@inkeep/open-knowledge 0.0.0-dev-20260501170533 → 0.0.0-dev-20260501181216

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cli.mjs +5 -5
  2. package/dist/config-schema.json +25 -0
  3. package/dist/config.project.schema.json +25 -0
  4. package/dist/config.user.schema.json +25 -0
  5. package/dist/constants-BnNhFY0P.mjs +2 -0
  6. package/dist/{dist-oDoSs1Bl.mjs → dist-BmX1Ns7C.mjs} +2 -2
  7. package/dist/{dist-BVnVlgjQ.mjs → dist-C5mH5cvM.mjs} +1 -1
  8. package/dist/{dist-CDuTCUx1.mjs → dist-CQ3cd3s_.mjs} +2 -2
  9. package/dist/index.d.mts +9 -0
  10. package/dist/index.mjs +1 -1
  11. package/dist/{init-CPq6B11A.mjs → init-CAeQdWL6.mjs} +3 -3
  12. package/dist/init-CCYsXS_y.mjs +1 -0
  13. package/dist/init-CIM4I1tW.mjs +1 -0
  14. package/dist/{init-Bf7LOYAr.mjs → init-DHwfj3AW.mjs} +2 -2
  15. package/dist/{loader-C79dNoU-.mjs → loader-CC_RQ-w2.mjs} +2 -2
  16. package/dist/loader-DqreB0_J.mjs +1 -0
  17. package/dist/paths-1NW3UxwQ.mjs +1 -0
  18. package/dist/paths-BwrGhrga.mjs +2 -0
  19. package/dist/{preview-AXEdeZ4w.mjs → preview-B-rYWHOQ.mjs} +2 -2
  20. package/dist/preview-Sf_RYYpl.mjs +1 -0
  21. package/dist/public/assets/{ActivityModeContent-CCJOMAyp.js → ActivityModeContent-Cdl0frU2.js} +1 -1
  22. package/dist/public/assets/{DocumentContext-BHFNw5NZ.js → DocumentContext-BRyrYElZ.js} +1 -1
  23. package/dist/public/assets/{GraphPanel-BuZEMdl-.js → GraphPanel-BH5vs7kB.js} +1 -1
  24. package/dist/public/assets/{OutlinePanel-CnKUM65X.js → OutlinePanel-BcdH74Qw.js} +1 -1
  25. package/dist/public/assets/{SettingsPane-B3rEEyMP.js → SettingsPane-rdUN7cCp.js} +1 -1
  26. package/dist/public/assets/{SourceEditor-CE_X9auW.js → SourceEditor-Df4RyC-2.js} +1 -1
  27. package/dist/public/assets/{config-validation-events-DqfR4UtM.js → config-validation-events-CWaXc07D.js} +1 -1
  28. package/dist/public/assets/{index-NVu982rh.js → index-DN_1M53F.js} +70 -70
  29. package/dist/public/assets/{target-navigation-intent-1238Z_HW.js → target-navigation-intent-CIITpiPs.js} +1 -1
  30. package/dist/public/assets/{toggle-group-C5MXNna8.js → toggle-group-1sl8rMnA.js} +1 -1
  31. package/dist/public/assets/{tooltip-BMlqVI54.js → tooltip-CFeKxs4p.js} +1 -1
  32. package/dist/public/index.html +7 -7
  33. package/dist/schemas/v0/config.project.schema.json +25 -0
  34. package/dist/schemas/v0/config.user.schema.json +25 -0
  35. package/dist/{server-Cb1yd7Zc.mjs → server-CJdOKLcU.mjs} +2 -2
  36. package/dist/src-8G0QyHkY.mjs +1 -0
  37. package/dist/start-BlAW3ifD.mjs +1 -0
  38. package/dist/{start-Dl1pApAn.mjs → start-CrKpyaZC.mjs} +2 -2
  39. package/package.json +1 -1
  40. package/dist/constants-B8HpPaWG.mjs +0 -2
  41. package/dist/init-BhfL8UL0.mjs +0 -1
  42. package/dist/init-DkzHwyzJ.mjs +0 -1
  43. package/dist/loader-5abUX3Eq.mjs +0 -1
  44. package/dist/paths-BIsyTDX6.mjs +0 -1
  45. package/dist/paths-Drz5vBVF.mjs +0 -2
  46. package/dist/preview-DUYE2XxR.mjs +0 -1
  47. package/dist/src-CPe0c6hz.mjs +0 -1
  48. package/dist/start-COO3npTl.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DF7KVxgp.js","./chunk-DECur_0Z.js","./propagation-api-LnD10wq2.js","./trace-api-CbLDdnQA.js","./McpConsentDialogBody-CI9rAMX9.js","./button-Dyz7QGIk.js","./compiler-runtime-Y11fyRVL.js","./dialog-FUclf-NK.js","./mcp-consent-store-B9QLSyUV.js","./ActivityPanelDiffView-C1vRNF09.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BuZEMdl-.js","./toggle-group-C5MXNna8.js","./w3c-keyname-B5t0fahT.js","./tooltip-BMlqVI54.js","./panel-DT62BXGr.js","./target-navigation-intent-1238Z_HW.js","./circle-check-C-DpX4dU.js","./ActivityModeContent-CCJOMAyp.js","./DocumentContext-BHFNw5NZ.js","./dist-oNAFjGrp.js","./dist-dkPJvrfr.js","./dist-RVD4DzGH.js","./agent-presence-BxT9uQ-C.js","./SourceEditor-CE_X9auW.js","./OutlinePanel-CnKUM65X.js","./SettingsPane-B3rEEyMP.js","./config-validation-events-DqfR4UtM.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r}from"./propagation-api-LnD10wq2.js";import{n as i,r as a,t as o}from"./compiler-runtime-Y11fyRVL.js";import{A as s,C as c,D as l,E as u,O as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,k as C,l as w,m as T,n as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"./panel-DT62BXGr.js";import{A as I,An as L,Bn as R,Dn as z,F as B,Fn as V,Gn as H,Gt as U,Hn as W,Ht as G,In as K,J as ee,Jn as q,Kn as te,Kt as ne,Ln as re,Lt as ie,Mn as ae,Nn as oe,On as se,Pn as ce,Q as le,Qt as ue,Rn as de,Rt as fe,T as pe,Un as me,V as he,Vn as ge,Vt as _e,Wn as ve,Wt as ye,X as be,Xn as xe,Y as Se,Yn as Ce,Z as we,Zt as Te,_ as Ee,_n as De,a as Oe,an as ke,at as Ae,bt as je,ct as Me,dn as Ne,f as Pe,ft as Fe,g as Ie,gn as Le,gt as Re,ht as ze,i as Be,it as Ve,jn as He,k as Ue,kn as We,kt as Ge,l as Ke,ln as qe,lt as Je,n as Ye,o as Xe,on as Ze,p as Qe,pt as $e,q as et,qn as tt,r as nt,rt,t as it,u as at,vn as ot,vt as st,w as ct,xt as lt,zn as ut}from"./toggle-group-C5MXNna8.js";import{C as dt,S as J,_ as ft,a as pt,b as mt,c as ht,d as gt,g as _t,h as vt,i as yt,l as bt,m as xt,n as St,o as Ct,p as wt,r as Y,s as Tt,t as X,x as Et,y as Dt}from"./button-Dyz7QGIk.js";import{$ as Ot,A as kt,At,B as jt,Bt as Mt,C as Nt,Ct as Pt,D as Ft,Dt as It,E as Lt,Et as Rt,F as zt,Ft as Bt,G as Vt,H as Ht,I as Ut,K as Wt,L as Gt,Lt as Kt,M as qt,Mt as Jt,N as Yt,Nt as Xt,O as Zt,Ot as Qt,P as $t,Pt as en,Q as tn,Rt as nn,S as rn,St as an,T as on,Tt as sn,U as cn,V as ln,W as un,Y as dn,Z as fn,_ as pn,_t as mn,a as hn,b as gn,bt as _n,c as vn,d as yn,et as bn,f as xn,g as Sn,gt as Cn,ht as wn,i as Tn,j as En,jt as Dn,k as On,kt as kn,l as An,n as jn,o as Mn,q as Nn,r as Pn,rt as Fn,s as In,t as Ln,tt as Rn,u as zn,v as Bn,vt as Vn,w as Hn,wt as Un,x as Wn,xt as Gn,y as Kn,yt as qn,z as Jn,zt as Yn}from"./DocumentContext-BHFNw5NZ.js";import{a as Xn,c as Zn,d as Qn,f as $n,i as er,l as tr,m as nr,n as rr,o as ir,p as ar,r as or,s as sr,t as cr,u as lr}from"./agent-presence-BxT9uQ-C.js";import{a as ur,c as dr,i as fr,l as pr,o as mr,r as hr,s as gr,t as _r,u as vr}from"./config-validation-events-DqfR4UtM.js";import{n as yr,r as br,t as xr}from"./target-navigation-intent-1238Z_HW.js";import{t as Sr}from"./circle-check-C-DpX4dU.js";import{S as Cr,_ as wr,a as Tr,b as Er,c as Dr,f as Or,g as kr,h as Ar,i as jr,l as Mr,m as Nr,n as Pr,o as Fr,p as Ir,r as Lr,s as Rr,t as zr,u as Br,v as Vr,x as Hr,y as Ur}from"./dialog-FUclf-NK.js";import{i as Wr,n as Gr,r as Kr,t as qr}from"./tooltip-BMlqVI54.js";import{n as Jr,t as Yr}from"./mcp-consent-store-B9QLSyUV.js";import{At as Xr,C as Zr,Dt as Qr,Et as $r,F as ei,Ft as ti,Nt as ni,O as ri,Pt as ii,Q as ai,St as oi,X as si,Y as ci,Z as li,it as ui,jt as di,kt as fi,q as pi,wt as mi,yt as hi}from"./dist-dkPJvrfr.js";import{n as gi,r as _i,s as vi,t as yi}from"./OutlinePanel-CnKUM65X.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 bi(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&r(()=>import(`./telemetry-impl-DF7KVxgp.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3]),import.meta.url)}function xi(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=>{b(e,()=>t.signal,()=>n=!0)},u=F(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?M:m;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ci:Si,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:Si(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 Si(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 Ci(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var wi=class extends y{#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||Ti(),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=D({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),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ti(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ei=class extends s{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 wi({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=Di(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=Di(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=Di(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=Di(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.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=>c(t,e))}findAll(e={}){return this.getAll().filter(t=>c(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(p))))}};function Di(e){return e.options.scope?.id}var Oi=class extends s{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({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(){x.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=>N(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>N(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ki=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Oi,this.#t=e.mutationCache||new Ei,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=C.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=T.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(l(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=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.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;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(p).catch(p)}invalidateQueries(e,t={}){return x.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=x.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(p)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(p)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(p).catch(p)}fetchInfiniteQuery(e){return e.behavior=xi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(p).catch(p)}ensureInfiniteQueryData(e){return e.behavior=xi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return T.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(P(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{u(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(P(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{u(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||=f(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===d&&(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()}},Ai=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}}}})),ji=n(((e,t)=>{t.exports=Ai()})),Mi=n((e=>{var t=ji(),n=i(),r=dt();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 ee(){B(H),B(U),B(W)}function q(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-DF7KVxgp.js","./chunk-DECur_0Z.js","./propagation-api-LnD10wq2.js","./trace-api-CbLDdnQA.js","./McpConsentDialogBody-CI9rAMX9.js","./button-Dyz7QGIk.js","./compiler-runtime-Y11fyRVL.js","./dialog-FUclf-NK.js","./mcp-consent-store-B9QLSyUV.js","./ActivityPanelDiffView-C1vRNF09.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BH5vs7kB.js","./toggle-group-1sl8rMnA.js","./w3c-keyname-B5t0fahT.js","./tooltip-CFeKxs4p.js","./panel-DT62BXGr.js","./target-navigation-intent-CIITpiPs.js","./circle-check-C-DpX4dU.js","./ActivityModeContent-Cdl0frU2.js","./DocumentContext-BRyrYElZ.js","./dist-oNAFjGrp.js","./dist-dkPJvrfr.js","./dist-RVD4DzGH.js","./agent-presence-BxT9uQ-C.js","./SourceEditor-Df4RyC-2.js","./OutlinePanel-BcdH74Qw.js","./SettingsPane-rdUN7cCp.js","./config-validation-events-CWaXc07D.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./chunk-DECur_0Z.js";import{i as r}from"./propagation-api-LnD10wq2.js";import{n as i,r as a,t as o}from"./compiler-runtime-Y11fyRVL.js";import{A as s,C as c,D as l,E as u,O as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,k as C,l as w,m as T,n as E,p as D,r as O,s as k,t as A,u as j,v as M,w as N,x as P,y as F}from"./panel-DT62BXGr.js";import{A as I,An as L,Bn as R,Dn as z,F as B,Fn as V,Gn as H,Gt as U,Hn as W,Ht as G,In as K,J as ee,Jn as q,Kn as te,Kt as ne,Ln as re,Lt as ie,Mn as ae,Nn as oe,On as se,Pn as ce,Q as le,Qt as ue,Rn as de,Rt as fe,T as pe,Un as me,V as he,Vn as ge,Vt as _e,Wn as ve,Wt as ye,X as be,Xn as xe,Y as Se,Yn as Ce,Z as we,Zt as Te,_ as Ee,_n as De,a as Oe,an as ke,at as Ae,bt as je,ct as Me,dn as Ne,f as Pe,ft as Fe,g as Ie,gn as Le,gt as Re,ht as ze,i as Be,it as Ve,jn as He,k as Ue,kn as We,kt as Ge,l as Ke,ln as qe,lt as Je,n as Ye,o as Xe,on as Ze,p as Qe,pt as $e,q as et,qn as tt,r as nt,rt,t as it,u as at,vn as ot,vt as st,w as ct,xt as lt,zn as ut}from"./toggle-group-1sl8rMnA.js";import{C as dt,S as J,_ as ft,a as pt,b as mt,c as ht,d as gt,g as _t,h as vt,i as yt,l as bt,m as xt,n as St,o as Ct,p as wt,r as Y,s as Tt,t as X,x as Et,y as Dt}from"./button-Dyz7QGIk.js";import{$ as Ot,A as kt,At,B as jt,Bt as Mt,C as Nt,Ct as Pt,D as Ft,Dt as It,E as Lt,Et as Rt,F as zt,Ft as Bt,G as Vt,H as Ht,I as Ut,K as Wt,L as Gt,Lt as Kt,M as qt,Mt as Jt,N as Yt,Nt as Xt,O as Zt,Ot as Qt,P as $t,Pt as en,Q as tn,Rt as nn,S as rn,St as an,T as on,Tt as sn,U as cn,V as ln,W as un,Y as dn,Z as fn,_ as pn,_t as mn,a as hn,b as gn,bt as _n,c as vn,d as yn,et as bn,f as xn,g as Sn,gt as Cn,ht as wn,i as Tn,j as En,jt as Dn,k as On,kt as kn,l as An,n as jn,o as Mn,q as Nn,r as Pn,rt as Fn,s as In,t as Ln,tt as Rn,u as zn,v as Bn,vt as Vn,w as Hn,wt as Un,x as Wn,xt as Gn,y as Kn,yt as qn,z as Jn,zt as Yn}from"./DocumentContext-BRyrYElZ.js";import{a as Xn,c as Zn,d as Qn,f as $n,i as er,l as tr,m as nr,n as rr,o as ir,p as ar,r as or,s as sr,t as cr,u as lr}from"./agent-presence-BxT9uQ-C.js";import{a as ur,c as dr,i as fr,l as pr,o as mr,r as hr,s as gr,t as _r,u as vr}from"./config-validation-events-CWaXc07D.js";import{n as yr,r as br,t as xr}from"./target-navigation-intent-CIITpiPs.js";import{t as Sr}from"./circle-check-C-DpX4dU.js";import{S as Cr,_ as wr,a as Tr,b as Er,c as Dr,f as Or,g as kr,h as Ar,i as jr,l as Mr,m as Nr,n as Pr,o as Fr,p as Ir,r as Lr,s as Rr,t as zr,u as Br,v as Vr,x as Hr,y as Ur}from"./dialog-FUclf-NK.js";import{i as Wr,n as Gr,r as Kr,t as qr}from"./tooltip-CFeKxs4p.js";import{n as Jr,t as Yr}from"./mcp-consent-store-B9QLSyUV.js";import{At as Xr,C as Zr,Dt as Qr,Et as $r,F as ei,Ft as ti,Nt as ni,O as ri,Pt as ii,Q as ai,St as oi,X as si,Y as ci,Z as li,it as ui,jt as di,kt as fi,q as pi,wt as mi,yt as hi}from"./dist-dkPJvrfr.js";import{n as gi,r as _i,s as vi,t as yi}from"./OutlinePanel-BcdH74Qw.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 bi(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&r(()=>import(`./telemetry-impl-DF7KVxgp.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3]),import.meta.url)}function xi(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=>{b(e,()=>t.signal,()=>n=!0)},u=F(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?M:m;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ci:Si,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:Si(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 Si(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 Ci(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var wi=class extends y{#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||Ti(),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=D({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),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ti(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ei=class extends s{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 wi({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=Di(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=Di(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=Di(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=Di(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.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=>c(t,e))}findAll(e={}){return this.getAll().filter(t=>c(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(p))))}};function Di(e){return e.options.scope?.id}var Oi=class extends s{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new v({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(){x.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=>N(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>N(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ki=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Oi,this.#t=e.mutationCache||new Ei,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=C.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=T.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(l(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=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.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;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(p).catch(p)}invalidateQueries(e,t={}){return x.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=x.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(p)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(p)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(p).catch(p)}fetchInfiniteQuery(e){return e.behavior=xi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(p).catch(p)}ensureInfiniteQueryData(e){return e.behavior=xi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return T.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(P(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{u(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(P(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{u(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||=f(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===d&&(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()}},Ai=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}}}})),ji=n(((e,t)=>{t.exports=Ai()})),Mi=n((e=>{var t=ji(),n=i(),r=dt();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 ee(){B(H),B(U),B(W)}function q(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,25 +10,25 @@ 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===``||Mt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Mt(e,``+r);break;case`className`:vt(e,`class`,r);break;case`tabIndex`:vt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:vt(e,n,r);break;case`style`:Ft(e,r,o);break;case`data`:if(t!==`object`){vt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=zt(``+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=zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Bt);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=zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),_t(e,`popover`,r);break;case`xlinkActuate`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:_t(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Lt.get(n)||n,_t(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:Ft(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`?Mt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Mt(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=Bt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ut.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[Xe]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):_t(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,o,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Md(e,t,r,d,n,null)}}Dt(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&&kt(e,!!r,n,!0):kt(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)}jt(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(It(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)}}Et(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?kt(e,!!n,n?[]:``,!1):kt(e,!!n,t,!0)):kt(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)}At(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(It(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[nt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),rt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[nt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=at(e);t!==null&&t.tag===5&&t.type===`form`?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=X(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ct(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+X(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+X(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+X(n.imageSizes)+`"]`)):i+=`[href="`+X(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ct(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+X(r)+`"][href="`+X(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ct(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=st(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ct(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=st(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=st(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ct(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=W.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=st(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=st(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=st(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+X(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ct(t),e.head.appendChild(t))}function Pf(e){return`[src="`+X(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~="`+X(n.href)+`"]`);if(r)return t.instance=r,ct(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ct(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,ct(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,ct(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),ct(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[nt]||a[Ye]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ct(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:x,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Re(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Re(0),this.hiddenUpdates=Re(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=Ji(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Da(a),e}function tp(e){return e?(e=qr,e):qr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Aa(e,r,t),n!==null&&(fu(n,e,t),ja(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Wr(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=We(t);var n=Wr(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=at(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ne(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ee(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=me()+500,nd(0,!1))}}break;case 31:case 13:s=Wr(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Ht(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=it(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(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=at(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=it(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,qe(e.priority,function(){op(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,qe(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Vt=r,n.target.dispatchEvent(r),Vt=null}else return t=at(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=at(n);a!==null&&(e.splice(t,3),t-=3,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[Xe]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Xe]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[Ze]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ke();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(a(527,Lp,`19.2.5`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{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[Ze]=t.current,xd(e),new Fp(t)}})),Ni=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=Mi()})),Pi=J(`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`}]]),Fi=J(`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`}]]),Ii=J(`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`}]]),Li=J(`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`}]]),Ri=J(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Z=a(),Q=t(i(),1),zi=t(dt(),1),Bi=Ni(),$=o(),Vi=[[`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`}]];J(`bot`,Vi);var Hi=J(`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`}]]),Ui=J(`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`}]]),Wi=J(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Gi=J(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Ki=J(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),qi=J(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ji=J(`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`}]]),Yi=J(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Xi=J(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Zi=J(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Qi=J(`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`}]]),$i=J(`contrast`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 18a6 6 0 0 0 0-12v12z`,key:`j4l70d`}]]),ea=J(`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`}]]),ta=J(`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`}]]),na=J(`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`}]]),ra=J(`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`}]]),ia=J(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),aa=J(`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`}]]),oa=J(`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`}]]),sa=J(`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`}]]),ca=J(`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`}]]),la=J(`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`}]]),ua=J(`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`}]]),da=J(`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`}]]),fa=J(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),pa=J(`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`}]]),ma=J(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),ha=J(`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`}]]),ga=J(`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`}]]),_a=J(`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`}]]),va=[[`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`}]],ya=J(`link-2`,va),ba=J(`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`}]]),xa=J(`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`}]]),Sa=J(`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`}]]),Ca=J(`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`}]]),wa=J(`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`}]]),Ta=J(`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`}]]),Ea=J(`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`}]]),Da=J(`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`}]]),Oa=J(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),ka=J(`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`}]]),Aa=J(`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`}]]),ja=J(`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`}]]),Ma=J(`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`}]]),Na=J(`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`}]]),Pa=J(`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`}]]),Fa=J(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),Ia=J(`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`}]]),La=J(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ra=J(`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`}]]),za=J(`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`}]]),Ba=J(`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`}]]),Va=J(`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`}]]),Ha=J(`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`}]]),Ua=J(`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`}]]),Wa=J(`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`}]]),Ga=J(`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`}]]),Ka=J(`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`}]]),qa=J(`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`}]]),Ja=J(`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`}]]),Ya=J(`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`}]]),Xa=J(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),Za=J(`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`}]]),Qa=J(`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`}]]),$a=J(`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 eo(e,t){return e instanceof Error&&e.message?e.message:t}async function to(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(eo(e,t))}}async function no(e,t,n=Hr,r=`action`){await to(e,t,e=>{e!==null&&n.error(e)},r)}async function ro(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}function io(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 ao(){return{async status(e){let t=e?.host??`github.com`,n=await ro(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t};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 ro(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:`Failed to fetch repositories`};let r=io(await n.text());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 oo(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function so(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 co(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 lo(){return{start(){return co((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||!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await so(n.body,t=>{try{let n=JSON.parse(t);if(e(n),n.type===`complete`||n.type===`error`)return`terminal`}catch{}return`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 uo(e){return{start(){return e.localOp.auth.start()}}}function fo(){return{start(e){return co((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||!r.body){t({type:`error`,message:`Clone failed — check the URL and try again`});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())try{t(JSON.parse(e))}catch{}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 po(e){return{start(t){return e.localOp.clone.start(t)}}}var mo=`Checkbox`,[ho,go]=wt(mo),[_o,vo]=ho(mo);function yo(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=bt({prop:n,defaultProp:i??!1,onChange:c,caller:mo}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:Oo(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,Z.jsx)(_o,{scope:t,...b,children:Do(d)?d(b):r})}var bo=`CheckboxTrigger`,xo=Q.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=vo(bo,e),h=mt(i,u),g=Q.useRef(c);return Q.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,Z.jsx)(xt.button,{type:`button`,role:`checkbox`,"aria-checked":Oo(c)?`mixed`:c,"aria-required":l,"data-state":ko(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:gt(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:gt(n,e=>{d(e=>Oo(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});xo.displayName=bo;var So=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Z.jsx)(yo,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xo,{...d,ref:t,__scopeCheckbox:n}),e&&(0,Z.jsx)(Eo,{__scopeCheckbox:n})]})})});So.displayName=mo;var Co=`CheckboxIndicator`,wo=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=vo(Co,n);return(0,Z.jsx)(ht,{present:r||Oo(a.checked)||a.checked===!0,children:(0,Z.jsx)(xt.span,{"data-state":ko(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});wo.displayName=Co;var To=`CheckboxBubbleInput`,Eo=Q.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=vo(To,e),m=mt(n,p),h=an(a),g=H(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Oo(a),n.call(e,Oo(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(Oo(a)?!1:a);return(0,Z.jsx)(xt.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Eo.displayName=To;function Do(e){return typeof e==`function`}function Oo(e){return e===`indeterminate`}function ko(e){return Oo(e)?`indeterminate`:e?`checked`:`unchecked`}var Ao=[`Enter`,` `],jo=[`ArrowDown`,`PageUp`,`Home`],Mo=[`ArrowUp`,`PageDown`,`End`],No=[...jo,...Mo],Po={ltr:[...Ao,`ArrowRight`],rtl:[...Ao,`ArrowLeft`]},Fo={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Io=`Menu`,[Lo,Ro,zo]=tt(Io),[Bo,Vo]=wt(Io,[zo,ce,We]),Ho=ce(),Uo=We(),[Wo,Go]=Bo(Io),[Ko,qo]=Bo(Io),Jo=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ho(t),[c,l]=Q.useState(null),u=Q.useRef(!1),d=Ct(a),f=te(i);return Q.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,Z.jsx)(oe,{...s,children:(0,Z.jsx)(Wo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Z.jsx)(Ko,{scope:t,onClose:Q.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Jo.displayName=Io;var Yo=`MenuAnchor`,Xo=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ho(n);return(0,Z.jsx)(L,{...i,...r,ref:t})});Xo.displayName=Yo;var Zo=`MenuPortal`,[Qo,$o]=Bo(Zo,{forceMount:void 0}),es=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Go(Zo,t);return(0,Z.jsx)(Qo,{scope:t,forceMount:n,children:(0,Z.jsx)(ht,{present:n||a.open,children:(0,Z.jsx)(yt,{asChild:!0,container:i,children:r})})})};es.displayName=Zo;var ts=`MenuContent`,[ns,rs]=Bo(ts),is=Q.forwardRef((e,t)=>{let n=$o(ts,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Go(ts,e.__scopeMenu),o=qo(ts,e.__scopeMenu);return(0,Z.jsx)(Lo.Provider,{scope:e.__scopeMenu,children:(0,Z.jsx)(ht,{present:r||a.open,children:(0,Z.jsx)(Lo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Z.jsx)(as,{...i,ref:t}):(0,Z.jsx)(os,{...i,ref:t})})})})}),as=Q.forwardRef((e,t)=>{let n=Go(ts,e.__scopeMenu),r=Q.useRef(null),i=mt(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return kr(e)},[]),(0,Z.jsx)(cs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gt(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),os=Q.forwardRef((e,t)=>{let n=Go(ts,e.__scopeMenu);return(0,Z.jsx)(cs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ss=ft(`MenuContent.ScrollLock`),cs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Go(ts,n),_=qo(ts,n),v=Ho(n),y=Uo(n),b=Ro(n),[x,S]=Q.useState(null),C=Q.useRef(null),w=mt(t,C,g.onContentChange),T=Q.useRef(0),E=Q.useRef(``),D=Q.useRef(0),O=Q.useRef(null),k=Q.useRef(`right`),A=Q.useRef(0),j=m?wr:Q.Fragment,M=m?{as:ss,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ks(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};Q.useEffect(()=>()=>window.clearTimeout(T.current),[]),Vr();let P=Q.useCallback(e=>k.current===O.current?.side&&Js(e,O.current?.area),[]);return(0,Z.jsx)(ns,{scope:n,searchRef:E,onItemEnter:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Q.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:Q.useCallback(e=>{O.current=e},[]),children:(0,Z.jsx)(j,{...M,children:(0,Z.jsx)(Ur,{asChild:!0,trapped:i,onMountAutoFocus:gt(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Z.jsx)(pt,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Z.jsx)(se,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:gt(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Z.jsx)(ae,{role:`menu`,"aria-orientation":`vertical`,"data-state":Vs(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:gt(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!No.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Mo.includes(e.key)&&a.reverse(),Ws(a)}),onBlur:gt(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:gt(e.onPointerMove,Ys(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});is.displayName=ts;var ls=`MenuGroup`,us=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{role:`group`,...r,ref:t})});us.displayName=ls;var ds=`MenuLabel`,fs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{...r,ref:t})});fs.displayName=ds;var ps=`MenuItem`,ms=`menu.itemSelect`,hs=Q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Q.useRef(null),o=qo(ps,e.__scopeMenu),s=rs(ps,e.__scopeMenu),c=mt(t,a),l=Q.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ms,{bubbles:!0,cancelable:!0});e.addEventListener(ms,e=>r?.(e),{once:!0}),vt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Z.jsx)(gs,{...i,ref:c,disabled:n,onClick:gt(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:gt(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:gt(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ao.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});hs.displayName=ps;var gs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=rs(ps,n),s=Uo(n),c=Q.useRef(null),l=mt(t,c),[u,d]=Q.useState(!1),[f,p]=Q.useState(``);return Q.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,Z.jsx)(Lo.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Z.jsx)(z,{asChild:!0,...s,focusable:!r,children:(0,Z.jsx)(xt.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:gt(e.onPointerMove,Ys(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:gt(e.onPointerLeave,Ys(e=>o.onItemLeave(e))),onFocus:gt(e.onFocus,()=>d(!0)),onBlur:gt(e.onBlur,()=>d(!1))})})})}),_s=`MenuCheckboxItem`,vs=Q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Z.jsx)(Es,{scope:e.__scopeMenu,checked:n,children:(0,Z.jsx)(hs,{role:`menuitemcheckbox`,"aria-checked":Hs(n)?`mixed`:n,...i,ref:t,"data-state":Us(n),onSelect:gt(i.onSelect,()=>r?.(Hs(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vs.displayName=_s;var ys=`MenuRadioGroup`,[bs,xs]=Bo(ys,{value:void 0,onValueChange:()=>{}}),Ss=Q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ct(r);return(0,Z.jsx)(bs,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Z.jsx)(us,{...i,ref:t})})});Ss.displayName=ys;var Cs=`MenuRadioItem`,ws=Q.forwardRef((e,t)=>{let{value:n,...r}=e,i=xs(Cs,e.__scopeMenu),a=n===i.value;return(0,Z.jsx)(Es,{scope:e.__scopeMenu,checked:a,children:(0,Z.jsx)(hs,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Us(a),onSelect:gt(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ws.displayName=Cs;var Ts=`MenuItemIndicator`,[Es,Ds]=Bo(Ts,{checked:!1}),Os=Q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ds(Ts,n);return(0,Z.jsx)(ht,{present:r||Hs(a.checked)||a.checked===!0,children:(0,Z.jsx)(xt.span,{...i,ref:t,"data-state":Us(a.checked)})})});Os.displayName=Ts;var ks=`MenuSeparator`,As=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});As.displayName=ks;var js=`MenuArrow`,Ms=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ho(n);return(0,Z.jsx)(He,{...i,...r,ref:t})});Ms.displayName=js;var Ns=`MenuSub`,[Ps,Fs]=Bo(Ns),Is=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Go(Ns,t),o=Ho(t),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=Ct(i);return Q.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Z.jsx)(oe,{...o,children:(0,Z.jsx)(Wo,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Z.jsx)(Ps,{scope:t,contentId:Tt(),triggerId:Tt(),trigger:s,onTriggerChange:c,children:n})})})};Is.displayName=Ns;var Ls=`MenuSubTrigger`,Rs=Q.forwardRef((e,t)=>{let n=Go(Ls,e.__scopeMenu),r=qo(Ls,e.__scopeMenu),i=Fs(Ls,e.__scopeMenu),a=rs(Ls,e.__scopeMenu),o=Q.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return Q.useEffect(()=>u,[u]),Q.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,Z.jsx)(Xo,{asChild:!0,...l,children:(0,Z.jsx)(gs,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Vs(n.open),...e,ref:Dt(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:gt(e.onPointerMove,Ys(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:gt(e.onPointerLeave,Ys(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:gt(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Po[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Rs.displayName=Ls;var zs=`MenuSubContent`,Bs=Q.forwardRef((e,t)=>{let n=$o(ts,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Go(ts,e.__scopeMenu),o=qo(ts,e.__scopeMenu),s=Fs(zs,e.__scopeMenu),c=Q.useRef(null),l=mt(t,c);return(0,Z.jsx)(Lo.Provider,{scope:e.__scopeMenu,children:(0,Z.jsx)(ht,{present:r||a.open,children:(0,Z.jsx)(Lo.Slot,{scope:e.__scopeMenu,children:(0,Z.jsx)(cs,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:gt(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:gt(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:gt(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Fo[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Bs.displayName=zs;function Vs(e){return e?`open`:`closed`}function Hs(e){return e===`indeterminate`}function Us(e){return Hs(e)?`indeterminate`:e?`checked`:`unchecked`}function Ws(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Gs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ks(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Gs(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function qs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Js(e,t){return t?qs({x:e.clientX,y:e.clientY},t):!1}function Ys(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Xs=Jo,Zs=Xo,Qs=es,$s=is,ec=us,tc=fs,nc=hs,rc=vs,ic=Ss,ac=ws,oc=Os,sc=As,cc=Ms,lc=Is,uc=Rs,dc=Bs,fc=`DropdownMenu`,[pc,mc]=wt(fc,[Vo]),hc=Vo(),[gc,_c]=pc(fc),vc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=hc(t),l=Q.useRef(null),[u,d]=bt({prop:i,defaultProp:a??!1,onChange:o,caller:fc});return(0,Z.jsx)(gc,{scope:t,triggerId:Tt(),triggerRef:l,contentId:Tt(),open:u,onOpenChange:d,onOpenToggle:Q.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Z.jsx)(Xs,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};vc.displayName=fc;var yc=`DropdownMenuTrigger`,bc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=_c(yc,n),o=hc(n);return(0,Z.jsx)(Zs,{asChild:!0,...o,children:(0,Z.jsx)(xt.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Dt(t,a.triggerRef),onPointerDown:gt(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:gt(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});bc.displayName=yc;var xc=`DropdownMenuPortal`,Sc=e=>{let{__scopeDropdownMenu:t,...n}=e,r=hc(t);return(0,Z.jsx)(Qs,{...r,...n})};Sc.displayName=xc;var Cc=`DropdownMenuContent`,wc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_c(Cc,n),a=hc(n),o=Q.useRef(!1);return(0,Z.jsx)($s,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:gt(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:gt(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});wc.displayName=Cc;var Tc=`DropdownMenuGroup`,Ec=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ec,{...i,...r,ref:t})});Ec.displayName=Tc;var Dc=`DropdownMenuLabel`,Oc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(tc,{...i,...r,ref:t})});Oc.displayName=Dc;var kc=`DropdownMenuItem`,Ac=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(nc,{...i,...r,ref:t})});Ac.displayName=kc;var jc=`DropdownMenuCheckboxItem`,Mc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(rc,{...i,...r,ref:t})});Mc.displayName=jc;var Nc=`DropdownMenuRadioGroup`,Pc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ic,{...i,...r,ref:t})});Pc.displayName=Nc;var Fc=`DropdownMenuRadioItem`,Ic=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ac,{...i,...r,ref:t})});Ic.displayName=Fc;var Lc=`DropdownMenuItemIndicator`,Rc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(oc,{...i,...r,ref:t})});Rc.displayName=Lc;var zc=`DropdownMenuSeparator`,Bc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(sc,{...i,...r,ref:t})});Bc.displayName=zc;var Vc=`DropdownMenuArrow`,Hc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(cc,{...i,...r,ref:t})});Hc.displayName=Vc;var Uc=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=hc(t),[s,c]=bt({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,Z.jsx)(lc,{...o,open:s,onOpenChange:c,children:n})},Wc=`DropdownMenuSubTrigger`,Gc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(uc,{...i,...r,ref:t})});Gc.displayName=Wc;var Kc=`DropdownMenuSubContent`,qc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(dc,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});qc.displayName=Kc;var Jc=vc,Yc=bc,Xc=Sc,Zc=wc,Qc=Oc,$c=Ac,el=Pc,tl=Ic,nl=Rc,rl=Bc,il=Uc,al=Gc,ol=qc,sl=`Radio`,[cl,ll]=wt(sl),[ul,dl]=cl(sl),fl=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=mt(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(ul,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(xt.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":_l(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:gt(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(gl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});fl.displayName=sl;var pl=`RadioIndicator`,ml=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=dl(pl,n);return(0,Z.jsx)(ht,{present:r||a.checked,children:(0,Z.jsx)(xt.span,{"data-state":_l(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});ml.displayName=pl;var hl=`RadioBubbleInput`,gl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=mt(o,a),c=an(n),l=H(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)(xt.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}})});gl.displayName=hl;function _l(e){return e?`checked`:`unchecked`}var vl=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],yl=`RadioGroup`,[bl,xl]=wt(yl,[We,ll]),Sl=We(),Cl=ll(),[wl,Tl]=bl(yl),El=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=Sl(n),m=te(l),[h,g]=bt({prop:a,defaultProp:i??null,onChange:d,caller:yl});return(0,Z.jsx)(wl,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(se,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(xt.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});El.displayName=yl;var Dl=`RadioGroupItem`,Ol=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Tl(Dl,n),o=a.disabled||r,s=Sl(n),c=Cl(n),l=Q.useRef(null),u=mt(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{vl.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)(z,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(fl,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:gt(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:gt(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ol.displayName=Dl;var kl=`RadioGroupIndicator`,Al=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(ml,{...Cl(n),...r,ref:t})});Al.displayName=kl;var jl=El,Ml=Ol,Nl=Al,Pl=`Separator`,Fl=`horizontal`,Il=[`horizontal`,`vertical`],Ll=Q.forwardRef((e,t)=>{let{decorative:n,orientation:r=Fl,...i}=e,a=Rl(r)?r:Fl,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Z.jsx)(xt.div,{"data-orientation":a,...o,...i,ref:t})});Ll.displayName=Pl;function Rl(e){return Il.includes(e)}var zl=Ll;async function Bl(e){try{await navigator.clipboard.writeText(e)}catch{}}var Vl=120*1e3;function Hl(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)(Vl),_=(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),Bl(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=Vl-(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:`noreferrer`,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 Bl(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 Ul(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||!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await so(t.body,e=>{try{let t=JSON.parse(e);if(t.type===`complete`)return n({login:t.login,name:t.name,email:t.email}),s(!1),`terminal`;if(t.type===`error`)return l(t.message),s(!1),`terminal`}catch{}return`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:`noreferrer`,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)(Gn,{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 Wl(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)(Gn,{"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)(Gn,{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 Gl(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??lo(),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),Hr.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/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({setIdentity:{name:e,email:t}})}).catch(Kl);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),Hr.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),Hr.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)(Rr,{children:(0,Z.jsx)(Dr,{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)(Hl,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(Ul,{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)(Wl,{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)(Pr,{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)(jr,{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)(zr,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function Kl(){}function ql(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 Jl(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 Yl(e){let t=(0,$.c)(86),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s}=e,c;t[0]===o?c=t[1]:(c=o??fo(),t[0]=o,t[1]=c);let l=c,u;t[2]===s?u=t[3]:(u=s??ao(),t[2]=s,t[3]=u);let d=u,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O;t[4]!==n||t[5]!==d?(O=()=>{if(!n)return;let e=!1;return d.status().then(t=>{e||C(t.authenticated)}).catch(()=>{e||C(!1)}),()=>{e=!0}},t[4]=n,t[5]=d,t[6]=O):O=t[6];let k;t[7]===n?k=t[8]:(k=[n],t[7]=n,t[8]=k),(0,Q.useEffect)(O,k);let A;t[9]!==S||t[10]!==n||t[11]!==d?(A=()=>{if(!S||!n)return;let e=!1;return y(!0),d.repos().then(t=>{e||(_(t.ok?t.repos:[]),y(!1))}).catch(()=>{e||(_([]),y(!1))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=d,t[12]=A):A=t[12];let j;t[13]!==S||t[14]!==n?(j=[S,n],t[13]=S,t[14]=n,t[15]=j):j=t[15],(0,Q.useEffect)(A,j);let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){p(e);let t=Jl(e);t&&h(`~/Documents/${t}`)},t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){p(e.clone_url);let t=e.full_name.split(`/`)[1];h(`~/Documents/${t}`)},t[17]=P):P=t[17];let F=P,I;t[18]!==m||t[19]!==a||t[20]!==r||t[21]!==l||t[22]!==f?(I=async function(){if(!f.trim()){Hr.error(`Enter a repository URL or owner/repo`);return}T(!0);let e=Hr.loading(`Starting clone…`,{duration:1/0});D.current=e;let t=l.start({url:f.trim(),dir:m||``});E.current=t.cancel;try{let n=t.events[Symbol.asyncIterator](),i=await n.next();for(;!i.done;){let t=i.value;if(t.type===`progress`)Hr.loading(`${ql(t.phase)} — ${t.pct}%`,{id:e});else if(t.type===`complete`){Hr.success(`Clone complete — opening project`,{id:e}),r(!1),T(!1),E.current=null;let n=`port`in t?t.port:void 0;a?a({port:n,dir:t.dir}):n!==void 0&&(window.location.href=`http://localhost:${n}`);return}else if(t.type===`error`){Hr.error(`Clone failed: ${t.message}`,{id:e}),T(!1),E.current=null;return}i=await n.next()}Hr.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:e}),T(!1),E.current=null}catch(t){console.error(`[CloneDialog] clone iteration failed:`,t),Hr.error(`Clone failed — connection error`,{id:e}),T(!1),E.current=null}},t[18]=m,t[19]=a,t[20]=r,t[21]=l,t[22]=f,t[23]=I):I=t[23];let L=I,R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(){E.current?.(),E.current=null,T(!1),Hr.dismiss(D.current??void 0)},t[24]=R):R=t[24];let z=R,B;t[25]!==w||t[26]!==r?(B=function(e){w||(r(e),e||(p(``),h(``),x(``)))},t[25]=w,t[26]=r,t[27]=B):B=t[27];let V=B,H,U,W,G,K,ee,q,te,ne,re;if(t[28]!==w||t[29]!==V||t[30]!==S||t[31]!==v||t[32]!==n||t[33]!==b||t[34]!==g||t[35]!==f){let e=g?.filter(e=>e.full_name.toLowerCase().includes(b.toLowerCase()));W=zr,ne=n,re=V,U=jr,q=`sm:max-w-lg`,t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Rr,{children:(0,Z.jsx)(Dr,{children:`Clone from GitHub`})}),t[46]=te):te=t[46],H=Pr,G=`flex flex-col gap-4`;let r;t[47]===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[47]=r):r=t[47];let i;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(i=e=>N(e.target.value),t[48]=i):i=t[48],t[49]!==w||t[50]!==f?(K=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(Gn,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:f,onChange:i,disabled:w})]}),t[49]=w,t[50]=f,t[51]=K):K=t[51],ee=S&&(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)(Gn,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories…`,value:b,onChange:e=>x(e.target.value),disabled:w||v&&g===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":v&&g===null,children:v&&g===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(ur,{className:`h-4 w-2/3`}),(0,Z.jsx)(ur,{className:`h-4 w-1/2`}),(0,Z.jsx)(ur,{className:`h-4 w-3/4`}),(0,Z.jsx)(ur,{className:`h-4 w-2/5`}),(0,Z.jsx)(ur,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:g?.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:()=>F(e),disabled:w,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[28]=w,t[29]=V,t[30]=S,t[31]=v,t[32]=n,t[33]=b,t[34]=g,t[35]=f,t[36]=H,t[37]=U,t[38]=W,t[39]=G,t[40]=K,t[41]=ee,t[42]=q,t[43]=te,t[44]=ne,t[45]=re}else H=t[36],U=t[37],W=t[38],G=t[39],K=t[40],ee=t[41],q=t[42],te=t[43],ne=t[44],re=t[45];let ie;t[52]!==w||t[53]!==S||t[54]!==i?(ie=!S&&(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:w,children:`Sign in to GitHub`})]}),t[52]=w,t[53]=S,t[54]=i,t[55]=ie):ie=t[55];let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),t[56]=ae):ae=t[56];let oe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>h(e.target.value),t[57]=oe):oe=t[57];let se;t[58]!==w||t[59]!==m?(se=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[ae,(0,Z.jsx)(Gn,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:m,onChange:oe,disabled:w})]}),t[58]=w,t[59]=m,t[60]=se):se=t[60];let ce;t[61]!==G||t[62]!==K||t[63]!==ee||t[64]!==ie||t[65]!==se?(ce=(0,Z.jsxs)(`div`,{className:G,children:[K,ee,ie,se]}),t[61]=G,t[62]=K,t[63]=ee,t[64]=ie,t[65]=se,t[66]=ce):ce=t[66];let le;t[67]!==H||t[68]!==ce?(le=(0,Z.jsx)(H,{children:ce}),t[67]=H,t[68]=ce,t[69]=le):le=t[69];let ue;t[70]!==w||t[71]!==L||t[72]!==V||t[73]!==f?(ue=(0,Z.jsx)(Fr,{children:w?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:z,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>V(!1),children:`Cancel`}),(0,Z.jsx)(X,{onClick:()=>void L(),disabled:!f.trim(),children:`Clone`})]})}),t[70]=w,t[71]=L,t[72]=V,t[73]=f,t[74]=ue):ue=t[74];let de;t[75]!==U||t[76]!==q||t[77]!==te||t[78]!==le||t[79]!==ue?(de=(0,Z.jsxs)(U,{className:q,children:[te,le,ue]}),t[75]=U,t[76]=q,t[77]=te,t[78]=le,t[79]=ue,t[80]=de):de=t[80];let fe;return t[81]!==W||t[82]!==ne||t[83]!==re||t[84]!==de?(fe=(0,Z.jsx)(W,{open:ne,onOpenChange:re,children:de}),t[81]=W,t[82]=ne,t[83]=re,t[84]=de,t[85]=fe):fe=t[85],fe}function Xl(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 Zl(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 Ql=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-CI9rAMX9.js`),__vite__mapDeps([4,1,5,6,7,8]),import.meta.url));function $l(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Jr.subscribe,tu,eu))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)(Ql,{})}),e[0]=t):t=e[0],t}function eu(){return!1}function tu(){return Jr.getSnapshot()!==null}var nu=(e,t,n)=>to(e,t,n,`NavigatorApp`);function ru(e){let t=(0,$.c)(62),{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)(`auth`),v;t[1]===n.project?v=t[2]:(v=()=>{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]=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=(e,t)=>nu(e,t,l),t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(!0),t[6]=S):S=t[6];let C=S,w;t[7]===n?w=t[8]:(w=()=>x(async()=>{let e=await n.dialog.openFolder();e&&await ou(n,e)},`Failed to open folder.`),t[7]=n,t[8]=w);let T=w,E;t[9]===n?E=t[10]:(E=()=>x(async()=>{let e=await n.dialog.createFolder();e&&await ou(n,e)},`Failed to create project folder.`),t[9]=n,t[10]=E);let D=E,O;t[11]===n?O=t[12]:(O=e=>x(async()=>{await ou(n,e)},`Failed to open project.`),t[11]=n,t[12]=O);let k=O,A=`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background p-12 pb-2 text-foreground max-w-5xl space-y-10 mx-auto ${!o&&i.length===0?`justify-center`:``}`,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Zl,{className:`size-12 shrink-0`}),t[13]=j):j=t[13];let M;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),t[14]=M):M=t[14];let N;t[15]===n.appVersion?N=t[16]:(N=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[j,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[M,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[15]=n.appVersion,t[16]=N);let P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(iu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:C,dataTestId:`nav-clone`,Icon:Xl}),t[17]=P):P=t[17];let F;t[18]===T?F=t[19]:(F=(0,Z.jsx)(iu,{title:`Open folder on disk`,description:`Open an existing folder as a project.`,onClick:T,dataTestId:`nav-open`,Icon:en}),t[18]=T,t[19]=F);let I;t[20]===D?I=t[21]:(I=(0,Z.jsx)(iu,{title:`Start fresh`,description:`Create a new folder for a brand-new project.`,onClick:D,dataTestId:`nav-fresh`,Icon:mr}),t[20]=D,t[21]=I);let L;t[22]!==F||t[23]!==I?(L=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[P,F,I]}),t[22]=F,t[23]=I,t[24]=L):L=t[24];let R;t[25]===c?R=t[26]:(R=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[25]=c,t[26]=R);let z;t[27]!==o||t[28]!==k||t[29]!==i?(z=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)(Rt,{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)(au,{project:e,onOpen:()=>k(e.path)},e.path))})]}):null,t[27]=o,t[28]=k,t[29]=i,t[30]=z):z=t[30];let B;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)($l,{}),t[31]=B):B=t[31];let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{p(e),e||h(!1)},t[32]=V):V=t[32];let H;t[33]===n?H=t[34]:(H=uo(n),t[33]=n,t[34]=H);let U=g===`identity`,W;t[35]===m?W=t[36]:(W=()=>{p(!1),m&&(h(!1),d(!0))},t[35]=m,t[36]=W);let G;t[37]!==f||t[38]!==H||t[39]!==U||t[40]!==W?(G=(0,Z.jsx)(Gl,{open:f,onOpenChange:V,transport:H,identityPrompt:U,onSuccess:W}),t[37]=f,t[38]=H,t[39]=U,t[40]=W,t[41]=G):G=t[41];let K;t[42]===n?K=t[43]:(K=po(n),t[42]=n,t[43]=K);let ee;t[44]===n?ee=t[45]:(ee=oo(n),t[44]=n,t[45]=ee);let q;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>{d(!1),_(`auth`),h(!0),p(!0)},t[46]=q):q=t[46];let te;t[47]===n?te=t[48]:(te=e=>{let{dir:t}=e;x(()=>ou(n,t),`Failed to open cloned project.`)},t[47]=n,t[48]=te);let ne;t[49]!==u||t[50]!==K||t[51]!==ee||t[52]!==te?(ne=(0,Z.jsx)(Yl,{open:u,onOpenChange:d,transport:K,authQueryTransport:ee,onSignIn:q,onCloneComplete:te}),t[49]=u,t[50]=K,t[51]=ee,t[52]=te,t[53]=ne):ne=t[53];let re;return t[54]!==N||t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==G||t[59]!==ne||t[60]!==A?(re=(0,Z.jsxs)(`div`,{className:A,children:[N,L,R,z,B,G,ne]}),t[54]=N,t[55]=L,t[56]=R,t[57]=z,t[58]=G,t[59]=ne,t[60]=A,t[61]=re):re=t[61],re}function iu(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 au(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)(_n,{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 ou(e,t){await e.project.open({path:t,target:`new-window`})}var su=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=xe(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Sr,{className:`size-4`}),info:(0,Z.jsx)(At,{className:`size-4`}),warning:(0,Z.jsx)(q,{className:`size-4`}),error:(0,Z.jsx)(Da,{className:`size-4`}),loading:(0,Z.jsx)(Rt,{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)(Er,{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 cu(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(lu(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 lu(e,t){return e.startsWith(`/api/`)?t+e:e}function uu(e){return`#/${encodeURIComponent(e)}`}function du(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(uu(e.doc))})}function fu(e){let t=e.bridge;if(!t)return;let n=e.toastImpl??(e=>Hr.info(e));return t.onGitInitNotice(e=>{n(`Initialized git repo at ${e.gitDir}`)})}var pu=`Update ready`,mu=`Relaunch`,hu=`Release notes`,gu=`Updates paused`,_u=`Download`,vu=`Relaunch failed — please restart manually`;function yu(e){return`Updated to v${e}`}var bu=0,xu=1,Su=2,Cu=3;function wu(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:pu,priority:Su,action:{label:mu,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},()=>{t({id:`relaunch-error-${r}`,body:vu,variant:`error`,priority:xu})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:yu(n),priority:Cu,action:{label:hu,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:gu,priority:bu,action:{label:_u,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}var Tu=[],Eu=new Set,Du=!1;function Ou(){for(let e of Eu)e()}function ku(e){let t=Tu.findIndex(t=>t.id===e.id);if(t===-1)Tu=[...Tu,e];else{let n=Tu.slice();n[t]=e,Tu=n}Ou()}function Au(e){let t=Tu.filter(t=>t.id!==e);t.length!==Tu.length&&(Tu=t,Ou())}function ju(){return Tu}function Mu(e){return Eu.add(e),()=>{Eu.delete(e)}}function Nu(){if(Du||typeof window>`u`)return;let e=window.okDesktop;e&&(Du=!0,wu(e,ku,Au))}var Pu=1,Fu=.9,Iu=.8,Lu=.17,Ru=.1,zu=.999,Bu=.9999,Vu=.99,Hu=/[\\\/_+.#"@\[\(\{&]/,Uu=/[\\\/_+.#"@\[\(\{&]/g,Wu=/[\s-]/,Gu=/[\s-]/g;function Ku(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Pu:Vu;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Ku(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Pu:Hu.test(e.charAt(l-1))?(d*=Iu,p=e.slice(i,l-1).match(Uu),p&&i>0&&(d*=zu**+p.length)):Wu.test(e.charAt(l-1))?(d*=Fu,m=e.slice(i,l-1).match(Gu),m&&i>0&&(d*=zu**+m.length)):(d*=Lu,i>0&&(d*=zu**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Bu)),(d<Ru&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ku(e,t,n,r,l+1,a+2,o),f*Ru>d&&(d=f*Ru)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function qu(e){return e.toLowerCase().replace(Gu,` `)}function Ju(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ku(e,t,qu(e),qu(t),0,0,{})}var Yu=`[cmdk-group=""]`,Xu=`[cmdk-group-items=""]`,Zu=`[cmdk-group-heading=""]`,Qu=`[cmdk-item=""]`,$u=`${Qu}:not([aria-disabled="true"])`,ed=`cmdk-item-select`,td=`data-value`,nd=(e,t,n)=>Ju(e,t,n),rd=Q.createContext(void 0),id=()=>Q.useContext(rd),ad=Q.createContext(void 0),od=()=>Q.useContext(ad),sd=Q.createContext(void 0),cd=Q.forwardRef((e,t)=>{let n=Sd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Sd(()=>new Set),i=Sd(()=>new Map),a=Sd(()=>new Map),o=Sd(()=>new Set),s=bd(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Tt(),y=Tt(),b=Tt(),x=Q.useRef(null),S=Td();xd(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),xd(()=>{S(6,k)},[]);let C=Q.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Q.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??nd;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Xu);t?t.appendChild(e.parentElement===t?e:e.closest(`${Xu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Xu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Yu}[${td}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(td);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Yu)?.querySelector(Zu))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Qu}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll($u)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(td))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(td))}function P(e){let t=A()?.closest(Yu),n;for(;t&&!n;)t=e>0?vd(t,Yu):yd(t,Yu),n=t?.querySelector($u);n?C.setState(`value`,n.getAttribute(td)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Q.createElement(xt.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(ed);t.dispatchEvent(e)}}}}},Q.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Od},c),Dd(e,e=>Q.createElement(ad.Provider,{value:C},Q.createElement(rd.Provider,{value:w},e))))}),ld=Q.forwardRef((e,t)=>{let n=Tt(),r=Q.useRef(null),i=Q.useContext(sd),a=id(),o=bd(e),s=o.current?.forceMount??i?.forceMount;xd(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=wd(n,r,[e.value,e.children,r],e.keywords),l=od(),u=Cd(e=>e.value&&e.value===c.current),d=Cd(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);Q.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(ed,f),()=>t.removeEventListener(ed,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Q.createElement(xt.div,{ref:Dt(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),ud=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Tt(),s=Q.useRef(null),c=Q.useRef(null),l=Tt(),u=id(),d=Cd(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);xd(()=>u.group(o),[]),wd(o,s,[e.value,e.heading,c]);let f=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(xt.div,{ref:Dt(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&Q.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Dd(e,e=>Q.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Q.createElement(sd.Provider,{value:f},e))))}),dd=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),a=Cd(e=>!e.search);return!n&&!a?null:Q.createElement(xt.div,{ref:Dt(i,t),...r,"cmdk-separator":``,role:`separator`})}),fd=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=od(),o=Cd(e=>e.search),s=Cd(e=>e.selectedItemId),c=id();return Q.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Q.createElement(xt.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),pd=Q.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Q.useRef(null),o=Q.useRef(null),s=Cd(e=>e.selectedItemId),c=id();return Q.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(xt.div,{ref:Dt(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Dd(e,e=>Q.createElement(`div`,{ref:Dt(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),md=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Q.createElement(Nr,{open:n,onOpenChange:r},Q.createElement(Ir,{container:o},Q.createElement(Or,{"cmdk-overlay":``,className:i}),Q.createElement(Br,{"aria-label":e.label,"cmdk-dialog":``,className:a},Q.createElement(cd,{ref:t,...s}))))}),hd=Q.forwardRef((e,t)=>Cd(e=>e.filtered.count===0)?Q.createElement(xt.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),gd=Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Q.createElement(xt.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Dd(e,e=>Q.createElement(`div`,{"aria-hidden":!0},e)))}),_d=Object.assign(cd,{List:pd,Item:ld,Input:fd,Group:ud,Separator:dd,Dialog:md,Empty:hd,Loading:gd});function vd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function yd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function bd(e){let t=Q.useRef(e);return xd(()=>{t.current=e}),t}var xd=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function Sd(e){let t=Q.useRef();return t.current===void 0&&(t.current=e()),t}function Cd(e){let t=od(),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function wd(e,t,n,r=[]){let i=Q.useRef(),a=id();return xd(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(td,s),i.current=s}),i}var Td=()=>{let[e,t]=Q.useState(),n=Sd(()=>new Map);return xd(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ed(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Dd({asChild:e,children:t},n){return e&&Q.isValidElement(t)?Q.cloneElement(Ed(t),{ref:t.ref},n(t.props.children)):n(t)}var Od={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function kd(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 flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ad(e){let t=(0,$.c)(26),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]):({title:a,description:o,children:n,className:r,showCloseButton:s,...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?`Command Palette`:a,l=o===void 0?`Search for a command to run…`:o,u=s===void 0?!0:s,d;t[7]===c?d=t[8]:(d=(0,Z.jsx)(Dr,{children:c}),t[7]=c,t[8]=d);let f;t[9]===l?f=t[10]:(f=(0,Z.jsx)(Tr,{children:l}),t[9]=l,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(Rr,{className:`sr-only`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===r?m=t[15]:(m=Y(`overflow-hidden p-0`,r),t[14]=r,t[15]=m);let h;t[16]===n?h=t[17]:(h=(0,Z.jsx)(kd,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n}),t[16]=n,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Z.jsx)(jr,{className:m,showCloseButton:u,children:h}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==i||t[23]!==p||t[24]!==g?(_=(0,Z.jsxs)(zr,{...i,children:[p,g]}),t[22]=i,t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function jd(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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(La,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Y(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,Z.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[i,(0,Z.jsx)(_d.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function Md(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(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nd(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(_d.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Pd(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(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fd(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 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Separator,{"data-slot":`command-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Id(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(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ld(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(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rd=`Switch Project…`,zd=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`}],Bd=`#settings`;function Vd(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function Hd(e){let t=e.replace(/^#/,``);return t===`settings`||t===`settings/project`?`project`:t===`settings/user`?`user`:null}function Ud(e){return`#settings/${e}`}function Wd(){return typeof window>`u`?``:window.location.hash}function Gd(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(qd),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(Hd(Wd()))};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=Kd,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{if(typeof window>`u`)return;let t=Ud(e);if(window.location.hash===t)return;let{pathname:r,search:i}=window.location;window.history.replaceState(null,``,`${r}${i}${t}`),n(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={scope:t,close:a,setScope:s},e[3]=t,e[4]=c),c}function Kd(){typeof window>`u`||Hd(Wd())!==null&&window.history.back()}function qd(){return Hd(Wd())}function Jd(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Zd),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(Xd);e&&t.ok&&r?.ok&&typeof r.contentDir==`string`&&(r.pathSeparator===`/`||r.pathSeparator===`\\`)&&n({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Yd),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Yd(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function Xd(){return null}function Zd(){return Qd()}function Qd(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 $d(e){return{async install(){let t;try{t=await e.buildAndOpen()}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return t.ok?{ok:!0,path:t.path}:{ok:!1,reason:t.reason,message:t.message}}}}function ef(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(){let e;try{e=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json(),r=typeof n.error==`string`?n.error:n.error?.message;r&&(t=r)}catch{}return{ok:!1,reason:`http-error`,message:t}}let r;try{r=await e.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!r||typeof r.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:r.status===`failed`?{ok:!1,reason:`build-failed`,message:r.buildError??`unknown build failure`}:{ok:!0,path:r.outputPath,handoffWarning:r.handoffError?.message}}}}function tf(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?$d(e):ef()}var nf=`ok:skill:cowork:installed`,rf=`1`;function af(e){return`${nf}:v${e}`}async function of(e){let t=sf(e.storage),n=e.installer===void 0?tf():e.installer,r=af(e.skillVersion);if(t?.getItem(r)===rf)return{kind:`already-installed`};if(!n)return{kind:`host-unsupported`};let i=await n.install();if(i.ok){try{t?.setItem(r,rf)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:i.path,handoffWarning:i.handoffWarning}}return{kind:`install-failed`,reason:i.reason,message:i.message}}function sf(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function cf(){return{skillVersion:(typeof window<`u`?window.okDesktop:void 0)?.appVersion??`unknown`}}function lf(){return of(cf())}async function uf(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:df(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:df(e)}}}function df(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var ff=1e3,pf=1500;function mf(e){return new Promise(t=>setTimeout(t,e))}async function hf(e,t={}){let n=t.spawnCursor??(typeof window<`u`?window.okDesktop?.shell.spawnCursor:void 0);if(!n)return{ok:!1,reason:`web-host-cursor-unsupported`};let r=await n(e.projectDir);if(!r.ok)return gf(r.reason);let i=t.isCursorRunning&&await t.isCursorRunning().catch(()=>!1)?ff:pf;return await(t.sleep??mf)(i),uf(le(e),t.openExternalDeps)}function gf(e){switch(e){case`not-installed`:return{ok:!1,reason:`not-installed`,detail:`cursor binary not found`};case`invalid-path`:return{ok:!1,reason:`invalid-payload`,detail:`cursor spawn: invalid path`};case`timeout`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: timeout`};case`spawn-error`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: spawn-error`};default:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: ${String(e)}`}}}async function _f(e,t={}){switch(e.target){case`claude-cowork`:return uf(be({mode:`cowork`},e),t.openExternalDeps);case`claude-code`:return uf(be({mode:`code`},e),t.openExternalDeps);case`codex`:return uf(we(e),t.openExternalDeps);case`cursor`:return hf(e,{...t.cursorDeps,openExternalDeps:t.cursorDeps?.openExternalDeps??t.openExternalDeps});default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function vf(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 yf(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function bf(e){return`${e}.md`}function xf(e){if(!e.docName||!e.workspace)return null;let t=bf(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:yf(n,t,r)}}function Sf(e){return`Opened in ${e}.`}function Cf(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 wf(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Tf(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 Ef(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:Ve(t.docContext)},a=await n.dispatchHandoff(i),o=Tf(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Sf(s));else{let i=wf(r),a=Cf(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Ef(e,t,n,r+1)}}})}return a}function Df(e){return zd.find(t=>t.id===e)?.displayName??e}function Of(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kf(){return{dispatchHandoff:_f,recordHandoff:vf,toast:{success:e=>{Hr.success(e)},error:(e,t)=>{Hr.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Of(),getDisplayName:Df,ensureCoworkSkillInstalled:lf}}function Af(){return{dispatch:(e,t)=>Ef(e,t,kf())}}var jf=[...new Set(zd.flatMap(e=>e.schemes))];function Mf(e,t){let n=t.now?.()??Date.now(),r={};for(let i of zd){if(!t.isElectronHost&&i.id===`cursor`){r[i.id]={installed:!1,lastChecked:n};continue}let a=i.schemes[0],o=a===void 0?void 0:e[a];if(!o){r[i.id]={installed:null};continue}r[i.id]={installed:o.installed,...o.displayName===void 0?{}:{displayName:o.displayName},lastChecked:n}}return r}function Nf(e){return Mf({},e)}async function Pf(e){let t=e.schemes??jf,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 Ff=Object.fromEntries(jf.map(e=>[e,{installed:!1}]));async function If(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 Ff}if(!t.ok)return Ff;let n;try{n=await t.json()}catch{return Ff}if(typeof n!=`object`||!n||Array.isArray(n))return Ff;let r=n,i={};for(let e of jf)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lf(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 Rf(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nf({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mf(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=!Lf(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 zf(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bf(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pf({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>If({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vf(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Hf),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rf(Bf());r.current=e;let t=e.subscribe(n);return e.probe(),()=>{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 Hf(){return Nf({isElectronHost:zf(),now:Date.now})}var Uf=(e,t,n)=>no(e,t,n,`CommandPalette`);function Wf(e){let t=(0,$.c)(49),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,s]=(0,Q.useState)(a),{activeDocName:c}=jn(),l=Jd(),{states:u,refresh:d}=Vf(),{dispatch:f}=Af(),p=xf({docName:c,workspace:l}),m;t[1]!==n.project||t[2]!==r||t[3]!==d?(m=()=>{if(!r)return;let e=!1;return Uf(async()=>{let t=await n.project.listRecent();e||s(t)},`Failed to load recent projects.`),d(),()=>{e=!0}},t[1]=n.project,t[2]=r,t[3]=d,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==r||t[7]!==d?(h=[r,n,d],t[5]=n,t[6]=r,t[7]=d,t[8]=h):h=t[8],(0,Q.useEffect)(m,h);let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`k`||e.key===`K`)&&(e.preventDefault(),i(Gf))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_=[],t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,Q.useEffect)(g,_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),Uf(async()=>{await e()},n)},t[11]=v):v=t[11];let y=v,b=n.config.projectPath,x;t[12]===b?x=t[13]:(x=e=>e.path!==b,t[12]=b,t[13]=x);let S=o.filter(x),C=Ad,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(jd,{placeholder:`Type a command or search recent projects…`}),t[14]=w):w=t[14];let T=Md,E;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(Nd,{children:`No matching commands.`}),t[15]=E):E=t[15];let D;t[16]!==n.dialog||t[17]!==n.project?(D=()=>y(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})}),t[16]=n.dialog,t[17]=n.project,t[18]=D):D=t[18];let O,k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(en,{}),k=(0,Z.jsx)(`span`,{children:`Open folder on disk…`}),A=(0,Z.jsx)(Ld,{children:`⌘O`}),t[19]=O,t[20]=k,t[21]=A):(O=t[19],k=t[20],A=t[21]);let j;t[22]===D?j=t[23]:(j=(0,Z.jsxs)(Id,{onSelect:D,"data-testid":`command-palette-open-folder`,children:[O,k,A]}),t[22]=D,t[23]=j);let M;t[24]===n.navigator?M=t[25]:(M=()=>y(()=>n.navigator.open(),`Failed to open Project Navigator.`),t[24]=n.navigator,t[25]=M);let N,P,F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(_a,{}),P=(0,Z.jsx)(`span`,{children:Rd}),F=(0,Z.jsx)(Ld,{children:`⌘⇧N`}),t[26]=N,t[27]=P,t[28]=F):(N=t[26],P=t[27],F=t[28]);let I;t[29]===M?I=t[30]:(I=(0,Z.jsxs)(Id,{value:`switch-project navigator projects`,onSelect:M,"data-testid":`command-palette-switch-project`,children:[N,P,F]}),t[29]=M,t[30]=I);let L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Bd)},t[31]=L):L=t[31];let R;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(Id,{value:`settings preferences config`,onSelect:L,"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Ra,{}),(0,Z.jsx)(`span`,{children:`Settings…`}),(0,Z.jsx)(Ld,{children:`⌘,`})]}),t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{i(!1),window.location.hash=`#install-claude-desktop`},t[33]=z):z=t[33];let B;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Id,{onSelect:z,"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(gr,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)…`})]}),t[34]=B):B=t[34];let V;t[35]!==j||t[36]!==I?(V=(0,Z.jsxs)(Pd,{heading:`Project`,children:[j,I,R,B]}),t[35]=j,t[36]=I,t[37]=V):V=t[37];let H=c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{}),(0,Z.jsx)(Pd,{heading:`Open in agent`,children:zd.map(e=>{let t=u[e.id],n=t.installed===!0&&p!==null,r=t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:p===null?`No active doc`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(Id,{value:`open-in-agent ${e.id} ${e.displayName}`,disabled:!n,onSelect:()=>{!n||!p||(i(!1),f(e.id,p))},"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,U=S.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{}),(0,Z.jsx)(Pd,{heading:`Recent projects`,children:S.slice(0,10).map(e=>(0,Z.jsxs)(Id,{value:`${e.name} ${e.path}`,disabled:e.missing,onSelect:()=>y(()=>n.project.open({path:e.path,target:`new-window`})),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Z.jsx)(ar,{}),(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,W;t[38]!==T||t[39]!==E||t[40]!==V||t[41]!==H||t[42]!==U?(W=(0,Z.jsxs)(T,{className:`subtle-scrollbar`,children:[E,V,H,U]}),t[38]=T,t[39]=E,t[40]=V,t[41]=H,t[42]=U,t[43]=W):W=t[43];let G;return t[44]!==C||t[45]!==r||t[46]!==w||t[47]!==W?(G=(0,Z.jsxs)(C,{open:r,onOpenChange:i,title:`Project Command Palette`,description:`Open a folder, switch to a recent project, or open the Project Navigator.`,children:[w,W]}),t[44]=C,t[45]=r,t[46]=w,t[47]=W,t[48]=G):G=t[48],G}function Gf(e){return!e}var Kf=500;function qf(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Jf(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 Yf(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=jn(),[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),Kf);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=qf(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Jf(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/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}var Xf=`raw-mdx-nav`,Zf=`ok-editor-mode-v1`,Qf=[`wysiwyg`,`source`],$f=`wysiwyg`;function ep(e){return Qf.includes(e)}function tp(e=localStorage){try{let t=e.getItem(Zf);if(t===null)return $f;if(ep(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return $f}function np(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return ep(n)?n:tp(t)}function rp(e,t=localStorage){try{return t.setItem(Zf,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function ip(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(np),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),rp(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}async function ap(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function op(){return sp().status}function sp(){let e=(0,$.c)(8),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ap().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,Q.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Xe(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,Q.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}function cp(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=op();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)(q,{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 lp=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 up(e,t,n,r,i,a){if(e==r)return[];let o=bp(e,t,n,r,i,a),s=xp(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 lp(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new lp(t,t+o,i,i),new lp(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 lp(t,t,i,i+o),new lp(n,n,i+o+c,a)]}if(c==1||l==1)return[new lp(t,n,i,a)];let u=Cp(e,t,n,r,i,a);if(u){let[o,s,c]=u;return up(e,t,o,r,i,s).concat(up(e,o+c,n,r,s+c,a))}return mp(e,t,n,r,i,a)}var dp=1e9,fp=0,pp=!1;function mp(e,t,n,r,i,a){let o=n-t,s=a-i;if(dp<1e9&&Math.min(o,s)>dp*16||fp>0&&Date.now()>fp)return Math.min(o,s)>dp*64?[new lp(t,n,i,a)]:wp(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);gp.reset(c),_p.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:_p,f=d?null:gp;for(let p=0;p<c;p++){if(p>dp||fp>0&&!(p&63)&&Date.now()>fp)return wp(e,t,n,r,i,a);let m=gp.advance(p,o,s,c,d,!1,l)||_p.advance(p,o,s,c,f,!0,u);if(m)return vp(e,t,n,t+m[0],r,i,a,i+m[1])}return[new lp(t,n,i,a)]}var hp=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}},gp=new hp,_p=new hp;function vp(e,t,n,r,i,a,o,s){let c=!1;return!zp(e,r)&&++r==n&&(c=!0),!zp(i,s)&&++s==o&&(c=!0),c?[new lp(t,n,a,o)]:up(e,t,r,i,a,s).concat(up(e,r,n,i,s,o))}function yp(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function bp(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=yp(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-+!zp(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function xp(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=yp(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-+!zp(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Sp(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;;){zp(e,s)||s++;let u=s+o;if(zp(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=bp(e,u,n,r,i+f+d.length,a),c=xp(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 Cp(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Cp(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Sp(e,t,n,r,i,a,Math.floor(o/4),-1)}function wp(e,t,n,r,i,a){pp=!0;let o=n-t,s=a-i,c;if(o<s){let s=Sp(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Sp(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new lp(t,n,i,a)];let[l,u,d]=c;return up(e,t,l,r,i,u).concat(up(e,l+d,n,r,u+d,a))}function Tp(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 lp(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Ep(e,t,n){for(;;){Tp(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=bp(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new lp(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=xp(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new lp(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 lp(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 lp(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Dp(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=Pp(t,a.fromA,l),f=Np(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 lp(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Np(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new lp(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Pp(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new lp(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Ip(n,a.fromB,a.toB),r,o=t<0?-1:Fp(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=Ip(t,a.fromA,a.toA),r,o=n<0?-1:Fp(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 Tp(e,3),e}var Op;try{Op=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function kp(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Ap(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!kp(n):Op?!Lp(n)||t==e.length-1?+!!Op.test(String.fromCharCode(n)):Op.test(e.slice(t,t+2))?2:0:0}function jp(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!kp(n):Op?!Rp(n)||t==1?+!!Op.test(String.fromCharCode(n)):Op.test(e.slice(t-2,t))?2:0:0}var Mp=8;function Np(e,t,n){if(t==e.length||!jp(e,t))return t;for(let r=t,i=t+n,a=0;a<Mp;a++){let t=Ap(e,r);if(!t||r+t>i)return r;r+=t}return t}function Pp(e,t,n){if(!t||!Ap(e,t))return t;for(let r=t,i=t-n,a=0;a<Mp;a++){let t=jp(e,r);if(!t||r-t<i)return r;r-=t}return t}function Fp(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Ip(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Lp=e=>e>=55296&&e<=56319,Rp=e=>e>=56320&&e<=57343;function zp(e,t){return!t||t==e.length||!Lp(e.charCodeAt(t-1))||!Rp(e.charCodeAt(t))}function Bp(e,t,n){let r=n?.override;return r?r(e,t):(dp=(n?.scanLimit??1e9)>>1,fp=n?.timeout?Date.now()+n.timeout:0,pp=!1,Ep(e,t,up(e,0,e.length,t,0,t.length)))}function Vp(){return!pp}function Hp(e,t,n){return Dp(Bp(e,t,n),e,t)}var Up=Qr.define({combine:e=>e[0]}),Wp=ni.define(),Gp=Qr.define(),Kp=ii.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Wp)&&(e=n.value);for(let n of t.state.facet(Gp))e=n(e,t);return e}});function qp(e){let t=e.field(Kp,!1);if(!t)return null;let n=e.facet(Up);return{chunks:t,side:n?n.side:null}}var Jp=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 Zp(Hp(e.toString(),t.toString(),n),e,t,0,0,Vp())}static updateA(e,t,n,r,i){return tm(em(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return tm(em(e,r,!1,t.length),e,t,n,i)}};function Yp(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 Xp(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 Zp(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Yp(c.fromA+r,c.fromB+i,t,n),[d,f]=Xp(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]=Yp(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]=Xp(a.toA+r,a.toB+i,t,n),s++}o.push(new Jp(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Qp=1e3;function $p(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 em(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>Qp&&([l,d]=$p(e,a-Qp,n,!0)),o<t.length-Qp&&([u,f]=$p(e,o+Qp,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 tm(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=Hp(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Zp(h,n,r,d,f,Vp()))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 nm={scanLimit:500},rm=li.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=pm(e))}update(e){(e.docChanged||e.viewportChanged||am(e.startState,e.state)||om(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=pm(e.view))}},{decorations:e=>e.deco}),im=fi.low(ui({class:`cm-changeGutter`,markers:e=>e.plugin(rm)?.gutter||Xr.empty}));function am(e,t){return e.field(Kp,!1)!=t.field(Kp,!1)}function om(e,t){return e.facet(Up)!=t.facet(Up)}var sm=pi.line({class:`cm-changedLine`}),cm=pi.mark({class:`cm-changedText`}),lm=pi.mark({tagName:`ins`,class:`cm-insertedLine`}),um=pi.mark({tagName:`del`,class:`cm-deletedLine`}),dm=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function fm(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,sm),i.add(o,s,n?um:lm),a&&a.add(o,o,dm);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,sm),a&&a.add(u,u,dm);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,cm),s<t)c++;else break}u=t}}}function pm(e){let t=e.state.field(Kp),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Up),o=n==`a`,s=new di,c=i?new di: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))&&fm(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var mm=class extends ai{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}},hm=ni.define({map:(e,t)=>e.map(t)}),gm=ii.define({create:()=>pi.none,update:(e,t)=>{for(let e of t.effects)if(e.is(hm))return e.value;return e.map(t.changes)},provide:e=>ci.decorations.from(e)}),_m=.01;function vm(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 ym(e,t,n){let r=new di,i=new di,a=e.state.field(gm).iter(),o=t.state.field(gm).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<-_m?(l-=n,r.add(s,s,pi.widget({widget:new mm(-n),block:!0,side:-1}))):n>_m&&(u+=n,i.add(c,c,pi.widget({widget:new mm(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<_m?r.add(e.state.doc.length,e.state.doc.length,pi.widget({widget:new mm(-p),block:!0,side:1})):p>_m&&i.add(t.state.doc.length,t.state.doc.length,pi.widget({widget:new mm(p),block:!0,side:1}));let m=r.finish(),h=i.finish();vm(m,e.state.field(gm))||e.dispatch({effects:hm.of(m)}),vm(h,t.state.field(gm))||t.dispatch({effects:hm.of(h)})}var bm=ni.define({map:(e,t)=>t.mapPos(e)}),xm=class extends ai{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:bm.of(n)});let{side:r,sibling:i}=e.state.facet(Up);i&&i().dispatch({effects:bm.of(Sm(n,e.state.field(Kp),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Sm(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 Cm=ii.define({create(e){return pi.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(bm)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ci.decorations.from(e)});function wm({margin:e=3,minSize:t=4}){return Cm.init(n=>Tm(n,e,t))}function Tm(e,t,n){let r=new di,i=e.facet(Up).side==`a`,a=e.field(Kp),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,pi.replace({widget:new xm(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Em=ci.styleModule.of(new hi({".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`}})),Dm=ci.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`}}),Om=new mi,km=new mi,Am=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||nm;let t=[fi.low(rm),Dm,Em,gm,ci.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(hm)))&&this.measure()})],n=[Up.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(im);let r=$r.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ci.editorAttributes.of({class:`cm-merge-a`}),km.of(n),t]}),i=[Up.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(im);let a=$r.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ci.editorAttributes.of({class:`cm-merge-b`}),km.of(i),t]});this.chunks=Jp.build(r.doc,a.doc,this.diffConf);let o=[Kp.init(()=>this.chunks),Om.of(e.collapseUnchanged?wm(e.collapseUnchanged):[])];r=r.update({effects:ni.appendConfig.of(o)}).state,a=a.update({effects:ni.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 ci({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ci({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),oi.empty(e[0].startState.doc.length));this.chunks=t==this.a?Jp.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Jp.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Wp.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Wp.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(Up),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(km.reconfigure([Up.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?im:[]])),a.push(km.reconfigure([Up.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?im:[]]))}if(r){let t=Om.reconfigure(e.collapseUnchanged?wm(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(){ym(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=jm(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=jm(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 jm(e){let t=e.nextSibling;return e.remove(),t}var Mm=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Nm=fi.low(ui({class:`cm-changeGutter`,markers:e=>e.plugin(rm)?.gutter||Xr.empty,widgetMarker:(e,t)=>t instanceof Rm?Mm:null}));function Pm(e){let t=typeof e.original==`string`?ti.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||nm;return[fi.low(rm),Um,Dm,ci.editorAttributes.of({class:`cm-merge-b`}),Gp.of((e,t)=>{let r=t.effects.find(e=>e.is(Fm));return r&&(e=Jp.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Jp.updateB(e,t.state.field(Im),t.newDoc,t.changes,n)),e}),Up.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Ym:void 0,side:`b`}),Im.init(()=>t),e.gutter===!1?[]:Nm,e.collapseUnchanged?wm(e.collapseUnchanged):[],Kp.init(e=>Jp.build(t,e.doc,n))]}var Fm=ni.define(),Im=ii.define({create:()=>ti.empty,update(e,t){for(let n of t.effects)n.is(Fm)&&(e=n.value.doc);return e}}),Lm=new WeakMap,Rm=class extends ai{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 zm(e,t,n){let r=Lm.get(t.changes);if(r)return r;let i=pi.widget({block:!0,side:-1,widget:new Rm(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Up),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(),Bm(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Vm(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(Im).sliceString(t.fromA,t.endA),u=a&&e.facet(ri),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())try{t(JSON.parse(e))}catch{}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 po(e){return{start(t){return e.localOp.clone.start(t)}}}var mo=`Checkbox`,[ho,go]=wt(mo),[_o,vo]=ho(mo);function yo(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=bt({prop:n,defaultProp:i??!1,onChange:c,caller:mo}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v=Q.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:Oo(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,Z.jsx)(_o,{scope:t,...b,children:Do(d)?d(b):r})}var bo=`CheckboxTrigger`,xo=Q.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=vo(bo,e),h=mt(i,u),g=Q.useRef(c);return Q.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,Z.jsx)(xt.button,{type:`button`,role:`checkbox`,"aria-checked":Oo(c)?`mixed`:c,"aria-required":l,"data-state":ko(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:gt(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:gt(n,e=>{d(e=>Oo(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});xo.displayName=bo;var So=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Z.jsx)(yo,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xo,{...d,ref:t,__scopeCheckbox:n}),e&&(0,Z.jsx)(Eo,{__scopeCheckbox:n})]})})});So.displayName=mo;var Co=`CheckboxIndicator`,wo=Q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=vo(Co,n);return(0,Z.jsx)(ht,{present:r||Oo(a.checked)||a.checked===!0,children:(0,Z.jsx)(xt.span,{"data-state":ko(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});wo.displayName=Co;var To=`CheckboxBubbleInput`,Eo=Q.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=vo(To,e),m=mt(n,p),h=an(a),g=H(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Oo(a),n.call(e,Oo(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(Oo(a)?!1:a);return(0,Z.jsx)(xt.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Eo.displayName=To;function Do(e){return typeof e==`function`}function Oo(e){return e===`indeterminate`}function ko(e){return Oo(e)?`indeterminate`:e?`checked`:`unchecked`}var Ao=[`Enter`,` `],jo=[`ArrowDown`,`PageUp`,`Home`],Mo=[`ArrowUp`,`PageDown`,`End`],No=[...jo,...Mo],Po={ltr:[...Ao,`ArrowRight`],rtl:[...Ao,`ArrowLeft`]},Fo={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Io=`Menu`,[Lo,Ro,zo]=tt(Io),[Bo,Vo]=wt(Io,[zo,ce,We]),Ho=ce(),Uo=We(),[Wo,Go]=Bo(Io),[Ko,qo]=Bo(Io),Jo=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ho(t),[c,l]=Q.useState(null),u=Q.useRef(!1),d=Ct(a),f=te(i);return Q.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,Z.jsx)(oe,{...s,children:(0,Z.jsx)(Wo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Z.jsx)(Ko,{scope:t,onClose:Q.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Jo.displayName=Io;var Yo=`MenuAnchor`,Xo=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ho(n);return(0,Z.jsx)(L,{...i,...r,ref:t})});Xo.displayName=Yo;var Zo=`MenuPortal`,[Qo,$o]=Bo(Zo,{forceMount:void 0}),es=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Go(Zo,t);return(0,Z.jsx)(Qo,{scope:t,forceMount:n,children:(0,Z.jsx)(ht,{present:n||a.open,children:(0,Z.jsx)(yt,{asChild:!0,container:i,children:r})})})};es.displayName=Zo;var ts=`MenuContent`,[ns,rs]=Bo(ts),is=Q.forwardRef((e,t)=>{let n=$o(ts,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Go(ts,e.__scopeMenu),o=qo(ts,e.__scopeMenu);return(0,Z.jsx)(Lo.Provider,{scope:e.__scopeMenu,children:(0,Z.jsx)(ht,{present:r||a.open,children:(0,Z.jsx)(Lo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Z.jsx)(as,{...i,ref:t}):(0,Z.jsx)(os,{...i,ref:t})})})})}),as=Q.forwardRef((e,t)=>{let n=Go(ts,e.__scopeMenu),r=Q.useRef(null),i=mt(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return kr(e)},[]),(0,Z.jsx)(cs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gt(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),os=Q.forwardRef((e,t)=>{let n=Go(ts,e.__scopeMenu);return(0,Z.jsx)(cs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ss=ft(`MenuContent.ScrollLock`),cs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Go(ts,n),_=qo(ts,n),v=Ho(n),y=Uo(n),b=Ro(n),[x,S]=Q.useState(null),C=Q.useRef(null),w=mt(t,C,g.onContentChange),T=Q.useRef(0),E=Q.useRef(``),D=Q.useRef(0),O=Q.useRef(null),k=Q.useRef(`right`),A=Q.useRef(0),j=m?wr:Q.Fragment,M=m?{as:ss,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ks(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};Q.useEffect(()=>()=>window.clearTimeout(T.current),[]),Vr();let P=Q.useCallback(e=>k.current===O.current?.side&&Js(e,O.current?.area),[]);return(0,Z.jsx)(ns,{scope:n,searchRef:E,onItemEnter:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:Q.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:Q.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:Q.useCallback(e=>{O.current=e},[]),children:(0,Z.jsx)(j,{...M,children:(0,Z.jsx)(Ur,{asChild:!0,trapped:i,onMountAutoFocus:gt(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Z.jsx)(pt,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Z.jsx)(se,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:gt(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Z.jsx)(ae,{role:`menu`,"aria-orientation":`vertical`,"data-state":Vs(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:gt(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!No.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Mo.includes(e.key)&&a.reverse(),Ws(a)}),onBlur:gt(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:gt(e.onPointerMove,Ys(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});is.displayName=ts;var ls=`MenuGroup`,us=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{role:`group`,...r,ref:t})});us.displayName=ls;var ds=`MenuLabel`,fs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{...r,ref:t})});fs.displayName=ds;var ps=`MenuItem`,ms=`menu.itemSelect`,hs=Q.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=Q.useRef(null),o=qo(ps,e.__scopeMenu),s=rs(ps,e.__scopeMenu),c=mt(t,a),l=Q.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ms,{bubbles:!0,cancelable:!0});e.addEventListener(ms,e=>r?.(e),{once:!0}),vt(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Z.jsx)(gs,{...i,ref:c,disabled:n,onClick:gt(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:gt(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:gt(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Ao.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});hs.displayName=ps;var gs=Q.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=rs(ps,n),s=Uo(n),c=Q.useRef(null),l=mt(t,c),[u,d]=Q.useState(!1),[f,p]=Q.useState(``);return Q.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,Z.jsx)(Lo.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Z.jsx)(z,{asChild:!0,...s,focusable:!r,children:(0,Z.jsx)(xt.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:gt(e.onPointerMove,Ys(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:gt(e.onPointerLeave,Ys(e=>o.onItemLeave(e))),onFocus:gt(e.onFocus,()=>d(!0)),onBlur:gt(e.onBlur,()=>d(!1))})})})}),_s=`MenuCheckboxItem`,vs=Q.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Z.jsx)(Es,{scope:e.__scopeMenu,checked:n,children:(0,Z.jsx)(hs,{role:`menuitemcheckbox`,"aria-checked":Hs(n)?`mixed`:n,...i,ref:t,"data-state":Us(n),onSelect:gt(i.onSelect,()=>r?.(Hs(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vs.displayName=_s;var ys=`MenuRadioGroup`,[bs,xs]=Bo(ys,{value:void 0,onValueChange:()=>{}}),Ss=Q.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Ct(r);return(0,Z.jsx)(bs,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Z.jsx)(us,{...i,ref:t})})});Ss.displayName=ys;var Cs=`MenuRadioItem`,ws=Q.forwardRef((e,t)=>{let{value:n,...r}=e,i=xs(Cs,e.__scopeMenu),a=n===i.value;return(0,Z.jsx)(Es,{scope:e.__scopeMenu,checked:a,children:(0,Z.jsx)(hs,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Us(a),onSelect:gt(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ws.displayName=Cs;var Ts=`MenuItemIndicator`,[Es,Ds]=Bo(Ts,{checked:!1}),Os=Q.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ds(Ts,n);return(0,Z.jsx)(ht,{present:r||Hs(a.checked)||a.checked===!0,children:(0,Z.jsx)(xt.span,{...i,ref:t,"data-state":Us(a.checked)})})});Os.displayName=Ts;var ks=`MenuSeparator`,As=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Z.jsx)(xt.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});As.displayName=ks;var js=`MenuArrow`,Ms=Q.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ho(n);return(0,Z.jsx)(He,{...i,...r,ref:t})});Ms.displayName=js;var Ns=`MenuSub`,[Ps,Fs]=Bo(Ns),Is=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Go(Ns,t),o=Ho(t),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=Ct(i);return Q.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Z.jsx)(oe,{...o,children:(0,Z.jsx)(Wo,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Z.jsx)(Ps,{scope:t,contentId:Tt(),triggerId:Tt(),trigger:s,onTriggerChange:c,children:n})})})};Is.displayName=Ns;var Ls=`MenuSubTrigger`,Rs=Q.forwardRef((e,t)=>{let n=Go(Ls,e.__scopeMenu),r=qo(Ls,e.__scopeMenu),i=Fs(Ls,e.__scopeMenu),a=rs(Ls,e.__scopeMenu),o=Q.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=Q.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return Q.useEffect(()=>u,[u]),Q.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,Z.jsx)(Xo,{asChild:!0,...l,children:(0,Z.jsx)(gs,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Vs(n.open),...e,ref:Dt(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:gt(e.onPointerMove,Ys(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:gt(e.onPointerLeave,Ys(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:gt(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Po[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Rs.displayName=Ls;var zs=`MenuSubContent`,Bs=Q.forwardRef((e,t)=>{let n=$o(ts,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Go(ts,e.__scopeMenu),o=qo(ts,e.__scopeMenu),s=Fs(zs,e.__scopeMenu),c=Q.useRef(null),l=mt(t,c);return(0,Z.jsx)(Lo.Provider,{scope:e.__scopeMenu,children:(0,Z.jsx)(ht,{present:r||a.open,children:(0,Z.jsx)(Lo.Slot,{scope:e.__scopeMenu,children:(0,Z.jsx)(cs,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:gt(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:gt(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:gt(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Fo[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Bs.displayName=zs;function Vs(e){return e?`open`:`closed`}function Hs(e){return e===`indeterminate`}function Us(e){return Hs(e)?`indeterminate`:e?`checked`:`unchecked`}function Ws(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Gs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ks(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Gs(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function qs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Js(e,t){return t?qs({x:e.clientX,y:e.clientY},t):!1}function Ys(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Xs=Jo,Zs=Xo,Qs=es,$s=is,ec=us,tc=fs,nc=hs,rc=vs,ic=Ss,ac=ws,oc=Os,sc=As,cc=Ms,lc=Is,uc=Rs,dc=Bs,fc=`DropdownMenu`,[pc,mc]=wt(fc,[Vo]),hc=Vo(),[gc,_c]=pc(fc),vc=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=hc(t),l=Q.useRef(null),[u,d]=bt({prop:i,defaultProp:a??!1,onChange:o,caller:fc});return(0,Z.jsx)(gc,{scope:t,triggerId:Tt(),triggerRef:l,contentId:Tt(),open:u,onOpenChange:d,onOpenToggle:Q.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Z.jsx)(Xs,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};vc.displayName=fc;var yc=`DropdownMenuTrigger`,bc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=_c(yc,n),o=hc(n);return(0,Z.jsx)(Zs,{asChild:!0,...o,children:(0,Z.jsx)(xt.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Dt(t,a.triggerRef),onPointerDown:gt(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:gt(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});bc.displayName=yc;var xc=`DropdownMenuPortal`,Sc=e=>{let{__scopeDropdownMenu:t,...n}=e,r=hc(t);return(0,Z.jsx)(Qs,{...r,...n})};Sc.displayName=xc;var Cc=`DropdownMenuContent`,wc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=_c(Cc,n),a=hc(n),o=Q.useRef(!1);return(0,Z.jsx)($s,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:gt(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:gt(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});wc.displayName=Cc;var Tc=`DropdownMenuGroup`,Ec=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ec,{...i,...r,ref:t})});Ec.displayName=Tc;var Dc=`DropdownMenuLabel`,Oc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(tc,{...i,...r,ref:t})});Oc.displayName=Dc;var kc=`DropdownMenuItem`,Ac=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(nc,{...i,...r,ref:t})});Ac.displayName=kc;var jc=`DropdownMenuCheckboxItem`,Mc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(rc,{...i,...r,ref:t})});Mc.displayName=jc;var Nc=`DropdownMenuRadioGroup`,Pc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ic,{...i,...r,ref:t})});Pc.displayName=Nc;var Fc=`DropdownMenuRadioItem`,Ic=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(ac,{...i,...r,ref:t})});Ic.displayName=Fc;var Lc=`DropdownMenuItemIndicator`,Rc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(oc,{...i,...r,ref:t})});Rc.displayName=Lc;var zc=`DropdownMenuSeparator`,Bc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(sc,{...i,...r,ref:t})});Bc.displayName=zc;var Vc=`DropdownMenuArrow`,Hc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(cc,{...i,...r,ref:t})});Hc.displayName=Vc;var Uc=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=hc(t),[s,c]=bt({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,Z.jsx)(lc,{...o,open:s,onOpenChange:c,children:n})},Wc=`DropdownMenuSubTrigger`,Gc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(uc,{...i,...r,ref:t})});Gc.displayName=Wc;var Kc=`DropdownMenuSubContent`,qc=Q.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hc(n);return(0,Z.jsx)(dc,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});qc.displayName=Kc;var Jc=vc,Yc=bc,Xc=Sc,Zc=wc,Qc=Oc,$c=Ac,el=Pc,tl=Ic,nl=Rc,rl=Bc,il=Uc,al=Gc,ol=qc,sl=`Radio`,[cl,ll]=wt(sl),[ul,dl]=cl(sl),fl=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=mt(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(ul,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(xt.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":_l(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:gt(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(gl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});fl.displayName=sl;var pl=`RadioIndicator`,ml=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=dl(pl,n);return(0,Z.jsx)(ht,{present:r||a.checked,children:(0,Z.jsx)(xt.span,{"data-state":_l(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});ml.displayName=pl;var hl=`RadioBubbleInput`,gl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=mt(o,a),c=an(n),l=H(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)(xt.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}})});gl.displayName=hl;function _l(e){return e?`checked`:`unchecked`}var vl=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],yl=`RadioGroup`,[bl,xl]=wt(yl,[We,ll]),Sl=We(),Cl=ll(),[wl,Tl]=bl(yl),El=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=Sl(n),m=te(l),[h,g]=bt({prop:a,defaultProp:i??null,onChange:d,caller:yl});return(0,Z.jsx)(wl,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(se,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(xt.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});El.displayName=yl;var Dl=`RadioGroupItem`,Ol=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Tl(Dl,n),o=a.disabled||r,s=Sl(n),c=Cl(n),l=Q.useRef(null),u=mt(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{vl.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)(z,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(fl,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:gt(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:gt(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ol.displayName=Dl;var kl=`RadioGroupIndicator`,Al=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(ml,{...Cl(n),...r,ref:t})});Al.displayName=kl;var jl=El,Ml=Ol,Nl=Al,Pl=`Separator`,Fl=`horizontal`,Il=[`horizontal`,`vertical`],Ll=Q.forwardRef((e,t)=>{let{decorative:n,orientation:r=Fl,...i}=e,a=Rl(r)?r:Fl,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Z.jsx)(xt.div,{"data-orientation":a,...o,...i,ref:t})});Ll.displayName=Pl;function Rl(e){return Il.includes(e)}var zl=Ll;async function Bl(e){try{await navigator.clipboard.writeText(e)}catch{}}var Vl=120*1e3;function Hl(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)(Vl),_=(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),Bl(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=Vl-(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:`noreferrer`,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 Bl(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 Ul(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||!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await so(t.body,e=>{try{let t=JSON.parse(e);if(t.type===`complete`)return n({login:t.login,name:t.name,email:t.email}),s(!1),`terminal`;if(t.type===`error`)return l(t.message),s(!1),`terminal`}catch{}return`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:`noreferrer`,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)(Gn,{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 Wl(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)(Gn,{"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)(Gn,{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 Gl(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??lo(),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),Hr.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/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({setIdentity:{name:e,email:t}})}).catch(Kl);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),Hr.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),Hr.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)(Rr,{children:(0,Z.jsx)(Dr,{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)(Hl,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(Ul,{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)(Wl,{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)(Pr,{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)(jr,{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)(zr,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function Kl(){}function ql(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 Jl(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 Yl(e){let t=(0,$.c)(86),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s}=e,c;t[0]===o?c=t[1]:(c=o??fo(),t[0]=o,t[1]=c);let l=c,u;t[2]===s?u=t[3]:(u=s??ao(),t[2]=s,t[3]=u);let d=u,[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),O;t[4]!==n||t[5]!==d?(O=()=>{if(!n)return;let e=!1;return d.status().then(t=>{e||C(t.authenticated)}).catch(()=>{e||C(!1)}),()=>{e=!0}},t[4]=n,t[5]=d,t[6]=O):O=t[6];let k;t[7]===n?k=t[8]:(k=[n],t[7]=n,t[8]=k),(0,Q.useEffect)(O,k);let A;t[9]!==S||t[10]!==n||t[11]!==d?(A=()=>{if(!S||!n)return;let e=!1;return y(!0),d.repos().then(t=>{e||(_(t.ok?t.repos:[]),y(!1))}).catch(()=>{e||(_([]),y(!1))}),()=>{e=!0}},t[9]=S,t[10]=n,t[11]=d,t[12]=A):A=t[12];let j;t[13]!==S||t[14]!==n?(j=[S,n],t[13]=S,t[14]=n,t[15]=j):j=t[15],(0,Q.useEffect)(A,j);let M;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){p(e);let t=Jl(e);t&&h(`~/Documents/${t}`)},t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){p(e.clone_url);let t=e.full_name.split(`/`)[1];h(`~/Documents/${t}`)},t[17]=P):P=t[17];let F=P,I;t[18]!==m||t[19]!==a||t[20]!==r||t[21]!==l||t[22]!==f?(I=async function(){if(!f.trim()){Hr.error(`Enter a repository URL or owner/repo`);return}T(!0);let e=Hr.loading(`Starting clone…`,{duration:1/0});D.current=e;let t=l.start({url:f.trim(),dir:m||``});E.current=t.cancel;try{let n=t.events[Symbol.asyncIterator](),i=await n.next();for(;!i.done;){let t=i.value;if(t.type===`progress`)Hr.loading(`${ql(t.phase)} — ${t.pct}%`,{id:e});else if(t.type===`complete`){Hr.success(`Clone complete — opening project`,{id:e}),r(!1),T(!1),E.current=null;let n=`port`in t?t.port:void 0;a?a({port:n,dir:t.dir}):n!==void 0&&(window.location.href=`http://localhost:${n}`);return}else if(t.type===`error`){Hr.error(`Clone failed: ${t.message}`,{id:e}),T(!1),E.current=null;return}i=await n.next()}Hr.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:e}),T(!1),E.current=null}catch(t){console.error(`[CloneDialog] clone iteration failed:`,t),Hr.error(`Clone failed — connection error`,{id:e}),T(!1),E.current=null}},t[18]=m,t[19]=a,t[20]=r,t[21]=l,t[22]=f,t[23]=I):I=t[23];let L=I,R;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(){E.current?.(),E.current=null,T(!1),Hr.dismiss(D.current??void 0)},t[24]=R):R=t[24];let z=R,B;t[25]!==w||t[26]!==r?(B=function(e){w||(r(e),e||(p(``),h(``),x(``)))},t[25]=w,t[26]=r,t[27]=B):B=t[27];let V=B,H,U,W,G,K,ee,q,te,ne,re;if(t[28]!==w||t[29]!==V||t[30]!==S||t[31]!==v||t[32]!==n||t[33]!==b||t[34]!==g||t[35]!==f){let e=g?.filter(e=>e.full_name.toLowerCase().includes(b.toLowerCase()));W=zr,ne=n,re=V,U=jr,q=`sm:max-w-lg`,t[46]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Rr,{children:(0,Z.jsx)(Dr,{children:`Clone from GitHub`})}),t[46]=te):te=t[46],H=Pr,G=`flex flex-col gap-4`;let r;t[47]===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[47]=r):r=t[47];let i;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(i=e=>N(e.target.value),t[48]=i):i=t[48],t[49]!==w||t[50]!==f?(K=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(Gn,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:f,onChange:i,disabled:w})]}),t[49]=w,t[50]=f,t[51]=K):K=t[51],ee=S&&(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)(Gn,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories…`,value:b,onChange:e=>x(e.target.value),disabled:w||v&&g===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":v&&g===null,children:v&&g===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(ur,{className:`h-4 w-2/3`}),(0,Z.jsx)(ur,{className:`h-4 w-1/2`}),(0,Z.jsx)(ur,{className:`h-4 w-3/4`}),(0,Z.jsx)(ur,{className:`h-4 w-2/5`}),(0,Z.jsx)(ur,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:g?.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:()=>F(e),disabled:w,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[28]=w,t[29]=V,t[30]=S,t[31]=v,t[32]=n,t[33]=b,t[34]=g,t[35]=f,t[36]=H,t[37]=U,t[38]=W,t[39]=G,t[40]=K,t[41]=ee,t[42]=q,t[43]=te,t[44]=ne,t[45]=re}else H=t[36],U=t[37],W=t[38],G=t[39],K=t[40],ee=t[41],q=t[42],te=t[43],ne=t[44],re=t[45];let ie;t[52]!==w||t[53]!==S||t[54]!==i?(ie=!S&&(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:w,children:`Sign in to GitHub`})]}),t[52]=w,t[53]=S,t[54]=i,t[55]=ie):ie=t[55];let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),t[56]=ae):ae=t[56];let oe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>h(e.target.value),t[57]=oe):oe=t[57];let se;t[58]!==w||t[59]!==m?(se=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[ae,(0,Z.jsx)(Gn,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:m,onChange:oe,disabled:w})]}),t[58]=w,t[59]=m,t[60]=se):se=t[60];let ce;t[61]!==G||t[62]!==K||t[63]!==ee||t[64]!==ie||t[65]!==se?(ce=(0,Z.jsxs)(`div`,{className:G,children:[K,ee,ie,se]}),t[61]=G,t[62]=K,t[63]=ee,t[64]=ie,t[65]=se,t[66]=ce):ce=t[66];let le;t[67]!==H||t[68]!==ce?(le=(0,Z.jsx)(H,{children:ce}),t[67]=H,t[68]=ce,t[69]=le):le=t[69];let ue;t[70]!==w||t[71]!==L||t[72]!==V||t[73]!==f?(ue=(0,Z.jsx)(Fr,{children:w?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:z,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>V(!1),children:`Cancel`}),(0,Z.jsx)(X,{onClick:()=>void L(),disabled:!f.trim(),children:`Clone`})]})}),t[70]=w,t[71]=L,t[72]=V,t[73]=f,t[74]=ue):ue=t[74];let de;t[75]!==U||t[76]!==q||t[77]!==te||t[78]!==le||t[79]!==ue?(de=(0,Z.jsxs)(U,{className:q,children:[te,le,ue]}),t[75]=U,t[76]=q,t[77]=te,t[78]=le,t[79]=ue,t[80]=de):de=t[80];let fe;return t[81]!==W||t[82]!==ne||t[83]!==re||t[84]!==de?(fe=(0,Z.jsx)(W,{open:ne,onOpenChange:re,children:de}),t[81]=W,t[82]=ne,t[83]=re,t[84]=de,t[85]=fe):fe=t[85],fe}function Xl(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 Zl(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 Ql=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-CI9rAMX9.js`),__vite__mapDeps([4,1,5,6,7,8]),import.meta.url));function $l(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Jr.subscribe,tu,eu))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)(Ql,{})}),e[0]=t):t=e[0],t}function eu(){return!1}function tu(){return Jr.getSnapshot()!==null}var nu=(e,t,n)=>to(e,t,n,`NavigatorApp`);function ru(e){let t=(0,$.c)(62),{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)(`auth`),v;t[1]===n.project?v=t[2]:(v=()=>{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]=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=(e,t)=>nu(e,t,l),t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(!0),t[6]=S):S=t[6];let C=S,w;t[7]===n?w=t[8]:(w=()=>x(async()=>{let e=await n.dialog.openFolder();e&&await ou(n,e)},`Failed to open folder.`),t[7]=n,t[8]=w);let T=w,E;t[9]===n?E=t[10]:(E=()=>x(async()=>{let e=await n.dialog.createFolder();e&&await ou(n,e)},`Failed to create project folder.`),t[9]=n,t[10]=E);let D=E,O;t[11]===n?O=t[12]:(O=e=>x(async()=>{await ou(n,e)},`Failed to open project.`),t[11]=n,t[12]=O);let k=O,A=`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background p-12 pb-2 text-foreground max-w-5xl space-y-10 mx-auto ${!o&&i.length===0?`justify-center`:``}`,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Zl,{className:`size-12 shrink-0`}),t[13]=j):j=t[13];let M;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),t[14]=M):M=t[14];let N;t[15]===n.appVersion?N=t[16]:(N=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[j,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[M,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[15]=n.appVersion,t[16]=N);let P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(iu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:C,dataTestId:`nav-clone`,Icon:Xl}),t[17]=P):P=t[17];let F;t[18]===T?F=t[19]:(F=(0,Z.jsx)(iu,{title:`Open folder on disk`,description:`Open an existing folder as a project.`,onClick:T,dataTestId:`nav-open`,Icon:en}),t[18]=T,t[19]=F);let I;t[20]===D?I=t[21]:(I=(0,Z.jsx)(iu,{title:`Start fresh`,description:`Create a new folder for a brand-new project.`,onClick:D,dataTestId:`nav-fresh`,Icon:mr}),t[20]=D,t[21]=I);let L;t[22]!==F||t[23]!==I?(L=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[P,F,I]}),t[22]=F,t[23]=I,t[24]=L):L=t[24];let R;t[25]===c?R=t[26]:(R=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[25]=c,t[26]=R);let z;t[27]!==o||t[28]!==k||t[29]!==i?(z=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)(Rt,{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)(au,{project:e,onOpen:()=>k(e.path)},e.path))})]}):null,t[27]=o,t[28]=k,t[29]=i,t[30]=z):z=t[30];let B;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)($l,{}),t[31]=B):B=t[31];let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=e=>{p(e),e||h(!1)},t[32]=V):V=t[32];let H;t[33]===n?H=t[34]:(H=uo(n),t[33]=n,t[34]=H);let U=g===`identity`,W;t[35]===m?W=t[36]:(W=()=>{p(!1),m&&(h(!1),d(!0))},t[35]=m,t[36]=W);let G;t[37]!==f||t[38]!==H||t[39]!==U||t[40]!==W?(G=(0,Z.jsx)(Gl,{open:f,onOpenChange:V,transport:H,identityPrompt:U,onSuccess:W}),t[37]=f,t[38]=H,t[39]=U,t[40]=W,t[41]=G):G=t[41];let K;t[42]===n?K=t[43]:(K=po(n),t[42]=n,t[43]=K);let ee;t[44]===n?ee=t[45]:(ee=oo(n),t[44]=n,t[45]=ee);let q;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>{d(!1),_(`auth`),h(!0),p(!0)},t[46]=q):q=t[46];let te;t[47]===n?te=t[48]:(te=e=>{let{dir:t}=e;x(()=>ou(n,t),`Failed to open cloned project.`)},t[47]=n,t[48]=te);let ne;t[49]!==u||t[50]!==K||t[51]!==ee||t[52]!==te?(ne=(0,Z.jsx)(Yl,{open:u,onOpenChange:d,transport:K,authQueryTransport:ee,onSignIn:q,onCloneComplete:te}),t[49]=u,t[50]=K,t[51]=ee,t[52]=te,t[53]=ne):ne=t[53];let re;return t[54]!==N||t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==G||t[59]!==ne||t[60]!==A?(re=(0,Z.jsxs)(`div`,{className:A,children:[N,L,R,z,B,G,ne]}),t[54]=N,t[55]=L,t[56]=R,t[57]=z,t[58]=G,t[59]=ne,t[60]=A,t[61]=re):re=t[61],re}function iu(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 au(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)(_n,{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 ou(e,t){await e.project.open({path:t,target:`new-window`})}var su=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=xe(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Sr,{className:`size-4`}),info:(0,Z.jsx)(At,{className:`size-4`}),warning:(0,Z.jsx)(q,{className:`size-4`}),error:(0,Z.jsx)(Da,{className:`size-4`}),loading:(0,Z.jsx)(Rt,{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)(Er,{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 cu(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(lu(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 lu(e,t){return e.startsWith(`/api/`)?t+e:e}function uu(e){return`#/${encodeURIComponent(e)}`}function du(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(uu(e.doc))})}function fu(e){let t=e.bridge;if(!t)return;let n=e.toastImpl??(e=>Hr.info(e));return t.onGitInitNotice(e=>{n(`Initialized git repo at ${e.gitDir}`)})}var pu=`Update ready`,mu=`Relaunch`,hu=`Release notes`,gu=`Updates paused`,_u=`Download`,vu=`Relaunch failed — please restart manually`;function yu(e){return`Updated to v${e}`}var bu=0,xu=1,Su=2,Cu=3;function wu(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:pu,priority:Su,action:{label:mu,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},()=>{t({id:`relaunch-error-${r}`,body:vu,variant:`error`,priority:xu})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:yu(n),priority:Cu,action:{label:hu,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:gu,priority:bu,action:{label:_u,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}var Tu=[],Eu=new Set,Du=!1;function Ou(){for(let e of Eu)e()}function ku(e){let t=Tu.findIndex(t=>t.id===e.id);if(t===-1)Tu=[...Tu,e];else{let n=Tu.slice();n[t]=e,Tu=n}Ou()}function Au(e){let t=Tu.filter(t=>t.id!==e);t.length!==Tu.length&&(Tu=t,Ou())}function ju(){return Tu}function Mu(e){return Eu.add(e),()=>{Eu.delete(e)}}function Nu(){if(Du||typeof window>`u`)return;let e=window.okDesktop;e&&(Du=!0,wu(e,ku,Au))}var Pu=1,Fu=.9,Iu=.8,Lu=.17,Ru=.1,zu=.999,Bu=.9999,Vu=.99,Hu=/[\\\/_+.#"@\[\(\{&]/,Uu=/[\\\/_+.#"@\[\(\{&]/g,Wu=/[\s-]/,Gu=/[\s-]/g;function Ku(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Pu:Vu;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Ku(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Pu:Hu.test(e.charAt(l-1))?(d*=Iu,p=e.slice(i,l-1).match(Uu),p&&i>0&&(d*=zu**+p.length)):Wu.test(e.charAt(l-1))?(d*=Fu,m=e.slice(i,l-1).match(Gu),m&&i>0&&(d*=zu**+m.length)):(d*=Lu,i>0&&(d*=zu**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Bu)),(d<Ru&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ku(e,t,n,r,l+1,a+2,o),f*Ru>d&&(d=f*Ru)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function qu(e){return e.toLowerCase().replace(Gu,` `)}function Ju(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ku(e,t,qu(e),qu(t),0,0,{})}var Yu=`[cmdk-group=""]`,Xu=`[cmdk-group-items=""]`,Zu=`[cmdk-group-heading=""]`,Qu=`[cmdk-item=""]`,$u=`${Qu}:not([aria-disabled="true"])`,ed=`cmdk-item-select`,td=`data-value`,nd=(e,t,n)=>Ju(e,t,n),rd=Q.createContext(void 0),id=()=>Q.useContext(rd),ad=Q.createContext(void 0),od=()=>Q.useContext(ad),sd=Q.createContext(void 0),cd=Q.forwardRef((e,t)=>{let n=Sd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Sd(()=>new Set),i=Sd(()=>new Map),a=Sd(()=>new Map),o=Sd(()=>new Set),s=bd(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Tt(),y=Tt(),b=Tt(),x=Q.useRef(null),S=Td();xd(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),xd(()=>{S(6,k)},[]);let C=Q.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=Q.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??nd;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Xu);t?t.appendChild(e.parentElement===t?e:e.closest(`${Xu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Xu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Yu}[${td}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(td);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Yu)?.querySelector(Zu))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Qu}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll($u)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(td))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(td))}function P(e){let t=A()?.closest(Yu),n;for(;t&&!n;)t=e>0?vd(t,Yu):yd(t,Yu),n=t?.querySelector($u);n?C.setState(`value`,n.getAttribute(td)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return Q.createElement(xt.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(ed);t.dispatchEvent(e)}}}}},Q.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Od},c),Dd(e,e=>Q.createElement(ad.Provider,{value:C},Q.createElement(rd.Provider,{value:w},e))))}),ld=Q.forwardRef((e,t)=>{let n=Tt(),r=Q.useRef(null),i=Q.useContext(sd),a=id(),o=bd(e),s=o.current?.forceMount??i?.forceMount;xd(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=wd(n,r,[e.value,e.children,r],e.keywords),l=od(),u=Cd(e=>e.value&&e.value===c.current),d=Cd(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);Q.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(ed,f),()=>t.removeEventListener(ed,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return Q.createElement(xt.div,{ref:Dt(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),ud=Q.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Tt(),s=Q.useRef(null),c=Q.useRef(null),l=Tt(),u=id(),d=Cd(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);xd(()=>u.group(o),[]),wd(o,s,[e.value,e.heading,c]);let f=Q.useMemo(()=>({id:o,forceMount:i}),[i]);return Q.createElement(xt.div,{ref:Dt(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&Q.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Dd(e,e=>Q.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},Q.createElement(sd.Provider,{value:f},e))))}),dd=Q.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=Q.useRef(null),a=Cd(e=>!e.search);return!n&&!a?null:Q.createElement(xt.div,{ref:Dt(i,t),...r,"cmdk-separator":``,role:`separator`})}),fd=Q.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=od(),o=Cd(e=>e.search),s=Cd(e=>e.selectedItemId),c=id();return Q.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),Q.createElement(xt.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),pd=Q.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=Q.useRef(null),o=Q.useRef(null),s=Cd(e=>e.selectedItemId),c=id();return Q.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),Q.createElement(xt.div,{ref:Dt(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Dd(e,e=>Q.createElement(`div`,{ref:Dt(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),md=Q.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return Q.createElement(Nr,{open:n,onOpenChange:r},Q.createElement(Ir,{container:o},Q.createElement(Or,{"cmdk-overlay":``,className:i}),Q.createElement(Br,{"aria-label":e.label,"cmdk-dialog":``,className:a},Q.createElement(cd,{ref:t,...s}))))}),hd=Q.forwardRef((e,t)=>Cd(e=>e.filtered.count===0)?Q.createElement(xt.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),gd=Q.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return Q.createElement(xt.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Dd(e,e=>Q.createElement(`div`,{"aria-hidden":!0},e)))}),_d=Object.assign(cd,{List:pd,Item:ld,Input:fd,Group:ud,Separator:dd,Dialog:md,Empty:hd,Loading:gd});function vd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function yd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function bd(e){let t=Q.useRef(e);return xd(()=>{t.current=e}),t}var xd=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function Sd(e){let t=Q.useRef();return t.current===void 0&&(t.current=e()),t}function Cd(e){let t=od(),n=()=>e(t.snapshot());return Q.useSyncExternalStore(t.subscribe,n,n)}function wd(e,t,n,r=[]){let i=Q.useRef(),a=id();return xd(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(td,s),i.current=s}),i}var Td=()=>{let[e,t]=Q.useState(),n=Sd(()=>new Map);return xd(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Ed(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Dd({asChild:e,children:t},n){return e&&Q.isValidElement(t)?Q.cloneElement(Ed(t),{ref:t.ref},n(t.props.children)):n(t)}var Od={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function kd(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 flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ad(e){let t=(0,$.c)(26),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]):({title:a,description:o,children:n,className:r,showCloseButton:s,...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?`Command Palette`:a,l=o===void 0?`Search for a command to run…`:o,u=s===void 0?!0:s,d;t[7]===c?d=t[8]:(d=(0,Z.jsx)(Dr,{children:c}),t[7]=c,t[8]=d);let f;t[9]===l?f=t[10]:(f=(0,Z.jsx)(Tr,{children:l}),t[9]=l,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(Rr,{className:`sr-only`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===r?m=t[15]:(m=Y(`overflow-hidden p-0`,r),t[14]=r,t[15]=m);let h;t[16]===n?h=t[17]:(h=(0,Z.jsx)(kd,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n}),t[16]=n,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Z.jsx)(jr,{className:m,showCloseButton:u,children:h}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==i||t[23]!==p||t[24]!==g?(_=(0,Z.jsxs)(zr,{...i,children:[p,g]}),t[22]=i,t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function jd(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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(La,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Y(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,Z.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[i,(0,Z.jsx)(_d.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function Md(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(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nd(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(_d.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Pd(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(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fd(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 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Separator,{"data-slot":`command-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Id(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(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_d.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ld(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(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rd=`Switch Project…`,zd=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`}],Bd=`#settings`;function Vd(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function Hd(e){let t=e.replace(/^#/,``);return t===`settings`||t===`settings/project`?`project`:t===`settings/user`?`user`:null}function Ud(e){return`#settings/${e}`}function Wd(){return typeof window>`u`?``:window.location.hash}function Gd(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(qd),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(Hd(Wd()))};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=Kd,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{if(typeof window>`u`)return;let t=Ud(e);if(window.location.hash===t)return;let{pathname:r,search:i}=window.location;window.history.replaceState(null,``,`${r}${i}${t}`),n(e)},e[2]=o):o=e[2];let s=o,c;return e[3]===t?c=e[4]:(c={scope:t,close:a,setScope:s},e[3]=t,e[4]=c),c}function Kd(){typeof window>`u`||Hd(Wd())!==null&&window.history.back()}function qd(){return Hd(Wd())}function Jd(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Zd),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(Xd);e&&t.ok&&r?.ok&&typeof r.contentDir==`string`&&(r.pathSeparator===`/`||r.pathSeparator===`\\`)&&n({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Yd),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Yd(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function Xd(){return null}function Zd(){return Qd()}function Qd(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 $d(e){return{async install(){let t;try{t=await e.buildAndOpen()}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return t.ok?{ok:!0,path:t.path}:{ok:!1,reason:t.reason,message:t.message}}}}function ef(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(){let e;try{e=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!e.ok){let t=`HTTP ${e.status}`;try{let n=await e.json(),r=typeof n.error==`string`?n.error:n.error?.message;r&&(t=r)}catch{}return{ok:!1,reason:`http-error`,message:t}}let r;try{r=await e.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!r||typeof r.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:r.status===`failed`?{ok:!1,reason:`build-failed`,message:r.buildError??`unknown build failure`}:{ok:!0,path:r.outputPath,handoffWarning:r.handoffError?.message}}}}function tf(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?$d(e):ef()}var nf=`ok:skill:cowork:installed`,rf=`1`;function af(e){return`${nf}:v${e}`}async function of(e){let t=sf(e.storage),n=e.installer===void 0?tf():e.installer,r=af(e.skillVersion);if(t?.getItem(r)===rf)return{kind:`already-installed`};if(!n)return{kind:`host-unsupported`};let i=await n.install();if(i.ok){try{t?.setItem(r,rf)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:i.path,handoffWarning:i.handoffWarning}}return{kind:`install-failed`,reason:i.reason,message:i.message}}function sf(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function cf(){return{skillVersion:(typeof window<`u`?window.okDesktop:void 0)?.appVersion??`unknown`}}function lf(){return of(cf())}async function uf(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:df(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:df(e)}}}function df(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var ff=1e3,pf=1500;function mf(e){return new Promise(t=>setTimeout(t,e))}async function hf(e,t={}){let n=t.spawnCursor??(typeof window<`u`?window.okDesktop?.shell.spawnCursor:void 0);if(!n)return{ok:!1,reason:`web-host-cursor-unsupported`};let r=await n(e.projectDir);if(!r.ok)return gf(r.reason);let i=t.isCursorRunning&&await t.isCursorRunning().catch(()=>!1)?ff:pf;return await(t.sleep??mf)(i),uf(le(e),t.openExternalDeps)}function gf(e){switch(e){case`not-installed`:return{ok:!1,reason:`not-installed`,detail:`cursor binary not found`};case`invalid-path`:return{ok:!1,reason:`invalid-payload`,detail:`cursor spawn: invalid path`};case`timeout`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: timeout`};case`spawn-error`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: spawn-error`};default:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: ${String(e)}`}}}async function _f(e,t={}){switch(e.target){case`claude-cowork`:return uf(be({mode:`cowork`},e),t.openExternalDeps);case`claude-code`:return uf(be({mode:`code`},e),t.openExternalDeps);case`codex`:return uf(we(e),t.openExternalDeps);case`cursor`:return hf(e,{...t.cursorDeps,openExternalDeps:t.cursorDeps?.openExternalDeps??t.openExternalDeps});default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function vf(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 yf(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function bf(e){return`${e}.md`}function xf(e){if(!e.docName||!e.workspace)return null;let t=bf(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:yf(n,t,r)}}function Sf(e){return`Opened in ${e}.`}function Cf(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 wf(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Tf(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 Ef(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:Ve(t.docContext)},a=await n.dispatchHandoff(i),o=Tf(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Sf(s));else{let i=wf(r),a=Cf(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Ef(e,t,n,r+1)}}})}return a}function Df(e){return zd.find(t=>t.id===e)?.displayName??e}function Of(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function kf(){return{dispatchHandoff:_f,recordHandoff:vf,toast:{success:e=>{Hr.success(e)},error:(e,t)=>{Hr.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Of(),getDisplayName:Df,ensureCoworkSkillInstalled:lf}}function Af(){return{dispatch:(e,t)=>Ef(e,t,kf())}}var jf=[...new Set(zd.flatMap(e=>e.schemes))];function Mf(e,t){let n=t.now?.()??Date.now(),r={};for(let i of zd){if(!t.isElectronHost&&i.id===`cursor`){r[i.id]={installed:!1,lastChecked:n};continue}let a=i.schemes[0],o=a===void 0?void 0:e[a];if(!o){r[i.id]={installed:null};continue}r[i.id]={installed:o.installed,...o.displayName===void 0?{}:{displayName:o.displayName},lastChecked:n}}return r}function Nf(e){return Mf({},e)}async function Pf(e){let t=e.schemes??jf,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 Ff=Object.fromEntries(jf.map(e=>[e,{installed:!1}]));async function If(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 Ff}if(!t.ok)return Ff;let n;try{n=await t.json()}catch{return Ff}if(typeof n!=`object`||!n||Array.isArray(n))return Ff;let r=n,i={};for(let e of jf)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Lf(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 Rf(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Nf({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Mf(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=!Lf(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 zf(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Bf(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Pf({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>If({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Vf(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Hf),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Rf(Bf());r.current=e;let t=e.subscribe(n);return e.probe(),()=>{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 Hf(){return Nf({isElectronHost:zf(),now:Date.now})}var Uf=(e,t,n)=>no(e,t,n,`CommandPalette`);function Wf(e){let t=(0,$.c)(49),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,s]=(0,Q.useState)(a),{activeDocName:c}=jn(),l=Jd(),{states:u,refresh:d}=Vf(),{dispatch:f}=Af(),p=xf({docName:c,workspace:l}),m;t[1]!==n.project||t[2]!==r||t[3]!==d?(m=()=>{if(!r)return;let e=!1;return Uf(async()=>{let t=await n.project.listRecent();e||s(t)},`Failed to load recent projects.`),d(),()=>{e=!0}},t[1]=n.project,t[2]=r,t[3]=d,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==r||t[7]!==d?(h=[r,n,d],t[5]=n,t[6]=r,t[7]=d,t[8]=h):h=t[8],(0,Q.useEffect)(m,h);let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`k`||e.key===`K`)&&(e.preventDefault(),i(Gf))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_=[],t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,Q.useEffect)(g,_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),Uf(async()=>{await e()},n)},t[11]=v):v=t[11];let y=v,b=n.config.projectPath,x;t[12]===b?x=t[13]:(x=e=>e.path!==b,t[12]=b,t[13]=x);let S=o.filter(x),C=Ad,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(jd,{placeholder:`Type a command or search recent projects…`}),t[14]=w):w=t[14];let T=Md,E;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(Nd,{children:`No matching commands.`}),t[15]=E):E=t[15];let D;t[16]!==n.dialog||t[17]!==n.project?(D=()=>y(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})}),t[16]=n.dialog,t[17]=n.project,t[18]=D):D=t[18];let O,k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(en,{}),k=(0,Z.jsx)(`span`,{children:`Open folder on disk…`}),A=(0,Z.jsx)(Ld,{children:`⌘O`}),t[19]=O,t[20]=k,t[21]=A):(O=t[19],k=t[20],A=t[21]);let j;t[22]===D?j=t[23]:(j=(0,Z.jsxs)(Id,{onSelect:D,"data-testid":`command-palette-open-folder`,children:[O,k,A]}),t[22]=D,t[23]=j);let M;t[24]===n.navigator?M=t[25]:(M=()=>y(()=>n.navigator.open(),`Failed to open Project Navigator.`),t[24]=n.navigator,t[25]=M);let N,P,F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(_a,{}),P=(0,Z.jsx)(`span`,{children:Rd}),F=(0,Z.jsx)(Ld,{children:`⌘⇧N`}),t[26]=N,t[27]=P,t[28]=F):(N=t[26],P=t[27],F=t[28]);let I;t[29]===M?I=t[30]:(I=(0,Z.jsxs)(Id,{value:`switch-project navigator projects`,onSelect:M,"data-testid":`command-palette-switch-project`,children:[N,P,F]}),t[29]=M,t[30]=I);let L;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Bd)},t[31]=L):L=t[31];let R;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsxs)(Id,{value:`settings preferences config`,onSelect:L,"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Ra,{}),(0,Z.jsx)(`span`,{children:`Settings…`}),(0,Z.jsx)(Ld,{children:`⌘,`})]}),t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{i(!1),window.location.hash=`#install-claude-desktop`},t[33]=z):z=t[33];let B;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Id,{onSelect:z,"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(gr,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)…`})]}),t[34]=B):B=t[34];let V;t[35]!==j||t[36]!==I?(V=(0,Z.jsxs)(Pd,{heading:`Project`,children:[j,I,R,B]}),t[35]=j,t[36]=I,t[37]=V):V=t[37];let H=c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{}),(0,Z.jsx)(Pd,{heading:`Open in agent`,children:zd.map(e=>{let t=u[e.id],n=t.installed===!0&&p!==null,r=t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:p===null?`No active doc`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(Id,{value:`open-in-agent ${e.id} ${e.displayName}`,disabled:!n,onSelect:()=>{!n||!p||(i(!1),f(e.id,p))},"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,U=S.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fd,{}),(0,Z.jsx)(Pd,{heading:`Recent projects`,children:S.slice(0,10).map(e=>(0,Z.jsxs)(Id,{value:`${e.name} ${e.path}`,disabled:e.missing,onSelect:()=>y(()=>n.project.open({path:e.path,target:`new-window`})),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Z.jsx)(ar,{}),(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,W;t[38]!==T||t[39]!==E||t[40]!==V||t[41]!==H||t[42]!==U?(W=(0,Z.jsxs)(T,{className:`subtle-scrollbar`,children:[E,V,H,U]}),t[38]=T,t[39]=E,t[40]=V,t[41]=H,t[42]=U,t[43]=W):W=t[43];let G;return t[44]!==C||t[45]!==r||t[46]!==w||t[47]!==W?(G=(0,Z.jsxs)(C,{open:r,onOpenChange:i,title:`Project Command Palette`,description:`Open a folder, switch to a recent project, or open the Project Navigator.`,children:[w,W]}),t[44]=C,t[45]=r,t[46]=w,t[47]=W,t[48]=G):G=t[48],G}function Gf(e){return!e}var Kf=500;function qf(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Jf(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 Yf(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=jn(),[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),Kf);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=qf(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Jf(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/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}var Xf=`raw-mdx-nav`,Zf=`ok-editor-mode-v1`,Qf=[`wysiwyg`,`source`],$f=`wysiwyg`;function ep(e){return Qf.includes(e)}function tp(e=localStorage){try{let t=e.getItem(Zf);if(t===null)return $f;if(ep(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return $f}function np(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return ep(n)?n:tp(t)}function rp(e,t=localStorage){try{return t.setItem(Zf,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function ip(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(np),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),rp(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}async function ap(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function op(){return sp().status}function sp(){let e=(0,$.c)(8),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ap().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,Q.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Xe(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,Q.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var cp=(0,Q.createContext)(null);function lp(e,t,n){let r=new Fn,i=new Nn({url:e,name:t,document:r}),a=et(i,n);return{binding:a,config:a.current(),cleanup:()=>{a.dispose(),i.destroy(),r.destroy()}}}function up(e){let t=(0,$.c)(19),{children:n}=e,{collabUrl:r}=jn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c,l;t[0]===r?(c=t[1],l=t[2]):(c=()=>{if(r===null)return;let e=lp(r,pe,`user`),t=lp(r,ct,`project`);a({binding:e.binding,config:e.config}),s({binding:t.binding,config:t.config});let n=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),i=t.binding.subscribe(e=>{s(n=>n?.binding===t.binding?{...n,config:e}:n)});return()=>{n(),i(),e.cleanup(),t.cleanup(),a(t=>t?.binding===e.binding?null:t),s(e=>e?.binding===t.binding?null:e)}},l=[r],t[0]=r,t[1]=c,t[2]=l),(0,Q.useEffect)(c,l);let u;t[3]!==o||t[4]!==i?(u=i&&o?fp(i.config,o.config):null,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=u,{setTheme:f}=xe(),p=d?.appearance?.theme,m,h;t[6]!==f||t[7]!==p?(m=()=>{(p===`light`||p===`dark`||p===`system`)&&f(p)},h=[p,f],t[6]=f,t[7]=p,t[8]=m,t[9]=h):(m=t[8],h=t[9]),(0,Q.useEffect)(m,h);let g=i?.binding??null,_=o?.binding??null,v=i?.config??null,y=o?.config??null,b;t[10]!==d||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==y?(b={userBinding:g,projectBinding:_,userConfig:v,projectConfig:y,merged:d},t[10]=d,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b):b=t[15];let x=b,S;return t[16]!==n||t[17]!==x?(S=(0,Z.jsx)(cp,{value:x,children:n}),t[16]=n,t[17]=x,t[18]=S):S=t[18],S}function dp(){let e=(0,Q.use)(cp);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function fp(e,t){return pp(e,t,[])}function pp(e,t,n){if(n.length>0){let r=Re(ne,n);if(r?.scope===`user`)return e;if(r?.scope===`project`)return t??e}if(t===void 0)return e;if(t===null)return null;if(Array.isArray(t)||typeof t!=`object`||typeof e!=`object`||!e||Array.isArray(e))return t;let r={...e};for(let[i,a]of Object.entries(t))r[i]=pp(e[i],a,[...n,i]);return r}async function mp(e){let t=await fetch(`/api/sync/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`set-enabled failed: HTTP ${t.status}`)}function hp(e){let t=(0,$.c)(29),{open:n,onResolved:r}=e,{projectBinding:i}=dp(),[a,o]=(0,Q.useState)(null),s;t[0]===i?s=t[1]:(s=function(){if(!i)return Hr.error(`Settings not ready — please try again in a moment.`),!1;let e=i.patch({autoSync:{onboardingResolvedAt:new Date().toISOString()}});return e.ok?!0:(Hr.error(`Could not save your choice: ${e.error.code}`),!1)},t[0]=i,t[1]=s);let c=s,l;t[2]!==r||t[3]!==c?(l=async function(){o(`enable`);try{await mp(!0)}catch(e){let t=e,n=t instanceof Error?t.message:String(t);Hr.error(`Could not enable sync: ${n}`),o(null);return}if(!c()){o(null);return}o(null),r()},t[2]=r,t[3]=c,t[4]=l):l=t[4];let u=l,d;t[5]!==r||t[6]!==c?(d=function(){if(o(`dismiss`),!c()){o(null);return}o(null),r()},t[5]=r,t[6]=c,t[7]=d):d=t[7];let f=d,p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Rr,{children:[(0,Z.jsx)(Dr,{children:`Enable git auto-sync?`}),(0,Z.jsx)(Tr,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Before you enable it:`}),t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(Pr,{children:[m,(0,Z.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,Z.jsx)(`li`,{children:`If you do not want automatic commits in your git history, you should not enable auto-sync.`})]})]}),t[10]=h):h=t[10];let g=a!==null,_;t[11]===a?_=t[12]:(_=a===`dismiss`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Saving…`]}):`Keep disabled`,t[11]=a,t[12]=_);let v;t[13]!==f||t[14]!==g||t[15]!==_?(v=(0,Z.jsx)(X,{variant:`ghost`,className:`uppercase font-mono`,onClick:f,disabled:g,children:_}),t[13]=f,t[14]=g,t[15]=_,t[16]=v):v=t[16];let y=a!==null,b;t[17]===a?b=t[18]:(b=a===`enable`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Enabling…`]}):`Enable auto-sync`,t[17]=a,t[18]=b);let x;t[19]!==u||t[20]!==y||t[21]!==b?(x=(0,Z.jsx)(X,{onClick:u,disabled:y,children:b}),t[19]=u,t[20]=y,t[21]=b,t[22]=x):x=t[22];let S;t[23]!==x||t[24]!==v?(S=(0,Z.jsxs)(jr,{className:`sm:max-w-lg`,showCloseButton:!1,children:[p,h,(0,Z.jsxs)(Fr,{children:[v,x]})]}),t[23]=x,t[24]=v,t[25]=S):S=t[25];let C;return t[26]!==n||t[27]!==S?(C=(0,Z.jsx)(zr,{open:n,onOpenChange:gp,children:S}),t[26]=n,t[27]=S,t[28]=C):C=t[28],C}function gp(){}function _p(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=op();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)(q,{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 vp=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 yp(e,t,n,r,i,a){if(e==r)return[];let o=kp(e,t,n,r,i,a),s=Ap(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 vp(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new vp(t,t+o,i,i),new vp(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 vp(t,t,i,i+o),new vp(n,n,i+o+c,a)]}if(c==1||l==1)return[new vp(t,n,i,a)];let u=Mp(e,t,n,r,i,a);if(u){let[o,s,c]=u;return yp(e,t,o,r,i,s).concat(yp(e,o+c,n,r,s+c,a))}return Cp(e,t,n,r,i,a)}var bp=1e9,xp=0,Sp=!1;function Cp(e,t,n,r,i,a){let o=n-t,s=a-i;if(bp<1e9&&Math.min(o,s)>bp*16||xp>0&&Date.now()>xp)return Math.min(o,s)>bp*64?[new vp(t,n,i,a)]:Np(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Tp.reset(c),Ep.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:Ep,f=d?null:Tp;for(let p=0;p<c;p++){if(p>bp||xp>0&&!(p&63)&&Date.now()>xp)return Np(e,t,n,r,i,a);let m=Tp.advance(p,o,s,c,d,!1,l)||Ep.advance(p,o,s,c,f,!0,u);if(m)return Dp(e,t,n,t+m[0],r,i,a,i+m[1])}return[new vp(t,n,i,a)]}var wp=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}},Tp=new wp,Ep=new wp;function Dp(e,t,n,r,i,a,o,s){let c=!1;return!Jp(e,r)&&++r==n&&(c=!0),!Jp(i,s)&&++s==o&&(c=!0),c?[new vp(t,n,a,o)]:yp(e,t,r,i,a,s).concat(yp(e,r,n,i,s,o))}function Op(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function kp(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Op(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-+!Jp(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Ap(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Op(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-+!Jp(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function jp(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;;){Jp(e,s)||s++;let u=s+o;if(Jp(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=kp(e,u,n,r,i+f+d.length,a),c=Ap(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 Mp(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Mp(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:jp(e,t,n,r,i,a,Math.floor(o/4),-1)}function Np(e,t,n,r,i,a){Sp=!0;let o=n-t,s=a-i,c;if(o<s){let s=jp(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=jp(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new vp(t,n,i,a)];let[l,u,d]=c;return yp(e,t,l,r,i,u).concat(yp(e,l+d,n,r,u+d,a))}function Pp(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 vp(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Fp(e,t,n){for(;;){Pp(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=kp(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new vp(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Ap(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new vp(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 vp(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 vp(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Ip(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=Up(t,a.fromA,l),f=Hp(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 vp(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Hp(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new vp(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Up(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new vp(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Gp(n,a.fromB,a.toB),r,o=t<0?-1:Wp(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=Gp(t,a.fromA,a.toA),r,o=n<0?-1:Wp(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 Pp(e,3),e}var Lp;try{Lp=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Rp(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function zp(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Rp(n):Lp?!Kp(n)||t==e.length-1?+!!Lp.test(String.fromCharCode(n)):Lp.test(e.slice(t,t+2))?2:0:0}function Bp(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Rp(n):Lp?!qp(n)||t==1?+!!Lp.test(String.fromCharCode(n)):Lp.test(e.slice(t-2,t))?2:0:0}var Vp=8;function Hp(e,t,n){if(t==e.length||!Bp(e,t))return t;for(let r=t,i=t+n,a=0;a<Vp;a++){let t=zp(e,r);if(!t||r+t>i)return r;r+=t}return t}function Up(e,t,n){if(!t||!zp(e,t))return t;for(let r=t,i=t-n,a=0;a<Vp;a++){let t=Bp(e,r);if(!t||r-t<i)return r;r-=t}return t}function Wp(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Gp(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Kp=e=>e>=55296&&e<=56319,qp=e=>e>=56320&&e<=57343;function Jp(e,t){return!t||t==e.length||!Kp(e.charCodeAt(t-1))||!qp(e.charCodeAt(t))}function Yp(e,t,n){let r=n?.override;return r?r(e,t):(bp=(n?.scanLimit??1e9)>>1,xp=n?.timeout?Date.now()+n.timeout:0,Sp=!1,Fp(e,t,yp(e,0,e.length,t,0,t.length)))}function Xp(){return!Sp}function Zp(e,t,n){return Ip(Yp(e,t,n),e,t)}var Qp=Qr.define({combine:e=>e[0]}),$p=ni.define(),em=Qr.define(),tm=ii.define({create(e){return null},update(e,t){for(let n of t.effects)n.is($p)&&(e=n.value);for(let n of t.state.facet(em))e=n(e,t);return e}});function nm(e){let t=e.field(tm,!1);if(!t)return null;let n=e.facet(Qp);return{chunks:t,side:n?n.side:null}}var rm=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 om(Zp(e.toString(),t.toString(),n),e,t,0,0,Xp())}static updateA(e,t,n,r,i){return um(lm(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return um(lm(e,r,!1,t.length),e,t,n,i)}};function im(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 am(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 om(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=im(c.fromA+r,c.fromB+i,t,n),[d,f]=am(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]=im(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]=am(a.toA+r,a.toB+i,t,n),s++}o.push(new rm(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var sm=1e3;function cm(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 lm(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>sm&&([l,d]=cm(e,a-sm,n,!0)),o<t.length-sm&&([u,f]=cm(e,o+sm,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 um(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=Zp(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of om(h,n,r,d,f,Xp()))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 dm={scanLimit:500},fm=li.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Sm(e))}update(e){(e.docChanged||e.viewportChanged||mm(e.startState,e.state)||hm(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Sm(e.view))}},{decorations:e=>e.deco}),pm=fi.low(ui({class:`cm-changeGutter`,markers:e=>e.plugin(fm)?.gutter||Xr.empty}));function mm(e,t){return e.field(tm,!1)!=t.field(tm,!1)}function hm(e,t){return e.facet(Qp)!=t.facet(Qp)}var gm=pi.line({class:`cm-changedLine`}),_m=pi.mark({class:`cm-changedText`}),vm=pi.mark({tagName:`ins`,class:`cm-insertedLine`}),ym=pi.mark({tagName:`del`,class:`cm-deletedLine`}),bm=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function xm(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,gm),i.add(o,s,n?ym:vm),a&&a.add(o,o,bm);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,gm),a&&a.add(u,u,bm);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,_m),s<t)c++;else break}u=t}}}function Sm(e){let t=e.state.field(tm),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Qp),o=n==`a`,s=new di,c=i?new di: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))&&xm(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Cm=class extends ai{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}},wm=ni.define({map:(e,t)=>e.map(t)}),Tm=ii.define({create:()=>pi.none,update:(e,t)=>{for(let e of t.effects)if(e.is(wm))return e.value;return e.map(t.changes)},provide:e=>ci.decorations.from(e)}),Em=.01;function Dm(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 Om(e,t,n){let r=new di,i=new di,a=e.state.field(Tm).iter(),o=t.state.field(Tm).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<-Em?(l-=n,r.add(s,s,pi.widget({widget:new Cm(-n),block:!0,side:-1}))):n>Em&&(u+=n,i.add(c,c,pi.widget({widget:new Cm(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<Em?r.add(e.state.doc.length,e.state.doc.length,pi.widget({widget:new Cm(-p),block:!0,side:1})):p>Em&&i.add(t.state.doc.length,t.state.doc.length,pi.widget({widget:new Cm(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Dm(m,e.state.field(Tm))||e.dispatch({effects:wm.of(m)}),Dm(h,t.state.field(Tm))||t.dispatch({effects:wm.of(h)})}var km=ni.define({map:(e,t)=>t.mapPos(e)}),Am=class extends ai{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:km.of(n)});let{side:r,sibling:i}=e.state.facet(Qp);i&&i().dispatch({effects:km.of(jm(n,e.state.field(tm),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function jm(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 Mm=ii.define({create(e){return pi.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(km)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ci.decorations.from(e)});function Nm({margin:e=3,minSize:t=4}){return Mm.init(n=>Pm(n,e,t))}function Pm(e,t,n){let r=new di,i=e.facet(Qp).side==`a`,a=e.field(tm),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,pi.replace({widget:new Am(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Fm=ci.styleModule.of(new hi({".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`}})),Im=ci.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`}}),Lm=new mi,Rm=new mi,zm=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||dm;let t=[fi.low(fm),Im,Fm,Tm,ci.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(wm)))&&this.measure()})],n=[Qp.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(pm);let r=$r.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ci.editorAttributes.of({class:`cm-merge-a`}),Rm.of(n),t]}),i=[Qp.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(pm);let a=$r.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ci.editorAttributes.of({class:`cm-merge-b`}),Rm.of(i),t]});this.chunks=rm.build(r.doc,a.doc,this.diffConf);let o=[tm.init(()=>this.chunks),Lm.of(e.collapseUnchanged?Nm(e.collapseUnchanged):[])];r=r.update({effects:ni.appendConfig.of(o)}).state,a=a.update({effects:ni.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 ci({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ci({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),oi.empty(e[0].startState.doc.length));this.chunks=t==this.a?rm.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):rm.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:$p.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:$p.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(Qp),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Rm.reconfigure([Qp.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?pm:[]])),a.push(Rm.reconfigure([Qp.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?pm:[]]))}if(r){let t=Lm.reconfigure(e.collapseUnchanged?Nm(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(){Om(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=Bm(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=Bm(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 Bm(e){let t=e.nextSibling;return e.remove(),t}var Vm=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Hm=fi.low(ui({class:`cm-changeGutter`,markers:e=>e.plugin(fm)?.gutter||Xr.empty,widgetMarker:(e,t)=>t instanceof qm?Vm:null}));function Um(e){let t=typeof e.original==`string`?ti.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||dm;return[fi.low(fm),Qm,Im,ci.editorAttributes.of({class:`cm-merge-b`}),em.of((e,t)=>{let r=t.effects.find(e=>e.is(Wm));return r&&(e=rm.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=rm.updateB(e,t.state.field(Gm),t.newDoc,t.changes,n)),e}),Qp.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?ih:void 0,side:`b`}),Gm.init(()=>t),e.gutter===!1?[]:Hm,e.collapseUnchanged?Nm(e.collapseUnchanged):[],tm.init(e=>rm.build(t,e.doc,n))]}var Wm=ni.define(),Gm=ii.define({create:()=>ti.empty,update(e,t){for(let n of t.effects)n.is(Wm)&&(e=n.value.doc);return e}}),Km=new WeakMap,qm=class extends ai{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 Jm(e,t,n){let r=Km.get(t.changes);if(r)return r;let i=pi.widget({block:!0,side:-1,widget:new qm(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Qp),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(),Ym(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Xm(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(Gm).sliceString(t.fromA,t.endA),u=a&&e.facet(ri),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;ei(t,{style:t=>Zr(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 Lm.set(t.changes,i),i}function Bm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Kp).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(Im);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oi.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Fm.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Vm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Kp).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Im).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 Hm(e){let t=new di;for(let n of e.field(Kp)){let r=e.facet(Up).overrideChunk&&Gm(e,n);t.add(n.fromB,n.fromB,zm(e,n,!!r))}return t.finish()}var Um=ii.define({create:e=>Hm(e),update(e,t){return t.state.field(Kp,!1)==t.startState.field(Kp,!1)?e:Hm(t.state)},provide:e=>ci.decorations.from(e)}),Wm=new WeakMap;function Gm(e,t){let n=Wm.get(t);if(n!==void 0)return n;n=null;let r=e.field(Im),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(pi.widget({widget:new Km(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(cm.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Wm.set(t,n),n}var Km=class extends ai{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}},qm=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Jm=pi.line({class:`cm-inlineChangedLine`});function Ym(e,t,n,r){let i=Gm(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,qm),n.add(o.from,o.from,Jm);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 Xm=pn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Zm=Sn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Qm(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}=xe(),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,_;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?Xm:Zm,t=[ci.editable.of(!1),$r.readOnly.of(!0)],o=[_i,Bn(),...t,e,ci.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new ci({doc:r,extensions:[_i,Bn(),ci.editable.of(!1),e,ci.lineWrapping,Pm({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ci.updateListener.of(e=>{let t=qp(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=qp(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new Am({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 ci({doc:r,extensions:[...o,Pm({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},_=[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]=_):(g=t[8],_=t[9]),(0,Q.useEffect)(g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){let e=l.current;!e||!(e instanceof ci)||d.current?.(e.state.doc.toString())},t[10]=v):v=t[10];let y=v,b=p===0,x=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=S):S=t[11];let C;t[12]!==b||t[13]!==a||t[14]!==x||t[15]!==s||t[16]!==o?(C=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 ${b?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:x}),(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:!b,onClick:y,children:`Save resolution`})]})]}),t[12]=b,t[13]=a,t[14]=x,t[15]=s,t[16]=o,t[17]=C):C=t[17];let w;return t[18]===C?w=t[19]:(w=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[S,C]}),t[18]=C,t[19]=w),w}function $m(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)(Nr,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function eh(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)(Ir,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function th(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)(Or,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nh(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)(th,{}),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)(Mr,{"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)(Cr,{}),(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)(eh,{children:[l,(0,Z.jsxs)(Br,{"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 rh(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 ih(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)(Ar,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function ah(){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 oh(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 sh(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 ch=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function lh(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 oh(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)(Rr,{className:`shrink-0`,children:(0,Z.jsxs)(Dr,{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)(jr,{className:ch,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(zr,{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)(Dr,{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)(Rr,{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)(Qm,{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)(jr,{className:`${ch} 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)(zr,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function uh(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(){ah().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(dh));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=()=>Xe(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&&(Hr.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 sh(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):Hr.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?Hr.info(`Merge aborted — sync paused`):Hr.error(`Failed to abort merge`)}catch{Hr.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)(ih,{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)(rh,{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)(nh,{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)($m,{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)(lh,{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 dh(e){return e.file}function fh(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,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=Y(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Z.jsx)(zl,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var ph=5;async function mh(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load backlinks`);return n.backlinks??[]}async function hh(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load outgoing links`);return n.forwardLinks??[]}function gh(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function _h(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)(nn,{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)(k,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(O,{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)(Ft,{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 vh(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=ph)return null;let a=n-ph,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{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 yh(e){let t=(0,$.c)(37),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,onClick:p,hoverAction:m}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Y(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==f||t[7]!==d||t[8]!==p||t[9]!==a||t[10]!==l?(b=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:p,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,onClick:p,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`),children:a}),t[5]=u,t[6]=f,t[7]=d,t[8]=p,t[9]=a,t[10]=l,t[11]=b):b=t[11];let x=b,S;t[12]===y?S=t[13]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[12]=y,t[13]=S);let C;t[14]!==s||t[15]!==o||t[16]!==h?(C=h?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[14]=s,t[15]=o,t[16]=h,t[17]=C):C=t[17];let w;t[18]===c?w=t[19]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[18]=c,t[19]=w);let T;t[20]!==x||t[21]!==C||t[22]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[20]=x,t[21]=C,t[22]=w,t[23]=T):T=t[23];let E;t[24]===m?E=t[25]:(E=m?(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":m.tooltip,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 group-hover:opacity-100`,onClick:m.onClick,children:m.icon})}),(0,Z.jsx)(Gr,{side:`top`,children:m.tooltip})]}):null,t[24]=m,t[25]=E);let D;t[26]!==S||t[27]!==T||t[28]!==E?(D=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[S,T,E]}),t[26]=S,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O=D;if(i){let e;t[30]===O?e=t[31]:(e=(0,Z.jsx)(Wr,{asChild:!0,children:O}),t[30]=O,t[31]=e);let n;t[32]===i?n=t[33]:(n=(0,Z.jsx)(Gr,{side:`top`,children:i}),t[32]=i,t[33]=n);let r;return t[34]!==e||t[35]!==n?(r=(0,Z.jsxs)(qr,{children:[e,n]}),t[34]=e,t[35]=n,t[36]=r):r=t[36],r}return O}function bh(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=Be(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>mh(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}=_(l),p;t[11]===u?p=t[12]:(p=u===void 0?[]:u,t[11]=u,t[12]=p);let m=p,[g,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(n);y!==n&&(b(n),v(!1));let x;t[13]!==m||t[14]!==g?(x=g?m:m.slice(0,ph),t[13]=m,t[14]=g,t[15]=x):x=t[15];let C=x,w;t[16]!==m.length||t[17]!==d?(w=(0,Z.jsx)(_h,{title:`Backlinks`,count:m.length,isLoading:d}),t[16]=m.length,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==m.length||t[20]!==f||t[21]!==g||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==C?(T=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(h,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):m.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(S,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=xr(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(yh,{icon:(0,Z.jsx)(Bt,{className:`size-3.5`}),title:e.title,path:gh(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:at(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(vh,{total:m.length,expanded:g,onToggle:()=>v(xh)})]}),t[19]=m.length,t[20]=f,t[21]=g,t[22]=r,t[23]=d,t[24]=i,t[25]=C,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(Lt,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:T})}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==w?(D=(0,Z.jsxs)(on,{defaultOpen:!0,children:[w,E]}),t[30]=E,t[31]=w,t[32]=D):D=t[32],D}function xh(e){return!e}function Sh(e){let t=(0,$.c)(50),{docName:n}=e,{folderPaths:r,pages:i,pagesBySlug:a,loading:o}=Be(),s,c;t[0]===n?(s=t[1],c=t[2]):(s=[`forward-links`,n],c=()=>hh(n),t[0]=n,t[1]=s,t[2]=c);let l;t[3]!==n||t[4]!==i||t[5]!==o?(l=!o&&i.has(n),t[3]=n,t[4]=i,t[5]=o,t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c||t[9]!==l?(u={queryKey:s,queryFn:c,enabled:l},t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10];let{data:d,isLoading:f,error:p}=_(u),m;t[11]===d?m=t[12]:(m=d===void 0?[]:d,t[11]=d,t[12]=m);let g=m,[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),x(!1));let T;t[13]!==b||t[14]!==g?(T=b?g:g.slice(0,ph),t[13]=b,t[14]=g,t[15]=T):T=t[15];let E=T,D;if(t[16]!==v||t[17]!==r||t[18]!==i||t[19]!==a){let e=v===null?null:Gt(v.docName,{pages:i,folderPaths:r,pagesBySlug:a});D=e===null?null:e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:Ut(e),t[16]=v,t[17]=r,t[18]=i,t[19]=a,t[20]=D}else D=t[20];let O=D,k;t[21]!==r||t[22]!==i||t[23]!==a||t[24]!==o?(k=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(yh,{icon:(0,Z.jsx)(br,{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=Gt(e.docName,{pages:i,folderPaths:r,pagesBySlug:a}),n=!o&&t.kind===`create`,s=!o&&t.kind===`navigate`&&t.displayState===`folder`,c=gh(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,d=at(t.kind===`navigate`?t.hashDocName:e.docName,e.anchor);return n?(0,Z.jsx)(yh,{icon:(0,Z.jsx)(q,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:`Missing page — click to create`,ariaLabel:`Missing page: ${e.title}. Click to create.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,onClick:()=>y(e)},u):s?(0,Z.jsx)(yh,{icon:(0,Z.jsx)(la,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:`Folder target: ${e.title}. Click to open the overview.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d,hoverAction:{icon:(0,Z.jsx)(mr,{className:`size-3.5`}),tooltip:`Create index note`,onClick:()=>y(e)}},u):(0,Z.jsx)(yh,{icon:(0,Z.jsx)(Bt,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u)},t[21]=r,t[22]=i,t[23]=a,t[24]=o,t[25]=k):k=t[25];let A=k,j;t[26]!==f||t[27]!==g.length?(j=(0,Z.jsx)(_h,{title:`Outgoing`,count:g.length,isLoading:f}),t[26]=f,t[27]=g.length,t[28]=j):j=t[28];let M;t[29]!==p||t[30]!==b||t[31]!==f||t[32]!==g.length||t[33]!==A||t[34]!==E?(M=p?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(h,{children:p instanceof Error?p.message:`Failed to load outgoing links`})}):g.length===0&&!f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(S,{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(A)}),(0,Z.jsx)(vh,{total:g.length,expanded:b,onToggle:()=>x(Ch)})]}),t[29]=p,t[30]=b,t[31]=f,t[32]=g.length,t[33]=A,t[34]=E,t[35]=M):M=t[35];let N;t[36]!==f||t[37]!==M?(N=(0,Z.jsx)(Lt,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":f,children:M})}),t[36]=f,t[37]=M,t[38]=N):N=t[38];let P;t[39]!==j||t[40]!==N?(P=(0,Z.jsxs)(on,{defaultOpen:!0,children:[j,N]}),t[39]=j,t[40]=N,t[41]=P):P=t[41];let F=v!==null,I=O?.initialDir??``,L=O?.suggestedName,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||y(null)},t[42]=R):R=t[42];let z;t[43]!==F||t[44]!==I||t[45]!==L?(z=(0,Z.jsx)($t,{open:F,kind:`file`,initialDir:I,suggestedName:L,onOpenChange:R}),t[43]=F,t[44]=I,t[45]=L,t[46]=z):z=t[46];let B;return t[47]!==P||t[48]!==z?(B=(0,Z.jsxs)(Z.Fragment,{children:[P,z]}),t[47]=P,t[48]=z,t[49]=B):B=t[49],B}function Ch(e){return!e}function wh(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)(bh,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(fh,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Sh,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(E,{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)(A,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var Th=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 Th{};function Eh(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 Dh(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 Oh(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 kh(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 Ah(e,t){return Oh(e,t,``)}function jh(e,t){return kh(e,t,``)}function Mh(e,t){return t.slice(0,Nh(e,t))}function Nh(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 Ph(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 Fh(e,t){if(t)return Lh(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Ih(e,t){if(t)return Lh(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Lh(e,t){if(!t)return[Ih(e),Fh(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Ph(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Rh=`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}`,zh=RegExp(`[${Rh}]+|\\s+|[^${Rh}]`,`ug`);new class extends Th{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=Ph(e,r)}else n=e.match(zh)||[];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)&&Bh(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Bh(n,i,r,null,t.intlSegmenter),e}};function Bh(e,t,n,r,i){if(t&&n){let[a,o]=Lh(t.value,i),[s,c]=Lh(n.value,i);if(e){let r=Eh(a,s);e.value=kh(e.value,s,r),t.value=Ah(t.value,r),n.value=Ah(n.value,r)}if(r){let e=Dh(o,c);r.value=Oh(r.value,c,e),t.value=jh(t.value,e),n.value=jh(n.value,e)}}else if(n){if(e){let e=Ih(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Ih(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Ih(r.value,i),[a,o]=Lh(t.value,i),s=Eh(n,a);t.value=Ah(t.value,s);let c=Dh(Ah(n,s),o);t.value=jh(t.value,c),r.value=Oh(r.value,n,c),e.value=kh(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Ih(r.value,i),n=Mh(Fh(t.value,i),e);t.value=jh(t.value,n)}else if(e){let n=Mh(Fh(e.value,i),Ih(t.value,i));t.value=Ah(t.value,n)}}new class extends Th{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Rh}]+|[^\\S\\n\\r]+|[^${Rh}]`,`ug`);return e.match(t)||[]}};var Vh=new class extends Th{constructor(){super(...arguments),this.tokenize=Uh}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;ei(t,{style:t=>Zr(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 Km.set(t.changes,i),i}function Ym(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(tm).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(Gm);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oi.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Wm.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Xm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(tm).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Gm).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 Zm(e){let t=new di;for(let n of e.field(tm)){let r=e.facet(Qp).overrideChunk&&eh(e,n);t.add(n.fromB,n.fromB,Jm(e,n,!!r))}return t.finish()}var Qm=ii.define({create:e=>Zm(e),update(e,t){return t.state.field(tm,!1)==t.startState.field(tm,!1)?e:Zm(t.state)},provide:e=>ci.decorations.from(e)}),$m=new WeakMap;function eh(e,t){let n=$m.get(t);if(n!==void 0)return n;n=null;let r=e.field(Gm),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(pi.widget({widget:new th(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(_m.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return $m.set(t,n),n}var th=class extends ai{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}},nh=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},rh=pi.line({class:`cm-inlineChangedLine`});function ih(e,t,n,r){let i=eh(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,nh),n.add(o.from,o.from,rh);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 ah=pn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),oh=Sn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function sh(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}=xe(),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,_;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?ah:oh,t=[ci.editable.of(!1),$r.readOnly.of(!0)],o=[_i,Bn(),...t,e,ci.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new ci({doc:r,extensions:[_i,Bn(),ci.editable.of(!1),e,ci.lineWrapping,Um({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ci.updateListener.of(e=>{let t=nm(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=nm(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new zm({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 ci({doc:r,extensions:[...o,Um({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},_=[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]=_):(g=t[8],_=t[9]),(0,Q.useEffect)(g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){let e=l.current;!e||!(e instanceof ci)||d.current?.(e.state.doc.toString())},t[10]=v):v=t[10];let y=v,b=p===0,x=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=S):S=t[11];let C;t[12]!==b||t[13]!==a||t[14]!==x||t[15]!==s||t[16]!==o?(C=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 ${b?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:x}),(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:!b,onClick:y,children:`Save resolution`})]})]}),t[12]=b,t[13]=a,t[14]=x,t[15]=s,t[16]=o,t[17]=C):C=t[17];let w;return t[18]===C?w=t[19]:(w=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[S,C]}),t[18]=C,t[19]=w),w}function ch(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)(Nr,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function lh(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)(Ir,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function uh(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)(Or,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dh(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)(uh,{}),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)(Mr,{"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)(Cr,{}),(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)(lh,{children:[l,(0,Z.jsxs)(Br,{"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 fh(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 ph(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)(Ar,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function mh(){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 hh(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 gh(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 _h=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function vh(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 hh(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)(Rr,{className:`shrink-0`,children:(0,Z.jsxs)(Dr,{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)(jr,{className:_h,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(zr,{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)(Dr,{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)(Rr,{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)(sh,{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)(jr,{className:`${_h} 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)(zr,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function yh(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(){mh().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(bh));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=()=>Xe(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&&(Hr.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 gh(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):Hr.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?Hr.info(`Merge aborted — sync paused`):Hr.error(`Failed to abort merge`)}catch{Hr.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)(ph,{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)(fh,{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)(dh,{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)(ch,{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)(vh,{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 bh(e){return e.file}function xh(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,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=Y(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Z.jsx)(zl,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Sh=5;async function Ch(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load backlinks`);return n.backlinks??[]}async function wh(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load outgoing links`);return n.forwardLinks??[]}function Th(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function Eh(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)(nn,{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)(k,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(O,{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)(Ft,{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 Dh(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=Sh)return null;let a=n-Sh,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{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 Oh(e){let t=(0,$.c)(37),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,onClick:p,hoverAction:m}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Y(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==f||t[7]!==d||t[8]!==p||t[9]!==a||t[10]!==l?(b=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:p,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,onClick:p,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`),children:a}),t[5]=u,t[6]=f,t[7]=d,t[8]=p,t[9]=a,t[10]=l,t[11]=b):b=t[11];let x=b,S;t[12]===y?S=t[13]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[12]=y,t[13]=S);let C;t[14]!==s||t[15]!==o||t[16]!==h?(C=h?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[14]=s,t[15]=o,t[16]=h,t[17]=C):C=t[17];let w;t[18]===c?w=t[19]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[18]=c,t[19]=w);let T;t[20]!==x||t[21]!==C||t[22]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[20]=x,t[21]=C,t[22]=w,t[23]=T):T=t[23];let E;t[24]===m?E=t[25]:(E=m?(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":m.tooltip,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 group-hover:opacity-100`,onClick:m.onClick,children:m.icon})}),(0,Z.jsx)(Gr,{side:`top`,children:m.tooltip})]}):null,t[24]=m,t[25]=E);let D;t[26]!==S||t[27]!==T||t[28]!==E?(D=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[S,T,E]}),t[26]=S,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O=D;if(i){let e;t[30]===O?e=t[31]:(e=(0,Z.jsx)(Wr,{asChild:!0,children:O}),t[30]=O,t[31]=e);let n;t[32]===i?n=t[33]:(n=(0,Z.jsx)(Gr,{side:`top`,children:i}),t[32]=i,t[33]=n);let r;return t[34]!==e||t[35]!==n?(r=(0,Z.jsxs)(qr,{children:[e,n]}),t[34]=e,t[35]=n,t[36]=r):r=t[36],r}return O}function kh(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=Be(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>Ch(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}=_(l),p;t[11]===u?p=t[12]:(p=u===void 0?[]:u,t[11]=u,t[12]=p);let m=p,[g,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(n);y!==n&&(b(n),v(!1));let x;t[13]!==m||t[14]!==g?(x=g?m:m.slice(0,Sh),t[13]=m,t[14]=g,t[15]=x):x=t[15];let C=x,w;t[16]!==m.length||t[17]!==d?(w=(0,Z.jsx)(Eh,{title:`Backlinks`,count:m.length,isLoading:d}),t[16]=m.length,t[17]=d,t[18]=w):w=t[18];let T;t[19]!==m.length||t[20]!==f||t[21]!==g||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==C?(T=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(h,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):m.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(S,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=xr(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(Oh,{icon:(0,Z.jsx)(Bt,{className:`size-3.5`}),title:e.title,path:Th(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:at(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(Dh,{total:m.length,expanded:g,onToggle:()=>v(Ah)})]}),t[19]=m.length,t[20]=f,t[21]=g,t[22]=r,t[23]=d,t[24]=i,t[25]=C,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(Lt,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:T})}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==w?(D=(0,Z.jsxs)(on,{defaultOpen:!0,children:[w,E]}),t[30]=E,t[31]=w,t[32]=D):D=t[32],D}function Ah(e){return!e}function jh(e){let t=(0,$.c)(50),{docName:n}=e,{folderPaths:r,pages:i,pagesBySlug:a,loading:o}=Be(),s,c;t[0]===n?(s=t[1],c=t[2]):(s=[`forward-links`,n],c=()=>wh(n),t[0]=n,t[1]=s,t[2]=c);let l;t[3]!==n||t[4]!==i||t[5]!==o?(l=!o&&i.has(n),t[3]=n,t[4]=i,t[5]=o,t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c||t[9]!==l?(u={queryKey:s,queryFn:c,enabled:l},t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10];let{data:d,isLoading:f,error:p}=_(u),m;t[11]===d?m=t[12]:(m=d===void 0?[]:d,t[11]=d,t[12]=m);let g=m,[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),x(!1));let T;t[13]!==b||t[14]!==g?(T=b?g:g.slice(0,Sh),t[13]=b,t[14]=g,t[15]=T):T=t[15];let E=T,D;if(t[16]!==v||t[17]!==r||t[18]!==i||t[19]!==a){let e=v===null?null:Gt(v.docName,{pages:i,folderPaths:r,pagesBySlug:a});D=e===null?null:e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:Ut(e),t[16]=v,t[17]=r,t[18]=i,t[19]=a,t[20]=D}else D=t[20];let O=D,k;t[21]!==r||t[22]!==i||t[23]!==a||t[24]!==o?(k=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(Oh,{icon:(0,Z.jsx)(br,{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=Gt(e.docName,{pages:i,folderPaths:r,pagesBySlug:a}),n=!o&&t.kind===`create`,s=!o&&t.kind===`navigate`&&t.displayState===`folder`,c=Th(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,d=at(t.kind===`navigate`?t.hashDocName:e.docName,e.anchor);return n?(0,Z.jsx)(Oh,{icon:(0,Z.jsx)(q,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:`Missing page — click to create`,ariaLabel:`Missing page: ${e.title}. Click to create.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,onClick:()=>y(e)},u):s?(0,Z.jsx)(Oh,{icon:(0,Z.jsx)(la,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:`Folder target: ${e.title}. Click to open the overview.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d,hoverAction:{icon:(0,Z.jsx)(mr,{className:`size-3.5`}),tooltip:`Create index note`,onClick:()=>y(e)}},u):(0,Z.jsx)(Oh,{icon:(0,Z.jsx)(Bt,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u)},t[21]=r,t[22]=i,t[23]=a,t[24]=o,t[25]=k):k=t[25];let A=k,j;t[26]!==f||t[27]!==g.length?(j=(0,Z.jsx)(Eh,{title:`Outgoing`,count:g.length,isLoading:f}),t[26]=f,t[27]=g.length,t[28]=j):j=t[28];let M;t[29]!==p||t[30]!==b||t[31]!==f||t[32]!==g.length||t[33]!==A||t[34]!==E?(M=p?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(h,{children:p instanceof Error?p.message:`Failed to load outgoing links`})}):g.length===0&&!f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(S,{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(A)}),(0,Z.jsx)(Dh,{total:g.length,expanded:b,onToggle:()=>x(Mh)})]}),t[29]=p,t[30]=b,t[31]=f,t[32]=g.length,t[33]=A,t[34]=E,t[35]=M):M=t[35];let N;t[36]!==f||t[37]!==M?(N=(0,Z.jsx)(Lt,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":f,children:M})}),t[36]=f,t[37]=M,t[38]=N):N=t[38];let P;t[39]!==j||t[40]!==N?(P=(0,Z.jsxs)(on,{defaultOpen:!0,children:[j,N]}),t[39]=j,t[40]=N,t[41]=P):P=t[41];let F=v!==null,I=O?.initialDir??``,L=O?.suggestedName,R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||y(null)},t[42]=R):R=t[42];let z;t[43]!==F||t[44]!==I||t[45]!==L?(z=(0,Z.jsx)($t,{open:F,kind:`file`,initialDir:I,suggestedName:L,onOpenChange:R}),t[43]=F,t[44]=I,t[45]=L,t[46]=z):z=t[46];let B;return t[47]!==P||t[48]!==z?(B=(0,Z.jsxs)(Z.Fragment,{children:[P,z]}),t[47]=P,t[48]=z,t[49]=B):B=t[49],B}function Mh(e){return!e}function Nh(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)(kh,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(xh,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(jh,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(E,{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)(A,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var Ph=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 Ph{};function Fh(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 Ih(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 Lh(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 Rh(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 zh(e,t){return Lh(e,t,``)}function Bh(e,t){return Rh(e,t,``)}function Vh(e,t){return t.slice(0,Hh(e,t))}function Hh(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 Uh(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 Wh(e,t){if(t)return Kh(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Gh(e,t){if(t)return Kh(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Kh(e,t){if(!t)return[Gh(e),Wh(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Uh(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var qh=`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}`,Jh=RegExp(`[${qh}]+|\\s+|[^${qh}]`,`ug`);new class extends Ph{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=Uh(e,r)}else n=e.match(Jh)||[];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)&&Yh(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Yh(n,i,r,null,t.intlSegmenter),e}};function Yh(e,t,n,r,i){if(t&&n){let[a,o]=Kh(t.value,i),[s,c]=Kh(n.value,i);if(e){let r=Fh(a,s);e.value=Rh(e.value,s,r),t.value=zh(t.value,r),n.value=zh(n.value,r)}if(r){let e=Ih(o,c);r.value=Lh(r.value,c,e),t.value=Bh(t.value,e),n.value=Bh(n.value,e)}}else if(n){if(e){let e=Gh(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Gh(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Gh(r.value,i),[a,o]=Kh(t.value,i),s=Fh(n,a);t.value=zh(t.value,s);let c=Ih(zh(n,s),o);t.value=Bh(t.value,c),r.value=Lh(r.value,n,c),e.value=Rh(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Gh(r.value,i),n=Vh(Wh(t.value,i),e);t.value=Bh(t.value,n)}else if(e){let n=Vh(Wh(e.value,i),Gh(t.value,i));t.value=zh(t.value,n)}}new class extends Ph{tokenize(e){let t=RegExp(`(\\r?\\n)|[${qh}]+|[^\\S\\n\\r]+|[^${qh}]`,`ug`);return e.match(t)||[]}};var Xh=new class extends Ph{constructor(){super(...arguments),this.tokenize=Qh}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 Hh(e,t,n){return Vh.diff(e,t,n)}function Uh(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 Wh(e){return e==`.`||e==`!`||e==`?`}new class extends Th{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(Wh(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 Th{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Th{constructor(){super(...arguments),this.tokenize=Uh}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(Gh(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 Gh(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]=Gh(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]=Gh(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Th{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var Kh={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function qh(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;Hh(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(Hh(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||Zh(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 Jh(e,t){if(t||=Kh,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=>Jh(e,t)).join(`
19
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Zh(e,t,n){return Xh.diff(e,t,n)}function Qh(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 $h(e){return e==`.`||e==`!`||e==`?`}new class extends Ph{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($h(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 Ph{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Ph{constructor(){super(...arguments),this.tokenize=Qh}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(eg(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 eg(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]=eg(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]=eg(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Ph{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var tg={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function ng(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;Zh(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(Zh(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||og(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 rg(e,t){if(t||=tg,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=>rg(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 Yh(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;qh(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Jh(e,o.headerOptions):void 0)}}))}else{let s=qh(e,t,n,r,i,a,o);return s?Jh(s,o?.headerOptions):void 0}}function Xh(e,t,n,r,i,a){return Yh(e,e,t,n,r,i,a)}function Zh(e){let t=e.endsWith(`
24
+ `}function ig(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;ng(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?rg(e,o.headerOptions):void 0)}}))}else{let s=ng(e,t,n,r,i,a,o);return s?rg(s,o?.headerOptions):void 0}}function ag(e,t,n,r,i,a){return ig(e,e,t,n,r,i,a)}function og(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 Qh(e,t){return`${e}\u0000${t}`}function $h(e,t,n){let r=G(e).body,i=G(t).body;return r===i?``:Xh(n,r,i,``,``,{context:3})}function eg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=jn(),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=Qh(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=$h(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 tg=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityPanelDiffView-C1vRNF09.js`),__vite__mapDeps([9,1,6,10]),import.meta.url)).ActivityPanelDiffView}));function ng(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 rg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ig(e){return e.slice(0,7)}function ag(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 og(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)(Qn,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ir,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Xn,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(tr,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(lr,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(sr,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ar,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function sg(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)(ua,{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=lt(i),t[1]=i,t[2]=a);let o=a,s=r?Ee[o]??Ie[o]:Ie[o],c;t[3]!==s||t[4]!==i?(c=s??rt(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)(og,{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)(pa,{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)(Pi,{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)($a,{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)(ar,{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)(Pi,{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)($a,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function cg(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r);if(n.length===0)return null;let p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>f(lg),t[0]=p):p=t[0];let m;t[1]===d?m=t[2]:(m=d?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{className:`size-3`}),t[1]=d,t[2]=m);let h=d?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,g;t[3]!==d||t[4]!==m||t[5]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:p,children:[m,h]}),t[3]=d,t[4]=m,t[5]=h,t[6]=g):g=t[6];let _;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==d||t[12]!==c||t[13]!==i||t[14]!==u||t[15]!==l?(_=d&&n.map(e=>(0,Z.jsx)(Cg,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=d,t[12]=c,t[13]=i,t[14]=u,t[15]=l,t[16]=_):_=t[16];let v;return t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19],v}function lg(e){return!e}function ug(e){return e.checkpoint?e.checkpoint.kind:`save`}function dg(e){let t=ug(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${fg(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function fg(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function pg(e){return e.type===`checkpoint`?ug(e)===`save`?`version`:`auto-save`:`wip`}var mg={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},hg={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function gg(e){return mg[pg(e)]}function _g(e){return hg[pg(e)]}function vg(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function yg(e){let t=(0,$.c)(20),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(xg),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(bg)},children:[r?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{className:`size-3`}),r?`Hide ${s.length} more`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function bg(e){return!e}function xg(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 Sg(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=eg(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)(Rt,{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)(Rt,{className:`size-3 animate-spin`}),`Loading diff renderer…`]}),children:(0,Z.jsx)(tg,{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 Cg(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=ng(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=ag(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(wg),_;t[4]===n?_=t[5]:(_=vg(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}),Hr.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=await r.json();t.error&&(e=t.error)}catch{}console.error(`[timeline] rollback failed`,{docName:s,sha:n.sha,status:r.status,detail:e}),Hr.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=ug(n);return e===`bridge-merge-loss`?(0,Z.jsx)(q,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(ra,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(ta,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(sg,{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:dg(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=gg(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)(Rt,{className:`size-3 animate-spin`}):(0,Z.jsx)($n,{className:`size-3`}),t[40]=x,t[41]=K);let ee;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==K?(ee=(0,Z.jsx)(Wr,{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]=ee):ee=t[46];let te;t[47]===n?te=t[48]:(te=gg(n),t[47]=n,t[48]=te);let ne;t[49]===te?ne=t[50]:(ne=(0,Z.jsx)(Gr,{side:`top`,children:te}),t[49]=te,t[50]=ne);let re;t[51]!==ee||t[52]!==ne?(re=(0,Z.jsxs)(qr,{children:[ee,ne]}),t[51]=ee,t[52]=ne,t[53]=re):re=t[53];let ie;t[54]!==V||t[55]!==H||t[56]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,re]}),t[54]=V,t[55]=H,t[56]=re,t[57]=ie):ie=t[57];let ae;t[58]===v?ae=t[59]:(ae=v.length>0&&(0,Z.jsx)(yg,{summaries:v}),t[58]=v,t[59]=ae);let oe=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}),se;t[60]!==ie||t[61]!==ae||t[62]!==oe?(se=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ie,ae,oe]}),t[60]=ie,t[61]=ae,t[62]=oe,t[63]=se):se=t[63];let ce;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==se?(ce=(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,se]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=se,t[71]=ce):ce=t[71];let le;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(le=c&&(0,Z.jsx)(Sg,{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]=le):le=t[78];let ue;t[79]!==ce||t[80]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ce,le]}),t[79]=ce,t[80]=le,t[81]=ue):ue=t[81];let de;t[82]!==A||t[83]!==b?(de=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=de):de=t[84];let fe;t[85]===n?fe=t[86]:(fe=_g(n),t[85]=n,t[86]=fe);let pe;t[87]===fe?pe=t[88]:(pe=(0,Z.jsx)(Dr,{children:fe}),t[87]=fe,t[88]=pe);let me;t[89]===n.timestamp?me=t[90]:(me=rg(n.timestamp),t[89]=n.timestamp,t[90]=me);let he;t[91]===n.sha?he=t[92]:(he=ig(n.sha),t[91]=n.sha,t[92]=he);let ge;t[93]!==p||t[94]!==me||t[95]!==he?(ge=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,me,`, `,he,`)`]}),t[93]=p,t[94]=me,t[95]=he,t[96]=ge):ge=t[96];let _e;t[97]===h?_e=t[98]:(_e=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=_e);let ve;t[99]!==ge||t[100]!==_e?(ve=(0,Z.jsxs)(Tr,{children:[`This will replace the current document content with the version from`,` `,ge,` `,`by `,_e,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=ge,t[100]=_e,t[101]=ve):ve=t[101];let ye;t[102]!==pe||t[103]!==ve?(ye=(0,Z.jsxs)(Rr,{children:[pe,ve]}),t[102]=pe,t[103]=ve,t[104]=ye):ye=t[104];let be;t[105]===A?be=t[106]:(be=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=be);let xe;t[107]===M?xe=t[108]:(xe=()=>M(),t[107]=M,t[108]=xe);let Se;t[109]===x?Se=t[110]:(Se=x?(0,Z.jsx)(Rt,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=Se);let Ce;t[111]!==x||t[112]!==xe||t[113]!==Se?(Ce=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:xe,children:[Se,`Restore`]}),t[111]=x,t[112]=xe,t[113]=Se,t[114]=Ce):Ce=t[114];let we;t[115]!==be||t[116]!==Ce?(we=(0,Z.jsxs)(Fr,{children:[be,Ce]}),t[115]=be,t[116]=Ce,t[117]=we):we=t[117];let Te;t[118]!==ye||t[119]!==we?(Te=(0,Z.jsxs)(jr,{children:[ye,we]}),t[118]=ye,t[119]=we,t[120]=Te):Te=t[120];let Ee;t[121]!==y||t[122]!==de||t[123]!==Te?(Ee=(0,Z.jsx)(zr,{open:y,onOpenChange:de,children:Te}),t[121]=y,t[122]=de,t[123]=Te,t[124]=Ee):Ee=t[124];let De;return t[125]!==ue||t[126]!==Ee?(De=(0,Z.jsxs)(Z.Fragment,{children:[ue,Ee]}),t[125]=ue,t[126]=Ee,t[127]=De):De=t[127],De}function wg(e){return e.docs}function Tg(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=xe(),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)(kg),[g,_]=(0,Q.useState)(Og),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(Dg),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)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsxs)(it,{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)(Ye,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Fa,{className:`size-3.5`})}),(0,Z.jsx)(Ye,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Zi,{className:`size-3.5`})})]})}),(0,Z.jsx)(Gr,{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(Eg)}),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)(Cg,{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)(Cg,{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)(cg,{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 Eg(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(ur,{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)(ur,{className:`h-3 w-28`}),(0,Z.jsx)(ur,{className:`h-3 w-40`})]})]},e)}function Dg(e){return e.type===`checkpoint`}function Og(){return new Set}function kg(){return new er(32)}var Ag=[{id:`outline`,label:`Outline`,icon:Ca},{id:`links`,label:`Links`,icon:ya},{id:`graph`,label:`Graph`,icon:Ea},{id:`timeline`,label:`Timeline`,icon:qi}];function jg(){return r(()=>import(`./GraphPanel-BuZEMdl-.js`),__vite__mapDeps([11,1,12,3,5,6,13,14,15,16,17]),import.meta.url)}var Mg=(0,Q.lazy)(async()=>({default:(await jg()).GraphPanel})),Ng=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityModeContent-CCJOMAyp.js`),__vite__mapDeps([18,1,2,3,19,20,21,13,12,5,6,22,7,14,23]),import.meta.url)).ActivityModeContent}));function Pg(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)(it,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:Ag.map(Fg)})}):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)(gi,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(wh,{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)(Mg,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(Tg,{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)(Ng,{})})}),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 Fg(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Ye,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(Wr,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(Gr,{side:`bottom`,children:n})]},t)}function Ig(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Lg(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Rg(e){return e/100*window.innerHeight}function zg(e){return e/100*window.innerWidth}function Bg(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 Vg({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Bg(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Lg(t,i);break;case`em`:r=Ig(t,i);break;case`vh`:r=Rg(i);break;case`vw`:r=zg(i);break}return r}function Hg(e){return parseFloat(e.toFixed(3))}function Ug({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 Wg(e){let{panels:t}=e,n=Ug({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=Hg(Vg({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Hg(Vg({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Hg(Vg({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Hg(Vg({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 Gg(e,t=`Assertion error`){if(!e)throw Error(t)}function Kg(e,t){return Array.from(t).sort(e===`horizontal`?qg:Jg)}function qg(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Jg(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Yg(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Xg(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 Zg({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}=Xg(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Gg(i,`No rect found`),i}var Qg;function $g(){return Qg===void 0&&(Qg=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Qg}function e_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Kg(n,Array.from(t.children).filter(Yg).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,Zg({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=$g()?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:Ug({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 t_=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)}}},n_=new Map,r_=new t_;function i_(e){n_=new Map(n_),n_.delete(e)}function a_(e,t){for(let[t]of n_)if(t.id===e)return t}function o_(e,t){for(let[t,n]of n_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function s_(){return n_}function c_(e,t){return r_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function l_(e,t){let n=n_.get(e);n_=new Map(n_),n_.set(e,t),r_.emit(`groupChange`,{group:e,prev:n,next:t})}function u_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Xg(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 d_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function f_(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:v_(e),b:v_(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Gg(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:__(g_(n.a)),b:__(g_(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 p_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function m_(e){let t=getComputedStyle(y_(e)??e).display;return t===`flex`||t===`inline-flex`}function h_(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||m_(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`||p_.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function g_(e){let t=e.length;for(;t--;){let n=e[t];if(Gg(n,`Missing node`),h_(n))return n}return null}function __(e){return e&&Number(getComputedStyle(e).zIndex)||0}function v_(e){let t=[];for(;e;)t.push(e),e=y_(e);return t}function y_(e){let{parentNode:t}=e;return d_(t)?t.host:t}function b_(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 x_({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Yg(n)||n.contains(e)||e.contains(n))return!0;if(f_(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(b_(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function S_(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=e_(r),a=u_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&x_({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function C_(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 w_(e,t,n=0){return Math.abs(Hg(e)-Hg(t))<=n}function T_(e,t){return w_(e,t)?0:e>t?1:-1}function E_({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(T_(r,c)<0)if(a){let e=(i+c)/2;r=T_(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Hg(r),r}function D_({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(w_(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Gg(u!=null,`Invalid first pivot index`),Gg(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Gg(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(Gg(n!=null,`Previous layout not found for panel index ${t}`),w_(n,i)){let t=o-n;T_(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Gg(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(Gg(n!=null,`Previous layout not found for panel index ${t}`),w_(n,o)){let t=n-i;T_(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Gg(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&T_(i,c)<0)if(e>0){let t=c-o,n=t/2;T_(i+e,c)<0&&(e=T_(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;T_(i-e,c)<0&&(e=T_(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];Gg(e!=null,`Previous layout not found for panel index ${r}`);let a=E_({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];Gg(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=E_({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!w_(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(C_(c,l))return i;{let t=e<0?d:u,r=s[t];Gg(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=E_({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!w_(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Gg(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=E_({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(w_(i,s)||(t-=s-i,l[r]=s),w_(t,0))break;e>0?r--:r++}}}if(!w_(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 O_(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||T_(e[n],t[n])!==0)return!1;return!0}function k_({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(!w_(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Gg(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];Gg(i!=null,`No layout data found for index ${e}`);let o=r[e];Gg(o!=null,`No layout data found for index ${e}`);let s=E_({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!w_(a,0))for(let e=0;e<t.length;e++){let n=r[e];Gg(n!=null,`No layout data found for index ${e}`);let i=n+a,o=E_({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,w_(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function A_({groupId:e,panelId:t}){let n=()=>{let t=s_();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=k_({layout:D_({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});O_(l,p)||l_(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&&w_(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Ug({group:t});o(Hg(Vg({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function j_(e){e.defaultPrevented||S_(e,s_()).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=A_({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function M_(e){let t=s_();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 N_({groupId:e}){let t=()=>{let t=s_();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=k_({layout:e,panelConstraints:r});return n?o:(O_(o,c)||l_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function P_(e,t){let n=M_(e),r=o_(n.id,!0),i=n.separators.find(t=>t.element===e);Gg(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Gg(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=N_({groupId:n.id}).getLayout(),c=k_({layout:D_({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});O_(s,c)||l_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function F_(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=M_(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&P_(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&P_(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&P_(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&P_(t,-5);break;case`End`:e.preventDefault(),P_(t,100);break;case`Enter`:{e.preventDefault();let n=M_(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=o_(n.id,!0),o=n.separators.find(e=>e.element===t);Gg(o,`Matching separator not found`);let s=a.get(o);Gg(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Gg(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];P_(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=M_(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Gg(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(),P_(t,-100);break}}var I_={cursorFlags:0,state:`inactive`},L_=new t_;function R_(){return I_}function z_(e){return L_.addListener(`change`,e)}function B_(e){let t=I_,n={...I_};n.cursorFlags=e,I_=n,L_.emit(`change`,{prev:t,next:n})}function V_(e){let t=I_;I_=e,L_.emit(`change`,{prev:t,next:e})}function H_(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=s_(),n=S_(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)}),V_({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var U_=e=>e,W_=()=>{},G_=1,K_=2,q_=4,J_=8,Y_=3,X_=12,Z_;function Q_(){return Z_===void 0&&(Z_=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Z_=!0)),Z_}function $_({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&&Q_()){let t=(e&G_)!==0,n=(e&K_)!==0,r=(e&q_)!==0,i=(e&J_)!==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 Q_()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ev=new WeakMap;function tv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ev.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=R_();switch(r.state){case`active`:case`hover`:{let e=$_({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}ev.set(e,{prevStyle:t,styleSheet:n})}function nv({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=D_({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(O_(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?G_:K_;break;case`vertical`:s|=d<0?q_:J_;break}}else l_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Y_:c|=s&Y_,t.movementY===0?c|=o&X_:c|=s&X_,B_(c),tv(e)}function rv(e){let t=s_(),n=R_();switch(n.state){case`active`:nv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function iv(e){if(e.defaultPrevented)return;let t=R_(),n=s_();switch(t.state){case`active`:if(e.buttons===0){V_({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=o_(e.group.id,!0);l_(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)}nv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=S_(e,n);r.length===0?t.state!==`inactive`&&V_({cursorFlags:0,state:`inactive`}):V_({cursorFlags:0,hitRegions:r,state:`hover`}),tv(e.currentTarget);break}}}function av(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(R_().state){case`hover`:V_({cursorFlags:0,state:`inactive`})}}function ov(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=R_();switch(t.state){case`active`:V_({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(tv(e.currentTarget),t.hitRegions.forEach(e=>{let t=o_(e.group.id,!0);l_(e.group,t)}),e.preventDefault())}}function sv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Hg(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Hg((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function cv(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Ug({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Hg(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function lv(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 uv({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=Hg(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]=Hg((r[e]??0)/a*l);else{let e=Hg(l/c.length);for(let t of c)u[t]=e}return u}function dv(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 fv=new Map;function pv(e){let t=!0;Gg(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=Ug({group:e});if(t===0)return;let n=o_(e.id);if(!n)return;let r=Wg(e),i=n.defaultLayoutDeferred?sv(r):n.layout,a=k_({layout:uv({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&O_(n.layout,a)&&lv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;l_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else cv(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Gg(!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=Ug({group:e}),s=Wg(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(dv(e.panels,l)||(l=void 0));let u=k_({layout:e.mutableState.layouts[c]??l??sv(s),panelConstraints:s}),d=e.element.ownerDocument;fv.set(d,(fv.get(d)??0)+1);let f=new Map;return e_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),l_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Gg(!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`,F_)}),fv.get(d)===1&&(d.addEventListener(`dblclick`,j_,!0),d.addEventListener(`pointerdown`,H_,!0),d.addEventListener(`pointerleave`,rv),d.addEventListener(`pointermove`,iv),d.addEventListener(`pointerout`,av),d.addEventListener(`pointerup`,ov,!0)),function(){t=!1,fv.set(d,Math.max(0,(fv.get(d)??0)-1)),i_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,F_)}),fv.get(d)||(d.removeEventListener(`dblclick`,j_,!0),d.removeEventListener(`pointerdown`,H_,!0),d.removeEventListener(`pointerleave`,rv),d.removeEventListener(`pointermove`,iv),d.removeEventListener(`pointerout`,av),d.removeEventListener(`pointerup`,ov,!0)),a.disconnect()}}function mv(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function hv(e){let t=(0,Q.useId)();return`${e??t}`}var gv=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function _v(e){let t=(0,Q.useRef)(e);return gv(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function vv(...e){return _v(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function yv(e){let t=(0,Q.useRef)({...e});return gv(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var bv=(0,Q.createContext)(null);function xv(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:U_});(0,Q.useImperativeHandle)(t,()=>n.current,[]),gv(()=>{Object.assign(n.current,N_({groupId:e}))})}function Sv({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=_v(e=>{O_(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=_v(e=>{O_(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=hv(s),v=(0,Q.useRef)(null),[y,b]=mv(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=vv(v,a);xv(_,o);let C=_v((e,t)=>{let r=R_(),i=a_(e),a=o_(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=yv({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=Kg(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Kg(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=a_(_),i=o_(_);r&&i&&l_(r,{...i,derivedPanelConstraints:Wg(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 gv(()=>{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=pv(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=o_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=c_(_,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=w_(t.collapsedSize,i[t.panelId]),a=w_(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=R_().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)(bv.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})})}Sv.displayName=`Group`;function Cv(){let e=(0,Q.useContext)(bv);return Gg(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function wv(e,t){let{id:n}=Cv(),r=(0,Q.useRef)({collapse:W_,expand:W_,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:W_});(0,Q.useImperativeHandle)(t,()=>r.current,[]),gv(()=>{Object.assign(r.current,A_({groupId:n,panelId:e}))})}function Tv({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=hv(c),_=yv({disabled:a}),v=(0,Q.useRef)(null),y=vv(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Cv(),T=d!==null,E=_v((e,t,n)=>{d?.(e,c,n)});gv(()=>{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]),wv(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>c_(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:{...Ev,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})})}Tv.displayName=`Panel`;var Ev={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Dv(){return(0,Q.useRef)(null)}function Ov({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=k_({layout:D_({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=k_({layout:D_({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function kv({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=hv(a),l=yv({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=vv(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Cv(),x=v===`horizontal`?`vertical`:`horizontal`;gv(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=z_(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=c_(_,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(Ov({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})}kv.displayName=`Separator`;function Av(){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)(ur,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(ur,{className:`h-4 w-full`}),(0,Z.jsx)(ur,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var jv=1700,Mv=3;function Nv(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Mv;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Pv={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}},Fv=[`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 Iv(e,t={}){let n=t.rng??Math.random,r=t.colors??Fv,i=Pv[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 Lv=1.8,Rv=90,zv=16,Bv=380,Vv=.025,Hv=.1,Uv=.18,Wv=400,Gv=9.2736,Kv=18.1799,qv=14.5244,Jv={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Yv(e,t){let{halfWidth:n,apexLift:r}=Jv[t];return`M${e-n} ${qv+.3} Q${e} ${qv-r}, ${e+n} ${qv+.3}`}function Xv(e){let t=1.5,n=.3;return`M${e-t} ${qv-n} Q${e} ${qv+1.4}, ${e+t} ${qv-n}`}var Zv=15,Qv=15;function $v(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 ey(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=Nv(g,t);_(n),y(iy),S(Iv(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},jv)},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(ry),S(Iv(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},jv))},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(r){e=r.clientX,t=r.clientY,n=!0};function u(){if(s=requestAnimationFrame(u),!n)return;let c=f.current,l=d.current;if(!c||!l)return;let m=c.getBoundingClientRect(),g=m.left+m.width/2,_=m.top+m.height*.48,v=e-g,y=t-_,b=Math.hypot(v,y),x=Math.max(-1,Math.min(1,v/Bv)),S=Math.max(-1,Math.min(1,y/Bv)),C=x*zv,w=-S*zv;r+=(w-r)*Hv,i+=(C-i)*Hv,l.style.transform=`perspective(${Wv}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`;let T=0,E=0;if(b>=1){let e=Math.min(b/Rv,1)*Lv;T=v/b*e,E=y/b*e}a+=(T-a)*Uv,o+=(E-o)*Uv;let D=i*Vv,O=-r*Vv,k=a+D,A=o+O;h.current.x=k,h.current.y=A,p.current?.setAttribute(`transform`,`translate(${k.toFixed(3)} ${A.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),s=requestAnimationFrame(u),()=>{document.removeEventListener(`mousemove`,l),cancelAnimationFrame(s),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:Gv,cy:qv,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,q;t[26]===ee?q=t[27]:(q=Y(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=q);let te;t[28]===q?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:Kv,cy:qv,rx:1.2722,ry:1.9083,className:q}),t[28]=q,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=Yv(Gv,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=Yv(Kv,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:Xv(Gv),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Xv(Kv),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(ty)},`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:ny,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 ty(e){return(0,Z.jsx)(`circle`,{cx:Zv+e.originDx,cy:Qv+e.originDy,r:e.size,className:`ok-blob-firework`,style:$v(e)},e.id)}function ny(e){return e.preventDefault()}function ry(e){return e+1}function iy(e){return e+1}var ay=Et(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function oy(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=Y(ay({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function sy(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/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cy(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/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(fr,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ly(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-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uy(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(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dy(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)(jl,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fy(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)(Nl,{"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)(Ml,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function py(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:t=>e.seed.plan(t),apply:t=>e.seed.apply(t)}:{plan:async e=>{let t=e?`?rootDir=${encodeURIComponent(e)}`:``;return await(await fetch(`/api/seed/plan${t}`)).json()},apply:async e=>await(await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e})})).json()}}function my(e){let t=(0,$.c)(45),{open:n,onOpenChange:r,onSeedApplied:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`loading`},t[0]=a):a=t[0];let[o,s]=(0,Q.useState)(a),[c,l]=(0,Q.useState)(`project-root`),[u,d]=(0,Q.useState)(`brain`),f=(0,Q.useRef)(!0),p,m;t[1]===n?(p=t[2],m=t[3]):(p=()=>{n&&(l(`project-root`),d(`brain`),f.current=!0)},m=[n],t[1]=n,t[2]=p,t[3]=m),(0,Q.useEffect)(p,m);let h;t[4]===u?h=t[5]:(h=u.trim(),t[4]=u,t[5]=h);let g=h,_=c===`subfolder`&&g===``,v,y;t[6]!==n||t[7]!==c||t[8]!==_||t[9]!==g?(v=()=>{if(!n)return;if(_){s({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=c===`project-root`?void 0:g,t=f.current?0:200;f.current=!1;let r=!1,i=setTimeout(()=>{r||(s(hy),py().plan(e).then(e=>{if(!r){if(!e.ok){s({kind:`error`,message:e.error.message});return}s(e.plan.created.length>0||e.plan.configEdits.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||s({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},y=[n,c,g,_],t[6]=n,t[7]=c,t[8]=_,t[9]=g,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==i||t[14]!==o.kind||t[15]!==o.plan?(b=async function(){if(o.kind!==`plan`)return;s({kind:`applying`,plan:o.plan});let e=await py().apply(o.plan);e.ok?(Hr.success(`LLM brain initialized (${e.result.applied} ${e.result.applied===1?`entry`:`entries`})`),i?.(),r(!1)):(Hr.error(`Initialize failed: ${e.error.message}`),s({kind:`error`,message:e.error.message}))},t[12]=r,t[13]=i,t[14]=o.kind,t[15]=o.plan,t[16]=b):b=t[16];let x=b,S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(Rr,{children:[(0,Z.jsxs)(Dr,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-4 w-4 text-foreground opacity-70`}),`Initialize LLM brain`]}),(0,Z.jsx)(Tr,{children:`Three layers designed so AI agents can navigate naturally: raw sources, working drafts, and canonical articles.`})]}),t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==u?(C=(0,Z.jsx)(gy,{choice:c,subfolder:u,onChoiceChange:l,onSubfolderChange:d}),t[18]=c,t[19]=u,t[20]=C):C=t[20];let w;t[21]===o?w=t[22]:(w=(0,Z.jsx)(_y,{phase:o}),t[21]=o,t[22]=w);let T;t[23]!==w||t[24]!==C?(T=(0,Z.jsxs)(Pr,{className:`space-y-6`,children:[C,w]}),t[23]=w,t[24]=C,t[25]=T):T=t[25];let E;t[26]===r?E=t[27]:(E=()=>r(!1),t[26]=r,t[27]=E);let D=o.kind===`already-seeded`||o.kind===`error`?`Close`:`Cancel`,O;t[28]!==E||t[29]!==D?(O=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:E,children:D}),t[28]=E,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==x||t[32]!==o.kind||t[33]!==_?(k=o.kind===`plan`?(0,Z.jsx)(X,{onClick:x,disabled:_,children:`Initialize`}):o.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(Rt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up…`]}):null,t[31]=x,t[32]=o.kind,t[33]=_,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Z.jsxs)(Fr,{children:[O,k]}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==T||t[39]!==A?(j=(0,Z.jsxs)(jr,{className:`sm:max-w-2xl`,"data-ok-layer-spawned":``,children:[S,T,A]}),t[38]=T,t[39]=A,t[40]=j):j=t[40];let M;return t[41]!==r||t[42]!==n||t[43]!==j?(M=(0,Z.jsx)(zr,{open:n,onOpenChange:r,children:j}),t[41]=r,t[42]=n,t[43]=j,t[44]=M):M=t[44],M}function hy(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function gy(e){let t=(0,$.c)(21),{choice:n,subfolder:r,onChoiceChange:i,onSubfolderChange:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Where should the brain live?`}),t[0]=o):o=t[0];let s;t[1]===i?s=t[2]:(s=e=>i(e),t[1]=i,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(cy,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(oy,{orientation:`horizontal`,children:[(0,Z.jsxs)(sy,{children:[(0,Z.jsx)(ly,{children:`Project root`}),(0,Z.jsx)(uy,{children:`Scaffold the three folders directly under this project.`})]}),(0,Z.jsx)(fy,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=c):c=t[3];let l,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ly,{children:`In a subfolder`}),u=(0,Z.jsx)(uy,{className:`nth-last-2:mt-0`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=l,t[5]=u):(l=t[4],u=t[5]);let d;t[6]===a?d=t[7]:(d=e=>a(e.target.value),t[6]=a,t[7]=d);let f;t[8]===i?f=t[9]:(f=()=>i(`subfolder`),t[8]=i,t[9]=f);let p;t[10]!==r||t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(sy,{children:[l,u,(0,Z.jsx)(Gn,{value:r,onChange:d,onFocus:f,placeholder:`brain`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=r,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(fy,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,Z.jsx)(cy,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(oy,{orientation:`horizontal`,children:[p,m]})}),t[15]=p,t[16]=h);let g;return t[17]!==n||t[18]!==h||t[19]!==s?(g=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[o,(0,Z.jsxs)(dy,{className:`sm:flex`,value:n,onValueChange:s,children:[c,h]})]}),t[17]=n,t[18]=h,t[19]=s,t[20]=g):g=t[20],g}function _y(e){let t=(0,$.c)(11),{phase:n}=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)(Rt,{"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 LLM brain is already set up.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The three-layer structure is in place — there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let r=n.plan,i;t[4]===r?i=t[5]:(i=(0,Z.jsx)(Cy,{plan:r}),t[4]=r,t[5]=i);let a;t[6]===r.warnings?a=t[7]:(a=r.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:r.warnings.map(vy)}):null,t[6]=r.warnings,t[7]=a);let o;return t[8]!==i||t[9]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function vy(e){return(0,Z.jsx)(`p`,{children:e},e)}var yy=[{name:`external-sources`,blurb:`Raw sources saved verbatim — full text of URLs and PDFs, not just citations. Every claim traces back to preserved evidence.`},{name:`research`,blurb:`Provisional analysis synthesizing sources. Every claim cites a doc; promotes to articles/ once the team trusts the findings.`},{name:`articles`,blurb:`Canonical decisions. Each links back through research/ to its sources — no dead links, full evidence chain in repo.`}],by={"log.md":`Append-only timeline`};function xy(e){return e.split(`/`).pop()??e}function Sy(e){let t=new Map(yy.map(e=>[e.name,e.blurb])),n=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:t.get(xy(e.path))??``})),r=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:by[xy(e.path)]??``})),i=e.configEdits.length>0?[{kind:`config`,name:`.ok/config.yml`,description:`Folder descriptions for AI agents`}]:[];return[...n,...r,...i]}function Cy(e){let t=(0,$.c)(13),{plan:n}=e,r,i,a,o;if(t[0]!==n){let e=Sy(n);a=`space-y-3`,t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(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[5]=o):o=t[5],r=`space-y-3 overflow-y-auto subtle-scrollbar max-h-full`,i=e.map(wy),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[6]!==r||t[7]!==i?(s=(0,Z.jsx)(`ul`,{className:r,children:i}),t[6]=r,t[7]=i,t[8]=s):s=t[8];let c;return t[9]!==a||t[10]!==o||t[11]!==s?(c=(0,Z.jsxs)(`section`,{className:a,children:[o,s]}),t[9]=a,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function wy(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)(la,{"aria-hidden":`true`,className:`mt-1 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):e.kind===`config`?(0,Z.jsx)(ia,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(aa,{"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)}function Ty(){let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(`loading`),[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(){let t=fetch(`/api/documents`).then(async t=>{let n=await t.json().catch(Ay);e||(t.ok&&n?.ok&&Array.isArray(n.documents)?(i(n.documents.length),l.current=!0):l.current||=(i(1),!0))}).catch(()=>{!e&&!l.current&&(i(1),l.current=!0)}),n=(async()=>{let t=typeof window<`u`?window.okDesktop:void 0;try{let n=t?.seed?await t.seed.plan():await fetch(`/api/seed/plan`).then(ky);if(e)return;if(!n?.ok){o(`error`);return}o(n.plan.created.length>0||n.plan.configEdits.length>0?`has-work`:`seeded`)}catch{e||o(`error`)}})();await Promise.all([t,n])};t();let n=Xe(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(Oy),250),o(`seeded`),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(Dy);e.ok&&t?.ok&&Array.isArray(t.documents)&&i(t.documents.length)}).catch(Ey)},e[2]=p):p=e[2];let m=p,h=a===`has-work`,g=r!==null&&a!==`loading`,_=r===0,v;e[3]===s?v=e[4]:(v=(0,Z.jsx)(ey,{size:80,celebrateSignal:s}),e[3]=s,e[4]=v);let y;e[5]!==_||e[6]!==g||e[7]!==h?(y=g?_?(0,Z.jsx)(jy,{onCtaClick:()=>n(!0),showCta:h}):(0,Z.jsx)(My,{onCtaClick:()=>n(!0),showCta:h}):null,e[5]=_,e[6]=g,e[7]=h,e[8]=y):y=e[8];let b;e[9]===t?b=e[10]:(b=(0,Z.jsx)(my,{open:t,onOpenChange:n,onSeedApplied:m}),e[9]=t,e[10]=b);let x;return e[11]!==v||e[12]!==y||e[13]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6 px-6`,children:[v,y,b]}),e[11]=v,e[12]=y,e[13]=b,e[14]=x):x=e[14],x}function Ey(){}function Dy(){return null}function Oy(e){return e+1}function ky(e){return e.json()}function Ay(){return null}function jy(e){let t=(0,$.c)(7),{onCtaClick:n,showCta:r}=e,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`h2`,{className:`text-base font-medium`,children:`Welcome to your LLM brain`}),a=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A space for working with AI agents. Start with a curated layer structure — or create your own files in the sidebar.`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]!==n||t[3]!==r?(o=r?(0,Z.jsxs)(X,{className:`mt-1`,onClick:n,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}):null,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[i,a,o]}),t[5]=o,t[6]=s),s}function My(e){let t=(0,$.c)(6),{onCtaClick:n,showCta:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{className:`select-none text-sm text-muted-foreground`,children:`Select a document to edit`}),t[0]=i):i=t[0];let a;t[1]!==n||t[2]!==r?(a=r?(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`uppercase font-mono text-xs`,onClick:n,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),`Initialize LLM brain`]}):null,t[1]=n,t[2]=r,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[i,a]}),t[4]=a,t[5]=o),o}function Ny(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Py(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Ny(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Fy(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Iy(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:Py(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:Fy(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:Py(e,t.pageTitles),children:a}}function Ly(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)(Jc,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Ry(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)(Yc,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function zy(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,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=Y(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-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-[state=closed]:overflow-hidden 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[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(Xc,{children:(0,Z.jsx)(Zc,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function By(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/dropdown-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 not-data-[variant=destructive]: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 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)($c,{"data-slot":`dropdown-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 Vy(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)(el,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Hy(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Y(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Z.jsx)(nl,{children:(0,Z.jsx)(pr,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(tl,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Uy(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Qc,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Wy(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)(rl,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Gy(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)(il,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Ky(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Y(`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 not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Kt,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(al,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function qy(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 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg 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)(ol,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jy(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 Yy(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 Xy(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 Zy(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 Qy(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 $y(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 eb(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 tb(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 nb(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)(Yn,{className:`ml-1 size-3`}):(0,Z.jsx)(Mt,{className:`ml-1 size-3`}):(0,Z.jsx)(Fi,{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 rb(e){let t=(0,$.c)(87),{folderPath:n}=e,{addPage:r,folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Be(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(`name`),[_,v]=(0,Q.useState)(`asc`);if(a){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)(ur,{className:`size-5 rounded`}),(0,Z.jsx)(ur,{className:`h-7 w-48`})]}),(0,Z.jsx)(ur,{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)(ur,{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)(ur,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(sb)]})]})}),t[2]=r):r=t[2],r}let y,b,x,S,C,w,T,E;if(t[3]!==r||t[4]!==p||t[5]!==d||t[6]!==n||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==h){let e=Iy(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=tb(e.children,h,_),l;t[21]===h?l=t[22]:(l=function(e){e===h?v(ob):(g(e),v(`asc`))},t[21]=h,t[22]=l);let D=l,O;t[23]!==r||t[24]!==n?(O=async function(){f(!0),m(null);try{let e=`${n}/index.md`,t=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await t.json().catch(ab);if(!t.ok||!i?.ok){m(i?.error??`Server error (HTTP ${t.status})`),f(!1);return}let a=i.docName??`${n}/index`;r(a),Oe([`files`,`backlinks`,`graph`]),window.location.hash=at(a)}catch(e){console.warn(`[FolderOverview] create index note failed:`,e),m(`Network error — please try again`)}f(!1)},t[23]=r,t[24]=n,t[25]=O):O=t[25];let k=O;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,w=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(en,{className:`size-5 text-muted-foreground`}),t[26]=A):A=t[26];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(mr,{className:`size-4`}),t[27]=M):M=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ry,{asChild:!0,children:(0,Z.jsxs)(X,{children:[M,`New`,(0,Z.jsx)(nn,{className:`size-3`})]})}),t[28]=N):N=t[28];let P;t[29]===k?P=t[30]:(P=()=>void k(),t[29]=k,t[30]=P);let F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:`Index note`}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Landing page for this folder`})]}),t[31]=F):F=t[31];let I;t[32]!==d||t[33]!==P?(I=(0,Z.jsx)(By,{disabled:d,onSelect:P,children:F}),t[32]=d,t[33]=P,t[34]=I):I=t[34];let L;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(By,{onSelect:()=>u(!0),children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:`Note`}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`New note inside this folder`})]})}),t[35]=L):L=t[35];let R;t[36]===I?R=t[37]:(R=(0,Z.jsxs)(Ly,{children:[N,(0,Z.jsxs)(zy,{align:`end`,children:[I,L]})]}),t[36]=I,t[37]=R);let z;t[38]!==j||t[39]!==R?(z=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,R]}),t[38]=j,t[39]=R,t[40]=z):z=t[40];let B;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This folder has no landing note yet. Choose an explicit action to add one or open a note inside the folder.`}),t[41]=B):B=t[41];let V;t[42]===p?V=t[43]:(V=p?(0,Z.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:p}):null,t[42]=p,t[43]=V),t[44]!==z||t[45]!==V?(T=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[z,B,V]}),t[44]=z,t[45]=V,t[46]=T):T=t[46],C=`rounded-lg border`,b=Jy;let H=h===`name`?_===`asc`?`ascending`:`descending`:`none`,U;t[47]!==D||t[48]!==_||t[49]!==h?(U=(0,Z.jsx)(nb,{label:`Name`,sortKey:`name`,activeKey:h,activeDir:_,onSort:D}),t[47]=D,t[48]=_,t[49]=h,t[50]=U):U=t[50];let W;t[51]!==H||t[52]!==U?(W=(0,Z.jsx)(Qy,{"aria-sort":H,children:U}),t[51]=H,t[52]=U,t[53]=W):W=t[53];let G=h===`modified`?_===`asc`?`ascending`:`descending`:`none`,K;t[54]!==D||t[55]!==_||t[56]!==h?(K=(0,Z.jsx)(nb,{label:`Modified`,sortKey:`modified`,activeKey:h,activeDir:_,onSort:D}),t[54]=D,t[55]=_,t[56]=h,t[57]=K):K=t[57];let ee;t[58]!==G||t[59]!==K?(ee=(0,Z.jsx)(Qy,{className:`w-32`,"aria-sort":G,children:K}),t[58]=G,t[59]=K,t[60]=ee):ee=t[60],t[61]!==W||t[62]!==ee?(S=(0,Z.jsx)(Yy,{children:(0,Z.jsxs)(Zy,{children:[W,ee]})}),t[61]=W,t[62]=ee,t[63]=S):S=t[63],y=Xy,x=a.length?a.map(ib):(0,Z.jsx)(Zy,{children:(0,Z.jsx)($y,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=r,t[4]=p,t[5]=d,t[6]=n,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=_,t[12]=h,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E}else y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20];let D;t[64]!==y||t[65]!==x?(D=(0,Z.jsx)(y,{children:x}),t[64]=y,t[65]=x,t[66]=D):D=t[66];let O;t[67]!==b||t[68]!==S||t[69]!==D?(O=(0,Z.jsxs)(b,{children:[S,D]}),t[67]=b,t[68]=S,t[69]=D,t[70]=O):O=t[70];let k;t[71]!==C||t[72]!==O?(k=(0,Z.jsx)(`div`,{className:C,children:O}),t[71]=C,t[72]=O,t[73]=k):k=t[73];let A;t[74]!==w||t[75]!==T||t[76]!==k?(A=(0,Z.jsxs)(`div`,{className:w,children:[T,k]}),t[74]=w,t[75]=T,t[76]=k,t[77]=A):A=t[77];let j;t[78]!==A||t[79]!==E?(j=(0,Z.jsx)(`div`,{className:E,children:A}),t[78]=A,t[79]=E,t[80]=j):j=t[80];let M;t[81]!==l||t[82]!==n?(M=(0,Z.jsx)($t,{open:l,onOpenChange:u,kind:`file`,initialDir:n}),t[81]=l,t[82]=n,t[83]=M):M=t[83];let N;return t[84]!==j||t[85]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[j,M]}),t[84]=j,t[85]=M,t[86]=N):N=t[86],N}function ib(e){return(0,Z.jsxs)(Zy,{children:[(0,Z.jsx)($y,{children:(0,Z.jsxs)(`a`,{href:at(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)(la,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Bt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)($y,{className:`text-muted-foreground`,children:e.kind===`file`?eb(e.modified):`—`})]},e.path)}function ab(){return null}function ob(e){return e===`asc`?`desc`:`asc`}function sb(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)(ur,{className:`size-4 rounded`}),(0,Z.jsx)(ur,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(ur,{className:`h-4 w-16`})})]},e)}var cb=(0,Q.createContext)(null);function lb(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(ub),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)(cb,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function ub(){return new Map}function db(){let e=(0,Q.use)(cb);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function fb(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)(Sv,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pb(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)(Tv,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function mb(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)(kv,{"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 hb=960,gb=1024;function _b(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(yb),[r,i]=(0,Q.useState)(vb),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${hb-1}px)`),t=window.matchMedia(`(max-width: ${gb-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 vb(){return window.innerWidth>=hb&&window.innerWidth<gb}function yb(){return window.innerWidth<hb?`sheet`:`panel`}var bb={words:0,chars:0,tokens:0},xb=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,Sb=/[\p{L}\p{N}]/u;function Cb(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Sb.test(n)&&t++;return t}function wb(e){let t=globalThis.Intl.Segmenter;if(!t)return Cb(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Tb(e){let t=xb.test(e)?1.5:4;return Math.ceil(e.length/t)}function Eb(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=G(e),n=t.trim();return n?{words:xb.test(n)?wb(n):Cb(n),chars:n.length,tokens:Tb(n)}:{words:0,chars:0,tokens:0}}var Db=300;function Ob(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(bb),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(bb);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Eb(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,Db)};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}var kb=ye;function Ab(e,t={}){let n=Vt(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var jb=4;function Mb(e){let t=(0,$.c)(8),{editor:n}=e,r=Wn(n),i=!!(n&&r&&r.ancestorChain.length>0),a=i?void 0:`true`,o=`jsx-component-breadcrumb flex items-center gap-1 min-h-[28px] px-3 py-1.5 text-xs font-mono text-muted-foreground overflow-hidden ${i?`border-t border-border`:``}`,s;t[0]!==r||t[1]!==n||t[2]!==i?(s=i&&r?(0,Z.jsx)(Pb,{editor:n,blockSelection:r}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=s):s=t[3];let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":`Block ancestor navigation`,"aria-hidden":a,className:o,children:s}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Nb(e,t){let n=cn.getState(e.state)?.posToId;if(!n)return t.pos;for(let[e,r]of n)if(r===t.bridgeId)return e;return null}function Pb(e){let t=(0,$.c)(9),{editor:n,blockSelection:r}=e,{ancestorChain:i,selectedBlockId:a}=r,o;if(t[0]!==i||t[1]!==n||t[2]!==a){let e=Lb(i),r;t[4]===n?r=t[5]:(r=(0,Z.jsx)(`button`,{type:`button`,className:`opacity-60 hover:opacity-100 hover:text-foreground transition-opacity outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,onClick:()=>{n.chain().focus().setTextSelection(0).command(Ib).run()},children:Nt}),t[4]=n,t[5]=r);let s;t[6]!==n||t[7]!==a?(s=e=>{if(e.kind===`ellipsis`)return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Kt,{size:12,className:`opacity-50`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{role:`img`,"aria-label":`${e.hiddenCount} hidden ancestors`,title:`${e.hiddenCount} hidden ancestors`,className:`opacity-60`,children:`…`})]},`ellipsis`);let t=Ab(e.entry),r=e.entry.bridgeId===a;return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0`,children:[(0,Z.jsx)(Kt,{size:12,className:`opacity-50 shrink-0`,"aria-hidden":`true`}),r?(0,Z.jsx)(`span`,{"aria-current":`location`,className:`text-foreground truncate`,children:t}):(0,Z.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm truncate`,onClick:()=>{let t=Nb(n,e.entry);t!==null&&n.chain().focus().setNodeSelection(t).command(Fb).run()},children:t})]},e.entry.bridgeId)},t[6]=n,t[7]=a,t[8]=s):s=t[8],o=(0,Z.jsxs)(Z.Fragment,{children:[r,e.map(s)]}),t[0]=i,t[1]=n,t[2]=a,t[3]=o}else o=t[3];return o}function Fb(e){let{tr:t}=e;return t.setMeta(rn,`programmatic`),!0}function Ib(e){let{tr:t}=e;return t.setMeta(rn,`programmatic`),!0}function Lb(e){if(e.length<=jb)return e.map(e=>({kind:`entry`,entry:e}));let t=e[0],n=e.slice(-2),r=e.length-1-n.length;return[{kind:`entry`,entry:t},{kind:`ellipsis`,hiddenCount:r},...n.map(e=>({kind:`entry`,entry:e}))]}var Rb=200,zb=`Outside any block`;function Bb(e){let t=(0,$.c)(5),{editor:n}=e,r=Wn(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?Vb(n,r):o.current?zb:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Rb),()=>{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 Vb(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=Ab(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=Ab(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 Hb(){let[e]=(0,Q.useState)(ze);return e}function Ub({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:$e(e.display_name),color:rt(e.id,I),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:rt(e.id,I),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Wb(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 Gb=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&&qe(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(ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(me(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(W(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(V(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ve(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(K(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(R(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ge(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=Ne(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Le){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 U){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():Wb(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&de(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()}},Kb=e=>new De({key:typeof e.pluginKey==`string`?new ot(e.pluginKey):e.pluginKey,view:t=>new Gb({view:t,...e})});ue.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Kb({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 qb=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 ke(e,{textSerializers:Ze(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(me(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(W(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(V(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ve(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(K(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(R(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ge(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=Ne(this.view,e.from,e.to);de({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()}},Jb=e=>new De({key:typeof e.pluginKey==`string`?new ot(e.pluginKey):e.pluginKey,view:t=>new qb({view:t,...e})});ue.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?[Jb({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 Yb(e,t){return e??new ot(t)}var Xb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,Zb=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Qb=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(`.`)),$b=new Set([`children`,`className`,`style`]),ex=new Set([`tabIndex`]),tx=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),nx={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function rx(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function ix(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function ax(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||tx.has(e)}function ox(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function sx(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:nx[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function cx(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 lx(e){return ex.has(e)}function ux(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function dx(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 fx(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Qb.has(e)?String(t):`${t}px`}function px(e,t){Zb.has(t)||e.style.removeProperty(ox(t))}function mx(e,t,n){Zb.has(t)||e.style.setProperty(ox(t),fx(t,n))}function hx(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if($b.has(r)||!ax(r)||rx(r,t[r])||rx(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=ix(r);if(a==null||a===!1){lx(r)&&dx(e,r),e.removeAttribute(o);return}if(a===!0){lx(r)&&ux(e,r,!0),e.setAttribute(o,``);return}if(lx(r)){ux(e,r,a);return}e.setAttribute(o,String(a))})}function gx(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function _x(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){px(e,t);return}mx(e,t,a)}})}function vx(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(!rx(t,n))return;let{eventName:i,options:a}=sx(t),o=t=>{n(cx(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function yx(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);Xb(()=>{let i=n.current;return gx(e,i.className,t.className),_x(e,i.style,t.style),hx(e,i,t),r.current=vx(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 bx=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(Yb(e,`bubbleMenu`)).current;yx(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Cn(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Kb({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,zi.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(Yb(e,`floatingMenu`)).current;yx(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Cn(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Jb({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,zi.createPortal)(s,u.current)});var xx=[{name:`paragraph`,label:`Text`,icon:ja,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Xt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Jt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Dn,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:It,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:kn,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Qt,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Un,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Ha,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function Sx(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Cx},t[0]=n,t[1]=r);let{current:i,activeStates:a}=mn(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)(nn,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ry,{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=xx.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(By,{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)(zy,{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)(Ly,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Cx(e){let t=Object.fromEntries(xx.map(t=>[t.name,t.isActive(e.editor)]));return{current:xx.find(e=>t[e.name])??xx[0],activeStates:t}}var wx=[{name:`bold`,icon:Li,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:ga,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:Xa,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:Ga,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:Xi,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:ha,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Tx(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Ex},t[0]=n,t[1]=r);let i=mn(r),a;t[2]!==i||t[3]!==n?(a=wx.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{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)(Gr,{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 Ex(e){return Object.fromEntries(wx.map(t=>[t.name,t.isActive(e.editor)]))}function Dx(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)(ea,{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)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),window.open(d,`_blank`,`noopener,noreferrer`)},children:(0,Z.jsx)(br,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{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)(Pt,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{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)(ba,{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)(Wr,{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)(Gr,{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)(qr,{children:[T,E]}),t[44]=T,t[45]=D),D}function Ox({editor:e}){if(e.state.selection.empty||e.isActive(`codeBlock`))return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function kx(e){let t=(0,$.c)(25),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]!==n.state||t[1]!==n.view?(s=()=>{try{let{from:e,to:t}=n.state.selection;return Ne(n.view,e,t)}catch{return new DOMRect}},t[0]=n.state,t[1]=n.view,t[2]=s):s=t[2];let c;if(t[3]!==n.view.dom||t[4]!==s){let e={getBoundingClientRect:s,contextElement:n.view.dom};c=()=>{let t=r.current;t&&(o.current?.(),o.current=re(e,t,()=>{de(e,t,{placement:`top`,strategy:`fixed`,middleware:[W(8),ut(),me({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(Mx)}))},t[3]=n.view.dom,t[4]=s,t[5]=c}else c=t[5];let l=c,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o.current?.(),o.current=null,a(jx)},t[6]=u):u=t[6];let d=u,f;t[7]===l?f=t[8]:(f={onShow:l,onHide:d,strategy:`fixed`},t[7]=l,t[8]=f);let p;t[9]===n?p=t[10]:(p=(0,Z.jsx)(Sx,{editor:n}),t[9]=n,t[10]=p);let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(fh,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i?(h=(0,Z.jsx)(Tx,{editor:n},i),t[12]=n,t[13]=i,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(fh,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[15]=g):g=t[15];let _=`${i}-link`,v;t[16]!==n||t[17]!==_?(v=(0,Z.jsx)(Dx,{editor:n},_),t[16]=n,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==n||t[20]!==v||t[21]!==f||t[22]!==p||t[23]!==h?(y=(0,Z.jsxs)(bx,{ref:r,editor:n,appendTo:Ax,shouldShow:Ox,updateDelay:250,options:f,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[p,m,h,g,v]}),t[19]=n,t[20]=v,t[21]=f,t[22]=p,t[23]=h,t[24]=y):y=t[24],y}function Ax(){return document.body}function jx(e){return e+1}function Mx(){}var Nx=[{name:`addRowBefore`,icon:Yn,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:Mt,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Pt,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],Px=[{name:`addColumnBefore`,icon:nr,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:vr,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Pt,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],Fx=[{name:`toggleHeaderRow`,icon:qa,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:Qi,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:da,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function Ix({editor:e}){return e.isActive(`table`)}function Lx(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)(Wr,{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)(Gr,{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)(qr,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Rx(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=Nx.map(e=>(0,Z.jsx)(Lx,{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)(fh,{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=Px.map(e=>(0,Z.jsx)(Lx,{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)(fh,{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=Fx.map(e=>(0,Z.jsx)(Lx,{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)(bx,{editor:n,shouldShow:Ix,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 zx=new WeakMap;function Bx(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=Me(e.color),n.textContent=e.name,t.append(n),t}var Vx={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},Hx=e=>{let t=(0,$.c)(66),{provider:n,placeholder:r,isSourceMode:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(Vx),s=Hb(),{principal:c,activeDocName:l}=jn(),u=n.configuration.name??``,[d]=(0,Q.useState)(Ux),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let g=(0,Q.useRef)(null),_;t[0]!==d||t[1]!==u||t[2]!==r||t[3]!==n?(_=()=>{let e;try{let t={viewCount:0,bytes:n.document.getText(`source`).length};e=dn({docName:u,container:document.createElement(`div`),sizeStats:t,factory:e=>{let t=performance.now();return{editor:new Te({element:e,onBeforeCreate:e=>{let{editor:n}=e;zx.set(n,t)},onCreate:e=>{let{editor:t}=e;d.html.setView(t.view);let r=zx.get(t);if(zx.delete(t),r==null)return;let i=performance.now();qn(`ok/editor/create-tiptap`,{docName:n.configuration.name??`unknown`,ytextLength:n.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,n,r)=>{let i=d.mdManager.parse(e);return r.state.schema.nodeFromJSON(i).content},clipboardTextSerializer:(e,t)=>d.text(e,t),clipboardSerializer:d.html.serializer,handlePaste:(e,t)=>d.paste(e,t)},extensions:[...xn.map(e=>e.name===`link`?e.configure({docName:n.configuration.name??``}):e),kb.configure({placeholder:r??`Type '/' for commands`,showOnlyCurrent:!0}),Ht.configure({document:n.document}),ue.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[un]}}),ue.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=n.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Rn(e,{cursorBuilder:Bx})]}})]}),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}}}),g.current=e,p(e.editor)}catch(e){let t=e;console.error(`[TiptapEditor] mountTiptapEditor failed`,t),g.current=null,p(null),h(t instanceof Error?t:Error(String(t)))}return()=>{let e=g.current;e&&fn(e),g.current=null,p(null)}},t[0]=d,t[1]=u,t[2]=r,t[3]=n,t[4]=_):_=t[4];let v;t[5]!==d||t[6]!==u||t[7]!==n?(v=[u,n,d],t[5]=d,t[6]=u,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(_,v);let y;t[9]!==f||t[10]!==n.configuration.name?(y=()=>{if(f)return Wt(f,n.configuration.name??null),()=>{Wt(f,null)}},t[9]=f,t[10]=n.configuration.name,t[11]=y):y=t[11];let b;t[12]!==f||t[13]!==n?(b=[f,n],t[12]=f,t[13]=n,t[14]=b):b=t[14],(0,Q.useEffect)(y,b);let x;t[15]!==f||t[16]!==n.configuration.name?(x=()=>{},t[15]=f,t[16]=n.configuration.name,t[17]=x):x=t[17];let S;t[18]!==f||t[19]!==n?(S=[f,n],t[18]=f,t[19]=n,t[20]=S):S=t[20],(0,Q.useEffect)(x,S);let C,w;t[21]===f?(C=t[22],w=t[23]):(C=()=>{if(!f)return;let e=Wx,t=null,n=()=>{if(t||!f||f.isDestroyed)return;let n=Kn(f);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 Kn(f)?n():f.on(`create`,n),()=>{f.off(`create`,n),r()}},w=[f],t[21]=f,t[22]=C,t[23]=w),(0,Q.useEffect)(C,w);let T,E;t[24]!==f||t[25]!==n.document?(E=()=>{if(!f)return;let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,s=null,c=null,l=()=>{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},u=e=>{o.current=e;let t=a.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=l(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(o.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};u(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),s&&clearTimeout(s),c&&clearTimeout(c),s=window.setTimeout(()=>{let e={...n,state:`settled`};u(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),c=window.setTimeout(()=>{u({...e,state:`idle`})},300)},Ue)};u(Vx);let p=()=>{if(Je(e),!st(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(p);let m=()=>{document.visibilityState===`visible`?st(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,m),()=>{e.unobserve(p),document.removeEventListener(`visibilitychange`,m),i&&clearTimeout(i),s&&clearTimeout(s),c&&clearTimeout(c)}},T=[f,n.document],t[24]=f,t[25]=n.document,t[26]=T,t[27]=E):(T=t[26],E=t[27]),(0,Q.useEffect)(E,T);let D,O;t[28]===n?(D=t[29],O=t[30]):(D=()=>{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)}},O=[n],t[28]=n,t[29]=D,t[30]=O),(0,Q.useEffect)(D,O);let k,A;t[31]===f?(k=t[32],A=t[33]):(k=()=>{if(!f)return;let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||!f||f.isDestroyed)return;let n=Kn(f);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(yi,e),()=>window.removeEventListener(yi,e)},A=[f],t[31]=f,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j;t[34]!==l||t[35]!==u||t[36]!==s||t[37]!==i||t[38]!==c||t[39]!==n.awareness?(j=()=>{let e=n.awareness;if(e){if(u!==l){e.setLocalState(null);return}e.setLocalState({user:Ub({principal:c,identity:s}),mode:i?`source`:`wysiwyg`})}},t[34]=l,t[35]=u,t[36]=s,t[37]=i,t[38]=c,t[39]=n.awareness,t[40]=j):j=t[40];let M;t[41]!==l||t[42]!==u||t[43]!==s||t[44]!==i||t[45]!==c||t[46]!==n?(M=[n,u,l,s,c,i],t[41]=l,t[42]=u,t[43]=s,t[44]=i,t[45]=c,t[46]=n,t[47]=M):M=t[47],(0,Q.useEffect)(j,M);let N;t[48]===f?N=t[49]:(N=f&&(0,Z.jsx)(kx,{editor:f}),t[48]=f,t[49]=N);let P;t[50]===f?P=t[51]:(P=f&&(0,Z.jsx)(Rx,{editor:f}),t[50]=f,t[51]=P);let F,I;t[52]===f?(F=t[53],I=t[54]):(F=(0,Z.jsx)(wn,{editor:f,className:`h-full`}),I=f&&(0,Z.jsx)(Mb,{editor:f}),t[52]=f,t[53]=F,t[54]=I);let L;t[55]===f?L=t[56]:(L=f&&(0,Z.jsx)(Bb,{editor:f}),t[55]=f,t[56]=L);let R;t[57]===f?R=t[58]:(R=f&&(0,Z.jsx)(Yt,{store:qt(f).store}),t[57]=f,t[58]=R);let z;return t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I||t[63]!==L||t[64]!==R?(z=(0,Z.jsxs)(`div`,{ref:a,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,I,L,R]}),t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L,t[64]=R,t[65]=z):z=t[65],z};function Ux(){let e=new B({extensions:_e});return{mdManager:e,text:jt({mdManager:e}),html:Jn({mdManager:e}),paste:ln({mdManager:e})}}function Wx(){return gn()}function Gx(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zn(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 Kx=`__back-nav__`;function qx(e){return e instanceof vn||e instanceof Mn||e instanceof hn||e instanceof Tn||e instanceof In?e.docName:null}function Jx(e){return e instanceof vn?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof Mn?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof hn?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof Tn?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof In?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function Yx(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=Jx(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)(ey,{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-lg font-medium`,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||(An(qx(n)??i),o(a),r(Kx))},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 Xx(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)(Yx,{...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]===Kx){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.warn(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Jx(e).title}`)},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)(En,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function Zx(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Qx=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function $x(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function eS(e){return`nodeType`in e}function tS(e){return e?$x(e)?e:eS(e)?e.ownerDocument?.defaultView??window:window:window}function nS(e){let{Document:t}=tS(e);return e instanceof t}function rS(e){return $x(e)?!1:e instanceof tS(e).HTMLElement}function iS(e){return e instanceof tS(e).SVGElement}function aS(e){return e?$x(e)?e.document:eS(e)?nS(e)?e:rS(e)||iS(e)?e.ownerDocument:document:document:document}var oS=Qx?Q.useLayoutEffect:Q.useEffect;function sS(e){let t=(0,Q.useRef)(e);return oS(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function cS(){let e=(0,Q.useRef)(null);return[(0,Q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function lS(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return oS(()=>{n.current!==e&&(n.current=e)},t),n}function uS(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function dS(e){let t=sS(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function fS(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var pS={};function mS(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=pS[e]==null?0:pS[e]+1;return pS[e]=n,e+`-`+n},[e,t])}function hS(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var gS=hS(1),_S=hS(-1);function vS(e){return`clientX`in e&&`clientY`in e}function yS(e){if(!e)return!1;let{KeyboardEvent:t}=tS(e.target);return t&&e instanceof t}function bS(e){if(!e)return!1;let{TouchEvent:t}=tS(e.target);return t&&e instanceof t}function xS(e){if(bS(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return vS(e)?{x:e.clientX,y:e.clientY}:null}var SS=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[SS.Translate.toString(e),SS.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),CS=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function wS(e){return e.matches(CS)?e:e.querySelector(CS)}var TS={display:`none`};function ES(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:TS},n)}function DS(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function OS(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var kS=(0,Q.createContext)(null);function AS(e){let t=(0,Q.useContext)(kS);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function jS(){let[e]=(0,Q.useState)(()=>new Set),t=(0,Q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var MS={draggable:`
27
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function sg(e,t){return`${e}\u0000${t}`}function cg(e,t,n){let r=G(e).body,i=G(t).body;return r===i?``:ag(n,r,i,``,``,{context:3})}function lg(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=jn(),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=sg(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=cg(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 ug=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityPanelDiffView-C1vRNF09.js`),__vite__mapDeps([9,1,6,10]),import.meta.url)).ActivityPanelDiffView}));function dg(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 fg(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function pg(e){return e.slice(0,7)}function mg(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 hg(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)(Qn,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ir,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Xn,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(tr,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(lr,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(sr,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ar,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function gg(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)(ua,{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=lt(i),t[1]=i,t[2]=a);let o=a,s=r?Ee[o]??Ie[o]:Ie[o],c;t[3]!==s||t[4]!==i?(c=s??rt(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)(hg,{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)(pa,{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)(Pi,{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)($a,{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)(ar,{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)(Pi,{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)($a,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function _g(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r);if(n.length===0)return null;let p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>f(vg),t[0]=p):p=t[0];let m;t[1]===d?m=t[2]:(m=d?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{className:`size-3`}),t[1]=d,t[2]=m);let h=d?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,g;t[3]!==d||t[4]!==m||t[5]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:p,children:[m,h]}),t[3]=d,t[4]=m,t[5]=h,t[6]=g):g=t[6];let _;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==d||t[12]!==c||t[13]!==i||t[14]!==u||t[15]!==l?(_=d&&n.map(e=>(0,Z.jsx)(Mg,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=d,t[12]=c,t[13]=i,t[14]=u,t[15]=l,t[16]=_):_=t[16];let v;return t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19],v}function vg(e){return!e}function yg(e){return e.checkpoint?e.checkpoint.kind:`save`}function bg(e){let t=yg(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${xg(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function xg(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Sg(e){return e.type===`checkpoint`?yg(e)===`save`?`version`:`auto-save`:`wip`}var Cg={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},wg={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function Tg(e){return Cg[Sg(e)]}function Eg(e){return wg[Sg(e)]}function Dg(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Og(e){let t=(0,$.c)(20),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(Ag),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(kg)},children:[r?(0,Z.jsx)(nn,{className:`size-3`}):(0,Z.jsx)(Kt,{className:`size-3`}),r?`Hide ${s.length} more`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function kg(e){return!e}function Ag(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 jg(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=lg(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)(Rt,{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)(Rt,{className:`size-3 animate-spin`}),`Loading diff renderer…`]}),children:(0,Z.jsx)(ug,{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 Mg(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=dg(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=mg(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(Ng),_;t[4]===n?_=t[5]:(_=Dg(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}),Hr.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=await r.json();t.error&&(e=t.error)}catch{}console.error(`[timeline] rollback failed`,{docName:s,sha:n.sha,status:r.status,detail:e}),Hr.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=yg(n);return e===`bridge-merge-loss`?(0,Z.jsx)(q,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(ra,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(ta,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(gg,{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:bg(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=Tg(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)(Rt,{className:`size-3 animate-spin`}):(0,Z.jsx)($n,{className:`size-3`}),t[40]=x,t[41]=K);let ee;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==K?(ee=(0,Z.jsx)(Wr,{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]=ee):ee=t[46];let te;t[47]===n?te=t[48]:(te=Tg(n),t[47]=n,t[48]=te);let ne;t[49]===te?ne=t[50]:(ne=(0,Z.jsx)(Gr,{side:`top`,children:te}),t[49]=te,t[50]=ne);let re;t[51]!==ee||t[52]!==ne?(re=(0,Z.jsxs)(qr,{children:[ee,ne]}),t[51]=ee,t[52]=ne,t[53]=re):re=t[53];let ie;t[54]!==V||t[55]!==H||t[56]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,re]}),t[54]=V,t[55]=H,t[56]=re,t[57]=ie):ie=t[57];let ae;t[58]===v?ae=t[59]:(ae=v.length>0&&(0,Z.jsx)(Og,{summaries:v}),t[58]=v,t[59]=ae);let oe=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}),se;t[60]!==ie||t[61]!==ae||t[62]!==oe?(se=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ie,ae,oe]}),t[60]=ie,t[61]=ae,t[62]=oe,t[63]=se):se=t[63];let ce;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==se?(ce=(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,se]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=se,t[71]=ce):ce=t[71];let le;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(le=c&&(0,Z.jsx)(jg,{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]=le):le=t[78];let ue;t[79]!==ce||t[80]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ce,le]}),t[79]=ce,t[80]=le,t[81]=ue):ue=t[81];let de;t[82]!==A||t[83]!==b?(de=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=de):de=t[84];let fe;t[85]===n?fe=t[86]:(fe=Eg(n),t[85]=n,t[86]=fe);let pe;t[87]===fe?pe=t[88]:(pe=(0,Z.jsx)(Dr,{children:fe}),t[87]=fe,t[88]=pe);let me;t[89]===n.timestamp?me=t[90]:(me=fg(n.timestamp),t[89]=n.timestamp,t[90]=me);let he;t[91]===n.sha?he=t[92]:(he=pg(n.sha),t[91]=n.sha,t[92]=he);let ge;t[93]!==p||t[94]!==me||t[95]!==he?(ge=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,me,`, `,he,`)`]}),t[93]=p,t[94]=me,t[95]=he,t[96]=ge):ge=t[96];let _e;t[97]===h?_e=t[98]:(_e=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=_e);let ve;t[99]!==ge||t[100]!==_e?(ve=(0,Z.jsxs)(Tr,{children:[`This will replace the current document content with the version from`,` `,ge,` `,`by `,_e,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=ge,t[100]=_e,t[101]=ve):ve=t[101];let ye;t[102]!==pe||t[103]!==ve?(ye=(0,Z.jsxs)(Rr,{children:[pe,ve]}),t[102]=pe,t[103]=ve,t[104]=ye):ye=t[104];let be;t[105]===A?be=t[106]:(be=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=be);let xe;t[107]===M?xe=t[108]:(xe=()=>M(),t[107]=M,t[108]=xe);let Se;t[109]===x?Se=t[110]:(Se=x?(0,Z.jsx)(Rt,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=Se);let Ce;t[111]!==x||t[112]!==xe||t[113]!==Se?(Ce=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:xe,children:[Se,`Restore`]}),t[111]=x,t[112]=xe,t[113]=Se,t[114]=Ce):Ce=t[114];let we;t[115]!==be||t[116]!==Ce?(we=(0,Z.jsxs)(Fr,{children:[be,Ce]}),t[115]=be,t[116]=Ce,t[117]=we):we=t[117];let Te;t[118]!==ye||t[119]!==we?(Te=(0,Z.jsxs)(jr,{children:[ye,we]}),t[118]=ye,t[119]=we,t[120]=Te):Te=t[120];let Ee;t[121]!==y||t[122]!==de||t[123]!==Te?(Ee=(0,Z.jsx)(zr,{open:y,onOpenChange:de,children:Te}),t[121]=y,t[122]=de,t[123]=Te,t[124]=Ee):Ee=t[124];let De;return t[125]!==ue||t[126]!==Ee?(De=(0,Z.jsxs)(Z.Fragment,{children:[ue,Ee]}),t[125]=ue,t[126]=Ee,t[127]=De):De=t[127],De}function Ng(e){return e.docs}function Pg(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=xe(),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)(Rg),[g,_]=(0,Q.useState)(Lg),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(Ig),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)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsxs)(it,{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)(Ye,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Fa,{className:`size-3.5`})}),(0,Z.jsx)(Ye,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Zi,{className:`size-3.5`})})]})}),(0,Z.jsx)(Gr,{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(Fg)}),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)(Mg,{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)(Mg,{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)(_g,{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 Fg(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(ur,{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)(ur,{className:`h-3 w-28`}),(0,Z.jsx)(ur,{className:`h-3 w-40`})]})]},e)}function Ig(e){return e.type===`checkpoint`}function Lg(){return new Set}function Rg(){return new er(32)}var zg=[{id:`outline`,label:`Outline`,icon:Ca},{id:`links`,label:`Links`,icon:ya},{id:`graph`,label:`Graph`,icon:Ea},{id:`timeline`,label:`Timeline`,icon:qi}];function Bg(){return r(()=>import(`./GraphPanel-BH5vs7kB.js`),__vite__mapDeps([11,1,12,3,5,6,13,14,15,16,17]),import.meta.url)}var Vg=(0,Q.lazy)(async()=>({default:(await Bg()).GraphPanel})),Hg=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityModeContent-Cdl0frU2.js`),__vite__mapDeps([18,1,2,3,19,20,21,13,12,5,6,22,7,14,23]),import.meta.url)).ActivityModeContent}));function Ug(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)(it,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:zg.map(Wg)})}):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)(gi,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(Nh,{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)(Vg,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(Pg,{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)(Hg,{})})}),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 Wg(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Ye,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(Wr,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(Gr,{side:`bottom`,children:n})]},t)}function Gg(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Kg(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function qg(e){return e/100*window.innerHeight}function Jg(e){return e/100*window.innerWidth}function Yg(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 Xg({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Yg(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Kg(t,i);break;case`em`:r=Gg(t,i);break;case`vh`:r=qg(i);break;case`vw`:r=Jg(i);break}return r}function Zg(e){return parseFloat(e.toFixed(3))}function Qg({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 $g(e){let{panels:t}=e,n=Qg({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=Zg(Xg({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Zg(Xg({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Zg(Xg({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Zg(Xg({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 e_(e,t=`Assertion error`){if(!e)throw Error(t)}function t_(e,t){return Array.from(t).sort(e===`horizontal`?n_:r_)}function n_(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function r_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function i_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function a_(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 o_({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}=a_(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return e_(i,`No rect found`),i}var s_;function c_(){return s_===void 0&&(s_=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),s_}function l_(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=t_(n,Array.from(t.children).filter(i_).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,o_({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=c_()?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:Qg({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 u_=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)}}},d_=new Map,f_=new u_;function p_(e){d_=new Map(d_),d_.delete(e)}function m_(e,t){for(let[t]of d_)if(t.id===e)return t}function h_(e,t){for(let[t,n]of d_)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function g_(){return d_}function __(e,t){return f_.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function v_(e,t){let n=d_.get(e);d_=new Map(d_),d_.set(e,t),f_.emit(`groupChange`,{group:e,prev:n,next:t})}function y_(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=a_(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 b_(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function x_(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:D_(e),b:D_(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();e_(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:E_(T_(n.a)),b:E_(T_(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 S_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function C_(e){let t=getComputedStyle(O_(e)??e).display;return t===`flex`||t===`inline-flex`}function w_(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||C_(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`||S_.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function T_(e){let t=e.length;for(;t--;){let n=e[t];if(e_(n,`Missing node`),w_(n))return n}return null}function E_(e){return e&&Number(getComputedStyle(e).zIndex)||0}function D_(e){let t=[];for(;e;)t.push(e),e=O_(e);return t}function O_(e){let{parentNode:t}=e;return b_(t)?t.host:t}function k_(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 A_({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!i_(n)||n.contains(e)||e.contains(n))return!0;if(x_(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(k_(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function j_(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=l_(r),a=y_(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&A_({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function M_(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 N_(e,t,n=0){return Math.abs(Zg(e)-Zg(t))<=n}function P_(e,t){return N_(e,t)?0:e>t?1:-1}function F_({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(P_(r,c)<0)if(a){let e=(i+c)/2;r=P_(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Zg(r),r}function I_({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(N_(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;e_(u!=null,`Invalid first pivot index`),e_(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];e_(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(e_(n!=null,`Previous layout not found for panel index ${t}`),N_(n,i)){let t=o-n;P_(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];e_(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(e_(n!=null,`Previous layout not found for panel index ${t}`),N_(n,o)){let t=n-i;P_(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];e_(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&P_(i,c)<0)if(e>0){let t=c-o,n=t/2;P_(i+e,c)<0&&(e=P_(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;P_(i-e,c)<0&&(e=P_(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];e_(e!=null,`Previous layout not found for panel index ${r}`);let a=F_({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];e_(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=F_({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!N_(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(M_(c,l))return i;{let t=e<0?d:u,r=s[t];e_(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=F_({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!N_(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];e_(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=F_({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(N_(i,s)||(t-=s-i,l[r]=s),N_(t,0))break;e>0?r--:r++}}}if(!N_(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 L_(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||P_(e[n],t[n])!==0)return!1;return!0}function R_({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(!N_(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];e_(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];e_(i!=null,`No layout data found for index ${e}`);let o=r[e];e_(o!=null,`No layout data found for index ${e}`);let s=F_({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!N_(a,0))for(let e=0;e<t.length;e++){let n=r[e];e_(n!=null,`No layout data found for index ${e}`);let i=n+a,o=F_({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,N_(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function z_({groupId:e,panelId:t}){let n=()=>{let t=g_();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=R_({layout:I_({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});L_(l,p)||v_(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&&N_(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Qg({group:t});o(Zg(Xg({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function B_(e){e.defaultPrevented||j_(e,g_()).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=z_({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function V_(e){let t=g_();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 H_({groupId:e}){let t=()=>{let t=g_();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=R_({layout:e,panelConstraints:r});return n?o:(L_(o,c)||v_(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function U_(e,t){let n=V_(e),r=h_(n.id,!0),i=n.separators.find(t=>t.element===e);e_(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);e_(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=H_({groupId:n.id}).getLayout(),c=R_({layout:I_({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});L_(s,c)||v_(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function W_(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=V_(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&U_(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&U_(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&U_(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&U_(t,-5);break;case`End`:e.preventDefault(),U_(t,100);break;case`Enter`:{e.preventDefault();let n=V_(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=h_(n.id,!0),o=n.separators.find(e=>e.element===t);e_(o,`Matching separator not found`);let s=a.get(o);e_(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(e_(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];U_(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=V_(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);e_(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(),U_(t,-100);break}}var G_={cursorFlags:0,state:`inactive`},K_=new u_;function q_(){return G_}function J_(e){return K_.addListener(`change`,e)}function Y_(e){let t=G_,n={...G_};n.cursorFlags=e,G_=n,K_.emit(`change`,{prev:t,next:n})}function X_(e){let t=G_;G_=e,K_.emit(`change`,{prev:t,next:e})}function Z_(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=g_(),n=j_(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)}),X_({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Q_=e=>e,$_=()=>{},ev=1,tv=2,nv=4,rv=8,iv=3,av=12,ov;function sv(){return ov===void 0&&(ov=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(ov=!0)),ov}function cv({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&&sv()){let t=(e&ev)!==0,n=(e&tv)!==0,r=(e&nv)!==0,i=(e&rv)!==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 sv()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var lv=new WeakMap;function uv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=lv.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=q_();switch(r.state){case`active`:case`hover`:{let e=cv({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}lv.set(e,{prevStyle:t,styleSheet:n})}function dv({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=I_({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(L_(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ev:tv;break;case`vertical`:s|=d<0?nv:rv;break}}else v_(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&iv:c|=s&iv,t.movementY===0?c|=o&av:c|=s&av,Y_(c),uv(e)}function fv(e){let t=g_(),n=q_();switch(n.state){case`active`:dv({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function pv(e){if(e.defaultPrevented)return;let t=q_(),n=g_();switch(t.state){case`active`:if(e.buttons===0){X_({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=h_(e.group.id,!0);v_(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)}dv({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=j_(e,n);r.length===0?t.state!==`inactive`&&X_({cursorFlags:0,state:`inactive`}):X_({cursorFlags:0,hitRegions:r,state:`hover`}),uv(e.currentTarget);break}}}function mv(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(q_().state){case`hover`:X_({cursorFlags:0,state:`inactive`})}}function hv(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=q_();switch(t.state){case`active`:X_({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(uv(e.currentTarget),t.hitRegions.forEach(e=>{let t=h_(e.group.id,!0);v_(e.group,t)}),e.preventDefault())}}function gv(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Zg(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Zg((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function _v(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Qg({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Zg(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function vv(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 yv({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=Zg(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]=Zg((r[e]??0)/a*l);else{let e=Zg(l/c.length);for(let t of c)u[t]=e}return u}function bv(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 xv=new Map;function Sv(e){let t=!0;e_(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=Qg({group:e});if(t===0)return;let n=h_(e.id);if(!n)return;let r=$g(e),i=n.defaultLayoutDeferred?gv(r):n.layout,a=R_({layout:yv({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&L_(n.layout,a)&&vv(n.derivedPanelConstraints,r)&&n.groupSize===t)return;v_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else _v(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{e_(!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=Qg({group:e}),s=$g(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(bv(e.panels,l)||(l=void 0));let u=R_({layout:e.mutableState.layouts[c]??l??gv(s),panelConstraints:s}),d=e.element.ownerDocument;xv.set(d,(xv.get(d)??0)+1);let f=new Map;return l_(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),v_(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{e_(!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`,W_)}),xv.get(d)===1&&(d.addEventListener(`dblclick`,B_,!0),d.addEventListener(`pointerdown`,Z_,!0),d.addEventListener(`pointerleave`,fv),d.addEventListener(`pointermove`,pv),d.addEventListener(`pointerout`,mv),d.addEventListener(`pointerup`,hv,!0)),function(){t=!1,xv.set(d,Math.max(0,(xv.get(d)??0)-1)),p_(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,W_)}),xv.get(d)||(d.removeEventListener(`dblclick`,B_,!0),d.removeEventListener(`pointerdown`,Z_,!0),d.removeEventListener(`pointerleave`,fv),d.removeEventListener(`pointermove`,pv),d.removeEventListener(`pointerout`,mv),d.removeEventListener(`pointerup`,hv,!0)),a.disconnect()}}function Cv(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function wv(e){let t=(0,Q.useId)();return`${e??t}`}var Tv=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Ev(e){let t=(0,Q.useRef)(e);return Tv(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Dv(...e){return Ev(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ov(e){let t=(0,Q.useRef)({...e});return Tv(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var kv=(0,Q.createContext)(null);function Av(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Q_});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Tv(()=>{Object.assign(n.current,H_({groupId:e}))})}function jv({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=Ev(e=>{L_(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Ev(e=>{L_(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=wv(s),v=(0,Q.useRef)(null),[y,b]=Cv(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Dv(v,a);Av(_,o);let C=Ev((e,t)=>{let r=q_(),i=m_(e),a=h_(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=Ov({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=t_(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=t_(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=m_(_),i=h_(_);r&&i&&v_(r,{...i,derivedPanelConstraints:$g(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 Tv(()=>{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=Sv(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=h_(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=__(_,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=N_(t.collapsedSize,i[t.panelId]),a=N_(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=q_().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)(kv.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})})}jv.displayName=`Group`;function Mv(){let e=(0,Q.useContext)(kv);return e_(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Nv(e,t){let{id:n}=Mv(),r=(0,Q.useRef)({collapse:$_,expand:$_,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:$_});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Tv(()=>{Object.assign(r.current,z_({groupId:n,panelId:e}))})}function Pv({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=wv(c),_=Ov({disabled:a}),v=(0,Q.useRef)(null),y=Dv(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Mv(),T=d!==null,E=Ev((e,t,n)=>{d?.(e,c,n)});Tv(()=>{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]),Nv(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>__(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:{...Fv,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})})}Pv.displayName=`Panel`;var Fv={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Iv(){return(0,Q.useRef)(null)}function Lv({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=R_({layout:I_({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=R_({layout:I_({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Rv({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=wv(a),l=Ov({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Dv(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Mv(),x=v===`horizontal`?`vertical`:`horizontal`;Tv(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=J_(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=__(_,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(Lv({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})}Rv.displayName=`Separator`;function zv(){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)(ur,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(ur,{className:`h-4 w-full`}),(0,Z.jsx)(ur,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var Bv=1700,Vv=3;function Hv(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Vv;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Uv={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}},Wv=[`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 Gv(e,t={}){let n=t.rng??Math.random,r=t.colors??Wv,i=Uv[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 Kv=1.8,qv=90,Jv=16,Yv=380,Xv=.025,Zv=.1,Qv=.18,$v=400,ey=9.2736,ty=18.1799,ny=14.5244,ry={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function iy(e,t){let{halfWidth:n,apexLift:r}=ry[t];return`M${e-n} ${ny+.3} Q${e} ${ny-r}, ${e+n} ${ny+.3}`}function ay(e){let t=1.5,n=.3;return`M${e-t} ${ny-n} Q${e} ${ny+1.4}, ${e+t} ${ny-n}`}var oy=15,sy=15;function cy(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 ly(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=Hv(g,t);_(n),y(py),S(Gv(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Bv)},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(fy),S(Gv(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},Bv))},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(r){e=r.clientX,t=r.clientY,n=!0};function u(){if(s=requestAnimationFrame(u),!n)return;let c=f.current,l=d.current;if(!c||!l)return;let m=c.getBoundingClientRect(),g=m.left+m.width/2,_=m.top+m.height*.48,v=e-g,y=t-_,b=Math.hypot(v,y),x=Math.max(-1,Math.min(1,v/Yv)),S=Math.max(-1,Math.min(1,y/Yv)),C=x*Jv,w=-S*Jv;r+=(w-r)*Zv,i+=(C-i)*Zv,l.style.transform=`perspective(${$v}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`;let T=0,E=0;if(b>=1){let e=Math.min(b/qv,1)*Kv;T=v/b*e,E=y/b*e}a+=(T-a)*Qv,o+=(E-o)*Qv;let D=i*Xv,O=-r*Xv,k=a+D,A=o+O;h.current.x=k,h.current.y=A,p.current?.setAttribute(`transform`,`translate(${k.toFixed(3)} ${A.toFixed(3)})`)}return document.addEventListener(`mousemove`,l,{passive:!0}),s=requestAnimationFrame(u),()=>{document.removeEventListener(`mousemove`,l),cancelAnimationFrame(s),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:ey,cy:ny,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,q;t[26]===ee?q=t[27]:(q=Y(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=q);let te;t[28]===q?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:ty,cy:ny,rx:1.2722,ry:1.9083,className:q}),t[28]=q,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=iy(ey,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=iy(ty,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:ay(ey),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:ay(ty),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(uy)},`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:dy,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 uy(e){return(0,Z.jsx)(`circle`,{cx:oy+e.originDx,cy:sy+e.originDy,r:e.size,className:`ok-blob-firework`,style:cy(e)},e.id)}function dy(e){return e.preventDefault()}function fy(e){return e+1}function py(e){return e+1}var my=Et(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function hy(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=Y(my({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function gy(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/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _y(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/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(fr,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vy(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-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yy(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(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function by(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)(jl,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xy(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)(Nl,{"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)(Ml,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Sy(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:t=>e.seed.plan(t),apply:t=>e.seed.apply(t)}:{plan:async e=>{let t=e?`?rootDir=${encodeURIComponent(e)}`:``;return await(await fetch(`/api/seed/plan${t}`)).json()},apply:async e=>await(await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e})})).json()}}function Cy(e){let t=(0,$.c)(45),{open:n,onOpenChange:r,onSeedApplied:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`loading`},t[0]=a):a=t[0];let[o,s]=(0,Q.useState)(a),[c,l]=(0,Q.useState)(`project-root`),[u,d]=(0,Q.useState)(`brain`),f=(0,Q.useRef)(!0),p,m;t[1]===n?(p=t[2],m=t[3]):(p=()=>{n&&(l(`project-root`),d(`brain`),f.current=!0)},m=[n],t[1]=n,t[2]=p,t[3]=m),(0,Q.useEffect)(p,m);let h;t[4]===u?h=t[5]:(h=u.trim(),t[4]=u,t[5]=h);let g=h,_=c===`subfolder`&&g===``,v,y;t[6]!==n||t[7]!==c||t[8]!==_||t[9]!==g?(v=()=>{if(!n)return;if(_){s({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=c===`project-root`?void 0:g,t=f.current?0:200;f.current=!1;let r=!1,i=setTimeout(()=>{r||(s(wy),Sy().plan(e).then(e=>{if(!r){if(!e.ok){s({kind:`error`,message:e.error.message});return}s(e.plan.created.length>0||e.plan.configEdits.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||s({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},y=[n,c,g,_],t[6]=n,t[7]=c,t[8]=_,t[9]=g,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==i||t[14]!==o.kind||t[15]!==o.plan?(b=async function(){if(o.kind!==`plan`)return;s({kind:`applying`,plan:o.plan});let e=await Sy().apply(o.plan);e.ok?(Hr.success(`LLM brain initialized (${e.result.applied} ${e.result.applied===1?`entry`:`entries`})`),i?.(),r(!1)):(Hr.error(`Initialize failed: ${e.error.message}`),s({kind:`error`,message:e.error.message}))},t[12]=r,t[13]=i,t[14]=o.kind,t[15]=o.plan,t[16]=b):b=t[16];let x=b,S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(Rr,{children:[(0,Z.jsxs)(Dr,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-4 w-4 text-foreground opacity-70`}),`Initialize LLM brain`]}),(0,Z.jsx)(Tr,{children:`Three layers designed so AI agents can navigate naturally: raw sources, working drafts, and canonical articles.`})]}),t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==u?(C=(0,Z.jsx)(Ty,{choice:c,subfolder:u,onChoiceChange:l,onSubfolderChange:d}),t[18]=c,t[19]=u,t[20]=C):C=t[20];let w;t[21]===o?w=t[22]:(w=(0,Z.jsx)(Ey,{phase:o}),t[21]=o,t[22]=w);let T;t[23]!==w||t[24]!==C?(T=(0,Z.jsxs)(Pr,{className:`space-y-6`,children:[C,w]}),t[23]=w,t[24]=C,t[25]=T):T=t[25];let E;t[26]===r?E=t[27]:(E=()=>r(!1),t[26]=r,t[27]=E);let D=o.kind===`already-seeded`||o.kind===`error`?`Close`:`Cancel`,O;t[28]!==E||t[29]!==D?(O=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:E,children:D}),t[28]=E,t[29]=D,t[30]=O):O=t[30];let k;t[31]!==x||t[32]!==o.kind||t[33]!==_?(k=o.kind===`plan`?(0,Z.jsx)(X,{onClick:x,disabled:_,children:`Initialize`}):o.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(Rt,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up…`]}):null,t[31]=x,t[32]=o.kind,t[33]=_,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Z.jsxs)(Fr,{children:[O,k]}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==T||t[39]!==A?(j=(0,Z.jsxs)(jr,{className:`sm:max-w-2xl`,"data-ok-layer-spawned":``,children:[S,T,A]}),t[38]=T,t[39]=A,t[40]=j):j=t[40];let M;return t[41]!==r||t[42]!==n||t[43]!==j?(M=(0,Z.jsx)(zr,{open:n,onOpenChange:r,children:j}),t[41]=r,t[42]=n,t[43]=j,t[44]=M):M=t[44],M}function wy(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Ty(e){let t=(0,$.c)(21),{choice:n,subfolder:r,onChoiceChange:i,onSubfolderChange:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Where should the brain live?`}),t[0]=o):o=t[0];let s;t[1]===i?s=t[2]:(s=e=>i(e),t[1]=i,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(_y,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(hy,{orientation:`horizontal`,children:[(0,Z.jsxs)(gy,{children:[(0,Z.jsx)(vy,{children:`Project root`}),(0,Z.jsx)(yy,{children:`Scaffold the three folders directly under this project.`})]}),(0,Z.jsx)(xy,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=c):c=t[3];let l,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(vy,{children:`In a subfolder`}),u=(0,Z.jsx)(yy,{className:`nth-last-2:mt-0`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=l,t[5]=u):(l=t[4],u=t[5]);let d;t[6]===a?d=t[7]:(d=e=>a(e.target.value),t[6]=a,t[7]=d);let f;t[8]===i?f=t[9]:(f=()=>i(`subfolder`),t[8]=i,t[9]=f);let p;t[10]!==r||t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(gy,{children:[l,u,(0,Z.jsx)(Gn,{value:r,onChange:d,onFocus:f,placeholder:`brain`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=r,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(xy,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,Z.jsx)(_y,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(hy,{orientation:`horizontal`,children:[p,m]})}),t[15]=p,t[16]=h);let g;return t[17]!==n||t[18]!==h||t[19]!==s?(g=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[o,(0,Z.jsxs)(by,{className:`sm:flex`,value:n,onValueChange:s,children:[c,h]})]}),t[17]=n,t[18]=h,t[19]=s,t[20]=g):g=t[20],g}function Ey(e){let t=(0,$.c)(11),{phase:n}=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)(Rt,{"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 LLM brain is already set up.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The three-layer structure is in place — there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let r=n.plan,i;t[4]===r?i=t[5]:(i=(0,Z.jsx)(My,{plan:r}),t[4]=r,t[5]=i);let a;t[6]===r.warnings?a=t[7]:(a=r.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:r.warnings.map(Dy)}):null,t[6]=r.warnings,t[7]=a);let o;return t[8]!==i||t[9]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function Dy(e){return(0,Z.jsx)(`p`,{children:e},e)}var Oy=[{name:`external-sources`,blurb:`Raw sources saved verbatim — full text of URLs and PDFs, not just citations. Every claim traces back to preserved evidence.`},{name:`research`,blurb:`Provisional analysis synthesizing sources. Every claim cites a doc; promotes to articles/ once the team trusts the findings.`},{name:`articles`,blurb:`Canonical decisions. Each links back through research/ to its sources — no dead links, full evidence chain in repo.`}],ky={"log.md":`Append-only timeline`};function Ay(e){return e.split(`/`).pop()??e}function jy(e){let t=new Map(Oy.map(e=>[e.name,e.blurb])),n=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:t.get(Ay(e.path))??``})),r=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:ky[Ay(e.path)]??``})),i=e.configEdits.length>0?[{kind:`config`,name:`.ok/config.yml`,description:`Folder descriptions for AI agents`}]:[];return[...n,...r,...i]}function My(e){let t=(0,$.c)(13),{plan:n}=e,r,i,a,o;if(t[0]!==n){let e=jy(n);a=`space-y-3`,t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(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[5]=o):o=t[5],r=`space-y-3 overflow-y-auto subtle-scrollbar max-h-full`,i=e.map(Ny),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[6]!==r||t[7]!==i?(s=(0,Z.jsx)(`ul`,{className:r,children:i}),t[6]=r,t[7]=i,t[8]=s):s=t[8];let c;return t[9]!==a||t[10]!==o||t[11]!==s?(c=(0,Z.jsxs)(`section`,{className:a,children:[o,s]}),t[9]=a,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ny(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)(la,{"aria-hidden":`true`,className:`mt-1 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):e.kind===`config`?(0,Z.jsx)(ia,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(aa,{"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)}function Py(){let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(`loading`),[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(){let t=fetch(`/api/documents`).then(async t=>{let n=await t.json().catch(zy);e||(t.ok&&n?.ok&&Array.isArray(n.documents)?(i(n.documents.length),l.current=!0):l.current||=(i(1),!0))}).catch(()=>{!e&&!l.current&&(i(1),l.current=!0)}),n=(async()=>{let t=typeof window<`u`?window.okDesktop:void 0;try{let n=t?.seed?await t.seed.plan():await fetch(`/api/seed/plan`).then(Ry);if(e)return;if(!n?.ok){o(`error`);return}o(n.plan.created.length>0||n.plan.configEdits.length>0?`has-work`:`seeded`)}catch{e||o(`error`)}})();await Promise.all([t,n])};t();let n=Xe(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(Ly),250),o(`seeded`),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(Iy);e.ok&&t?.ok&&Array.isArray(t.documents)&&i(t.documents.length)}).catch(Fy)},e[2]=p):p=e[2];let m=p,h=a===`has-work`,g=r!==null&&a!==`loading`,_=r===0,v;e[3]===s?v=e[4]:(v=(0,Z.jsx)(ly,{size:80,celebrateSignal:s}),e[3]=s,e[4]=v);let y;e[5]!==_||e[6]!==g||e[7]!==h?(y=g?_?(0,Z.jsx)(By,{onCtaClick:()=>n(!0),showCta:h}):(0,Z.jsx)(Vy,{onCtaClick:()=>n(!0),showCta:h}):null,e[5]=_,e[6]=g,e[7]=h,e[8]=y):y=e[8];let b;e[9]===t?b=e[10]:(b=(0,Z.jsx)(Cy,{open:t,onOpenChange:n,onSeedApplied:m}),e[9]=t,e[10]=b);let x;return e[11]!==v||e[12]!==y||e[13]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6 px-6`,children:[v,y,b]}),e[11]=v,e[12]=y,e[13]=b,e[14]=x):x=e[14],x}function Fy(){}function Iy(){return null}function Ly(e){return e+1}function Ry(e){return e.json()}function zy(){return null}function By(e){let t=(0,$.c)(7),{onCtaClick:n,showCta:r}=e,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`h2`,{className:`text-base font-medium`,children:`Welcome to your LLM brain`}),a=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A space for working with AI agents. Start with a curated layer structure — or create your own files in the sidebar.`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]!==n||t[3]!==r?(o=r?(0,Z.jsxs)(X,{className:`mt-1`,onClick:n,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}):null,t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[i,a,o]}),t[5]=o,t[6]=s),s}function Vy(e){let t=(0,$.c)(6),{onCtaClick:n,showCta:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{className:`select-none text-sm text-muted-foreground`,children:`Select a document to edit`}),t[0]=i):i=t[0];let a;t[1]!==n||t[2]!==r?(a=r?(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`uppercase font-mono text-xs`,onClick:n,children:[(0,Z.jsx)(ar,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),`Initialize LLM brain`]}):null,t[1]=n,t[2]=r,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[i,a]}),t[4]=a,t[5]=o),o}function Hy(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function Uy(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=Hy(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function Wy(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function Gy(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:Uy(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:Wy(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:Uy(e,t.pageTitles),children:a}}function Ky(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)(Jc,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function qy(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)(Yc,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Jy(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,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=Y(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-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-[state=closed]:overflow-hidden 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[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(Xc,{children:(0,Z.jsx)(Zc,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function Yy(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/dropdown-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 not-data-[variant=destructive]: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 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)($c,{"data-slot":`dropdown-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 Xy(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)(el,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Zy(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Y(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Z.jsx)(nl,{children:(0,Z.jsx)(pr,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(tl,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Qy(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Y(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Qc,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function $y(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)(rl,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function eb(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)(il,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function tb(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Y(`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 not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Kt,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(al,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function nb(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 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg 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)(ol,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rb(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 ib(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 ab(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 ob(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 sb(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 cb(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 lb(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 ub(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 db(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)(Yn,{className:`ml-1 size-3`}):(0,Z.jsx)(Mt,{className:`ml-1 size-3`}):(0,Z.jsx)(Fi,{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 fb(e){let t=(0,$.c)(87),{folderPath:n}=e,{addPage:r,folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Be(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(`name`),[_,v]=(0,Q.useState)(`asc`);if(a){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)(ur,{className:`size-5 rounded`}),(0,Z.jsx)(ur,{className:`h-7 w-48`})]}),(0,Z.jsx)(ur,{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)(ur,{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)(ur,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(gb)]})]})}),t[2]=r):r=t[2],r}let y,b,x,S,C,w,T,E;if(t[3]!==r||t[4]!==p||t[5]!==d||t[6]!==n||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==h){let e=Gy(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=ub(e.children,h,_),l;t[21]===h?l=t[22]:(l=function(e){e===h?v(hb):(g(e),v(`asc`))},t[21]=h,t[22]=l);let D=l,O;t[23]!==r||t[24]!==n?(O=async function(){f(!0),m(null);try{let e=`${n}/index.md`,t=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await t.json().catch(mb);if(!t.ok||!i?.ok){m(i?.error??`Server error (HTTP ${t.status})`),f(!1);return}let a=i.docName??`${n}/index`;r(a),Oe([`files`,`backlinks`,`graph`]),window.location.hash=at(a)}catch(e){console.warn(`[FolderOverview] create index note failed:`,e),m(`Network error — please try again`)}f(!1)},t[23]=r,t[24]=n,t[25]=O):O=t[25];let k=O;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,w=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(en,{className:`size-5 text-muted-foreground`}),t[26]=A):A=t[26];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(mr,{className:`size-4`}),t[27]=M):M=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(qy,{asChild:!0,children:(0,Z.jsxs)(X,{children:[M,`New`,(0,Z.jsx)(nn,{className:`size-3`})]})}),t[28]=N):N=t[28];let P;t[29]===k?P=t[30]:(P=()=>void k(),t[29]=k,t[30]=P);let F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:`Index note`}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Landing page for this folder`})]}),t[31]=F):F=t[31];let I;t[32]!==d||t[33]!==P?(I=(0,Z.jsx)(Yy,{disabled:d,onSelect:P,children:F}),t[32]=d,t[33]=P,t[34]=I):I=t[34];let L;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Yy,{onSelect:()=>u(!0),children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:`Note`}),(0,Z.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`New note inside this folder`})]})}),t[35]=L):L=t[35];let R;t[36]===I?R=t[37]:(R=(0,Z.jsxs)(Ky,{children:[N,(0,Z.jsxs)(Jy,{align:`end`,children:[I,L]})]}),t[36]=I,t[37]=R);let z;t[38]!==j||t[39]!==R?(z=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,R]}),t[38]=j,t[39]=R,t[40]=z):z=t[40];let B;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This folder has no landing note yet. Choose an explicit action to add one or open a note inside the folder.`}),t[41]=B):B=t[41];let V;t[42]===p?V=t[43]:(V=p?(0,Z.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:p}):null,t[42]=p,t[43]=V),t[44]!==z||t[45]!==V?(T=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[z,B,V]}),t[44]=z,t[45]=V,t[46]=T):T=t[46],C=`rounded-lg border`,b=rb;let H=h===`name`?_===`asc`?`ascending`:`descending`:`none`,U;t[47]!==D||t[48]!==_||t[49]!==h?(U=(0,Z.jsx)(db,{label:`Name`,sortKey:`name`,activeKey:h,activeDir:_,onSort:D}),t[47]=D,t[48]=_,t[49]=h,t[50]=U):U=t[50];let W;t[51]!==H||t[52]!==U?(W=(0,Z.jsx)(sb,{"aria-sort":H,children:U}),t[51]=H,t[52]=U,t[53]=W):W=t[53];let G=h===`modified`?_===`asc`?`ascending`:`descending`:`none`,K;t[54]!==D||t[55]!==_||t[56]!==h?(K=(0,Z.jsx)(db,{label:`Modified`,sortKey:`modified`,activeKey:h,activeDir:_,onSort:D}),t[54]=D,t[55]=_,t[56]=h,t[57]=K):K=t[57];let ee;t[58]!==G||t[59]!==K?(ee=(0,Z.jsx)(sb,{className:`w-32`,"aria-sort":G,children:K}),t[58]=G,t[59]=K,t[60]=ee):ee=t[60],t[61]!==W||t[62]!==ee?(S=(0,Z.jsx)(ib,{children:(0,Z.jsxs)(ob,{children:[W,ee]})}),t[61]=W,t[62]=ee,t[63]=S):S=t[63],y=ab,x=a.length?a.map(pb):(0,Z.jsx)(ob,{children:(0,Z.jsx)(cb,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=r,t[4]=p,t[5]=d,t[6]=n,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=_,t[12]=h,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E}else y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20];let D;t[64]!==y||t[65]!==x?(D=(0,Z.jsx)(y,{children:x}),t[64]=y,t[65]=x,t[66]=D):D=t[66];let O;t[67]!==b||t[68]!==S||t[69]!==D?(O=(0,Z.jsxs)(b,{children:[S,D]}),t[67]=b,t[68]=S,t[69]=D,t[70]=O):O=t[70];let k;t[71]!==C||t[72]!==O?(k=(0,Z.jsx)(`div`,{className:C,children:O}),t[71]=C,t[72]=O,t[73]=k):k=t[73];let A;t[74]!==w||t[75]!==T||t[76]!==k?(A=(0,Z.jsxs)(`div`,{className:w,children:[T,k]}),t[74]=w,t[75]=T,t[76]=k,t[77]=A):A=t[77];let j;t[78]!==A||t[79]!==E?(j=(0,Z.jsx)(`div`,{className:E,children:A}),t[78]=A,t[79]=E,t[80]=j):j=t[80];let M;t[81]!==l||t[82]!==n?(M=(0,Z.jsx)($t,{open:l,onOpenChange:u,kind:`file`,initialDir:n}),t[81]=l,t[82]=n,t[83]=M):M=t[83];let N;return t[84]!==j||t[85]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[j,M]}),t[84]=j,t[85]=M,t[86]=N):N=t[86],N}function pb(e){return(0,Z.jsxs)(ob,{children:[(0,Z.jsx)(cb,{children:(0,Z.jsxs)(`a`,{href:at(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)(la,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Bt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(cb,{className:`text-muted-foreground`,children:e.kind===`file`?lb(e.modified):`—`})]},e.path)}function mb(){return null}function hb(e){return e===`asc`?`desc`:`asc`}function gb(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)(ur,{className:`size-4 rounded`}),(0,Z.jsx)(ur,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(ur,{className:`h-4 w-16`})})]},e)}var _b=(0,Q.createContext)(null);function vb(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(yb),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)(_b,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function yb(){return new Map}function bb(){let e=(0,Q.use)(_b);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function xb(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)(jv,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sb(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)(Pv,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Cb(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)(Rv,{"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 wb=960,Tb=1024;function Eb(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Ob),[r,i]=(0,Q.useState)(Db),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${wb-1}px)`),t=window.matchMedia(`(max-width: ${Tb-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 Db(){return window.innerWidth>=wb&&window.innerWidth<Tb}function Ob(){return window.innerWidth<wb?`sheet`:`panel`}var kb={words:0,chars:0,tokens:0},Ab=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,jb=/[\p{L}\p{N}]/u;function Mb(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))jb.test(n)&&t++;return t}function Nb(e){let t=globalThis.Intl.Segmenter;if(!t)return Mb(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Pb(e){let t=Ab.test(e)?1.5:4;return Math.ceil(e.length/t)}function Fb(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=G(e),n=t.trim();return n?{words:Ab.test(n)?Nb(n):Mb(n),chars:n.length,tokens:Pb(n)}:{words:0,chars:0,tokens:0}}var Ib=300;function Lb(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(kb),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(kb);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Fb(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,Ib)};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}var Rb=ye;function zb(e,t={}){let n=Vt(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Bb=4;function Vb(e){let t=(0,$.c)(8),{editor:n}=e,r=Wn(n),i=!!(n&&r&&r.ancestorChain.length>0),a=i?void 0:`true`,o=`jsx-component-breadcrumb flex items-center gap-1 min-h-[28px] px-3 py-1.5 text-xs font-mono text-muted-foreground overflow-hidden ${i?`border-t border-border`:``}`,s;t[0]!==r||t[1]!==n||t[2]!==i?(s=i&&r?(0,Z.jsx)(Ub,{editor:n,blockSelection:r}):null,t[0]=r,t[1]=n,t[2]=i,t[3]=s):s=t[3];let c;return t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":`Block ancestor navigation`,"aria-hidden":a,className:o,children:s}),t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Hb(e,t){let n=cn.getState(e.state)?.posToId;if(!n)return t.pos;for(let[e,r]of n)if(r===t.bridgeId)return e;return null}function Ub(e){let t=(0,$.c)(9),{editor:n,blockSelection:r}=e,{ancestorChain:i,selectedBlockId:a}=r,o;if(t[0]!==i||t[1]!==n||t[2]!==a){let e=Kb(i),r;t[4]===n?r=t[5]:(r=(0,Z.jsx)(`button`,{type:`button`,className:`opacity-60 hover:opacity-100 hover:text-foreground transition-opacity outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,onClick:()=>{n.chain().focus().setTextSelection(0).command(Gb).run()},children:Nt}),t[4]=n,t[5]=r);let s;t[6]!==n||t[7]!==a?(s=e=>{if(e.kind===`ellipsis`)return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Kt,{size:12,className:`opacity-50`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{role:`img`,"aria-label":`${e.hiddenCount} hidden ancestors`,title:`${e.hiddenCount} hidden ancestors`,className:`opacity-60`,children:`…`})]},`ellipsis`);let t=zb(e.entry),r=e.entry.bridgeId===a;return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 min-w-0`,children:[(0,Z.jsx)(Kt,{size:12,className:`opacity-50 shrink-0`,"aria-hidden":`true`}),r?(0,Z.jsx)(`span`,{"aria-current":`location`,className:`text-foreground truncate`,children:t}):(0,Z.jsx)(`button`,{type:`button`,className:`hover:text-foreground transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm truncate`,onClick:()=>{let t=Hb(n,e.entry);t!==null&&n.chain().focus().setNodeSelection(t).command(Wb).run()},children:t})]},e.entry.bridgeId)},t[6]=n,t[7]=a,t[8]=s):s=t[8],o=(0,Z.jsxs)(Z.Fragment,{children:[r,e.map(s)]}),t[0]=i,t[1]=n,t[2]=a,t[3]=o}else o=t[3];return o}function Wb(e){let{tr:t}=e;return t.setMeta(rn,`programmatic`),!0}function Gb(e){let{tr:t}=e;return t.setMeta(rn,`programmatic`),!0}function Kb(e){if(e.length<=Bb)return e.map(e=>({kind:`entry`,entry:e}));let t=e[0],n=e.slice(-2),r=e.length-1-n.length;return[{kind:`entry`,entry:t},{kind:`ellipsis`,hiddenCount:r},...n.map(e=>({kind:`entry`,entry:e}))]}var qb=200,Jb=`Outside any block`;function Yb(e){let t=(0,$.c)(5),{editor:n}=e,r=Wn(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?Xb(n,r):o.current?Jb:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},qb),()=>{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 Xb(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=zb(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=zb(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 Zb(){let[e]=(0,Q.useState)(ze);return e}function Qb({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:$e(e.display_name),color:rt(e.id,I),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:rt(e.id,I),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function $b(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 ex=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&&qe(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(ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(me(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(W(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(V(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ve(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(K(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(R(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ge(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=Ne(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Le){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 U){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():$b(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&de(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()}},tx=e=>new De({key:typeof e.pluginKey==`string`?new ot(e.pluginKey):e.pluginKey,view:t=>new ex({view:t,...e})});ue.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[tx({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 nx=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 ke(e,{textSerializers:Ze(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(ut(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(me(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(W(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(V(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ve(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(K(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(R(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ge(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=Ne(this.view,e.from,e.to);de({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()}},rx=e=>new De({key:typeof e.pluginKey==`string`?new ot(e.pluginKey):e.pluginKey,view:t=>new nx({view:t,...e})});ue.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?[rx({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 ix(e,t){return e??new ot(t)}var ax=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,ox=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),sx=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(`.`)),cx=new Set([`children`,`className`,`style`]),lx=new Set([`tabIndex`]),ux=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),dx={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function fx(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function px(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function mx(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||ux.has(e)}function hx(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function gx(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:dx[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function _x(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 vx(e){return lx.has(e)}function yx(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function bx(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 xx(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||sx.has(e)?String(t):`${t}px`}function Sx(e,t){ox.has(t)||e.style.removeProperty(hx(t))}function Cx(e,t,n){ox.has(t)||e.style.setProperty(hx(t),xx(t,n))}function wx(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(cx.has(r)||!mx(r)||fx(r,t[r])||fx(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=px(r);if(a==null||a===!1){vx(r)&&bx(e,r),e.removeAttribute(o);return}if(a===!0){vx(r)&&yx(e,r,!0),e.setAttribute(o,``);return}if(vx(r)){yx(e,r,a);return}e.setAttribute(o,String(a))})}function Tx(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Ex(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){Sx(e,t);return}Cx(e,t,a)}})}function Dx(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(!fx(t,n))return;let{eventName:i,options:a}=gx(t),o=t=>{n(_x(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Ox(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);ax(()=>{let i=n.current;return Tx(e,i.className,t.className),Ex(e,i.style,t.style),wx(e,i,t),r.current=Dx(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 kx=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(ix(e,`bubbleMenu`)).current;Ox(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Cn(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=tx({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,zi.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(ix(e,`floatingMenu`)).current;Ox(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Cn(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=rx({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,zi.createPortal)(s,u.current)});var Ax=[{name:`paragraph`,label:`Text`,icon:ja,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Xt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Jt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Dn,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:It,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:kn,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Qt,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Un,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Ha,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function jx(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Mx},t[0]=n,t[1]=r);let{current:i,activeStates:a}=mn(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)(nn,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(qy,{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=Ax.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Yy,{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)(Jy,{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)(Ky,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Mx(e){let t=Object.fromEntries(Ax.map(t=>[t.name,t.isActive(e.editor)]));return{current:Ax.find(e=>t[e.name])??Ax[0],activeStates:t}}var Nx=[{name:`bold`,icon:Li,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:ga,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:Xa,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:Ga,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:Xi,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:ha,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Px(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Fx},t[0]=n,t[1]=r);let i=mn(r),a;t[2]!==i||t[3]!==n?(a=Nx.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{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)(Gr,{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 Fx(e){return Object.fromEntries(Nx.map(t=>[t.name,t.isActive(e.editor)]))}function Ix(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)(ea,{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)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),window.open(d,`_blank`,`noopener,noreferrer`)},children:(0,Z.jsx)(br,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{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)(Pt,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{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)(ba,{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)(Wr,{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)(Gr,{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)(qr,{children:[T,E]}),t[44]=T,t[45]=D),D}function Lx({editor:e}){if(e.state.selection.empty||e.isActive(`codeBlock`))return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function Rx(e){let t=(0,$.c)(25),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]!==n.state||t[1]!==n.view?(s=()=>{try{let{from:e,to:t}=n.state.selection;return Ne(n.view,e,t)}catch{return new DOMRect}},t[0]=n.state,t[1]=n.view,t[2]=s):s=t[2];let c;if(t[3]!==n.view.dom||t[4]!==s){let e={getBoundingClientRect:s,contextElement:n.view.dom};c=()=>{let t=r.current;t&&(o.current?.(),o.current=re(e,t,()=>{de(e,t,{placement:`top`,strategy:`fixed`,middleware:[W(8),ut(),me({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(Vx)}))},t[3]=n.view.dom,t[4]=s,t[5]=c}else c=t[5];let l=c,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o.current?.(),o.current=null,a(Bx)},t[6]=u):u=t[6];let d=u,f;t[7]===l?f=t[8]:(f={onShow:l,onHide:d,strategy:`fixed`},t[7]=l,t[8]=f);let p;t[9]===n?p=t[10]:(p=(0,Z.jsx)(jx,{editor:n}),t[9]=n,t[10]=p);let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(xh,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i?(h=(0,Z.jsx)(Px,{editor:n},i),t[12]=n,t[13]=i,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xh,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[15]=g):g=t[15];let _=`${i}-link`,v;t[16]!==n||t[17]!==_?(v=(0,Z.jsx)(Ix,{editor:n},_),t[16]=n,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==n||t[20]!==v||t[21]!==f||t[22]!==p||t[23]!==h?(y=(0,Z.jsxs)(kx,{ref:r,editor:n,appendTo:zx,shouldShow:Lx,updateDelay:250,options:f,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[p,m,h,g,v]}),t[19]=n,t[20]=v,t[21]=f,t[22]=p,t[23]=h,t[24]=y):y=t[24],y}function zx(){return document.body}function Bx(e){return e+1}function Vx(){}var Hx=[{name:`addRowBefore`,icon:Yn,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:Mt,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Pt,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],Ux=[{name:`addColumnBefore`,icon:nr,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:vr,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Pt,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],Wx=[{name:`toggleHeaderRow`,icon:qa,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:Qi,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:da,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function Gx({editor:e}){return e.isActive(`table`)}function Kx(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)(Wr,{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)(Gr,{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)(qr,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function qx(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=Hx.map(e=>(0,Z.jsx)(Kx,{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)(xh,{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=Ux.map(e=>(0,Z.jsx)(Kx,{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)(xh,{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=Wx.map(e=>(0,Z.jsx)(Kx,{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)(kx,{editor:n,shouldShow:Gx,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 Jx=new WeakMap;function Yx(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=Me(e.color),n.textContent=e.name,t.append(n),t}var Xx={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},Zx=e=>{let t=(0,$.c)(66),{provider:n,placeholder:r,isSourceMode:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(Xx),s=Zb(),{principal:c,activeDocName:l}=jn(),u=n.configuration.name??``,[d]=(0,Q.useState)(Qx),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null);if(m)throw m;let g=(0,Q.useRef)(null),_;t[0]!==d||t[1]!==u||t[2]!==r||t[3]!==n?(_=()=>{let e;try{let t={viewCount:0,bytes:n.document.getText(`source`).length};e=dn({docName:u,container:document.createElement(`div`),sizeStats:t,factory:e=>{let t=performance.now();return{editor:new Te({element:e,onBeforeCreate:e=>{let{editor:n}=e;Jx.set(n,t)},onCreate:e=>{let{editor:t}=e;d.html.setView(t.view);let r=Jx.get(t);if(Jx.delete(t),r==null)return;let i=performance.now();qn(`ok/editor/create-tiptap`,{docName:n.configuration.name??`unknown`,ytextLength:n.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,n,r)=>{let i=d.mdManager.parse(e);return r.state.schema.nodeFromJSON(i).content},clipboardTextSerializer:(e,t)=>d.text(e,t),clipboardSerializer:d.html.serializer,handlePaste:(e,t)=>d.paste(e,t)},extensions:[...xn.map(e=>e.name===`link`?e.configure({docName:n.configuration.name??``}):e),Rb.configure({placeholder:r??`Type '/' for commands`,showOnlyCurrent:!0}),Ht.configure({document:n.document}),ue.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[un]}}),ue.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=n.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Rn(e,{cursorBuilder:Yx})]}})]}),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}}}),g.current=e,p(e.editor)}catch(e){let t=e;console.error(`[TiptapEditor] mountTiptapEditor failed`,t),g.current=null,p(null),h(t instanceof Error?t:Error(String(t)))}return()=>{let e=g.current;e&&fn(e),g.current=null,p(null)}},t[0]=d,t[1]=u,t[2]=r,t[3]=n,t[4]=_):_=t[4];let v;t[5]!==d||t[6]!==u||t[7]!==n?(v=[u,n,d],t[5]=d,t[6]=u,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(_,v);let y;t[9]!==f||t[10]!==n.configuration.name?(y=()=>{if(f)return Wt(f,n.configuration.name??null),()=>{Wt(f,null)}},t[9]=f,t[10]=n.configuration.name,t[11]=y):y=t[11];let b;t[12]!==f||t[13]!==n?(b=[f,n],t[12]=f,t[13]=n,t[14]=b):b=t[14],(0,Q.useEffect)(y,b);let x;t[15]!==f||t[16]!==n.configuration.name?(x=()=>{},t[15]=f,t[16]=n.configuration.name,t[17]=x):x=t[17];let S;t[18]!==f||t[19]!==n?(S=[f,n],t[18]=f,t[19]=n,t[20]=S):S=t[20],(0,Q.useEffect)(x,S);let C,w;t[21]===f?(C=t[22],w=t[23]):(C=()=>{if(!f)return;let e=$x,t=null,n=()=>{if(t||!f||f.isDestroyed)return;let n=Kn(f);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 Kn(f)?n():f.on(`create`,n),()=>{f.off(`create`,n),r()}},w=[f],t[21]=f,t[22]=C,t[23]=w),(0,Q.useEffect)(C,w);let T,E;t[24]!==f||t[25]!==n.document?(E=()=>{if(!f)return;let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,s=null,c=null,l=()=>{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},u=e=>{o.current=e;let t=a.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=l(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(o.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};u(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),s&&clearTimeout(s),c&&clearTimeout(c),s=window.setTimeout(()=>{let e={...n,state:`settled`};u(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),c=window.setTimeout(()=>{u({...e,state:`idle`})},300)},Ue)};u(Xx);let p=()=>{if(Je(e),!st(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(p);let m=()=>{document.visibilityState===`visible`?st(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,m),()=>{e.unobserve(p),document.removeEventListener(`visibilitychange`,m),i&&clearTimeout(i),s&&clearTimeout(s),c&&clearTimeout(c)}},T=[f,n.document],t[24]=f,t[25]=n.document,t[26]=T,t[27]=E):(T=t[26],E=t[27]),(0,Q.useEffect)(E,T);let D,O;t[28]===n?(D=t[29],O=t[30]):(D=()=>{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)}},O=[n],t[28]=n,t[29]=D,t[30]=O),(0,Q.useEffect)(D,O);let k,A;t[31]===f?(k=t[32],A=t[33]):(k=()=>{if(!f)return;let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||!f||f.isDestroyed)return;let n=Kn(f);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(yi,e),()=>window.removeEventListener(yi,e)},A=[f],t[31]=f,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j;t[34]!==l||t[35]!==u||t[36]!==s||t[37]!==i||t[38]!==c||t[39]!==n.awareness?(j=()=>{let e=n.awareness;if(e){if(u!==l){e.setLocalState(null);return}e.setLocalState({user:Qb({principal:c,identity:s}),mode:i?`source`:`wysiwyg`})}},t[34]=l,t[35]=u,t[36]=s,t[37]=i,t[38]=c,t[39]=n.awareness,t[40]=j):j=t[40];let M;t[41]!==l||t[42]!==u||t[43]!==s||t[44]!==i||t[45]!==c||t[46]!==n?(M=[n,u,l,s,c,i],t[41]=l,t[42]=u,t[43]=s,t[44]=i,t[45]=c,t[46]=n,t[47]=M):M=t[47],(0,Q.useEffect)(j,M);let N;t[48]===f?N=t[49]:(N=f&&(0,Z.jsx)(Rx,{editor:f}),t[48]=f,t[49]=N);let P;t[50]===f?P=t[51]:(P=f&&(0,Z.jsx)(qx,{editor:f}),t[50]=f,t[51]=P);let F,I;t[52]===f?(F=t[53],I=t[54]):(F=(0,Z.jsx)(wn,{editor:f,className:`h-full`}),I=f&&(0,Z.jsx)(Vb,{editor:f}),t[52]=f,t[53]=F,t[54]=I);let L;t[55]===f?L=t[56]:(L=f&&(0,Z.jsx)(Yb,{editor:f}),t[55]=f,t[56]=L);let R;t[57]===f?R=t[58]:(R=f&&(0,Z.jsx)(Yt,{store:qt(f).store}),t[57]=f,t[58]=R);let z;return t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I||t[63]!==L||t[64]!==R?(z=(0,Z.jsxs)(`div`,{ref:a,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,I,L,R]}),t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L,t[64]=R,t[65]=z):z=t[65],z};function Qx(){let e=new B({extensions:_e});return{mdManager:e,text:jt({mdManager:e}),html:Jn({mdManager:e}),paste:ln({mdManager:e})}}function $x(){return gn()}function eS(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(zn(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 tS=`__back-nav__`;function nS(e){return e instanceof vn||e instanceof Mn||e instanceof hn||e instanceof Tn||e instanceof In?e.docName:null}function rS(e){return e instanceof vn?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof Mn?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof hn?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof Tn?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof In?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function iS(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=rS(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)(ly,{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-lg font-medium`,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||(An(nS(n)??i),o(a),r(tS))},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 aS(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)(iS,{...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]===tS){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.warn(`[DocumentErrorBoundary] rendered fallback for ${n}: ${rS(e).title}`)},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)(En,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function oS(){var e=[...arguments];return(0,Q.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var sS=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function cS(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function lS(e){return`nodeType`in e}function uS(e){return e?cS(e)?e:lS(e)?e.ownerDocument?.defaultView??window:window:window}function dS(e){let{Document:t}=uS(e);return e instanceof t}function fS(e){return cS(e)?!1:e instanceof uS(e).HTMLElement}function pS(e){return e instanceof uS(e).SVGElement}function mS(e){return e?cS(e)?e.document:lS(e)?dS(e)?e:fS(e)||pS(e)?e.ownerDocument:document:document:document}var hS=sS?Q.useLayoutEffect:Q.useEffect;function gS(e){let t=(0,Q.useRef)(e);return hS(()=>{t.current=e}),(0,Q.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function _S(){let e=(0,Q.useRef)(null);return[(0,Q.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,Q.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function vS(e,t){t===void 0&&(t=[e]);let n=(0,Q.useRef)(e);return hS(()=>{n.current!==e&&(n.current=e)},t),n}function yS(e,t){let n=(0,Q.useRef)();return(0,Q.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function bS(e){let t=gS(e),n=(0,Q.useRef)(null);return[n,(0,Q.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function xS(e){let t=(0,Q.useRef)();return(0,Q.useEffect)(()=>{t.current=e},[e]),t.current}var SS={};function CS(e,t){return(0,Q.useMemo)(()=>{if(t)return t;let n=SS[e]==null?0:SS[e]+1;return SS[e]=n,e+`-`+n},[e,t])}function wS(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var TS=wS(1),ES=wS(-1);function DS(e){return`clientX`in e&&`clientY`in e}function OS(e){if(!e)return!1;let{KeyboardEvent:t}=uS(e.target);return t&&e instanceof t}function kS(e){if(!e)return!1;let{TouchEvent:t}=uS(e.target);return t&&e instanceof t}function AS(e){if(kS(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return DS(e)?{x:e.clientX,y:e.clientY}:null}var jS=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[jS.Translate.toString(e),jS.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),MS=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function NS(e){return e.matches(MS)?e:e.querySelector(MS)}var PS={display:`none`};function FS(e){let{id:t,value:n}=e;return Q.createElement(`div`,{id:t,style:PS},n)}function IS(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return Q.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function LS(){let[e,t]=(0,Q.useState)(``);return{announce:(0,Q.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var RS=(0,Q.createContext)(null);function zS(e){let t=(0,Q.useContext)(RS);(0,Q.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function BS(){let[e]=(0,Q.useState)(()=>new Set),t=(0,Q.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,Q.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var VS={draggable:`
28
28
  To pick up a draggable item, press the space bar.
29
29
  While dragging, use the arrow keys to move the item.
30
30
  Press space again to drop the item in its new position, or press escape to cancel.
31
- `},NS={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function PS(e){let{announcements:t=NS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=MS}=e,{announce:a,announcement:o}=OS(),s=mS(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),AS((0,Q.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Q.createElement(Q.Fragment,null,Q.createElement(ES,{id:r,value:i.draggable}),Q.createElement(DS,{id:s,announcement:o}));return n?(0,zi.createPortal)(u,n):u}var FS;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(FS||={});function IS(){}function LS(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function RS(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var zS=Object.freeze({x:0,y:0});function BS(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function VS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function HS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function US(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function WS(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function GS(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var KS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=GS(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=BS(GS(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(VS)},qS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=US(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=US(r),o=i.reduce((e,t,r)=>e+BS(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(VS)};function JS(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var YS=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=JS(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(HS)};function XS(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ZS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:zS}function QS(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var $S=QS(1);function eC(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function tC(e,t,n){let r=eC(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var nC={ignoreTransform:!1};function rC(e,t){t===void 0&&(t=nC);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=tS(e).getComputedStyle(e);t&&(n=tC(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function iC(e){return rC(e,{ignoreTransform:!0})}function aC(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function oC(e,t){return t===void 0&&(t=tS(e).getComputedStyle(e)),t.position===`fixed`}function sC(e,t){t===void 0&&(t=tS(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function cC(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(nS(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!rS(i)||iS(i)||n.includes(i))return n;let a=tS(e).getComputedStyle(i);return i!==e&&sC(i,a)&&n.push(i),oC(i,a)?n:r(i.parentNode)}return e?r(e):n}function lC(e){let[t]=cC(e,1);return t??null}function uC(e){return!Qx||!e?null:$x(e)?e:eS(e)?nS(e)||e===aS(e).scrollingElement?window:rS(e)?e:null:null}function dC(e){return $x(e)?e.scrollX:e.scrollLeft}function fC(e){return $x(e)?e.scrollY:e.scrollTop}function pC(e){return{x:dC(e),y:fC(e)}}var mC;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(mC||={});function hC(e){return!Qx||!e?!1:e===document.scrollingElement}function gC(e){let t={x:0,y:0},n=hC(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var _C={x:.2,y:.2};function vC(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=_C);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=gC(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=mC.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=mC.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=mC.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=mC.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function yC(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function bC(e){return e.reduce((e,t)=>gS(e,pC(t)),zS)}function xC(e){return e.reduce((e,t)=>e+dC(t),0)}function SC(e){return e.reduce((e,t)=>e+fC(t),0)}function CC(e,t){if(t===void 0&&(t=rC),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);lC(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var wC=[[`x`,[`left`,`right`],xC],[`y`,[`top`,`bottom`],SC]],TC=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=cC(t),r=bC(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of wC)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},EC=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function DC(e){let{EventTarget:t}=tS(e);return e instanceof t?e:aS(e)}function OC(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var kC;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(kC||={});function AC(e){e.preventDefault()}function jC(e){e.stopPropagation()}var MC;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(MC||={});var NC={start:[MC.Space,MC.Enter],cancel:[MC.Esc],end:[MC.Space,MC.Enter,MC.Tab]},PC=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case MC.Right:return{...n,x:n.x+25};case MC.Left:return{...n,x:n.x-25};case MC.Down:return{...n,y:n.y+25};case MC.Up:return{...n,y:n.y-25}}},FC=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new EC(aS(t)),this.windowListeners=new EC(tS(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(kC.Resize,this.handleCancel),this.windowListeners.add(kC.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(kC.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&CC(n),t(zS)}handleKeyDown(e){if(yS(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=NC,coordinateGetter:a=PC,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:zS;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=_S(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=gC(n),p=yC(n),m={x:Math.min(i===MC.Right?p.right-p.width/2:p.right,Math.max(i===MC.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===MC.Down?p.bottom-p.height/2:p.bottom,Math.max(i===MC.Down?p.top:p.top+p.height/2,u.y))},h=i===MC.Right&&!s||i===MC.Left&&!c,g=i===MC.Down&&!l||i===MC.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===MC.Right&&e<=d.x||i===MC.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===MC.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===MC.Down&&e<=d.y||i===MC.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===MC.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,gS(_S(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};FC.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=NC,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function IC(e){return!!(e&&`distance`in e)}function LC(e){return!!(e&&`delay`in e)}var RC=class{constructor(e,t,n){n===void 0&&(n=DC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=aS(i),this.documentListeners=new EC(this.document),this.listeners=new EC(n),this.windowListeners=new EC(tS(i)),this.initialCoordinates=xS(r)??zS,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(kC.Resize,this.handleCancel),this.windowListeners.add(kC.DragStart,AC),this.windowListeners.add(kC.VisibilityChange,this.handleCancel),this.windowListeners.add(kC.ContextMenu,AC),this.documentListeners.add(kC.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(LC(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(IC(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(kC.Click,jC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(kC.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=xS(e)??zS,s=_S(n,o);if(!t&&a){if(IC(a)){if(a.tolerance!=null&&OC(s,a.tolerance))return this.handleCancel();if(OC(s,a.distance))return this.handleStart()}if(LC(a)&&OC(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===MC.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},zC={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},BC=class extends RC{constructor(e){let{event:t}=e,n=aS(t.target);super(e,zC,n)}};BC.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var VC={move:{name:`mousemove`},end:{name:`mouseup`}},HC;(function(e){e[e.RightClick=2]=`RightClick`})(HC||={});var UC=class extends RC{constructor(e){super(e,VC,aS(e.event.target))}};UC.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===HC.RightClick?!1:(r?.({event:n}),!0)}}];var WC={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},GC=class extends RC{constructor(e){super(e,WC)}static setup(){return window.addEventListener(WC.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(WC.move.name,e)};function e(){}}};GC.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var KC;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(KC||={});var qC;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(qC||={});function JC(e){let{acceleration:t,activator:n=KC.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=qC.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=XC({delta:d,disabled:!a}),[m,h]=cS(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case KC.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case KC.DraggableRect:return i}},[n,i,c]),y=(0,Q.useRef)(null),b=(0,Q.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Q.useMemo)(()=>s===qC.TreeOrder?[...l].reverse():l,[s,l]);(0,Q.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=vC(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var YC={x:{[mC.Backward]:!1,[mC.Forward]:!1},y:{[mC.Backward]:!1,[mC.Forward]:!1}};function XC(e){let{delta:t,disabled:n}=e,r=fS(t);return uS(e=>{if(n||!r||!e)return YC;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[mC.Backward]:e.x[mC.Backward]||i.x===-1,[mC.Forward]:e.x[mC.Forward]||i.x===1},y:{[mC.Backward]:e.y[mC.Backward]||i.y===-1,[mC.Forward]:e.y[mC.Forward]||i.y===1}}},[n,t,r])}function ZC(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return uS(e=>t==null?null:r??e??null,[r,t])}function QC(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var $C;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})($C||={});var ew;(function(e){e.Optimized=`optimized`})(ew||={});var tw=new Map;function nw(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Q.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Q.useRef)(e),d=g(),f=lS(d),p=(0,Q.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Q.useRef)(null),h=uS(t=>{if(d&&!n)return tw;if(!t||t===tw||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new TC(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Q.useEffect)(()=>{u.current=e},[e]),(0,Q.useEffect)(()=>{d||p()},[n,d]),(0,Q.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Q.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case $C.Always:return!1;case $C.BeforeDragging:return n;default:return!n}}}function rw(e,t){return uS(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function iw(e,t){return rw(e,t)}function aw(e){let{callback:t,disabled:n}=e,r=sS(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function ow(e){let{callback:t,disabled:n}=e,r=sS(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function sw(e){return new TC(rC(e),e)}function cw(e,t,n){t===void 0&&(t=sw);let[r,i]=(0,Q.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=aw({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=ow({callback:a});return oS(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function lw(e){return ZS(e,rw(e))}var uw=[];function dw(e){let t=(0,Q.useRef)(e),n=uS(n=>e?n&&n!==uw&&e&&t.current&&e.parentNode===t.current.parentNode?n:cC(e):uw,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function fw(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=uC(e.target);t&&n(e=>e?(e.set(t,pC(t)),new Map(e)):null)},[]);return(0,Q.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=uC(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,pC(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{uC(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>gS(e,t),zS):bC(e):zS,[e,t])}function pw(e,t){t===void 0&&(t=[]);let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{n.current=null},t),(0,Q.useEffect)(()=>{let t=e!==zS;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?_S(e,n.current):zS}function mw(e){(0,Q.useEffect)(()=>{if(!Qx)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function hw(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function gw(e){return(0,Q.useMemo)(()=>e?aC(e):null,[e])}var _w=[];function vw(e,t){t===void 0&&(t=rC);let[n]=e,r=gw(n?tS(n):null),[i,a]=(0,Q.useState)(_w);function o(){a(()=>e.length?e.map(e=>hC(e)?r:new TC(t(e),e)):_w)}let s=ow({callback:o});return oS(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function yw(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return rS(t)?t:e}function bw(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=ow({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(rS(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=dS((0,Q.useCallback)(e=>{let n=yw(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Q.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var xw=[{sensor:BC,options:{}},{sensor:FC,options:{}}],Sw={current:{}},Cw={draggable:{measure:iC},droppable:{measure:iC,strategy:$C.WhileDragging,frequency:ew.Optimized},dragOverlay:{measure:rC}},ww=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Tw={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ww,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:IS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Cw,measureDroppableContainers:IS,windowRect:null,measuringScheduled:!1},Ew={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:IS,draggableNodes:new Map,over:null,measureDroppableContainers:IS},Dw=(0,Q.createContext)(Ew),Ow=(0,Q.createContext)(Tw);function kw(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ww}}}function Aw(e,t){switch(t.type){case FS.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case FS.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case FS.DragEnd:case FS.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case FS.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new ww(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case FS.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new ww(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case FS.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new ww(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function jw(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(Dw),a=fS(r),o=fS(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!yS(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=wS(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Mw(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Nw(e){return(0,Q.useMemo)(()=>({draggable:{...Cw.draggable,...e?.draggable},droppable:{...Cw.droppable,...e?.droppable},dragOverlay:{...Cw.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Pw(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Q.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;oS(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=ZS(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=lC(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Fw=(0,Q.createContext)({...zS,scaleX:1,scaleY:1}),Iw;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Iw||={});var Lw=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=xw,collisionDetection:o=YS,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(Aw,void 0,kw),[f,p]=jS(),[m,h]=(0,Q.useState)(Iw.Uninitialized),g=m===Iw.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Q.useRef)({initial:null,translated:null}),C=(0,Q.useMemo)(()=>_==null?null:{id:_,data:x?.data??Sw,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=lS(l,Object.values(l)),A=mS(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=Nw(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=nw(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=ZC(v,_),L=(0,Q.useMemo)(()=>D?xS(D):null,[D]),R=xe(),z=iw(I,M.draggable.measure);Pw({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:M.draggable.measure});let B=cw(I,M.draggable.measure,z),V=cw(I?I.parentElement:null),H=(0,Q.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),U=b.getNodeFor(H.current.over?.id),W=bw({measure:M.dragOverlay.measure}),G=W.nodeRef.current??I,K=g?W.rect??B:null,ee=!!(W.nodeRef.current&&W.rect),q=lw(ee?null:B),te=gw(G?tS(G):null),ne=dw(g?U??I:null),re=vw(ne),ie=Mw(c,{transform:{x:y.x-q.x,y:y.y-q.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:B,containerNodeRect:V,draggingNodeRect:K,over:H.current.over,overlayNodeRect:W.rect,scrollableAncestors:ne,scrollableAncestorRects:re,windowRect:te}),ae=L?gS(L,y):null,oe=fw(ne),se=pw(oe),ce=pw(oe,[B]),le=gS(ie,se),ue=K?$S(K,ie):null,de=C&&ue?o({active:C,collisionRect:ue,droppableRects:N,droppableContainers:j,pointerCoordinates:ae}):null,fe=WS(de,`id`),[pe,me]=(0,Q.useState)(null),he=XS(ee?ie:gS(ie,ce),pe?.rect??null,B),ge=(0,Q.useRef)(null),_e=(0,Q.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ge.current=new n({active:w.current,activeNode:i,event:a,options:r,context:H,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,zi.unstable_batchedUpdates)(()=>{r?.(i),h(Iw.Initializing),d({type:FS.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ge.current),O(a)})},onMove(e){d({type:FS.DragMove,coordinates:e})},onEnd:o(FS.DragEnd),onCancel:o(FS.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=H.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===FS.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=FS.DragCancel)}w.current=null,(0,zi.unstable_batchedUpdates)(()=>{d({type:e}),h(Iw.Uninitialized),me(null),E(null),O(null),ge.current=null;let t=e===FS.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ve=QC(a,(0,Q.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,_e(n,t))},[v,_e]));mw(a),oS(()=>{B&&m===Iw.Initializing&&h(Iw.Initialized)},[B,m]),(0,Q.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=H.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:le.x,y:le.y},over:i};(0,zi.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[le.x,le.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=H.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(fe),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,zi.unstable_batchedUpdates)(()=>{me(s),a?.(c),f({type:`onDragOver`,event:c})})},[fe]),oS(()=>{H.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ue,collisions:de,droppableRects:N,draggableNodes:v,draggingNode:G,draggingNodeRect:K,droppableContainers:b,over:pe,scrollableAncestors:ne,scrollAdjustedTranslate:le},S.current={initial:K,translated:ue}},[C,I,de,ue,v,G,K,N,b,pe,ne,le]),JC({...R,delta:y,draggingRect:ue,pointerCoordinates:ae,scrollableAncestors:ne,scrollableAncestorRects:re});let ye=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:B,activatorEvent:D,collisions:de,containerNodeRect:V,dragOverlay:W,draggableNodes:v,droppableContainers:b,droppableRects:N,over:pe,measureDroppableContainers:P,scrollableAncestors:ne,scrollableAncestorRects:re,measuringConfiguration:M,measuringScheduled:F,windowRect:te}),[C,I,B,D,de,V,W,v,b,N,pe,P,ne,re,M,F,te]),be=(0,Q.useMemo)(()=>({activatorEvent:D,activators:ve,active:C,activeNodeRect:B,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:pe,measureDroppableContainers:P}),[D,ve,C,B,d,A,v,pe,P]);return Q.createElement(kS.Provider,{value:p},Q.createElement(Dw.Provider,{value:be},Q.createElement(Ow.Provider,{value:ye},Q.createElement(Fw.Provider,{value:he},i)),Q.createElement(jw,{disabled:n?.restoreFocus===!1})),Q.createElement(PS,{...n,hiddenTextDescribedById:A}));function xe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Rw=(0,Q.createContext)(null),zw=`button`,Bw=`Draggable`;function Vw(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=mS(Bw),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(Dw),{role:p=zw,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?Fw:Rw),[v,y]=dS(),[b,x]=dS(),S=hw(o,t),C=lS(n);return oS(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Q.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===zw?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Hw(){return(0,Q.useContext)(Ow)}var Uw=`Droppable`,Ww={timeout:25};function Gw(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=mS(Uw),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(Dw),u=(0,Q.useRef)({disabled:n}),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Ww,...i},_=lS(h??r),v=ow({callback:(0,Q.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=dS((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=lS(t);return(0,Q.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:FS.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:FS.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:FS.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Kw(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function qw(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Jw(e){return e!==null&&e>=0}function Yw(e,t){if(e===t)return!0;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 Xw(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Zw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Kw(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Qw={scaleX:1,scaleY:1},$w=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Qw}:null}let s=eT(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Qw}:r<t&&r>=a?{x:0,y:o.height+s,...Qw}:{x:0,y:0,...Qw}};function eT(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var tT=`Sortable`,nT=Q.createContext({activeIndex:-1,containerId:tT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Zw,disabled:{draggable:!1,droppable:!1}});function rT(e){let{children:t,id:n,items:r,strategy:i=Zw,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Hw(),d=mS(tT,n),f=s.rect!==null,p=(0,Q.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Q.useRef)(p),v=!Yw(p,_.current),y=g!==-1&&h===-1||v,b=Xw(a);oS(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Q.useEffect)(()=>{_.current=p},[p]);let x=(0,Q.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:qw(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(nT.Provider,{value:x},t)}var iT=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Kw(n,r,i).indexOf(t)},aT=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},oT={duration:200,easing:`ease`},sT=`transform`,cT=SS.Transition.toString({property:sT,duration:0,easing:`linear`}),lT={roleDescription:`sortable`};function uT(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return oS(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=rC(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Q.useEffect)(()=>{a&&o(null)},[a]),a}function dT(e){let{animateLayoutChanges:t=aT,attributes:n,disabled:r,data:i,getNewIndex:a=iT,id:o,strategy:s,resizeObserverConfig:c,transition:l=oT}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(nT),y=fT(r,p),b=u.indexOf(o),x=(0,Q.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Q.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=Gw({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=Vw({id:o,data:x,attributes:{...lT,...n},disabled:y.draggable}),L=Zx(E,j),R=!!D,z=R&&!m&&Jw(f)&&Jw(g),B=!_&&N,V=z?(B&&z?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,H=Jw(f)&&Jw(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,U=D?.id,W=(0,Q.useRef)({activeId:U,items:u,newIndex:H,containerId:d}),G=u!==W.current.items,K=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:l,wasDragging:W.current.activeId!=null}),ee=uT({disabled:!K,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{R&&W.current.newIndex!==H&&(W.current.newIndex=H),d!==W.current.containerId&&(W.current.containerId=d),u!==W.current.items&&(W.current.items=u)},[R,H,d,u]),(0,Q.useEffect)(()=>{if(U===W.current.activeId)return;if(U!=null&&W.current.activeId==null){W.current.activeId=U;return}let e=setTimeout(()=>{W.current.activeId=U},50);return()=>clearTimeout(e)},[U]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:H,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ee??V,transition:q()};function q(){if(ee||G&&W.current.newIndex===b)return cT;if(!(B&&!yS(O)||!l)&&(R||K))return SS.Transition.toString({...l,property:sT})}}function fT(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function pT(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var mT=[MC.Down,MC.Right,MC.Up,MC.Left],hT=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(mT.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case MC.Down:r.top<a.top&&t.push(n);break;case MC.Up:r.top>a.top&&t.push(n);break;case MC.Left:r.left>a.left&&t.push(n);break;case MC.Right:r.left<a.left&&t.push(n);break}});let c=qS({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=WS(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=cC(c).some((e,t)=>s[t]!==e),i=gT(e,t),a=_T(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:_S(u,l)}}}};function gT(e,t){return!pT(e)||!pT(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function _T(e,t){return!pT(e)||!pT(t)||!gT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var vT=365.2425,yT=6048e5,bT=864e5,xT=6e4,ST=36e5,CT=1e3,wT=3600*24;wT*7,wT*vT/12*3;var TT=Symbol.for(`constructDateFrom`);function ET(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&TT in e?e[TT](t):e instanceof Date?new e.constructor(t):new Date(t)}function DT(e,t){return ET(t||e,e)}function OT(e,t,n){let r=DT(e,n?.in);return isNaN(t)?ET(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function kT(e,t,n){let r=DT(e,n?.in);if(isNaN(t))return ET(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=ET(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 AT={};function jT(){return AT}function MT(e,t){let n=jT(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=DT(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 NT(e,t){return MT(e,{...t,weekStartsOn:1})}function PT(e,t){let n=DT(e,t?.in),r=n.getFullYear(),i=ET(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=NT(i),o=ET(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=NT(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function FT(e){let t=DT(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 IT(e,...t){let n=ET.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function LT(e,t){let n=DT(e,t?.in);return n.setHours(0,0,0,0),n}function RT(e,t,n){let[r,i]=IT(n?.in,e,t),a=LT(r),o=LT(i),s=+a-FT(a),c=+o-FT(o);return Math.round((s-c)/bT)}function zT(e,t){let n=PT(e,t),r=ET(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),NT(r)}function BT(e,t,n){return OT(e,t*7,n)}function VT(e,t,n){return kT(e,t*12,n)}function HT(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=ET.bind(null,e));let t=DT(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),ET(r,n||NaN)}function UT(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=ET.bind(null,e));let t=DT(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),ET(r,n||NaN)}function WT(e,t,n){let[r,i]=IT(n?.in,e,t);return+LT(r)==+LT(i)}function GT(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function KT(e){return!(!GT(e)&&typeof e!=`number`||isNaN(+DT(e)))}function qT(e,t,n){let[r,i]=IT(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function JT(e,t){let n=DT(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function YT(e,t){let[n,r]=IT(e,t.start,t.end);return{start:n,end:r}}function XT(e,t){let{start:n,end:r}=YT(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(ET(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function ZT(e,t){let n=DT(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function QT(e,t){let n=DT(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function $T(e,t){let n=DT(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function eE(e,t){let{start:n,end:r}=YT(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(ET(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function tE(e,t){let n=jT(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=DT(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 nE(e,t){return tE(e,{...t,weekStartsOn:1})}var rE={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`}},iE=(e,t,n)=>{let r,i=rE[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 aE(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var oE={date:aE({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:aE({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:aE({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},sE={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},cE=(e,t,n,r)=>sE[e];function lE(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 uE={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:lE({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:lE({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:lE({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:lE({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:lE({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 dE(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)?pE(s,e=>e.test(o)):fE(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 fE(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function pE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function mE(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 hE={code:`en-US`,formatDistance:iE,formatLong:oE,formatRelative:cE,localize:uE,match:{ordinalNumber:mE({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:dE({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:dE({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:dE({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:dE({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:dE({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 gE(e,t){let n=DT(e,t?.in);return RT(n,$T(n))+1}function _E(e,t){let n=DT(e,t?.in),r=NT(n)-+zT(n);return Math.round(r/yT)+1}function vE(e,t){let n=DT(e,t?.in),r=n.getFullYear(),i=jT(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=ET(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=MT(o,t),c=ET(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=MT(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function yE(e,t){let n=jT(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vE(e,t),a=ET(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),MT(a,t)}function bE(e,t){let n=DT(e,t?.in),r=MT(n,t)-+yE(n,t);return Math.round(r/yT)+1}function xE(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var SE={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return xE(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):xE(n+1,2)},d(e,t){return xE(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 xE(e.getHours()%12||12,t.length)},H(e,t){return xE(e.getHours(),t.length)},m(e,t){return xE(e.getMinutes(),t.length)},s(e,t){return xE(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return xE(Math.trunc(r*10**(n-3)),t.length)}},CE={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wE={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 SE.y(e,t)},Y:function(e,t,n,r){let i=vE(e,r),a=i>0?i:1-i;return t===`YY`?xE(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):xE(a,t.length)},R:function(e,t){return xE(PT(e),t.length)},u:function(e,t){return xE(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 xE(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 xE(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 SE.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 xE(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=bE(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):xE(i,t.length)},I:function(e,t,n){let r=_E(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):xE(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):SE.d(e,t)},D:function(e,t,n){let r=gE(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):xE(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 xE(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 xE(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 xE(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?CE.noon:r===0?CE.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?CE.evening:r>=12?CE.afternoon:r>=4?CE.morning:CE.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 SE.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):SE.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):xE(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):xE(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):SE.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):SE.s(e,t)},S:function(e,t){return SE.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return EE(r);case`XXXX`:case`XX`:return DE(r);default:return DE(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return EE(r);case`xxxx`:case`xx`:return DE(r);default:return DE(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+TE(r,`:`);default:return`GMT`+DE(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+TE(r,`:`);default:return`GMT`+DE(r,`:`)}},t:function(e,t,n){return xE(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return xE(+e,t.length)}};function TE(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+xE(a,2)}function EE(e,t){return e%60==0?(e>0?`-`:`+`)+xE(Math.abs(e)/60,2):DE(e,t)}function DE(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=xE(Math.trunc(r/60),2),a=xE(r%60,2);return n+i+t+a}var OE=(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`})}},kE=(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`})}},AE={p:kE,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return OE(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}}`,OE(r,t)).replace(`{{time}}`,kE(i,t))}},jE=/^D+$/,ME=/^Y+$/,NE=[`D`,`DD`,`YY`,`YYYY`];function PE(e){return jE.test(e)}function FE(e){return ME.test(e)}function IE(e,t,n){let r=LE(e,t,n);if(console.warn(r),NE.includes(e))throw RangeError(r)}function LE(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 RE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,BE=/^'([^]*?)'?$/,VE=/''/g,HE=/[a-zA-Z]/;function UE(e,t,n){let r=jT(),i=n?.locale??r.locale??hE,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=DT(e,n?.in);if(!KT(s))throw RangeError(`Invalid time value`);let c=t.match(zE).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=AE[t];return n(e,i.formatLong)}return e}).join(``).match(RE).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:WE(e)};if(wE[t])return{isToken:!0,value:e};if(t.match(HE))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&&FE(a)||!n?.useAdditionalDayOfYearTokens&&PE(a))&&IE(a,t,String(e));let o=wE[a[0]];return o(s,a,i.localize,l)}).join(``)}function WE(e){let t=e.match(BE);return t?t[1].replace(VE,`'`):e}function GE(e,t){let n=DT(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=ET(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function KE(){return Object.assign({},jT())}function qE(e,t){let n=DT(e,t?.in).getDay();return n===0?7:n}function JE(e,t){return DT(e,t?.in).getMonth()}function YE(e,t){return DT(e,t?.in).getFullYear()}function XE(e,t){return+DT(e)>+DT(t)}function ZE(e,t){return+DT(e)<+DT(t)}function QE(e,t){let n=$E(t)?new t(0):ET(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function $E(e){return typeof e==`function`&&e.prototype?.constructor===e}var eD=10,tD=class{subPriority=0;validate(e,t){return!0}},nD=class extends tD{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)}},rD=class extends tD{priority=eD;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>ET(t,e))}set(e,t){return t.timestampIsSet?e:ET(e,QE(e,this.context))}},iD=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new nD(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},aD=class extends iD{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`]},oD={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}/},sD={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 cD(e,t){return e&&{value:t(e.value),rest:e.rest}}function lD(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function uD(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*ST+a*xT+o*CT),rest:t.slice(n[0].length)}}function dD(e){return lD(oD.anyDigitsSigned,e)}function fD(e,t){switch(e){case 1:return lD(oD.singleDigit,t);case 2:return lD(oD.twoDigits,t);case 3:return lD(oD.threeDigits,t);case 4:return lD(oD.fourDigits,t);default:return lD(RegExp(`^\\d{1,`+e+`}`),t)}}function pD(e,t){switch(e){case 1:return lD(oD.singleDigitSigned,t);case 2:return lD(oD.twoDigitsSigned,t);case 3:return lD(oD.threeDigitsSigned,t);case 4:return lD(oD.fourDigitsSigned,t);default:return lD(RegExp(`^-?\\d{1,`+e+`}`),t)}}function mD(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function hD(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 gD(e){return e%400==0||e%4==0&&e%100!=0}var _D=class extends iD{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 cD(fD(4,e),r);case`yo`:return cD(n.ordinalNumber(e,{unit:`year`}),r);default:return cD(fD(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=hD(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}},vD=class extends iD{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return cD(fD(4,e),r);case`Yo`:return cD(n.ordinalNumber(e,{unit:`year`}),r);default:return cD(fD(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=vE(e,r);if(n.isTwoDigitYear){let t=hD(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),MT(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),MT(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},yD=class extends iD{priority=130;parse(e,t){return pD(t===`R`?4:t.length,e)}set(e,t,n){let r=ET(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),NT(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},bD=class extends iD{priority=130;parse(e,t){return pD(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`]},xD=class extends iD{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return fD(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`]},SD=class extends iD{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return fD(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`]},CD=class extends iD{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 cD(lD(oD.month,e),r);case`MM`:return cD(fD(2,e),r);case`Mo`:return cD(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}},wD=class extends iD{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return cD(lD(oD.month,e),r);case`LL`:return cD(fD(2,e),r);case`Lo`:return cD(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 TD(e,t,n){let r=DT(e,n?.in),i=bE(r,n)-t;return r.setDate(r.getDate()-i*7),DT(r,n?.in)}var ED=class extends iD{priority=100;parse(e,t,n){switch(t){case`w`:return lD(oD.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return fD(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return MT(TD(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function DD(e,t,n){let r=DT(e,n?.in),i=_E(r,n)-t;return r.setDate(r.getDate()-i*7),r}var OD=class extends iD{priority=100;parse(e,t,n){switch(t){case`I`:return lD(oD.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return fD(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return NT(DD(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},kD=[31,28,31,30,31,30,31,31,30,31,30,31],AD=[31,29,31,30,31,30,31,31,30,31,30,31],jD=class extends iD{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return lD(oD.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return fD(t.length,e)}}validate(e,t){let n=gD(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=AD[r]:t>=1&&t<=kD[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`]},MD=class extends iD{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return lD(oD.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return fD(t.length,e)}}validate(e,t){return gD(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 ND(e,t,n){let r=jT(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=DT(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return OT(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var PD=class extends iD{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=ND(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},FD=class extends iD{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 cD(fD(t.length,e),i);case`eo`:return cD(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=ND(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`]},ID=class extends iD{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 cD(fD(t.length,e),i);case`co`:return cD(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=ND(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 LD(e,t,n){let r=DT(e,n?.in);return OT(r,t-qE(r,n),n)}var RD=class extends iD{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return fD(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return cD(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 cD(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return cD(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return cD(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=LD(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`]},zD=class extends iD{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(mD(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},BD=class extends iD{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(mD(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},VD=class extends iD{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(mD(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},HD=class extends iD{priority=70;parse(e,t,n){switch(t){case`h`:return lD(oD.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return fD(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`]},UD=class extends iD{priority=70;parse(e,t,n){switch(t){case`H`:return lD(oD.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return fD(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`]},WD=class extends iD{priority=70;parse(e,t,n){switch(t){case`K`:return lD(oD.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return fD(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`]},GD=class extends iD{priority=70;parse(e,t,n){switch(t){case`k`:return lD(oD.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return fD(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`]},KD=class extends iD{priority=60;parse(e,t,n){switch(t){case`m`:return lD(oD.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return fD(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`]},qD=class extends iD{priority=50;parse(e,t,n){switch(t){case`s`:return lD(oD.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return fD(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},JD=class extends iD{priority=30;parse(e,t){return cD(fD(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},YD=class extends iD{priority=10;parse(e,t){switch(t){case`X`:return uD(sD.basicOptionalMinutes,e);case`XX`:return uD(sD.basic,e);case`XXXX`:return uD(sD.basicOptionalSeconds,e);case`XXXXX`:return uD(sD.extendedOptionalSeconds,e);default:return uD(sD.extended,e)}}set(e,t,n){return t.timestampIsSet?e:ET(e,e.getTime()-FT(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},XD=class extends iD{priority=10;parse(e,t){switch(t){case`x`:return uD(sD.basicOptionalMinutes,e);case`xx`:return uD(sD.basic,e);case`xxxx`:return uD(sD.basicOptionalSeconds,e);case`xxxxx`:return uD(sD.extendedOptionalSeconds,e);default:return uD(sD.extended,e)}}set(e,t,n){return t.timestampIsSet?e:ET(e,e.getTime()-FT(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},ZD=class extends iD{priority=40;parse(e){return dD(e)}set(e,t,n){return[ET(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},QD=class extends iD{priority=20;parse(e){return dD(e)}set(e,t,n){return[ET(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},$D={G:new aD,y:new _D,Y:new vD,R:new yD,u:new bD,Q:new xD,q:new SD,M:new CD,L:new wD,w:new ED,I:new OD,d:new jD,D:new MD,E:new PD,e:new FD,c:new ID,i:new RD,a:new zD,b:new BD,B:new VD,h:new HD,H:new UD,K:new WD,k:new GD,m:new KD,s:new qD,S:new JD,X:new YD,x:new XD,t:new ZD,T:new QD},eO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tO=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,nO=/^'([^]*?)'?$/,rO=/''/g,iO=/\S/,aO=/[a-zA-Z]/;function oO(e,t,n,r){let i=()=>ET(r?.in||n,NaN),a=KE(),o=r?.locale??a.locale??hE,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():DT(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new rD(r?.in,n)],d=t.match(tO).map(e=>{let t=e[0];if(t in AE){let n=AE[t];return n(e,o.formatLong)}return e}).join(``).match(eO),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&FE(n)&&IE(n,t,e),!r?.useAdditionalDayOfYearTokens&&PE(n)&&IE(n,t,e);let a=n[0],s=$D[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(aO))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=sO(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&iO.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=DT(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 sO(e){return e.match(nO)[1].replace(rO,`'`)}function cO(e,t,n){let[r,i]=IT(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function lO(e,t,n){let[r,i]=IT(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function uO(e,t){let n=()=>ET(t?.in,NaN),r=t?.additionalDigits??2,i=hO(e),a;if(i.date){let e=gO(i.date,r);a=_O(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=yO(i.time),isNaN(s)))return n();if(i.timezone){if(c=xO(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=DT(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return DT(o+s+c,t?.in)}var dO={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},fO=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,pO=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,mO=/^([+-])(\d{2})(?::?(\d{2}))?$/;function hO(e){let t={},n=e.split(dO.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],dO.timeZoneDelimiter.test(t.date)&&(t.date=e.split(dO.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=dO.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function gO(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 _O(e,t){if(t===null)return new Date(NaN);let n=e.match(fO);if(!n)return new Date(NaN);let r=!!n[4],i=vO(n[1]),a=vO(n[2])-1,o=vO(n[3]),s=vO(n[4]),c=vO(n[5])-1;if(r)return DO(t,s,c)?SO(t,s,c):new Date(NaN);{let e=new Date(0);return!TO(t,a,o)||!EO(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function vO(e){return e?parseInt(e):1}function yO(e){let t=e.match(pO);if(!t)return NaN;let n=bO(t[1]),r=bO(t[2]),i=bO(t[3]);return OO(n,r,i)?n*ST+r*xT+i*1e3:NaN}function bO(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function xO(e){if(e===`Z`)return 0;let t=e.match(mO);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return kO(r,i)?n*(r*ST+i*xT):NaN}function SO(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 CO=[31,null,31,30,31,30,31,31,30,31,30,31];function wO(e){return e%400==0||e%4==0&&e%100!=0}function TO(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(CO[t]||(wO(e)?29:28))}function EO(e,t){return t>=1&&t<=(wO(e)?366:365)}function DO(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function OO(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function kO(e,t){return t>=0&&t<=59}function AO(e,t,n){let r=DT(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=ET(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=GE(o);return r.setMonth(t,Math.min(a,s)),r}function jO(e,t,n){let r=DT(e,n?.in);return isNaN(+r)?ET(n?.in||e,NaN):(r.setFullYear(t),r)}function MO(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 NO={},PO={};function FO(e,t){try{let n=(NO[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in PO?PO[n]:LO(n,n.split(`:`))}catch{if(e in PO)return PO[e];let t=e?.match(IO);return t?LO(e,t.slice(1)):NaN}}var IO=/([+-]\d\d):?(\d\d)?/;function LO(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return PO[e]=n*60+r>0?n*60+r+i:n*60-r-i}var RO=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(FO(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)),HO(this,NaN),BO(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=-FO(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),BO(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},zO=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!zO.test(e))return;let t=e.replace(zO,`$1UTC`);RO.prototype[t]&&(e.startsWith(`get`)?RO.prototype[e]=function(){return this.internal[t]()}:(RO.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),VO(this),+this},RO.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),BO(this),+this}))});function BO(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-FO(e.timeZone,e)*60))}function VO(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()),HO(e)}function HO(e){let t=FO(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(-(FO(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=FO(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=FO(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 UO=class e extends RO{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} (${MO(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)}},WO=5,GO=4;function KO(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,WO*7-1);return t.getMonth(e)===t.getMonth(a)?WO:GO}function qO(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 JO(e,t){let n=qO(e,t),r=KO(e,t);return t.addDays(n,r*7-1)}var YO={...hE,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>UE(e,t,{locale:hE,...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)=>UE(e,n,{locale:hE,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>UE(e,t,{locale:hE,...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)=>UE(e,n,{locale:hE,...t}),r(e,`cccc`)}}},XO=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?UO.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 UO(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):OT(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):kT(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):BT(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):VT(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):RT(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):qT(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):XT(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):eE(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):JO(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):nE(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):JT(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):tE(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):QT(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):UE(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):_E(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):JE(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):YE(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):bE(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):XE(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):ZE(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):GT(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):WT(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):cO(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):lO(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):HT(e),this.min=e=>this.overrides?.min?this.overrides.min(e):UT(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):AO(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):jO(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):qO(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):LT(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):NT(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):ZT(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):MT(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):$T(e),this.options={locale:YO,...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)}};XO.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 ZO=new XO,QO=class{constructor(e,t,n=ZO){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)}},$O=class{constructor(e,t){this.date=e,this.weeks=t}},ek=class{constructor(e,t){this.days=t,this.weekNumber=e}};function tk(e){return Q.createElement(`button`,{...e})}function nk(e){return Q.createElement(`span`,{...e})}function rk(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 ik(e){let{day:t,modifiers:n,...r}=e;return Q.createElement(`td`,{...r})}function ak(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 ok;(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`})(ok||={});var sk;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(sk||={});var ck;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(ck||={});var lk;(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`})(lk||={});function uk(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[ok.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return Q.createElement(`span`,{"data-disabled":a.disabled,className:i[ok.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[ok.CaptionLabel],"aria-hidden":!0},s?.label,Q.createElement(r.Chevron,{orientation:`down`,size:18,className:i[ok.Chevron]})))}function dk(e){return Q.createElement(`div`,{...e})}function fk(e){return Q.createElement(`div`,{...e})}function pk(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r},e.children)}function mk(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r})}function hk(e){return Q.createElement(`table`,{...e})}function gk(e){return Q.createElement(`div`,{...e})}var _k=(0,Q.createContext)(void 0);function vk(){let e=(0,Q.useContext)(_k);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function yk(e){let{components:t}=vk();return Q.createElement(t.Dropdown,{...e})}function bk(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=vk(),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[ok.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[ok.Chevron],orientation:`left`})),Q.createElement(o.NextMonthButton,{type:`button`,className:s[ok.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[ok.Chevron]})))}function xk(e){let{components:t}=vk();return Q.createElement(t.Button,{...e})}function Sk(e){return Q.createElement(`option`,{...e})}function Ck(e){let{components:t}=vk();return Q.createElement(t.Button,{...e})}function wk(e){let{rootRef:t,...n}=e;return Q.createElement(`div`,{...n,ref:t})}function Tk(e){return Q.createElement(`select`,{...e})}function Ek(e){let{week:t,...n}=e;return Q.createElement(`tr`,{...n})}function Dk(e){return Q.createElement(`th`,{...e})}function Ok(e){return Q.createElement(`thead`,{"aria-hidden":!0},Q.createElement(`tr`,{...e}))}function kk(e){let{week:t,...n}=e;return Q.createElement(`th`,{...n})}function Ak(e){return Q.createElement(`th`,{...e})}function jk(e){return Q.createElement(`tbody`,{...e})}function Mk(e){let{components:t}=vk();return Q.createElement(t.Dropdown,{...e})}var Nk=e({Button:()=>tk,CaptionLabel:()=>nk,Chevron:()=>rk,Day:()=>ik,DayButton:()=>ak,Dropdown:()=>uk,DropdownNav:()=>dk,Footer:()=>fk,Month:()=>pk,MonthCaption:()=>mk,MonthGrid:()=>hk,Months:()=>gk,MonthsDropdown:()=>yk,Nav:()=>bk,NextMonthButton:()=>xk,Option:()=>Sk,PreviousMonthButton:()=>Ck,Root:()=>wk,Select:()=>Tk,Week:()=>Ek,WeekNumber:()=>kk,WeekNumberHeader:()=>Ak,Weekday:()=>Dk,Weekdays:()=>Ok,Weeks:()=>jk,YearsDropdown:()=>Mk});function Pk(e,t,n=!1,r=ZO){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 Fk(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Ik(e){return!!(e&&typeof e==`object`&&`from`in e)}function Lk(e){return!!(e&&typeof e==`object`&&`after`in e)}function Rk(e){return!!(e&&typeof e==`object`&&`before`in e)}function zk(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Bk(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Vk(e,t,n=ZO){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(Bk(t,n))return t.some(t=>i(e,t));if(Ik(t))return Pk(t,e,!1,n);if(zk(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Fk(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 Lk(t)?a(e,t.after)>0:Rk(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function Hk(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={[sk.focused]:[],[sk.outside]:[],[sk.disabled]:[],[sk.hidden]:[],[sk.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&&Vk(e,a,i)),S=!!(o&&Vk(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&&Vk(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[sk.focused]:!1,[sk.disabled]:!1,[sk.hidden]:!1,[sk.outside]:!1,[sk.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 Uk(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[sk[r]]?e.push(t[sk[r]]):t[ck[r]]&&e.push(t[ck[r]]),e),[t[ok.Day]])}function Wk(e){return{...Nk,...e}}function Gk(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 Kk(){let e={};for(let t in ok)e[ok[t]]=`rdp-${ok[t]}`;for(let t in sk)e[sk[t]]=`rdp-${sk[t]}`;for(let t in ck)e[ck[t]]=`rdp-${ck[t]}`;for(let t in lk)e[lk[t]]=`rdp-${lk[t]}`;return e}function qk(e,t,n){return(n??new XO(t)).formatMonthYear(e)}var Jk=qk;function Yk(e,t,n){return(n??new XO(t)).format(e,`d`)}function Xk(e,t=ZO){return t.format(e,`LLLL`)}function Zk(e,t,n){return(n??new XO(t)).format(e,`cccccc`)}function Qk(e,t=ZO){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function $k(){return``}function eA(e,t=ZO){return t.format(e,`yyyy`)}var tA=eA,nA=e({formatCaption:()=>qk,formatDay:()=>Yk,formatMonthCaption:()=>Jk,formatMonthDropdown:()=>Xk,formatWeekNumber:()=>Qk,formatWeekNumberHeader:()=>$k,formatWeekdayName:()=>Zk,formatYearCaption:()=>tA,formatYearDropdown:()=>eA});function rA(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...nA,...e}}function iA(e,t,n,r){let i=(r??new XO(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var aA=iA;function oA(e,t,n){return(n??new XO(t)).formatMonthYear(e)}var sA=oA;function cA(e,t,n,r){let i=(r??new XO(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function lA(e){return`Choose the Month`}function uA(){return``}var dA=`Go to the Next Month`;function fA(e,t){return dA}function pA(e){return`Go to the Previous Month`}function mA(e,t,n){return(n??new XO(t)).format(e,`cccc`)}function hA(e,t){return`Week ${e}`}function gA(e){return`Week Number`}function _A(e){return`Choose the Year`}var vA=e({labelCaption:()=>sA,labelDay:()=>aA,labelDayButton:()=>iA,labelGrid:()=>oA,labelGridcell:()=>cA,labelMonthDropdown:()=>lA,labelNav:()=>uA,labelNext:()=>fA,labelPrevious:()=>pA,labelWeekNumber:()=>hA,labelWeekNumberHeader:()=>gA,labelWeekday:()=>mA,labelYearDropdown:()=>_A}),yA=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function bA(e,t){let n=t.locale?.labels??{};return{...vA,...e??{},labelDayButton:yA(iA,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:yA(lA,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:yA(fA,e?.labelNext,n.labelNext),labelPrevious:yA(pA,e?.labelPrevious,n.labelPrevious),labelWeekNumber:yA(hA,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:yA(_A,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:yA(oA,e?.labelGrid,n.labelGrid),labelGridcell:yA(cA,e?.labelGridcell,n.labelGridcell),labelNav:yA(uA,e?.labelNav,n.labelNav),labelWeekNumberHeader:yA(gA,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:yA(mA,e?.labelWeekday,n.labelWeekday)}}function xA(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 SA(e,t={},n={}){let r={...t?.[ok.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function CA(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 wA(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 TA(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 UO(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(UO.tz(e)),newDate:(t,n,r)=>new UO(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 UO(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 UO(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 UO(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new UO(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>bE(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>_E(o(e)),differenceInCalendarDays:(e,t)=>RT(o(e),o(t)),differenceInCalendarMonths:(e,t)=>qT(o(e),o(t))}}var EA=e=>e instanceof HTMLElement?e:null,DA=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],OA=e=>EA(e.querySelector(`[data-animated-month]`)),kA=e=>EA(e.querySelector(`[data-animated-caption]`)),AA=e=>EA(e.querySelector(`[data-animated-weeks]`)),jA=e=>EA(e.querySelector(`[data-animated-nav]`)),MA=e=>EA(e.querySelector(`[data-animated-weekdays]`));function NA(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[lk.caption_after_enter]:n[lk.caption_before_enter],p=d?n[lk.weeks_after_enter]:n[lk.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(DA(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=OA(e);t&&e.contains(t)&&e.removeChild(t);let n=kA(e);n&&n.classList.remove(f);let r=AA(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?DA(m):[],_=DA(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=jA(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=kA(i);s&&s.classList.add(f);let l=AA(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=MA(o);m&&(m.style.opacity=`0`);let h=kA(o);h&&(h.classList.add(d?n[lk.caption_before_exit]:n[lk.caption_after_exit]),h.addEventListener(`animationend`,u));let _=AA(o);_&&_.classList.add(d?n[lk.weeks_before_exit]:n[lk.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function PA(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 FA(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 IA(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 LA(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 RA(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 $O(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new QO(t,m,r);return a?a.days.push(o):e.push(new ek(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function zA(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 BA(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 VA(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 HA(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function UA(e,t){let[n,r]=(0,Q.useState)(e);return[t===void 0?n:t,r]}function WA(e,t){let[n,r]=zA(e,t),{startOfMonth:i,endOfMonth:a}=t,o=LA(e,n,r,t),[s,c]=UA(o,e.month?o:void 0);(0,Q.useEffect)(()=>{c(LA(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,Q.useMemo)(()=>{let i=IA(s,r,{numberOfMonths:e.numberOfMonths},t),o=RA(i,PA(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:HA(o),days:FA(o),previousMonth:VA(s,n,e,t),nextMonth:BA(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 GA;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(GA||={});function KA(e){return!e[sk.disabled]&&!e[sk.hidden]&&!e[sk.outside]}function qA(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);KA(e)&&(e[sk.focused]&&a<GA.FocusedModifier?(i=o,a=GA.FocusedModifier):r?.isEqualTo(o)&&a<GA.LastFocused?(i=o,a=GA.LastFocused):n(o.date)&&a<GA.Selected?(i=o,a=GA.Selected):e[sk.today]&&a<GA.Today&&(i=o,a=GA.Today))}return i||=e.find(e=>KA(t(e))),i}function JA(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 YA(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=JA(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Vk(c,a.disabled,o)),u=!!(a.hidden&&Vk(c,a.hidden,o)),d=new QO(c,c,o);return!l&&!u?d:YA(e,t,d,r,i,a,o,s+1)}function XA(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,Q.useState)(),c=qA(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=YA(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 ZA(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=UA(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 QA(e,t,n=0,r=0,i=!1,a=ZO){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 $A(e,t,n=ZO){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 ej(e,t,n=ZO){return Pk(e,t.from,!1,n)||Pk(e,t.to,!1,n)||Pk(t,e.from,!1,n)||Pk(t,e.to,!1,n)}function tj(e,t,n=ZO){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Pk(e,t,!1,n):Bk(t,n)?t.some(t=>Pk(e,t,!1,n)):Ik(t)?t.from&&t.to?ej(e,{from:t.from,to:t.to},n):!1:zk(t)?$A(e,t.dayOfWeek,n):Fk(t)?n.isAfter(t.before,t.after)?ej(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Vk(e.from,t,n)||Vk(e.to,t,n):Lk(t)||Rk(t)?Vk(e.from,t,n)||Vk(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 nj(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=UA(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}:QA(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&tj({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&&Pk(u,e,!1,t)}}function rj(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=UA(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 ij(e,t){let n=rj(e,t),r=ZA(e,t),i=nj(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function aj(e,t){return e instanceof UO&&e.timeZone===t?e:new UO(e,t)}function oj(e,t,n){if(!n)return aj(e,t);let r=aj(e,t),i=new UO(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function sj(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?oj(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?oj(e,t,n):e):Ik(e)?{...e,from:e.from?aj(e.from,t):e.from,to:e.to?aj(e.to,t):e.to}:Fk(e)?{before:oj(e.before,t,n),after:oj(e.after,t,n)}:Lk(e)?{after:oj(e.after,t,n)}:Rk(e)?{before:oj(e.before,t,n)}:e}function cj(e,t,n){return e&&(Array.isArray(e)?e.map(e=>sj(e,t,n)):sj(e,t,n))}function lj(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=aj(t.today,n),t.month&&=aj(t.month,n),t.defaultMonth&&=aj(t.defaultMonth,n),t.startMonth&&=aj(t.startMonth,n),t.endMonth&&=aj(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=aj(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>aj(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?aj(t.selected.from,n):t.selected.from,to:t.selected.to?aj(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=cj(t.disabled,n)),t.hidden!==void 0&&(t.hidden=cj(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=cj(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={...YO,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?TA(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new XO({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:Wk(t.components),formatters:rA(t.formatters),labels:bA(t.labels,a.options),locale:e,classNames:{...Kk(),...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=WA(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:L}=A,R=Hk(j,t,N,P,o),{isSelected:z,select:B,selected:V}=ij(t,o)??{},{blur:H,focused:U,isFocusTarget:W,moveFocus:G,setFocused:K}=XA(t,A,R,z??(()=>!1),o),{labelDayButton:ee,labelGridcell:q,labelGrid:te,labelMonthDropdown:ne,labelNav:re,labelPrevious:ie,labelNext:ae,labelWeekday:oe,labelWeekNumber:se,labelWeekNumberHeader:ce,labelYearDropdown:le}=a,ue=(0,Q.useMemo)(()=>CA(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[ok.Root],t.className].filter(Boolean).join(` `),style:{...S?.[ok.Root],...t.style}}),[c,t.className,t.style,S]),we=Gk(t),Te=(0,Q.useRef)(null);NA(Te,!!t.animate,{classNames:c,months:M,focused:U,dateLib:o});let Ee={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(_k.Provider,{value:Ee},Q.createElement(r.Root,{rootRef:t.animate?Te: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[ok.Months],style:S?.[ok.Months]},!t.hideNavigation&&!d&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[ok.Nav],style:S?.[ok.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[ok.Month],style:S?.[ok.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&Q.createElement(r.PreviousMonthButton,{type:`button`,className:c[ok.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[ok.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),Q.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[ok.MonthCaption],style:S?.[ok.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?Q.createElement(r.DropdownNav,{className:c[ok.Dropdowns],style:S?.[ok.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?Q.createElement(r.MonthsDropdown,{key:`month`,className:c[ok.MonthsDropdown],"aria-label":ne(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:be(e.date),options:xA(e.date,N,P,i,o),style:S?.[ok.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[ok.YearsDropdown],"aria-label":le(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:xe(e.date),options:wA(N,P,i,o,!!t.reverseYears),style:S?.[ok.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[ok.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[ok.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[ok.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[ok.Nav],style:S?.[ok.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[ok.MonthGrid],style:S?.[ok.MonthGrid]},!t.hideWeekdays&&Q.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[ok.Weekdays],style:S?.[ok.Weekdays]},x&&Q.createElement(r.WeekNumberHeader,{"aria-label":ce(o.options),className:c[ok.WeekNumberHeader],style:S?.[ok.WeekNumberHeader],scope:`col`},D()),ue.map(e=>Q.createElement(r.Weekday,{"aria-label":oe(e,o.options,o),className:c[ok.Weekday],key:String(e),style:S?.[ok.Weekday],scope:`col`},O(e,o.options,o)))),Q.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[ok.Weeks],style:S?.[ok.Weeks]},e.weeks.map(e=>Q.createElement(r.Week,{className:c[ok.Week],key:e.weekNumber,style:S?.[ok.Week],week:e},x&&Q.createElement(r.WeekNumber,{week:e,style:S?.[ok.WeekNumber],"aria-label":se(e.weekNumber,{locale:s}),className:c[ok.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=R(e);if(i[sk.focused]=!i.hidden&&!!U?.isEqualTo(e),i[ck.selected]=z?.(n)||i.selected,Ik(V)){let{from:e,to:t}=V;i[ck.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[ck.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[ck.range_middle]=Pk(V,n,!0,o)}let a=SA(i,S,t.modifiersStyles),s=Uk(i,c,t.modifiersClassNames),l=!de&&!i.hidden?q(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[ok.DayButton],style:S?.[ok.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":ee(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[ok.Footer],style:S?.[ok.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function uj(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=Kk();m=lj,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(St({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_previous),W=Y(St({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)(mj,{locale:o,...t})},t[82]=o,t[83]=K);let ee;t[84]!==i||t[85]!==K?(ee={Root:pj,Chevron:fj,DayButton:K,WeekNumber:dj,...i},t[84]=i,t[85]=K,t[86]=ee):ee=t[86];let q;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]!==ee?(q=(0,Z.jsx)(m,{showOutsideDays:P,className:F,captionLayout:I,locale:L,formatters:R,classNames:G,components:ee,...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]=ee,t[96]=q):q=t[96],q}function dj(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 fj(e){let{className:t,orientation:n,...r}=e;return n===`left`?(0,Z.jsx)(Wi,{className:Y(`size-4`,t),...r}):n===`right`?(0,Z.jsx)(Kt,{className:Y(`size-4`,t),...r}):(0,Z.jsx)(nn,{className:Y(`size-4`,t),...r})}function pj(e){let{className:t,rootRef:n,...r}=e;return(0,Z.jsx)(`div`,{"data-slot":`calendar`,ref:n,className:Y(t),...r})}function mj(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=Kk(),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 hj(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(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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)(wo,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Z.jsx)(pr,{})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(So,{"data-slot":`checkbox`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function gj(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.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)(Gn,{"data-testid":`text-widget`,"data-key":n,type:`text`,value:a,placeholder:`Empty`,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`h-7 border-transparent dark:bg-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 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 _j(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)(Gn,{"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 vj(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)(hj,{"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 yj(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=xj(r),o=Q.useState,s=Sj(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=xj(r);l(Sj(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=wj(c);if(e){let t=UE(e,`yyyy-MM-dd`);t!==r&&i(t),l(Sj(e)),d(e)}else l(Sj(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=UE(e,`yyyy-MM-dd`);t!==r&&i(t),l(Sj(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=wj(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 E;t[19]!==y||t[20]!==a?(E=e=>{e.key===`Enter`?(e.preventDefault(),y(),e.currentTarget.blur()):e.key===`Escape`?(e.preventDefault(),h.current=!0,l(Sj(a)),e.currentTarget.blur()):e.key===`ArrowDown`&&(e.preventDefault(),p(!0))},t[19]=y,t[20]=a,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==T||t[24]!==E||t[25]!==S?(D=(0,Z.jsx)(Gn,{type:`text`,value:c,placeholder:`Empty`,"aria-label":S,onChange:C,onFocus:w,onBlur:T,onKeyDown:E,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]=E,t[25]=S,t[26]=D):D=t[26];let O=`Open date picker for ${n}`,k;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Hi,{className:`size-3.5`}),t[27]=k):k=t[27];let A;t[28]===O?A=t[29]:(A=(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":O,className:`absolute right-0 size-6 p-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:k})}),t[28]=O,t[29]=A);let j;t[30]!==a||t[31]!==x||t[32]!==u?(j=(0,Z.jsx)(On,{className:`w-auto overflow-hidden p-0`,align:`end`,children:(0,Z.jsx)(uj,{mode:`single`,selected:a,month:u,onMonthChange:d,onSelect:x,captionLayout:`dropdown`})}),t[30]=a,t[31]=x,t[32]=u,t[33]=j):j=t[33];let M;t[34]!==f||t[35]!==A||t[36]!==j?(M=(0,Z.jsxs)(Zt,{open:f,onOpenChange:p,children:[A,j]}),t[34]=f,t[35]=A,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==n||t[39]!==D||t[40]!==M?(N=(0,Z.jsxs)(`div`,{"data-testid":`date-widget`,"data-key":n,className:`relative flex h-7 items-center`,children:[D,M]}),t[38]=n,t[39]=D,t[40]=M,t[41]=N):N=t[41],N}var bj=`MMM d, yyyy`;function xj(e){if(!e)return;let t=uO(e);return Number.isNaN(t.getTime())?void 0:t}function Sj(e){return e?UE(e,bj):``}var Cj=[`MMM d, yyyy`,`MMMM d, yyyy`,`yyyy-MM-dd`,`M/d/yyyy`,`MM/dd/yyyy`];function wj(e){let t=e.trim();if(!t)return;let n=new Date;for(let e of Cj){let r=oO(t,e,n);if(!Number.isNaN(r.getTime()))return r}}function Tj(e){let t=(0,$.c)(30),{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;if(t[6]!==u||t[7]!==r){let e;t[9]===u?e=t[10]:(e=(e,t)=>(0,Z.jsxs)(`span`,{"data-testid":`list-chip`,"data-index":t,className:`inline-flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-sm`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>u(t),className:`text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:(0,Z.jsx)(Cr,{className:`size-3`})})]},`${t}-${e}`),t[9]=u,t[10]=e),d=r.map(e),t[6]=u,t[7]=r,t[8]=d}else d=t[8];let f=r.length===0?`Empty`:``,p=`${n} value`,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>o(e.target.value),t[11]=m):m=t[11];let h;t[12]!==c||t[13]!==a||t[14]!==u||t[15]!==r.length?(h=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[12]=c,t[13]=a,t[14]=u,t[15]=r.length,t[16]=h):h=t[16];let g;t[17]!==c||t[18]!==a?(g=()=>{a&&c(a)},t[17]=c,t[18]=a,t[19]=g):g=t[19];let _;t[20]!==a||t[21]!==f||t[22]!==p||t[23]!==h||t[24]!==g?(_=(0,Z.jsx)(`input`,{"data-testid":`list-chip-input`,type:`text`,value:a,placeholder:f,"aria-label":p,onChange:m,onKeyDown:h,onBlur:g,className:`min-w-16 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60`}),t[20]=a,t[21]=f,t[22]=p,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;return t[26]!==n||t[27]!==d||t[28]!==_?(v=(0,Z.jsxs)(`div`,{"data-testid":`list-widget`,"data-key":n,className:`flex h-7 min-h-7 flex-wrap items-center gap-1 rounded-md px-2 focus-within:bg-background`,children:[d,_]}),t[26]=n,t[27]=d,t[28]=_,t[29]=v):v=t[29],v}var Ej={text:Ya,number:ma,boolean:Va,date:Hi,list:It},Dj={text:`Text`,number:`Number`,boolean:`Checkbox`,date:`Date`,list:`List`};function Oj(e){let t=(0,$.c)(17),{keyName:n,type:r,onChangeType:i}=e,a=Ej[r],o=`${n} type: ${Dj[r]}. Click to change.`,s;t[0]===a?s=t[1]:(s=(0,Z.jsx)(a,{className:`size-3.5`}),t[0]=a,t[1]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s||t[5]!==r?(c=(0,Z.jsx)(Ry,{"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":o,className:`flex size-6 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:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=r,t[6]=c):c=t[6];let l;t[7]===i?l=t[8]:(l=e=>i(e),t[7]=i,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(Ej),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=u.map(kj),t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==r?(f=(0,Z.jsx)(zy,{align:`start`,"data-testid":`type-picker-menu`,children:(0,Z.jsx)(Vy,{value:r,onValueChange:l,children:d})}),t[11]=l,t[12]=r,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,Z.jsxs)(Ly,{children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}function kj(e){let t=Ej[e];return(0,Z.jsxs)(Hy,{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:Dj[e]})]},e)}function Aj(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 jj(e,t){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:t===`list`?`text`:t}var Mj={text:``,number:0,boolean:!1,date:``,list:[]};function Nj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=fe(t);return{map:n,keys:ie(t),parseError:r}}function Pj(e){let t=(0,$.c)(110),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>Nj(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{let e=ee(n);i(e),s(e.current());let t=e.subscribe(e=>{s(e)});return()=>{t(),e.dispose(),i(t=>t===e?null:t)}},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useEffect)(c,l);let u=o.map,d=o.keys,f=o.parseError,[p,m]=(0,Q.useState)(!1),h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[5]=h):h=t[5];let[g,_]=(0,Q.useState)(h),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S={},t[6]=S):S=t[6];let[C,w]=(0,Q.useState)(S),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[7]=T):T=t[7];let[E,D]=(0,Q.useState)(T),O=n.configuration.name??``,k;t[8]===r?k=t[9]:(k=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=Fe(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=k);let A=k,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){w(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[10]=j):j=t[10];let M=j,N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e,t){if(e.ok)return;let n=e.error??`Failed to update property`,r=e.fieldErrors??{};w(e=>{let i={...e};for(let e of t)i[e]=r[e]??n;return i}),D(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[11]=N):N=t[11];let P=N,F;t[12]===A?F=t[13]:(F=function(e,t){M(e),P(A({[e]:t}),[e])},t[12]=A,t[13]=F);let I=F,L;t[14]===A?L=t[15]:(L=function(e){M(e),P(A({[e]:null}),[e])},t[14]=A,t[15]=L);let R=L,z;t[16]===r?z=t[17]:(z=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=Fe(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[16]=r,t[17]=z);let B=z,V;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e,t){return`${e}${t}`},t[18]=V):V=t[18];let H=V,U;t[19]!==r||t[20]!==d?(U=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=d.map((e,t)=>H(e,t)),a=i.indexOf(t),o=i.indexOf(n);if(a<0||o<0)return;let s=d.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[19]=r,t[20]=d,t[21]=U):U=t[21];let W=U,G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G={activationConstraint:{distance:4}},t[22]=G):G=t[22];let K;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(K={coordinateGetter:hT},t[23]=K):K=t[23];let te=RS(LS(BC,G),LS(FC,K)),ne;t[24]!==I||t[25]!==u?(ne=function(e,t){let n=u[e];if(n===void 0)return;_(n=>({...n,[e]:t}));let r=Aj(n,t);zj(n,r)||I(e,r)},t[24]=I,t[25]=u,t[26]=ne):ne=t[26];let re=ne,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){y({name:``,type:`text`,value:``,error:null}),m(!1)},t[27]=ie):ie=t[27];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=db(),ce;t[28]!==oe||t[29]!==O?(ce=oe.get(O)??0,t[28]=oe,t[29]=O,t[30]=ce):ce=t[30];let le=ce,ue,de;t[31]===le?(ue=t[32],de=t[33]):(ue=()=>{le>0&&(y({name:``,type:`text`,value:``,error:null}),m(!1))},de=[le],t[31]=le,t[32]=ue,t[33]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[34]!==se||t[35]!==O?(fe=()=>()=>se(O),pe=[O,se],t[34]=se,t[35]=O,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){y(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Mj[e];return{...t,type:e,value:n,error:null}})},t[38]=me):me=t[38];let he=me,ge;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){y(t=>t&&{...t,value:e})},t[39]=ge):ge=t[39];let _e=ge,ve;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){y(t=>t&&{...t,name:e,error:null})},t[40]=ve):ve=t[40];let ye=ve,be;t[41]!==v||t[42]!==A||t[43]!==u?(be=function(){if(!v)return;let e=v.name.trim();if(!e){y({...v,error:`Name is required`});return}if(e===`frontmatter`){y({...v,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){y({...v,error:`Property "${e}" already exists`});return}let t=A({[e]:v.value});if(t.ok){y(null);return}let n=t.fieldErrors?.[e],r=t.error??`Failed to add property`;y({...v,error:n??r})},t[41]=v,t[42]=A,t[43]=u,t[44]=be):be=t[44];let xe=be,Se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){y(null)},t[45]=Se):Se=t[45];let Ce=Se,we;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){x({key:e,draft:e,error:null})},t[46]=we):we=t[46];let Te=we,Ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){x(t=>t&&{...t,draft:e,error:null})},t[47]=Ee):Ee=t[47];let De=Ee,Oe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){x(null)},t[48]=Oe):Oe=t[48];let ke=Oe,Ae;t[49]!==u||t[50]!==B||t[51]!==b?(Ae=function(){if(!b)return;let e=b.draft.trim();if(!e){x(null);return}if(e===b.key){x(null);return}if(e===`frontmatter`){x({...b,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){x({...b,error:`Property "${e}" already exists`});return}let t=B(b.key,e);if(t.ok){_(t=>{if(!Object.hasOwn(t,b.key))return t;let n={...t};return n[e]=n[b.key],delete n[b.key],n}),M(b.key),x(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[b.key]??t.error??`Failed to rename property`;x({...b,error:n})},t[49]=u,t[50]=B,t[51]=b,t[52]=Ae):Ae=t[52];let je=Ae,Me;t[53]!==u||t[54]!==d?(Me=d.length>0?d:Object.keys(u),t[53]=u,t[54]=d,t[55]=Me):Me=t[55];let Ne=Me,Pe;if(t[56]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[56]=Ne,t[57]=Pe}else Pe=t[57];if(Ne.length===0&&!v&&!f)return null;let Ie=!p,Le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>m(!e),t[58]=Le):Le=t[58];let Re=!p,ze;t[59]===Re?ze=t[60]:(ze=(0,Z.jsx)(Kt,{"data-expanded":Re,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[59]=Re,t[60]=ze);let Be;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(`span`,{children:`Properties`}),t[61]=Be):Be=t[61];let Ve;t[62]===ze?Ve=t[63]:(Ve=(0,Z.jsx)(Ft,{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:[ze,Be]})}),t[62]=ze,t[63]=Ve);let He;t[64]===f?He=t[65]:(He=f?(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)(q,{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:f})]})]}):null,t[64]=f,t[65]=He);let Ue;if(t[66]!==Ne){let e;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>H(e,t),t[68]=e):e=t[68],Ue=Ne.map(e),t[66]=Ne,t[67]=Ue}else Ue=t[67];let We;if(t[69]!==I||t[70]!==je||t[71]!==Pe||t[72]!==C||t[73]!==u||t[74]!==g||t[75]!==R||t[76]!==b||t[77]!==Ne||t[78]!==E||t[79]!==re){let e;t[81]!==I||t[82]!==je||t[83]!==Pe||t[84]!==C||t[85]!==u||t[86]!==g||t[87]!==R||t[88]!==b||t[89]!==E||t[90]!==re?(e=(e,t)=>{let n=u[e];if(n===void 0)return null;let r=g[e]??Ge(n),i=b?.key===e?b:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Fj,{sortableId:H(e,t),keyName:e,value:n,declared:r,renameState:i,error:C[e]??null,resetCounter:E[e]??0,isDuplicate:a,onCommit:t=>I(e,t),onChangeType:t=>re(e,t),onRemove:()=>R(e),onBeginRename:()=>Te(e),onChangeRenameDraft:De,onCommitRename:je,onCancelRename:ke},`${e}-${t}`)},t[81]=I,t[82]=je,t[83]=Pe,t[84]=C,t[85]=u,t[86]=g,t[87]=R,t[88]=b,t[89]=E,t[90]=re,t[91]=e):e=t[91],We=Ne.map(e),t[69]=I,t[70]=je,t[71]=Pe,t[72]=C,t[73]=u,t[74]=g,t[75]=R,t[76]=b,t[77]=Ne,t[78]=E,t[79]=re,t[80]=We}else We=t[80];let Ke;t[92]!==Ue||t[93]!==We?(Ke=(0,Z.jsx)(rT,{items:Ue,strategy:$w,children:We}),t[92]=Ue,t[93]=We,t[94]=Ke):Ke=t[94];let qe;t[95]!==W||t[96]!==te||t[97]!==Ke?(qe=(0,Z.jsx)(Lw,{sensors:te,collisionDetection:KS,onDragEnd:W,children:Ke}),t[95]=W,t[96]=te,t[97]=Ke,t[98]=qe):qe=t[98];let Je;t[99]!==v||t[100]!==xe?(Je=v?(0,Z.jsx)(Lj,{draft:v,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,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)(mr,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[99]=v,t[100]=xe,t[101]=Je):Je=t[101];let Ye;t[102]!==He||t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(Lt,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[He,qe,Je]}),t[102]=He,t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let Xe;return t[106]!==Ie||t[107]!==Ve||t[108]!==Ye?(Xe=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(on,{open:Ie,onOpenChange:Le,children:[Ve,Ye]})}),t[106]=Ie,t[107]=Ve,t[108]=Ye,t[109]=Xe):Xe=t[109],Xe}function Fj(e){let t=(0,$.c)(63),{sortableId:n,keyName:r,value:i,declared:a,renameState:o,error:s,resetCounter:c,isDuplicate:l,onCommit:u,onChangeType:d,onRemove:f,onBeginRename:p,onChangeRenameDraft:m,onCommitRename:h,onCancelRename:g}=e,_;t[0]!==a||t[1]!==i?(_=jj(i,a),t[0]=a,t[1]=i,t[2]=_):_=t[2];let v=_,y;t[3]===n?y=t[4]:(y={id:n},t[3]=n,t[4]=y);let{attributes:b,listeners:x,setNodeRef:S,transform:C,transition:w,isDragging:T}=dT(y),E;t[5]===C?E=t[6]:(E=SS.Transform.toString(C),t[5]=C,t[6]=E);let D=T?.5:void 0,O=T?1:void 0,k;t[7]!==E||t[8]!==D||t[9]!==O||t[10]!==w?(k={transform:E,transition:w,opacity:D,zIndex:O},t[7]=E,t[8]=D,t[9]=O,t[10]=w,t[11]=k):k=t[11];let A=k,j=s??void 0,M=l||void 0,N=T||void 0,P=`Drag ${r} to reorder`,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(fa,{className:`size-3.5`}),t[12]=F):F=t[12];let I;t[13]!==b||t[14]!==r||t[15]!==x||t[16]!==P?(I=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`property-drag-handle`,"data-key":r,"aria-label":P,...b,...x,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:F}),t[13]=b,t[14]=r,t[15]=x,t[16]=P,t[17]=I):I=t[17];let L;t[18]!==r||t[19]!==d||t[20]!==v?(L=(0,Z.jsx)(Oj,{keyName:r,type:v,onChangeType:d}),t[18]=r,t[19]=d,t[20]=v,t[21]=L):L=t[21];let R;t[22]!==r||t[23]!==p||t[24]!==g||t[25]!==m||t[26]!==h||t[27]!==o?(R=(0,Z.jsx)(`div`,{className:`w-32 shrink-0`,children:o?(0,Z.jsx)(Ij,{keyName:r,draft:o.draft,error:o.error,onChangeDraft:m,onCommit:h,onCancel:g}):(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"data-testid":`property-name-button`,"data-key":r,onClick:p,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`,children:r})}),t[22]=r,t[23]=p,t[24]=g,t[25]=m,t[26]=h,t[27]=o,t[28]=R):R=t[28];let z;t[29]!==l||t[30]!==r?(z=l?(0,Z.jsx)(`span`,{"data-testid":`property-duplicate-marker`,"data-key":r,title:`Duplicate name "${r}"`,className:`flex size-4 items-center justify-center text-amber-600`,children:(0,Z.jsx)(q,{className:`size-3.5`})}):null,t[29]=l,t[30]=r,t[31]=z):z=t[31];let B=`widget-${c}`,V;t[32]!==r||t[33]!==u||t[34]!==B||t[35]!==i||t[36]!==v?(V=(0,Z.jsx)(`div`,{className:`flex-1`,children:(0,Z.jsx)(Rj,{keyName:r,value:i,widgetType:v,onCommit:u},B)}),t[32]=r,t[33]=u,t[34]=B,t[35]=i,t[36]=v,t[37]=V):V=t[37];let H=`Remove ${r}`,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Pt,{className:`size-3.5`}),t[38]=U):U=t[38];let W;t[39]!==r||t[40]!==f||t[41]!==H?(W=(0,Z.jsx)(X,{type:`button`,"data-testid":`property-remove-button`,"data-key":r,"aria-label":H,onClick:f,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:U}),t[39]=r,t[40]=f,t[41]=H,t[42]=W):W=t[42];let G;t[43]!==I||t[44]!==L||t[45]!==R||t[46]!==z||t[47]!==V||t[48]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[I,L,R,z,V,W]}),t[43]=I,t[44]=L,t[45]=R,t[46]=z,t[47]=V,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==s||t[51]!==r?(K=s?(0,Z.jsx)(`div`,{role:`alert`,"data-testid":`property-error`,"data-key":r,className:`pl-9 text-[10px] text-destructive`,children:s}):null,t[50]=s,t[51]=r,t[52]=K):K=t[52];let ee;return t[53]!==r||t[54]!==S||t[55]!==A||t[56]!==G||t[57]!==K||t[58]!==j||t[59]!==M||t[60]!==N||t[61]!==v?(ee=(0,Z.jsxs)(`div`,{ref:S,style:A,className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":v,"data-error":j,"data-duplicate":M,"data-dragging":N,children:[G,K]}),t[53]=r,t[54]=S,t[55]=A,t[56]=G,t[57]=K,t[58]=j,t[59]=M,t[60]=N,t[61]=v,t[62]=ee):ee=t[62],ee}function Ij(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)(Gn,{"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 Lj(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)(Oj,{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)(Gn,{"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:`flex-1`,children:(0,Z.jsx)(Rj,{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)(Cr,{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-center 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 Rj(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)(Tj,{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)(vj,{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)(_j,{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)(yj,{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)(gj,{keyName:n,value:s,onCommit:a}),t[20]=n,t[21]=a,t[22]=s,t[23]=c):c=t[23],c}function zj(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function Bj(e){let t=e.threshold??5e5;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Vj(){return r(()=>import(`./SourceEditor-CE_X9auW.js`),__vite__mapDeps([24,1,19,2,3,20,21,13,12,5,6,22,7,25,15]),import.meta.url)}var Hj=(0,Q.lazy)(async()=>({default:(await Vj()).SourceEditor}));function Uj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!yn(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 Wj(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 Gj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Vn,{name:`activity-pool`,children:(0,Z.jsx)(Kj,{...e})}),t[0]=e,t[1]=n),n}function Kj(e){let t=(0,$.c)(12),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=jn(),{pages:u,loading:d}=Be(),f=Uj(c,n,3),p=(0,Q.useRef)(``),m=f.map(qj).join(`,`);(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[];qn(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:e.filter(e=>!t.includes(e))}),p.current=m,tn(t)},[m,n]);let h;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==d||t[4]!==o||t[5]!==s||t[6]!==u||t[7]!==a||t[8]!==l?(h=e=>(0,Z.jsx)(Qj,{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[0]=n,t[1]=i,t[2]=r,t[3]=d,t[4]=o,t[5]=s,t[6]=u,t[7]=a,t[8]=l,t[9]=h):h=t[9];let g=f.map(h),_;return t[10]===g?_=t[11]:(_=(0,Z.jsx)(Z.Fragment,{children:g}),t[10]=g,t[11]=_),_}function qj(e){return e.docName}function Jj(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,className:`subtle-scrollbar h-full overflow-y-auto`,style:u,children:r}),t[6]=r,t[7]=d),d}function Yj(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)(Av,{}),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)(Hj,{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 Xj(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)(Pa,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Rt,{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:Zj,children:[(0,Z.jsx)(Pa,{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 Zj(){return window.location.reload()}function Qj(e){let t=(0,$.c)(36),{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=Wj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=n.provider.document.getText(`source`).length,[m,h]=(0,Q.useState)(i),[g,_]=(0,Q.useState)(!i),v,y;t[3]!==i||t[4]!==m||t[5]!==g?(v=()=>{i&&!m?h(!0):!i&&!g&&_(!0)},y=[i,m,g],t[3]=i,t[4]=m,t[5]=g,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b=Bj({ytextLength:p,isSourceMode:i,visitedSource:m,visitedVisual:g}),x=(0,Q.useRef)(``),S=`${b.isLarge}-${b.renderSource}-${b.renderVisual}`,C,w;t[8]!==n.docName||t[9]!==b.isLarge||t[10]!==b.renderSource||t[11]!==b.renderVisual||t[12]!==S||t[13]!==i||t[14]!==p?(C=()=>{x.current!==S&&(x.current=S,b.isLarge&&qn(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:p,isSourceMode:i,renderSource:b.renderSource,renderVisual:b.renderVisual}))},w=[S,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[8]=n.docName,t[9]=b.isLarge,t[10]=b.renderSource,t[11]=b.renderVisual,t[12]=S,t[13]=i,t[14]=p,t[15]=C,t[16]=w):(C=t[15],w=t[16]),(0,Q.useEffect)(C,w);let T=r?`visible`:`hidden`,E=`editor:${n.docName}`,D;t[17]!==a||t[18]!==n||t[19]!==b.renderSource||t[20]!==b.renderVisual||t[21]!==r||t[22]!==o||t[23]!==i||t[24]!==c||t[25]!==l||t[26]!==s||t[27]!==f?(D=f?(0,Z.jsx)(Xj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Xx,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(Av,{}),children:(0,Z.jsx)(Gx,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col ${i?``:`pt-6`}`,children:[!i&&(0,Z.jsx)(Pj,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[b.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Yj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,b.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(Hx,{provider:n.provider,placeholder:a,isSourceMode:i},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[17]=a,t[18]=n,t[19]=b.renderSource,t[20]=b.renderVisual,t[21]=r,t[22]=o,t[23]=i,t[24]=c,t[25]=l,t[26]=s,t[27]=f,t[28]=D):D=t[28];let O;t[29]!==r||t[30]!==D?(O=(0,Z.jsx)(Jj,{isActive:r,children:D}),t[29]=r,t[30]=D,t[31]=O):O=t[31];let k;return t[32]!==T||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(Q.Activity,{mode:T,name:E,children:O}),t[32]=T,t[33]=E,t[34]=O,t[35]=k):k=t[35],k}function $j(e){let t=(0,$.c)(26),{stats:n}=e,r;t[0]===n.words?r=t[1]:(r=n.words.toLocaleString(),t[0]=n.words,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=i);let a=n.words===1?`word`:`words`,o;t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`span`,{children:[i,` `,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===n.chars?s=t[8]:(s=n.chars.toLocaleString(),t[7]=n.chars,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[9]=s,t[10]=c);let l=n.chars===1?`char`:`chars`,u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`span`,{children:[c,` `,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=n.tokens>0?`~`:``,f;t[14]===n.tokens?f=t[15]:(f=n.tokens.toLocaleString(),t[14]=n.tokens,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f}),t[16]=f,t[17]=p);let m=n.tokens===1?`token`:`tokens`,h;t[18]!==p||t[19]!==m||t[20]!==d?(h=(0,Z.jsxs)(`span`,{children:[d,p,` `,m]}),t[18]=p,t[19]=m,t[20]=d,t[21]=h):h=t[21];let g;return t[22]!==h||t[23]!==o||t[24]!==u?(g=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`flex h-6 shrink-0 items-center justify-end gap-3 px-3 text-2xs text-muted-foreground`,children:[o,u,h]}),t[22]=h,t[23]=o,t[24]=u,t[25]=g):g=t[25],g}var eM=(0,Q.lazy)(()=>r(()=>import(`./SettingsPane-B3rEEyMP.js`).then(e=>({default:e.SettingsPane})),__vite__mapDeps([26,1,19,2,3,20,21,13,12,5,6,22,7,27,17,14]),import.meta.url));function tM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Vn,{name:`editor-area`,children:(0,Z.jsx)(lb,{children:(0,Z.jsx)(nM,{...e})})}),t[0]=e,t[1]=n),n}function nM(e){let t=(0,$.c)(101),{editorMode:n,activeTab:r,onActiveTabChange:i}=e,a=Gd(),{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=jn(),{openDocumentTransition:f}=Pn(),{requestAddProperty:p}=db(),m=Ob(s,o),h=(0,Q.useDeferredValue)(o),g=c?.kind===`missing`,_=!!o&&c?.kind!==`folder`,v=g?`Start writing to create this page…`:void 0,y=Dv(),[b,x]=(0,Q.useState)(!1),{layout:S,autoCollapse:C}=_b(),w=S===`sheet`,[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(!1),O,k;t[0]!==C||t[1]!==S||t[2]!==y?(O=()=>{S===`panel`&&(C?(D.current=!1,y.current?.collapse()):D.current||y.current?.expand())},k=[C,S,y],t[0]=C,t[1]=S,t[2]=y,t[3]=O,t[4]=k):(O=t[3],k=t[4]),(0,Q.useEffect)(O,k);let A,j;t[5]!==d||t[6]!==w||t[7]!==y?(A=()=>{d!==0&&(w?E(!0):(D.current=!1,y.current?.expand()))},j=[d,w,y],t[5]=d,t[6]=w,t[7]=y,t[8]=A,t[9]=j):(A=t[8],j=t[9]),(0,Q.useEffect)(A,j);let M=(0,Q.useRef)(null),[N,P]=(0,Q.useState)(null),F,I;if(t[10]===o?(F=t[11],I=t[12]):(F=()=>{if(o&&o!==M.current){let e=M.current;M.current=o,P(e)}},I=[o],t[10]=o,t[11]=F,t[12]=I),(0,Q.useEffect)(F,I),a.scope!==null){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Av,{}),t[13]=e):e=t[13];let n;return t[14]!==a.close||t[15]!==a.scope||t[16]!==a.setScope?(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(eM,{scope:a.scope,onClose:a.close,onScopeChange:a.setScope})}),t[14]=a.close,t[15]=a.scope,t[16]=a.setScope,t[17]=n):n=t[17],n}if(c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(rb,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(!s||!o){if((typeof window<`u`?Ke(window.location.hash):null)!==null){let e;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Av,{}),t[20]=e):e=t[20],e}let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ty,{}),t[21]=e):e=t[21],e}let L=n===`source`,R=w?!T:b,z;t[22]!==o||t[23]!==p?(z=function(){o&&p(o)},t[22]=o,t[23]=p,t[24]=z):z=t[24];let B=z,V;t[25]!==L||t[26]!==B?(V=!L&&(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:B,"data-testid":`add-properties-button`,className:`text-muted-foreground`,children:(0,Z.jsx)(Sa,{className:`size-4`})})}),(0,Z.jsx)(Gr,{side:`left`,children:`Add properties`})]}),t[25]=L,t[26]=B,t[27]=V):V=t[27];let H;t[28]!==b||t[29]!==w||t[30]!==y?(H=()=>{w?E(rM):b?(D.current=!1,y.current?.expand()):(D.current=!0,y.current?.collapse())},t[28]=b,t[29]=w,t[30]=y,t[31]=H):H=t[31];let U=R?`Show document panel`:`Hide document panel`,W;t[32]===R?W=t[33]:(W=R?(0,Z.jsx)(Aa,{className:`size-4`}):(0,Z.jsx)(ka,{className:`size-4`}),t[32]=R,t[33]=W);let G;t[34]!==U||t[35]!==W||t[36]!==H?(G=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:H,"aria-label":U,className:`text-muted-foreground`,children:W})}),t[34]=U,t[35]=W,t[36]=H,t[37]=G):G=t[37];let K=R?`Show panel`:`Hide panel`,ee;t[38]===K?ee=t[39]:(ee=(0,Z.jsx)(Gr,{side:`left`,children:K}),t[38]=K,t[39]=ee);let q;t[40]!==G||t[41]!==ee?(q=(0,Z.jsxs)(qr,{children:[G,ee]}),t[40]=G,t[41]=ee,t[42]=q):q=t[42];let te;t[43]!==q||t[44]!==V?(te=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1`,children:[V,q]}),t[43]=q,t[44]=V,t[45]=te):te=t[45];let ne=te,re=h??o,ie=N??void 0,ae;t[46]===f?ae=t[47]:(ae=e=>{let t=at(e);window.location.hash===t?f(e):window.location.hash=t},t[46]=f,t[47]=ae);let oe;t[48]!==v||t[49]!==L||t[50]!==l||t[51]!==re||t[52]!==ie||t[53]!==ae?(oe=(0,Z.jsx)(Gj,{activeDocName:re,isSourceMode:L,editorPlaceholder:v,previousDocName:ie,onNavigateBack:ae,onRecycle:l}),t[48]=v,t[49]=L,t[50]=l,t[51]=re,t[52]=ie,t[53]=ae,t[54]=oe):oe=t[54];let se;t[55]!==o||t[56]!==h?(se=o&&o!==h?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,Z.jsx)(Av,{})}):null,t[55]=o,t[56]=h,t[57]=se):se=t[57];let ce;t[58]!==oe||t[59]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[oe,se]}),t[58]=oe,t[59]=se,t[60]=ce):ce=t[60];let le;t[61]!==ce||t[62]!==ne?(le=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ce,ne]}),t[61]=ce,t[62]=ne,t[63]=le):le=t[63];let ue;t[64]!==_||t[65]!==m?(ue=_&&(0,Z.jsx)($j,{stats:m}),t[64]=_,t[65]=m,t[66]=ue):ue=t[66];let de;t[67]!==le||t[68]!==ue?(de=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[le,ue]}),t[67]=le,t[68]=ue,t[69]=de):de=t[69];let fe=de;if(w){let e;t[70]===fe?e=t[71]:(e=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:fe}),t[70]=fe,t[71]=e);let n;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(rh,{className:`sr-only`,children:(0,Z.jsx)(ih,{children:`Document panel`})}),t[72]=n):n=t[72];let a;t[73]!==o||t[74]!==r||t[75]!==u||t[76]!==L||t[77]!==i?(a=(0,Z.jsxs)(nh,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Z.jsx)(Pg,{docName:o,isSourceMode:L,activeTab:r,onActiveTabChange:i,mode:u})]}),t[73]=o,t[74]=r,t[75]=u,t[76]=L,t[77]=i,t[78]=a):a=t[78];let s;t[79]!==T||t[80]!==a?(s=(0,Z.jsx)($m,{open:T,onOpenChange:E,children:a}),t[79]=T,t[80]=a,t[81]=s):s=t[81];let c;return t[82]!==e||t[83]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,s]}),t[82]=e,t[83]=s,t[84]=c):c=t[84],c}let pe;t[85]===fe?pe=t[86]:(pe=(0,Z.jsx)(pb,{minSize:`30%`,defaultSize:`75%`,children:fe}),t[85]=fe,t[86]=pe);let me;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(mb,{withHandle:!0}),t[87]=me):me=t[87];let he;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>x(e.asPercentage===0),t[88]=he):he=t[88];let ge;t[89]!==o||t[90]!==r||t[91]!==u||t[92]!==L||t[93]!==i?(ge=(0,Z.jsx)(Pg,{docName:o,isSourceMode:L,activeTab:r,onActiveTabChange:i,mode:u}),t[89]=o,t[90]=r,t[91]=u,t[92]=L,t[93]=i,t[94]=ge):ge=t[94];let _e;t[95]!==y||t[96]!==ge?(_e=(0,Z.jsx)(pb,{panelRef:y,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:he,className:`flex flex-col bg-muted/20`,children:ge}),t[95]=y,t[96]=ge,t[97]=_e):_e=t[97];let ve;return t[98]!==pe||t[99]!==_e?(ve=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(fb,{orientation:`horizontal`,children:[pe,me,_e]})}),t[98]=pe,t[99]=_e,t[100]=ve):ve=t[100],ve}function rM(e){return!e}function iM(e,t){return t.trim()}function aM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function oM(e,t){let n=iM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function sM(e,t){if(t.length===0)return e;let n=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>({...e,docName:n.get(e.docName)??e.docName}))}function cM(e,t){if(t.length===0)return e;let n=new Set(t);return e.filter(e=>!n.has(e.docName))}function lM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}var uM=1280;function dM(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(fM),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${uM-1}px)`),t=()=>{n(window.innerWidth<uM)};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 fM(){return window.innerWidth<uM}function pM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function mM(e){let{value:t,unit:n}=pM(e);return n===`rem`?t*16:t}function hM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var gM=3600*24*7;function _M(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?vM:m,O=g===void 0?gM: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 ee=mM(b),q;t[6]===x?q=t[7]:(q=mM(x),t[6]=x,t[7]=q);let te=q,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:mM(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]!==ee||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}=pM(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(te,t)),u=hM(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(ee,Math.min(te,u)),f=hM(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,ee,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]=ee,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 vM(){}var yM=`sidebar_state`,bM=3600*24*7,xM=`18rem`,SM=`3rem`,CM=`\\`,wM=`app-file-sidebar`,TM=`14rem`,EM=`22rem`,DM=`sidebar_width`,OM=/^\d+(?:\.\d+)?(?:rem|px)$/,kM=Q.createContext(null);function AM(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${DM}=`))?.split(`=`)[1];if(!t)return e;let n=decodeURIComponent(t);return OM.test(n)?n:e}function jM(){let e=Q.use(kM);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function MM(e){let t=(0,$.c)(55),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?xM:l,f=dM(),p;t[9]===d?p=t[10]:(p=()=>AM(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),[v,y]=Q.useState(!1),[b,x]=Q.useState(!1),[S,C]=Q.useState(u),w=i??S,T;t[11]!==w||t[12]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),document.cookie=`${yM}=${t}; path=/; max-age=${bM}`},t[11]=w,t[12]=o,t[13]=T):T=t[13];let E=T,D;t[14]!==f||t[15]!==E?(D=function(){return f?_(PM):E(NM)},t[14]=f,t[15]=E,t[16]=D):D=t[16];let O=D,k;t[17]!==f||t[18]!==g?(k=function(){!f||!g||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||x(!0)},t[17]=f,t[18]=g,t[19]=k):k=t[19];let A=k,j,M;t[20]===O?(j=t[21],M=t[22]):(j=()=>{let e=e=>{e.key===CM&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},M=[O],t[20]=O,t[21]=j,t[22]=M),Q.useEffect(j,M);let N,P;t[23]!==f||t[24]!==g?(P=()=>{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})},N=[f,g],t[23]=f,t[24]=g,t[25]=N,t[26]=P):(N=t[25],P=t[26]),Q.useEffect(P,N);let F=Q.useRef(f),I,L;t[27]!==f||t[28]!==w?(I=()=>{!F.current&&f&&_(w),F.current=f},L=[f,w],t[27]=f,t[28]=w,t[29]=I,t[30]=L):(I=t[29],L=t[30]),Q.useEffect(I,L);let R=f?g?`expanded`:`collapsed`:w?`expanded`:`collapsed`,z;t[31]!==v||t[32]!==f||t[33]!==A||t[34]!==w||t[35]!==g||t[36]!==E||t[37]!==b||t[38]!==R||t[39]!==O||t[40]!==m?(z={state:R,open:w,setOpen:E,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:O,width:m,setWidth:h,isDraggingRail:v,setIsDraggingRail:y,showPushPulse:b,setShowPushPulse:x,notifySidebarFileSelected:A},t[31]=v,t[32]=f,t[33]=A,t[34]=w,t[35]=g,t[36]=E,t[37]=b,t[38]=R,t[39]=O,t[40]=m,t[41]=z):z=t[41];let B;t[42]!==s||t[43]!==m?(B={"--sidebar-width":m,"--sidebar-width-icon":SM,...s},t[42]=s,t[43]=m,t[44]=B):B=t[44];let V=B,H;t[45]===r?H=t[46]:(H=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[45]=r,t[46]=H);let U;t[47]!==n||t[48]!==a||t[49]!==V||t[50]!==H?(U=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:V,className:H,...a,children:n}),t[47]=n,t[48]=a,t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;return t[52]!==z||t[53]!==U?(W=(0,Z.jsx)(kM.Provider,{value:z,children:U}),t[52]=z,t[53]=U,t[54]=W):W=t[54],W}function NM(e){return!e}function PM(e){return!e}function FM(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}=jM();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:wM,"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 IM(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}=jM(),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)(Oa,{}),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":wM,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 LM(e){let t=(0,$.c)(22),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,enableDrag:a,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!0:a,{toggleSidebar:s,setWidth:c,state:l,width:u,setIsDraggingRail:d}=jM(),f=l===`collapsed`,p;t[5]!==o||t[6]!==d||t[7]!==c||t[8]!==f||t[9]!==s||t[10]!==u?(p={direction:`right`,enableDrag:o,onResize:c,onToggle:s,currentWidth:u,isCollapsed:f,minResizeWidth:TM,maxResizeWidth:EM,setIsDraggingRail:d,widthCookieName:DM,widthCookieMaxAge:bM},t[5]=o,t[6]=d,t[7]=c,t[8]=f,t[9]=s,t[10]=u,t[11]=p):p=t[11];let{dragRef:m,handleMouseDown:h}=_M(p),g;t[12]!==h||t[13]!==r?(g=e=>{r?.(e),e.defaultPrevented||h(e)},t[12]=h,t[13]=r,t[14]=g):g=t[14];let _;t[15]===n?_=t[16]:(_=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`,n),t[15]=n,t[16]=_);let v;return t[17]!==m||t[18]!==i||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(`button`,{ref:m,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:g,title:`Toggle Sidebar`,className:_,...i}),t[17]=m,t[18]=i,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function RM(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}=jM(),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 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md: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 zM(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 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(`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 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(`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 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(`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 UM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=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 WM=Et(`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 GM(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?_t:`button`,{isMobile:m,state:h}=jM(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y(WM({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)(Wr,{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)(Gr,{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)(qr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function KM(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 qM(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 JM=1e3,YM=!1;function XM(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:cr(i)?a=i:(a=void 0,YM||(YM=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=[];if(r)for(let[t,n]of r.getStates().entries()){let r=n;if(!r.user||typeof r.user!=`object`)continue;let i=r.user;i.type===`human`&&e.push({kind:`human`,clientId:t,user:i,mode:r.mode??`wysiwyg`,tabCount:1})}let t=qM(e),{current:i,crossDoc:s}=a?rr(a,n,Date.now()):{current:[],crossDoc:[]},c=ZM,l=i.map(c),u=s.map(c),d=[...t,...l],f=u;o(e=>KM(e.current,d)&&KM(e.crossDoc,f)?e:{current:d,crossDoc:f})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,JM);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 ZM(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}function QM(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`?$M: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 $M(e){return e===`synced`?`synced`:`connected`}var eN=`sync-status`;function tN(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,Hr.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:eN,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Hr.success(`Reconnected`,{id:eN,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 nN=4,rN=3,iN={Bird:Ii,Cat:Ui,Dog:na,Fish:oa,Mouse:Na,Rabbit:Ma,Shrimp:za,Snail:Ba,Squirrel:Wa,Turtle:Ja};Object.freeze([...Object.keys(iN)]);function aN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(iN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var oN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function sN(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=aN(n),o=a.kind===`animal`?iN[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Ae(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Me(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)(Wr,{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)(Gr,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(qr,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function cN(e){let t=oN[e.icon];return e.displayName||t||`Agent`}function lN(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 uN(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=cN(o),t[0]=o,t[1]=c);let l=c,u=lN(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=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Z.jsx)(or,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Z.jsx)(Wr,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Z.jsxs)(Gr,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Z.jsxs)(qr,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function dN(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)(kt,{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)(sN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uN,{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)(On,{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)(Zt,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function fN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(sN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function pN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=jn(),{current:s,crossDoc:c}=XM(t,r,n);tN(QM(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,nN),n;e[6]===s?n=e[7]:(n=s.slice(nN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,rN),d;e[8]===c?d=e[9]:(d=c.slice(rN),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=>fN(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)(dN,{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)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>fN(e,p,!0,m)),f.length>0?(0,Z.jsx)(dN,{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 mN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`LinkedIn`}),r=(0,Z.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`}),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 hN(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 gN=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:Ri},{label:`Homepage`,href:`https://openknowledge.ai/`,icon:yr},{label:`Twitter / X`,href:`https://x.com/inkeep`,icon:hN},{label:`LinkedIn`,href:`https://www.linkedin.com/company/inkeep/`,icon:mN}],_N=()=>{let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(Ki,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Help & resources`})]})})}),(0,Z.jsx)(Gr,{children:`Help & resources`})]}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Setup`}),e[1]=o):o=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Bd)},e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`help-popover-settings`,onClick:s,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(Ra,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{children:`Settings…`})]})}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{i(!1),n(!0)},e[4]=l):l=e[4];let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(`ul`,{className:`mb-3 space-y-0.5`,children:[c,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:l,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(gr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork…`})]})})]}),d=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(On,{align:`end`,className:`w-64 p-3`,children:[o,u,d,(0,Z.jsx)(`nav`,{"aria-label":`Help and resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:gN.map(vN)})})]}),e[7]=f):f=e[7];let p;e[8]===r?p=e[9]:(p=(0,Z.jsxs)(Zt,{open:r,onOpenChange:i,children:[a,f]}),e[8]=r,e[9]=p);let m;e[10]===t?m=e[11]:(m=(0,Z.jsx)(hr,{open:t,onOpenChange:n}),e[10]=t,e[11]=m);let h;return e[12]!==p||e[13]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),e[12]=p,e[13]=m,e[14]=h):h=e[14],h};function vN(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`,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)}var yN={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function bN(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}=xe(),s=yN[r],c=s?(o===`dark`?Ee[s]:void 0)??Ie[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)(Qn,{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)(Zn,{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)(ir,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var xN=`https://github.com/inkeep/open-knowledge/releases`;function SN(e){let{target:t,installState:n,isElectronHost:r}=e;return t.id===`cursor`&&!r?`Desktop only`:n.installed===null?`Detecting…`:n.installed===!1?`Not installed`:null}function CN(e){let{target:t,installState:n,isElectronHost:r}=e;if(t.id===`cursor`&&!r)return{enabled:!1,tooltip:{message:`Cursor handoff requires the desktop build.`,installAction:{label:`Install the Open Knowledge desktop app →`,url:xN}}};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 wN(e){return Se(e)}function TN(e){return`Opened ${e} in your browser.`}function EN(e){let t=(0,$.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??uf,c=e.onWebFallbackSuccess??ON,l=e.onWebFallbackError??DN,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=CN({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=SN({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s(wN(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open in ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Z.jsx)(bN,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Z.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Z.jsxs)(By,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Z.jsx)(bN,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Z.jsxs)(By,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Z.jsx)(bN,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Z.jsxs)(Ky,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Z.jsx)(Uy,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Wy,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Z.jsx)(By,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Z.jsxs)(By,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Z.jsxs)(qy,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Z.jsxs)(Gy,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function DN(){}function ON(){}function kN(e){let t=(0,$.c)(25),{input:n}=e,{states:r,refresh:i}=Vf(),{dispatch:a}=Af(),[o,s]=(0,Q.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l=jN,u=AN,d;t[0]===i?d=t[1]:(d=e=>{s(e),e&&i()},t[0]=i,t[1]=d);let f=d,p=n===null,m;t[2]===n?m=t[3]:(m=n===null?``:Ve(n.docContext),t[2]=n,t[3]=m);let h=m,g;t[4]!==a||t[5]!==n?(g=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ar,{className:`size-4`}),t[7]=v):v=t[7];let y;t[8]===p?y=t[9]:(y=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(Ry,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:p,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:v})})}),t[8]=p,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Gr,{children:`Edit with AI`}),t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x=(0,Z.jsxs)(qr,{children:[y,b]}),t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Uy,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in…`}),t[13]=S):S=t[13];let C;t[14]!==_||t[15]!==h||t[16]!==r?(C=zd.map(e=>{let t=r[e.id];return(0,Z.jsx)(EN,{target:e,installState:t,isElectronHost:c,prompt:h,onSelect:()=>_(e),onWebFallbackSuccess:l,onWebFallbackError:u},e.id)}),t[14]=_,t[15]=h,t[16]=r,t[17]=C):C=t[17];let w;t[18]===C?w=t[19]:(w=(0,Z.jsxs)(zy,{align:`end`,className:`min-w-[220px]`,"data-testid":`open-in-agent-menu`,children:[S,C]}),t[18]=C,t[19]=w);let T;return t[20]!==f||t[21]!==o||t[22]!==w||t[23]!==x?(T=(0,Z.jsxs)(Ly,{open:o,onOpenChange:f,children:[x,w]}),t[20]=f,t[21]=o,t[22]=w,t[23]=x,t[24]=T):T=t[24],T}function AN(e){Hr.error(`Couldn't open ${e.displayName} in your browser.`)}function jN(e){Hr.success(TN(e.displayName))}var MN={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`},NN=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`,...MN,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},PN=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)(NN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},FN=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)(NN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function IN(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 LN(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}async function RN(e){let t=await fetch(`/api/sync/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`set-enabled failed: HTTP ${t.status}`)}function zN(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)(Yi,{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)(Pa,{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)(Yi,{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)(Pa,{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)(q,{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)(Ji,{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)(wa,{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)(Ji,{className:`size-3.5 text-muted-foreground`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Yi,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function BN(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``;case`disabled`:return``;default:return``}}function VN(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 HN(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 UN(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`}`:VN(e.state):`Sync off`}function WN(e){let t=(0,$.c)(72),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,[o,s]=(0,Q.useState)(!1),c=n.syncEnabled,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=async function(e){s(!0);try{await RN(e)}catch(t){console.error(`[sync] toggle failed`,t),Hr.error(`Failed to ${e?`enable`:`disable`} sync — try again`)}s(!1)},t[0]=l):l=t[0];let u=l,d;t[1]===n?d=t[2]:(d=(0,Z.jsx)(zN,{status:n}),t[1]=n,t[2]=d);let f;t[3]===n.state?f=t[4]:(f=VN(n.state),t[3]=n.state,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:f}),t[5]=f,t[6]=p);let m;t[7]!==d||t[8]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,p]}),t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>void u(e),t[10]=h):h=t[10];let g=c?`Disable sync`:`Enable sync`,_;t[11]!==c||t[12]!==g||t[13]!==o?(_=(0,Z.jsx)(Hn,{checked:c,disabled:o,onCheckedChange:h,"aria-label":g}),t[11]=c,t[12]=g,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.error?y=t[19]:(y=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[18]=n.error,t[19]=y);let b;t[20]===n.pausedReason?b=t[21]:(b=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:HN(n.pausedReason)}),t[20]=n.pausedReason,t[21]=b);let x;t[22]===n.state?x=t[23]:(x=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[22]=n.state,t[23]=x);let S;t[24]!==c||t[25]!==n.lastSyncUtc||t[26]!==n.state?(S=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,IN(n.lastSyncUtc)]}),t[24]=c,t[25]=n.lastSyncUtc,t[26]=n.state,t[27]=S):S=t[27];let C;t[28]===n.ahead?C=t[29]:(C=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[28]=n.ahead,t[29]=C);let w;t[30]===n.behind?w=t[31]:(w=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[30]=n.behind,t[31]=w);let T;t[32]===n.conflictCount?T=t[33]:(T=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[32]=n.conflictCount,t[33]=T);let E;t[34]===c?E=t[35]:(E=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[34]=c,t[35]=E);let D;t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E?(D=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[S,C,w,T,E]}),t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==a||t[43]!==n.identityUnresolved?(O=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(Qa,{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[42]=a,t[43]=n.identityUnresolved,t[44]=O):O=t[44];let k;t[45]!==c||t[46]!==n.state?(k=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:KN,children:`Sync now`}),t[45]=c,t[46]=n.state,t[47]=k):k=t[47];let A;t[48]!==c||t[49]!==r||t[50]!==n.state?(A=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[48]=c,t[49]=r,t[50]=n.state,t[51]=A):A=t[51];let j;t[52]!==c||t[53]!==n.state?(j=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:GN,children:`Retry`}),t[52]=c,t[53]=n.state,t[54]=j):j=t[54];let M;t[55]!==c||t[56]!==i||t[57]!==n.state?(M=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[55]=c,t[56]=i,t[57]=n.state,t[58]=M):M=t[58];let N;t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[k,A,j,M]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=N):N=t[63];let P;return t[64]!==y||t[65]!==b||t[66]!==x||t[67]!==D||t[68]!==O||t[69]!==N||t[70]!==v?(P=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v,y,b,x,D,O,N]}),t[64]=y,t[65]=b,t[66]=x,t[67]=D,t[68]=O,t[69]=N,t[70]=v,t[71]=P):P=t[71],P}function GN(){LN(`sync`)}function KN(){LN(`sync`)}function qN(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}=sp();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wr,{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)(Ji,{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)(qr,{children:[e,(0,Z.jsx)(Gr,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote)return null;let c;t[5]===o?c=t[6]:(c=BN(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=VN(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)(zN,{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)(Wr,{asChild:!0,children:(0,Z.jsx)(kt,{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]:(_=UN(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(Gr,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(qr,{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)(On,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(WN,{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)(Zt,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var JN=(0,Q.createContext)(null);function YN(e,t,n){let r=new Fn,i=new Nn({url:e,name:t,document:r}),a=et(i,n);return{binding:a,config:a.current(),cleanup:()=>{a.dispose(),i.destroy(),r.destroy()}}}function XN(e){let t=(0,$.c)(19),{children:n}=e,{collabUrl:r}=jn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c,l;t[0]===r?(c=t[1],l=t[2]):(c=()=>{if(r===null)return;let e=YN(r,pe,`user`),t=YN(r,ct,`project`);a({binding:e.binding,config:e.config}),s({binding:t.binding,config:t.config});let n=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),i=t.binding.subscribe(e=>{s(n=>n?.binding===t.binding?{...n,config:e}:n)});return()=>{n(),i(),e.cleanup(),t.cleanup(),a(t=>t?.binding===e.binding?null:t),s(e=>e?.binding===t.binding?null:e)}},l=[r],t[0]=r,t[1]=c,t[2]=l),(0,Q.useEffect)(c,l);let u;t[3]!==o||t[4]!==i?(u=i&&o?QN(i.config,o.config):null,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=u,{setTheme:f}=xe(),p=d?.appearance?.theme,m,h;t[6]!==f||t[7]!==p?(m=()=>{(p===`light`||p===`dark`||p===`system`)&&f(p)},h=[p,f],t[6]=f,t[7]=p,t[8]=m,t[9]=h):(m=t[8],h=t[9]),(0,Q.useEffect)(m,h);let g=i?.binding??null,_=o?.binding??null,v=i?.config??null,y=o?.config??null,b;t[10]!==d||t[11]!==g||t[12]!==_||t[13]!==v||t[14]!==y?(b={userBinding:g,projectBinding:_,userConfig:v,projectConfig:y,merged:d},t[10]=d,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b):b=t[15];let x=b,S;return t[16]!==n||t[17]!==x?(S=(0,Z.jsx)(JN,{value:x,children:n}),t[16]=n,t[17]=x,t[18]=S):S=t[18],S}function ZN(){let e=(0,Q.use)(JN);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function QN(e,t){return $N(e,t,[])}function $N(e,t,n){if(n.length>0){let r=Re(ne,n);if(r?.scope===`user`)return e;if(r?.scope===`project`)return t??e}if(t===void 0)return e;if(t===null)return null;if(Array.isArray(t)||typeof t!=`object`||typeof e!=`object`||!e||Array.isArray(e))return t;let r={...e};for(let[i,a]of Object.entries(t))r[i]=$N(e[i],a,[...n,i]);return r}var eP=[{value:`light`,label:`Light`,icon:Ka},{value:`dark`,label:`Dark`,icon:Ta},{value:`system`,label:`System`,icon:$i}],tP=()=>{let e=(0,$.c)(16),{theme:t}=xe(),{merged:n,userBinding:r}=ZN(),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||Hr.error(je(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?$i:i===`dark`?Ta:Ka,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)(Ry,{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=eP.map(nP),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(zy,{align:`end`,children:(0,Z.jsx)(Vy,{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)(Ly,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function nP(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(Hy,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function rP(e){return typeof e==`object`&&!!e&&typeof e.fromDocName==`string`&&typeof e.toDocName==`string`}function iP(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.ok===!0?Array.isArray(t.renamed)&&t.renamed.every(rP)&&Array.isArray(t.rewrittenDocs):t.ok===!1?typeof t.error==`string`:!1}function aP(e){let t=(0,$.c)(78),{editorMode:n,onModeChange:r,onSaveVersion:i,saving:a,onSignIn:o,onSetIdentity:s,onOpenConflictResolver:c}=e,{activeDocName:l,activeProvider:u,activeTarget:d,closeAndClearForRename:f}=jn(),{pageMeta:p}=Be(),{state:m}=jM(),h=Jd(),g=QM(u),_;t[0]!==l||t[1]!==h?(_=xf({docName:l,workspace:h}),t[0]=l,t[1]=h,t[2]=_):_=t[2];let v=_,y=!l||!(g===`connected`||g===`synced`),b=d?.kind===`folder`,x=d?.kind===`missing`,S;t[3]!==l||t[4]!==p?(S=l&&p.get(l)?.docExt||`.md`,t[3]=l,t[4]=p,t[5]=S):S=t[5];let C=S,w=b?`${d.folderPath}/`:l?`${l}${C}`:``,T;t[6]===l?T=t[7]:(T=l?.lastIndexOf(`/`)??-1,t[6]=l,t[7]=T);let E=T,D;t[8]!==l||t[9]!==E?(D=l&&E!==-1?`${l.substring(0,E+1)}`:``,t[8]=l,t[9]=E,t[10]=D):D=t[10];let O=D,k;t[11]!==l||t[12]!==E?(k=l?l.substring(E+1):``,t[11]=l,t[12]=E,t[13]=k):k=t[13];let A=k,[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{V.current=!0,H.current=null,U.current=null,M(!1),I(null)},t[14]=W):W=t[14];let G;t[15]===l?G=t[16]:(G=[l],t[15]=l,t[16]=G),(0,Q.useEffect)(W,G);let K,ee;t[17]===j?(K=t[18],ee=t[19]):(K=()=>{if(j){let e=setTimeout(()=>{let e=z.current;e&&(e.focus(),e.select())},0);return()=>clearTimeout(e)}},ee=[j],t[17]=j,t[18]=K,t[19]=ee),(0,Q.useEffect)(K,ee);let q;t[20]!==l||t[21]!==b?(q=function(){if(!l||b)return;let e=l.split(`/`);V.current=!1,H.current=l,P(e[e.length-1]),I(null),U.current=null,M(!0)},t[20]=l,t[21]=b,t[22]=q):q=t[22];let te=q,ne;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(){V.current=!0,H.current=null,U.current=null,M(!1),P(``),I(null)},t[23]=ne):ne=t[23];let re=ne,ie;t[24]!==f||t[25]!==N?(ie=async function(){if(V.current){V.current=!1;return}if(B.current)return;let e=H.current;if(!e){re();return}let t=iM(`file`,N),n=e.split(`/`),r=n[n.length-1];if(t===r){re();return}if(t===U.current)return;if(!aM(t)){I(`Name can’t be empty, ".", "..", or contain / or \\`);return}let i=oM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(V.current){R(!1),B.current=!1;return}let r;try{r=await n.json()}catch(r){console.warn(`[EditorHeader] rename response JSON parse failed`,{parseErr:r,status:n.status,docName:e,newDocName:i}),I(`Server error (HTTP ${n.status})`),R(!1),B.current=!1,U.current=t;return}if(!n.ok||!iP(r)){let a=r;console.warn(`[EditorHeader] rename failed`,{status:n.status,docName:e,newDocName:i}),I(a?.error||`Server error (HTTP ${n.status})`),R(!1),B.current=!1,U.current=t;return}if(!r.ok){I(r.error||`Failed to rename path`),R(!1),B.current=!1,U.current=t;return}let a=r.renamed,o=lM(e,a);await Promise.all(a.flatMap(e=>[f(e.fromDocName),f(e.toDocName)])),Oe([`files`,`backlinks`,`graph`]),M(!1),P(``),R(!1),B.current=!1,U.current=null,H.current=null,o&&o!==e&&(window.location.hash=at(o))}catch(n){console.warn(`[EditorHeader] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(`Network error — please try again`),R(!1),B.current=!1,U.current=t}},t[24]=f,t[25]=N,t[26]=ie):ie=t[26];let ae=ie,oe;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(IM,{className:`-ml-1 shrink-0 text-muted-foreground`})}),t[27]=oe):oe=t[27];let se=m===`expanded`?`Hide Files`:`Show Files`,ce;t[28]===se?ce=t[29]:(ce=(0,Z.jsxs)(qr,{children:[oe,(0,Z.jsx)(Gr,{children:se})]}),t[28]=se,t[29]=ce);let le;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(fh,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[30]=le):le=t[30];let ue;t[31]!==C||t[32]!==l||t[33]!==ae||t[34]!==w||t[35]!==te||t[36]!==A||t[37]!==b||t[38]!==L||t[39]!==j||t[40]!==O||t[41]!==F||t[42]!==N?(ue=b?(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(en,{className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:w})]}):l?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center overflow-hidden`,children:[O&&(0,Z.jsxs)(`span`,{className:`flex shrink items-center overflow-hidden text-sm text-muted-foreground/60 transition-[max-width,opacity] duration-200 ease-in-out`,style:j?{maxWidth:0,opacity:0}:{maxWidth:`20rem`,opacity:1},children:[(0,Z.jsx)(`span`,{className:`truncate`,children:O.slice(0,-1)}),(0,Z.jsx)(`span`,{className:`shrink-0 pl-2`,children:`/`})]}),j?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Gn,{ref:z,value:N,disabled:L,"aria-label":`Rename ${l}`,"aria-invalid":F?!0:void 0,"aria-describedby":F?`editor-header-rename-error`:void 0,"aria-busy":L||void 0,onChange:e=>{P(e.target.value),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ae()):e.key===`Escape`&&(e.preventDefault(),re())},onBlur:()=>void ae(),className:`h-7 min-w-0 flex-1 border-none bg-background text-sm shadow-none focus-visible:ring-0`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-xs text-muted-foreground/40`,children:C})]}),F&&(0,Z.jsx)(`span`,{id:`editor-header-rename-error`,role:`alert`,className:`text-xs text-destructive mt-0.5`,children:F})]}):(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:te,className:`h-7 shrink-0 px-2 text-sm font-normal text-muted-foreground hover:text-foreground`,children:`${A}${C}`})]}):(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground truncate min-w-0`,children:w}),t[31]=C,t[32]=l,t[33]=ae,t[34]=w,t[35]=te,t[36]=A,t[37]=b,t[38]=L,t[39]=j,t[40]=O,t[41]=F,t[42]=N,t[43]=ue):ue=t[43];let de;t[44]===x?de=t[45]:(de=x&&(0,Z.jsx)(_n,{variant:`dashed`,children:`New file`}),t[44]=x,t[45]=de);let fe;t[46]!==ce||t[47]!==ue||t[48]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-1 items-center gap-1 px-3 min-w-0`,children:[ce,le,ue,de]}),t[46]=ce,t[47]=ue,t[48]=de,t[49]=fe):fe=t[49];let pe;t[50]!==l||t[51]!==n||t[52]!==r||t[53]!==y?(pe=l&&(0,Z.jsxs)(it,{type:`single`,value:n===`source`?`source`:`visual`,onValueChange:e=>{e&&r(e===`source`?`source`:`wysiwyg`)},"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,disabled:!l,children:[(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`span`,{children:(0,Z.jsxs)(Ye,{value:`visual`,"aria-label":`Visual editor`,className:`gap-1.5 text-xs`,children:[(0,Z.jsx)(FN,{className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`hidden md:inline`,children:`Visual`})]})})}),(0,Z.jsx)(Gr,{className:`md:hidden`,children:`Visual`})]}),(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:y?0:void 0,children:(0,Z.jsxs)(Ye,{value:`source`,"aria-label":`Markdown source`,className:`gap-1.5 text-xs`,disabled:y,children:[(0,Z.jsx)(PN,{className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`hidden md:inline`,children:`Markdown`})]})})}),y&&!l?null:y?(0,Z.jsx)(Gr,{children:`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`}):(0,Z.jsx)(Gr,{className:`md:hidden`,children:`Markdown`})]})]}),t[50]=l,t[51]=n,t[52]=r,t[53]=y,t[54]=pe):pe=t[54];let me;t[55]!==l||t[56]!==i||t[57]!==a?(me=l&&(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:i,disabled:a,className:`text-muted-foreground`,children:(0,Z.jsx)(Ia,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{children:a?`Saving…`:`Checkpoint version`})]}),t[55]=l,t[56]=i,t[57]=a,t[58]=me):me=t[58];let he;t[59]!==l||t[60]!==v?(he=l&&(0,Z.jsx)(kN,{input:v}),t[59]=l,t[60]=v,t[61]=he):he=t[61];let ge;t[62]!==c||t[63]!==s||t[64]!==o?(ge=(0,Z.jsx)(qN,{onSignIn:o,onSetIdentity:s,onOpenConflictResolver:c}),t[62]=c,t[63]=s,t[64]=o,t[65]=ge):ge=t[65];let _e,ve,ye,be;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(pN,{}),ve=(0,Z.jsx)(fh,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),ye=(0,Z.jsx)(_N,{}),be=(0,Z.jsx)(tP,{}),t[66]=_e,t[67]=ve,t[68]=ye,t[69]=be):(_e=t[66],ve=t[67],ye=t[68],be=t[69]);let xe;t[70]!==me||t[71]!==he||t[72]!==ge?(xe=(0,Z.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2 px-3`,children:[me,he,ge,_e,ve,ye,be]}),t[70]=me,t[71]=he,t[72]=ge,t[73]=xe):xe=t[73];let Se;return t[74]!==fe||t[75]!==pe||t[76]!==xe?(Se=(0,Z.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center border-b`,children:[fe,pe,xe]}),t[74]=fe,t[75]=pe,t[76]=xe,t[77]=Se):Se=t[77],Se}function oP(){let e=(0,$.c)(33),[t,n]=ip(),[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)(Ag[0].id),[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(!1),g=op(),{activeDocName:_}=jn(),v,y;e[0]===_?(v=e[1],y=e[2]):(v=()=>{let e=function(e){let t=e.detail;t&&_&&vi(_,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(Xf,e),()=>window.removeEventListener(Xf,e)},y=[_],e[0]=_,e[1]=v,e[2]=y),(0,Q.useEffect)(v,y);let b;e[3]===g?b=e[4]:(b=()=>{!h.current&&g?.state===`dormant`&&g.hasRemote&&(h.current=!0,Hr.info(`This project has a GitHub remote.`,{description:`Sign in to enable automatic sync with your team.`,duration:8e3,action:{label:`Sign in`,onClick:()=>c(!0)}}))},e[3]=g,e[4]=b);let x=g?.state,S=g?.hasRemote,C;e[5]!==x||e[6]!==S?(C=[x,S],e[5]=x,e[6]=S,e[7]=C):C=e[7],(0,Q.useEffect)(b,C);let w;e[8]===n?w=e[9]:(w=function(e){i(e),n(e)},e[8]=n,e[9]=w);let T=w,E;e[10]===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?Hr.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Hr.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Hr.error(`Checkpoint failed — try again`)}m(!1)},e[10]=E):E=e[10];let D=E,O;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(cp,{onOpenResolver:()=>o(!0)}),e[11]=O):O=e[11];let k,A,j;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{u(`auth`),c(!0)},k=()=>{u(`identity`),c(!0)},A=()=>o(!0),e[12]=k,e[13]=A,e[14]=j):(k=e[12],A=e[13],j=e[14]);let M;e[15]!==r||e[16]!==T||e[17]!==p?(M=(0,Z.jsx)(aP,{editorMode:r,onModeChange:T,onSaveVersion:D,saving:p,onSignIn:j,onSetIdentity:k,onOpenConflictResolver:A}),e[15]=r,e[16]=T,e[17]=p,e[18]=M):M=e[18];let N;e[19]!==d||e[20]!==r?(N=(0,Z.jsx)(tM,{editorMode:r,activeTab:d,onActiveTabChange:f}),e[19]=d,e[20]=r,e[21]=N):N=e[21];let P;e[22]===a?P=e[23]:(P=(0,Z.jsx)(uh,{open:a,onOpenChange:o}),e[22]=a,e[23]=P);let F=l===`identity`,I;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{c(!1)},e[24]=I):I=e[24];let L;e[25]!==s||e[26]!==F?(L=(0,Z.jsx)(Gl,{open:s,onOpenChange:c,identityPrompt:F,onSuccess:I}),e[25]=s,e[26]=F,e[27]=L):L=e[27];let R;return e[28]!==M||e[29]!==N||e[30]!==P||e[31]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[O,M,N,P,L]}),e[28]=M,e[29]=N,e[30]=P,e[31]=L,e[32]=R):R=e[32],R}var sP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
31
+ `},HS={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function US(e){let{announcements:t=HS,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=VS}=e,{announce:a,announcement:o}=LS(),s=CS(`DndLiveRegion`),[c,l]=(0,Q.useState)(!1);if((0,Q.useEffect)(()=>{l(!0)},[]),zS((0,Q.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=Q.createElement(Q.Fragment,null,Q.createElement(FS,{id:r,value:i.draggable}),Q.createElement(IS,{id:s,announcement:o}));return n?(0,zi.createPortal)(u,n):u}var WS;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(WS||={});function GS(){}function KS(e,t){return(0,Q.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function qS(){var e=[...arguments];return(0,Q.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var JS=Object.freeze({x:0,y:0});function YS(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function XS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ZS(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function QS(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function $S(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function eC(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var tC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=eC(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=YS(eC(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(XS)},nC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=QS(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=QS(r),o=i.reduce((e,t,r)=>e+YS(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(XS)};function rC(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var iC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=rC(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ZS)};function aC(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function oC(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:JS}function sC(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var cC=sC(1);function lC(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function uC(e,t,n){let r=lC(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var dC={ignoreTransform:!1};function fC(e,t){t===void 0&&(t=dC);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=uS(e).getComputedStyle(e);t&&(n=uC(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function pC(e){return fC(e,{ignoreTransform:!0})}function mC(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function hC(e,t){return t===void 0&&(t=uS(e).getComputedStyle(e)),t.position===`fixed`}function gC(e,t){t===void 0&&(t=uS(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function _C(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(dS(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!fS(i)||pS(i)||n.includes(i))return n;let a=uS(e).getComputedStyle(i);return i!==e&&gC(i,a)&&n.push(i),hC(i,a)?n:r(i.parentNode)}return e?r(e):n}function vC(e){let[t]=_C(e,1);return t??null}function yC(e){return!sS||!e?null:cS(e)?e:lS(e)?dS(e)||e===mS(e).scrollingElement?window:fS(e)?e:null:null}function bC(e){return cS(e)?e.scrollX:e.scrollLeft}function xC(e){return cS(e)?e.scrollY:e.scrollTop}function SC(e){return{x:bC(e),y:xC(e)}}var CC;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(CC||={});function wC(e){return!sS||!e?!1:e===document.scrollingElement}function TC(e){let t={x:0,y:0},n=wC(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var EC={x:.2,y:.2};function DC(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=EC);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=TC(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=CC.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=CC.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=CC.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=CC.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function OC(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function kC(e){return e.reduce((e,t)=>TS(e,SC(t)),JS)}function AC(e){return e.reduce((e,t)=>e+bC(t),0)}function jC(e){return e.reduce((e,t)=>e+xC(t),0)}function MC(e,t){if(t===void 0&&(t=fC),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);vC(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var NC=[[`x`,[`left`,`right`],AC],[`y`,[`top`,`bottom`],jC]],PC=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=_C(t),r=kC(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of NC)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},FC=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function IC(e){let{EventTarget:t}=uS(e);return e instanceof t?e:mS(e)}function LC(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var RC;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(RC||={});function zC(e){e.preventDefault()}function BC(e){e.stopPropagation()}var VC;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(VC||={});var HC={start:[VC.Space,VC.Enter],cancel:[VC.Esc],end:[VC.Space,VC.Enter,VC.Tab]},UC=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case VC.Right:return{...n,x:n.x+25};case VC.Left:return{...n,x:n.x-25};case VC.Down:return{...n,y:n.y+25};case VC.Up:return{...n,y:n.y-25}}},WC=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new FC(mS(t)),this.windowListeners=new FC(uS(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(RC.Resize,this.handleCancel),this.windowListeners.add(RC.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(RC.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&MC(n),t(JS)}handleKeyDown(e){if(OS(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=HC,coordinateGetter:a=UC,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:JS;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=ES(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=TC(n),p=OC(n),m={x:Math.min(i===VC.Right?p.right-p.width/2:p.right,Math.max(i===VC.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===VC.Down?p.bottom-p.height/2:p.bottom,Math.max(i===VC.Down?p.top:p.top+p.height/2,u.y))},h=i===VC.Right&&!s||i===VC.Left&&!c,g=i===VC.Down&&!l||i===VC.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===VC.Right&&e<=d.x||i===VC.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===VC.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===VC.Down&&e<=d.y||i===VC.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===VC.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,TS(ES(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};WC.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=HC,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function GC(e){return!!(e&&`distance`in e)}function KC(e){return!!(e&&`delay`in e)}var qC=class{constructor(e,t,n){n===void 0&&(n=IC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=mS(i),this.documentListeners=new FC(this.document),this.listeners=new FC(n),this.windowListeners=new FC(uS(i)),this.initialCoordinates=AS(r)??JS,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(RC.Resize,this.handleCancel),this.windowListeners.add(RC.DragStart,zC),this.windowListeners.add(RC.VisibilityChange,this.handleCancel),this.windowListeners.add(RC.ContextMenu,zC),this.documentListeners.add(RC.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(KC(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(GC(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(RC.Click,BC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(RC.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=AS(e)??JS,s=ES(n,o);if(!t&&a){if(GC(a)){if(a.tolerance!=null&&LC(s,a.tolerance))return this.handleCancel();if(LC(s,a.distance))return this.handleStart()}if(KC(a)&&LC(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===VC.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},JC={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},YC=class extends qC{constructor(e){let{event:t}=e,n=mS(t.target);super(e,JC,n)}};YC.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var XC={move:{name:`mousemove`},end:{name:`mouseup`}},ZC;(function(e){e[e.RightClick=2]=`RightClick`})(ZC||={});var QC=class extends qC{constructor(e){super(e,XC,mS(e.event.target))}};QC.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ZC.RightClick?!1:(r?.({event:n}),!0)}}];var $C={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},ew=class extends qC{constructor(e){super(e,$C)}static setup(){return window.addEventListener($C.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($C.move.name,e)};function e(){}}};ew.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var tw;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(tw||={});var nw;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(nw||={});function rw(e){let{acceleration:t,activator:n=tw.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=nw.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=aw({delta:d,disabled:!a}),[m,h]=_S(),g=(0,Q.useRef)({x:0,y:0}),_=(0,Q.useRef)({x:0,y:0}),v=(0,Q.useMemo)(()=>{switch(n){case tw.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case tw.DraggableRect:return i}},[n,i,c]),y=(0,Q.useRef)(null),b=(0,Q.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,Q.useMemo)(()=>s===nw.TreeOrder?[...l].reverse():l,[s,l]);(0,Q.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=DC(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var iw={x:{[CC.Backward]:!1,[CC.Forward]:!1},y:{[CC.Backward]:!1,[CC.Forward]:!1}};function aw(e){let{delta:t,disabled:n}=e,r=xS(t);return yS(e=>{if(n||!r||!e)return iw;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[CC.Backward]:e.x[CC.Backward]||i.x===-1,[CC.Forward]:e.x[CC.Forward]||i.x===1},y:{[CC.Backward]:e.y[CC.Backward]||i.y===-1,[CC.Forward]:e.y[CC.Forward]||i.y===1}}},[n,t,r])}function ow(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return yS(e=>t==null?null:r??e??null,[r,t])}function sw(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var cw;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(cw||={});var lw;(function(e){e.Optimized=`optimized`})(lw||={});var uw=new Map;function dw(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,Q.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,Q.useRef)(e),d=g(),f=vS(d),p=(0,Q.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,Q.useRef)(null),h=yS(t=>{if(d&&!n)return uw;if(!t||t===uw||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new PC(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,Q.useEffect)(()=>{u.current=e},[e]),(0,Q.useEffect)(()=>{d||p()},[n,d]),(0,Q.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,Q.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case cw.Always:return!1;case cw.BeforeDragging:return n;default:return!n}}}function fw(e,t){return yS(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function pw(e,t){return fw(e,t)}function mw(e){let{callback:t,disabled:n}=e,r=gS(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function hw(e){let{callback:t,disabled:n}=e,r=gS(t),i=(0,Q.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,Q.useEffect)(()=>()=>i?.disconnect(),[i]),i}function gw(e){return new PC(fC(e),e)}function _w(e,t,n){t===void 0&&(t=gw);let[r,i]=(0,Q.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=mw({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=hw({callback:a});return hS(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function vw(e){return oC(e,fw(e))}var yw=[];function bw(e){let t=(0,Q.useRef)(e),n=yS(n=>e?n&&n!==yw&&e&&t.current&&e.parentNode===t.current.parentNode?n:_C(e):yw,[e]);return(0,Q.useEffect)(()=>{t.current=e},[e]),n}function xw(e){let[t,n]=(0,Q.useState)(null),r=(0,Q.useRef)(e),i=(0,Q.useCallback)(e=>{let t=yC(e.target);t&&n(e=>e?(e.set(t,SC(t)),new Map(e)):null)},[]);return(0,Q.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=yC(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,SC(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{yC(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,Q.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>TS(e,t),JS):kC(e):JS,[e,t])}function Sw(e,t){t===void 0&&(t=[]);let n=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{n.current=null},t),(0,Q.useEffect)(()=>{let t=e!==JS;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?ES(e,n.current):JS}function Cw(e){(0,Q.useEffect)(()=>{if(!sS)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function ww(e,t){return(0,Q.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Tw(e){return(0,Q.useMemo)(()=>e?mC(e):null,[e])}var Ew=[];function Dw(e,t){t===void 0&&(t=fC);let[n]=e,r=Tw(n?uS(n):null),[i,a]=(0,Q.useState)(Ew);function o(){a(()=>e.length?e.map(e=>wC(e)?r:new PC(t(e),e)):Ew)}let s=hw({callback:o});return hS(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ow(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return fS(t)?t:e}function kw(e){let{measure:t}=e,[n,r]=(0,Q.useState)(null),i=hw({callback:(0,Q.useCallback)(e=>{for(let{target:n}of e)if(fS(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=bS((0,Q.useCallback)(e=>{let n=Ow(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,Q.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Aw=[{sensor:YC,options:{}},{sensor:WC,options:{}}],jw={current:{}},Mw={draggable:{measure:pC},droppable:{measure:pC,strategy:cw.WhileDragging,frequency:lw.Optimized},dragOverlay:{measure:fC}},Nw=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Pw={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nw,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:GS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mw,measureDroppableContainers:GS,windowRect:null,measuringScheduled:!1},Fw={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:GS,draggableNodes:new Map,over:null,measureDroppableContainers:GS},Iw=(0,Q.createContext)(Fw),Lw=(0,Q.createContext)(Pw);function Rw(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nw}}}function zw(e,t){switch(t.type){case WS.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case WS.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case WS.DragEnd:case WS.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case WS.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Nw(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case WS.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Nw(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case WS.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Nw(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Bw(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,Q.useContext)(Iw),a=xS(r),o=xS(n?.id);return(0,Q.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!OS(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=NS(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Vw(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Hw(e){return(0,Q.useMemo)(()=>({draggable:{...Mw.draggable,...e?.draggable},droppable:{...Mw.droppable,...e?.droppable},dragOverlay:{...Mw.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Uw(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,Q.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;hS(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=oC(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=vC(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Ww=(0,Q.createContext)({...JS,scaleX:1,scaleY:1}),Gw;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Gw||={});var Kw=(0,Q.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Aw,collisionDetection:o=iC,measuring:s,modifiers:c,...l}=e,[u,d]=(0,Q.useReducer)(zw,void 0,Rw),[f,p]=BS(),[m,h]=(0,Q.useState)(Gw.Uninitialized),g=m===Gw.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,Q.useRef)({initial:null,translated:null}),C=(0,Q.useMemo)(()=>_==null?null:{id:_,data:x?.data??jw,rect:S},[_,x]),w=(0,Q.useRef)(null),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=vS(l,Object.values(l)),A=CS(`DndDescribedBy`,t),j=(0,Q.useMemo)(()=>b.getEnabled(),[b]),M=Hw(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=dw(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=ow(v,_),L=(0,Q.useMemo)(()=>D?AS(D):null,[D]),R=xe(),z=pw(I,M.draggable.measure);Uw({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:M.draggable.measure});let B=_w(I,M.draggable.measure,z),V=_w(I?I.parentElement:null),H=(0,Q.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),U=b.getNodeFor(H.current.over?.id),W=kw({measure:M.dragOverlay.measure}),G=W.nodeRef.current??I,K=g?W.rect??B:null,ee=!!(W.nodeRef.current&&W.rect),q=vw(ee?null:B),te=Tw(G?uS(G):null),ne=bw(g?U??I:null),re=Dw(ne),ie=Vw(c,{transform:{x:y.x-q.x,y:y.y-q.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:B,containerNodeRect:V,draggingNodeRect:K,over:H.current.over,overlayNodeRect:W.rect,scrollableAncestors:ne,scrollableAncestorRects:re,windowRect:te}),ae=L?TS(L,y):null,oe=xw(ne),se=Sw(oe),ce=Sw(oe,[B]),le=TS(ie,se),ue=K?cC(K,ie):null,de=C&&ue?o({active:C,collisionRect:ue,droppableRects:N,droppableContainers:j,pointerCoordinates:ae}):null,fe=$S(de,`id`),[pe,me]=(0,Q.useState)(null),he=aC(ee?ie:TS(ie,ce),pe?.rect??null,B),ge=(0,Q.useRef)(null),_e=(0,Q.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;ge.current=new n({active:w.current,activeNode:i,event:a,options:r,context:H,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,zi.unstable_batchedUpdates)(()=>{r?.(i),h(Gw.Initializing),d({type:WS.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(ge.current),O(a)})},onMove(e){d({type:WS.DragMove,coordinates:e})},onEnd:o(WS.DragEnd),onCancel:o(WS.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=H.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===WS.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=WS.DragCancel)}w.current=null,(0,zi.unstable_batchedUpdates)(()=>{d({type:e}),h(Gw.Uninitialized),me(null),E(null),O(null),ge.current=null;let t=e===WS.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ve=sw(a,(0,Q.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,_e(n,t))},[v,_e]));Cw(a),hS(()=>{B&&m===Gw.Initializing&&h(Gw.Initialized)},[B,m]),(0,Q.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=H.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:le.x,y:le.y},over:i};(0,zi.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[le.x,le.y]),(0,Q.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=H.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(fe),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,zi.unstable_batchedUpdates)(()=>{me(s),a?.(c),f({type:`onDragOver`,event:c})})},[fe]),hS(()=>{H.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ue,collisions:de,droppableRects:N,draggableNodes:v,draggingNode:G,draggingNodeRect:K,droppableContainers:b,over:pe,scrollableAncestors:ne,scrollAdjustedTranslate:le},S.current={initial:K,translated:ue}},[C,I,de,ue,v,G,K,N,b,pe,ne,le]),rw({...R,delta:y,draggingRect:ue,pointerCoordinates:ae,scrollableAncestors:ne,scrollableAncestorRects:re});let ye=(0,Q.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:B,activatorEvent:D,collisions:de,containerNodeRect:V,dragOverlay:W,draggableNodes:v,droppableContainers:b,droppableRects:N,over:pe,measureDroppableContainers:P,scrollableAncestors:ne,scrollableAncestorRects:re,measuringConfiguration:M,measuringScheduled:F,windowRect:te}),[C,I,B,D,de,V,W,v,b,N,pe,P,ne,re,M,F,te]),be=(0,Q.useMemo)(()=>({activatorEvent:D,activators:ve,active:C,activeNodeRect:B,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:pe,measureDroppableContainers:P}),[D,ve,C,B,d,A,v,pe,P]);return Q.createElement(RS.Provider,{value:p},Q.createElement(Iw.Provider,{value:be},Q.createElement(Lw.Provider,{value:ye},Q.createElement(Ww.Provider,{value:he},i)),Q.createElement(Bw,{disabled:n?.restoreFocus===!1})),Q.createElement(US,{...n,hiddenTextDescribedById:A}));function xe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),qw=(0,Q.createContext)(null),Jw=`button`,Yw=`Draggable`;function Xw(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=CS(Yw),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,Q.useContext)(Iw),{role:p=Jw,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,Q.useContext)(g?Ww:qw),[v,y]=bS(),[b,x]=bS(),S=ww(o,t),C=vS(n);return hS(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,Q.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Jw?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Zw(){return(0,Q.useContext)(Lw)}var Qw=`Droppable`,$w={timeout:25};function eT(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=CS(Qw),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,Q.useContext)(Iw),u=(0,Q.useRef)({disabled:n}),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...$w,...i},_=vS(h??r),v=hw({callback:(0,Q.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=bS((0,Q.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=vS(t);return(0,Q.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,Q.useEffect)(()=>(s({type:WS.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:WS.UnregisterDroppable,key:a,id:r})),[r]),(0,Q.useEffect)(()=>{n!==u.current.disabled&&(s({type:WS.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function tT(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function nT(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function rT(e){return e!==null&&e>=0}function iT(e,t){if(e===t)return!0;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 aT(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var oT=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=tT(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},sT={scaleX:1,scaleY:1},cT=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...sT}:null}let s=lT(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...sT}:r<t&&r>=a?{x:0,y:o.height+s,...sT}:{x:0,y:0,...sT}};function lT(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var uT=`Sortable`,dT=Q.createContext({activeIndex:-1,containerId:uT,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:oT,disabled:{draggable:!1,droppable:!1}});function fT(e){let{children:t,id:n,items:r,strategy:i=oT,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Zw(),d=CS(uT,n),f=s.rect!==null,p=(0,Q.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,Q.useRef)(p),v=!iT(p,_.current),y=g!==-1&&h===-1||v,b=aT(a);hS(()=>{v&&m&&u(p)},[v,p,m,u]),(0,Q.useEffect)(()=>{_.current=p},[p]);let x=(0,Q.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:nT(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return Q.createElement(dT.Provider,{value:x},t)}var pT=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return tT(n,r,i).indexOf(t)},mT=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},hT={duration:200,easing:`ease`},gT=`transform`,_T=jS.Transition.toString({property:gT,duration:0,easing:`linear`}),vT={roleDescription:`sortable`};function yT(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(n);return hS(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=fC(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,Q.useEffect)(()=>{a&&o(null)},[a]),a}function bT(e){let{animateLayoutChanges:t=mT,attributes:n,disabled:r,data:i,getNewIndex:a=pT,id:o,strategy:s,resizeObserverConfig:c,transition:l=hT}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,Q.useContext)(dT),y=xT(r,p),b=u.indexOf(o),x=(0,Q.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,Q.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=eT({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=Xw({id:o,data:x,attributes:{...vT,...n},disabled:y.draggable}),L=oS(E,j),R=!!D,z=R&&!m&&rT(f)&&rT(g),B=!_&&N,V=z?(B&&z?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,H=rT(f)&&rT(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,U=D?.id,W=(0,Q.useRef)({activeId:U,items:u,newIndex:H,containerId:d}),G=u!==W.current.items,K=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:l,wasDragging:W.current.activeId!=null}),ee=yT({disabled:!K,index:b,node:w,rect:C});return(0,Q.useEffect)(()=>{R&&W.current.newIndex!==H&&(W.current.newIndex=H),d!==W.current.containerId&&(W.current.containerId=d),u!==W.current.items&&(W.current.items=u)},[R,H,d,u]),(0,Q.useEffect)(()=>{if(U===W.current.activeId)return;if(U!=null&&W.current.activeId==null){W.current.activeId=U;return}let e=setTimeout(()=>{W.current.activeId=U},50);return()=>clearTimeout(e)},[U]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:H,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ee??V,transition:q()};function q(){if(ee||G&&W.current.newIndex===b)return _T;if(!(B&&!OS(O)||!l)&&(R||K))return jS.Transition.toString({...l,property:gT})}}function xT(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function ST(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var CT=[VC.Down,VC.Right,VC.Up,VC.Left],wT=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(CT.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case VC.Down:r.top<a.top&&t.push(n);break;case VC.Up:r.top>a.top&&t.push(n);break;case VC.Left:r.left>a.left&&t.push(n);break;case VC.Right:r.left<a.left&&t.push(n);break}});let c=nC({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=$S(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=_C(c).some((e,t)=>s[t]!==e),i=TT(e,t),a=ET(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:ES(u,l)}}}};function TT(e,t){return!ST(e)||!ST(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ET(e,t){return!ST(e)||!ST(t)||!TT(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var DT=365.2425,OT=6048e5,kT=864e5,AT=6e4,jT=36e5,MT=1e3,NT=3600*24;NT*7,NT*DT/12*3;var PT=Symbol.for(`constructDateFrom`);function FT(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&PT in e?e[PT](t):e instanceof Date?new e.constructor(t):new Date(t)}function IT(e,t){return FT(t||e,e)}function LT(e,t,n){let r=IT(e,n?.in);return isNaN(t)?FT(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function RT(e,t,n){let r=IT(e,n?.in);if(isNaN(t))return FT(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=FT(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 zT={};function BT(){return zT}function VT(e,t){let n=BT(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=IT(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 HT(e,t){return VT(e,{...t,weekStartsOn:1})}function UT(e,t){let n=IT(e,t?.in),r=n.getFullYear(),i=FT(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=HT(i),o=FT(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=HT(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function WT(e){let t=IT(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 GT(e,...t){let n=FT.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function KT(e,t){let n=IT(e,t?.in);return n.setHours(0,0,0,0),n}function qT(e,t,n){let[r,i]=GT(n?.in,e,t),a=KT(r),o=KT(i),s=+a-WT(a),c=+o-WT(o);return Math.round((s-c)/kT)}function JT(e,t){let n=UT(e,t),r=FT(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),HT(r)}function YT(e,t,n){return LT(e,t*7,n)}function XT(e,t,n){return RT(e,t*12,n)}function ZT(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=FT.bind(null,e));let t=IT(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),FT(r,n||NaN)}function QT(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=FT.bind(null,e));let t=IT(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),FT(r,n||NaN)}function $T(e,t,n){let[r,i]=GT(n?.in,e,t);return+KT(r)==+KT(i)}function eE(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function tE(e){return!(!eE(e)&&typeof e!=`number`||isNaN(+IT(e)))}function nE(e,t,n){let[r,i]=GT(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function rE(e,t){let n=IT(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function iE(e,t){let[n,r]=GT(e,t.start,t.end);return{start:n,end:r}}function aE(e,t){let{start:n,end:r}=iE(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(FT(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function oE(e,t){let n=IT(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function sE(e,t){let n=IT(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function cE(e,t){let n=IT(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function lE(e,t){let{start:n,end:r}=iE(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(FT(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function uE(e,t){let n=BT(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=IT(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 dE(e,t){return uE(e,{...t,weekStartsOn:1})}var fE={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`}},pE=(e,t,n)=>{let r,i=fE[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 mE(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var hE={date:mE({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:mE({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:mE({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},gE={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},_E=(e,t,n,r)=>gE[e];function vE(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 yE={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:vE({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:vE({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:vE({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:vE({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:vE({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 bE(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)?SE(s,e=>e.test(o)):xE(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 xE(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function SE(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function CE(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 wE={code:`en-US`,formatDistance:pE,formatLong:hE,formatRelative:_E,localize:yE,match:{ordinalNumber:CE({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:bE({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:bE({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:bE({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:bE({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:bE({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 TE(e,t){let n=IT(e,t?.in);return qT(n,cE(n))+1}function EE(e,t){let n=IT(e,t?.in),r=HT(n)-+JT(n);return Math.round(r/OT)+1}function DE(e,t){let n=IT(e,t?.in),r=n.getFullYear(),i=BT(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=FT(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=VT(o,t),c=FT(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=VT(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function OE(e,t){let n=BT(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=DE(e,t),a=FT(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),VT(a,t)}function kE(e,t){let n=IT(e,t?.in),r=VT(n,t)-+OE(n,t);return Math.round(r/OT)+1}function AE(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var jE={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return AE(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):AE(n+1,2)},d(e,t){return AE(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 AE(e.getHours()%12||12,t.length)},H(e,t){return AE(e.getHours(),t.length)},m(e,t){return AE(e.getMinutes(),t.length)},s(e,t){return AE(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return AE(Math.trunc(r*10**(n-3)),t.length)}},ME={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},NE={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 jE.y(e,t)},Y:function(e,t,n,r){let i=DE(e,r),a=i>0?i:1-i;return t===`YY`?AE(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):AE(a,t.length)},R:function(e,t){return AE(UT(e),t.length)},u:function(e,t){return AE(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 AE(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 AE(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 jE.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 AE(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=kE(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):AE(i,t.length)},I:function(e,t,n){let r=EE(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):AE(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):jE.d(e,t)},D:function(e,t,n){let r=TE(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):AE(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 AE(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 AE(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 AE(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?ME.noon:r===0?ME.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?ME.evening:r>=12?ME.afternoon:r>=4?ME.morning:ME.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 jE.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):jE.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):AE(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):AE(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):jE.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):jE.s(e,t)},S:function(e,t){return jE.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return FE(r);case`XXXX`:case`XX`:return IE(r);default:return IE(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return FE(r);case`xxxx`:case`xx`:return IE(r);default:return IE(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+PE(r,`:`);default:return`GMT`+IE(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+PE(r,`:`);default:return`GMT`+IE(r,`:`)}},t:function(e,t,n){return AE(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return AE(+e,t.length)}};function PE(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+AE(a,2)}function FE(e,t){return e%60==0?(e>0?`-`:`+`)+AE(Math.abs(e)/60,2):IE(e,t)}function IE(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=AE(Math.trunc(r/60),2),a=AE(r%60,2);return n+i+t+a}var LE=(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`})}},RE=(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`})}},zE={p:RE,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return LE(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}}`,LE(r,t)).replace(`{{time}}`,RE(i,t))}},BE=/^D+$/,VE=/^Y+$/,HE=[`D`,`DD`,`YY`,`YYYY`];function UE(e){return BE.test(e)}function WE(e){return VE.test(e)}function GE(e,t,n){let r=KE(e,t,n);if(console.warn(r),HE.includes(e))throw RangeError(r)}function KE(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 qE=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,JE=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,YE=/^'([^]*?)'?$/,XE=/''/g,ZE=/[a-zA-Z]/;function QE(e,t,n){let r=BT(),i=n?.locale??r.locale??wE,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=IT(e,n?.in);if(!tE(s))throw RangeError(`Invalid time value`);let c=t.match(JE).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=zE[t];return n(e,i.formatLong)}return e}).join(``).match(qE).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:$E(e)};if(NE[t])return{isToken:!0,value:e};if(t.match(ZE))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&&WE(a)||!n?.useAdditionalDayOfYearTokens&&UE(a))&&GE(a,t,String(e));let o=NE[a[0]];return o(s,a,i.localize,l)}).join(``)}function $E(e){let t=e.match(YE);return t?t[1].replace(XE,`'`):e}function eD(e,t){let n=IT(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=FT(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function tD(){return Object.assign({},BT())}function nD(e,t){let n=IT(e,t?.in).getDay();return n===0?7:n}function rD(e,t){return IT(e,t?.in).getMonth()}function iD(e,t){return IT(e,t?.in).getFullYear()}function aD(e,t){return+IT(e)>+IT(t)}function oD(e,t){return+IT(e)<+IT(t)}function sD(e,t){let n=cD(t)?new t(0):FT(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function cD(e){return typeof e==`function`&&e.prototype?.constructor===e}var lD=10,uD=class{subPriority=0;validate(e,t){return!0}},dD=class extends uD{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)}},fD=class extends uD{priority=lD;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>FT(t,e))}set(e,t){return t.timestampIsSet?e:FT(e,sD(e,this.context))}},pD=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new dD(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},mD=class extends pD{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`]},hD={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}/},gD={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 _D(e,t){return e&&{value:t(e.value),rest:e.rest}}function vD(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function yD(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*jT+a*AT+o*MT),rest:t.slice(n[0].length)}}function bD(e){return vD(hD.anyDigitsSigned,e)}function xD(e,t){switch(e){case 1:return vD(hD.singleDigit,t);case 2:return vD(hD.twoDigits,t);case 3:return vD(hD.threeDigits,t);case 4:return vD(hD.fourDigits,t);default:return vD(RegExp(`^\\d{1,`+e+`}`),t)}}function SD(e,t){switch(e){case 1:return vD(hD.singleDigitSigned,t);case 2:return vD(hD.twoDigitsSigned,t);case 3:return vD(hD.threeDigitsSigned,t);case 4:return vD(hD.fourDigitsSigned,t);default:return vD(RegExp(`^-?\\d{1,`+e+`}`),t)}}function CD(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function wD(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 TD(e){return e%400==0||e%4==0&&e%100!=0}var ED=class extends pD{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 _D(xD(4,e),r);case`yo`:return _D(n.ordinalNumber(e,{unit:`year`}),r);default:return _D(xD(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=wD(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}},DD=class extends pD{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return _D(xD(4,e),r);case`Yo`:return _D(n.ordinalNumber(e,{unit:`year`}),r);default:return _D(xD(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=DE(e,r);if(n.isTwoDigitYear){let t=wD(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),VT(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),VT(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},OD=class extends pD{priority=130;parse(e,t){return SD(t===`R`?4:t.length,e)}set(e,t,n){let r=FT(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),HT(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},kD=class extends pD{priority=130;parse(e,t){return SD(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`]},AD=class extends pD{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return xD(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`]},jD=class extends pD{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return xD(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`]},MD=class extends pD{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 _D(vD(hD.month,e),r);case`MM`:return _D(xD(2,e),r);case`Mo`:return _D(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}},ND=class extends pD{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return _D(vD(hD.month,e),r);case`LL`:return _D(xD(2,e),r);case`Lo`:return _D(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 PD(e,t,n){let r=IT(e,n?.in),i=kE(r,n)-t;return r.setDate(r.getDate()-i*7),IT(r,n?.in)}var FD=class extends pD{priority=100;parse(e,t,n){switch(t){case`w`:return vD(hD.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return xD(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return VT(PD(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function ID(e,t,n){let r=IT(e,n?.in),i=EE(r,n)-t;return r.setDate(r.getDate()-i*7),r}var LD=class extends pD{priority=100;parse(e,t,n){switch(t){case`I`:return vD(hD.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return xD(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return HT(ID(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},RD=[31,28,31,30,31,30,31,31,30,31,30,31],zD=[31,29,31,30,31,30,31,31,30,31,30,31],BD=class extends pD{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return vD(hD.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return xD(t.length,e)}}validate(e,t){let n=TD(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=zD[r]:t>=1&&t<=RD[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`]},VD=class extends pD{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return vD(hD.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return xD(t.length,e)}}validate(e,t){return TD(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 HD(e,t,n){let r=BT(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=IT(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return LT(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var UD=class extends pD{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=HD(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},WD=class extends pD{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 _D(xD(t.length,e),i);case`eo`:return _D(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=HD(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`]},GD=class extends pD{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 _D(xD(t.length,e),i);case`co`:return _D(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=HD(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 KD(e,t,n){let r=IT(e,n?.in);return LT(r,t-nD(r,n),n)}var qD=class extends pD{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return xD(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return _D(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 _D(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return _D(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return _D(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=KD(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`]},JD=class extends pD{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(CD(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},YD=class extends pD{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(CD(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},XD=class extends pD{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(CD(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},ZD=class extends pD{priority=70;parse(e,t,n){switch(t){case`h`:return vD(hD.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return xD(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`]},QD=class extends pD{priority=70;parse(e,t,n){switch(t){case`H`:return vD(hD.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return xD(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`]},$D=class extends pD{priority=70;parse(e,t,n){switch(t){case`K`:return vD(hD.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return xD(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`]},eO=class extends pD{priority=70;parse(e,t,n){switch(t){case`k`:return vD(hD.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return xD(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`]},tO=class extends pD{priority=60;parse(e,t,n){switch(t){case`m`:return vD(hD.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return xD(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`]},nO=class extends pD{priority=50;parse(e,t,n){switch(t){case`s`:return vD(hD.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return xD(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},rO=class extends pD{priority=30;parse(e,t){return _D(xD(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},iO=class extends pD{priority=10;parse(e,t){switch(t){case`X`:return yD(gD.basicOptionalMinutes,e);case`XX`:return yD(gD.basic,e);case`XXXX`:return yD(gD.basicOptionalSeconds,e);case`XXXXX`:return yD(gD.extendedOptionalSeconds,e);default:return yD(gD.extended,e)}}set(e,t,n){return t.timestampIsSet?e:FT(e,e.getTime()-WT(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},aO=class extends pD{priority=10;parse(e,t){switch(t){case`x`:return yD(gD.basicOptionalMinutes,e);case`xx`:return yD(gD.basic,e);case`xxxx`:return yD(gD.basicOptionalSeconds,e);case`xxxxx`:return yD(gD.extendedOptionalSeconds,e);default:return yD(gD.extended,e)}}set(e,t,n){return t.timestampIsSet?e:FT(e,e.getTime()-WT(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},oO=class extends pD{priority=40;parse(e){return bD(e)}set(e,t,n){return[FT(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},sO=class extends pD{priority=20;parse(e){return bD(e)}set(e,t,n){return[FT(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},cO={G:new mD,y:new ED,Y:new DD,R:new OD,u:new kD,Q:new AD,q:new jD,M:new MD,L:new ND,w:new FD,I:new LD,d:new BD,D:new VD,E:new UD,e:new WD,c:new GD,i:new qD,a:new JD,b:new YD,B:new XD,h:new ZD,H:new QD,K:new $D,k:new eO,m:new tO,s:new nO,S:new rO,X:new iO,x:new aO,t:new oO,T:new sO},lO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,uO=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dO=/^'([^]*?)'?$/,fO=/''/g,pO=/\S/,mO=/[a-zA-Z]/;function hO(e,t,n,r){let i=()=>FT(r?.in||n,NaN),a=tD(),o=r?.locale??a.locale??wE,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():IT(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new fD(r?.in,n)],d=t.match(uO).map(e=>{let t=e[0];if(t in zE){let n=zE[t];return n(e,o.formatLong)}return e}).join(``).match(lO),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&WE(n)&&GE(n,t,e),!r?.useAdditionalDayOfYearTokens&&UE(n)&&GE(n,t,e);let a=n[0],s=cO[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(mO))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=gO(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&pO.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=IT(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 gO(e){return e.match(dO)[1].replace(fO,`'`)}function _O(e,t,n){let[r,i]=GT(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function vO(e,t,n){let[r,i]=GT(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function yO(e,t){let n=()=>FT(t?.in,NaN),r=t?.additionalDigits??2,i=wO(e),a;if(i.date){let e=TO(i.date,r);a=EO(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=OO(i.time),isNaN(s)))return n();if(i.timezone){if(c=AO(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=IT(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return IT(o+s+c,t?.in)}var bO={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},xO=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,SO=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,CO=/^([+-])(\d{2})(?::?(\d{2}))?$/;function wO(e){let t={},n=e.split(bO.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],bO.timeZoneDelimiter.test(t.date)&&(t.date=e.split(bO.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=bO.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function TO(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 EO(e,t){if(t===null)return new Date(NaN);let n=e.match(xO);if(!n)return new Date(NaN);let r=!!n[4],i=DO(n[1]),a=DO(n[2])-1,o=DO(n[3]),s=DO(n[4]),c=DO(n[5])-1;if(r)return IO(t,s,c)?jO(t,s,c):new Date(NaN);{let e=new Date(0);return!PO(t,a,o)||!FO(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function DO(e){return e?parseInt(e):1}function OO(e){let t=e.match(SO);if(!t)return NaN;let n=kO(t[1]),r=kO(t[2]),i=kO(t[3]);return LO(n,r,i)?n*jT+r*AT+i*1e3:NaN}function kO(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function AO(e){if(e===`Z`)return 0;let t=e.match(CO);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return RO(r,i)?n*(r*jT+i*AT):NaN}function jO(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 MO=[31,null,31,30,31,30,31,31,30,31,30,31];function NO(e){return e%400==0||e%4==0&&e%100!=0}function PO(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(MO[t]||(NO(e)?29:28))}function FO(e,t){return t>=1&&t<=(NO(e)?366:365)}function IO(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function LO(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function RO(e,t){return t>=0&&t<=59}function zO(e,t,n){let r=IT(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=FT(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=eD(o);return r.setMonth(t,Math.min(a,s)),r}function BO(e,t,n){let r=IT(e,n?.in);return isNaN(+r)?FT(n?.in||e,NaN):(r.setFullYear(t),r)}function VO(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 HO={},UO={};function WO(e,t){try{let n=(HO[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in UO?UO[n]:KO(n,n.split(`:`))}catch{if(e in UO)return UO[e];let t=e?.match(GO);return t?KO(e,t.slice(1)):NaN}}var GO=/([+-]\d\d):?(\d\d)?/;function KO(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return UO[e]=n*60+r>0?n*60+r+i:n*60-r-i}var qO=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(WO(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)),ZO(this,NaN),YO(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=-WO(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),YO(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},JO=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!JO.test(e))return;let t=e.replace(JO,`$1UTC`);qO.prototype[t]&&(e.startsWith(`get`)?qO.prototype[e]=function(){return this.internal[t]()}:(qO.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),XO(this),+this},qO.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),YO(this),+this}))});function YO(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-WO(e.timeZone,e)*60))}function XO(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()),ZO(e)}function ZO(e){let t=WO(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(-(WO(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=WO(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=WO(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 QO=class e extends qO{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} (${VO(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)}},$O=5,ek=4;function tk(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,$O*7-1);return t.getMonth(e)===t.getMonth(a)?$O:ek}function nk(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 rk(e,t){let n=nk(e,t),r=tk(e,t);return t.addDays(n,r*7-1)}var ik={...wE,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>QE(e,t,{locale:wE,...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)=>QE(e,n,{locale:wE,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>QE(e,t,{locale:wE,...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)=>QE(e,n,{locale:wE,...t}),r(e,`cccc`)}}},ak=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?QO.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 QO(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):LT(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):RT(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):YT(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):XT(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):qT(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):nE(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):aE(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):lE(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):rk(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):dE(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):rE(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):uE(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):sE(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):QE(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):EE(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):rD(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):iD(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):kE(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):aD(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):oD(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):eE(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):$T(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):_O(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):vO(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):ZT(e),this.min=e=>this.overrides?.min?this.overrides.min(e):QT(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):zO(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):BO(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):nk(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):KT(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):HT(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):oE(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):VT(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):cE(e),this.options={locale:ik,...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)}};ak.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 ok=new ak,sk=class{constructor(e,t,n=ok){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)}},ck=class{constructor(e,t){this.date=e,this.weeks=t}},lk=class{constructor(e,t){this.days=t,this.weekNumber=e}};function uk(e){return Q.createElement(`button`,{...e})}function dk(e){return Q.createElement(`span`,{...e})}function fk(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 pk(e){let{day:t,modifiers:n,...r}=e;return Q.createElement(`td`,{...r})}function mk(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 hk;(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`})(hk||={});var gk;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(gk||={});var _k;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(_k||={});var vk;(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`})(vk||={});function yk(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[hk.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return Q.createElement(`span`,{"data-disabled":a.disabled,className:i[hk.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[hk.CaptionLabel],"aria-hidden":!0},s?.label,Q.createElement(r.Chevron,{orientation:`down`,size:18,className:i[hk.Chevron]})))}function bk(e){return Q.createElement(`div`,{...e})}function xk(e){return Q.createElement(`div`,{...e})}function Sk(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r},e.children)}function Ck(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r})}function wk(e){return Q.createElement(`table`,{...e})}function Tk(e){return Q.createElement(`div`,{...e})}var Ek=(0,Q.createContext)(void 0);function Dk(){let e=(0,Q.useContext)(Ek);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function Ok(e){let{components:t}=Dk();return Q.createElement(t.Dropdown,{...e})}function kk(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=Dk(),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[hk.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[hk.Chevron],orientation:`left`})),Q.createElement(o.NextMonthButton,{type:`button`,className:s[hk.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[hk.Chevron]})))}function Ak(e){let{components:t}=Dk();return Q.createElement(t.Button,{...e})}function jk(e){return Q.createElement(`option`,{...e})}function Mk(e){let{components:t}=Dk();return Q.createElement(t.Button,{...e})}function Nk(e){let{rootRef:t,...n}=e;return Q.createElement(`div`,{...n,ref:t})}function Pk(e){return Q.createElement(`select`,{...e})}function Fk(e){let{week:t,...n}=e;return Q.createElement(`tr`,{...n})}function Ik(e){return Q.createElement(`th`,{...e})}function Lk(e){return Q.createElement(`thead`,{"aria-hidden":!0},Q.createElement(`tr`,{...e}))}function Rk(e){let{week:t,...n}=e;return Q.createElement(`th`,{...n})}function zk(e){return Q.createElement(`th`,{...e})}function Bk(e){return Q.createElement(`tbody`,{...e})}function Vk(e){let{components:t}=Dk();return Q.createElement(t.Dropdown,{...e})}var Hk=e({Button:()=>uk,CaptionLabel:()=>dk,Chevron:()=>fk,Day:()=>pk,DayButton:()=>mk,Dropdown:()=>yk,DropdownNav:()=>bk,Footer:()=>xk,Month:()=>Sk,MonthCaption:()=>Ck,MonthGrid:()=>wk,Months:()=>Tk,MonthsDropdown:()=>Ok,Nav:()=>kk,NextMonthButton:()=>Ak,Option:()=>jk,PreviousMonthButton:()=>Mk,Root:()=>Nk,Select:()=>Pk,Week:()=>Fk,WeekNumber:()=>Rk,WeekNumberHeader:()=>zk,Weekday:()=>Ik,Weekdays:()=>Lk,Weeks:()=>Bk,YearsDropdown:()=>Vk});function Uk(e,t,n=!1,r=ok){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 Wk(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function Gk(e){return!!(e&&typeof e==`object`&&`from`in e)}function Kk(e){return!!(e&&typeof e==`object`&&`after`in e)}function qk(e){return!!(e&&typeof e==`object`&&`before`in e)}function Jk(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Yk(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Xk(e,t,n=ok){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(Yk(t,n))return t.some(t=>i(e,t));if(Gk(t))return Uk(t,e,!1,n);if(Jk(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Wk(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 Kk(t)?a(e,t.after)>0:qk(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function Zk(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={[gk.focused]:[],[gk.outside]:[],[gk.disabled]:[],[gk.hidden]:[],[gk.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&&Xk(e,a,i)),S=!!(o&&Xk(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&&Xk(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[gk.focused]:!1,[gk.disabled]:!1,[gk.hidden]:!1,[gk.outside]:!1,[gk.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 Qk(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[gk[r]]?e.push(t[gk[r]]):t[_k[r]]&&e.push(t[_k[r]]),e),[t[hk.Day]])}function $k(e){return{...Hk,...e}}function eA(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 tA(){let e={};for(let t in hk)e[hk[t]]=`rdp-${hk[t]}`;for(let t in gk)e[gk[t]]=`rdp-${gk[t]}`;for(let t in _k)e[_k[t]]=`rdp-${_k[t]}`;for(let t in vk)e[vk[t]]=`rdp-${vk[t]}`;return e}function nA(e,t,n){return(n??new ak(t)).formatMonthYear(e)}var rA=nA;function iA(e,t,n){return(n??new ak(t)).format(e,`d`)}function aA(e,t=ok){return t.format(e,`LLLL`)}function oA(e,t,n){return(n??new ak(t)).format(e,`cccccc`)}function sA(e,t=ok){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function cA(){return``}function lA(e,t=ok){return t.format(e,`yyyy`)}var uA=lA,dA=e({formatCaption:()=>nA,formatDay:()=>iA,formatMonthCaption:()=>rA,formatMonthDropdown:()=>aA,formatWeekNumber:()=>sA,formatWeekNumberHeader:()=>cA,formatWeekdayName:()=>oA,formatYearCaption:()=>uA,formatYearDropdown:()=>lA});function fA(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...dA,...e}}function pA(e,t,n,r){let i=(r??new ak(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var mA=pA;function hA(e,t,n){return(n??new ak(t)).formatMonthYear(e)}var gA=hA;function _A(e,t,n,r){let i=(r??new ak(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function vA(e){return`Choose the Month`}function yA(){return``}var bA=`Go to the Next Month`;function xA(e,t){return bA}function SA(e){return`Go to the Previous Month`}function CA(e,t,n){return(n??new ak(t)).format(e,`cccc`)}function wA(e,t){return`Week ${e}`}function TA(e){return`Week Number`}function EA(e){return`Choose the Year`}var DA=e({labelCaption:()=>gA,labelDay:()=>mA,labelDayButton:()=>pA,labelGrid:()=>hA,labelGridcell:()=>_A,labelMonthDropdown:()=>vA,labelNav:()=>yA,labelNext:()=>xA,labelPrevious:()=>SA,labelWeekNumber:()=>wA,labelWeekNumberHeader:()=>TA,labelWeekday:()=>CA,labelYearDropdown:()=>EA}),OA=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function kA(e,t){let n=t.locale?.labels??{};return{...DA,...e??{},labelDayButton:OA(pA,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:OA(vA,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:OA(xA,e?.labelNext,n.labelNext),labelPrevious:OA(SA,e?.labelPrevious,n.labelPrevious),labelWeekNumber:OA(wA,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:OA(EA,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:OA(hA,e?.labelGrid,n.labelGrid),labelGridcell:OA(_A,e?.labelGridcell,n.labelGridcell),labelNav:OA(yA,e?.labelNav,n.labelNav),labelWeekNumberHeader:OA(TA,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:OA(CA,e?.labelWeekday,n.labelWeekday)}}function AA(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 jA(e,t={},n={}){let r={...t?.[hk.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function MA(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 NA(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 PA(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 QO(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(QO.tz(e)),newDate:(t,n,r)=>new QO(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 QO(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 QO(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 QO(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new QO(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>kE(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>EE(o(e)),differenceInCalendarDays:(e,t)=>qT(o(e),o(t)),differenceInCalendarMonths:(e,t)=>nE(o(e),o(t))}}var FA=e=>e instanceof HTMLElement?e:null,IA=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],LA=e=>FA(e.querySelector(`[data-animated-month]`)),RA=e=>FA(e.querySelector(`[data-animated-caption]`)),zA=e=>FA(e.querySelector(`[data-animated-weeks]`)),BA=e=>FA(e.querySelector(`[data-animated-nav]`)),VA=e=>FA(e.querySelector(`[data-animated-weekdays]`));function HA(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[vk.caption_after_enter]:n[vk.caption_before_enter],p=d?n[vk.weeks_after_enter]:n[vk.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(IA(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=LA(e);t&&e.contains(t)&&e.removeChild(t);let n=RA(e);n&&n.classList.remove(f);let r=zA(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?IA(m):[],_=IA(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=BA(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=RA(i);s&&s.classList.add(f);let l=zA(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=VA(o);m&&(m.style.opacity=`0`);let h=RA(o);h&&(h.classList.add(d?n[vk.caption_before_exit]:n[vk.caption_after_exit]),h.addEventListener(`animationend`,u));let _=zA(o);_&&_.classList.add(d?n[vk.weeks_before_exit]:n[vk.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function UA(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 WA(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 GA(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 KA(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 qA(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 ck(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new sk(t,m,r);return a?a.days.push(o):e.push(new lk(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function JA(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 YA(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 XA(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 ZA(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function QA(e,t){let[n,r]=(0,Q.useState)(e);return[t===void 0?n:t,r]}function $A(e,t){let[n,r]=JA(e,t),{startOfMonth:i,endOfMonth:a}=t,o=KA(e,n,r,t),[s,c]=QA(o,e.month?o:void 0);(0,Q.useEffect)(()=>{c(KA(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,Q.useMemo)(()=>{let i=GA(s,r,{numberOfMonths:e.numberOfMonths},t),o=qA(i,UA(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:ZA(o),days:WA(o),previousMonth:XA(s,n,e,t),nextMonth:YA(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 ej;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(ej||={});function tj(e){return!e[gk.disabled]&&!e[gk.hidden]&&!e[gk.outside]}function nj(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);tj(e)&&(e[gk.focused]&&a<ej.FocusedModifier?(i=o,a=ej.FocusedModifier):r?.isEqualTo(o)&&a<ej.LastFocused?(i=o,a=ej.LastFocused):n(o.date)&&a<ej.Selected?(i=o,a=ej.Selected):e[gk.today]&&a<ej.Today&&(i=o,a=ej.Today))}return i||=e.find(e=>tj(t(e))),i}function rj(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 ij(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=rj(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Xk(c,a.disabled,o)),u=!!(a.hidden&&Xk(c,a.hidden,o)),d=new sk(c,c,o);return!l&&!u?d:ij(e,t,d,r,i,a,o,s+1)}function aj(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,Q.useState)(),c=nj(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=ij(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 oj(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=QA(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 sj(e,t,n=0,r=0,i=!1,a=ok){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 cj(e,t,n=ok){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 lj(e,t,n=ok){return Uk(e,t.from,!1,n)||Uk(e,t.to,!1,n)||Uk(t,e.from,!1,n)||Uk(t,e.to,!1,n)}function uj(e,t,n=ok){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Uk(e,t,!1,n):Yk(t,n)?t.some(t=>Uk(e,t,!1,n)):Gk(t)?t.from&&t.to?lj(e,{from:t.from,to:t.to},n):!1:Jk(t)?cj(e,t.dayOfWeek,n):Wk(t)?n.isAfter(t.before,t.after)?lj(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Xk(e.from,t,n)||Xk(e.to,t,n):Kk(t)||qk(t)?Xk(e.from,t,n)||Xk(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 dj(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=QA(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}:sj(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&uj({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&&Uk(u,e,!1,t)}}function fj(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=QA(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 pj(e,t){let n=fj(e,t),r=oj(e,t),i=dj(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function mj(e,t){return e instanceof QO&&e.timeZone===t?e:new QO(e,t)}function hj(e,t,n){if(!n)return mj(e,t);let r=mj(e,t),i=new QO(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function gj(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?hj(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?hj(e,t,n):e):Gk(e)?{...e,from:e.from?mj(e.from,t):e.from,to:e.to?mj(e.to,t):e.to}:Wk(e)?{before:hj(e.before,t,n),after:hj(e.after,t,n)}:Kk(e)?{after:hj(e.after,t,n)}:qk(e)?{before:hj(e.before,t,n)}:e}function _j(e,t,n){return e&&(Array.isArray(e)?e.map(e=>gj(e,t,n)):gj(e,t,n))}function vj(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=mj(t.today,n),t.month&&=mj(t.month,n),t.defaultMonth&&=mj(t.defaultMonth,n),t.startMonth&&=mj(t.startMonth,n),t.endMonth&&=mj(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=mj(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>mj(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?mj(t.selected.from,n):t.selected.from,to:t.selected.to?mj(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=_j(t.disabled,n)),t.hidden!==void 0&&(t.hidden=_j(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=_j(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={...ik,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?PA(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new ak({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:$k(t.components),formatters:fA(t.formatters),labels:kA(t.labels,a.options),locale:e,classNames:{...tA(),...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=$A(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:L}=A,R=Zk(j,t,N,P,o),{isSelected:z,select:B,selected:V}=pj(t,o)??{},{blur:H,focused:U,isFocusTarget:W,moveFocus:G,setFocused:K}=aj(t,A,R,z??(()=>!1),o),{labelDayButton:ee,labelGridcell:q,labelGrid:te,labelMonthDropdown:ne,labelNav:re,labelPrevious:ie,labelNext:ae,labelWeekday:oe,labelWeekNumber:se,labelWeekNumberHeader:ce,labelYearDropdown:le}=a,ue=(0,Q.useMemo)(()=>MA(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[hk.Root],t.className].filter(Boolean).join(` `),style:{...S?.[hk.Root],...t.style}}),[c,t.className,t.style,S]),we=eA(t),Te=(0,Q.useRef)(null);HA(Te,!!t.animate,{classNames:c,months:M,focused:U,dateLib:o});let Ee={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(Ek.Provider,{value:Ee},Q.createElement(r.Root,{rootRef:t.animate?Te: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[hk.Months],style:S?.[hk.Months]},!t.hideNavigation&&!d&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[hk.Nav],style:S?.[hk.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[hk.Month],style:S?.[hk.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&Q.createElement(r.PreviousMonthButton,{type:`button`,className:c[hk.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[hk.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),Q.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[hk.MonthCaption],style:S?.[hk.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?Q.createElement(r.DropdownNav,{className:c[hk.Dropdowns],style:S?.[hk.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?Q.createElement(r.MonthsDropdown,{key:`month`,className:c[hk.MonthsDropdown],"aria-label":ne(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:be(e.date),options:AA(e.date,N,P,i,o),style:S?.[hk.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[hk.YearsDropdown],"aria-label":le(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:xe(e.date),options:NA(N,P,i,o,!!t.reverseYears),style:S?.[hk.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[hk.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[hk.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[hk.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[hk.Nav],style:S?.[hk.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[hk.MonthGrid],style:S?.[hk.MonthGrid]},!t.hideWeekdays&&Q.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[hk.Weekdays],style:S?.[hk.Weekdays]},x&&Q.createElement(r.WeekNumberHeader,{"aria-label":ce(o.options),className:c[hk.WeekNumberHeader],style:S?.[hk.WeekNumberHeader],scope:`col`},D()),ue.map(e=>Q.createElement(r.Weekday,{"aria-label":oe(e,o.options,o),className:c[hk.Weekday],key:String(e),style:S?.[hk.Weekday],scope:`col`},O(e,o.options,o)))),Q.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[hk.Weeks],style:S?.[hk.Weeks]},e.weeks.map(e=>Q.createElement(r.Week,{className:c[hk.Week],key:e.weekNumber,style:S?.[hk.Week],week:e},x&&Q.createElement(r.WeekNumber,{week:e,style:S?.[hk.WeekNumber],"aria-label":se(e.weekNumber,{locale:s}),className:c[hk.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=R(e);if(i[gk.focused]=!i.hidden&&!!U?.isEqualTo(e),i[_k.selected]=z?.(n)||i.selected,Gk(V)){let{from:e,to:t}=V;i[_k.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[_k.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[_k.range_middle]=Uk(V,n,!0,o)}let a=jA(i,S,t.modifiersStyles),s=Qk(i,c,t.modifiersClassNames),l=!de&&!i.hidden?q(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[hk.DayButton],style:S?.[hk.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":ee(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[hk.Footer],style:S?.[hk.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function yj(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=tA();m=vj,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(St({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_previous),W=Y(St({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)(Cj,{locale:o,...t})},t[82]=o,t[83]=K);let ee;t[84]!==i||t[85]!==K?(ee={Root:Sj,Chevron:xj,DayButton:K,WeekNumber:bj,...i},t[84]=i,t[85]=K,t[86]=ee):ee=t[86];let q;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]!==ee?(q=(0,Z.jsx)(m,{showOutsideDays:P,className:F,captionLayout:I,locale:L,formatters:R,classNames:G,components:ee,...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]=ee,t[96]=q):q=t[96],q}function bj(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 xj(e){let{className:t,orientation:n,...r}=e;return n===`left`?(0,Z.jsx)(Wi,{className:Y(`size-4`,t),...r}):n===`right`?(0,Z.jsx)(Kt,{className:Y(`size-4`,t),...r}):(0,Z.jsx)(nn,{className:Y(`size-4`,t),...r})}function Sj(e){let{className:t,rootRef:n,...r}=e;return(0,Z.jsx)(`div`,{"data-slot":`calendar`,ref:n,className:Y(t),...r})}function Cj(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=tA(),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 wj(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(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 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)(wo,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Z.jsx)(pr,{})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(So,{"data-slot":`checkbox`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Tj(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.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)(Gn,{"data-testid":`text-widget`,"data-key":n,type:`text`,value:a,placeholder:`Empty`,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`h-7 border-transparent dark:bg-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 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 Ej(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)(Gn,{"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 Dj(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)(wj,{"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 Oj(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=Aj(r),o=Q.useState,s=jj(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=Aj(r);l(jj(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=Nj(c);if(e){let t=QE(e,`yyyy-MM-dd`);t!==r&&i(t),l(jj(e)),d(e)}else l(jj(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=QE(e,`yyyy-MM-dd`);t!==r&&i(t),l(jj(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=Nj(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 E;t[19]!==y||t[20]!==a?(E=e=>{e.key===`Enter`?(e.preventDefault(),y(),e.currentTarget.blur()):e.key===`Escape`?(e.preventDefault(),h.current=!0,l(jj(a)),e.currentTarget.blur()):e.key===`ArrowDown`&&(e.preventDefault(),p(!0))},t[19]=y,t[20]=a,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==T||t[24]!==E||t[25]!==S?(D=(0,Z.jsx)(Gn,{type:`text`,value:c,placeholder:`Empty`,"aria-label":S,onChange:C,onFocus:w,onBlur:T,onKeyDown:E,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]=E,t[25]=S,t[26]=D):D=t[26];let O=`Open date picker for ${n}`,k;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Hi,{className:`size-3.5`}),t[27]=k):k=t[27];let A;t[28]===O?A=t[29]:(A=(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":O,className:`absolute right-0 size-6 p-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:k})}),t[28]=O,t[29]=A);let j;t[30]!==a||t[31]!==x||t[32]!==u?(j=(0,Z.jsx)(On,{className:`w-auto overflow-hidden p-0`,align:`end`,children:(0,Z.jsx)(yj,{mode:`single`,selected:a,month:u,onMonthChange:d,onSelect:x,captionLayout:`dropdown`})}),t[30]=a,t[31]=x,t[32]=u,t[33]=j):j=t[33];let M;t[34]!==f||t[35]!==A||t[36]!==j?(M=(0,Z.jsxs)(Zt,{open:f,onOpenChange:p,children:[A,j]}),t[34]=f,t[35]=A,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==n||t[39]!==D||t[40]!==M?(N=(0,Z.jsxs)(`div`,{"data-testid":`date-widget`,"data-key":n,className:`relative flex h-7 items-center`,children:[D,M]}),t[38]=n,t[39]=D,t[40]=M,t[41]=N):N=t[41],N}var kj=`MMM d, yyyy`;function Aj(e){if(!e)return;let t=yO(e);return Number.isNaN(t.getTime())?void 0:t}function jj(e){return e?QE(e,kj):``}var Mj=[`MMM d, yyyy`,`MMMM d, yyyy`,`yyyy-MM-dd`,`M/d/yyyy`,`MM/dd/yyyy`];function Nj(e){let t=e.trim();if(!t)return;let n=new Date;for(let e of Mj){let r=hO(t,e,n);if(!Number.isNaN(r.getTime()))return r}}function Pj(e){let t=(0,$.c)(30),{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;if(t[6]!==u||t[7]!==r){let e;t[9]===u?e=t[10]:(e=(e,t)=>(0,Z.jsxs)(`span`,{"data-testid":`list-chip`,"data-index":t,className:`inline-flex items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-sm`,children:[(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>u(t),className:`text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:(0,Z.jsx)(Cr,{className:`size-3`})})]},`${t}-${e}`),t[9]=u,t[10]=e),d=r.map(e),t[6]=u,t[7]=r,t[8]=d}else d=t[8];let f=r.length===0?`Empty`:``,p=`${n} value`,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>o(e.target.value),t[11]=m):m=t[11];let h;t[12]!==c||t[13]!==a||t[14]!==u||t[15]!==r.length?(h=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[12]=c,t[13]=a,t[14]=u,t[15]=r.length,t[16]=h):h=t[16];let g;t[17]!==c||t[18]!==a?(g=()=>{a&&c(a)},t[17]=c,t[18]=a,t[19]=g):g=t[19];let _;t[20]!==a||t[21]!==f||t[22]!==p||t[23]!==h||t[24]!==g?(_=(0,Z.jsx)(`input`,{"data-testid":`list-chip-input`,type:`text`,value:a,placeholder:f,"aria-label":p,onChange:m,onKeyDown:h,onBlur:g,className:`min-w-16 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60`}),t[20]=a,t[21]=f,t[22]=p,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;return t[26]!==n||t[27]!==d||t[28]!==_?(v=(0,Z.jsxs)(`div`,{"data-testid":`list-widget`,"data-key":n,className:`flex h-7 min-h-7 flex-wrap items-center gap-1 rounded-md px-2 focus-within:bg-background`,children:[d,_]}),t[26]=n,t[27]=d,t[28]=_,t[29]=v):v=t[29],v}var Fj={text:Ya,number:ma,boolean:Va,date:Hi,list:It},Ij={text:`Text`,number:`Number`,boolean:`Checkbox`,date:`Date`,list:`List`};function Lj(e){let t=(0,$.c)(17),{keyName:n,type:r,onChangeType:i}=e,a=Fj[r],o=`${n} type: ${Ij[r]}. Click to change.`,s;t[0]===a?s=t[1]:(s=(0,Z.jsx)(a,{className:`size-3.5`}),t[0]=a,t[1]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s||t[5]!==r?(c=(0,Z.jsx)(qy,{"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":o,className:`flex size-6 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:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=r,t[6]=c):c=t[6];let l;t[7]===i?l=t[8]:(l=e=>i(e),t[7]=i,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(Fj),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=u.map(Rj),t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==r?(f=(0,Z.jsx)(Jy,{align:`start`,"data-testid":`type-picker-menu`,children:(0,Z.jsx)(Xy,{value:r,onValueChange:l,children:d})}),t[11]=l,t[12]=r,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,Z.jsxs)(Ky,{children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}function Rj(e){let t=Fj[e];return(0,Z.jsxs)(Zy,{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:Ij[e]})]},e)}function zj(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 Bj(e,t){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:t===`list`?`text`:t}var Vj={text:``,number:0,boolean:!1,date:``,list:[]};function Hj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=fe(t);return{map:n,keys:ie(t),parseError:r}}function Uj(e){let t=(0,$.c)(110),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>Hj(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{let e=ee(n);i(e),s(e.current());let t=e.subscribe(e=>{s(e)});return()=>{t(),e.dispose(),i(t=>t===e?null:t)}},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useEffect)(c,l);let u=o.map,d=o.keys,f=o.parseError,[p,m]=(0,Q.useState)(!1),h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[5]=h):h=t[5];let[g,_]=(0,Q.useState)(h),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S={},t[6]=S):S=t[6];let[C,w]=(0,Q.useState)(S),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[7]=T):T=t[7];let[E,D]=(0,Q.useState)(T),O=n.configuration.name??``,k;t[8]===r?k=t[9]:(k=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=Fe(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=k);let A=k,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){w(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[10]=j):j=t[10];let M=j,N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e,t){if(e.ok)return;let n=e.error??`Failed to update property`,r=e.fieldErrors??{};w(e=>{let i={...e};for(let e of t)i[e]=r[e]??n;return i}),D(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[11]=N):N=t[11];let P=N,F;t[12]===A?F=t[13]:(F=function(e,t){M(e),P(A({[e]:t}),[e])},t[12]=A,t[13]=F);let I=F,L;t[14]===A?L=t[15]:(L=function(e){M(e),P(A({[e]:null}),[e])},t[14]=A,t[15]=L);let R=L,z;t[16]===r?z=t[17]:(z=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=Fe(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[16]=r,t[17]=z);let B=z,V;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e,t){return`${e}${t}`},t[18]=V):V=t[18];let H=V,U;t[19]!==r||t[20]!==d?(U=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=d.map((e,t)=>H(e,t)),a=i.indexOf(t),o=i.indexOf(n);if(a<0||o<0)return;let s=d.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[19]=r,t[20]=d,t[21]=U):U=t[21];let W=U,G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G={activationConstraint:{distance:4}},t[22]=G):G=t[22];let K;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(K={coordinateGetter:wT},t[23]=K):K=t[23];let te=qS(KS(YC,G),KS(WC,K)),ne;t[24]!==I||t[25]!==u?(ne=function(e,t){let n=u[e];if(n===void 0)return;_(n=>({...n,[e]:t}));let r=zj(n,t);Jj(n,r)||I(e,r)},t[24]=I,t[25]=u,t[26]=ne):ne=t[26];let re=ne,ie;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){y({name:``,type:`text`,value:``,error:null}),m(!1)},t[27]=ie):ie=t[27];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=bb(),ce;t[28]!==oe||t[29]!==O?(ce=oe.get(O)??0,t[28]=oe,t[29]=O,t[30]=ce):ce=t[30];let le=ce,ue,de;t[31]===le?(ue=t[32],de=t[33]):(ue=()=>{le>0&&(y({name:``,type:`text`,value:``,error:null}),m(!1))},de=[le],t[31]=le,t[32]=ue,t[33]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[34]!==se||t[35]!==O?(fe=()=>()=>se(O),pe=[O,se],t[34]=se,t[35]=O,t[36]=fe,t[37]=pe):(fe=t[36],pe=t[37]),(0,Q.useEffect)(fe,pe);let me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){y(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Vj[e];return{...t,type:e,value:n,error:null}})},t[38]=me):me=t[38];let he=me,ge;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){y(t=>t&&{...t,value:e})},t[39]=ge):ge=t[39];let _e=ge,ve;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){y(t=>t&&{...t,name:e,error:null})},t[40]=ve):ve=t[40];let ye=ve,be;t[41]!==v||t[42]!==A||t[43]!==u?(be=function(){if(!v)return;let e=v.name.trim();if(!e){y({...v,error:`Name is required`});return}if(e===`frontmatter`){y({...v,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){y({...v,error:`Property "${e}" already exists`});return}let t=A({[e]:v.value});if(t.ok){y(null);return}let n=t.fieldErrors?.[e],r=t.error??`Failed to add property`;y({...v,error:n??r})},t[41]=v,t[42]=A,t[43]=u,t[44]=be):be=t[44];let xe=be,Se;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){y(null)},t[45]=Se):Se=t[45];let Ce=Se,we;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){x({key:e,draft:e,error:null})},t[46]=we):we=t[46];let Te=we,Ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){x(t=>t&&{...t,draft:e,error:null})},t[47]=Ee):Ee=t[47];let De=Ee,Oe;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){x(null)},t[48]=Oe):Oe=t[48];let ke=Oe,Ae;t[49]!==u||t[50]!==B||t[51]!==b?(Ae=function(){if(!b)return;let e=b.draft.trim();if(!e){x(null);return}if(e===b.key){x(null);return}if(e===`frontmatter`){x({...b,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(u,e)){x({...b,error:`Property "${e}" already exists`});return}let t=B(b.key,e);if(t.ok){_(t=>{if(!Object.hasOwn(t,b.key))return t;let n={...t};return n[e]=n[b.key],delete n[b.key],n}),M(b.key),x(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[b.key]??t.error??`Failed to rename property`;x({...b,error:n})},t[49]=u,t[50]=B,t[51]=b,t[52]=Ae):Ae=t[52];let je=Ae,Me;t[53]!==u||t[54]!==d?(Me=d.length>0?d:Object.keys(u),t[53]=u,t[54]=d,t[55]=Me):Me=t[55];let Ne=Me,Pe;if(t[56]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[56]=Ne,t[57]=Pe}else Pe=t[57];if(Ne.length===0&&!v&&!f)return null;let Ie=!p,Le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>m(!e),t[58]=Le):Le=t[58];let Re=!p,ze;t[59]===Re?ze=t[60]:(ze=(0,Z.jsx)(Kt,{"data-expanded":Re,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[59]=Re,t[60]=ze);let Be;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Z.jsx)(`span`,{children:`Properties`}),t[61]=Be):Be=t[61];let Ve;t[62]===ze?Ve=t[63]:(Ve=(0,Z.jsx)(Ft,{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:[ze,Be]})}),t[62]=ze,t[63]=Ve);let He;t[64]===f?He=t[65]:(He=f?(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)(q,{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:f})]})]}):null,t[64]=f,t[65]=He);let Ue;if(t[66]!==Ne){let e;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>H(e,t),t[68]=e):e=t[68],Ue=Ne.map(e),t[66]=Ne,t[67]=Ue}else Ue=t[67];let We;if(t[69]!==I||t[70]!==je||t[71]!==Pe||t[72]!==C||t[73]!==u||t[74]!==g||t[75]!==R||t[76]!==b||t[77]!==Ne||t[78]!==E||t[79]!==re){let e;t[81]!==I||t[82]!==je||t[83]!==Pe||t[84]!==C||t[85]!==u||t[86]!==g||t[87]!==R||t[88]!==b||t[89]!==E||t[90]!==re?(e=(e,t)=>{let n=u[e];if(n===void 0)return null;let r=g[e]??Ge(n),i=b?.key===e?b:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Wj,{sortableId:H(e,t),keyName:e,value:n,declared:r,renameState:i,error:C[e]??null,resetCounter:E[e]??0,isDuplicate:a,onCommit:t=>I(e,t),onChangeType:t=>re(e,t),onRemove:()=>R(e),onBeginRename:()=>Te(e),onChangeRenameDraft:De,onCommitRename:je,onCancelRename:ke},`${e}-${t}`)},t[81]=I,t[82]=je,t[83]=Pe,t[84]=C,t[85]=u,t[86]=g,t[87]=R,t[88]=b,t[89]=E,t[90]=re,t[91]=e):e=t[91],We=Ne.map(e),t[69]=I,t[70]=je,t[71]=Pe,t[72]=C,t[73]=u,t[74]=g,t[75]=R,t[76]=b,t[77]=Ne,t[78]=E,t[79]=re,t[80]=We}else We=t[80];let Ke;t[92]!==Ue||t[93]!==We?(Ke=(0,Z.jsx)(fT,{items:Ue,strategy:cT,children:We}),t[92]=Ue,t[93]=We,t[94]=Ke):Ke=t[94];let qe;t[95]!==W||t[96]!==te||t[97]!==Ke?(qe=(0,Z.jsx)(Kw,{sensors:te,collisionDetection:tC,onDragEnd:W,children:Ke}),t[95]=W,t[96]=te,t[97]=Ke,t[98]=qe):qe=t[98];let Je;t[99]!==v||t[100]!==xe?(Je=v?(0,Z.jsx)(Kj,{draft:v,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,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)(mr,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[99]=v,t[100]=xe,t[101]=Je):Je=t[101];let Ye;t[102]!==He||t[103]!==qe||t[104]!==Je?(Ye=(0,Z.jsxs)(Lt,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[He,qe,Je]}),t[102]=He,t[103]=qe,t[104]=Je,t[105]=Ye):Ye=t[105];let Xe;return t[106]!==Ie||t[107]!==Ve||t[108]!==Ye?(Xe=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(on,{open:Ie,onOpenChange:Le,children:[Ve,Ye]})}),t[106]=Ie,t[107]=Ve,t[108]=Ye,t[109]=Xe):Xe=t[109],Xe}function Wj(e){let t=(0,$.c)(63),{sortableId:n,keyName:r,value:i,declared:a,renameState:o,error:s,resetCounter:c,isDuplicate:l,onCommit:u,onChangeType:d,onRemove:f,onBeginRename:p,onChangeRenameDraft:m,onCommitRename:h,onCancelRename:g}=e,_;t[0]!==a||t[1]!==i?(_=Bj(i,a),t[0]=a,t[1]=i,t[2]=_):_=t[2];let v=_,y;t[3]===n?y=t[4]:(y={id:n},t[3]=n,t[4]=y);let{attributes:b,listeners:x,setNodeRef:S,transform:C,transition:w,isDragging:T}=bT(y),E;t[5]===C?E=t[6]:(E=jS.Transform.toString(C),t[5]=C,t[6]=E);let D=T?.5:void 0,O=T?1:void 0,k;t[7]!==E||t[8]!==D||t[9]!==O||t[10]!==w?(k={transform:E,transition:w,opacity:D,zIndex:O},t[7]=E,t[8]=D,t[9]=O,t[10]=w,t[11]=k):k=t[11];let A=k,j=s??void 0,M=l||void 0,N=T||void 0,P=`Drag ${r} to reorder`,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(fa,{className:`size-3.5`}),t[12]=F):F=t[12];let I;t[13]!==b||t[14]!==r||t[15]!==x||t[16]!==P?(I=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`property-drag-handle`,"data-key":r,"aria-label":P,...b,...x,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:F}),t[13]=b,t[14]=r,t[15]=x,t[16]=P,t[17]=I):I=t[17];let L;t[18]!==r||t[19]!==d||t[20]!==v?(L=(0,Z.jsx)(Lj,{keyName:r,type:v,onChangeType:d}),t[18]=r,t[19]=d,t[20]=v,t[21]=L):L=t[21];let R;t[22]!==r||t[23]!==p||t[24]!==g||t[25]!==m||t[26]!==h||t[27]!==o?(R=(0,Z.jsx)(`div`,{className:`w-32 shrink-0`,children:o?(0,Z.jsx)(Gj,{keyName:r,draft:o.draft,error:o.error,onChangeDraft:m,onCommit:h,onCancel:g}):(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"data-testid":`property-name-button`,"data-key":r,onClick:p,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`,children:r})}),t[22]=r,t[23]=p,t[24]=g,t[25]=m,t[26]=h,t[27]=o,t[28]=R):R=t[28];let z;t[29]!==l||t[30]!==r?(z=l?(0,Z.jsx)(`span`,{"data-testid":`property-duplicate-marker`,"data-key":r,title:`Duplicate name "${r}"`,className:`flex size-4 items-center justify-center text-amber-600`,children:(0,Z.jsx)(q,{className:`size-3.5`})}):null,t[29]=l,t[30]=r,t[31]=z):z=t[31];let B=`widget-${c}`,V;t[32]!==r||t[33]!==u||t[34]!==B||t[35]!==i||t[36]!==v?(V=(0,Z.jsx)(`div`,{className:`flex-1`,children:(0,Z.jsx)(qj,{keyName:r,value:i,widgetType:v,onCommit:u},B)}),t[32]=r,t[33]=u,t[34]=B,t[35]=i,t[36]=v,t[37]=V):V=t[37];let H=`Remove ${r}`,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Pt,{className:`size-3.5`}),t[38]=U):U=t[38];let W;t[39]!==r||t[40]!==f||t[41]!==H?(W=(0,Z.jsx)(X,{type:`button`,"data-testid":`property-remove-button`,"data-key":r,"aria-label":H,onClick:f,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:U}),t[39]=r,t[40]=f,t[41]=H,t[42]=W):W=t[42];let G;t[43]!==I||t[44]!==L||t[45]!==R||t[46]!==z||t[47]!==V||t[48]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[I,L,R,z,V,W]}),t[43]=I,t[44]=L,t[45]=R,t[46]=z,t[47]=V,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==s||t[51]!==r?(K=s?(0,Z.jsx)(`div`,{role:`alert`,"data-testid":`property-error`,"data-key":r,className:`pl-9 text-[10px] text-destructive`,children:s}):null,t[50]=s,t[51]=r,t[52]=K):K=t[52];let ee;return t[53]!==r||t[54]!==S||t[55]!==A||t[56]!==G||t[57]!==K||t[58]!==j||t[59]!==M||t[60]!==N||t[61]!==v?(ee=(0,Z.jsxs)(`div`,{ref:S,style:A,className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":v,"data-error":j,"data-duplicate":M,"data-dragging":N,children:[G,K]}),t[53]=r,t[54]=S,t[55]=A,t[56]=G,t[57]=K,t[58]=j,t[59]=M,t[60]=N,t[61]=v,t[62]=ee):ee=t[62],ee}function Gj(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)(Gn,{"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 Kj(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)(Lj,{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)(Gn,{"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:`flex-1`,children:(0,Z.jsx)(qj,{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)(Cr,{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-center 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 qj(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)(Pj,{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)(Dj,{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)(Ej,{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)(Oj,{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)(Tj,{keyName:n,value:s,onCommit:a}),t[20]=n,t[21]=a,t[22]=s,t[23]=c):c=t[23],c}function Jj(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function Yj(e){let t=e.threshold??5e5;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Xj(){return r(()=>import(`./SourceEditor-Df4RyC-2.js`),__vite__mapDeps([24,1,19,2,3,20,21,13,12,5,6,22,7,25,15]),import.meta.url)}var Zj=(0,Q.lazy)(async()=>({default:(await Xj()).SourceEditor}));function Qj(e,t,n){if(n<=0)return[];let r=e.filter(e=>!yn(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 $j(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 eM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Vn,{name:`activity-pool`,children:(0,Z.jsx)(tM,{...e})}),t[0]=e,t[1]=n),n}function tM(e){let t=(0,$.c)(12),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=jn(),{pages:u,loading:d}=Be(),f=Qj(c,n,3),p=(0,Q.useRef)(``),m=f.map(nM).join(`,`);(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[];qn(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:e.filter(e=>!t.includes(e))}),p.current=m,tn(t)},[m,n]);let h;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==d||t[4]!==o||t[5]!==s||t[6]!==u||t[7]!==a||t[8]!==l?(h=e=>(0,Z.jsx)(sM,{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[0]=n,t[1]=i,t[2]=r,t[3]=d,t[4]=o,t[5]=s,t[6]=u,t[7]=a,t[8]=l,t[9]=h):h=t[9];let g=f.map(h),_;return t[10]===g?_=t[11]:(_=(0,Z.jsx)(Z.Fragment,{children:g}),t[10]=g,t[11]=_),_}function nM(e){return e.docName}function rM(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,className:`subtle-scrollbar h-full overflow-y-auto`,style:u,children:r}),t[6]=r,t[7]=d),d}function iM(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)(zv,{}),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)(Zj,{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 aM(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)(Pa,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Rt,{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:oM,children:[(0,Z.jsx)(Pa,{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 oM(){return window.location.reload()}function sM(e){let t=(0,$.c)(36),{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=$j(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=n.provider.document.getText(`source`).length,[m,h]=(0,Q.useState)(i),[g,_]=(0,Q.useState)(!i),v,y;t[3]!==i||t[4]!==m||t[5]!==g?(v=()=>{i&&!m?h(!0):!i&&!g&&_(!0)},y=[i,m,g],t[3]=i,t[4]=m,t[5]=g,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b=Yj({ytextLength:p,isSourceMode:i,visitedSource:m,visitedVisual:g}),x=(0,Q.useRef)(``),S=`${b.isLarge}-${b.renderSource}-${b.renderVisual}`,C,w;t[8]!==n.docName||t[9]!==b.isLarge||t[10]!==b.renderSource||t[11]!==b.renderVisual||t[12]!==S||t[13]!==i||t[14]!==p?(C=()=>{x.current!==S&&(x.current=S,b.isLarge&&qn(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:p,isSourceMode:i,renderSource:b.renderSource,renderVisual:b.renderVisual}))},w=[S,b.isLarge,b.renderSource,b.renderVisual,n.docName,p,i],t[8]=n.docName,t[9]=b.isLarge,t[10]=b.renderSource,t[11]=b.renderVisual,t[12]=S,t[13]=i,t[14]=p,t[15]=C,t[16]=w):(C=t[15],w=t[16]),(0,Q.useEffect)(C,w);let T=r?`visible`:`hidden`,E=`editor:${n.docName}`,D;t[17]!==a||t[18]!==n||t[19]!==b.renderSource||t[20]!==b.renderVisual||t[21]!==r||t[22]!==o||t[23]!==i||t[24]!==c||t[25]!==l||t[26]!==s||t[27]!==f?(D=f?(0,Z.jsx)(aM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(aS,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(zv,{}),children:(0,Z.jsx)(eS,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col ${i?``:`pt-6`}`,children:[!i&&(0,Z.jsx)(Uj,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[b.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(iM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,b.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(Zx,{provider:n.provider,placeholder:a,isSourceMode:i},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[17]=a,t[18]=n,t[19]=b.renderSource,t[20]=b.renderVisual,t[21]=r,t[22]=o,t[23]=i,t[24]=c,t[25]=l,t[26]=s,t[27]=f,t[28]=D):D=t[28];let O;t[29]!==r||t[30]!==D?(O=(0,Z.jsx)(rM,{isActive:r,children:D}),t[29]=r,t[30]=D,t[31]=O):O=t[31];let k;return t[32]!==T||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(Q.Activity,{mode:T,name:E,children:O}),t[32]=T,t[33]=E,t[34]=O,t[35]=k):k=t[35],k}function cM(e){let t=(0,$.c)(26),{stats:n}=e,r;t[0]===n.words?r=t[1]:(r=n.words.toLocaleString(),t[0]=n.words,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=i);let a=n.words===1?`word`:`words`,o;t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`span`,{children:[i,` `,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===n.chars?s=t[8]:(s=n.chars.toLocaleString(),t[7]=n.chars,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[9]=s,t[10]=c);let l=n.chars===1?`char`:`chars`,u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`span`,{children:[c,` `,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=n.tokens>0?`~`:``,f;t[14]===n.tokens?f=t[15]:(f=n.tokens.toLocaleString(),t[14]=n.tokens,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f}),t[16]=f,t[17]=p);let m=n.tokens===1?`token`:`tokens`,h;t[18]!==p||t[19]!==m||t[20]!==d?(h=(0,Z.jsxs)(`span`,{children:[d,p,` `,m]}),t[18]=p,t[19]=m,t[20]=d,t[21]=h):h=t[21];let g;return t[22]!==h||t[23]!==o||t[24]!==u?(g=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`flex h-6 shrink-0 items-center justify-end gap-3 px-3 text-2xs text-muted-foreground`,children:[o,u,h]}),t[22]=h,t[23]=o,t[24]=u,t[25]=g):g=t[25],g}var lM=(0,Q.lazy)(()=>r(()=>import(`./SettingsPane-rdUN7cCp.js`).then(e=>({default:e.SettingsPane})),__vite__mapDeps([26,1,19,2,3,20,21,13,12,5,6,22,7,27,17,14]),import.meta.url));function uM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Vn,{name:`editor-area`,children:(0,Z.jsx)(vb,{children:(0,Z.jsx)(dM,{...e})})}),t[0]=e,t[1]=n),n}function dM(e){let t=(0,$.c)(101),{editorMode:n,activeTab:r,onActiveTabChange:i}=e,a=Gd(),{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=jn(),{openDocumentTransition:f}=Pn(),{requestAddProperty:p}=bb(),m=Lb(s,o),h=(0,Q.useDeferredValue)(o),g=c?.kind===`missing`,_=!!o&&c?.kind!==`folder`,v=g?`Start writing to create this page…`:void 0,y=Iv(),[b,x]=(0,Q.useState)(!1),{layout:S,autoCollapse:C}=Eb(),w=S===`sheet`,[T,E]=(0,Q.useState)(!1),D=(0,Q.useRef)(!1),O,k;t[0]!==C||t[1]!==S||t[2]!==y?(O=()=>{S===`panel`&&(C?(D.current=!1,y.current?.collapse()):D.current||y.current?.expand())},k=[C,S,y],t[0]=C,t[1]=S,t[2]=y,t[3]=O,t[4]=k):(O=t[3],k=t[4]),(0,Q.useEffect)(O,k);let A,j;t[5]!==d||t[6]!==w||t[7]!==y?(A=()=>{d!==0&&(w?E(!0):(D.current=!1,y.current?.expand()))},j=[d,w,y],t[5]=d,t[6]=w,t[7]=y,t[8]=A,t[9]=j):(A=t[8],j=t[9]),(0,Q.useEffect)(A,j);let M=(0,Q.useRef)(null),[N,P]=(0,Q.useState)(null),F,I;if(t[10]===o?(F=t[11],I=t[12]):(F=()=>{if(o&&o!==M.current){let e=M.current;M.current=o,P(e)}},I=[o],t[10]=o,t[11]=F,t[12]=I),(0,Q.useEffect)(F,I),a.scope!==null){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zv,{}),t[13]=e):e=t[13];let n;return t[14]!==a.close||t[15]!==a.scope||t[16]!==a.setScope?(n=(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(lM,{scope:a.scope,onClose:a.close,onScopeChange:a.setScope})}),t[14]=a.close,t[15]=a.scope,t[16]=a.setScope,t[17]=n):n=t[17],n}if(c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(fb,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(!s||!o){if((typeof window<`u`?Ke(window.location.hash):null)!==null){let e;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zv,{}),t[20]=e):e=t[20],e}let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Py,{}),t[21]=e):e=t[21],e}let L=n===`source`,R=w?!T:b,z;t[22]!==o||t[23]!==p?(z=function(){o&&p(o)},t[22]=o,t[23]=p,t[24]=z):z=t[24];let B=z,V;t[25]!==L||t[26]!==B?(V=!L&&(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:B,"data-testid":`add-properties-button`,className:`text-muted-foreground`,children:(0,Z.jsx)(Sa,{className:`size-4`})})}),(0,Z.jsx)(Gr,{side:`left`,children:`Add properties`})]}),t[25]=L,t[26]=B,t[27]=V):V=t[27];let H;t[28]!==b||t[29]!==w||t[30]!==y?(H=()=>{w?E(fM):b?(D.current=!1,y.current?.expand()):(D.current=!0,y.current?.collapse())},t[28]=b,t[29]=w,t[30]=y,t[31]=H):H=t[31];let U=R?`Show document panel`:`Hide document panel`,W;t[32]===R?W=t[33]:(W=R?(0,Z.jsx)(Aa,{className:`size-4`}):(0,Z.jsx)(ka,{className:`size-4`}),t[32]=R,t[33]=W);let G;t[34]!==U||t[35]!==W||t[36]!==H?(G=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:H,"aria-label":U,className:`text-muted-foreground`,children:W})}),t[34]=U,t[35]=W,t[36]=H,t[37]=G):G=t[37];let K=R?`Show panel`:`Hide panel`,ee;t[38]===K?ee=t[39]:(ee=(0,Z.jsx)(Gr,{side:`left`,children:K}),t[38]=K,t[39]=ee);let q;t[40]!==G||t[41]!==ee?(q=(0,Z.jsxs)(qr,{children:[G,ee]}),t[40]=G,t[41]=ee,t[42]=q):q=t[42];let te;t[43]!==q||t[44]!==V?(te=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1`,children:[V,q]}),t[43]=q,t[44]=V,t[45]=te):te=t[45];let ne=te,re=h??o,ie=N??void 0,ae;t[46]===f?ae=t[47]:(ae=e=>{let t=at(e);window.location.hash===t?f(e):window.location.hash=t},t[46]=f,t[47]=ae);let oe;t[48]!==v||t[49]!==L||t[50]!==l||t[51]!==re||t[52]!==ie||t[53]!==ae?(oe=(0,Z.jsx)(eM,{activeDocName:re,isSourceMode:L,editorPlaceholder:v,previousDocName:ie,onNavigateBack:ae,onRecycle:l}),t[48]=v,t[49]=L,t[50]=l,t[51]=re,t[52]=ie,t[53]=ae,t[54]=oe):oe=t[54];let se;t[55]!==o||t[56]!==h?(se=o&&o!==h?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,Z.jsx)(zv,{})}):null,t[55]=o,t[56]=h,t[57]=se):se=t[57];let ce;t[58]!==oe||t[59]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[oe,se]}),t[58]=oe,t[59]=se,t[60]=ce):ce=t[60];let le;t[61]!==ce||t[62]!==ne?(le=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ce,ne]}),t[61]=ce,t[62]=ne,t[63]=le):le=t[63];let ue;t[64]!==_||t[65]!==m?(ue=_&&(0,Z.jsx)(cM,{stats:m}),t[64]=_,t[65]=m,t[66]=ue):ue=t[66];let de;t[67]!==le||t[68]!==ue?(de=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[le,ue]}),t[67]=le,t[68]=ue,t[69]=de):de=t[69];let fe=de;if(w){let e;t[70]===fe?e=t[71]:(e=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:fe}),t[70]=fe,t[71]=e);let n;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(fh,{className:`sr-only`,children:(0,Z.jsx)(ph,{children:`Document panel`})}),t[72]=n):n=t[72];let a;t[73]!==o||t[74]!==r||t[75]!==u||t[76]!==L||t[77]!==i?(a=(0,Z.jsxs)(dh,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Z.jsx)(Ug,{docName:o,isSourceMode:L,activeTab:r,onActiveTabChange:i,mode:u})]}),t[73]=o,t[74]=r,t[75]=u,t[76]=L,t[77]=i,t[78]=a):a=t[78];let s;t[79]!==T||t[80]!==a?(s=(0,Z.jsx)(ch,{open:T,onOpenChange:E,children:a}),t[79]=T,t[80]=a,t[81]=s):s=t[81];let c;return t[82]!==e||t[83]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,s]}),t[82]=e,t[83]=s,t[84]=c):c=t[84],c}let pe;t[85]===fe?pe=t[86]:(pe=(0,Z.jsx)(Sb,{minSize:`30%`,defaultSize:`75%`,children:fe}),t[85]=fe,t[86]=pe);let me;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Cb,{withHandle:!0}),t[87]=me):me=t[87];let he;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>x(e.asPercentage===0),t[88]=he):he=t[88];let ge;t[89]!==o||t[90]!==r||t[91]!==u||t[92]!==L||t[93]!==i?(ge=(0,Z.jsx)(Ug,{docName:o,isSourceMode:L,activeTab:r,onActiveTabChange:i,mode:u}),t[89]=o,t[90]=r,t[91]=u,t[92]=L,t[93]=i,t[94]=ge):ge=t[94];let _e;t[95]!==y||t[96]!==ge?(_e=(0,Z.jsx)(Sb,{panelRef:y,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:he,className:`flex flex-col bg-muted/20`,children:ge}),t[95]=y,t[96]=ge,t[97]=_e):_e=t[97];let ve;return t[98]!==pe||t[99]!==_e?(ve=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(xb,{orientation:`horizontal`,children:[pe,me,_e]})}),t[98]=pe,t[99]=_e,t[100]=ve):ve=t[100],ve}function fM(e){return!e}function pM(e,t){return t.trim()}function mM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function hM(e,t){let n=pM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function gM(e,t){if(t.length===0)return e;let n=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>({...e,docName:n.get(e.docName)??e.docName}))}function _M(e,t){if(t.length===0)return e;let n=new Set(t);return e.filter(e=>!n.has(e.docName))}function vM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}var yM=1280;function bM(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(xM),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${yM-1}px)`),t=()=>{n(window.innerWidth<yM)};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 xM(){return window.innerWidth<yM}function SM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function CM(e){let{value:t,unit:n}=SM(e);return n===`rem`?t*16:t}function wM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var TM=3600*24*7;function EM(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?DM:m,O=g===void 0?TM: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 ee=CM(b),q;t[6]===x?q=t[7]:(q=CM(x),t[6]=x,t[7]=q);let te=q,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:CM(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]!==ee||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}=SM(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(te,t)),u=wM(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(ee,Math.min(te,u)),f=wM(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,ee,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]=ee,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 DM(){}var OM=`sidebar_state`,kM=3600*24*7,AM=`18rem`,jM=`3rem`,MM=`\\`,NM=`app-file-sidebar`,PM=`14rem`,FM=`22rem`,IM=`sidebar_width`,LM=/^\d+(?:\.\d+)?(?:rem|px)$/,RM=Q.createContext(null);function zM(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${IM}=`))?.split(`=`)[1];if(!t)return e;let n=decodeURIComponent(t);return LM.test(n)?n:e}function BM(){let e=Q.use(RM);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function VM(e){let t=(0,$.c)(55),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?AM:l,f=bM(),p;t[9]===d?p=t[10]:(p=()=>zM(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),[v,y]=Q.useState(!1),[b,x]=Q.useState(!1),[S,C]=Q.useState(u),w=i??S,T;t[11]!==w||t[12]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),document.cookie=`${OM}=${t}; path=/; max-age=${kM}`},t[11]=w,t[12]=o,t[13]=T):T=t[13];let E=T,D;t[14]!==f||t[15]!==E?(D=function(){return f?_(UM):E(HM)},t[14]=f,t[15]=E,t[16]=D):D=t[16];let O=D,k;t[17]!==f||t[18]!==g?(k=function(){!f||!g||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||x(!0)},t[17]=f,t[18]=g,t[19]=k):k=t[19];let A=k,j,M;t[20]===O?(j=t[21],M=t[22]):(j=()=>{let e=e=>{e.key===MM&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},M=[O],t[20]=O,t[21]=j,t[22]=M),Q.useEffect(j,M);let N,P;t[23]!==f||t[24]!==g?(P=()=>{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})},N=[f,g],t[23]=f,t[24]=g,t[25]=N,t[26]=P):(N=t[25],P=t[26]),Q.useEffect(P,N);let F=Q.useRef(f),I,L;t[27]!==f||t[28]!==w?(I=()=>{!F.current&&f&&_(w),F.current=f},L=[f,w],t[27]=f,t[28]=w,t[29]=I,t[30]=L):(I=t[29],L=t[30]),Q.useEffect(I,L);let R=f?g?`expanded`:`collapsed`:w?`expanded`:`collapsed`,z;t[31]!==v||t[32]!==f||t[33]!==A||t[34]!==w||t[35]!==g||t[36]!==E||t[37]!==b||t[38]!==R||t[39]!==O||t[40]!==m?(z={state:R,open:w,setOpen:E,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:O,width:m,setWidth:h,isDraggingRail:v,setIsDraggingRail:y,showPushPulse:b,setShowPushPulse:x,notifySidebarFileSelected:A},t[31]=v,t[32]=f,t[33]=A,t[34]=w,t[35]=g,t[36]=E,t[37]=b,t[38]=R,t[39]=O,t[40]=m,t[41]=z):z=t[41];let B;t[42]!==s||t[43]!==m?(B={"--sidebar-width":m,"--sidebar-width-icon":jM,...s},t[42]=s,t[43]=m,t[44]=B):B=t[44];let V=B,H;t[45]===r?H=t[46]:(H=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[45]=r,t[46]=H);let U;t[47]!==n||t[48]!==a||t[49]!==V||t[50]!==H?(U=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:V,className:H,...a,children:n}),t[47]=n,t[48]=a,t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;return t[52]!==z||t[53]!==U?(W=(0,Z.jsx)(RM.Provider,{value:z,children:U}),t[52]=z,t[53]=U,t[54]=W):W=t[54],W}function HM(e){return!e}function UM(e){return!e}function WM(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}=BM();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:NM,"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 GM(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}=BM(),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)(Oa,{}),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":NM,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 KM(e){let t=(0,$.c)(22),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,enableDrag:a,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!0:a,{toggleSidebar:s,setWidth:c,state:l,width:u,setIsDraggingRail:d}=BM(),f=l===`collapsed`,p;t[5]!==o||t[6]!==d||t[7]!==c||t[8]!==f||t[9]!==s||t[10]!==u?(p={direction:`right`,enableDrag:o,onResize:c,onToggle:s,currentWidth:u,isCollapsed:f,minResizeWidth:PM,maxResizeWidth:FM,setIsDraggingRail:d,widthCookieName:IM,widthCookieMaxAge:kM},t[5]=o,t[6]=d,t[7]=c,t[8]=f,t[9]=s,t[10]=u,t[11]=p):p=t[11];let{dragRef:m,handleMouseDown:h}=EM(p),g;t[12]!==h||t[13]!==r?(g=e=>{r?.(e),e.defaultPrevented||h(e)},t[12]=h,t[13]=r,t[14]=g):g=t[14];let _;t[15]===n?_=t[16]:(_=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`,n),t[15]=n,t[16]=_);let v;return t[17]!==m||t[18]!==i||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(`button`,{ref:m,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:g,title:`Toggle Sidebar`,className:_,...i}),t[17]=m,t[18]=i,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function qM(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}=BM(),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 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md: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 JM(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 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(`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 XM(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 ZM(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 QM(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 $M=Et(`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 eN(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?_t:`button`,{isMobile:m,state:h}=BM(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y($M({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)(Wr,{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)(Gr,{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)(qr,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function tN(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 nN(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 rN=1e3,iN=!1;function aN(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:cr(i)?a=i:(a=void 0,iN||(iN=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=[];if(r)for(let[t,n]of r.getStates().entries()){let r=n;if(!r.user||typeof r.user!=`object`)continue;let i=r.user;i.type===`human`&&e.push({kind:`human`,clientId:t,user:i,mode:r.mode??`wysiwyg`,tabCount:1})}let t=nN(e),{current:i,crossDoc:s}=a?rr(a,n,Date.now()):{current:[],crossDoc:[]},c=oN,l=i.map(c),u=s.map(c),d=[...t,...l],f=u;o(e=>tN(e.current,d)&&tN(e.crossDoc,f)?e:{current:d,crossDoc:f})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,rN);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 oN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}function sN(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`?cN: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 cN(e){return e===`synced`?`synced`:`connected`}var lN=`sync-status`;function uN(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,Hr.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:lN,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Hr.success(`Reconnected`,{id:lN,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 dN=4,fN=3,pN={Bird:Ii,Cat:Ui,Dog:na,Fish:oa,Mouse:Na,Rabbit:Ma,Shrimp:za,Snail:Ba,Squirrel:Wa,Turtle:Ja};Object.freeze([...Object.keys(pN)]);function mN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(pN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var hN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function gN(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=mN(n),o=a.kind===`animal`?pN[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Ae(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Me(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)(Wr,{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)(Gr,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(qr,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function _N(e){let t=hN[e.icon];return e.displayName||t||`Agent`}function vN(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 yN(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=_N(o),t[0]=o,t[1]=c);let l=c,u=vN(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=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Z.jsx)(or,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Z.jsx)(Wr,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Z.jsxs)(Gr,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Z.jsxs)(qr,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function bN(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)(kt,{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)(gN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(yN,{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)(On,{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)(Zt,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function xN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(gN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(yN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function SN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=jn(),{current:s,crossDoc:c}=aN(t,r,n);uN(sN(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,dN),n;e[6]===s?n=e[7]:(n=s.slice(dN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,fN),d;e[8]===c?d=e[9]:(d=c.slice(fN),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=>xN(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)(bN,{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)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>xN(e,p,!0,m)),f.length>0?(0,Z.jsx)(bN,{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 CN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`LinkedIn`}),r=(0,Z.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`}),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 wN(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 TN=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:Ri},{label:`Homepage`,href:`https://openknowledge.ai/`,icon:yr},{label:`Twitter / X`,href:`https://x.com/inkeep`,icon:wN},{label:`LinkedIn`,href:`https://www.linkedin.com/company/inkeep/`,icon:CN}],EN=()=>{let e=(0,$.c)(15),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(Ki,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Help & resources`})]})})}),(0,Z.jsx)(Gr,{children:`Help & resources`})]}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Setup`}),e[1]=o):o=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Bd)},e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`help-popover-settings`,onClick:s,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(Ra,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{children:`Settings…`})]})}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{i(!1),n(!0)},e[4]=l):l=e[4];let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(`ul`,{className:`mb-3 space-y-0.5`,children:[c,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:l,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(gr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork…`})]})})]}),d=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(On,{align:`end`,className:`w-64 p-3`,children:[o,u,d,(0,Z.jsx)(`nav`,{"aria-label":`Help and resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:TN.map(DN)})})]}),e[7]=f):f=e[7];let p;e[8]===r?p=e[9]:(p=(0,Z.jsxs)(Zt,{open:r,onOpenChange:i,children:[a,f]}),e[8]=r,e[9]=p);let m;e[10]===t?m=e[11]:(m=(0,Z.jsx)(hr,{open:t,onOpenChange:n}),e[10]=t,e[11]=m);let h;return e[12]!==p||e[13]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),e[12]=p,e[13]=m,e[14]=h):h=e[14],h};function DN(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`,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)}var ON={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function kN(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}=xe(),s=ON[r],c=s?(o===`dark`?Ee[s]:void 0)??Ie[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)(Qn,{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)(Zn,{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)(ir,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var AN=`https://github.com/inkeep/open-knowledge/releases`;function jN(e){let{target:t,installState:n,isElectronHost:r}=e;return t.id===`cursor`&&!r?`Desktop only`:n.installed===null?`Detecting…`:n.installed===!1?`Not installed`:null}function MN(e){let{target:t,installState:n,isElectronHost:r}=e;if(t.id===`cursor`&&!r)return{enabled:!1,tooltip:{message:`Cursor handoff requires the desktop build.`,installAction:{label:`Install the Open Knowledge desktop app →`,url:AN}}};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 NN(e){return Se(e)}function PN(e){return`Opened ${e} in your browser.`}function FN(e){let t=(0,$.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??uf,c=e.onWebFallbackSuccess??LN,l=e.onWebFallbackError??IN,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=MN({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=jN({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s(NN(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open in ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Z.jsx)(kN,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Z.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Z.jsxs)(Yy,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Z.jsx)(kN,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Z.jsxs)(Yy,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Z.jsx)(kN,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Z.jsxs)(tb,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Z.jsx)(Qy,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)($y,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Z.jsx)(Yy,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Z.jsxs)(Yy,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Z.jsxs)(nb,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Z.jsxs)(eb,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function IN(){}function LN(){}function RN(e){let t=(0,$.c)(25),{input:n}=e,{states:r,refresh:i}=Vf(),{dispatch:a}=Af(),[o,s]=(0,Q.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l=BN,u=zN,d;t[0]===i?d=t[1]:(d=e=>{s(e),e&&i()},t[0]=i,t[1]=d);let f=d,p=n===null,m;t[2]===n?m=t[3]:(m=n===null?``:Ve(n.docContext),t[2]=n,t[3]=m);let h=m,g;t[4]!==a||t[5]!==n?(g=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ar,{className:`size-4`}),t[7]=v):v=t[7];let y;t[8]===p?y=t[9]:(y=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(qy,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:p,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:v})})}),t[8]=p,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Gr,{children:`Edit with AI`}),t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x=(0,Z.jsxs)(qr,{children:[y,b]}),t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Qy,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in…`}),t[13]=S):S=t[13];let C;t[14]!==_||t[15]!==h||t[16]!==r?(C=zd.map(e=>{let t=r[e.id];return(0,Z.jsx)(FN,{target:e,installState:t,isElectronHost:c,prompt:h,onSelect:()=>_(e),onWebFallbackSuccess:l,onWebFallbackError:u},e.id)}),t[14]=_,t[15]=h,t[16]=r,t[17]=C):C=t[17];let w;t[18]===C?w=t[19]:(w=(0,Z.jsxs)(Jy,{align:`end`,className:`min-w-[220px]`,"data-testid":`open-in-agent-menu`,children:[S,C]}),t[18]=C,t[19]=w);let T;return t[20]!==f||t[21]!==o||t[22]!==w||t[23]!==x?(T=(0,Z.jsxs)(Ky,{open:o,onOpenChange:f,children:[x,w]}),t[20]=f,t[21]=o,t[22]=w,t[23]=x,t[24]=T):T=t[24],T}function zN(e){Hr.error(`Couldn't open ${e.displayName} in your browser.`)}function BN(e){Hr.success(PN(e.displayName))}var VN={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`},HN=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`,...VN,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},UN=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)(HN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},WN=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)(HN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function GN(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 KN(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}async function qN(e){let t=await fetch(`/api/sync/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`set-enabled failed: HTTP ${t.status}`)}function JN(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)(Yi,{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)(Pa,{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)(Yi,{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)(Pa,{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)(q,{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)(Ji,{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)(wa,{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)(Ji,{className:`size-3.5 text-muted-foreground`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Yi,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function YN(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``;case`disabled`:return``;default:return``}}function XN(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 ZN(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 QN(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`}`:XN(e.state):`Sync off`}function $N(e){let t=(0,$.c)(72),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,[o,s]=(0,Q.useState)(!1),c=n.syncEnabled,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=async function(e){s(!0);try{await qN(e)}catch(t){console.error(`[sync] toggle failed`,t),Hr.error(`Failed to ${e?`enable`:`disable`} sync — try again`)}s(!1)},t[0]=l):l=t[0];let u=l,d;t[1]===n?d=t[2]:(d=(0,Z.jsx)(JN,{status:n}),t[1]=n,t[2]=d);let f;t[3]===n.state?f=t[4]:(f=XN(n.state),t[3]=n.state,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:f}),t[5]=f,t[6]=p);let m;t[7]!==d||t[8]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,p]}),t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>void u(e),t[10]=h):h=t[10];let g=c?`Disable sync`:`Enable sync`,_;t[11]!==c||t[12]!==g||t[13]!==o?(_=(0,Z.jsx)(Hn,{checked:c,disabled:o,onCheckedChange:h,"aria-label":g}),t[11]=c,t[12]=g,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.error?y=t[19]:(y=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[18]=n.error,t[19]=y);let b;t[20]===n.pausedReason?b=t[21]:(b=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ZN(n.pausedReason)}),t[20]=n.pausedReason,t[21]=b);let x;t[22]===n.state?x=t[23]:(x=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[22]=n.state,t[23]=x);let S;t[24]!==c||t[25]!==n.lastSyncUtc||t[26]!==n.state?(S=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,GN(n.lastSyncUtc)]}),t[24]=c,t[25]=n.lastSyncUtc,t[26]=n.state,t[27]=S):S=t[27];let C;t[28]===n.ahead?C=t[29]:(C=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[28]=n.ahead,t[29]=C);let w;t[30]===n.behind?w=t[31]:(w=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[30]=n.behind,t[31]=w);let T;t[32]===n.conflictCount?T=t[33]:(T=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[32]=n.conflictCount,t[33]=T);let E;t[34]===c?E=t[35]:(E=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[34]=c,t[35]=E);let D;t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E?(D=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[S,C,w,T,E]}),t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==a||t[43]!==n.identityUnresolved?(O=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(Qa,{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[42]=a,t[43]=n.identityUnresolved,t[44]=O):O=t[44];let k;t[45]!==c||t[46]!==n.state?(k=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:tP,children:`Sync now`}),t[45]=c,t[46]=n.state,t[47]=k):k=t[47];let A;t[48]!==c||t[49]!==r||t[50]!==n.state?(A=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[48]=c,t[49]=r,t[50]=n.state,t[51]=A):A=t[51];let j;t[52]!==c||t[53]!==n.state?(j=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:eP,children:`Retry`}),t[52]=c,t[53]=n.state,t[54]=j):j=t[54];let M;t[55]!==c||t[56]!==i||t[57]!==n.state?(M=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[55]=c,t[56]=i,t[57]=n.state,t[58]=M):M=t[58];let N;t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[k,A,j,M]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=N):N=t[63];let P;return t[64]!==y||t[65]!==b||t[66]!==x||t[67]!==D||t[68]!==O||t[69]!==N||t[70]!==v?(P=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v,y,b,x,D,O,N]}),t[64]=y,t[65]=b,t[66]=x,t[67]=D,t[68]=O,t[69]=N,t[70]=v,t[71]=P):P=t[71],P}function eP(){KN(`sync`)}function tP(){KN(`sync`)}function nP(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}=sp();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wr,{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)(Ji,{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)(qr,{children:[e,(0,Z.jsx)(Gr,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote)return null;let c;t[5]===o?c=t[6]:(c=YN(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=XN(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)(JN,{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)(Wr,{asChild:!0,children:(0,Z.jsx)(kt,{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]:(_=QN(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(Gr,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(qr,{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)(On,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)($N,{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)(Zt,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var rP=[{value:`light`,label:`Light`,icon:Ka},{value:`dark`,label:`Dark`,icon:Ta},{value:`system`,label:`System`,icon:$i}],iP=()=>{let e=(0,$.c)(16),{theme:t}=xe(),{merged:n,userBinding:r}=dp(),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||Hr.error(je(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?$i:i===`dark`?Ta:Ka,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)(qy,{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=rP.map(aP),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(Jy,{align:`end`,children:(0,Z.jsx)(Xy,{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)(Ky,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function aP(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(Zy,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function oP(e){return typeof e==`object`&&!!e&&typeof e.fromDocName==`string`&&typeof e.toDocName==`string`}function sP(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.ok===!0?Array.isArray(t.renamed)&&t.renamed.every(oP)&&Array.isArray(t.rewrittenDocs):t.ok===!1?typeof t.error==`string`:!1}function cP(e){let t=(0,$.c)(78),{editorMode:n,onModeChange:r,onSaveVersion:i,saving:a,onSignIn:o,onSetIdentity:s,onOpenConflictResolver:c}=e,{activeDocName:l,activeProvider:u,activeTarget:d,closeAndClearForRename:f}=jn(),{pageMeta:p}=Be(),{state:m}=BM(),h=Jd(),g=sN(u),_;t[0]!==l||t[1]!==h?(_=xf({docName:l,workspace:h}),t[0]=l,t[1]=h,t[2]=_):_=t[2];let v=_,y=!l||!(g===`connected`||g===`synced`),b=d?.kind===`folder`,x=d?.kind===`missing`,S;t[3]!==l||t[4]!==p?(S=l&&p.get(l)?.docExt||`.md`,t[3]=l,t[4]=p,t[5]=S):S=t[5];let C=S,w=b?`${d.folderPath}/`:l?`${l}${C}`:``,T;t[6]===l?T=t[7]:(T=l?.lastIndexOf(`/`)??-1,t[6]=l,t[7]=T);let E=T,D;t[8]!==l||t[9]!==E?(D=l&&E!==-1?`${l.substring(0,E+1)}`:``,t[8]=l,t[9]=E,t[10]=D):D=t[10];let O=D,k;t[11]!==l||t[12]!==E?(k=l?l.substring(E+1):``,t[11]=l,t[12]=E,t[13]=k):k=t[13];let A=k,[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(null),W;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{V.current=!0,H.current=null,U.current=null,M(!1),I(null)},t[14]=W):W=t[14];let G;t[15]===l?G=t[16]:(G=[l],t[15]=l,t[16]=G),(0,Q.useEffect)(W,G);let K,ee;t[17]===j?(K=t[18],ee=t[19]):(K=()=>{if(j){let e=setTimeout(()=>{let e=z.current;e&&(e.focus(),e.select())},0);return()=>clearTimeout(e)}},ee=[j],t[17]=j,t[18]=K,t[19]=ee),(0,Q.useEffect)(K,ee);let q;t[20]!==l||t[21]!==b?(q=function(){if(!l||b)return;let e=l.split(`/`);V.current=!1,H.current=l,P(e[e.length-1]),I(null),U.current=null,M(!0)},t[20]=l,t[21]=b,t[22]=q):q=t[22];let te=q,ne;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(){V.current=!0,H.current=null,U.current=null,M(!1),P(``),I(null)},t[23]=ne):ne=t[23];let re=ne,ie;t[24]!==f||t[25]!==N?(ie=async function(){if(V.current){V.current=!1;return}if(B.current)return;let e=H.current;if(!e){re();return}let t=pM(`file`,N),n=e.split(`/`),r=n[n.length-1];if(t===r){re();return}if(t===U.current)return;if(!mM(t)){I(`Name can’t be empty, ".", "..", or contain / or \\`);return}let i=hM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(V.current){R(!1),B.current=!1;return}let r;try{r=await n.json()}catch(r){console.warn(`[EditorHeader] rename response JSON parse failed`,{parseErr:r,status:n.status,docName:e,newDocName:i}),I(`Server error (HTTP ${n.status})`),R(!1),B.current=!1,U.current=t;return}if(!n.ok||!sP(r)){let a=r;console.warn(`[EditorHeader] rename failed`,{status:n.status,docName:e,newDocName:i}),I(a?.error||`Server error (HTTP ${n.status})`),R(!1),B.current=!1,U.current=t;return}if(!r.ok){I(r.error||`Failed to rename path`),R(!1),B.current=!1,U.current=t;return}let a=r.renamed,o=vM(e,a);await Promise.all(a.flatMap(e=>[f(e.fromDocName),f(e.toDocName)])),Oe([`files`,`backlinks`,`graph`]),M(!1),P(``),R(!1),B.current=!1,U.current=null,H.current=null,o&&o!==e&&(window.location.hash=at(o))}catch(n){console.warn(`[EditorHeader] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(`Network error — please try again`),R(!1),B.current=!1,U.current=t}},t[24]=f,t[25]=N,t[26]=ie):ie=t[26];let ae=ie,oe;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(GM,{className:`-ml-1 shrink-0 text-muted-foreground`})}),t[27]=oe):oe=t[27];let se=m===`expanded`?`Hide Files`:`Show Files`,ce;t[28]===se?ce=t[29]:(ce=(0,Z.jsxs)(qr,{children:[oe,(0,Z.jsx)(Gr,{children:se})]}),t[28]=se,t[29]=ce);let le;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(xh,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[30]=le):le=t[30];let ue;t[31]!==C||t[32]!==l||t[33]!==ae||t[34]!==w||t[35]!==te||t[36]!==A||t[37]!==b||t[38]!==L||t[39]!==j||t[40]!==O||t[41]!==F||t[42]!==N?(ue=b?(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(en,{className:`size-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:w})]}):l?(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center overflow-hidden`,children:[O&&(0,Z.jsxs)(`span`,{className:`flex shrink items-center overflow-hidden text-sm text-muted-foreground/60 transition-[max-width,opacity] duration-200 ease-in-out`,style:j?{maxWidth:0,opacity:0}:{maxWidth:`20rem`,opacity:1},children:[(0,Z.jsx)(`span`,{className:`truncate`,children:O.slice(0,-1)}),(0,Z.jsx)(`span`,{className:`shrink-0 pl-2`,children:`/`})]}),j?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Gn,{ref:z,value:N,disabled:L,"aria-label":`Rename ${l}`,"aria-invalid":F?!0:void 0,"aria-describedby":F?`editor-header-rename-error`:void 0,"aria-busy":L||void 0,onChange:e=>{P(e.target.value),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ae()):e.key===`Escape`&&(e.preventDefault(),re())},onBlur:()=>void ae(),className:`h-7 min-w-0 flex-1 border-none bg-background text-sm shadow-none focus-visible:ring-0`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-xs text-muted-foreground/40`,children:C})]}),F&&(0,Z.jsx)(`span`,{id:`editor-header-rename-error`,role:`alert`,className:`text-xs text-destructive mt-0.5`,children:F})]}):(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:te,className:`h-7 shrink-0 px-2 text-sm font-normal text-muted-foreground hover:text-foreground`,children:`${A}${C}`})]}):(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground truncate min-w-0`,children:w}),t[31]=C,t[32]=l,t[33]=ae,t[34]=w,t[35]=te,t[36]=A,t[37]=b,t[38]=L,t[39]=j,t[40]=O,t[41]=F,t[42]=N,t[43]=ue):ue=t[43];let de;t[44]===x?de=t[45]:(de=x&&(0,Z.jsx)(_n,{variant:`dashed`,children:`New file`}),t[44]=x,t[45]=de);let fe;t[46]!==ce||t[47]!==ue||t[48]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-1 items-center gap-1 px-3 min-w-0`,children:[ce,le,ue,de]}),t[46]=ce,t[47]=ue,t[48]=de,t[49]=fe):fe=t[49];let pe;t[50]!==l||t[51]!==n||t[52]!==r||t[53]!==y?(pe=l&&(0,Z.jsxs)(it,{type:`single`,value:n===`source`?`source`:`visual`,onValueChange:e=>{e&&r(e===`source`?`source`:`wysiwyg`)},"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,disabled:!l,children:[(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`span`,{children:(0,Z.jsxs)(Ye,{value:`visual`,"aria-label":`Visual editor`,className:`gap-1.5 text-xs`,children:[(0,Z.jsx)(WN,{className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`hidden md:inline`,children:`Visual`})]})})}),(0,Z.jsx)(Gr,{className:`md:hidden`,children:`Visual`})]}),(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:y?0:void 0,children:(0,Z.jsxs)(Ye,{value:`source`,"aria-label":`Markdown source`,className:`gap-1.5 text-xs`,disabled:y,children:[(0,Z.jsx)(UN,{className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`hidden md:inline`,children:`Markdown`})]})})}),y&&!l?null:y?(0,Z.jsx)(Gr,{children:`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`}):(0,Z.jsx)(Gr,{className:`md:hidden`,children:`Markdown`})]})]}),t[50]=l,t[51]=n,t[52]=r,t[53]=y,t[54]=pe):pe=t[54];let me;t[55]!==l||t[56]!==i||t[57]!==a?(me=l&&(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:i,disabled:a,className:`text-muted-foreground`,children:(0,Z.jsx)(Ia,{className:`size-3.5`})})}),(0,Z.jsx)(Gr,{children:a?`Saving…`:`Checkpoint version`})]}),t[55]=l,t[56]=i,t[57]=a,t[58]=me):me=t[58];let he;t[59]!==l||t[60]!==v?(he=l&&(0,Z.jsx)(RN,{input:v}),t[59]=l,t[60]=v,t[61]=he):he=t[61];let ge;t[62]!==c||t[63]!==s||t[64]!==o?(ge=(0,Z.jsx)(nP,{onSignIn:o,onSetIdentity:s,onOpenConflictResolver:c}),t[62]=c,t[63]=s,t[64]=o,t[65]=ge):ge=t[65];let _e,ve,ye,be;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(SN,{}),ve=(0,Z.jsx)(xh,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),ye=(0,Z.jsx)(EN,{}),be=(0,Z.jsx)(iP,{}),t[66]=_e,t[67]=ve,t[68]=ye,t[69]=be):(_e=t[66],ve=t[67],ye=t[68],be=t[69]);let xe;t[70]!==me||t[71]!==he||t[72]!==ge?(xe=(0,Z.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2 px-3`,children:[me,he,ge,_e,ve,ye,be]}),t[70]=me,t[71]=he,t[72]=ge,t[73]=xe):xe=t[73];let Se;return t[74]!==fe||t[75]!==pe||t[76]!==xe?(Se=(0,Z.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center border-b`,children:[fe,pe,xe]}),t[74]=fe,t[75]=pe,t[76]=xe,t[77]=Se):Se=t[77],Se}function lP(){let e=(0,$.c)(32),[t,n]=ip(),[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)(zg[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=op(),{projectConfig:v}=dp(),{activeDocName:y}=jn(),b=!h&&_?.hasRemote===!0&&v!==null&&v.autoSync?.onboardingResolvedAt==null,x,S;e[0]===y?(x=e[1],S=e[2]):(x=()=>{let e=function(e){let t=e.detail;t&&y&&vi(y,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(Xf,e),()=>window.removeEventListener(Xf,e)},S=[y],e[0]=y,e[1]=x,e[2]=S),(0,Q.useEffect)(x,S);let C;e[3]===n?C=e[4]:(C=function(e){i(e),n(e)},e[3]=n,e[4]=C);let w=C,T;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?Hr.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Hr.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Hr.error(`Checkpoint failed — try again`)}m(!1)},e[5]=T):T=e[5];let E=T,D;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(_p,{onOpenResolver:()=>o(!0)}),e[6]=D):D=e[6];let O,k,A;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{u(`auth`),c(!0)},k=()=>{u(`identity`),c(!0)},A=()=>o(!0),e[7]=O,e[8]=k,e[9]=A):(O=e[7],k=e[8],A=e[9]);let j;e[10]!==r||e[11]!==w||e[12]!==p?(j=(0,Z.jsx)(cP,{editorMode:r,onModeChange:w,onSaveVersion:E,saving:p,onSignIn:O,onSetIdentity:k,onOpenConflictResolver:A}),e[10]=r,e[11]=w,e[12]=p,e[13]=j):j=e[13];let M;e[14]!==d||e[15]!==r?(M=(0,Z.jsx)(uM,{editorMode:r,activeTab:d,onActiveTabChange:f}),e[14]=d,e[15]=r,e[16]=M):M=e[16];let N;e[17]===a?N=e[18]:(N=(0,Z.jsx)(yh,{open:a,onOpenChange:o}),e[17]=a,e[18]=N);let P=l===`identity`,F;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{c(!1)},e[19]=F):F=e[19];let I;e[20]!==s||e[21]!==P?(I=(0,Z.jsx)(Gl,{open:s,onOpenChange:c,identityPrompt:P,onSuccess:F}),e[20]=s,e[21]=P,e[22]=I):I=e[22];let L;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>g(!0),e[23]=L):L=e[23];let R;e[24]===b?R=e[25]:(R=(0,Z.jsx)(hp,{open:b,onResolved:L}),e[24]=b,e[25]=R);let z;return e[26]!==N||e[27]!==I||e[28]!==R||e[29]!==j||e[30]!==M?(z=(0,Z.jsxs)(Z.Fragment,{children:[D,j,M,N,I,R]}),e[26]=N,e[27]=I,e[28]=R,e[29]=j,e[30]=M,e[31]=z):z=e[31],z}var uP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
32
32
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
33
33
  <path d="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"/>
34
34
  </symbol>
@@ -45,68 +45,68 @@ Error generating stack: `+e.message+`
45
45
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
46
46
  <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" />
47
47
  </symbol>
48
- </svg>`,cP=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
48
+ </svg>`,dP=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
49
49
  <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"/>
50
50
  <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"/>
51
- </symbol>`,lP=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
51
+ </symbol>`,fP=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
52
52
  <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"/>
53
- </symbol>`,uP=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
53
+ </symbol>`,pP=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
54
54
  <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"/>
55
55
  <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"/>
56
- </symbol>`,dP=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
56
+ </symbol>`,mP=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
57
57
  <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"/>
58
- </symbol>`,fP=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
58
+ </symbol>`,hP=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
59
59
  <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"/>
60
60
  <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"/>
61
- </symbol>`,pP=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
61
+ </symbol>`,gP=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
62
62
  <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"/>
63
63
  <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"/>
64
64
  <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"/>
65
- </symbol>`,mP=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
65
+ </symbol>`,_P=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
66
66
  <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"/>
67
- </symbol>`,hP=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
67
+ </symbol>`,vP=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
68
68
  <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"/>
69
- </symbol>`,gP=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
69
+ </symbol>`,yP=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
70
70
  <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"/>
71
71
  <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"/>
72
- </symbol>`,_P=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
72
+ </symbol>`,bP=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
73
73
  <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"/>
74
74
  <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"/>
75
75
  <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"/>
76
- </symbol>`,vP=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
76
+ </symbol>`,xP=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
77
77
  <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"/>
78
78
  <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"/>
79
- </symbol>`,yP=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
79
+ </symbol>`,SP=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
80
80
  <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"/>
81
81
  <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"/>
82
- </symbol>`,bP=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
82
+ </symbol>`,CP=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
83
83
  <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"/>
84
84
  <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"/>
85
- </symbol>`,xP=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
85
+ </symbol>`,wP=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
86
86
  <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"/>
87
- </symbol>`,SP=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
87
+ </symbol>`,TP=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
88
88
  <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"/>
89
- </symbol>`,CP=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
89
+ </symbol>`,EP=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
90
90
  <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"/>
91
- </symbol>`,wP=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
91
+ </symbol>`,DP=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
92
92
  <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"/>
93
- </symbol>`,TP=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
93
+ </symbol>`,OP=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
94
94
  <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"/>
95
95
  <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"/>
96
- </symbol>`,EP=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
96
+ </symbol>`,kP=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
97
97
  <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"/>
98
98
  <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"/>
99
- </symbol>`,DP=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
99
+ </symbol>`,AP=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
100
100
  <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"/>
101
101
  <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"/>
102
- </symbol>`,OP=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
102
+ </symbol>`,jP=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
103
103
  <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"/>
104
- </symbol>`,kP=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
104
+ </symbol>`,MP=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
105
105
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
106
- </symbol>`,AP=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
106
+ </symbol>`,NP=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
107
107
  <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"/>
108
108
  <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"/>
109
- </symbol>`,jP=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
109
+ </symbol>`,PP=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
110
110
  <defs>
111
111
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
112
112
  <stop stop-color="currentColor"/>
@@ -116,82 +116,82 @@ Error generating stack: `+e.message+`
116
116
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
117
117
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
118
118
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
119
- </symbol>`,MP=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
119
+ </symbol>`,FP=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
120
120
  <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"/>
121
121
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
122
- </symbol>`,NP=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
122
+ </symbol>`,IP=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
123
123
  <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"/>
124
- </symbol>`,PP=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
124
+ </symbol>`,LP=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
125
125
  <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"/>
126
- </symbol>`,FP=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
126
+ </symbol>`,RP=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
127
127
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
128
128
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
129
129
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
130
130
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
131
- </symbol>`,IP=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
131
+ </symbol>`,zP=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
132
132
  <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"/>
133
133
  <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"/>
134
- </symbol>`,LP=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
134
+ </symbol>`,BP=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
135
135
  <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"/>
136
136
  <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"/>
137
- </symbol>`,RP=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
137
+ </symbol>`,VP=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
138
138
  <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"/>
139
- </symbol>`,zP=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
139
+ </symbol>`,HP=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
140
140
  <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"/>
141
- </symbol>`,BP=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
141
+ </symbol>`,UP=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
142
142
  <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"/>
143
- </symbol>`,VP=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
143
+ </symbol>`,WP=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
144
144
  <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"/>
145
145
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
146
- </symbol>`,HP=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
146
+ </symbol>`,GP=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
147
147
  <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"/>
148
- </symbol>`,UP=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
148
+ </symbol>`,KP=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
149
149
  <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"/>
150
150
  <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"/>
151
- </symbol>`,WP=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
151
+ </symbol>`,qP=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
152
152
  <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"/>
153
153
  <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"/>
154
- </symbol>`,GP=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
154
+ </symbol>`,JP=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
155
155
  <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"/>
156
- </symbol>`,KP=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
156
+ </symbol>`,YP=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
157
157
  <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"/>
158
158
  <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"/>
159
- </symbol>`,qP=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
159
+ </symbol>`,XP=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
160
160
  <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"/>
161
- </symbol>`,JP=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
161
+ </symbol>`,ZP=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
162
162
  <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"/>
163
- </symbol>`,YP=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
163
+ </symbol>`,QP=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
164
164
  <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"/>
165
165
  <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"/>
166
- </symbol>`,XP=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
166
+ </symbol>`,$P=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
167
167
  <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"/>
168
168
  <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"/>
169
- </symbol>`,ZP=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
169
+ </symbol>`,eF=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
170
170
  <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"/>
171
- </symbol>`,QP=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
171
+ </symbol>`,tF=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
172
172
  <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"/>
173
173
  <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"/>
174
174
  <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"/>
175
- </symbol>`,$P=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
175
+ </symbol>`,nF=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
176
176
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
177
177
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
178
- </symbol>`,eF=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
178
+ </symbol>`,rF=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
179
179
  <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"/>
180
180
  <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"/>
181
181
  <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"/>
182
- </symbol>`,tF=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
182
+ </symbol>`,iF=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
183
183
  <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"/>
184
184
  <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"/>
185
- </symbol>`,nF=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
185
+ </symbol>`,aF=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
186
186
  <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"/>
187
- </symbol>`,rF=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
187
+ </symbol>`,oF=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
188
188
  <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"/>
189
189
  <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"/>
190
- </symbol>`,iF=[uP,gP,_P,vP,xP,SP,CP,TP,EP,DP,OP,kP,AP,IP,RP,zP,GP,KP,YP,XP,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
190
+ </symbol>`,sF=[pP,yP,bP,xP,wP,TP,EP,OP,kP,AP,jP,MP,NP,zP,VP,HP,JP,YP,QP,$P,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
191
191
  <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"/>
192
192
  <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"/>
193
- </symbol>`],aF=[cP,lP,dP,fP,pP,mP,hP,yP,bP,wP,jP,MP,NP,PP,FP,LP,BP,VP,HP,UP,WP,qP,JP,ZP,QP,$P,eF,tF,nF,rF];function oF(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
194
- `)}\n</svg>`)}var sF=oF(sP,iF),cF={minimal:sP,standard:sF,complete:oF(sF,aF)},lF={".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`},uF={"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`},dF={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},fF=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),pF=new Set([`complete`]);function mF(e){return cF[e===`none`?`minimal`:e]}function hF(e){return`file-tree-builtin-${e}`}function gF(e){return e!==`none`&&pF.has(e)}function _F(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=lF[t.toLowerCase()];if(i!=null&&(r||fF.has(i)))return i;for(let e of n){if(r){let t=dF[e];if(t!=null)return t}let t=uF[e];if(t!=null&&(r||fF.has(t)))return t}return`default`}var vF=`file-tree-container`,yF=`data-file-tree-style`,bF=`data-file-tree-unsafe-css`,xF=`data-file-tree-scrollbar-measure`,SF=`data-file-tree-scrollbar-gutter-measured`,CF=`--trees-scrollbar-gutter-measured`,wF=`header`,TF=`context-menu`,EF=`context-menu-trigger`;function DF(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function OF(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(DF(e)?`none`:`complete`),colored:e.colored??!0}}var kF=e=>e.trim().toLowerCase(),AF=e=>e.split(`/`).at(-1)??e,jF=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 MF(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function NF(e){let t=OF(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(kF(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=AF(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return MF(c,e);for(let[t,n]of a)if(s.includes(t))return MF(n,e);let l=jF(n);for(let t of l){let n=i.get(t);if(n!=null)return MF(n,e)}let u=_F(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:hF(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:MF(s,e)}}}var PF=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,FF=/^0(?:\.0+)?%?$/;function IF(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 LF(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||PF.test(t))return!0;let n=IF(t);return n!=null&&FF.test(n)}function RF(e){return LF(e)?void 0:e}function zF(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=RF(t[`list.focusOutline`])??RF(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 BF=5,VF=1<<BF,HF=VF*4;function UF(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function WF(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function GF(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 KF(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 qF(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function JF(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 YF(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,$F(e,t)}function XF(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=KF(e).get(t);if(i===void 0)return;let a=i>>BF;e.childVisibleChunkSums[a]+=r}function ZF(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=eI(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=VF}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 QF(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>BF;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<BF}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 $F(e,t){if(t.childIds.length<HF){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/VF),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>>BF]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function eI(e,t,n,r){let i=Math.min(t.childIds.length,n+VF),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 tI=7,nI=3,rI=1<<nI,iI=4;function aI(e,t,n=0){return e<<iI|n<<nI|t}function oI(e){return e.depthAndFlags>>>iI}function sI(e){return(e.depthAndFlags&rI)>>nI}function cI(e){return(e.depthAndFlags&rI)!==0}function lI(e){return e.depthAndFlags&tI}function uI(e,t){return(lI(e)&t)!==0}function dI(e,t){e.depthAndFlags|=t}function fI(e,t){e.depthAndFlags=aI(t,lI(e),sI(e))}var pI=Symbol(`benchmarkInstrumentation`);function mI(e,t){return t==null||Object.defineProperty(e,pI,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function hI(e){return e==null?null:e[pI]??null}function gI(e,t,n){return e==null?n():e.measurePhase(t,n)}function _I(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function vI(e){return e>=48&&e<=57}function yI(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!vI(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&&vI(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 bI(e){let t=e.toLowerCase();return{lowerValue:t,tokens:yI(t)}}function xI(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 SI(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=xI(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function CI(e,t,n){let r=SI(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function wI(e,t){return CI(e,t,bI)}function TI(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function EI(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=TI(e,r);return a===TI(t,r)?wI(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 DI(e,t){return EI(e,t)}function OI(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=bI(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=TI(e,n);return o===TI(t,n)?CI(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 kI(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=bI(r);return e.sortKeyById[t]=i,i}function AI(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function jI(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 MI(e){let{hasTrailingSlash:t,segments:n}=jI(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function NI(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=jI(e);return{requiresDirectory:t,segments:n}}var PI=``;function FI(){let e=new Map;return e.set(PI,0),{idByValue:e,valueById:[PI],sortKeyById:[bI(PI)]}}function II(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 LI(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var RI=Symbol(`pathStorePreparedInputKind`);function zI(e,t){return e[RI]=t,e}function BI(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function VI(e,t,n){return n===`default`?DI(e,t):n(BI(e),BI(t))}function HI(){return{depthAndFlags:aI(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function UI(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 WI(e){return e.isDirectory?e.segments.length:e.segments.length-1}function GI(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 KI(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function qI(e,t={}){return $I(e,t).map(e=>e.path)}function JI(e,t={}){let n=$I(e,t);return zI({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function YI(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 zI({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function XI(e){let t=e,n=t.preparedPaths;if(t[RI]===`prepared`&&n!=null)return n;if(!GI(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function ZI(e){let t=e;return t[RI]===`presorted`&&t.presortedPaths!=null||KI(t.presortedPaths)?t.presortedPaths:null}function QI(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function $I(e,t={}){let n=AI(t),r=hI(t);_I(r,`workload.inputFiles`,e.length);let i=gI(r,`store.preparePathEntries.parse`,()=>e.map(e=>MI(e)));return gI(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>VI(e,t,n.sort))),i}var eL=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[HI()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=FI();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=hI(e),this.options=AI(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,UF())}appendPaths(e){return gI(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>MI(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,gI(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return gI(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:aI(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:aI(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:aI(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=MI(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:aI(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:aI(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=MI(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(gI(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||gI(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`?OI(this.lastPreparedPath,e,this.segmentSortKeyCache):VI(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=WI(e),i=n==null?0:WI(n),a=n==null?0:UI(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=II(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:aI(oI(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),qF(i,s),s}createFileChildUnchecked(e,t){let n=II(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:aI(oI(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),a}getOrCreateDirectoryChild(e,t){let n=II(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&&!cI(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:aI(oI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),this.directories.set(a,UF()),a}createDirectoryChild(e,t){let n=II(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:aI(oI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),this.directories.set(a,UF()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!cI(n))throw Error(`Path is not a directory: "${t}"`);if(uI(n,1))throw Error(`Duplicate path: "${t}"`);dI(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,WF());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(cI(a)){let t=WF();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;cI(n)&&this.directories.set(t,UF());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),qF(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!cI(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 YF(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function tL(e,t=`closed`,n=null){let r=rL(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 nL(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function rL(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 iL(e,t){return uI(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:oI(t)<=e.defaultExpansion}function aL(e,t,n=e.snapshot.nodes[t]){return n==null||!cI(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:iL(e,n)}function oL(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!cI(r))return;let i=iL(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 sL(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 cL(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function lL(e,t){let n=sL(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 uL(e,t){let n=sL(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function dL(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 fL(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function pL(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 mL(e,t){e.directoryLoadInfoById.delete(t)}function hL(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 gL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function _L(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function vL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function yL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function bL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function xL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function SL(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 CL(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 wL(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 TL(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 EL(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 DL(e,t,n){return{...n,visibleCountDelta:RL(e)-t}}function OL(e,t){let n=RL(e),r=nL();e.transactionStack.push(r);try{t()}catch(t){throw jL(e,r,!1),t}jL(e,r,!0,RL(e)-n)}function kL(e,t){let n=e.instrumentation;if(n==null){AL(e,t);return}gI(n,`store.events.record`,()=>AL(e,t))}function AL(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){IL(e,t);return}n.events.push(t),FL(n,t)}function jL(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?PL(i,t):gI(n,`store.events.batch.merge`,()=>PL(i,t));return}let a=ML(t,r),o=e.instrumentation;if(o==null){IL(e,a);return}gI(o,`store.events.batch.commit`,()=>IL(e,a))}function ML(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 NL(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function PL(e,t){for(let n of t.events)e.events.push(n);NL(e,t)}function FL(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function IL(e,t){let n=e.instrumentation;if(n==null){LL(e,t);return}gI(n,`store.events.emit`,()=>LL(e,t))}function LL(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function RL(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function zL(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!cI(n)||uI(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||!cI(a)?null:i}function BL(e,t){let n=t;for(;;){let t=zL(e,n);if(t==null)return n;n=t}}function VL(e,t){let n=[t],r=t;for(;;){let t=zL(e,r);if(t==null)return n;n.push(t),r=t}}function HL(e,t){let n=t==null?e.snapshot.rootId:QL(e,t);return n==null?[]:nR(e,n)}function UL(e,t){let n=MI(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=_R(e,gR(e,r)),{createdNodeIds:a,directoryId:o}=rR(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=tR(e,o);if(uI(n,1))throw Error(`Path already exists: "${t}"`);dI(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=aR(e,o,n.basename),s.add(c);YL(e,o);let l=_R(e,o);return gL({affectedAncestorIds:ZL(e,c),affectedNodeIds:[...s],path:t,projectionChanged:vR(i,l)})}function WL(e,t,n){let r=QL(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=tR(e,r);if(uI(i,2))throw Error(`The root node cannot be removed`);if(cI(i)&&eR(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=_R(e,a),s=mR(e,r);cR(e,a,r,i.nameId),hR(e,a),YL(e,a);let c=_R(e,a);return _L({affectedAncestorIds:ZL(e,a),affectedNodeIds:s,path:t,projectionChanged:vR(o,c),recursive:n.recursive===!0})}function GL(e,t,n,r){let i=QL(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=tR(e,i);if(uI(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=fR(e,i,n),c=_R(e,a.parentId),l=_R(e,s.parentId),u=LI(e.snapshot.segmentTable,a.nameId),d=II(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(cI(a)&&SR(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=GF(e.snapshot.nodes,eR(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&pR(e,p,o,sI(a))===`skip`)return null;let m=a.parentId;cR(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),xR(e,i),sR(e,s.parentId,i),hR(e,m),e.pathCacheVersion++,YL(e,m),s.parentId!==m&&YL(e,s.parentId);let h=_R(e,m),g=_R(e,s.parentId);return vL({affectedAncestorIds:[...new Set([...ZL(e,m),...ZL(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:yR([c,l],[h,g]),to:JL(e,i)})}function KL(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function qL(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function JL(e,t){let n=tR(e,t),r=KL(e,t);if(r!=null)return r;if(uI(n,2))return qL(e,t,``);let i=JL(e,n.parentId),a=LI(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return qL(e,t,cI(n)?`${o}/`:o)}function YL(e,t){let n=e.instrumentation;if(n==null){wR(e,t);return}gI(n,`store.recomputeCountsUpwardFrom`,()=>wR(e,t))}function XL(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||!cI(o)){CR(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){CR(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function ZL(e,t){let n=[],r=t;for(;r!=null;){let t=tR(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function QL(e,t){if(t.length===0)return e.snapshot.rootId;let n=NI(t);return $L(e,n.segments,n.requiresDirectory)}function $L(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=eR(e,r),a=GF(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=tR(e,r);return n&&!cI(i)?null:r}function eR(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 tR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uI(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function nR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uI(n,4))return[];if(!cI(n))return[JL(e,t)];if(eR(e,t).childIds.length===0)return uI(n,1)&&!uI(n,2)?[JL(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||uI(n,4)){i.pop();continue}if(!cI(n)){r.push(JL(e,t.nodeId)),i.pop();continue}let a=eR(e,t.nodeId);if(a.childIds.length===0){uI(n,1)&&!uI(n,2)&&r.push(JL(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 rR(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=II(e.snapshot.segmentTable,i),a=eR(e,r),o=GF(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!cI(tR(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=iR(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function iR(e,t,n){let r=tR(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:aI(oI(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,UF()),sR(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function aR(e,t,n){let r=II(e.snapshot.segmentTable,n),i=eR(e,t);if(GF(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ER(e,t,n)}"`);let a=tR(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:aI(oI(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),sR(e,t,o),e.activeNodeCount++,o}function oR(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}lR(e,n,o)<0?i=a:r=a+1}return r}function sR(e,t,n){let r=eR(e,t),i=tR(e,n);GF(e.snapshot.nodes,r).set(i.nameId,n),XF(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=oR(e,r,n);r.childIds.splice(a,0,n),JF(r,a),$F(e.snapshot.nodes,r)}function cR(e,t,n,r){let i=eR(e,t),a=KF(i),o=a.get(n)??-1;GF(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&XF(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),JF(i,o),$F(e.snapshot.nodes,i))}function lR(e,t,n){let r=e.snapshot.options.sort;return r===`default`?uR(e,t,n):r(dR(e,t),dR(e,n))}function uR(e,t,n){let r=tR(e,t),i=tR(e,n),a=cI(r);if(a!==cI(i))return a?-1:1;let o=SI(kI(e.snapshot.segmentTable,r.nameId),kI(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=LI(e.snapshot.segmentTable,r.nameId),c=LI(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function dR(e,t){let n=tR(e,t),r=JL(e,t),i=cI(n),a=i?r.slice(0,-1):r;return{basename:LI(e.snapshot.segmentTable,n.nameId),depth:oI(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function fR(e,t,n){let r=tR(e,t),i=QL(e,n);if(i!=null){let t=tR(e,i);if(cI(t))return{basename:LI(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=NI(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=NI(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:$L(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function pR(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${JL(e,t)}"`);let i=tR(e,t);if(sI(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(cI(i)&&eR(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return mR(e,t),cR(e,a,t,o),hR(e,a),YL(e,a),`handled`}function mR(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=tR(e,t.nodeId);if(t.visitedChildren||!cI(i)){cI(i)&&e.snapshot.directories.delete(t.nodeId),dI(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),mL(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=eR(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 hR(e,t){let n=t;for(;n!=null;){let t=tR(e,n);if(!cI(t)||uI(t,2)||eR(e,n).childIds.length>0)return;dI(t,1),n=t.parentId===n?null:t.parentId}}function gR(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=GF(e.snapshot.nodes,eR(e,n)).get(t);if(i==null||!cI(tR(e,i)))break;n=i}return n}function _R(e,t){let n=bR(e,t);if(n==null)return null;let r=BL(e,n),i=tR(e,r),a=n===r?null:VL(e,n).map(t=>JL(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:eR(e,r).childIds.length>0,path:JL(e,r),terminalKind:sI(i)})}function vR(e,t){return yR([e],[t])}function yR(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 bR(e,t){let n=t;for(;n!=null;){let t=tR(e,n);if(!cI(t)||uI(t,2))return null;if(!aL(e,n,t))return n;n=t.parentId}return null}function xR(e,t){let n=tR(e,t);if(fI(n,(t===e.snapshot.rootId?-1:oI(tR(e,n.parentId)))+1),!cI(n))return;let r=eR(e,t);for(let t of r.childIds)xR(e,t)}function SR(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=tR(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function CR(e,t,n=tR(e,t),r=!1){let i=e.instrumentation;if(i==null){TR(e,t,n,r);return}gI(i,`store.recomputeNodeCounts`,()=>TR(e,t,n,r))}function wR(e,t){let n=t;for(;n!=null;){let t=tR(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(CR(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&XF(eR(e,s),n,a,o),n=s}}function TR(e,t,n,r){if(!cI(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=eR(e,t);if(r){let t=e.instrumentation;t==null?YF(e.snapshot.nodes,i):gI(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>YF(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,uI(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=zL(e,t)==null?aL(e,t,n)?1+o:1:o}function ER(e,t,n){let r=JL(e,t);return r.length===0?n:`${r}${n}`}function DR(e){return e!=null&&!uI(e,4)}function OR(e,t){let n=e.snapshot.nodes[t];return!DR(n)||!cI(n)||uI(n,2)?null:n}function kR(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&DR(e.snapshot.nodes[n])&&(t+=1);return t}function AR(e){return Math.max(0,e.valueById.length-1)}function jR(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:kR(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:AR(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function MR(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 NR(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)OR(e,n)!=null&&t.push(JL(e,n));for(let t of e.expandedDirectoryIds)OR(e,t)!=null&&n.push(JL(e,t));return{collapsedPaths:t,expandedPaths:n}}function PR(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)OR(e,n)==null||cL(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:JL(e,n)});return t}function FR(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=QL(e,n);t!=null&&oL(e,t,!0,tR(e,t))}for(let n of t.collapsedPaths){let t=QL(e,n);t!=null&&oL(e,t,!1,tR(e,t))}}function IR(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=QL(e,n.path);t!=null&&OR(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function LR(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function RR(e){let t=e.snapshot.segmentTable,n=FI();for(let r of e.snapshot.nodes)if(DR(r)){if(uI(r,2)){r.nameId=0;continue}r.nameId=II(n,LI(t,r.nameId))}e.snapshot.segmentTable=n}function zR(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!DR(r)||!cI(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return DR(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[tR(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),YF(e.snapshot.nodes,n)}}function BR(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(DR(n))break;--t}e.snapshot.nodes.length=t+1}function VR(e){let t=NR(e),n=PR(e);gI(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>LR(e)),gI(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>RR(e)),gI(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>zR(e)),gI(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>BR(e)),gI(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>FR(e,t)),gI(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>IR(e,n)),gI(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>XL(e,e.snapshot.rootId))}function HR(e){let t=NR(e),n=PR(e),r=gI(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>HL(e)),i=mI({...e.snapshot.options},e.instrumentation),a=gI(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new eL(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,gI(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>FR(e,t)),gI(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>IR(e,n)),gI(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>XL(e,e.snapshot.rootId))}function UR(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function WR(e,t){let n=jR(e);t===`stable`?gI(e.instrumentation,`store.cleanup.stable`,()=>VR(e)):gI(e.instrumentation,`store.cleanup.aggressive`,()=>HR(e));let r=jR(e);return MR(t,t===`stable`,n,r)}var GR=64;function KR(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 qR(e){return tR(e,e.snapshot.rootId).visibleSubtreeCount}function JR(e,t,n,r){let i=tR(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function YR(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:mz(e,t.cursor),setSize:t.setSize,subtreeEndIndex:JR(e,t.cursor,t.index,n)}}function XR(e,t,n,r,i,a){let o=eR(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=ZF(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ZR(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ZR(e,t,n,r,i,a,o,s){if(!cI(tR(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=cz(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=tR(e,c.terminalNodeId);if(!cI(l)||!aL(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return XR(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function QR(e,t){let n=qR(e);if(t<0||t>=n)return null;let r=XR(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>JL(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=YR(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:mz(e,r.cursor),setSize:r.setSize,subtreeEndIndex:JR(e,r.cursor,r.index,n)}}function $R(e,t,n){let r=e.instrumentation,i=qR(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 pz(e,o+1);let t=[],n=az(e,a);for(let r=a;r<=o&&n!=null;r++){let r=mz(e,n);t.push(r),n=uz(e,n)}return t}let s=[],c=0,l=0,u=gI(r,`store.getVisibleSlice.selectFirstRow`,()=>az(e,a));for(let t=a;t<=o&&u!=null;t++){let t=gI(r,`store.getVisibleSlice.materializeRow`,()=>mz(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=gI(r,`store.getVisibleSlice.advanceCursor`,()=>uz(e,u))}return _I(r,`workload.visibleRowsRead`,s.length),_I(r,`workload.flattenedRowsRead`,c),_I(r,`workload.flattenedSegmentsRead`,l),s}function ez(e,t=qR(e)){let n=e.instrumentation;return n==null?fz(e,t):gI(n,`store.getVisibleTreeProjection`,()=>fz(e,t))}function tz(e){return dz(ez(e))}function nz(e,t){let n=QL(e,t);if(n==null||n===e.snapshot.rootId||cI(tR(e,n))&&BL(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=tR(e,i).parentId,n=eR(e,t),s=KF(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=QF(a,n,s),t!==o){let n=tR(e,t),a=zL(e,t);if(!aL(e,t,n)&&a!==i)return null;BL(e,t)===t&&(r+=1)}i=t}return r}function rz(e,t){let n=QL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=tR(e,n);if(!cI(r))throw Error(`Path is not a directory: "${t}"`);return aL(e,n,r)?null:(oL(e,n,!0,r),YL(e,n),yL({affectedAncestorIds:ZL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function iz(e,t){let n=QL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=tR(e,n);if(!cI(r))throw Error(`Path is not a directory: "${t}"`);return aL(e,n,r)?(oL(e,n,!1,r),YL(e,n),bL({affectedAncestorIds:ZL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function az(e,t){return t<0||t>=qR(e)?null:oz(e,e.snapshot.rootId,t,-1)}function oz(e,t,n,r){let i=eR(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?ZF(e.snapshot.nodes,i,n):gI(a,`store.getVisibleSlice.selectChildIndex`,()=>ZF(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return sz(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function sz(e,t,n,r){if(!cI(tR(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=cz(e,t,r);if(n===0)return i;let a=tR(e,i.terminalNodeId);if(!cI(a)||!aL(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return oz(e,i.terminalNodeId,n-1,i.visibleDepth)}function cz(e,t,n){return cI(tR(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:BL(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:gI(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>BL(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function lz(e,t){let n=tR(e,t);if(!cI(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:zL(e,r)!==t}function uz(e,t){let n=tR(e,t.terminalNodeId);if(cI(n)){let r=eR(e,t.terminalNodeId);if(aL(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:sz(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=tR(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=eR(e,n),o=KF(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 sz(e,s,0,i);lz(e,r)&&i--,r=n}}function dz(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 fz(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(GR);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=KR(o,y);let x,S=_;if(cI(v))S=f?BL(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:JL(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&&cI(C)&&aL(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 pz(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(!cI(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:JL(e,f)};continue}let h=l?BL(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=mz(e,g);let _=i[h];_!=null&&cI(_)&&aL(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function mz(e,t){let n=tR(e,t.terminalNodeId),r=cI(n)?hz(e,t):null,i=JL(e,t.terminalNodeId),a=LI(e.snapshot.segmentTable,n.nameId),o=cI(n)&&eR(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?VL(e,t.headNodeId).map(n=>{let r=tR(e,n);return{isTerminal:n===t.terminalNodeId,name:LI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:JL(e,n)}}):gI(c,`store.getVisibleSlice.flatten.collectSegments`,()=>VL(e,t.headNodeId).map(n=>{let r=tR(e,n);return{isTerminal:n===t.terminalNodeId,name:LI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:JL(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:cI(n)&&aL(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:cI(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function hz(e,t){if(t.headNodeId===t.terminalNodeId)return cL(e,t.terminalNodeId);let n=VL(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=cL(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function gz(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||!cI(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&&$F(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&cI(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,$F(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function _z(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var vz=class e{#e;constructor(e={}){let t=hI(e),n=gI(t,`store.builder.create`,()=>new eL(e));if(e.preparedInput!=null){let t=ZI(e.preparedInput);t==null?n.appendPreparedPaths(XI(e.preparedInput),!1):n.appendPresortedPaths(t,QI(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(gI(t,`store.preparePathEntries`,()=>$I(r,e)))}let r=gI(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=gI(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=gI(t,`store.state.create`,()=>tL(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:gI(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||_z(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&gI(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?gI(t,`store.state.initializeOpenVisibleCounts`,()=>gz(this.#e)):gI(t,`store.state.recomputeCounts`,()=>XL(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return qI(e,t)}static prepareInput(e,t={}){return JI(e,t)}static preparePresortedInput(e){return YI(e)}list(e){return gI(this.#e.instrumentation,`store.list`,()=>HL(this.#e,e))}add(e){gI(this.#e.instrumentation,`store.add`,()=>{let t=qR(this.#e);kL(this.#e,DL(this.#e,t,UL(this.#e,e)))})}remove(e,t={}){gI(this.#e.instrumentation,`store.remove`,()=>{let n=qR(this.#e);kL(this.#e,DL(this.#e,n,WL(this.#e,e,t)))})}move(e,t,n={}){gI(this.#e.instrumentation,`store.move`,()=>{let r=qR(this.#e),i=GL(this.#e,e,t,n);i!=null&&kL(this.#e,DL(this.#e,r,i))})}batch(e){OL(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 gI(this.#e.instrumentation,`store.getVisibleCount`,()=>qR(this.#e))}getVisibleSlice(e,t){return gI(this.#e.instrumentation,`store.getVisibleSlice`,()=>$R(this.#e,e,t))}getVisibleRowContext(e){return gI(this.#e.instrumentation,`store.getVisibleRowContext`,()=>QR(this.#e,e))}getVisibleTreeProjection(){return tz(this.#e)}getVisibleTreeProjectionData(e){return ez(this.#e,e)}getVisibleIndex(e){return gI(this.#e.instrumentation,`store.getVisibleIndex`,()=>nz(this.#e,e))}getPathInfo(e){return gI(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=QL(this.#e,e);if(t==null)return null;let n=tR(this.#e,t);return{depth:oI(n),kind:cI(n)?`directory`:`file`,path:JL(this.#e,t)}})}isExpanded(e){return gI(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=tR(this.#e,t);return aL(this.#e,t,n)})}expand(e){gI(this.#e.instrumentation,`store.expand`,()=>{let t=qR(this.#e),n=rz(this.#e,e);n!=null&&kL(this.#e,DL(this.#e,t,n))})}collapse(e){gI(this.#e.instrumentation,`store.collapse`,()=>{let t=qR(this.#e),n=iz(this.#e,e);n!=null&&kL(this.#e,DL(this.#e,t,n))})}on(e,t){return hL(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return cL(this.#e,t)}markDirectoryUnloaded(e){gI(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(eR(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=qR(this.#e);uL(this.#e,t),kL(this.#e,DL(this.#e,n,xL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return gI(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=qR(this.#e),r=lL(this.#e,t);return kL(this.#e,DL(this.#e,n,SL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return gI(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||cL(this.#e,n)!==`loading`||!fL(this.#e,n,e.attemptId))return!1;let r=JL(this.#e,n);this.validateChildPatch(r,t);let i=qR(this.#e),a=[];for(let e of t.operations){yz(r,e);let t=qR(this.#e);switch(e.type){case`add`:a.push(DL(this.#e,t,UL(this.#e,e.path)));break;case`remove`:a.push(DL(this.#e,t,WL(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=GL(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(DL(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return kL(this.#e,DL(this.#e,i,CL({affectedAncestorIds:ZL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:JL(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return gI(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=qR(this.#e),r=dL(this.#e,t,e.attemptId);return kL(this.#e,DL(this.#e,n,wL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:JL(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return gI(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=qR(this.#e),i=pL(this.#e,n,e.attemptId,t);return kL(this.#e,DL(this.#e,r,TL({affectedAncestorIds:ZL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:JL(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return gI(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(UR(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=qR(this.#e),n=WR(this.#e,e.mode??`stable`);return kL(this.#e,DL(this.#e,t,EL({...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=eR(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??bI(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=SI(kI(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(!cI(tR(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=tR(this.#e,n);aL(this.#e,n,i)||(oL(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=tR(this.#e,e);if(!aL(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=QL(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!cI(tR(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!cI(tR(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=tR(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=tR(this.#e,e),r=zL(this.#e,e);if(!aL(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 yz(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 bz={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function xz(e,t){if(typeof e==`number`)return{itemHeight:t??bz.default.itemHeight,factor:e};let n=bz[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Sz=bz.default.itemHeight,Cz=`@layer base, theme, unsafe;
193
+ </symbol>`],cF=[dP,fP,mP,hP,gP,_P,vP,SP,CP,DP,PP,FP,IP,LP,RP,BP,UP,WP,GP,KP,qP,XP,ZP,eF,tF,nF,rF,iF,aF,oF];function lF(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
194
+ `)}\n</svg>`)}var uF=lF(uP,sF),dF={minimal:uP,standard:uF,complete:lF(uF,cF)},fF={".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`},pF={"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`},mF={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},hF=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),gF=new Set([`complete`]);function _F(e){return dF[e===`none`?`minimal`:e]}function vF(e){return`file-tree-builtin-${e}`}function yF(e){return e!==`none`&&gF.has(e)}function bF(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=fF[t.toLowerCase()];if(i!=null&&(r||hF.has(i)))return i;for(let e of n){if(r){let t=mF[e];if(t!=null)return t}let t=pF[e];if(t!=null&&(r||hF.has(t)))return t}return`default`}var xF=`file-tree-container`,SF=`data-file-tree-style`,CF=`data-file-tree-unsafe-css`,wF=`data-file-tree-scrollbar-measure`,TF=`data-file-tree-scrollbar-gutter-measured`,EF=`--trees-scrollbar-gutter-measured`,DF=`header`,OF=`context-menu`,kF=`context-menu-trigger`;function AF(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function jF(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(AF(e)?`none`:`complete`),colored:e.colored??!0}}var MF=e=>e.trim().toLowerCase(),NF=e=>e.split(`/`).at(-1)??e,PF=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 FF(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function IF(e){let t=jF(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(MF(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=NF(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return FF(c,e);for(let[t,n]of a)if(s.includes(t))return FF(n,e);let l=PF(n);for(let t of l){let n=i.get(t);if(n!=null)return FF(n,e)}let u=bF(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:vF(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:FF(s,e)}}}var LF=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,RF=/^0(?:\.0+)?%?$/;function zF(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 BF(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||LF.test(t))return!0;let n=zF(t);return n!=null&&RF.test(n)}function VF(e){return BF(e)?void 0:e}function HF(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=VF(t[`list.focusOutline`])??VF(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 UF=5,WF=1<<UF,GF=WF*4;function KF(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function qF(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function JF(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 YF(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 XF(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function ZF(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 QF(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,nI(e,t)}function $F(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=YF(e).get(t);if(i===void 0)return;let a=i>>UF;e.childVisibleChunkSums[a]+=r}function eI(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=rI(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=WF}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 tI(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>UF;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<UF}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 nI(e,t){if(t.childIds.length<GF){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/WF),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>>UF]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function rI(e,t,n,r){let i=Math.min(t.childIds.length,n+WF),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 iI=7,aI=3,oI=1<<aI,sI=4;function cI(e,t,n=0){return e<<sI|n<<aI|t}function lI(e){return e.depthAndFlags>>>sI}function uI(e){return(e.depthAndFlags&oI)>>aI}function dI(e){return(e.depthAndFlags&oI)!==0}function fI(e){return e.depthAndFlags&iI}function pI(e,t){return(fI(e)&t)!==0}function mI(e,t){e.depthAndFlags|=t}function hI(e,t){e.depthAndFlags=cI(t,fI(e),uI(e))}var gI=Symbol(`benchmarkInstrumentation`);function _I(e,t){return t==null||Object.defineProperty(e,gI,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function vI(e){return e==null?null:e[gI]??null}function yI(e,t,n){return e==null?n():e.measurePhase(t,n)}function bI(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function xI(e){return e>=48&&e<=57}function SI(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!xI(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&&xI(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 CI(e){let t=e.toLowerCase();return{lowerValue:t,tokens:SI(t)}}function wI(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 TI(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=wI(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function EI(e,t,n){let r=TI(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function DI(e,t){return EI(e,t,CI)}function OI(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function kI(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=OI(e,r);return a===OI(t,r)?DI(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 AI(e,t){return kI(e,t)}function jI(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=CI(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=OI(e,n);return o===OI(t,n)?EI(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 MI(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=CI(r);return e.sortKeyById[t]=i,i}function NI(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function PI(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 FI(e){let{hasTrailingSlash:t,segments:n}=PI(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function II(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=PI(e);return{requiresDirectory:t,segments:n}}var LI=``;function RI(){let e=new Map;return e.set(LI,0),{idByValue:e,valueById:[LI],sortKeyById:[CI(LI)]}}function zI(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 BI(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var VI=Symbol(`pathStorePreparedInputKind`);function HI(e,t){return e[VI]=t,e}function UI(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function WI(e,t,n){return n===`default`?AI(e,t):n(UI(e),UI(t))}function GI(){return{depthAndFlags:cI(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function KI(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 qI(e){return e.isDirectory?e.segments.length:e.segments.length-1}function JI(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 YI(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function XI(e,t={}){return nL(e,t).map(e=>e.path)}function ZI(e,t={}){let n=nL(e,t);return HI({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function QI(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 HI({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function $I(e){let t=e,n=t.preparedPaths;if(t[VI]===`prepared`&&n!=null)return n;if(!JI(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function eL(e){let t=e;return t[VI]===`presorted`&&t.presortedPaths!=null||YI(t.presortedPaths)?t.presortedPaths:null}function tL(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function nL(e,t={}){let n=NI(t),r=vI(t);bI(r,`workload.inputFiles`,e.length);let i=yI(r,`store.preparePathEntries.parse`,()=>e.map(e=>FI(e)));return yI(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>WI(e,t,n.sort))),i}var rL=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[GI()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=RI();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=vI(e),this.options=NI(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,KF())}appendPaths(e){return yI(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>FI(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,yI(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return yI(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:cI(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:cI(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:cI(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=FI(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:cI(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:cI(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=FI(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(yI(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||yI(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`?jI(this.lastPreparedPath,e,this.segmentSortKeyCache):WI(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=qI(e),i=n==null?0:qI(n),a=n==null?0:KI(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=zI(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:cI(lI(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),XF(i,s),s}createFileChildUnchecked(e,t){let n=zI(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:cI(lI(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),XF(r,a),a}getOrCreateDirectoryChild(e,t){let n=zI(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&&!dI(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:cI(lI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),XF(r,a),this.directories.set(a,KF()),a}createDirectoryChild(e,t){let n=zI(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:cI(lI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),XF(r,a),this.directories.set(a,KF()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!dI(n))throw Error(`Path is not a directory: "${t}"`);if(pI(n,1))throw Error(`Duplicate path: "${t}"`);mI(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,qF());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(dI(a)){let t=qF();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;dI(n)&&this.directories.set(t,KF());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),XF(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!dI(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 QF(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function iL(e,t=`closed`,n=null){let r=oL(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 aL(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function oL(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 sL(e,t){return pI(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:lI(t)<=e.defaultExpansion}function cL(e,t,n=e.snapshot.nodes[t]){return n==null||!dI(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:sL(e,n)}function lL(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!dI(r))return;let i=sL(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 uL(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 dL(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function fL(e,t){let n=uL(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 pL(e,t){let n=uL(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function mL(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 hL(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function gL(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 _L(e,t){e.directoryLoadInfoById.delete(t)}function vL(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 yL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function bL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function xL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function SL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function CL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function wL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function TL(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 EL(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 DL(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 OL(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 kL(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 AL(e,t,n){return{...n,visibleCountDelta:VL(e)-t}}function jL(e,t){let n=VL(e),r=aL();e.transactionStack.push(r);try{t()}catch(t){throw PL(e,r,!1),t}PL(e,r,!0,VL(e)-n)}function ML(e,t){let n=e.instrumentation;if(n==null){NL(e,t);return}yI(n,`store.events.record`,()=>NL(e,t))}function NL(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){zL(e,t);return}n.events.push(t),RL(n,t)}function PL(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?LL(i,t):yI(n,`store.events.batch.merge`,()=>LL(i,t));return}let a=FL(t,r),o=e.instrumentation;if(o==null){zL(e,a);return}yI(o,`store.events.batch.commit`,()=>zL(e,a))}function FL(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 IL(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function LL(e,t){for(let n of t.events)e.events.push(n);IL(e,t)}function RL(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function zL(e,t){let n=e.instrumentation;if(n==null){BL(e,t);return}yI(n,`store.events.emit`,()=>BL(e,t))}function BL(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function VL(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function HL(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!dI(n)||pI(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||!dI(a)?null:i}function UL(e,t){let n=t;for(;;){let t=HL(e,n);if(t==null)return n;n=t}}function WL(e,t){let n=[t],r=t;for(;;){let t=HL(e,r);if(t==null)return n;n.push(t),r=t}}function GL(e,t){let n=t==null?e.snapshot.rootId:tR(e,t);return n==null?[]:aR(e,n)}function KL(e,t){let n=FI(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=bR(e,yR(e,r)),{createdNodeIds:a,directoryId:o}=oR(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=iR(e,o);if(pI(n,1))throw Error(`Path already exists: "${t}"`);mI(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=cR(e,o,n.basename),s.add(c);QL(e,o);let l=bR(e,o);return yL({affectedAncestorIds:eR(e,c),affectedNodeIds:[...s],path:t,projectionChanged:xR(i,l)})}function qL(e,t,n){let r=tR(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=iR(e,r);if(pI(i,2))throw Error(`The root node cannot be removed`);if(dI(i)&&rR(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=bR(e,a),s=_R(e,r);dR(e,a,r,i.nameId),vR(e,a),QL(e,a);let c=bR(e,a);return bL({affectedAncestorIds:eR(e,a),affectedNodeIds:s,path:t,projectionChanged:xR(o,c),recursive:n.recursive===!0})}function JL(e,t,n,r){let i=tR(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=iR(e,i);if(pI(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=hR(e,i,n),c=bR(e,a.parentId),l=bR(e,s.parentId),u=BI(e.snapshot.segmentTable,a.nameId),d=zI(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(dI(a)&&TR(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=JF(e.snapshot.nodes,rR(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&gR(e,p,o,uI(a))===`skip`)return null;let m=a.parentId;dR(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),wR(e,i),uR(e,s.parentId,i),vR(e,m),e.pathCacheVersion++,QL(e,m),s.parentId!==m&&QL(e,s.parentId);let h=bR(e,m),g=bR(e,s.parentId);return xL({affectedAncestorIds:[...new Set([...eR(e,m),...eR(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:SR([c,l],[h,g]),to:ZL(e,i)})}function YL(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function XL(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function ZL(e,t){let n=iR(e,t),r=YL(e,t);if(r!=null)return r;if(pI(n,2))return XL(e,t,``);let i=ZL(e,n.parentId),a=BI(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return XL(e,t,dI(n)?`${o}/`:o)}function QL(e,t){let n=e.instrumentation;if(n==null){DR(e,t);return}yI(n,`store.recomputeCountsUpwardFrom`,()=>DR(e,t))}function $L(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||!dI(o)){ER(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){ER(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function eR(e,t){let n=[],r=t;for(;r!=null;){let t=iR(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function tR(e,t){if(t.length===0)return e.snapshot.rootId;let n=II(t);return nR(e,n.segments,n.requiresDirectory)}function nR(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=rR(e,r),a=JF(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=iR(e,r);return n&&!dI(i)?null:r}function rR(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 iR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||pI(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function aR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||pI(n,4))return[];if(!dI(n))return[ZL(e,t)];if(rR(e,t).childIds.length===0)return pI(n,1)&&!pI(n,2)?[ZL(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||pI(n,4)){i.pop();continue}if(!dI(n)){r.push(ZL(e,t.nodeId)),i.pop();continue}let a=rR(e,t.nodeId);if(a.childIds.length===0){pI(n,1)&&!pI(n,2)&&r.push(ZL(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 oR(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=zI(e.snapshot.segmentTable,i),a=rR(e,r),o=JF(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!dI(iR(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=sR(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function sR(e,t,n){let r=iR(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:cI(lI(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,KF()),uR(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function cR(e,t,n){let r=zI(e.snapshot.segmentTable,n),i=rR(e,t);if(JF(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${kR(e,t,n)}"`);let a=iR(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:cI(lI(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),uR(e,t,o),e.activeNodeCount++,o}function lR(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}fR(e,n,o)<0?i=a:r=a+1}return r}function uR(e,t,n){let r=rR(e,t),i=iR(e,n);JF(e.snapshot.nodes,r).set(i.nameId,n),$F(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=lR(e,r,n);r.childIds.splice(a,0,n),ZF(r,a),nI(e.snapshot.nodes,r)}function dR(e,t,n,r){let i=rR(e,t),a=YF(i),o=a.get(n)??-1;JF(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&$F(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),ZF(i,o),nI(e.snapshot.nodes,i))}function fR(e,t,n){let r=e.snapshot.options.sort;return r===`default`?pR(e,t,n):r(mR(e,t),mR(e,n))}function pR(e,t,n){let r=iR(e,t),i=iR(e,n),a=dI(r);if(a!==dI(i))return a?-1:1;let o=TI(MI(e.snapshot.segmentTable,r.nameId),MI(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=BI(e.snapshot.segmentTable,r.nameId),c=BI(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function mR(e,t){let n=iR(e,t),r=ZL(e,t),i=dI(n),a=i?r.slice(0,-1):r;return{basename:BI(e.snapshot.segmentTable,n.nameId),depth:lI(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function hR(e,t,n){let r=iR(e,t),i=tR(e,n);if(i!=null){let t=iR(e,i);if(dI(t))return{basename:BI(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=II(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=II(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:nR(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function gR(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${ZL(e,t)}"`);let i=iR(e,t);if(uI(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(dI(i)&&rR(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return _R(e,t),dR(e,a,t,o),vR(e,a),QL(e,a),`handled`}function _R(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=iR(e,t.nodeId);if(t.visitedChildren||!dI(i)){dI(i)&&e.snapshot.directories.delete(t.nodeId),mI(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),_L(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=rR(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 vR(e,t){let n=t;for(;n!=null;){let t=iR(e,n);if(!dI(t)||pI(t,2)||rR(e,n).childIds.length>0)return;mI(t,1),n=t.parentId===n?null:t.parentId}}function yR(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=JF(e.snapshot.nodes,rR(e,n)).get(t);if(i==null||!dI(iR(e,i)))break;n=i}return n}function bR(e,t){let n=CR(e,t);if(n==null)return null;let r=UL(e,n),i=iR(e,r),a=n===r?null:WL(e,n).map(t=>ZL(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:rR(e,r).childIds.length>0,path:ZL(e,r),terminalKind:uI(i)})}function xR(e,t){return SR([e],[t])}function SR(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 CR(e,t){let n=t;for(;n!=null;){let t=iR(e,n);if(!dI(t)||pI(t,2))return null;if(!cL(e,n,t))return n;n=t.parentId}return null}function wR(e,t){let n=iR(e,t);if(hI(n,(t===e.snapshot.rootId?-1:lI(iR(e,n.parentId)))+1),!dI(n))return;let r=rR(e,t);for(let t of r.childIds)wR(e,t)}function TR(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=iR(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function ER(e,t,n=iR(e,t),r=!1){let i=e.instrumentation;if(i==null){OR(e,t,n,r);return}yI(i,`store.recomputeNodeCounts`,()=>OR(e,t,n,r))}function DR(e,t){let n=t;for(;n!=null;){let t=iR(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(ER(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&$F(rR(e,s),n,a,o),n=s}}function OR(e,t,n,r){if(!dI(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=rR(e,t);if(r){let t=e.instrumentation;t==null?QF(e.snapshot.nodes,i):yI(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>QF(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,pI(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=HL(e,t)==null?cL(e,t,n)?1+o:1:o}function kR(e,t,n){let r=ZL(e,t);return r.length===0?n:`${r}${n}`}function AR(e){return e!=null&&!pI(e,4)}function jR(e,t){let n=e.snapshot.nodes[t];return!AR(n)||!dI(n)||pI(n,2)?null:n}function MR(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&AR(e.snapshot.nodes[n])&&(t+=1);return t}function NR(e){return Math.max(0,e.valueById.length-1)}function PR(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:MR(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:NR(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function FR(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 IR(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)jR(e,n)!=null&&t.push(ZL(e,n));for(let t of e.expandedDirectoryIds)jR(e,t)!=null&&n.push(ZL(e,t));return{collapsedPaths:t,expandedPaths:n}}function LR(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)jR(e,n)==null||dL(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:ZL(e,n)});return t}function RR(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=tR(e,n);t!=null&&lL(e,t,!0,iR(e,t))}for(let n of t.collapsedPaths){let t=tR(e,n);t!=null&&lL(e,t,!1,iR(e,t))}}function zR(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=tR(e,n.path);t!=null&&jR(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function BR(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function VR(e){let t=e.snapshot.segmentTable,n=RI();for(let r of e.snapshot.nodes)if(AR(r)){if(pI(r,2)){r.nameId=0;continue}r.nameId=zI(n,BI(t,r.nameId))}e.snapshot.segmentTable=n}function HR(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!AR(r)||!dI(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return AR(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[iR(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),QF(e.snapshot.nodes,n)}}function UR(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(AR(n))break;--t}e.snapshot.nodes.length=t+1}function WR(e){let t=IR(e),n=LR(e);yI(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>BR(e)),yI(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>VR(e)),yI(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>HR(e)),yI(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>UR(e)),yI(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>RR(e,t)),yI(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>zR(e,n)),yI(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>$L(e,e.snapshot.rootId))}function GR(e){let t=IR(e),n=LR(e),r=yI(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>GL(e)),i=_I({...e.snapshot.options},e.instrumentation),a=yI(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new rL(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,yI(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>RR(e,t)),yI(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>zR(e,n)),yI(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>$L(e,e.snapshot.rootId))}function KR(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function qR(e,t){let n=PR(e);t===`stable`?yI(e.instrumentation,`store.cleanup.stable`,()=>WR(e)):yI(e.instrumentation,`store.cleanup.aggressive`,()=>GR(e));let r=PR(e);return FR(t,t===`stable`,n,r)}var JR=64;function YR(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 XR(e){return iR(e,e.snapshot.rootId).visibleSubtreeCount}function ZR(e,t,n,r){let i=iR(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function QR(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:_z(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ZR(e,t.cursor,t.index,n)}}function $R(e,t,n,r,i,a){let o=rR(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=eI(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ez(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ez(e,t,n,r,i,a,o,s){if(!dI(iR(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=dz(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=iR(e,c.terminalNodeId);if(!dI(l)||!cL(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return $R(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function tz(e,t){let n=XR(e);if(t<0||t>=n)return null;let r=$R(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>ZL(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=QR(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:_z(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ZR(e,r.cursor,r.index,n)}}function nz(e,t,n){let r=e.instrumentation,i=XR(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 gz(e,o+1);let t=[],n=cz(e,a);for(let r=a;r<=o&&n!=null;r++){let r=_z(e,n);t.push(r),n=pz(e,n)}return t}let s=[],c=0,l=0,u=yI(r,`store.getVisibleSlice.selectFirstRow`,()=>cz(e,a));for(let t=a;t<=o&&u!=null;t++){let t=yI(r,`store.getVisibleSlice.materializeRow`,()=>_z(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=yI(r,`store.getVisibleSlice.advanceCursor`,()=>pz(e,u))}return bI(r,`workload.visibleRowsRead`,s.length),bI(r,`workload.flattenedRowsRead`,c),bI(r,`workload.flattenedSegmentsRead`,l),s}function rz(e,t=XR(e)){let n=e.instrumentation;return n==null?hz(e,t):yI(n,`store.getVisibleTreeProjection`,()=>hz(e,t))}function iz(e){return mz(rz(e))}function az(e,t){let n=tR(e,t);if(n==null||n===e.snapshot.rootId||dI(iR(e,n))&&UL(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=iR(e,i).parentId,n=rR(e,t),s=YF(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=tI(a,n,s),t!==o){let n=iR(e,t),a=HL(e,t);if(!cL(e,t,n)&&a!==i)return null;UL(e,t)===t&&(r+=1)}i=t}return r}function oz(e,t){let n=tR(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=iR(e,n);if(!dI(r))throw Error(`Path is not a directory: "${t}"`);return cL(e,n,r)?null:(lL(e,n,!0,r),QL(e,n),SL({affectedAncestorIds:eR(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function sz(e,t){let n=tR(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=iR(e,n);if(!dI(r))throw Error(`Path is not a directory: "${t}"`);return cL(e,n,r)?(lL(e,n,!1,r),QL(e,n),CL({affectedAncestorIds:eR(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function cz(e,t){return t<0||t>=XR(e)?null:lz(e,e.snapshot.rootId,t,-1)}function lz(e,t,n,r){let i=rR(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?eI(e.snapshot.nodes,i,n):yI(a,`store.getVisibleSlice.selectChildIndex`,()=>eI(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return uz(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function uz(e,t,n,r){if(!dI(iR(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=dz(e,t,r);if(n===0)return i;let a=iR(e,i.terminalNodeId);if(!dI(a)||!cL(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return lz(e,i.terminalNodeId,n-1,i.visibleDepth)}function dz(e,t,n){return dI(iR(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:UL(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:yI(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>UL(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function fz(e,t){let n=iR(e,t);if(!dI(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:HL(e,r)!==t}function pz(e,t){let n=iR(e,t.terminalNodeId);if(dI(n)){let r=rR(e,t.terminalNodeId);if(cL(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:uz(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=iR(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=rR(e,n),o=YF(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 uz(e,s,0,i);fz(e,r)&&i--,r=n}}function mz(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 hz(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(JR);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=YR(o,y);let x,S=_;if(dI(v))S=f?UL(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:ZL(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&&dI(C)&&cL(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 gz(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(!dI(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:ZL(e,f)};continue}let h=l?UL(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=_z(e,g);let _=i[h];_!=null&&dI(_)&&cL(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function _z(e,t){let n=iR(e,t.terminalNodeId),r=dI(n)?vz(e,t):null,i=ZL(e,t.terminalNodeId),a=BI(e.snapshot.segmentTable,n.nameId),o=dI(n)&&rR(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?WL(e,t.headNodeId).map(n=>{let r=iR(e,n);return{isTerminal:n===t.terminalNodeId,name:BI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:ZL(e,n)}}):yI(c,`store.getVisibleSlice.flatten.collectSegments`,()=>WL(e,t.headNodeId).map(n=>{let r=iR(e,n);return{isTerminal:n===t.terminalNodeId,name:BI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:ZL(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:dI(n)&&cL(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:dI(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function vz(e,t){if(t.headNodeId===t.terminalNodeId)return dL(e,t.terminalNodeId);let n=WL(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=dL(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function yz(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||!dI(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&&nI(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&dI(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,nI(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function bz(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var xz=class e{#e;constructor(e={}){let t=vI(e),n=yI(t,`store.builder.create`,()=>new rL(e));if(e.preparedInput!=null){let t=eL(e.preparedInput);t==null?n.appendPreparedPaths($I(e.preparedInput),!1):n.appendPresortedPaths(t,tL(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(yI(t,`store.preparePathEntries`,()=>nL(r,e)))}let r=yI(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=yI(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=yI(t,`store.state.create`,()=>iL(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:yI(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||bz(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&yI(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?yI(t,`store.state.initializeOpenVisibleCounts`,()=>yz(this.#e)):yI(t,`store.state.recomputeCounts`,()=>$L(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return XI(e,t)}static prepareInput(e,t={}){return ZI(e,t)}static preparePresortedInput(e){return QI(e)}list(e){return yI(this.#e.instrumentation,`store.list`,()=>GL(this.#e,e))}add(e){yI(this.#e.instrumentation,`store.add`,()=>{let t=XR(this.#e);ML(this.#e,AL(this.#e,t,KL(this.#e,e)))})}remove(e,t={}){yI(this.#e.instrumentation,`store.remove`,()=>{let n=XR(this.#e);ML(this.#e,AL(this.#e,n,qL(this.#e,e,t)))})}move(e,t,n={}){yI(this.#e.instrumentation,`store.move`,()=>{let r=XR(this.#e),i=JL(this.#e,e,t,n);i!=null&&ML(this.#e,AL(this.#e,r,i))})}batch(e){jL(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 yI(this.#e.instrumentation,`store.getVisibleCount`,()=>XR(this.#e))}getVisibleSlice(e,t){return yI(this.#e.instrumentation,`store.getVisibleSlice`,()=>nz(this.#e,e,t))}getVisibleRowContext(e){return yI(this.#e.instrumentation,`store.getVisibleRowContext`,()=>tz(this.#e,e))}getVisibleTreeProjection(){return iz(this.#e)}getVisibleTreeProjectionData(e){return rz(this.#e,e)}getVisibleIndex(e){return yI(this.#e.instrumentation,`store.getVisibleIndex`,()=>az(this.#e,e))}getPathInfo(e){return yI(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=tR(this.#e,e);if(t==null)return null;let n=iR(this.#e,t);return{depth:lI(n),kind:dI(n)?`directory`:`file`,path:ZL(this.#e,t)}})}isExpanded(e){return yI(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=iR(this.#e,t);return cL(this.#e,t,n)})}expand(e){yI(this.#e.instrumentation,`store.expand`,()=>{let t=XR(this.#e),n=oz(this.#e,e);n!=null&&ML(this.#e,AL(this.#e,t,n))})}collapse(e){yI(this.#e.instrumentation,`store.collapse`,()=>{let t=XR(this.#e),n=sz(this.#e,e);n!=null&&ML(this.#e,AL(this.#e,t,n))})}on(e,t){return vL(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return dL(this.#e,t)}markDirectoryUnloaded(e){yI(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(rR(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=XR(this.#e);pL(this.#e,t),ML(this.#e,AL(this.#e,n,wL({affectedAncestorIds:eR(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return yI(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=XR(this.#e),r=fL(this.#e,t);return ML(this.#e,AL(this.#e,n,TL({affectedAncestorIds:eR(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return yI(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||dL(this.#e,n)!==`loading`||!hL(this.#e,n,e.attemptId))return!1;let r=ZL(this.#e,n);this.validateChildPatch(r,t);let i=XR(this.#e),a=[];for(let e of t.operations){Sz(r,e);let t=XR(this.#e);switch(e.type){case`add`:a.push(AL(this.#e,t,KL(this.#e,e.path)));break;case`remove`:a.push(AL(this.#e,t,qL(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=JL(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(AL(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return ML(this.#e,AL(this.#e,i,EL({affectedAncestorIds:eR(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:ZL(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return yI(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=XR(this.#e),r=mL(this.#e,t,e.attemptId);return ML(this.#e,AL(this.#e,n,DL({affectedAncestorIds:eR(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:ZL(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return yI(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=XR(this.#e),i=gL(this.#e,n,e.attemptId,t);return ML(this.#e,AL(this.#e,r,OL({affectedAncestorIds:eR(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:ZL(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return yI(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(KR(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=XR(this.#e),n=qR(this.#e,e.mode??`stable`);return ML(this.#e,AL(this.#e,t,kL({...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=rR(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??CI(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=TI(MI(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(!dI(iR(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=iR(this.#e,n);cL(this.#e,n,i)||(lL(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=iR(this.#e,e);if(!cL(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=tR(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!dI(iR(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!dI(iR(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=iR(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=iR(this.#e,e),r=HL(this.#e,e);if(!cL(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 Sz(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 Cz={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function wz(e,t){if(typeof e==`number`)return{itemHeight:t??Cz.default.itemHeight,factor:e};let n=Cz[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Tz=Cz.default.itemHeight,Ez=`@layer base, theme, unsafe;
195
195
 
196
196
  @layer base {
197
197
  :host {
@@ -1834,17 +1834,17 @@ Error generating stack: `+e.message+`
1834
1834
  }
1835
1835
  }
1836
1836
  }
1837
- `,wz=`@layer base, unsafe;`;function Tz(e){return`${wz}
1837
+ `,Dz=`@layer base, unsafe;`;function Oz(e){return`${Dz}
1838
1838
  @layer base {
1839
1839
  ${e}
1840
- }`}function Ez(e){return`${wz}
1840
+ }`}function kz(e){return`${Dz}
1841
1841
  @layer unsafe {
1842
1842
  ${e}
1843
- }`}var Dz=new WeakMap;function Oz(e){let t=Dz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(xF,`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(),Dz.set(e,i),i}function kz(e,t){if(!e.isConnected)return;let n=Oz(t);if(n==null)return;let r=t.querySelector(`style[${SF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(SF,``),t.appendChild(i)),i.textContent=`:host { ${CF}: ${n}px; }`}var Az;function jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Az??(Az=new CSSStyleSheet,Az.replaceSync(Tz(Cz)));let t=!1;try{e.adoptedStyleSheets=[Az],t=!0}catch{}if(t){e.querySelector(`style[${yF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(yF,``),t.textContent=Tz(Cz),e.prepend(t)}}function Mz(e,t){Nz(e,t),jz(t),kz(e,t)}function Nz(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`});Mz(this,e)}}if(customElements.define(vF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(vF)))e instanceof HTMLElement&&Mz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Pz=e=>e.startsWith(`f::`)?e.slice(3):e;function Fz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Iz(e,t){return e===``?t:`${e}/${t}`}function Lz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Pz(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}=Fz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Iz(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 Rz(e){return e.endsWith(`/`)}function zz(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 Bz(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 Vz(e,t){return t.includes(e)?Bz(t):[e]}function Hz(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 Uz(e,t){return{draggedPaths:e,target:t}}function Wz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Rz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Gz(e,t){return t.kind===`root`||t.directoryPath==null?zz(e):t.directoryPath}function Kz(e,t){let n=e.map(e=>{let n=Gz(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 qz=Symbol(`FILE_TREE_RENAME_VIEW`);function Jz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var Yz=512,Xz=512;function Zz(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Qz(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 $z(e){return Qz(e).at(-1)??null}function eB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var tB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},nB=e=>e.toLowerCase();function rB(e){return e.endsWith(`/`)}function iB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function aB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function oB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function sB(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 cB(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function lB(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 cB(e,t.path)?n?e:null:e;case`move`:return sB(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=lB(r,e,n),r==null)return null;return r}}}function uB(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function dB(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 fB(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(!dB(vz.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 pB(e){switch(e.operation){case`add`:return{...uB(e),operation:`add`,path:e.path};case`remove`:return{...uB(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...uB(e),from:e.from,operation:`move`,to:e.to}}}function mB(e){return{...uB(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>pB(e)),operation:`batch`}}function hB(e){switch(e.operation){case`add`:case`remove`:case`move`:return pB(e);case`batch`:return mB(e);default:return null}}function gB(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Qz(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 _B(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:gB(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var vB=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=fB({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=$z(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<=Xz){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=Vz(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=Uz(t.draggedPaths,n);(Wz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Hz(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=Uz(e.draggedPaths,t);if(Wz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=Kz(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=rB(r),a=aB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Qz(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=iB(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[qz](){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,rB(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,rB(e)?{recursive:!0}:void 0);return}let t=rB(e),n=Lz({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:aB(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(oB(n.sourcePath,t),oB(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=fB({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=!Zz(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=$z(e),n=eB(e,t),r=null,i=null;for(let e of this.#ve()){if($z(e)!==t)continue;let a=eB(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=Qz(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=!Zz(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 vz({...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 Qz(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(nB),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(nB),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 Qz(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:tB(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 Qz(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 Qz(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=_B(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,Yz)),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=lB(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=lB(this.#c,e,!0),r=[...this.#R].map(t=>lB(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=lB(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return Zz(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&&Jz(e)&&(this.#i=null);let t=Jz(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=hB(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},yB=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 bB(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 xB(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 SB(e,t){return t?`${e}/`:e}function CB(e,t=null){let n=yB(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=bB(t.path);if(e==null)continue;let n=SB(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 xB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var wB,TB,EB,DB,OB,kB,AB,jB,MB,NB,PB={},FB=[],IB=Array.isArray,LB=FB.slice,RB=Object.assign;function zB(e){e&&e.parentNode&&e.remove()}function BB(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?LB.call(arguments,2):n),VB(e,o,r,i,null)}function VB(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??++TB,__i:-1,__u:0};return i==null&&wB.vnode!=null&&wB.vnode(a),a}function HB(e){return e.children}function UB(e,t){this.props=e,this.context=t,this.__g=0}function WB(e,t){if(t==null)return e.__?WB(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`?WB(e):null}function GB(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 GB(e)}}function KB(e){(8&e.__g||!(e.__g|=8)||!EB.push(e)||OB++)&&DB==wB.debounceRendering||((DB=wB.debounceRendering)||queueMicrotask)(qB)}function qB(){for(var e,t,n,r,i,a,o,s,c=1;EB.length;)EB.length>c&&EB.sort(kB),e=EB.shift(),c=EB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=RB({},r)).__v=r.__v+1,wB.vnode&&wB.vnode(n),tV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??WB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,rV(a,n,o),n.__e!=i&&GB(n)));OB=0}function JB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||FB,b=t.length;for(c=YB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?PB:y[m.__i]||PB,m.__i=f,_=tV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&oV(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=XB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function YB(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?VB(null,o,null,null,null):IB(o)?VB(HB,{children:o},null,null,null):o.constructor==null&&o.__b>0?VB(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=ZB(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=WB(s)),sV(s,s));return r}function XB(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=XB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=WB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ZB(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 QB(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function $B(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||QB(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||QB(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(AB,`$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=jB,e.addEventListener(t,a?NB:MB,a)):e.removeEventListener(t,a?NB:MB,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 eV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=jB++;else if(t.u<n.l)return;return n(wB.event?wB.event(t):t)}}}function tV(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=wB.__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 UB(v,x),f.constructor=M,f.render=cV),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=RB({},f.__s)),RB(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=wB.__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=RB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===HB&&d.key==null&&(E=iV(d.props.children)),s=JB(e,IB(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--;)zB(a[j]);nV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||nV(t);wB.__e(e,t,n)}else s=t.__e=aV(n.__e,t,n,r,i,a,o,c,l,u);return(d=wB.diffed)&&d(t),128&t.__u?void 0:s}function nV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(nV)}function rV(e,t,n){for(var r=0;r<n.length;r++)oV(n[r],n[++r],n[++r]);wB.__c&&wB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){wB.__e(e,t.__v)}})}function iV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:IB(e)?e.map(iV):RB({},e)}function aV(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&&=(wB.__m&&wB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=LB.call(e.childNodes),v=n.props||PB,!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;$B(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&&!_||$B(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=``),JB(b==`template`?e.content:e,IB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&WB(n,0),s,c,l),a!=null)for(u=a.length;u--;)zB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||$B(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&$B(e,u,g,v[u],i))}return e}function oV(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){wB.__e(e,n)}}function sV(e,t,n){var r,i;if(wB.unmount&&wB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||oV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){wB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&sV(r[i],t,n||typeof e.type!=`function`);n||zB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function cV(e,t,n){return this.constructor(e,n)}function lV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),wB.__&&wB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=BB(HB,null,[e]),i=[],a=[],tV(t,e,r||PB,PB,t.namespaceURI,r?null:t.firstChild?LB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),rV(i,e,a)}function uV(e,t){e.__u|=32,lV(e,t)}wB={__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 OB=0,e}},TB=0,UB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=RB({},this.state);typeof e==`function`&&(e=e(RB({},n),this.props)),e&&RB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),KB(this))},UB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),KB(this))},UB.prototype.render=HB,EB=[],OB=0,kB=function(e,t){return e.__v.__b-t.__v.__b},AB=/(PointerCapture)$|Capture$/i,jB=0,MB=eV(!1),NB=eV(!0);var dV=0;Array.isArray;function fV(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:--dV,__i:-1,__u:0,__source:i,__self:a};return wB.vnode&&wB.vnode(l),l}var pV=16,mV=16,hV={};function gV({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}=hV[e]??{width:pV,height:mV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return fV(`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:fV(`use`,{href:c})})}var _V=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},vV=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)]},yV=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)]},bV=(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)]},xV=(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)]},SV=(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 CV({children:e,marker:t,variant:n=`default`}){"use no memo";return fV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:fV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?fV(`span`,{"data-truncate-fade":!0}):t})})}function wV(e){"use no memo";let{mode:t,children:n}=e;return fV(`div`,{children:[fV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?fV(`span`,{children:n}):n}),fV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?fV(`span`,{children:n}):n})]})}function TV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=fV(wV,{mode:t,children:e},`content`),o=fV(CV,{marker:n,mode:t,variant:r},`marker`),s=fV(`div`,{"data-truncate-fill":!0},`fill`);return fV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:fV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function EV({children:e,...t}){"use no memo";return fV(TV,{mode:`truncate`,...t,children:e})}function DV({children:e,...t}){"use no memo";return fV(TV,{mode:`fruncate`,...t,children:e})}function OV({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=fV(EV,{...s,children:t[0]}),l=fV(DV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return fV(`div`,{className:a,style:o});if(e.length<i)return fV(n===`end`?DV:EV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=_V:r===`extension`?t=vV:r===`leaf-path`&&(t=yV);else if(typeof r==`number`)t=bV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=xV:e===`first`&&(t=SV)}else typeof r==`function`&&(t=r);t??=_V;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=fV(EV,{...s,..._,children:f}),l=fV(DV,{...s,...v,children:p})}return fV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[fV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),fV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var kV={endIndex:-1,startIndex:-1};function AV(e,t,n){return Math.min(Math.max(e,t),n)}function jV(e,t){return e<0||t<e?kV:{endIndex:t,startIndex:e}}function MV(e){return e.startIndex<0||e.endIndex<e.startIndex}function NV(e,t){return MV(e)?0:(e.endIndex-e.startIndex+1)*t}function PV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function FV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function IV(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 LV(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 RV(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 zV(e,t,n){if(e.length===0||t<=0)return[];let r=RV(e),i=IV(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=LV(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 BV(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=AV(t.scrollTop,0,o),c=t.stickyRows??zV(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=PV(s,n,t.itemHeight),m=PV(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?kV:jV(m,FV(u+d,n,t.itemHeight)),y=g+1,b=MV(v)?kV:jV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=NV(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:MV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var VV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},HV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},UV=`Contains git status items`;function WV(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function GV(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 KV(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 qV(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 JV(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 YV,XV,ZV,QV,$V=Object.is,eH=0,tH=[],nH=wB,rH=nH.__b,iH=nH.__r,aH=nH.diffed,oH=nH.__c,sH=nH.unmount,cH=nH.__;function lH(e,t){nH.__h&&nH.__h(XV,e,eH||t),eH=0;var n=XV.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function uH(e){return eH=1,dH(CH,e)}function dH(e,t,n){var r=lH(YV++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):CH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);$V(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=XV,!XV.__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,$V(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};XV.__f=!0;var a=XV.shouldComponentUpdate,o=XV.componentWillUpdate;XV.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)},XV.shouldComponentUpdate=i}return r.__N||r.__}function fH(e,t){var n=lH(YV++,3);!nH.__s&&SH(n.__H,t)&&(n.__=e,n.u=t,XV.__H.__h.push(n))}function pH(e,t){var n=lH(YV++,4);!nH.__s&&SH(n.__H,t)&&(n.__=e,n.u=t,XV.__h.push(n))}function mH(e){return eH=5,hH(function(){return{current:e}},[])}function hH(e,t){var n=lH(YV++,7);return SH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function gH(e,t){return eH=8,hH(function(){return e},t)}function _H(){for(var e;e=tH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(bH),e.__H.__h.forEach(xH),e.__H.__h=[]}catch(t){e.__H.__h=[],nH.__e(t,e.__v)}}nH.__b=function(e){XV=null,rH&&rH(e)},nH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),cH&&cH(e,t)},nH.__r=function(e){iH&&iH(e),YV=0;var t=(XV=e.__c).__H;t&&(ZV===XV?(t.__h=[],XV.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(bH),t.__h.forEach(xH),t.__h=[],YV=0)),ZV=XV},nH.diffed=function(e){aH&&aH(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(tH.push(t)!==1&&QV===nH.requestAnimationFrame||((QV=nH.requestAnimationFrame)||yH)(_H)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ZV=XV=null},nH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(bH),e.__h=e.__h.filter(function(e){return!e.__||xH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],nH.__e(n,e.__v)}}),oH&&oH(e,t)},nH.unmount=function(e){sH&&sH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{bH(e)}catch(e){t=e}}),n.__H=void 0,t&&nH.__e(t,n.__v))};var vH=typeof requestAnimationFrame==`function`;function yH(e){var t,n=function(){clearTimeout(r),vH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);vH&&(t=requestAnimationFrame(n))}function bH(e){var t=XV,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),XV=t}function xH(e){var t=XV;e.__c=e.__(),XV=t}function SH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!$V(t,e[n])})}function CH(e,t){return typeof t==`function`?t(e):t}function wH(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 TH(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 EH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return fV(`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 DH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:fV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return fV(HB,{children:[fV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:fV(EV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function OH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function kH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function AH(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 jH({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=BV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:AH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?AH(u,1,t,o):i&&r<=0&&c.length>0?zV(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 MH=400,NH=10,PH=40,FH=18;function IH(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))?LH(e,t,n):a instanceof HTMLElement?a:null}function LH(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 RH(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 zH(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 BH(){return navigator.vendor!==`Apple Computer, Inc.`}function VH(e,t){let n=e-t.top;if(n<PH)return-Math.ceil((PH-Math.max(0,n))/PH*FH);let r=t.bottom-e;return r<PH?Math.ceil((PH-Math.max(0,r))/PH*FH):0}function HH(e,t){if(e!=null){let t=VV[e];return t==null?null:{text:t,title:HV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:UV}:null}function UH(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 WH(e){return e!=null&&`toggle`in e}function GH(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function KH(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function qH(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function JH(e,t){return e!=null&&e>0?e:t}function YH(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 XH(e,t,n,r,i=0){let a=qV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function ZH(e,t,n,r,i,a){let o=JV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function QH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function $H(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function eU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function tU(e,t){return t&&eU(e)||(e.ctrlKey||e.metaKey)&&GH(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var nU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function rU(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 iU(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 aU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function oU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function sU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function cU(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 lU(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 uU(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 dU(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=uU(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 fU(e,t){return{kind:e.kind,name:kH(e),path:t}}function pU(e){return e==null?void 0:`${e}__tree`}function mU(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function hU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function gU(e,t){if(e==null)return null;if(`text`in e)return fV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?hU(e.icon)?t(e.icon):{name:e.icon}:hU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return fV(`span`,{title:e.title,children:fV(gV,{...n})})}function _U(e){e!=null&&wH(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function vU(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=OH(e);return fV(HB,{children:[e.depth>0?fV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>fV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,fV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?fV(gV,{...t(`file-tree-icon-chevron`)}):fV(gV,{...t(`file-tree-icon-file`,u)})}),fV(`div`,{"data-item-section":`content`,children:e.isFlattened?DH(e,c,a):c??fV(OV,{minimumLength:5,split:`extension`,children:e.name})}),i?fV(`div`,{"data-item-section":`decoration`,children:r==null?null:gU(r,t)}):null,s?fV(`div`,{"data-item-section":`git`,children:gU(o,t)}):null,n?fV(`div`,{"data-item-section":`action`,children:l?fV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:fV(gV,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function yU(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=OH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??UH(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=HH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,q=R||!K?null:fV(EH,{ref:D,ariaLabel:`Rename ${kH(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=vU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:q,showDecorativeActionAffordance:G}),ne={...GV({ariaLabel:kH(t),domId:t.isFocused?mU(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:aU(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?fV(`div`,{...ne,children:te}):fV(`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 bU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(OH(e))).map((n,r)=>yU(e,n,t.start+r))}function xU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Sz,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 _=mH(null),v=mH(null),y=mH(!1),b=mH(null),x=mH(null),S=mH(null),C=mH(null),w=mH(null),T=mH(new Map),E=mH(new Map),D=mH(()=>{}),O=mH(null),k=mH(!1),A=mH(null),j=mH(null),M=mH(!1),N=mH(null),P=mH(null),F=mH(null),I=mH(null),L=mH(null),R=mH(null),z=mH(null),B=mH(null),V=mH(!1),H=mH(null),U=mH(null),W=mH(null),G=mH(null),K=hH(()=>new Map,[]),[,ee]=uH(0),[q,te]=uH(null),[ne,re]=uH(null),[ie,ae]=uH(null),[oe,se]=uH(null),[ce,le]=uH(0),[ue,de]=uH(null),fe=mH(ue);fe.current=ue;let pe=mH(null),me=mH(null),he=mH(null),ge=mH(null),_e=mH(null),ve=mH(!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=mH(d===`retain`&&t.isSearchOpen()),[Ce,we]=uH(p);fH(()=>{p||we(!1)},[p]);let Te=mH(!1),Ee=gH(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=uH(()=>jH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=uH(!1);fH(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`right-click`;pH(()=>{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 Ie=gH((e,t)=>{sU(T.current,e,t)},[]),Le=gH((e,t)=>{sU(E.current,e,t)},[]),Re=gH(e=>{x.current=e},[]),ze=gH(e=>cU(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=hH(()=>NF(a),[a]),He=t[qz](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.isDragAndDropEnabled(),Xe=t.getDragSession(),Ze=hH(()=>Xe==null?null:new Set(Xe.draggedPaths),[Xe]),Qe=Xe?.target??null,$e=Xe?.primaryPath??null,et=pU(o),{overlayHeight:tt,overlayRows:nt,snapshot:rt,visibleRows:it}=De,at=rt.physical.viewportHeight,ot=hH(()=>({end:rt.window.endIndex,start:rt.window.startIndex}),[rt.window.endIndex,rt.window.startIndex]),st=nt,ct=rt.sticky.rows,lt=rt.physical.totalHeight,ut=rt.sticky.height,dt=hH(()=>new Set(ct.map(e=>OH(e.row))),[ct]),J=Je>=0&&Je>=ot.start&&Je<=ot.end,ft=gH((e,t)=>u?.({item:fU(e,t),row:e})??null,[u]),pt=gH(e=>wH(e==null?null:T.current.get(e)??null)?!0:wH(S.current),[]),mt=gH(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=mH(mt);ht.current=mt;let gt=mH(!0),_t=mH(()=>{}),vt=gH((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=gH(e=>{let t=e==null?null:oU(S.current,e);ae(e=>e===t?e:t)},[]),bt=gH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(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:fU(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,yt]),xt=gH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=qH(e,at);N.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),ee(e=>e+1))}},[t,Je,s,l,at]),St=gH((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=qH(i,at),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:jH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,ZH(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,at,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Y=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Tt=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},X=()=>{R.current?.remove(),R.current=null},Et=()=>{Y(P.current),P.current=null,L.current=null},Dt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ot=()=>{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),X(),Tt(),Et(),z.current=null},kt=(e,n)=>{let r=S.current?.getRootNode(),i=RH(IH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},At=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Tt();return}let r=t.getItem(e.directoryPath),i=WH(r)?r:null;if(i==null||i.isExpanded()){Tt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Tt(),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))},jt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=VH(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()),At(kt(e.clientX,e.clientY)),P.current=wt(jt)},Mt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(jt)},Nt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ot(),X(),Tt(),Et(),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),BH())){let t=zH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Dt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Pt=()=>{X(),Tt(),Et(),z.current=null,t.cancelDrag()},Ft=(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<=NH*NH||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=zH(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`}),Dt(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)`),At(kt(t.clientX,t.clientY)),Mt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&kt(n.clientX,n.clientY),t.completeDrag(),Ot()},u=()=>{t.cancelDrag(),Ot()};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)},MH)},It=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}nU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=qH(n,at);N.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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`),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&KH(e)){t.openSearch(e.key),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&eU(e),r=tU(e,je),i=r&&S.current!=null?TH(S.current):null,a=r?new Set(lU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&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=WH(p)?p:null,h=u!=null&&(dt.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=cU(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&GH(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&&(dt.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,dU(S.current,v,i,u,s,ut,at)),k.current=!0,te(e=>e===b?e:b)):ye()}ee(e=>e+1),e.preventDefault(),e.stopPropagation()};pH(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}wH(w.current)}},[Ge,f]),pH(()=>{let e=x.current;switch(WV({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Ue})){case`reset`:j.current=null;return;case`reveal-canonical`:Ue!=null&&St(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=Ue,wH(e),e.select());return}},[ot.end,ot.start,Ue,St,dt]),pH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=TH(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,TH(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)}},[]),pH(()=>{let e=S.current;e!=null&&(rt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[rt.physical.scrollTop]),pH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=qH(n,g);let a=()=>{let e=t.getVisibleCount(),r=JH(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(jH({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?ee(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:YH(e[0]))??qH(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]),pH(()=>{je||ue==null||vt(!1)},[vt,je,ue]);let Lt=hH(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);pH(()=>{if(Lt==null){m?.clearSlotContent(TF);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??iU(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(TF,i),e?.contextMenu?.onOpen?.(t.item,r),_U(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&_U(i)}),()=>{m?.clearSlotContent(TF)}},[Lt,e?.contextMenu,m]),pH(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),pH(()=>{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&&(rU(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]),pH(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=qe;return}let n=qe==null?null:T.current.get(qe)??null,r=TH(t),i=r?.dataset.itemPath??null,a=We&&x.current===r,o=f&&w.current===r,c=M.current&&!Ge,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!==qe,v=d!=null&&d===qe&&qe!=null,y=c&&ZH(e,Je,s,at,lt,l),b=u!=null&&u===qe&&ZH(e,Je,s,at,lt,ut),E=p!=null&&p.path===qe&&ZH(e,Je,s,at,lt,p.viewportOffset),O=m!=null&&m.path===qe&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==qe&&!v&&XH(e,Je,s,at,ut))&&D.current(),!g){A.current=qe;return}if(a){A.current=qe;return}if(o&&!c){A.current=qe;return}if(n==null){c&&Je>=0&&(ZH(e,Je,s,at,lt,l),D.current()),A.current=qe;return}(_||c||u===qe||d===qe||p?.path===qe||m?.path===qe||i==null||i!==qe)&&(wH(n),u===qe&&(pe.current=null),d===qe&&(me.current=null),p?.path===qe&&(he.current=null),m?.path===qe&&(ge.current=null),M.current=!1,N.current=null),A.current=qe},[t,Je,qe,J,s,We,Ge,ot,at,f,ut,lt,it]);let Rt=Je>=0&&Je>=rt.visible.startIndex&&Je<=rt.visible.endIndex,zt=qe!=null&&st.some(e=>OH(e.row)===qe),Bt=Rt||zt,Vt=Ne&&k.current===!0&&Bt?qe:null,Ht=oe===`pointer`?ne:null,Ut=ue?.path??_e.current??Ht??Vt??ne,Wt=ue?.source===`right-click`;pH(()=>{y.current&&ue==null||yt(ze(Ut))},[ue,ze,ot,at,ce,st,Ut,yt,it]);let Gt=gH(e=>{if(y.current||rU(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)},[]),Kt=gH(()=>{re(null)},[]);pH(()=>{if(!Ye)return;let e=()=>{Ot(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ot(),t.cancelDrag()}},[t,Ye]);let qt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=RH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),At(t.getDragSession()?.target??null),Mt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Jt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Tt(),Et(),t.setDragTarget(null))},Yt=e=>{!Ye||t.getDragSession()==null||V.current||(e.preventDefault(),kt(e.clientX,e.clientY),t.completeDrag(),X(),Tt(),Et(),z.current=null)},Xt=rt.window.height,Zt=rt.window.offsetTop,Qt=Math.min(0,at-Xt-ut),$t=q===qe||M.current,en=qe!=null&&$t&&!J&&Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null,tn=en==null?null:QH(Je,s,ot,Xt),nn=z.current,rn=$e!=null&&nn!=null&&nn.path===$e&&nn.index>=ot.start&&nn.index<=ot.end,an=$e!=null&&nn!=null&&nn.path===$e&&!rn&&nn.path!==en?.path?nn:null,on=an==null?null:QH(an.index,s,ot,Xt),sn=$H((Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),cn=Ge&&qe!=null?mU(o,qe,!J):void 0,ln=ue?.path??(Ge?qe:q),un=ue?.path??ne,dn=ze(Ut),fn=je&&Ne&&!Wt&&!We&&dn!=null&&ie!=null&&Ut!=null,pn=je&&(fn||ue!=null),mn=ue?.anchorRect,hn=mn==null&&dn!=null&&ie!=null&&(ue!=null||fn)?ie:null,gn=mn==null?hn==null?void 0:{top:`${hn}px`}:{left:`${mn.left}px`,position:`fixed`,right:`auto`,top:`${mn.top}px`},_n=Wt?{opacity:`0`}:void 0,vn=gH((e,n,r,i)=>{let a=t.getItem(r),o=KV({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>=rt.visible.startIndex&&n.index<=rt.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&&WH(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,rt.visible.endIndex,rt.visible.startIndex,St]),yn=()=>{if(y.current||!Ne||Ut==null||dn==null)return;let e=t.getItem(Ut);e!=null&&(yt(dn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:dn.getAttribute(`aria-label`)??Ut,path:e.getPath()},path:e.getPath(),source:`button`}))},bn={contextHoverPath:un,contextMenuButtonTriggerEnabled:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ye,draggedPathSet:Ze,dragTarget:Qe,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:Pt,handleRowDragStart:Nt,handleRowTouchStart:Ft,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:It,onRowClick:vn,openContextMenuForRow:bt,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:ft,resolveIcon:Ve,shouldSuppressContextMenu:Ct,visualFocusPath:ln},xn={...bn,registerButton:Le};return fV(`div`,{ref:S,id:et,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Ye?Jt:void 0,onDragOver:Ye?qt:void 0,onDrop:Ye?Yt:void 0,onKeyDown:It,onPointerLeave:je?Kt:void 0,onPointerOver:je?Gt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[fV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:sn}}),fV(`slot`,{name:wF,"data-type":`header-slot`}),f?fV(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:fV(`input`,{ref:w,"aria-activedescendant":cn,"aria-controls":et,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,fV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&st.length>0?fV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:fV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${tt}px`},children:st.map((e,t)=>yU(xn,e.row,`sticky:${OH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${st.length-t}`}}))})}):null,fV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${lt}px`},children:[fV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${Zt}px`}}),fV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Xt}px`,top:`${Qt}px`,bottom:`${Qt}px`},children:[bU(bn,ot,dt),en!=null&&tn!=null?yU(bn,en,`parked:${en.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:$e===en.path?`none`:void 0,position:`absolute`,right:`0`,top:`${tn}px`}}):null,an!=null&&on!=null?yU(bn,an,`parked-drag:${an.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${on}px`}}):null]})]})]}),je?fV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":pn?`true`:`false`,style:gn,children:[fV(`button`,{ref:v,type:`button`,"data-type":EF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":fn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}yn()},tabIndex:-1,style:_n,children:fV(gV,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:fV(`slot`,{name:TF})]}):null,ue==null?null:fV(`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 SU={hydrateRoot:(e,t)=>{uV(BB(xU,t),e)},renderRoot:(e,t)=>{lV(BB(xU,t),e)},unmountRoot:e=>{lV(null,e)}};function CU(e,t){SU.renderRoot(e,t)}function wU(e,t){SU.hydrateRoot(e,t)}function TU(e){SU.unmountRoot(e)}var EU=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)}}},DU=`__c`,OU=`__k`,kU=`__d`,AU=`__s`,jU=/[\s\n\\/='"\0<>]/,MU=/^(xlink|xmlns|xml)([A-Z])/,NU=/^(?: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])/,PU=/^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/,FU=new Set([`draggable`,`spellcheck`]);function IU(e){e.__g===void 0?e[kU]=!0:e.__g|=8}function LU(e){e.__g===void 0?e[kU]=!1:e.__g&=-9}function RU(e){return e.__g===void 0?!0===e[kU]:!!(8&e.__g)}var zU=/["&<]/;function BU(e){if(e.length===0||!1===zU.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 VU={},HU=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(`.`)),UU=/[A-Z]/g;function WU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:VU[n]||(VU[n]=n.replace(UU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||HU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function GU(){this.__d=!0}function KU(e,t){return{__v:e,context:t,props:e.props,setState:GU,forceUpdate:GU,__d:!0,__h:[]}}function qU(e,t,n){if(!e.s){if(n instanceof JU){if(!n.s)return void(n.o=qU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(qU.bind(null,e,t),qU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var JU=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{qU(r,1,a(this.v))}catch(e){qU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?qU(r,1,t?t(i):i):n?qU(r,1,n(i)):qU(r,2,i)}catch(e){qU(r,2,e)}},r},e}(),YU,XU,ZU,QU,$U={},eW=Array.isArray,tW=Object.assign,nW=``,rW=`<!--$s-->`,iW=`<!--/$s-->`;function aW(e,t){var n,r=e.type,i=!0;return e[DU]?(i=!1,(n=e[DU]).state=n[AU]):n=new r(e.props,t),e[DU]=n,n.__v=e,n.props=e.props,n.context=t,IU(n),n.state??=$U,n[AU]??(n[AU]=n.state),r.getDerivedStateFromProps?n.state=tW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[AU]===n.state?n.state:n[AU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),ZU&&ZU(e),n.render(n.props,n.state,t)}function oW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===nW)return nW;var s=typeof e;if(s!=`object`)return s==`function`?nW:s==`string`?BU(e):e+nW;if(eW(e)){var c,l=nW;i[OU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=oW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=nW,eW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return nW;e.__=i,YU&&YU(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===HB){if(`tpl`in g){for(var x=nW,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&&!eW(C)?x+=C:x+=oW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+BU(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=aW(e,b),y=e[DU];else{e[DU]=y=KU(e,b);for(var E=0;RU(y)&&E++<25;){LU(y),ZU&&ZU(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}IU(y)}if(y.getChildContext!=null&&(t=tW({},t,y.getChildContext())),T&&wB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===HB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return oW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[AU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,$U),RU(y)?(v=aW(e,t),(y=e[DU]).getChildContext!=null&&(t=tW({},t,y.getChildContext())),oW(v=v!=null&&v.type===HB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):nW}finally{XU&&XU(e),QU&&QU(e)}}}v=v!=null&&v.type===HB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=oW(v,t,n,r,e,a,o);return XU&&XU(e),wB.unmount&&wB.unmount(e),e._suspended?typeof D==`string`?rW+D+iW:eW(D)?(D.unshift(rW),D.push(iW),D):D.then(function(e){return rW+e+iW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return oW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=wB.__e;return k&&k(i,e),nW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=oW(v,t,n,r,e,a,o);return e._suspended?rW+s+iW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=nW;for(var N in g){var P=g[N];if(typeof(P=cW(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=WU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(MU.test(N))N=N.replace(MU,`$1:$2`).toLowerCase();else{if(jU.test(N))continue;N[4]!==`-`&&!FU.has(N)||P==null?n?PU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):NU.test(N)&&(N=N.toLowerCase()):P+=nW}}P!=null&&!1!==P&&(j=!0===P||P===nW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?BU(P):P+nW)+`"`)}}if(jU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=BU(A):A!=null&&!1!==A&&!0!==A&&(M=oW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),XU&&XU(e),QU&&QU(e),!M&&sW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return eW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var sW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function cW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var lW=0;function uW(e){return e!=null&&e.length>0?e:(lW+=1,`pst_ft_${lW}`)}function dW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Sz)}function fW(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 pW(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 mW(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var hW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new EU;#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=uW(a),this.#p=CB(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=xz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new vB({...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&&(TU(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(),CU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=CB(e,this.#p);let t=this.#T();t!=null&&CU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),CU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),wU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),CU(r,this.#w())}#C(){return{initialViewportHeight:dW({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(wF,e());return}this.#l.setSlotHtml(wF,this.#e?.header?.html??null)}#k(e){let t=mW(e).find(e=>pW(e)),n=fW(mF(OF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=mW(e),n=t.find(e=>pW(e)),r=t.filter(e=>e!==n),i=OF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=fW(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=OF(this.#m);t.colored&&gF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${bF}]`);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(bF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ez(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 Mz(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)}},gW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function _W(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:wF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:TF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function vW(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 yW(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 bW(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 xW({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)(()=>bW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),gW(()=>{n.setComposition(g)},[g,n]),gW(()=>{if(c!=null)return r!=null&&yW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=vW(_W(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)(vF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function SW(e){let t=(0,Q.useRef)(null);return t.current??=new hW(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function CW(e){let t=(0,$.c)(22),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,c=n===void 0?`this item`:n,l=a??`Delete ${c}`,u;t[0]===l?u=t[1]:(u=(0,Z.jsx)(Dr,{children:l}),t[0]=l,t[1]=u);let d=o??`Are you sure you want to delete ${c}? This action cannot be undone.`,f;t[2]===d?f=t[3]:(f=(0,Z.jsx)(Tr,{className:`whitespace-pre-wrap`,children:d}),t[2]=d,t[3]=f);let p;t[4]===s?p=t[5]:(p=s?(0,Z.jsx)(Pr,{children:s}):null,t[4]=s,t[5]=p);let m;t[6]===r?m=t[7]:(m=(0,Z.jsx)(Lr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`outline`,disabled:r,children:`Cancel`})}),t[6]=r,t[7]=m);let h;t[8]===r?h=t[9]:(h=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[8]=r,t[9]=h);let g;t[10]!==r||t[11]!==i||t[12]!==h?(g=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,children:h}),t[10]=r,t[11]=i,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==m||t[15]!==g?(_=(0,Z.jsxs)(Fr,{children:[m,g]}),t[14]=m,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==_||t[18]!==u||t[19]!==f||t[20]!==p?(v=(0,Z.jsxs)(jr,{children:[u,f,p,_]}),t[17]=_,t[18]=u,t[19]=f,t[20]=p,t[21]=v):v=t[21],v}var wW=`.md`,TW=/\.(md|mdx)$/i;function EW(e,t=wW){return`${e}${t}`}function DW(e){return WW(e).replace(TW,``)}function OW(e){let t=WW(e).match(TW);return t?`.${t[1].toLowerCase()}`:void 0}function kW(e){return WW(e)}function AW(e){let t=WW(e.trim());return t?`${t}/`:``}function jW(e){return e.endsWith(`/`)?kW(e):DW(e)}function MW(e){return e.map(e=>EW(e.docName,e.docExt))}function NW(e){return[...e].sort().join(`\0`)}function PW(e){return NW(MW(e))}function FW(e){let t=new Set;for(let n of e){let e=n.docName.split(`/`).filter(Boolean);for(let n=1;n<e.length;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function IW(e){if(!e)return[];let t=WW(e.replace(TW,``)).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 LW(e){let t=e.kind===`directory`,n=t?kW(e.path):DW(e.path),r=t?void 0:OW(e.path);return{kind:t?`folder`:`file`,name:WW(UW(e.path)).replace(TW,``),path:n,treePath:zW(e.path,t),docExt:r}}function RW(e){return e.kind===`directory`?kW(e.path):e.path}function zW(e,t){return t?AW(e):TW.test(e)?e:`${e}${wW}`}function BW(e,t,n){let r=AW(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}${wW}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`,o=`${a}index${wW}`;if(!i.has(o)&&!i.has(a))return{addPath:o,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function VW(e,t){return e===`file`?zW(t,!1):`${kW(t)}/index${wW}`}function HW(e,t){return t.kind===`root`||t.directoryPath==null?UW(e):`${t.directoryPath}${UW(e)}`}function UW(e){let t=WW(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function WW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function GW(e,t){if(!e)return{selectedFilePath:t,selectedFolderPath:null,navigationPath:t};switch(e.kind){case`doc`:return{selectedFilePath:e.docName,selectedFolderPath:null,navigationPath:e.docName};case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function KW(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 qW(e,t,n,r){return e.id===`cursor`&&!n?`Desktop only`:t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:r?`No workspace`:null}function JW(e){let t=(0,$.c)(8),{input:n,installStates:r,isElectronHost:i,dispatch:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(Ky,{children:[(0,Z.jsx)(ar,{"aria-hidden":`true`}),`Open in…`]}),t[0]=o):o=t[0];let s;t[1]!==a||t[2]!==n||t[3]!==r||t[4]!==i?(s=zd.map(e=>{let t=r[e.id],o=CN({target:e,installState:t,isElectronHost:i}),s=n===null,c=o.enabled&&!s,l=qW(e,t,i,s),u=l?`Open in ${e.displayName}, ${l}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(By,{disabled:!c,onSelect:()=>{!c||!n||a(e.id,n)},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":u,children:[(0,Z.jsx)(bN,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)}),t[1]=a,t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]===s?c=t[7]:(c=(0,Z.jsxs)(Gy,{children:[o,(0,Z.jsx)(qy,{children:s})]}),t[6]=s,t[7]=c),c}var YW=80,XW=3,ZW=20,QW=new Map,$W=new Set,eG=[],tG=new Map;function nG(e){for(tG.delete(e),tG.set(e,!0);tG.size>ZW;){let e=tG.keys().next().value;if(e===void 0)break;tG.delete(e)}}function rG(e){$W.delete(e),iG()}function iG(){for(;$W.size<XW&&eG.length>0;){let e=eG.shift();if(!e)break;if(!tG.has(e.docName)){$W.add(e.docName),nG(e.docName);try{e.prewarm(e.docName)}catch(t){qn(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{rG(e.docName)}}}}function aG(e,t){if(yn(e)||tG.has(e))return;let n=QW.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(QW.delete(e),$W.size>=XW){eG.push({docName:e,prewarm:t});return}nG(e),$W.add(e);try{t(e)}catch(t){qn(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{rG(e)}},YW);QW.set(e,{timer:r,prewarm:t})}function oG(e){let t=QW.get(e);t&&(clearTimeout(t.timer),QW.delete(e))}function sG(e){window.location.hash=at(e)}async function cG(e,t){try{await navigator.clipboard.writeText(e),Hr.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Hr.error(`Could not copy ${t}`)}}var lG=new Set([`agents`,`agent`,`claude`,`skill`]),uG=`ok-file-tree-link-decoration`,dG=`ok-file-tree-agent-decoration`;function fG(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function pG(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${fG(t)}</symbol>`}var mG=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1844
- ${pG(uG,va)}
1845
- ${pG(dG,Vi)}
1846
- </svg>`,hG=`
1843
+ }`}var Az=new WeakMap;function jz(e){let t=Az.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(wF,`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(),Az.set(e,i),i}function Mz(e,t){if(!e.isConnected)return;let n=jz(t);if(n==null)return;let r=t.querySelector(`style[${TF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(TF,``),t.appendChild(i)),i.textContent=`:host { ${EF}: ${n}px; }`}var Nz;function Pz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Nz??(Nz=new CSSStyleSheet,Nz.replaceSync(Oz(Ez)));let t=!1;try{e.adoptedStyleSheets=[Nz],t=!0}catch{}if(t){e.querySelector(`style[${SF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(SF,``),t.textContent=Oz(Ez),e.prepend(t)}}function Fz(e,t){Iz(e,t),Pz(t),Mz(e,t)}function Iz(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`});Fz(this,e)}}if(customElements.define(xF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(xF)))e instanceof HTMLElement&&Fz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Lz=e=>e.startsWith(`f::`)?e.slice(3):e;function Rz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function zz(e,t){return e===``?t:`${e}/${t}`}function Bz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Lz(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}=Rz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=zz(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 Vz(e){return e.endsWith(`/`)}function Hz(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 Uz(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 Wz(e,t){return t.includes(e)?Uz(t):[e]}function Gz(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 Kz(e,t){return{draggedPaths:e,target:t}}function qz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Vz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Jz(e,t){return t.kind===`root`||t.directoryPath==null?Hz(e):t.directoryPath}function Yz(e,t){let n=e.map(e=>{let n=Jz(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 Xz=Symbol(`FILE_TREE_RENAME_VIEW`);function Zz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var Qz=512,$z=512;function eB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function tB(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 nB(e){return tB(e).at(-1)??null}function rB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var iB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},aB=e=>e.toLowerCase();function oB(e){return e.endsWith(`/`)}function sB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function cB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function lB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function uB(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 dB(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function fB(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 dB(e,t.path)?n?e:null:e;case`move`:return uB(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=fB(r,e,n),r==null)return null;return r}}}function pB(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function mB(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 hB(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(!mB(xz.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 gB(e){switch(e.operation){case`add`:return{...pB(e),operation:`add`,path:e.path};case`remove`:return{...pB(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...pB(e),from:e.from,operation:`move`,to:e.to}}}function _B(e){return{...pB(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>gB(e)),operation:`batch`}}function vB(e){switch(e.operation){case`add`:case`remove`:case`move`:return gB(e);case`batch`:return _B(e);default:return null}}function yB(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=tB(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 bB(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:yB(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var xB=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=hB({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=nB(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<=$z){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=Wz(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=Kz(t.draggedPaths,n);(qz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Gz(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=Kz(e.draggedPaths,t);if(qz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=Yz(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=oB(r),a=cB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of tB(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=sB(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[Xz](){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,oB(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,oB(e)?{recursive:!0}:void 0);return}let t=oB(e),n=Bz({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:cB(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(lB(n.sourcePath,t),lB(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=hB({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=!eB(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=nB(e),n=rB(e,t),r=null,i=null;for(let e of this.#ve()){if(nB(e)!==t)continue;let a=rB(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=tB(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=!eB(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 xz({...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 tB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(aB),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(aB),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 tB(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:iB(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 tB(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 tB(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=bB(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,Qz)),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=fB(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=fB(this.#c,e,!0),r=[...this.#R].map(t=>fB(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=fB(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return eB(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&&Zz(e)&&(this.#i=null);let t=Zz(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=vB(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},SB=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 CB(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 wB(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 TB(e,t){return t?`${e}/`:e}function EB(e,t=null){let n=SB(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=CB(t.path);if(e==null)continue;let n=TB(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 wB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var DB,OB,kB,AB,jB,MB,NB,PB,FB,IB,LB={},RB=[],zB=Array.isArray,BB=RB.slice,VB=Object.assign;function HB(e){e&&e.parentNode&&e.remove()}function UB(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?BB.call(arguments,2):n),WB(e,o,r,i,null)}function WB(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??++OB,__i:-1,__u:0};return i==null&&DB.vnode!=null&&DB.vnode(a),a}function GB(e){return e.children}function KB(e,t){this.props=e,this.context=t,this.__g=0}function qB(e,t){if(t==null)return e.__?qB(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`?qB(e):null}function JB(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 JB(e)}}function YB(e){(8&e.__g||!(e.__g|=8)||!kB.push(e)||jB++)&&AB==DB.debounceRendering||((AB=DB.debounceRendering)||queueMicrotask)(XB)}function XB(){for(var e,t,n,r,i,a,o,s,c=1;kB.length;)kB.length>c&&kB.sort(MB),e=kB.shift(),c=kB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=VB({},r)).__v=r.__v+1,DB.vnode&&DB.vnode(n),iV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??qB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,oV(a,n,o),n.__e!=i&&JB(n)));jB=0}function ZB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||RB,b=t.length;for(c=QB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?LB:y[m.__i]||LB,m.__i=f,_=iV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&lV(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=$B(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function QB(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?WB(null,o,null,null,null):zB(o)?WB(GB,{children:o},null,null,null):o.constructor==null&&o.__b>0?WB(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=eV(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=qB(s)),uV(s,s));return r}function $B(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=$B(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=qB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function eV(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 tV(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function nV(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||tV(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||tV(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(NB,`$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=PB,e.addEventListener(t,a?IB:FB,a)):e.removeEventListener(t,a?IB:FB,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 rV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=PB++;else if(t.u<n.l)return;return n(DB.event?DB.event(t):t)}}}function iV(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=DB.__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 KB(v,x),f.constructor=M,f.render=dV),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=VB({},f.__s)),VB(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=DB.__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=VB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===GB&&d.key==null&&(E=sV(d.props.children)),s=ZB(e,zB(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--;)HB(a[j]);aV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||aV(t);DB.__e(e,t,n)}else s=t.__e=cV(n.__e,t,n,r,i,a,o,c,l,u);return(d=DB.diffed)&&d(t),128&t.__u?void 0:s}function aV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(aV)}function oV(e,t,n){for(var r=0;r<n.length;r++)lV(n[r],n[++r],n[++r]);DB.__c&&DB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){DB.__e(e,t.__v)}})}function sV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:zB(e)?e.map(sV):VB({},e)}function cV(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&&=(DB.__m&&DB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=BB.call(e.childNodes),v=n.props||LB,!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;nV(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&&!_||nV(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=``),ZB(b==`template`?e.content:e,zB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&qB(n,0),s,c,l),a!=null)for(u=a.length;u--;)HB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||nV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&nV(e,u,g,v[u],i))}return e}function lV(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){DB.__e(e,n)}}function uV(e,t,n){var r,i;if(DB.unmount&&DB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||lV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){DB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&uV(r[i],t,n||typeof e.type!=`function`);n||HB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function dV(e,t,n){return this.constructor(e,n)}function fV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),DB.__&&DB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=UB(GB,null,[e]),i=[],a=[],iV(t,e,r||LB,LB,t.namespaceURI,r?null:t.firstChild?BB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),oV(i,e,a)}function pV(e,t){e.__u|=32,fV(e,t)}DB={__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 jB=0,e}},OB=0,KB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=VB({},this.state);typeof e==`function`&&(e=e(VB({},n),this.props)),e&&VB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),YB(this))},KB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),YB(this))},KB.prototype.render=GB,kB=[],jB=0,MB=function(e,t){return e.__v.__b-t.__v.__b},NB=/(PointerCapture)$|Capture$/i,PB=0,FB=rV(!1),IB=rV(!0);var mV=0;Array.isArray;function hV(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:--mV,__i:-1,__u:0,__source:i,__self:a};return DB.vnode&&DB.vnode(l),l}var gV=16,_V=16,vV={};function yV({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}=vV[e]??{width:gV,height:_V},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return hV(`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:hV(`use`,{href:c})})}var bV=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},xV=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)]},SV=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)]},CV=(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)]},wV=(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)]},TV=(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 EV({children:e,marker:t,variant:n=`default`}){"use no memo";return hV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:hV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?hV(`span`,{"data-truncate-fade":!0}):t})})}function DV(e){"use no memo";let{mode:t,children:n}=e;return hV(`div`,{children:[hV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?hV(`span`,{children:n}):n}),hV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?hV(`span`,{children:n}):n})]})}function OV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=hV(DV,{mode:t,children:e},`content`),o=hV(EV,{marker:n,mode:t,variant:r},`marker`),s=hV(`div`,{"data-truncate-fill":!0},`fill`);return hV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:hV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function kV({children:e,...t}){"use no memo";return hV(OV,{mode:`truncate`,...t,children:e})}function AV({children:e,...t}){"use no memo";return hV(OV,{mode:`fruncate`,...t,children:e})}function jV({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=hV(kV,{...s,children:t[0]}),l=hV(AV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return hV(`div`,{className:a,style:o});if(e.length<i)return hV(n===`end`?AV:kV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=bV:r===`extension`?t=xV:r===`leaf-path`&&(t=SV);else if(typeof r==`number`)t=CV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=wV:e===`first`&&(t=TV)}else typeof r==`function`&&(t=r);t??=bV;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=hV(kV,{...s,..._,children:f}),l=hV(AV,{...s,...v,children:p})}return hV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[hV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),hV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var MV={endIndex:-1,startIndex:-1};function NV(e,t,n){return Math.min(Math.max(e,t),n)}function PV(e,t){return e<0||t<e?MV:{endIndex:t,startIndex:e}}function FV(e){return e.startIndex<0||e.endIndex<e.startIndex}function IV(e,t){return FV(e)?0:(e.endIndex-e.startIndex+1)*t}function LV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function RV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function zV(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 BV(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 VV(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 HV(e,t,n){if(e.length===0||t<=0)return[];let r=VV(e),i=zV(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=BV(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 UV(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=NV(t.scrollTop,0,o),c=t.stickyRows??HV(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=LV(s,n,t.itemHeight),m=LV(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?MV:PV(m,RV(u+d,n,t.itemHeight)),y=g+1,b=FV(v)?MV:PV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=IV(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:FV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var WV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},GV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},KV=`Contains git status items`;function qV(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function JV(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 YV(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 XV(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 ZV(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 QV,$V,eH,tH,nH=Object.is,rH=0,iH=[],aH=DB,oH=aH.__b,sH=aH.__r,cH=aH.diffed,lH=aH.__c,uH=aH.unmount,dH=aH.__;function fH(e,t){aH.__h&&aH.__h($V,e,rH||t),rH=0;var n=$V.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function pH(e){return rH=1,mH(EH,e)}function mH(e,t,n){var r=fH(QV++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):EH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);nH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=$V,!$V.__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,nH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};$V.__f=!0;var a=$V.shouldComponentUpdate,o=$V.componentWillUpdate;$V.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)},$V.shouldComponentUpdate=i}return r.__N||r.__}function hH(e,t){var n=fH(QV++,3);!aH.__s&&TH(n.__H,t)&&(n.__=e,n.u=t,$V.__H.__h.push(n))}function gH(e,t){var n=fH(QV++,4);!aH.__s&&TH(n.__H,t)&&(n.__=e,n.u=t,$V.__h.push(n))}function _H(e){return rH=5,vH(function(){return{current:e}},[])}function vH(e,t){var n=fH(QV++,7);return TH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function yH(e,t){return rH=8,vH(function(){return e},t)}function bH(){for(var e;e=iH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(CH),e.__H.__h.forEach(wH),e.__H.__h=[]}catch(t){e.__H.__h=[],aH.__e(t,e.__v)}}aH.__b=function(e){$V=null,oH&&oH(e)},aH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),dH&&dH(e,t)},aH.__r=function(e){sH&&sH(e),QV=0;var t=($V=e.__c).__H;t&&(eH===$V?(t.__h=[],$V.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(CH),t.__h.forEach(wH),t.__h=[],QV=0)),eH=$V},aH.diffed=function(e){cH&&cH(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(iH.push(t)!==1&&tH===aH.requestAnimationFrame||((tH=aH.requestAnimationFrame)||SH)(bH)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),eH=$V=null},aH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(CH),e.__h=e.__h.filter(function(e){return!e.__||wH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],aH.__e(n,e.__v)}}),lH&&lH(e,t)},aH.unmount=function(e){uH&&uH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{CH(e)}catch(e){t=e}}),n.__H=void 0,t&&aH.__e(t,n.__v))};var xH=typeof requestAnimationFrame==`function`;function SH(e){var t,n=function(){clearTimeout(r),xH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);xH&&(t=requestAnimationFrame(n))}function CH(e){var t=$V,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),$V=t}function wH(e){var t=$V;e.__c=e.__(),$V=t}function TH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!nH(t,e[n])})}function EH(e,t){return typeof t==`function`?t(e):t}function DH(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 OH(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 kH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return hV(`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 AH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:hV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return hV(GB,{children:[hV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:hV(kV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function jH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function MH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function NH(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 PH({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=UV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:NH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?NH(u,1,t,o):i&&r<=0&&c.length>0?HV(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 FH=400,IH=10,LH=40,RH=18;function zH(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))?BH(e,t,n):a instanceof HTMLElement?a:null}function BH(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 VH(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 HH(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 UH(){return navigator.vendor!==`Apple Computer, Inc.`}function WH(e,t){let n=e-t.top;if(n<LH)return-Math.ceil((LH-Math.max(0,n))/LH*RH);let r=t.bottom-e;return r<LH?Math.ceil((LH-Math.max(0,r))/LH*RH):0}function GH(e,t){if(e!=null){let t=WV[e];return t==null?null:{text:t,title:GV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:KV}:null}function KH(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 qH(e){return e!=null&&`toggle`in e}function JH(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function YH(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function XH(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ZH(e,t){return e!=null&&e>0?e:t}function QH(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 $H(e,t,n,r,i=0){let a=XV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function eU(e,t,n,r,i,a){let o=ZV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function tU(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function nU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function rU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function iU(e,t){return t&&rU(e)||(e.ctrlKey||e.metaKey)&&JH(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var aU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function oU(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 sU(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 cU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function lU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function uU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function dU(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 fU(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 pU(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 mU(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=pU(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 hU(e,t){return{kind:e.kind,name:MH(e),path:t}}function gU(e){return e==null?void 0:`${e}__tree`}function _U(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function vU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function yU(e,t){if(e==null)return null;if(`text`in e)return hV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?vU(e.icon)?t(e.icon):{name:e.icon}:vU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return hV(`span`,{title:e.title,children:hV(yV,{...n})})}function bU(e){e!=null&&DH(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function xU(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=jH(e);return hV(GB,{children:[e.depth>0?hV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>hV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,hV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?hV(yV,{...t(`file-tree-icon-chevron`)}):hV(yV,{...t(`file-tree-icon-file`,u)})}),hV(`div`,{"data-item-section":`content`,children:e.isFlattened?AH(e,c,a):c??hV(jV,{minimumLength:5,split:`extension`,children:e.name})}),i?hV(`div`,{"data-item-section":`decoration`,children:r==null?null:yU(r,t)}):null,s?hV(`div`,{"data-item-section":`git`,children:yU(o,t)}):null,n?hV(`div`,{"data-item-section":`action`,children:l?hV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:hV(yV,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function SU(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=jH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??KH(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=GH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,ee=K?a.getValue():``,q=R||!K?null:hV(kH,{ref:D,ariaLabel:`Rename ${MH(t)}`,isFlattened:t.isFlattened,value:ee,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=xU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:q,showDecorativeActionAffordance:G}),ne={...JV({ariaLabel:MH(t),domId:t.isFocused?_U(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:cU(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?hV(`div`,{...ne,children:te}):hV(`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 CU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(jH(e))).map((n,r)=>SU(e,n,t.start+r))}function wU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Tz,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 _=_H(null),v=_H(null),y=_H(!1),b=_H(null),x=_H(null),S=_H(null),C=_H(null),w=_H(null),T=_H(new Map),E=_H(new Map),D=_H(()=>{}),O=_H(null),k=_H(!1),A=_H(null),j=_H(null),M=_H(!1),N=_H(null),P=_H(null),F=_H(null),I=_H(null),L=_H(null),R=_H(null),z=_H(null),B=_H(null),V=_H(!1),H=_H(null),U=_H(null),W=_H(null),G=_H(null),K=vH(()=>new Map,[]),[,ee]=pH(0),[q,te]=pH(null),[ne,re]=pH(null),[ie,ae]=pH(null),[oe,se]=pH(null),[ce,le]=pH(0),[ue,de]=pH(null),fe=_H(ue);fe.current=ue;let pe=_H(null),me=_H(null),he=_H(null),ge=_H(null),_e=_H(null),ve=_H(!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=_H(d===`retain`&&t.isSearchOpen()),[Ce,we]=pH(p);hH(()=>{p||we(!1)},[p]);let Te=_H(!1),Ee=yH(()=>{Te.current=!0,we(e=>e&&!1)},[]),[De,Oe]=pH(()=>PH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[ke,Ae]=pH(!1);hH(()=>{Ae(!0)},[]);let je=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Me=e?.contextMenu?.triggerMode??(je?`right-click`:`both`),Ne=Me===`both`||Me===`button`,Pe=e?.contextMenu?.buttonVisibility??`when-needed`,Fe=Me===`both`||Me===`right-click`;gH(()=>{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 Ie=yH((e,t)=>{uU(T.current,e,t)},[]),Le=yH((e,t)=>{uU(E.current,e,t)},[]),Re=yH(e=>{x.current=e},[]),ze=yH(e=>dU(e,E.current,T.current),[]),Be=n!=null||r!=null||i!=null,{resolveIcon:Ve}=vH(()=>IF(a),[a]),He=t[Xz](),Ue=He.getPath(),We=Ue!=null,Ge=t.isSearchOpen(),Ke=t.getSearchValue(),qe=t.getFocusedPath(),Je=t.getFocusedIndex(),Ye=t.isDragAndDropEnabled(),Xe=t.getDragSession(),Ze=vH(()=>Xe==null?null:new Set(Xe.draggedPaths),[Xe]),Qe=Xe?.target??null,$e=Xe?.primaryPath??null,et=gU(o),{overlayHeight:tt,overlayRows:nt,snapshot:rt,visibleRows:it}=De,at=rt.physical.viewportHeight,ot=vH(()=>({end:rt.window.endIndex,start:rt.window.startIndex}),[rt.window.endIndex,rt.window.startIndex]),st=nt,ct=rt.sticky.rows,lt=rt.physical.totalHeight,ut=rt.sticky.height,dt=vH(()=>new Set(ct.map(e=>jH(e.row))),[ct]),J=Je>=0&&Je>=ot.start&&Je<=ot.end,ft=yH((e,t)=>u?.({item:hU(e,t),row:e})??null,[u]),pt=yH(e=>DH(e==null?null:T.current.get(e)??null)?!0:DH(S.current),[]),mt=yH(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=_H(mt);ht.current=mt;let gt=_H(!0),_t=_H(()=>{}),vt=yH((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=yH(e=>{let t=e==null?null:lU(S.current,e);ae(e=>e===t?e:t)},[]),bt=yH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=ze(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:hU(e,n),path:n,source:r?.source??`keyboard`})},[t,ze,yt]),xt=yH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=XH(e,at);N.current=Je<0||e==null?null:Math.max(0,Math.min(Je*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),ee(e=>e+1))}},[t,Je,s,l,at]),St=yH((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=XH(i,at),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:PH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,eU(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,at,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Y=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Tt=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},X=()=>{R.current?.remove(),R.current=null},Et=()=>{Y(P.current),P.current=null,L.current=null},Dt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Ot=()=>{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),X(),Tt(),Et(),z.current=null},kt=(e,n)=>{let r=S.current?.getRootNode(),i=VH(zH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},At=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Tt();return}let r=t.getItem(e.directoryPath),i=qH(r)?r:null;if(i==null||i.isExpanded()){Tt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Tt(),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))},jt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=WH(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()),At(kt(e.clientX,e.clientY)),P.current=wt(jt)},Mt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(jt)},Nt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Ot(),X(),Tt(),Et(),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),UH())){let t=HH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Dt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Pt=()=>{X(),Tt(),Et(),z.current=null,t.cancelDrag()},Ft=(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<=IH*IH||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=HH(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`}),Dt(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)`),At(kt(t.clientX,t.clientY)),Mt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&kt(n.clientX,n.clientY),t.completeDrag(),Ot()},u=()=>{t.cancelDrag(),Ot()};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)},FH)},It=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}aU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(He.isActive()){if(e.key===`Escape`)He.cancel();else if(e.key===`Enter`)He.commit();else return;se(`focus`),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(qe??void 0),e.preventDefault(),e.stopPropagation();return}if(Ge){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=XH(n,at);N.current=Je<0||n==null?null:Math.max(0,Math.min(Je*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`),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&YH(e)){t.openSearch(e.key),ee(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=je&&rU(e),r=iU(e,je),i=r&&S.current!=null?OH(S.current):null,a=r?new Set(fU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==qe&&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=qH(p)?p:null,h=u!=null&&(dt.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=dU(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&JH(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&&(dt.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,mU(S.current,v,i,u,s,ut,at)),k.current=!0,te(e=>e===b?e:b)):ye()}ee(e=>e+1),e.preventDefault(),e.stopPropagation()};gH(()=>{if(!(!f||!Ge)){if(Se.current){Se.current=!1;return}DH(w.current)}},[Ge,f]),gH(()=>{let e=x.current;switch(qV({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Ue})){case`reset`:j.current=null;return;case`reveal-canonical`:Ue!=null&&St(Ue,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=Ue,DH(e),e.select());return}},[ot.end,ot.start,Ue,St,dt]),gH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=OH(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,OH(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)}},[]),gH(()=>{let e=S.current;e!=null&&(rt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[rt.physical.scrollTop]),gH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=XH(n,g);let a=()=>{let e=t.getVisibleCount(),r=ZH(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Oe(PH({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?ee(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:QH(e[0]))??XH(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]),gH(()=>{je||ue==null||vt(!1)},[vt,je,ue]);let Lt=vH(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);gH(()=>{if(Lt==null){m?.clearSlotContent(OF);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??sU(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(OF,i),e?.contextMenu?.onOpen?.(t.item,r),bU(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&bU(i)}),()=>{m?.clearSlotContent(OF)}},[Lt,e?.contextMenu,m]),gH(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),gH(()=>{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&&(oU(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]),gH(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=qe;return}let n=qe==null?null:T.current.get(qe)??null,r=OH(t),i=r?.dataset.itemPath??null,a=We&&x.current===r,o=f&&w.current===r,c=M.current&&!Ge,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!==qe,v=d!=null&&d===qe&&qe!=null,y=c&&eU(e,Je,s,at,lt,l),b=u!=null&&u===qe&&eU(e,Je,s,at,lt,ut),E=p!=null&&p.path===qe&&eU(e,Je,s,at,lt,p.viewportOffset),O=m!=null&&m.path===qe&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==qe&&!v&&$H(e,Je,s,at,ut))&&D.current(),!g){A.current=qe;return}if(a){A.current=qe;return}if(o&&!c){A.current=qe;return}if(n==null){c&&Je>=0&&(eU(e,Je,s,at,lt,l),D.current()),A.current=qe;return}(_||c||u===qe||d===qe||p?.path===qe||m?.path===qe||i==null||i!==qe)&&(DH(n),u===qe&&(pe.current=null),d===qe&&(me.current=null),p?.path===qe&&(he.current=null),m?.path===qe&&(ge.current=null),M.current=!1,N.current=null),A.current=qe},[t,Je,qe,J,s,We,Ge,ot,at,f,ut,lt,it]);let Rt=Je>=0&&Je>=rt.visible.startIndex&&Je<=rt.visible.endIndex,zt=qe!=null&&st.some(e=>jH(e.row)===qe),Bt=Rt||zt,Vt=Ne&&k.current===!0&&Bt?qe:null,Ht=oe===`pointer`?ne:null,Ut=ue?.path??_e.current??Ht??Vt??ne,Wt=ue?.source===`right-click`;gH(()=>{y.current&&ue==null||yt(ze(Ut))},[ue,ze,ot,at,ce,st,Ut,yt,it]);let Gt=yH(e=>{if(y.current||oU(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)},[]),Kt=yH(()=>{re(null)},[]);gH(()=>{if(!Ye)return;let e=()=>{Ot(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Ot(),t.cancelDrag()}},[t,Ye]);let qt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=VH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),At(t.getDragSession()?.target??null),Mt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Jt=e=>{if(!Ye||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Tt(),Et(),t.setDragTarget(null))},Yt=e=>{!Ye||t.getDragSession()==null||V.current||(e.preventDefault(),kt(e.clientX,e.clientY),t.completeDrag(),X(),Tt(),Et(),z.current=null)},Xt=rt.window.height,Zt=rt.window.offsetTop,Qt=Math.min(0,at-Xt-ut),$t=q===qe||M.current,en=qe!=null&&$t&&!J&&Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null,tn=en==null?null:tU(Je,s,ot,Xt),nn=z.current,rn=$e!=null&&nn!=null&&nn.path===$e&&nn.index>=ot.start&&nn.index<=ot.end,an=$e!=null&&nn!=null&&nn.path===$e&&!rn&&nn.path!==en?.path?nn:null,on=an==null?null:tU(an.index,s,ot,Xt),sn=nU((Je>=0?it[Je]??t.getVisibleRows(Je,Je)[0]??null:null)?.ancestorPaths.at(-1)??null),cn=Ge&&qe!=null?_U(o,qe,!J):void 0,ln=ue?.path??(Ge?qe:q),un=ue?.path??ne,dn=ze(Ut),fn=je&&Ne&&!Wt&&!We&&dn!=null&&ie!=null&&Ut!=null,pn=je&&(fn||ue!=null),mn=ue?.anchorRect,hn=mn==null&&dn!=null&&ie!=null&&(ue!=null||fn)?ie:null,gn=mn==null?hn==null?void 0:{top:`${hn}px`}:{left:`${mn.left}px`,position:`fixed`,right:`auto`,top:`${mn.top}px`},_n=Wt?{opacity:`0`}:void 0,vn=yH((e,n,r,i)=>{let a=t.getItem(r),o=YV({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>=rt.visible.startIndex&&n.index<=rt.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&&qH(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,rt.visible.endIndex,rt.visible.startIndex,St]),yn=()=>{if(y.current||!Ne||Ut==null||dn==null)return;let e=t.getItem(Ut);e!=null&&(yt(dn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:dn.getAttribute(`aria-label`)??Ut,path:e.getPath()},path:e.getPath(),source:`button`}))},bn={contextHoverPath:un,contextMenuButtonTriggerEnabled:Ne,contextMenuButtonVisibility:Pe,contextMenuEnabled:je,contextMenuRightClickEnabled:Fe,contextMenuTriggerMode:Me,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ye,draggedPathSet:Ze,dragTarget:Qe,gitLaneActive:Be,gitStatusByPath:n,handleRowDragEnd:Pt,handleRowDragStart:Nt,handleRowTouchStart:Ft,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:It,onRowClick:vn,openContextMenuForRow:bt,registerButton:Ie,registerRenameInput:Re,renameView:He,renderDecorationForRow:ft,resolveIcon:Ve,shouldSuppressContextMenu:Ct,visualFocusPath:ln},xn={...bn,registerButton:Le};return hV(`div`,{ref:S,id:et,"data-file-tree-context-menu-button-visibility":je&&Ne?Pe:void 0,"data-file-tree-context-menu-trigger-mode":je?Me:void 0,"data-file-tree-has-context-menu-action-lane":je&&Ne?`true`:void 0,"data-file-tree-has-git-lane":Be?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Ye?Jt:void 0,onDragOver:Ye?qt:void 0,onDrop:Ye?Yt:void 0,onKeyDown:It,onPointerLeave:je?Kt:void 0,onPointerOver:je?Gt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[hV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:sn}}),hV(`slot`,{name:DF,"data-type":`header-slot`}),f?hV(`div`,{"data-file-tree-search-container":!0,"data-open":Ge?`true`:`false`,children:hV(`input`,{ref:w,"aria-activedescendant":cn,"aria-controls":et,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ke,onBlur:()=>{d===`retain`&&!Te.current||t.closeSearch()},onFocus:Ee,onPointerDown:Ee,onInput:e=>{Ee();let n=e.currentTarget;t.setSearch(n.value)}})}):null,hV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&ke&&st.length>0?hV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:hV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${tt}px`},children:st.map((e,t)=>SU(xn,e.row,`sticky:${jH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${st.length-t}`}}))})}):null,hV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${lt}px`},children:[hV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${Zt}px`}}),hV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Xt}px`,top:`${Qt}px`,bottom:`${Qt}px`},children:[CU(bn,ot,dt),en!=null&&tn!=null?SU(bn,en,`parked:${en.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:$e===en.path?`none`:void 0,position:`absolute`,right:`0`,top:`${tn}px`}}):null,an!=null&&on!=null?SU(bn,an,`parked-drag:${an.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${on}px`}}):null]})]})]}),je?hV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":pn?`true`:`false`,style:gn,children:[hV(`button`,{ref:v,type:`button`,"data-type":kF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":fn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}yn()},tabIndex:-1,style:_n,children:hV(yV,{...Ve(`file-tree-icon-ellipsis`)})}),ue==null?null:hV(`slot`,{name:OF})]}):null,ue==null?null:hV(`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 TU={hydrateRoot:(e,t)=>{pV(UB(wU,t),e)},renderRoot:(e,t)=>{fV(UB(wU,t),e)},unmountRoot:e=>{fV(null,e)}};function EU(e,t){TU.renderRoot(e,t)}function DU(e,t){TU.hydrateRoot(e,t)}function OU(e){TU.unmountRoot(e)}var kU=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)}}},AU=`__c`,jU=`__k`,MU=`__d`,NU=`__s`,PU=/[\s\n\\/='"\0<>]/,FU=/^(xlink|xmlns|xml)([A-Z])/,IU=/^(?: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])/,LU=/^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/,RU=new Set([`draggable`,`spellcheck`]);function zU(e){e.__g===void 0?e[MU]=!0:e.__g|=8}function BU(e){e.__g===void 0?e[MU]=!1:e.__g&=-9}function VU(e){return e.__g===void 0?!0===e[MU]:!!(8&e.__g)}var HU=/["&<]/;function UU(e){if(e.length===0||!1===HU.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 WU={},GU=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(`.`)),KU=/[A-Z]/g;function qU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:WU[n]||(WU[n]=n.replace(KU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||GU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function JU(){this.__d=!0}function YU(e,t){return{__v:e,context:t,props:e.props,setState:JU,forceUpdate:JU,__d:!0,__h:[]}}function XU(e,t,n){if(!e.s){if(n instanceof ZU){if(!n.s)return void(n.o=XU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(XU.bind(null,e,t),XU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var ZU=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{XU(r,1,a(this.v))}catch(e){XU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?XU(r,1,t?t(i):i):n?XU(r,1,n(i)):XU(r,2,i)}catch(e){XU(r,2,e)}},r},e}(),QU,$U,eW,tW,nW={},rW=Array.isArray,iW=Object.assign,aW=``,oW=`<!--$s-->`,sW=`<!--/$s-->`;function cW(e,t){var n,r=e.type,i=!0;return e[AU]?(i=!1,(n=e[AU]).state=n[NU]):n=new r(e.props,t),e[AU]=n,n.__v=e,n.props=e.props,n.context=t,zU(n),n.state??=nW,n[NU]??(n[NU]=n.state),r.getDerivedStateFromProps?n.state=iW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[NU]===n.state?n.state:n[NU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),eW&&eW(e),n.render(n.props,n.state,t)}function lW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===aW)return aW;var s=typeof e;if(s!=`object`)return s==`function`?aW:s==`string`?UU(e):e+aW;if(rW(e)){var c,l=aW;i[jU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=lW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=aW,rW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return aW;e.__=i,QU&&QU(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===GB){if(`tpl`in g){for(var x=aW,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&&!rW(C)?x+=C:x+=lW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+UU(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=cW(e,b),y=e[AU];else{e[AU]=y=YU(e,b);for(var E=0;VU(y)&&E++<25;){BU(y),eW&&eW(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}zU(y)}if(y.getChildContext!=null&&(t=iW({},t,y.getChildContext())),T&&DB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===GB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return lW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[NU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,nW),VU(y)?(v=cW(e,t),(y=e[AU]).getChildContext!=null&&(t=iW({},t,y.getChildContext())),lW(v=v!=null&&v.type===GB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):aW}finally{$U&&$U(e),tW&&tW(e)}}}v=v!=null&&v.type===GB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=lW(v,t,n,r,e,a,o);return $U&&$U(e),DB.unmount&&DB.unmount(e),e._suspended?typeof D==`string`?oW+D+sW:rW(D)?(D.unshift(oW),D.push(sW),D):D.then(function(e){return oW+e+sW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return lW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=DB.__e;return k&&k(i,e),aW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=lW(v,t,n,r,e,a,o);return e._suspended?oW+s+sW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=aW;for(var N in g){var P=g[N];if(typeof(P=dW(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=qU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(FU.test(N))N=N.replace(FU,`$1:$2`).toLowerCase();else{if(PU.test(N))continue;N[4]!==`-`&&!RU.has(N)||P==null?n?LU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):IU.test(N)&&(N=N.toLowerCase()):P+=aW}}P!=null&&!1!==P&&(j=!0===P||P===aW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?UU(P):P+aW)+`"`)}}if(PU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=UU(A):A!=null&&!1!==A&&!0!==A&&(M=lW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),$U&&$U(e),tW&&tW(e),!M&&uW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return rW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var uW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function dW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var fW=0;function pW(e){return e!=null&&e.length>0?e:(fW+=1,`pst_ft_${fW}`)}function mW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Tz)}function hW(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 gW(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 _W(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var vW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new kU;#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=pW(a),this.#p=EB(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=wz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new xB({...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&&(OU(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(),EU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=EB(e,this.#p);let t=this.#T();t!=null&&EU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),EU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),DU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),EU(r,this.#w())}#C(){return{initialViewportHeight:mW({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(DF,e());return}this.#l.setSlotHtml(DF,this.#e?.header?.html??null)}#k(e){let t=_W(e).find(e=>gW(e)),n=hW(_F(jF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=_W(e),n=t.find(e=>gW(e)),r=t.filter(e=>e!==n),i=jF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=hW(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=jF(this.#m);t.colored&&yF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${CF}]`);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(CF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=kz(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 Fz(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)}},yW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function bW(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:DF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:OF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function xW(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 SW(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 CW(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 wW({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)(()=>CW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),yW(()=>{n.setComposition(g)},[g,n]),yW(()=>{if(c!=null)return r!=null&&SW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=xW(bW(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)(xF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function TW(e){let t=(0,Q.useRef)(null);return t.current??=new vW(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function EW(e){let t=(0,$.c)(22),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,c=n===void 0?`this item`:n,l=a??`Delete ${c}`,u;t[0]===l?u=t[1]:(u=(0,Z.jsx)(Dr,{children:l}),t[0]=l,t[1]=u);let d=o??`Are you sure you want to delete ${c}? This action cannot be undone.`,f;t[2]===d?f=t[3]:(f=(0,Z.jsx)(Tr,{className:`whitespace-pre-wrap`,children:d}),t[2]=d,t[3]=f);let p;t[4]===s?p=t[5]:(p=s?(0,Z.jsx)(Pr,{children:s}):null,t[4]=s,t[5]=p);let m;t[6]===r?m=t[7]:(m=(0,Z.jsx)(Lr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`outline`,disabled:r,children:`Cancel`})}),t[6]=r,t[7]=m);let h;t[8]===r?h=t[9]:(h=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[8]=r,t[9]=h);let g;t[10]!==r||t[11]!==i||t[12]!==h?(g=(0,Z.jsx)(X,{variant:`destructive`,onClick:i,disabled:r,children:h}),t[10]=r,t[11]=i,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==m||t[15]!==g?(_=(0,Z.jsxs)(Fr,{children:[m,g]}),t[14]=m,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==_||t[18]!==u||t[19]!==f||t[20]!==p?(v=(0,Z.jsxs)(jr,{children:[u,f,p,_]}),t[17]=_,t[18]=u,t[19]=f,t[20]=p,t[21]=v):v=t[21],v}var DW=`.md`,OW=/\.(md|mdx)$/i;function kW(e,t=DW){return`${e}${t}`}function AW(e){return qW(e).replace(OW,``)}function jW(e){let t=qW(e).match(OW);return t?`.${t[1].toLowerCase()}`:void 0}function MW(e){return qW(e)}function NW(e){let t=qW(e.trim());return t?`${t}/`:``}function PW(e){return e.endsWith(`/`)?MW(e):AW(e)}function FW(e){return e.map(e=>kW(e.docName,e.docExt))}function IW(e){return[...e].sort().join(`\0`)}function LW(e){return IW(FW(e))}function RW(e){let t=new Set;for(let n of e){let e=n.docName.split(`/`).filter(Boolean);for(let n=1;n<e.length;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function zW(e){if(!e)return[];let t=qW(e.replace(OW,``)).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 BW(e){let t=e.kind===`directory`,n=t?MW(e.path):AW(e.path),r=t?void 0:jW(e.path);return{kind:t?`folder`:`file`,name:qW(KW(e.path)).replace(OW,``),path:n,treePath:HW(e.path,t),docExt:r}}function VW(e){return e.kind===`directory`?MW(e.path):e.path}function HW(e,t){return t?NW(e):OW.test(e)?e:`${e}${DW}`}function UW(e,t,n){let r=NW(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}${DW}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`,o=`${a}index${DW}`;if(!i.has(o)&&!i.has(a))return{addPath:o,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function WW(e,t){return e===`file`?HW(t,!1):`${MW(t)}/index${DW}`}function GW(e,t){return t.kind===`root`||t.directoryPath==null?KW(e):`${t.directoryPath}${KW(e)}`}function KW(e){let t=qW(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function qW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function JW(e,t){if(!e)return{selectedFilePath:t,selectedFolderPath:null,navigationPath:t};switch(e.kind){case`doc`:return{selectedFilePath:e.docName,selectedFolderPath:null,navigationPath:e.docName};case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function YW(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 XW(e,t,n,r){return e.id===`cursor`&&!n?`Desktop only`:t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:r?`No workspace`:null}function ZW(e){let t=(0,$.c)(8),{input:n,installStates:r,isElectronHost:i,dispatch:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(tb,{children:[(0,Z.jsx)(ar,{"aria-hidden":`true`}),`Open in…`]}),t[0]=o):o=t[0];let s;t[1]!==a||t[2]!==n||t[3]!==r||t[4]!==i?(s=zd.map(e=>{let t=r[e.id],o=MN({target:e,installState:t,isElectronHost:i}),s=n===null,c=o.enabled&&!s,l=XW(e,t,i,s),u=l?`Open in ${e.displayName}, ${l}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(Yy,{disabled:!c,onSelect:()=>{!c||!n||a(e.id,n)},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":u,children:[(0,Z.jsx)(kN,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)}),t[1]=a,t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]===s?c=t[7]:(c=(0,Z.jsxs)(eb,{children:[o,(0,Z.jsx)(nb,{children:s})]}),t[6]=s,t[7]=c),c}var QW=80,$W=3,eG=20,tG=new Map,nG=new Set,rG=[],iG=new Map;function aG(e){for(iG.delete(e),iG.set(e,!0);iG.size>eG;){let e=iG.keys().next().value;if(e===void 0)break;iG.delete(e)}}function oG(e){nG.delete(e),sG()}function sG(){for(;nG.size<$W&&rG.length>0;){let e=rG.shift();if(!e)break;if(!iG.has(e.docName)){nG.add(e.docName),aG(e.docName);try{e.prewarm(e.docName)}catch(t){qn(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{oG(e.docName)}}}}function cG(e,t){if(yn(e)||iG.has(e))return;let n=tG.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(tG.delete(e),nG.size>=$W){rG.push({docName:e,prewarm:t});return}aG(e),nG.add(e);try{t(e)}catch(t){qn(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{oG(e)}},QW);tG.set(e,{timer:r,prewarm:t})}function lG(e){let t=tG.get(e);t&&(clearTimeout(t.timer),tG.delete(e))}function uG(e){window.location.hash=at(e)}async function dG(e,t){try{await navigator.clipboard.writeText(e),Hr.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Hr.error(`Could not copy ${t}`)}}var fG=new Set([`agents`,`agent`,`claude`,`skill`]),pG=`ok-file-tree-link-decoration`,mG=`ok-file-tree-agent-decoration`;function hG(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function gG(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${hG(t)}</symbol>`}var _G=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1844
+ ${gG(pG,va)}
1845
+ ${gG(mG,Vi)}
1846
+ </svg>`,vG=`
1847
1847
  [data-item-selected='true'] [data-icon-token='markdown'] {
1848
1848
  color: var(--trees-selected-fg);
1849
1849
  }
1850
- `;function gG(e){return{...zF({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 _G(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&lG.has(t)}function vG(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function yG(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=vG(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=yf(r.contentDir,RW(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)(en,{"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)(By,{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 bG(e){return e?.isDirectory()?e:null}function xG(e){let t=(0,$.c)(72),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,onStartCreating:c,onDelete:l,onExpandSubtree:u,onCollapseSubtree:d}=e,f;t[0]===n?f=t[1]:(f=LW(n),t[0]=n,t[1]=f);let p=f,m=n.kind===`directory`,h;t[2]!==m||t[3]!==n.path||t[4]!==a?(h=m?null:xf({docName:DW(n.path),workspace:a}),t[2]=m,t[3]=n.path,t[4]=a,t[5]=h):h=t[5];let g=h,_;t[6]===r?_=t[7]:(_=()=>r.close({restoreFocus:!1}),t[6]=r,t[7]=_);let v=_,y;t[8]===r?y=t[9]:(y=()=>r.close(),t[8]=r,t[9]=y);let b=y,x;t[10]===b?x=t[11]:(x=e=>{e||b()},t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Ry,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[12]=S):S=t[12];let C;t[13]!==i||t[14]!==b||t[15]!==v||t[16]!==m||t[17]!==n.path||t[18]!==d||t[19]!==u||t[20]!==c?(C=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(By,{disabled:i,onSelect:()=>{v(),c(`file`,kW(n.path))},children:[(0,Z.jsx)(Ua,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(By,{disabled:i,onSelect:()=>{v(),c(`folder`,kW(n.path))},children:[(0,Z.jsx)(ca,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(Wy,{}),(0,Z.jsxs)(By,{onSelect:()=>{b(),u(n.path)},children:[(0,Z.jsx)(Za,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(By,{onSelect:()=>{b(),d(n.path)},children:[(0,Z.jsx)(sa,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)(Wy,{})]}):null,t[13]=i,t[14]=b,t[15]=v,t[16]=m,t[17]=n.path,t[18]=d,t[19]=u,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==v||t[23]!==n.path||t[24]!==s?(w=()=>{v(),s.startRenaming(n.path)},t[22]=v,t[23]=n.path,t[24]=s,t[25]=w):w=t[25];let T;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(sn,{"aria-hidden":`true`}),t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==w?(E=(0,Z.jsxs)(By,{disabled:i,onSelect:w,children:[T,`Rename`]}),t[27]=i,t[28]=w,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(Ky,{children:[(0,Z.jsx)(dr,{"aria-hidden":`true`}),`Copy Path`]}),t[30]=D):D=t[30];let O=!a,k;t[31]!==b||t[32]!==n||t[33]!==a?(k=()=>{a&&(b(),cG(yf(a.contentDir,RW(n),a.pathSeparator),`full path`))},t[31]=b,t[32]=n,t[33]=a,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(By,{disabled:O,onSelect:k,children:`Full Path`}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==b||t[39]!==n?(j=(0,Z.jsx)(By,{onSelect:()=>{b(),cG(RW(n),`relative path`)},children:`Relative Path`}),t[38]=b,t[39]=n,t[40]=j):j=t[40];let M;t[41]!==A||t[42]!==j?(M=(0,Z.jsxs)(Gy,{children:[D,(0,Z.jsxs)(qy,{children:[A,j]})]}),t[41]=A,t[42]=j,t[43]=M):M=t[43];let N;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Wy,{}),t[44]=N):N=t[44];let P;t[45]!==b||t[46]!==n||t[47]!==a?(P=(0,Z.jsx)(yG,{item:n,workspace:a,onClose:b}),t[45]=b,t[46]=n,t[47]=a,t[48]=P):P=t[48];let F;t[49]!==o||t[50]!==g||t[51]!==m?(F=!m&&(0,Z.jsx)(JW,{input:g,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[49]=o,t[50]=g,t[51]=m,t[52]=F):F=t[52];let I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Wy,{}),t[53]=I):I=t[53];let L;t[54]!==b||t[55]!==l||t[56]!==p?(L=()=>{b(),l(p)},t[54]=b,t[55]=l,t[56]=p,t[57]=L):L=t[57];let R;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Pt,{"aria-hidden":`true`}),t[58]=R):R=t[58];let z;t[59]!==i||t[60]!==L?(z=(0,Z.jsxs)(By,{variant:`destructive`,disabled:i,onSelect:L,children:[R,`Delete`]}),t[59]=i,t[60]=L,t[61]=z):z=t[61];let B;t[62]!==E||t[63]!==M||t[64]!==P||t[65]!==F||t[66]!==z||t[67]!==C?(B=(0,Z.jsxs)(zy,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[C,E,M,N,P,F,I,z]}),t[62]=E,t[63]=M,t[64]=P,t[65]=F,t[66]=z,t[67]=C,t[68]=B):B=t[68];let V;return t[69]!==B||t[70]!==x?(V=(0,Z.jsxs)(Ly,{open:!0,modal:!1,onOpenChange:x,children:[S,B]}),t[69]=B,t[70]=x,t[71]=V):V=t[71],V}function SG(e){let t=(0,$.c)(106),{ref:n}=e,{activeDocName:r,activeTarget:i,closeDocument:a,closeAndClearForRename:o,prewarm:s}=jn(),{notifySidebarFileSelected:c}=jM(),{resolvedTheme:l}=xe(),u;t[0]===c?u=t[1]:(u=function(e){sG(e),c()},t[0]=c,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[2]=f):f=t[2];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!0),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(p),E=(0,Q.useRef)(r),D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[3]=D):D=t[3];let O=(0,Q.useRef)(D),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(!1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(jG),F=(0,Q.useRef)(AG),I=(0,Q.useRef)(kG),{selectedFilePath:L,selectedFolderPath:R,navigationPath:z}=GW(i,r),B=L?EW(L,p.find(e=>e.docName===L)?.docExt):R?AW(R):null,V=Vf().states,{dispatch:H}=Af(),U;t[4]!==H||t[5]!==V?(U={installStates:V,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:H},t[4]=H,t[5]=V,t[6]=U):U=t[6];let W=U,G;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[7]=G):G=t[7];let K;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(K={set:`complete`,spriteSheet:mG},t[8]=K):K=t[8];let ee;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(ee={paths:G,flattenEmptyDirectories:!1,initialExpansion:`closed`,search:!0,searchBlurBehavior:`retain`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:K,unsafeCSS:hG,composition:{contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},dragAndDrop:{canDrag:()=>N.current===null,canDrop:()=>N.current===null,onDropComplete:e=>I.current(e),onDropError:OG},renaming:{canRename:()=>N.current===null,onRename:e=>F.current(e),onError:Hr.error},onSelectionChange:e=>P.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=T.current.find(e=>EW(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:uG,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:_G(t.path)?{icon:dG,title:`Agent configuration file`}:null}},t[9]=ee):ee=t[9];let{model:q}=SW(ee),te,ne;t[10]===p?(te=t[11],ne=t[12]):(ne=MW(p),te=NW(ne),t[10]=p,t[11]=te,t[12]=ne);let re=te,ie=(0,Q.useRef)(ne),ae;t[13]===p?ae=t[14]:(ae=FW(p),t[13]=p,t[14]=ae);let oe=ae,se=(0,Q.useRef)(oe),ce=R?IW(AW(R)).slice(0,-1):IW(B??z),le=ce.join(`\0`),ue;t[15]===q?ue=t[16]:(ue=e=>{let t=MW(e??T.current);q.resetPaths(t,{initialExpandedPaths:O.current})},t[15]=q,t[16]=ue);let de=ue,fe;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{A.current=PW(e)},t[17]=fe):fe=t[17];let pe=fe,me,he;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>{let e=!0,t=KW(async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(DG);if(!e)return;t.ok&&n?.ok?(m(n.documents),v(null)):v(n?.error??`Server error (HTTP ${t.status})`)}catch(t){let n=t;e&&v(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&g(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Xe(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},he=[],t[18]=me,t[19]=he):(me=t[18],he=t[19]),(0,Q.useEffect)(me,he);let ge,_e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json().catch(EG);e&&t.ok&&n?.ok&&typeof n.contentDir==`string`&&(n.pathSeparator===`/`||n.pathSeparator===`\\`)&&w({contentDir:n.contentDir,pathSeparator:n.pathSeparator})}).catch(TG),()=>{e=!1}},_e=[],t[20]=ge,t[21]=_e):(ge=t[20],_e=t[21]),(0,Q.useEffect)(ge,_e);let ve,ye;t[22]!==q||t[23]!==re?(ve=()=>{if(A.current===re){A.current=null;return}q.resetPaths(ie.current,{initialExpandedPaths:O.current})},ye=[q,re],t[22]=q,t[23]=re,t[24]=ve,t[25]=ye):(ve=t[24],ye=t[25]),(0,Q.useEffect)(ve,ye);let be,Se;t[26]!==le||t[27]!==B||t[28]!==q?(be=()=>{if(!B)return;let e=le?le.split(`\0`):[];for(let t of e){let e=bG(q.getItem(t));e&&!e.isExpanded()&&e.expand()}let t=q.getItem(B);t&&(M.current=!0,t.select(),t.focus(),queueMicrotask(()=>{M.current=!1}))},Se=[le,B,q],t[26]=le,t[27]=B,t[28]=q,t[29]=be,t[30]=Se):(be=t[29],Se=t[30]),(0,Q.useEffect)(be,Se);let Ce,we;t[31]===q?(Ce=t[32],we=t[33]):(Ce=()=>q.subscribe(()=>{if(!q.isSearchOpen())for(let e of O.current){let t=bG(q.getItem(e));t&&!t.isExpanded()&&t.expand()}}),we=[q],t[31]=q,t[32]=Ce,t[33]=we),(0,Q.useEffect)(Ce,we);let Te;t[34]===o?Te=t[35]:(Te=async e=>{let t=E.current,n=lM(t,e);await Promise.all(e.flatMap(e=>[o(e.fromDocName),o(e.toDocName)])),m(t=>{let n=sM(t,e);return pe(n),n}),Oe([`files`,`backlinks`,`graph`]),t&&n!==t&&(window.location.hash=`#/${n}`)},t[34]=o,t[35]=Te);let Ee=Te,De;t[36]!==Ee||t[37]!==de?(De=async function(e){let t=e.isFolder?`folder`:`file`,n=zW(e.sourcePath,e.isFolder),r=zW(e.destinationPath,e.isFolder),i=k.current;b(n),v(null);try{if(i?.renamePath===n){let e=VW(t,r),n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await n.json().catch(wG);if(!n.ok||!i?.ok){let e=i?.error??`Failed to create ${t}`;Hr.error(e),v(e),de(),k.current=null,b(null);return}let a=i.docName??e.replace(/\.md$/i,``);m(e=>{if(e.some(e=>e.docName===a))return e;let t=[...e,{docName:a,modified:new Date().toISOString(),size:0}];return pe(t),t}),sG(a),Oe([`files`,`backlinks`,`graph`]),k.current=null,b(null);return}let a=e.isFolder?{kind:`folder`,fromPath:kW(n),toPath:kW(r)}:{kind:`file`,fromPath:DW(n),toPath:DW(r)},o=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),s=await o.json();if(!o.ok||!s.ok){let e=s.error??`Failed to rename path`;Hr.error(e),v(e),de(),k.current=null,b(null);return}await Ee(Array.isArray(s.renamed)?s.renamed:[]),k.current=null,b(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),Hr.error(`Network error — please try again`),v(`Network error — please try again`),de(),k.current=null,b(null)}},t[36]=Ee,t[37]=de,t[38]=De):De=t[38];let ke=De,Ae;t[39]!==Ee||t[40]!==de?(Ae=async function(e){let t=e.draggedPaths.map(t=>{let n=HW(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(CG);if(t.length!==0){b(t[0]?.sourcePath??null),v(null);try{let e=[];for(let n of t){let t=n.sourcePath.endsWith(`/`)?{kind:`folder`,fromPath:kW(n.sourcePath),toPath:kW(n.destinationTreePath)}:{kind:`file`,fromPath:DW(n.sourcePath),toPath:DW(n.destinationTreePath)},r=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i=await r.json();if(!r.ok||!i.ok){let e=i.error??`Failed to move`;Hr.error(e),v(e),de(),b(null);return}e=e.concat(Array.isArray(i.renamed)?i.renamed:[])}await Ee(e),b(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Hr.error(`Network error — please try again`),de(),b(null)}}},t[39]=Ee,t[40]=de,t[41]=Ae):Ae=t[41];let je=Ae,Me;t[42]!==q||t[43]!==ne?(Me=function(e,t){try{let n=BW(e,t,[...ne,...se.current]);k.current={kind:e,renamePath:n.renamePath},q.add(n.addPath),q.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Hr.error(`Could not start creating a new item`)}},t[42]=q,t[43]=ne,t[44]=Me):Me=t[44];let Ne=Me,Pe;t[45]===q?Pe=t[46]:(Pe=function(e){let t=AW(e);(0,Q.startTransition)(()=>{for(let e of se.current)if(e===t||e.startsWith(t)){let t=bG(q.getItem(e));t&&t.expand()}})},t[45]=q,t[46]=Pe);let Fe=Pe,Ie;t[47]===q?Ie=t[48]:(Ie=function(e){let t=AW(e),n=new Set(O.current);(0,Q.startTransition)(()=>{for(let e of[...se.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=bG(q.getItem(e));t&&t.collapse()}})},t[47]=q,t[48]=Ie);let Le=Ie,Re;t[49]!==ce||t[50]!==r||t[51]!==y||t[52]!==p||t[53]!==oe||t[54]!==je||t[55]!==ke||t[56]!==d||t[57]!==ne?(Re=()=>{T.current=p,E.current=r,N.current=y,ie.current=ne,se.current=oe,O.current=ce,P.current=e=>{if(M.current)return;let t=e[0];if(!t)return;let n=jW(t);if(!t.endsWith(`/`)&&!T.current.some(e=>e.docName===n)){console.debug(`[FileTree] Dropped selection for unknown docName:`,n);return}d(n)},F.current=ke,I.current=je},t[49]=ce,t[50]=r,t[51]=y,t[52]=p,t[53]=oe,t[54]=je,t[55]=ke,t[56]=d,t[57]=ne,t[58]=Re):Re=t[58],(0,Q.useLayoutEffect)(Re);let ze;t[59]!==q||t[60]!==Ne?(ze=()=>({startCreating:Ne,expandAll(){(0,Q.startTransition)(()=>{for(let e of se.current){let t=bG(q.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(O.current);(0,Q.startTransition)(()=>{for(let t of[...se.current].reverse()){if(e.has(t))continue;let n=bG(q.getItem(t));n&&n.collapse()}})}}),t[59]=q,t[60]=Ne,t[61]=ze):ze=t[61],(0,Q.useImperativeHandle)(n,ze);let Be;t[62]!==a||t[63]!==q||t[64]!==de?(Be=async function(e){b(e.path),S(null);try{let t=e.kind===`folder`?AW(e.path):EW(e.path,e.docExt),n=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r=await n.json();if(!n.ok||!r.ok){Hr.error(r.error??`Failed to delete path`),b(null);return}let i=Array.isArray(r.deletedDocNames)?r.deletedDocNames:[],o=new Set(i);for(let e of o)a(e);q.getItem(t)&&q.remove(t,e.kind===`folder`?{recursive:!0}:void 0),m(e=>{let t=cM(e,i);return pe(t),t}),Oe([`files`,`backlinks`,`graph`]);let s=E.current;s&&o.has(s)&&(window.location.hash=``),b(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),Hr.error(`Network error — please try again`),b(null),de()}},t[62]=a,t[63]=q,t[64]=de,t[65]=Be):Be=t[65];let Ve=Be,He;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){let e=j.current;e&&oG(e),j.current=null},t[66]=He):He=t[66];let Ue=He,We;t[67]===s?We=t[68]:(We=function(e){let t=MG(e.nativeEvent);if(!t||t.endsWith(`/`)){Ue();return}let n=DW(t);j.current!==n&&(Ue(),j.current=n,aG(n,e=>{s(e)}))},t[67]=s,t[68]=We);let Ge=We;if(h){let e;return t[69]===Symbol.for(`react.memo_cache_sentinel`)?(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/30 text-sm`,children:`Loading...`})}),t[69]=e):e=t[69],e}if(p.length===0){if(_){let e;return t[70]===_?e=t[71]:(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:_})}),t[70]=_,t[71]=e),e}let e;t[72]===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[72]=e):e=t[72];let n;return t[73]===Ne?n=t[74]:(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:()=>Ne(`file`,``),children:`Create your first file`})]}),t[73]=Ne,t[74]=n),n}let Ke=y!==null,qe;t[75]===_?qe=t[76]:(qe=_&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:_}),t[75]=_,t[76]=qe);let Je;t[77]===l?Je=t[78]:(Je=gG(l),t[77]=l,t[78]=Je);let Ye;t[79]!==Ke||t[80]!==Le||t[81]!==Fe||t[82]!==W||t[83]!==q||t[84]!==Ne||t[85]!==C?(Ye=(e,t)=>(0,Z.jsx)(xG,{item:e,context:t,anyActionBusy:Ke,workspace:C,handoff:W,model:q,onStartCreating:Ne,onDelete:S,onExpandSubtree:Fe,onCollapseSubtree:Le}),t[79]=Ke,t[80]=Le,t[81]=Fe,t[82]=W,t[83]=q,t[84]=Ne,t[85]=C,t[86]=Ye):Ye=t[86];let Ze;t[87]!==Ge||t[88]!==q||t[89]!==qe||t[90]!==Je||t[91]!==Ye?(Ze=(0,Z.jsx)(xW,{header:qe,model:q,style:Je,onMouseMove:Ge,onMouseLeave:Ue,renderContextMenu:Ye}),t[87]=Ge,t[88]=q,t[89]=qe,t[90]=Je,t[91]=Ye,t[92]=Ze):Ze=t[92];let Qe=!!x,$e;t[93]===y?$e=t[94]:($e=e=>{!e&&!y&&S(null)},t[93]=y,t[94]=$e);let et;t[95]!==y||t[96]!==x||t[97]!==Ve?(et=x&&(0,Z.jsx)(CW,{itemName:`${x.name}${x.kind===`file`?x.docExt??`.md`:`/`}`,isSubmitting:y===x.path,onDelete:()=>Ve(x),customDescription:x.kind===`folder`?`Are you sure you want to delete ${x.name}/ and all files inside? This action cannot be undone.`:void 0}),t[95]=y,t[96]=x,t[97]=Ve,t[98]=et):et=t[98];let tt;t[99]!==Qe||t[100]!==$e||t[101]!==et?(tt=(0,Z.jsx)(zr,{open:Qe,onOpenChange:$e,children:et}),t[99]=Qe,t[100]=$e,t[101]=et,t[102]=tt):tt=t[102];let nt;return t[103]!==Ze||t[104]!==tt?(nt=(0,Z.jsxs)(Z.Fragment,{children:[Ze,tt]}),t[103]=Ze,t[104]=tt,t[105]=nt):nt=t[105],nt}function CG(e){return!!e}function wG(){return null}function TG(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function EG(){return null}function DG(){return null}function OG(e){Hr.error(e)}function kG(){}function AG(){}function jG(){}function MG(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t.dataset.itemPath;return null}var NG=(e,t,n)=>no(e,t,n,`ProjectSwitcher`);function PG(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 NG(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),NG(()=>n.project.open({path:e,target:`new-window`}),`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),NG(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})},`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),NG(()=>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=Ly,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)(Gi,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(Ry,{asChild:!0,children:(0,Z.jsxs)(GM,{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),_=zy,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Uy,{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)(Uy,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(By,{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)(Wy,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(By,{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)(By,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:Rd}),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){let t=(0,$.c)(13),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a=`update-notice-${n.id}`,o=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,s;t[0]===n.body?s=t[1]:(s=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[0]=n.body,t[1]=s);let c;t[2]===n.action?c=t[3]:(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[2]=n.action,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Cr,{"aria-hidden":`true`,className:`size-3`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(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:l}),t[5]=r,t[6]=u);let d;return t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u?(d=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":a,className:o,children:[s,c,u]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function IG(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 LG(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Mu,ju,ju),n;e[0]===t?n=e[1]:(n=IG(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Au(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}function RG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Vn,{name:`file-sidebar`,children:(0,Z.jsx)(zG,{})}),e[0]=t):t=e[0],t}function zG(){let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`span`,{className:`font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(Ry,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Tree view options`,children:(0,Z.jsx)(xa,{"aria-hidden":`true`})})})}),(0,Z.jsx)(Gr,{children:`Tree view options`})]}),e[1]=r):r=e[1];let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(By,{onSelect:()=>t.current?.expandAll(),children:[(0,Z.jsx)(Za,{"aria-hidden":`true`}),`Expand All`]}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Ly,{children:[r,(0,Z.jsxs)(zy,{align:`end`,children:[i,(0,Z.jsxs)(By,{onSelect:()=>t.current?.collapseAll(),children:[(0,Z.jsx)(sa,{"aria-hidden":`true`}),`Collapse All`]})]})]}),e[3]=a):a=e[3];let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`New file`,onClick:()=>t.current?.startCreating(`file`,``),children:(0,Z.jsx)(Ua,{"aria-hidden":`true`})})}),(0,Z.jsx)(Gr,{children:`New File`})]}),e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(zM,{className:`flex-row items-center justify-between`,children:[n,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a,o,(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`New folder`,onClick:()=>t.current?.startCreating(`folder`,``),children:(0,Z.jsx)(ca,{"aria-hidden":`true`})})}),(0,Z.jsx)(Gr,{children:`New Folder`})]})]})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(VM,{children:(0,Z.jsx)(SG,{ref:t})}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(FM,{variant:`inset`,children:[s,c,(0,Z.jsxs)(BM,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(HM,{children:(0,Z.jsx)(UM,{children:(0,Z.jsx)(PG,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(LG,{})]}),(0,Z.jsx)(LM,{})]}),e[7]=l):l=e[7],l}function BG(){let e=(0,$.c)(17),t=j(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=jn(),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 Fn,i=new Nn({url:n,name:he,document:e,onStateless:e=>{let{payload:t}=e;Ot(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:GG,onConfigValidationRejected:WG,onUnknown:UG})},onClose:HG,onDisconnect:VG}),a=Xe(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=bn(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Oe([`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 VG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function HG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function UG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function WG(e){_r(e)}function GG(e){Oe([e.ch])}function KG(){let e=(0,$.c)(7),{clearTarget:t}=jn(),{openTargetTransition:n}=Pn(),{folderPaths:r,loading:i,pages:a}=Be(),o,s;return e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==a?(o=()=>{e();function e(){let e=Ke(window.location.hash);if(!e){qn(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(i){qn(`ok/nav/hash-change`,{docName:e,kind:`deferred-loading`});return}let o=Pe(e,{pages:a,folderPaths:r});qn(`ok/nav/hash-change`,{docName:e,kind:o.kind}),n(o)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},s=[t,r,i,n,a],e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s):(o=e[5],s=e[6]),(0,Q.useEffect)(o,s),null}var qG=`#install-claude-desktop`;function JG(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===qG),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===qG&&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===qG){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)(hr,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function YG(){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)(XG,t),null}function XG(){let e=function(e){let t=e.target;Vd({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Bd))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function ZG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=jn(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Qe(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;zt({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)($t,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function QG(){let e=(0,$.c)(10),t=typeof window<`u`?window.okDesktop??null:null,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Yf,{}),e[0]=n):n=e[0];let r,i,a,o,s,c,l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(BG,{}),i=(0,Z.jsx)(KG,{}),a=(0,Z.jsx)(ZG,{}),o=(0,Z.jsx)(YG,{}),s=(0,Z.jsx)(JG,{}),c=(0,Z.jsx)($l,{}),l=t?(0,Z.jsx)(Wf,{bridge:t}):null,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=s,e[6]=c,e[7]=l):(r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7]);let u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(RG,{}),e[8]=u):u=e[8];let d;return e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vn,{name:`app`,children:(0,Z.jsx)(Ln,{children:(0,Z.jsxs)(XN,{children:[n,(0,Z.jsxs)(nt,{children:[r,i,a,o,s,c,l,(0,Z.jsxs)(MM,{className:`h-screen overflow-hidden`,children:[u,(0,Z.jsx)(RM,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(oP,{})})]})]})]})})}),e[9]=d):d=e[9],d}bi(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&cu({apiOrigin:window.okDesktop.config.apiOrigin}),typeof window<`u`&&fu({bridge:window.okDesktop}),Nu(),typeof window<`u`&&du({bridge:window.okDesktop}),typeof window<`u`&&Yr({bridge:window.okDesktop});var $G=new ki({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),eK=document.getElementById(`root`);if(!eK)throw Error(`Root element not found`);var tK=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Bi.createRoot)(eK).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(w,{client:$G,children:(0,Z.jsxs)(Ce,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Kr,{children:tK&&window.okDesktop?(0,Z.jsx)(ru,{bridge:window.okDesktop}):(0,Z.jsx)(QG,{})}),(0,Z.jsx)(su,{richColors:!0})]})})}));
1850
+ `;function yG(e){return{...HF({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 bG(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&fG.has(t)}function xG(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function SG(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=xG(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=yf(r.contentDir,VW(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)(en,{"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)(Yy,{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 CG(e){return e?.isDirectory()?e:null}function wG(e){let t=(0,$.c)(72),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,onStartCreating:c,onDelete:l,onExpandSubtree:u,onCollapseSubtree:d}=e,f;t[0]===n?f=t[1]:(f=BW(n),t[0]=n,t[1]=f);let p=f,m=n.kind===`directory`,h;t[2]!==m||t[3]!==n.path||t[4]!==a?(h=m?null:xf({docName:AW(n.path),workspace:a}),t[2]=m,t[3]=n.path,t[4]=a,t[5]=h):h=t[5];let g=h,_;t[6]===r?_=t[7]:(_=()=>r.close({restoreFocus:!1}),t[6]=r,t[7]=_);let v=_,y;t[8]===r?y=t[9]:(y=()=>r.close(),t[8]=r,t[9]=y);let b=y,x;t[10]===b?x=t[11]:(x=e=>{e||b()},t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(qy,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[12]=S):S=t[12];let C;t[13]!==i||t[14]!==b||t[15]!==v||t[16]!==m||t[17]!==n.path||t[18]!==d||t[19]!==u||t[20]!==c?(C=m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Yy,{disabled:i,onSelect:()=>{v(),c(`file`,MW(n.path))},children:[(0,Z.jsx)(Ua,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(Yy,{disabled:i,onSelect:()=>{v(),c(`folder`,MW(n.path))},children:[(0,Z.jsx)(ca,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)($y,{}),(0,Z.jsxs)(Yy,{onSelect:()=>{b(),u(n.path)},children:[(0,Z.jsx)(Za,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(Yy,{onSelect:()=>{b(),d(n.path)},children:[(0,Z.jsx)(sa,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)($y,{})]}):null,t[13]=i,t[14]=b,t[15]=v,t[16]=m,t[17]=n.path,t[18]=d,t[19]=u,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==v||t[23]!==n.path||t[24]!==s?(w=()=>{v(),s.startRenaming(n.path)},t[22]=v,t[23]=n.path,t[24]=s,t[25]=w):w=t[25];let T;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(sn,{"aria-hidden":`true`}),t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==w?(E=(0,Z.jsxs)(Yy,{disabled:i,onSelect:w,children:[T,`Rename`]}),t[27]=i,t[28]=w,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(tb,{children:[(0,Z.jsx)(dr,{"aria-hidden":`true`}),`Copy Path`]}),t[30]=D):D=t[30];let O=!a,k;t[31]!==b||t[32]!==n||t[33]!==a?(k=()=>{a&&(b(),dG(yf(a.contentDir,VW(n),a.pathSeparator),`full path`))},t[31]=b,t[32]=n,t[33]=a,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(Yy,{disabled:O,onSelect:k,children:`Full Path`}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==b||t[39]!==n?(j=(0,Z.jsx)(Yy,{onSelect:()=>{b(),dG(VW(n),`relative path`)},children:`Relative Path`}),t[38]=b,t[39]=n,t[40]=j):j=t[40];let M;t[41]!==A||t[42]!==j?(M=(0,Z.jsxs)(eb,{children:[D,(0,Z.jsxs)(nb,{children:[A,j]})]}),t[41]=A,t[42]=j,t[43]=M):M=t[43];let N;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)($y,{}),t[44]=N):N=t[44];let P;t[45]!==b||t[46]!==n||t[47]!==a?(P=(0,Z.jsx)(SG,{item:n,workspace:a,onClose:b}),t[45]=b,t[46]=n,t[47]=a,t[48]=P):P=t[48];let F;t[49]!==o||t[50]!==g||t[51]!==m?(F=!m&&(0,Z.jsx)(ZW,{input:g,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[49]=o,t[50]=g,t[51]=m,t[52]=F):F=t[52];let I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)($y,{}),t[53]=I):I=t[53];let L;t[54]!==b||t[55]!==l||t[56]!==p?(L=()=>{b(),l(p)},t[54]=b,t[55]=l,t[56]=p,t[57]=L):L=t[57];let R;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Pt,{"aria-hidden":`true`}),t[58]=R):R=t[58];let z;t[59]!==i||t[60]!==L?(z=(0,Z.jsxs)(Yy,{variant:`destructive`,disabled:i,onSelect:L,children:[R,`Delete`]}),t[59]=i,t[60]=L,t[61]=z):z=t[61];let B;t[62]!==E||t[63]!==M||t[64]!==P||t[65]!==F||t[66]!==z||t[67]!==C?(B=(0,Z.jsxs)(Jy,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[C,E,M,N,P,F,I,z]}),t[62]=E,t[63]=M,t[64]=P,t[65]=F,t[66]=z,t[67]=C,t[68]=B):B=t[68];let V;return t[69]!==B||t[70]!==x?(V=(0,Z.jsxs)(Ky,{open:!0,modal:!1,onOpenChange:x,children:[S,B]}),t[69]=B,t[70]=x,t[71]=V):V=t[71],V}function TG(e){let t=(0,$.c)(106),{ref:n}=e,{activeDocName:r,activeTarget:i,closeDocument:a,closeAndClearForRename:o,prewarm:s}=jn(),{notifySidebarFileSelected:c}=BM(),{resolvedTheme:l}=xe(),u;t[0]===c?u=t[1]:(u=function(e){uG(e),c()},t[0]=c,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[2]=f):f=t[2];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(!0),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(p),E=(0,Q.useRef)(r),D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[3]=D):D=t[3];let O=(0,Q.useRef)(D),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(!1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(PG),F=(0,Q.useRef)(NG),I=(0,Q.useRef)(MG),{selectedFilePath:L,selectedFolderPath:R,navigationPath:z}=JW(i,r),B=L?kW(L,p.find(e=>e.docName===L)?.docExt):R?NW(R):null,V=Vf().states,{dispatch:H}=Af(),U;t[4]!==H||t[5]!==V?(U={installStates:V,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:H},t[4]=H,t[5]=V,t[6]=U):U=t[6];let W=U,G;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[7]=G):G=t[7];let K;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(K={set:`complete`,spriteSheet:_G},t[8]=K):K=t[8];let ee;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(ee={paths:G,flattenEmptyDirectories:!1,initialExpansion:`closed`,search:!0,searchBlurBehavior:`retain`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:K,unsafeCSS:vG,composition:{contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},dragAndDrop:{canDrag:()=>N.current===null,canDrop:()=>N.current===null,onDropComplete:e=>I.current(e),onDropError:jG},renaming:{canRename:()=>N.current===null,onRename:e=>F.current(e),onError:Hr.error},onSelectionChange:e=>P.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=T.current.find(e=>kW(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:pG,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:bG(t.path)?{icon:mG,title:`Agent configuration file`}:null}},t[9]=ee):ee=t[9];let{model:q}=TW(ee),te,ne;t[10]===p?(te=t[11],ne=t[12]):(ne=FW(p),te=IW(ne),t[10]=p,t[11]=te,t[12]=ne);let re=te,ie=(0,Q.useRef)(ne),ae;t[13]===p?ae=t[14]:(ae=RW(p),t[13]=p,t[14]=ae);let oe=ae,se=(0,Q.useRef)(oe),ce=R?zW(NW(R)).slice(0,-1):zW(B??z),le=ce.join(`\0`),ue;t[15]===q?ue=t[16]:(ue=e=>{let t=FW(e??T.current);q.resetPaths(t,{initialExpandedPaths:O.current})},t[15]=q,t[16]=ue);let de=ue,fe;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>{A.current=LW(e)},t[17]=fe):fe=t[17];let pe=fe,me,he;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>{let e=!0,t=YW(async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(AG);if(!e)return;t.ok&&n?.ok?(m(n.documents),v(null)):v(n?.error??`Server error (HTTP ${t.status})`)}catch(t){let n=t;e&&v(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&g(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Xe(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},he=[],t[18]=me,t[19]=he):(me=t[18],he=t[19]),(0,Q.useEffect)(me,he);let ge,_e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json().catch(kG);e&&t.ok&&n?.ok&&typeof n.contentDir==`string`&&(n.pathSeparator===`/`||n.pathSeparator===`\\`)&&w({contentDir:n.contentDir,pathSeparator:n.pathSeparator})}).catch(OG),()=>{e=!1}},_e=[],t[20]=ge,t[21]=_e):(ge=t[20],_e=t[21]),(0,Q.useEffect)(ge,_e);let ve,ye;t[22]!==q||t[23]!==re?(ve=()=>{if(A.current===re){A.current=null;return}q.resetPaths(ie.current,{initialExpandedPaths:O.current})},ye=[q,re],t[22]=q,t[23]=re,t[24]=ve,t[25]=ye):(ve=t[24],ye=t[25]),(0,Q.useEffect)(ve,ye);let be,Se;t[26]!==le||t[27]!==B||t[28]!==q?(be=()=>{if(!B)return;let e=le?le.split(`\0`):[];for(let t of e){let e=CG(q.getItem(t));e&&!e.isExpanded()&&e.expand()}let t=q.getItem(B);t&&(M.current=!0,t.select(),t.focus(),queueMicrotask(()=>{M.current=!1}))},Se=[le,B,q],t[26]=le,t[27]=B,t[28]=q,t[29]=be,t[30]=Se):(be=t[29],Se=t[30]),(0,Q.useEffect)(be,Se);let Ce,we;t[31]===q?(Ce=t[32],we=t[33]):(Ce=()=>q.subscribe(()=>{if(!q.isSearchOpen())for(let e of O.current){let t=CG(q.getItem(e));t&&!t.isExpanded()&&t.expand()}}),we=[q],t[31]=q,t[32]=Ce,t[33]=we),(0,Q.useEffect)(Ce,we);let Te;t[34]===o?Te=t[35]:(Te=async e=>{let t=E.current,n=vM(t,e);await Promise.all(e.flatMap(e=>[o(e.fromDocName),o(e.toDocName)])),m(t=>{let n=gM(t,e);return pe(n),n}),Oe([`files`,`backlinks`,`graph`]),t&&n!==t&&(window.location.hash=`#/${n}`)},t[34]=o,t[35]=Te);let Ee=Te,De;t[36]!==Ee||t[37]!==de?(De=async function(e){let t=e.isFolder?`folder`:`file`,n=HW(e.sourcePath,e.isFolder),r=HW(e.destinationPath,e.isFolder),i=k.current;b(n),v(null);try{if(i?.renamePath===n){let e=WW(t,r),n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await n.json().catch(DG);if(!n.ok||!i?.ok){let e=i?.error??`Failed to create ${t}`;Hr.error(e),v(e),de(),k.current=null,b(null);return}let a=i.docName??e.replace(/\.md$/i,``);m(e=>{if(e.some(e=>e.docName===a))return e;let t=[...e,{docName:a,modified:new Date().toISOString(),size:0}];return pe(t),t}),uG(a),Oe([`files`,`backlinks`,`graph`]),k.current=null,b(null);return}let a=e.isFolder?{kind:`folder`,fromPath:MW(n),toPath:MW(r)}:{kind:`file`,fromPath:AW(n),toPath:AW(r)},o=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),s=await o.json();if(!o.ok||!s.ok){let e=s.error??`Failed to rename path`;Hr.error(e),v(e),de(),k.current=null,b(null);return}await Ee(Array.isArray(s.renamed)?s.renamed:[]),k.current=null,b(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),Hr.error(`Network error — please try again`),v(`Network error — please try again`),de(),k.current=null,b(null)}},t[36]=Ee,t[37]=de,t[38]=De):De=t[38];let ke=De,Ae;t[39]!==Ee||t[40]!==de?(Ae=async function(e){let t=e.draggedPaths.map(t=>{let n=GW(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(EG);if(t.length!==0){b(t[0]?.sourcePath??null),v(null);try{let e=[];for(let n of t){let t=n.sourcePath.endsWith(`/`)?{kind:`folder`,fromPath:MW(n.sourcePath),toPath:MW(n.destinationTreePath)}:{kind:`file`,fromPath:AW(n.sourcePath),toPath:AW(n.destinationTreePath)},r=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i=await r.json();if(!r.ok||!i.ok){let e=i.error??`Failed to move`;Hr.error(e),v(e),de(),b(null);return}e=e.concat(Array.isArray(i.renamed)?i.renamed:[])}await Ee(e),b(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Hr.error(`Network error — please try again`),de(),b(null)}}},t[39]=Ee,t[40]=de,t[41]=Ae):Ae=t[41];let je=Ae,Me;t[42]!==q||t[43]!==ne?(Me=function(e,t){try{let n=UW(e,t,[...ne,...se.current]);k.current={kind:e,renamePath:n.renamePath},q.add(n.addPath),q.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Hr.error(`Could not start creating a new item`)}},t[42]=q,t[43]=ne,t[44]=Me):Me=t[44];let Ne=Me,Pe;t[45]===q?Pe=t[46]:(Pe=function(e){let t=NW(e);(0,Q.startTransition)(()=>{for(let e of se.current)if(e===t||e.startsWith(t)){let t=CG(q.getItem(e));t&&t.expand()}})},t[45]=q,t[46]=Pe);let Fe=Pe,Ie;t[47]===q?Ie=t[48]:(Ie=function(e){let t=NW(e),n=new Set(O.current);(0,Q.startTransition)(()=>{for(let e of[...se.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=CG(q.getItem(e));t&&t.collapse()}})},t[47]=q,t[48]=Ie);let Le=Ie,Re;t[49]!==ce||t[50]!==r||t[51]!==y||t[52]!==p||t[53]!==oe||t[54]!==je||t[55]!==ke||t[56]!==d||t[57]!==ne?(Re=()=>{T.current=p,E.current=r,N.current=y,ie.current=ne,se.current=oe,O.current=ce,P.current=e=>{if(M.current)return;let t=e[0];if(!t)return;let n=PW(t);if(!t.endsWith(`/`)&&!T.current.some(e=>e.docName===n)){console.debug(`[FileTree] Dropped selection for unknown docName:`,n);return}d(n)},F.current=ke,I.current=je},t[49]=ce,t[50]=r,t[51]=y,t[52]=p,t[53]=oe,t[54]=je,t[55]=ke,t[56]=d,t[57]=ne,t[58]=Re):Re=t[58],(0,Q.useLayoutEffect)(Re);let ze;t[59]!==q||t[60]!==Ne?(ze=()=>({startCreating:Ne,expandAll(){(0,Q.startTransition)(()=>{for(let e of se.current){let t=CG(q.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(O.current);(0,Q.startTransition)(()=>{for(let t of[...se.current].reverse()){if(e.has(t))continue;let n=CG(q.getItem(t));n&&n.collapse()}})}}),t[59]=q,t[60]=Ne,t[61]=ze):ze=t[61],(0,Q.useImperativeHandle)(n,ze);let Be;t[62]!==a||t[63]!==q||t[64]!==de?(Be=async function(e){b(e.path),S(null);try{let t=e.kind===`folder`?NW(e.path):kW(e.path,e.docExt),n=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r=await n.json();if(!n.ok||!r.ok){Hr.error(r.error??`Failed to delete path`),b(null);return}let i=Array.isArray(r.deletedDocNames)?r.deletedDocNames:[],o=new Set(i);for(let e of o)a(e);q.getItem(t)&&q.remove(t,e.kind===`folder`?{recursive:!0}:void 0),m(e=>{let t=_M(e,i);return pe(t),t}),Oe([`files`,`backlinks`,`graph`]);let s=E.current;s&&o.has(s)&&(window.location.hash=``),b(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),Hr.error(`Network error — please try again`),b(null),de()}},t[62]=a,t[63]=q,t[64]=de,t[65]=Be):Be=t[65];let Ve=Be,He;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(He=function(){let e=j.current;e&&lG(e),j.current=null},t[66]=He):He=t[66];let Ue=He,We;t[67]===s?We=t[68]:(We=function(e){let t=FG(e.nativeEvent);if(!t||t.endsWith(`/`)){Ue();return}let n=AW(t);j.current!==n&&(Ue(),j.current=n,cG(n,e=>{s(e)}))},t[67]=s,t[68]=We);let Ge=We;if(h){let e;return t[69]===Symbol.for(`react.memo_cache_sentinel`)?(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/30 text-sm`,children:`Loading...`})}),t[69]=e):e=t[69],e}if(p.length===0){if(_){let e;return t[70]===_?e=t[71]:(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:_})}),t[70]=_,t[71]=e),e}let e;t[72]===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[72]=e):e=t[72];let n;return t[73]===Ne?n=t[74]:(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:()=>Ne(`file`,``),children:`Create your first file`})]}),t[73]=Ne,t[74]=n),n}let Ke=y!==null,qe;t[75]===_?qe=t[76]:(qe=_&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:_}),t[75]=_,t[76]=qe);let Je;t[77]===l?Je=t[78]:(Je=yG(l),t[77]=l,t[78]=Je);let Ye;t[79]!==Ke||t[80]!==Le||t[81]!==Fe||t[82]!==W||t[83]!==q||t[84]!==Ne||t[85]!==C?(Ye=(e,t)=>(0,Z.jsx)(wG,{item:e,context:t,anyActionBusy:Ke,workspace:C,handoff:W,model:q,onStartCreating:Ne,onDelete:S,onExpandSubtree:Fe,onCollapseSubtree:Le}),t[79]=Ke,t[80]=Le,t[81]=Fe,t[82]=W,t[83]=q,t[84]=Ne,t[85]=C,t[86]=Ye):Ye=t[86];let Ze;t[87]!==Ge||t[88]!==q||t[89]!==qe||t[90]!==Je||t[91]!==Ye?(Ze=(0,Z.jsx)(wW,{header:qe,model:q,style:Je,onMouseMove:Ge,onMouseLeave:Ue,renderContextMenu:Ye}),t[87]=Ge,t[88]=q,t[89]=qe,t[90]=Je,t[91]=Ye,t[92]=Ze):Ze=t[92];let Qe=!!x,$e;t[93]===y?$e=t[94]:($e=e=>{!e&&!y&&S(null)},t[93]=y,t[94]=$e);let et;t[95]!==y||t[96]!==x||t[97]!==Ve?(et=x&&(0,Z.jsx)(EW,{itemName:`${x.name}${x.kind===`file`?x.docExt??`.md`:`/`}`,isSubmitting:y===x.path,onDelete:()=>Ve(x),customDescription:x.kind===`folder`?`Are you sure you want to delete ${x.name}/ and all files inside? This action cannot be undone.`:void 0}),t[95]=y,t[96]=x,t[97]=Ve,t[98]=et):et=t[98];let tt;t[99]!==Qe||t[100]!==$e||t[101]!==et?(tt=(0,Z.jsx)(zr,{open:Qe,onOpenChange:$e,children:et}),t[99]=Qe,t[100]=$e,t[101]=et,t[102]=tt):tt=t[102];let nt;return t[103]!==Ze||t[104]!==tt?(nt=(0,Z.jsxs)(Z.Fragment,{children:[Ze,tt]}),t[103]=Ze,t[104]=tt,t[105]=nt):nt=t[105],nt}function EG(e){return!!e}function DG(){return null}function OG(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function kG(){return null}function AG(){return null}function jG(e){Hr.error(e)}function MG(){}function NG(){}function PG(){}function FG(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t.dataset.itemPath;return null}var IG=(e,t,n)=>no(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 IG(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),IG(()=>n.project.open({path:e,target:`new-window`}),`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),IG(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})},`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),IG(()=>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=Ky,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)(Gi,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(qy,{asChild:!0,children:(0,Z.jsxs)(eN,{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),_=Jy,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Qy,{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)(Qy,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(Yy,{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)($y,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(Yy,{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)(Yy,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:Rd}),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 RG(e){let t=(0,$.c)(13),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a=`update-notice-${n.id}`,o=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,s;t[0]===n.body?s=t[1]:(s=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[0]=n.body,t[1]=s);let c;t[2]===n.action?c=t[3]:(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[2]=n.action,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Cr,{"aria-hidden":`true`,className:`size-3`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(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:l}),t[5]=r,t[6]=u);let d;return t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u?(d=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":a,className:o,children:[s,c,u]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function zG(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 BG(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Mu,ju,ju),n;e[0]===t?n=e[1]:(n=zG(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Au(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)(RG,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function VG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Vn,{name:`file-sidebar`,children:(0,Z.jsx)(HG,{})}),e[0]=t):t=e[0],t}function HG(){let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`span`,{className:`font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(qy,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Tree view options`,children:(0,Z.jsx)(xa,{"aria-hidden":`true`})})})}),(0,Z.jsx)(Gr,{children:`Tree view options`})]}),e[1]=r):r=e[1];let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(Yy,{onSelect:()=>t.current?.expandAll(),children:[(0,Z.jsx)(Za,{"aria-hidden":`true`}),`Expand All`]}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Ky,{children:[r,(0,Z.jsxs)(Jy,{align:`end`,children:[i,(0,Z.jsxs)(Yy,{onSelect:()=>t.current?.collapseAll(),children:[(0,Z.jsx)(sa,{"aria-hidden":`true`}),`Collapse All`]})]})]}),e[3]=a):a=e[3];let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`New file`,onClick:()=>t.current?.startCreating(`file`,``),children:(0,Z.jsx)(Ua,{"aria-hidden":`true`})})}),(0,Z.jsx)(Gr,{children:`New File`})]}),e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(JM,{className:`flex-row items-center justify-between`,children:[n,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a,o,(0,Z.jsxs)(qr,{children:[(0,Z.jsx)(Wr,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`New folder`,onClick:()=>t.current?.startCreating(`folder`,``),children:(0,Z.jsx)(ca,{"aria-hidden":`true`})})}),(0,Z.jsx)(Gr,{children:`New Folder`})]})]})]}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(XM,{children:(0,Z.jsx)(TG,{ref:t})}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(WM,{variant:`inset`,children:[s,c,(0,Z.jsxs)(YM,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(ZM,{children:(0,Z.jsx)(QM,{children:(0,Z.jsx)(LG,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(BG,{})]}),(0,Z.jsx)(KM,{})]}),e[7]=l):l=e[7],l}function UG(){let e=(0,$.c)(17),t=j(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=jn(),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 Fn,i=new Nn({url:n,name:he,document:e,onStateless:e=>{let{payload:t}=e;Ot(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:JG,onConfigValidationRejected:qG,onUnknown:KG})},onClose:GG,onDisconnect:WG}),a=Xe(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=bn(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Oe([`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 WG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function GG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function KG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function qG(e){_r(e)}function JG(e){Oe([e.ch])}function YG(){let e=(0,$.c)(7),{clearTarget:t}=jn(),{openTargetTransition:n}=Pn(),{folderPaths:r,loading:i,pages:a}=Be(),o,s;return e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==a?(o=()=>{e();function e(){let e=Ke(window.location.hash);if(!e){qn(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(i){qn(`ok/nav/hash-change`,{docName:e,kind:`deferred-loading`});return}let o=Pe(e,{pages:a,folderPaths:r});qn(`ok/nav/hash-change`,{docName:e,kind:o.kind}),n(o)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},s=[t,r,i,n,a],e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s):(o=e[5],s=e[6]),(0,Q.useEffect)(o,s),null}var XG=`#install-claude-desktop`;function ZG(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===XG),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===XG&&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===XG){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)(hr,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function QG(){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)($G,t),null}function $G(){let e=function(e){let t=e.target;Vd({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Bd))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function eK(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=jn(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Qe(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;zt({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)($t,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function tK(){let e=(0,$.c)(10),t=typeof window<`u`?window.okDesktop??null:null,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Yf,{}),e[0]=n):n=e[0];let r,i,a,o,s,c,l;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(UG,{}),i=(0,Z.jsx)(YG,{}),a=(0,Z.jsx)(eK,{}),o=(0,Z.jsx)(QG,{}),s=(0,Z.jsx)(ZG,{}),c=(0,Z.jsx)($l,{}),l=t?(0,Z.jsx)(Wf,{bridge:t}):null,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=s,e[6]=c,e[7]=l):(r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7]);let u;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(VG,{}),e[8]=u):u=e[8];let d;return e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Vn,{name:`app`,children:(0,Z.jsx)(Ln,{children:(0,Z.jsxs)(up,{children:[n,(0,Z.jsxs)(nt,{children:[r,i,a,o,s,c,l,(0,Z.jsxs)(VM,{className:`h-screen overflow-hidden`,children:[u,(0,Z.jsx)(qM,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(lP,{})})]})]})]})})}),e[9]=d):d=e[9],d}bi(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&cu({apiOrigin:window.okDesktop.config.apiOrigin}),typeof window<`u`&&fu({bridge:window.okDesktop}),Nu(),typeof window<`u`&&du({bridge:window.okDesktop}),typeof window<`u`&&Yr({bridge:window.okDesktop});var nK=new ki({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),rK=document.getElementById(`root`);if(!rK)throw Error(`Root element not found`);var iK=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Bi.createRoot)(rK).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(w,{client:nK,children:(0,Z.jsxs)(Ce,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Kr,{children:iK&&window.okDesktop?(0,Z.jsx)(ru,{bridge:window.okDesktop}):(0,Z.jsx)(tK,{})}),(0,Z.jsx)(su,{richColors:!0})]})})}));