@fungi.computer/inkcap 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{FileTab-fuWnqfb6.js → FileTab-X5waGVw9.js} +1 -1
- package/dist/assets/{InkcapFileTree-D95QfJxq.js → InkcapFileTree-CKC4p1cH.js} +1 -1
- package/dist/assets/dialog-Dz1fFD5Q.js +83 -0
- package/dist/assets/index-DLyrpXh7.js +1267 -0
- package/dist/assets/{index-CNWdjcVa.css → index-uzDGTzDc.css} +1 -1
- package/dist/assets/useForm-BWVwM5sy.js +1 -0
- package/dist/index.html +3 -3
- package/package.json +7 -7
- package/dist/assets/dialog-jssrzu-h.js +0 -83
- package/dist/assets/index-BK8Pcaxs.js +0 -1267
- package/dist/assets/useForm-JWOEk10W.js +0 -1
|
@@ -0,0 +1,1267 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FileTab-X5waGVw9.js","./rolldown-runtime-hePW80VL.js","./dialog-Dz1fFD5Q.js","./useForm-BWVwM5sy.js","./InkcapFileTree-CKC4p1cH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$i as n,$r as r,$t as i,Bn as a,Br as o,Cr as s,Fi as c,Gi as l,Gr as u,Hn as d,Hr as f,Ii as p,In as m,Ir as h,Ji as g,Ki as _,Kr as v,Ln as y,Lr as b,Nn as x,Qi as S,Qr as C,Rn as ee,Rr as te,Sr as ne,Ui as w,Ur as T,Vn as E,Wi as re,Wr as D,Xi as O,Xr as k,Yi as ie,Yr as A,Zi as ae,_i as oe,_r as se,a as ce,ai as le,ar as ue,bi as de,br as fe,c as pe,ci as me,cr as j,di as he,dr as ge,ei as _e,en as ve,fi as ye,fr as M,gi as be,gr as xe,hi as N,hr as P,i as Se,ii as Ce,ir as we,jn as Te,li as Ee,lr as F,mi as De,mr as I,n as Oe,o as ke,oi as Ae,or as je,pi as Me,pr as L,qi as Ne,qr as Pe,r as Fe,ri as R,rr as Ie,s as Le,si as Re,sr as ze,t as Be,ti as Ve,tn as He,tr as Ue,ui as We,ur as Ge,vi as Ke,vr as z,xr as qe,yi as Je,yr as B,zn as Ye,zr as Xe}from"./dialog-Dz1fFD5Q.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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ze=new WeakMap,Qe=`~effect/Redacted`,$e=e=>g(e,Qe),et=(e,t)=>{let n=Object.create(tt);return t?.label&&(n.label=t.label),Ze.set(n,e),n},tt={[Qe]:{_A:e=>e},label:void 0,...w,toJSON(){return this.toString()},toString(){return`<redacted${ae(this.label)?`:`+this.label:``}>`},[Ne](){return _(Ze.get(this))},[l](e){return $e(e)&&re(Ze.get(this),Ze.get(e))}},V=e(te(),1),H=b(),U=V.createContext(void 0),W=e=>{let t=V.useContext(U);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},nt=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(U.Provider,{value:e,children:t})),rt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},it=new class{#e=rt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function at(e){setTimeout(e,0)}var ot=typeof window>`u`||`Deno`in globalThis;function st(){}function ct(e,t){return typeof e==`function`?e(t):e}function lt(e){return typeof e==`number`&&e>=0&&e!==1/0}function ut(e,t){return Math.max(e+(t||0)-Date.now(),0)}function G(e,t){return typeof e==`function`?e(t):e}function dt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pt(o,t.options))return!1}else if(!ht(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ft(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(mt(t.options.mutationKey)!==mt(a))return!1}else if(!ht(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pt(e,t){return(t?.queryKeyHashFn||mt)(e)}function mt(e){return JSON.stringify(e,(e,t)=>bt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ht(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!ht(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ht(e[r],t[r]))return!1;return!0}return!1}var gt=Object.prototype.hasOwnProperty;function _t(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=yt(e)&&yt(t);if(!r&&!(bt(e)&&bt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:gt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=_t(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function vt(e,t){if(!t||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 yt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bt(e){if(!xt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!xt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function xt(e){return Object.prototype.toString.call(e)===`[object Object]`}function St(e){return new Promise(t=>{it.setTimeout(t,e)})}function Ct(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:_t(e,t)}function wt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Tt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Et=Symbol();function Dt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Et?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ot(e,t){return typeof e==`function`?e(...t):!!e}function kt(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var At=()=>ot,jt=()=>At(),Mt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Nt=new class extends Mt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Pt=at;function Ft(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Pt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var It=Ft(),Lt=new class extends Mt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Rt(e){return Math.min(1e3*2**e,3e4)}function zt(e){return(e??`online`)!==`online`||Lt.isOnline()}var Bt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Vt(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(st);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Bt(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Nt.isFocused()&&(e.networkMode===`always`||Lt.isOnline())&&e.canRun(),p=()=>zt(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(jt()?0:3),a=e.retryDelay??Rt,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),St(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ht=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lt(this.gcTime)&&(this.#e=it.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(jt()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(it.clearTimeout(this.#e),this.#e=void 0)}};function Ut(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=>{kt(e,()=>t.signal,()=>n=!0)},u=Dt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Tt:wt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Gt:Wt,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:Wt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Wt(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 Gt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Kt=class extends Ht{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Yt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Yt(this.options);e.data!==void 0&&(this.setState(Jt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ct(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(st).catch(st):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>G(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Et||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>G(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ut(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Dt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ut(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Vt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Bt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Bt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...qt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Jt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),It.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function qt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Jt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Yt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Xt=class extends Mt{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Qt(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $t(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $t(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof G(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!vt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&en(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||G(this.options.enabled,this.#t)!==G(t.enabled,this.#t)||G(this.options.staleTime,this.#t)!==G(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||G(this.options.enabled,this.#t)!==G(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return vt(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(st)),t}#h(e){return!jt()&&G(this.options.enabled,this.#t)!==!1&<(e)}#g(){this.#b();let e=G(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ut(this.#r.dataUpdatedAt,e)+1;this.#u=it.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=it.setInterval(()=>{(this.options.refetchIntervalInBackground||Nt.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(it.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(it.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Qt(e,t),o=i&&en(e,n,t,r);(a||o)&&(l={...l,...qt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Ct(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Ct(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:tn(e,t),refetch:this.refetch,isEnabled:G(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),vt(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();It.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Zt(e,t){return G(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||G(t.retryOnMount,e)!==!1)}function Qt(e,t){return Zt(e,t)||e.state.data!==void 0&&$t(e,t,t.refetchOnMount)}function $t(e,t,n){if(G(t.enabled,e)!==!1&&G(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&tn(e,t)}return!1}function en(e,t,n,r){return(e!==t||G(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&tn(e,n)}function tn(e,t){return G(t.enabled,e)!==!1&&e.isStaleByTime(G(t.staleTime,e))}var nn=class extends Ht{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||rn(),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.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Vt({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)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),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:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}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.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=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=t(this.state),It.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function rn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var an=class extends Mt{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new nn({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=on(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=on(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=on(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=on(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){It.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=>ft(t,e))}findAll(e={}){return this.getAll().filter(t=>ft(e,t))}notify(e){It.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return It.batch(()=>Promise.all(e.map(e=>e.continue().catch(st))))}};function on(e){return e.options.scope?.id}var sn=class extends Mt{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??pt(r,t),a=this.get(i);return a||(a=new Kt({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(){It.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=>dt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>dt(e,t)):t}notify(e){It.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){It.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){It.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},cn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new sn,this.#t=e.mutationCache||new an,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Nt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Lt.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(G(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=ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return It.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;It.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return It.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=It.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(st).catch(st)}invalidateQueries(e,t={}){return It.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=It.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(st)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(st)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(G(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(G(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(st).catch(st)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(st).catch(st)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Lt.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(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ht(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ht(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||=pt(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===Et&&(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()}},ln=V.createContext(!1),un=()=>V.useContext(ln);ln.Provider;function dn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fn=V.createContext(dn()),pn=()=>V.useContext(fn),mn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ot(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},hn=e=>{V.useEffect(()=>{e.clearReset()},[e])},gn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ot(n,[e.error,r])),_n=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},vn=(e,t)=>e?.suspense&&t.isPending,yn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function bn(e,t,n){let r=un(),i=pn(),a=W(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,_n(o),mn(o,i,s),hn(i);let[l]=V.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(V.useSyncExternalStore(V.useCallback(e=>{let t=d?l.subscribe(It.batchCalls(e)):st;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),V.useEffect(()=>{l.setOptions(o)},[o,l]),vn(o,u))throw yn(o,l,i);if(gn({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function xn(e,t){return bn(e,Xt,t)}function Sn(e){return e}var Cn=ge(),wn=M(()=>Ge(`status`,[P({status:L(`available`)}).strict(),P({status:L(`unavailable`),reason:B()}).strict()])),Tn=Cn,En=M(()=>se(B(),Tn)),Dn=e=>Tn.parse(e),On=M(()=>P({code:B().min(1).max(160),message:B().min(1).max(512),details:Tn.optional()}).strict()),kn=e=>On.parse(e),An=En,jn=M(()=>B().refine(e=>e.trim().length>0)),Mn=wn,Nn=M(()=>fe([P({type:L(`action`)}).strict(),P({type:L(`custom`),data:En}).strict(),P({type:L(`choice`),options:ze(P({value:Tn,label:jn,description:jn.optional()}))}).strict(),P({type:L(`form`),submitLabel:jn.optional()}).strict(),P({type:L(`confirmation`),message:jn,confirmLabel:jn.optional(),cancelLabel:jn.optional()}).strict()])),Pn=M(()=>P({inputSchema:An.optional(),outputSchema:An.optional(),presentation:Nn.optional()}).strict()),Fn=M(()=>I().int().refine(e=>Number.isSafeInteger(e))),In=M(()=>P({hint:jn.pipe(B().max(120)),words:ze(P({word:B().regex(/^\S{1,64}$/u),description:jn.pipe(B().max(512)).optional(),arguments:En}).strict()).max(32).optional(),text:P({field:jn.pipe(B().max(120)),arguments:En,requestIdField:jn.pipe(B().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Ln=M(()=>P({order:Fn.optional()}).strict()),Rn=M(()=>P({bindings:P({order:Fn.optional(),values:ze(jn).max(16)}).strict().optional(),agent:P({keybind:jn.optional(),order:Fn.optional()}).strict().optional(),help:Ln.optional(),menu:Ln.optional(),palette:Ln.optional(),slash:P({aliases:ze(jn).max(16),consumesDraft:j().optional(),order:Fn.optional(),arguments:In.optional()}).strict().optional()}).strict()),zn=M(()=>P({id:jn.refine(e=>!e.includes(`:`)),title:jn,category:jn,description:jn.optional(),projections:Rn.optional(),action:Pn.optional(),availability:Mn.optional()}).strict()),Bn=e=>zn.parse(e),Vn=M(()=>P({inputSchema:An.optional(),outputSchema:An.optional()}).strict()),Hn=B().min(1).brand(),Un=M(()=>P({commandId:Hn,command:P({namespace:B(),id:B()}).strict(),sourceId:B(),scope:B().optional(),title:B(),category:B(),description:B().optional(),order:I(),availability:wn,action:Vn.optional(),keybind:B().optional()}).strict());ze(Un);var Wn=8192,Gn=jn.pipe(B().max(Wn)),Kn=jn.pipe(B().max(60)),qn=ne({protocol:/^https?$/u}),Jn=P({label:Gn,value:Gn}).strict(),Yn={summary:Gn.optional(),facts:ze(Jn).max(4).optional(),body:Gn.optional(),bodyLabel:Gn.optional(),details:ze(Jn).max(24).optional()};Ge(`type`,[P({type:L(`choice`),message:Kn,...Yn,current:Gn.optional(),collapsedGroup:Gn.optional(),options:ze(P({value:Gn,label:Gn,description:Gn.optional(),group:Gn.optional(),destructive:L(!0).optional()}).strict()).min(1).max(256)}).strict(),P({type:L(`text`),message:Kn,...Yn,placeholder:Gn.optional(),secret:j().optional()}).strict(),P({type:L(`confirmation`),message:Kn,...Yn,confirmLabel:Gn.optional(),cancelLabel:Gn.optional(),destructive:L(!0).optional()}).strict(),P({type:L(`decision`),message:Kn,...Yn,options:ze(P({value:Gn,label:Gn,description:Gn.optional(),destructive:L(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(e=>e.value)).size===e.length,`Decision option values must be unique`),multiple:j().optional(),other:P({label:Gn,placeholder:Gn.optional(),maxLength:I().int().min(1).max(Wn),blank:Gn.optional()}).strict().optional(),escape:Gn.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(e=>e.value===t)),`A decision's escape and blank answers must be offered options`)]),M(()=>Ge(`type`,[P({type:L(`info`),message:Gn,links:ze(P({url:qn,label:Gn.optional()}).strict()).max(16).optional()}).strict(),P({type:L(`progress`),message:Gn}).strict(),P({type:L(`handoff`),url:qn,code:Gn.optional(),message:Gn.optional()}).strict(),P({type:L(`success`),message:Gn}).strict()]));var Xn=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},Zn=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Qn(){let e=!1,t=jr,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=jr,s(),o.clear())},contribute:t=>{if(sr(t),e)throw new Zn;cr(t,n),lr(t,n);let r=Symbol(`whistle-contribution`);or(t)||(n=[...n,{contribution:ur(t),generation:r}],i=!0,s());let a=!0;return kr(o=>{if(!a||e)return;let c={...t,commands:o};sr(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);cr(c,u),lr(c,u);let d=ur(c);if(or(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=ar(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=Nr(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&$n.has(r.origin)&&(o=n({commandId:ir(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=Fr(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return jr;let a=n.flatMap(e=>e.contribution.commands.map(Nr));return(i||a.some((e,t)=>!Pr(e,r[t])))&&(t=Ir(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var $n=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),er=16,tr=32,nr=64,rr=256;function ir(e,t){return Hn.parse(`${e}:${t}`)}function ar(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function or(e){return e.commands.length===0}function sr(e){Dr(e.sourceId,`source ID`),Dr(e.namespace,`namespace`),e.scope!==void 0&&Dr(e.scope,`scope`);for(let t of e.commands)Sr(t)}function cr(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Ar(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(ir(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=ir(e.namespace,t.id);n.has(i)&&Ar(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Ar(`Slash alias is already registered`),r.add(e)}}function lr(e,t){t.length>=nr&&Ar(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>rr&&Ar(`Live command capacity exceeded`)}function ur(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(dr)};return e.scope===void 0?t:{...t,scope:e.scope}}function dr(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=fr(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=gr(e.projections)),t}function fr(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=pr(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=pr(e.outputSchema)),e.presentation!==void 0&&(t.presentation=hr(e.presentation)),Object.freeze(t)}function pr(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,mr(t)])))}function mr(e){return Array.isArray(e)?Object.freeze(e.map(mr)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,mr(t)]))):e}function hr(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:pr(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:mr(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function gr(e){let t={};return e.bindings!==void 0&&(t.bindings=_r(e.bindings)),e.agent!==void 0&&(t.agent=vr(e.agent)),e.help!==void 0&&(t.help=yr(e.help.order)),e.menu!==void 0&&(t.menu=yr(e.menu.order)),e.palette!==void 0&&(t.palette=yr(e.palette.order)),e.slash!==void 0&&(t.slash=br(e.slash)),t}function _r(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function vr(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function yr(e){let t={};return e!==void 0&&(t.order=e),t}function br(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=xr(e.arguments)),t}function xr(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:pr(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:pr(e.text.arguments)})),Object.freeze(t)}function Sr(e){Dr(e.id,`command ID`,!0),Dr(e.title,`title`),Dr(e.category,`category`),Cr(e.action),wr(e.projections)}function Cr(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)Dr(t.label,`choice label`),t.description!==void 0&&Dr(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&Dr(e.presentation.submitLabel,`submit label`);return;case`confirmation`:Dr(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&Dr(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&Dr(e.presentation.cancelLabel,`cancellation label`)}}function wr(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Or(t.order);if(e.bindings!==void 0&&Er(e.bindings.values,`binding`),e.slash!==void 0){Er(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Ar(`slash alias must not contain whitespace`);Tr(e.slash.arguments)}e.agent?.keybind!==void 0&&Dr(e.agent.keybind,`agent keybind`)}}function Tr(e){if(e===void 0)return;Dr(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Ar(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])Dr(n.word,`argument word`),/\s/u.test(n.word)&&Ar(`argument word must not contain whitespace`),t.has(n.word)&&Ar(`argument word is repeated`),t.add(n.word),n.description!==void 0&&Dr(n.description,`argument word description`);t.size>tr&&Ar(`argument word count exceeds 32`),e.text!==void 0&&(Dr(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&Dr(e.text.requestIdField,`request id field`))}function Er(e,t){e.length>er&&Ar(`${t} count exceeds 16`);for(let n of e)Dr(n,t)}function Dr(e,t,n=!1){e.trim().length===0&&Ar(`${t} must not be blank`),n&&e.includes(`:`)&&Ar(`${t} must not contain a colon`)}function Or(e){e!==void 0&&!Number.isSafeInteger(e)&&Ar(`order must be a safe integer`)}function kr(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Ar(e){throw Error(e)}var jr=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Mr=Object.freeze({status:`available`});function Nr(e){let t=e.availability?.()??Mr;return t.status===`available`?Mr:Object.freeze({status:`unavailable`,reason:t.reason})}function Pr(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function Fr(e){if(e instanceof Xn){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:mr(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Ir(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??Mr;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...Ur(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...Ur(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...Ur(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...Ur(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...Ur(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Gr(e,l,u.agent,d))}}return Br(n),Vr(i),zr(r),zr(a),zr(o),zr(s),Object.freeze({bindings:Hr(n),palette:Hr(r),slash:Hr(i),help:Hr(a),menu:Hr(o),agent:Hr(s)})}var Lr=new TextEncoder;function Rr(e,t){let n=Lr.encode(e),r=Lr.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function zr(e){e.sort((e,t)=>e.order-t.order||Rr(e.commandId,t.commandId))}function Br(e){e.sort((e,t)=>e.order-t.order||Rr(e.commandId,t.commandId)||Rr(e.binding,t.binding))}function Vr(e){e.sort((e,t)=>e.order-t.order||Rr(e.commandId,t.commandId)||Rr(e.alias,t.alias))}function Hr(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function Ur(e,t,n,r){let i=Wr(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Wr(e,t,n,r){let i={commandId:ir(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Gr(e,t,n,r){let i=Ur(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Kr(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Kr(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function qr(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:Dn(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}Ie(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Jr=`data-theme`;function Yr(e){return e||(globalThis.document?.documentElement??null)}function Xr(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function Zr(e,t){let n=Xr(e),r=Yr(t);r&&r.setAttribute(Jr,n)}function Qr(e){return Yr(e)?.getAttribute(Jr)??null}function $r(e,t){let n=Yr(t),r=globalThis,i=(n?.ownerDocument??null)?.defaultView?.MutationObserver??r.MutationObserver;if(!n||!i)return()=>void 0;let a=new i(t=>{if(!t.some(e=>e.type===`attributes`&&e.attributeName===Jr))return;let r=n.getAttribute(Jr);r&&e(r)});a.observe(n,{attributes:!0,attributeFilter:[Jr]});let o=!1;return()=>{o||(o=!0,a.disconnect())}}var ei=t((e=>{var t=a();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function ti(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),et(t))}var ni=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var ri=globalThis[ni],ii=ri?ri.RpcTarget:class{},ai=async function(){}.constructor,oi=typeof Buffer<`u`?Buffer.prototype:void 0;function si(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case ai.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case oi:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case yi.prototype:return`stub`;case bi.prototype:return`rpc-promise`;default:if(ri){if(t==ri.RpcStub.prototype||e instanceof ri.ServiceStub)return`rpc-target`;if(t==ri.RpcPromise.prototype||t==ri.RpcProperty.prototype)return`rpc-thenable`}return e instanceof ii?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function ci(){throw Error(`RPC map() implementation was not loaded.`)}var li={applyMap:ci,sendMap:ci};function ui(){throw Error(`Stream implementation was not loaded.`)}var di={createWritableStreamHook:ui,createWritableStreamFromHook:ui,createReadableStreamHook:ui},fi=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},pi=class extends fi{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},mi=new pi(Error(`Attempted to use RPC stub after it has been disposed.`)),hi=(e,t,n)=>e.call(t,n);function gi(e,t){let n=hi;hi=e;try{return t()}finally{hi=n}}var _i=Symbol(`realStub`),vi={apply(e,t,n){let r=e.raw;return new bi(hi(r.hook,r.pathIfPromise||[],Di.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===_i)return r;if(t in bi.prototype)return r[t];if(typeof t==`string`)return new bi(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=mi}},has(e,t){let n=e.raw;return t===_i?!0:t in bi.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},yi=class e extends ii{constructor(e,t){if(super(),!(e instanceof fi)){let n=e;if(e=n instanceof ii||n instanceof Function?Mi.create(n,void 0):new Ai(Di.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,vi)}hook;pathIfPromise;dup(){let t=this[_i];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[_i].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[_i];return li.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},bi=class extends yi{constructor(e,t){if(e instanceof fi)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=si(e);if(n===`rpc-promise`){let t=Ti(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=mi,super(e,[])}}else if(n===`rpc-thenable`)super(Mi.create(e,void 0),[]);else{let t=new Ni(Promise.resolve(e).then(e=>new Ai(Di.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return Ei(this).then(...arguments)}catch(e){return Ei(this).catch(...arguments)}finally(e){return Ei(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function xi(e){let{hook:t,pathIfPromise:n}=e[_i];return n&&n.length>0?t.get(n):t}function Si(e){let{hook:t,pathIfPromise:n}=e[_i];return n?t.get(n):t.dup()}function Ci(e){let{hook:t,pathIfPromise:n}=e[_i];if(!(n&&n.length>0))return t}function wi(e){return e[_i].hook}function Ti(e){return e[_i]}async function Ei(e){let{hook:t,pathIfPromise:n}=e[_i];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var Di=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return Mi.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=Mi.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return di.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=di.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return di.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=di.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(si(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?Si(t):xi(t),t instanceof bi){let e=new bi(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new yi(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):Mi.create(n,t),this.hooks.push(r),new yi(r)}case`rpc-thenable`:{let o=e,s;return s=a?new bi(a.getHookForRpcTarget(o,t,i),[]):new bi(Mi.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):di.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):di.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof bi)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=Ci(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof bi?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(si(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=Ci(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):ji(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=di.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=di.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>wi(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(si(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:wi(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function Oi(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(si(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=Ti(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof bi){let{hook:t,pathIfPromise:n}=Ti(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var ki=class extends fi{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=Oi(t,void 0,e,r)}catch(e){return t.dispose(),new pi(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new Ni(t.deliverCall(n.value,n.parent).then(e=>new Ai(e))):(t.dispose(),new pi(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=Oi(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):li.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new pi(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=Oi(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new Ai(Di.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new pi(e)}}},Ai=class e extends ki{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(Di.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof yi&&this.payload.value.onRpcBroken(e)}};function ji(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var Mi=class e extends ki{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>Di.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&ji(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},Ni=class e extends fi{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},Pi={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},Fi=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Ii=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function Li(e){return Ii.includes(e)}var Ri={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},zi={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},Bi=new Map;for(let e of Object.keys(zi))Bi.set(zi[e],e);function Vi(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var Hi=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function Ui(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Wi={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},Gi=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=Hi,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(si(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=Bi.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=Ri[t];!Fi&&i&&(n=n.slice(),Vi(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=di.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=di.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=Ti(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return Pi}};function Ki(e,t){return new bi(new Ni(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new Ai(Di.fromAppReturn(r))})),[])}function qi(e,t){return new bi(new Ni(Ui(e,t).then(e=>new Ai(Di.fromAppReturn(e)))),[])}var Ji=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=Di.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!Li(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=Ri[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!Fi&&r!==void 0&&Vi(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=Wi[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=Ki(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=qi(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new bi(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new bi(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new bi(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new bi(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new yi(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=di.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=di.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},Yi=16,Xi=8,Zi=16,Qi=64;function $i(e){return 2+e.length*3}function ea(e,t,n=0){if(n>=Qi)return Xi;switch(typeof e){case`string`:return $i(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return Zi+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return Zi+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return Xi;if(t.add(e),e instanceof Array){let r=Yi;for(let i of e)r+=Xi+ea(i,t,n+1);return r}if(e instanceof Error){let r=Yi+$i(e.name)+$i(e.message)+$i(e.stack??``);for(let i of Object.keys(e))r+=Xi+$i(i)+ea(e[i],t,n+1);return r}let r=Yi;for(let i of Object.keys(e))r+=Xi+$i(i)+ea(e[i],t,n+1);return r}default:return 16}}var ta=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){if(!this.resolution){if(this.resolution=new pi(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations)for(let e of this.onBrokenRegistrations)delete this.session.onBrokenCallbacks[e];this.onBrokenRegistrations=void 0}}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},na=class e extends fi{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},ra=class extends na{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},ia=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...Pi,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new ta(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new ra(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.watchExport(t,e),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}watchExport(e,t){t.onBroken(n=>{queueMicrotask(()=>{if(this.abortReason===void 0&&this.exports[e]?.hook===t)try{this.send([`reject`,e,Gi.devaluate(n,void 0,this,void 0,this.encodingLevel)])}catch(e){this.abort(e)}})})}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof yi){let{hook:n,pathIfPromise:r}=Ti(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=Gi.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,Gi.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,Gi.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof na&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new ta(this,e,!1),this.imports[e]=t),new na(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new pi(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new ta(this,e,!0);return this.imports[e]=t,new na(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new ta(this,n,!1);this.imports.push(r);let i=new na(!1,r),a=di.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=Gi.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new ta(this,this.imports.length,!1);return this.imports.push(i),new na(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=Gi.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=ea(a));let s=this.imports.length,c=new ta(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new ta(this,this.imports.length,!1);return this.imports.push(a),new na(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,Gi.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t of Object.values(this.onBrokenCallbacks))try{t(e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new Ai(new Ji(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new Ai(new Ji(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=di.createWritableStreamHook(t),r=this.exports.length;this.exports.push({hook:n,refcount:1,pipeReadable:e}),this.watchExport(r,n);continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new Ai(new Ji(this,this.encodingLevel).evaluate(n[2])));else{let e=new Ji(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new pi(e.value))}}else n[0]==`resolve`&&new Ji(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new Ji(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},aa=class{#e;#t;constructor(e,t,n={}){let r;r=t?new Ai(Di.fromAppReturn(t)):new pi(Error(`This connection has no main object.`)),this.#e=new ia(e,r,n),this.#t=new yi(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function oa(e,t,n){return new aa(new sa(e),t,n).getRemoteMain()}var sa=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},ca,la=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=ca?{parent:ca,captures:[],subject:ca.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},ca=this}unregister(){ca=this.context.parent}makeInput(){return new da(this,0)}makeOutput(e){let t;try{t=Gi.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new da(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=Gi.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new da(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new da(this,this.instructions.length)}capture(e){if(e instanceof da&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};li.sendMap=(e,t,n)=>{let r=new la(e,t),i;try{i=Di.fromAppReturn(gi(r.pushCall.bind(r),()=>n(new bi(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new bi(r.makeOutput(i),[])};function ua(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var da=class extends fi{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(ca)return ca.pushGet(this,e);ua()}call(e,t){t.dispose(),ua()}map(e,t,n){for(let e of t)e.dispose();ua()}pull(){ua()}ignoreUnhandledRejections(){}onBroken(e){ua()}},fa=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new Ji(this).evaluateCopy(t);if(e.value instanceof yi){let t=Ci(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new Ai(e))}return new Ji(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return Pi}};function pa(e,t,n,r,i){let a=new fa(r,new Ai(Di.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}li.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof bi)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(pa(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=Di.fromArray(t)}else a=e==null?Di.fromAppReturn(e):pa(e,t,n,r,i);return new Ai(a)}finally{for(let e of r)e.dispose()}};var ma=class e extends fi{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new Ni((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new Ai(e)))}catch(e){return t.dispose(),new pi(e)}}map(e,t,n){for(let e of t)e.dispose();return new pi(Error(`Cannot use map() on a WritableStream`))}get(e){return new pi(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){this.getState().writer.closed.then(void 0,e)}},ha=262144,ga=1073741824,_a=65536,va=2,ya=1.25,ba=.9,xa=3,Sa=class{now;window=ha;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?va:ya,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*ba):Math.max(s,this.window),this.window=Math.max(Math.min(s,ga),_a),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*ya?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=xa&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function Ca(e){let t,n=!1,r=new Sa(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({start(n){e.onBroken(e=>{t===void 0&&(t=e,n.error(e),o()),a&&=(a(e),i=void 0,void 0)})},write(n,s){if(t!==void 0)throw t;let c=Di.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],Di.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],Di.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var wa=class e extends fi{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new pi(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new pi(Error(`Cannot use map() on a ReadableStream`))}get(e){return new pi(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};di.createWritableStreamHook=ma.create,di.createWritableStreamFromHook=Ca,di.createReadableStreamHook=wa.create;var Ta=yi,Ea=ii,Da=oa;function Oa(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function ka(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onActivate:()=>()=>void 0});function Aa(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function ja(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function Ma(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Na(e){return{name:Ma(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function Pa(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function Fa(e,t){let n=Pa(Na(e));return{stroke:n,display:t?.display??Ua(n),match:t?.match??za(n),tokenName:t?.tokenName?ja(t.tokenName):void 0}}function Ia(e){return{stroke:Pa(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function La(e){return e.map(e=>Ia(e))}function Ra(e){return`match`in e?e.match:`stroke`in e?za(e.stroke):za(e)}function za(e){return`key:${Wa(Na(e))}`}function Ba(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Va(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Ua(e.stroke):Ua(Na(e))}function Ha(e,t){return e.map(e=>Va(e,t)).join(t?.separator??``)}function Ua(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function Wa(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Ga=Symbol(`keymap-extension-context`);function Ka(e){return e.isDestroyed?null:e.getFocusedTarget()}function qa(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function Ja(e,t){let n=new Set;return qa(e,t,e=>{n.add(e)}),n}function Ya(e,t,n){let r=[],i=Ja(t,n),a=Array.isArray(e)?e:Xa(e);for(let e of a)Za(t,e,n,i)&&r.push(e);return r}function Xa(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Za(e,t,n,r=Ja(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function Qa(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function $a(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?Qa(e)>=i.min:n}function eo(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&Qa(e)<n.max)return!0}return $a(e,t,n)&&e.index+1<e.binding.sequence.length}function to(e,t){return e.index===e.binding.sequence.length-1&&$a(e,t,!1)}function no(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function ro(e,t){let n=no(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=no(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=no(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function io(e,t){let n=[];for(let r of e){if(!$a(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function ao(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function oo(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function so(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return ao({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function co(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&Qa(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return ao(e,e.index,r,t.value??n.name)}}return $a(e,r,!1)?so(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return so(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function lo(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=so(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=oo(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function uo(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function fo(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function po(){let e=fo();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function mo(){let e=fo(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function ho(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function go(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!ho(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function _o(e){let t=go(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function vo(e){return{...e,sequence:La(e.sequence)}}function yo(e,t){let n=po();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=bo(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function bo(e){return e.map(t=>({sequence:La(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:vo(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&xo(e,t)),hasContinuations:e.some(e=>e.event===`press`&&So(t,e))}))}function xo(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function So(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function Co(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function wo(){return{plain:Co(),bindings:Co(),metadata:Co(),bindingsAndMetadata:Co()}}function To(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function Eo(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function Do(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function Oo(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function ko(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function Ao(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=Va(i.stroke)),c&&(o=void 0),n.push(Fa(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function jo(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function Mo(e,t,n,r,i,a,o={}){let s=wo(),c=-1,l=[],u=()=>jo(t).getFocusedTarget(),d=()=>Ka(t),f=t=>{let n=e.pending;Oo(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),me(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&w(t.binding,n,r)&&eo(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?Ao(t):[];return(!t||te())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=ko(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=To(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&jo(t);let o=u(),s=Eo(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?A(l.captures,r,i,o,c):D(d,r,i,o,c);return(l?te():ee(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,Do(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return A(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?A(i.captures,n,r,e,o):D(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=Ya(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Za(t,e,n),ee=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,te=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,ne=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},w=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),T=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?Va(r):``}return a&&(r=void 0),{display:n,tokenName:r}},E=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),re=(e,t,n)=>e.map(e=>E(e,t,n)),D=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(O(n.root.children.values(),o,s,t,r,a),O(n.root.patternChildren,o,s,t,r,a));return se(o,t,n,r,a)},O=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=k(o,r,i,a);if(!s)continue;let c=t.get(e);c?fe(c,s,r):t.set(e,de(o.stroke,s,r)),s.stop&&n.add(e)}},k=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=ue(ie(e)?ne(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=T(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=ne(e.reachableBindings,n,r);if(i.length===0)return;let a=ue(e.bindings,n,r),o=T(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},ie=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},A=(t,n,r,i,a)=>{let o=new Map,s=new Set;return ae(io(t,e.patterns),o,s,n,i,a),se(o,n,r,i,a)},ae=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),oe(s,e,t,n,r,i,a))},oe=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=ce(e,t,i,a,o);if(!c)return;let l=n.get(s);l?fe(l,c,i):n.set(s,de(e.part.stroke,c,i)),c.stop&&r.add(s)},se=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=pe(o,t,n,r,i);e&&a.push(e)}return a},ce=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=ue(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=le(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},le=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?Va(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},ue=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},de=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),fe=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},pe=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:Pa(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[E(e.bindings[0],r,i)]:re(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},me=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?Ao(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:Ao,collectMatchingBindings:ne,collectActiveBindings:re}}var No=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),Po=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Fo=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function Io(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function Lo(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function Ro(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function zo(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),Ro(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Bo(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),Ro(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function Vo(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Ya(e.sortedLayers,t,r)),Bo(e.activeLayersCache,n,!0)}function Ho(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function Uo(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function Wo(e){let t=`field ${e.fieldName}`;return{require(n,r){Ho(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Uo(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Go(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ko(e,t){return e instanceof Error&&e.message?e.message:t}function qo(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function Jo(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>Jo(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Go(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?Jo(i,t):i;return r?Object.freeze(a):a}return e}var Yo=[`name`],Xo=Object.freeze({}),Zo=new WeakMap;function Qo(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>es({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>se(()=>e.commandResolvers.prepend(t),t),y=t=>se(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>he(e).map(e=>$o(e.commandState)),S=e=>{let t=j(e),n=he(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:$o(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&ge(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(_e(n,j(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},ee=(e,t,n)=>{let r=O(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=N(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=N(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},te=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=de(ue(t));return g.set(t,n??null),n},ne=(e,t)=>de(O(t).chainsByName.get(e)),w=(e,t)=>N(e,null,{mode:`registered`,execution:t}),T=(e,t,n)=>N(e,t,{mode:`active`,execution:n}),E=(e,t)=>ce(e,t)?.command,re=e=>le(e)?.commandState.command,D=(e,n,i)=>{let a=k().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!Za(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},O=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=Vo(e,t,r,n);return ie()&&(s=e.derivedVersion,c=n,l=i),i},k=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=zo(e),o),ie=()=>e.activeCommandViewCacheBlockers===0,A=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:fe(e.command,t,`active`)!==void 0:!1,ae=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:fe(e.command,t,`active`)?.attrs},oe=(e,n)=>{if(n?.some(t=>t.command.name===e)||k().chainsByName.has(e))return`resolved`;let r=N(e,Ka(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},se=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),ce=(e,t)=>{let n=O(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:fe(e,t,`active`)},le=e=>ue(e)?.[0],ue=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},de=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},fe=(e,t,n)=>N(e,t,{mode:n}).resolved,pe=()=>k().entries,me=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},j=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:Ka(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:O(r)}},he=(e,t=j(e))=>{let r;return r=t.visibility===`registered`?pe():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],as({entries:r,query:e,getCommand:e=>$o(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ge=(e,t,n)=>{ve(n,n=>{ye(e,t,n)})},_e=(e,t)=>{if(t.visibility===`registered`){let t=me();for(let[n,r]of e){let e=k().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(be(i,e))}return}ve(t,n=>{M(e,n,t)})},ve=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&A(a,t.focused,i)&&n(a)}},ye=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(be(n,r.commandAttrs))}},M=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(be(t,xe(t,n)))},be=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),xe=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return k().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return ae(e,t.focused,n)},N=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=ts(t,e.commandResolvers.values(),()=>Ce(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=Se(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=P(c.command.name,r,a)??is(c.command);e&&(s.resolved={...c,attrs:e})}return s},P=(e,t,n)=>n===`registered`?le(e)?.commandState.attrs:O(t).reachableByName.get(e)?.commandState.attrs,Se=(e,t,n)=>n===`registered`?le(e):O(t).reachableByName.get(e),Ce=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?re(n):E(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:ee,getRegisteredResolvedEntries:te,getActiveRegisteredResolvedEntries:ne,resolveRegisteredResolverFallback:w,resolveActiveResolverFallback:T,getTopCommand:E,getDispatchUnavailableCommandState:D,getActiveCommandView:O,isBindingVisible:A,getBindingCommandAttrs:ae,getCommandResolutionStatus:oe}}function $o(e){return e.command}function es(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Lo(r.name),s=ns(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,Wo({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,Ko(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function ts(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:rs(t,o.getExecutionFields())}}return{hadError:i}}function ns(e){let t={};for(let[n,r]of Object.entries(e))!No.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Xo:t}function rs(e,t){return{command:e,input:t.input,payload:t.payload}}function is(e){let t=ns(e);return t===Xo?void 0:t}function as(e){let t=e.query?.namespace,n=os(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Yo;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(cs(u,t)&&ss(u,r,i)&&!(c&&!c.has(u.command.name))&&ls(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function os(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function ss(e,t,n){if(!t)return!0;for(let r of n)if(us(e,r,t))return!0;return!1}function cs(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?_s(n.namespace,t):!1}function ls(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!ms(e,r,i,n))return!1;return!0}function us(e,t,n){return ds(e,t)?.includes(n)===!0}function ds(e,t){let n=Zo.get(e);if(n||(n=new Map,Zo.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=fs(a);return n.set(t,o),o}function fs(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=fs(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function ps(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function ms(e,t,n,r){return typeof n==`function`?hs(e,t,n,r):gs(e,t,n)}function hs(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,ps(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,ps(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,ps(n,o[t],l(),r.onFilterError))?!0:!c&&ps(n,void 0,l(),r.onFilterError)}function gs(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&_s(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&_s(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&_s(a[t],n)}function _s(e,t){return Array.isArray(t)?t.some(t=>vs(e,t)):vs(e,t)}function vs(e,t){return Array.isArray(e)?e.some(e=>vs(e,t)):Object.is(e,t)}function ys(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(qo(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(bs(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=Io(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(xs(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return xs(n,i),!0;return!1}}}function bs(e){return typeof e==`object`&&!!e&&`ok`in e}function xs(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var Ss=Object.freeze({}),Cs=[],ws=[];function Ts(e){if(Object.keys(e).length!==0)return Jo(e,{freeze:!0})}function Es(e,t,n,r){let i=t=>Ms(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Ss,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=js(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:Ss,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>Ha(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=ks(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Ko(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?js(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=As(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Ko(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||Po.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,Wo({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?Ts(u):void 0,m=Io(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:vo(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):Cs,matchers:d.length>0?d:ws,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&Os(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Ko(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>Fa(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:La(r)}];let l={...n,sequence:La(r)},u=[],d=!0,f=o??Ss;for(let n of s)try{n(l,{layer:f,parseKey:t=>Ms(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(vo(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function Ds(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function Os(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&Ds(n.sequence,t.sequence)||t.command!==void 0&&Ds(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function ks(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??Ss,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function As(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function js(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??Ss,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:ja,createMatch:Ba,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function Ms(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=js(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function Ns(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function Ps(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(Ns(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var Fs=Symbol(`keymap-disambiguation-decision`),Is=Symbol(`keymap-deferred-disambiguation-decision`);function Ls(e,t){return{[Fs]:!0,action:e,handler:t}}function Rs(e){return{[Is]:!0,action:e}}function zs(e){return!!e&&typeof e==`object`&&e[Fs]===!0}function Bs(e){return!!e&&typeof e==`object`&&e[Is]===!0}function Vs(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Hs(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function Us(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...Fa({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function Ws(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function Gs(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return oe(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return oe(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&be()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:La(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function ee(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:La(n.sequence),command:n.command})}function te(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function ne(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function w(e){return e.sequence?La(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function T(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function E(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function re(e,t){return t.handled||e.reason===`no-match`?t:e}function D(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:w(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function O(){return{handled:!1,reason:`no-match`}}function k(e){e.preventDefault(),e.stopPropagation()}function ie(e,t,n,i){r.setPendingSequence({captures:t});let a=T(`sequence-pending`,t);return te(e,t,n),k(i),a}function A(e,t,n,i){let a=T(e,t);return te(`sequence-clear`,t,n),r.setPendingSequence(null),k(i),a}function ae(i,a){a||be();let o=ne(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&D(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=se(i);o&&D(o,i,a,s,e);return}let u=ce(i);o&&D(o,i,a,s,u)}function oe(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function se(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=we(e),o=O();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=Te(a,r,e,t);if(o=re(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function ce(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=we(e);if(n)return le(n,i,e,t);let a=r.getActiveLayers(t),o=O();for(let n of i){let r=de(a,[n],e,t);if(o=re(o,r),r.handled)return o}return o}function le(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=co(r,n,i,e.patterns,Ee,F);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,oo(t,n)),1/0),u=c.filter(e=>oo(e,n)===l);if(u.length===0||!u.some(e=>ke(e,a,o))){let e=T(`sequence-miss`,t.captures);return te(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return ue(u,0,!1,i,a)}function ue(t,n,i,a,o){let s=i,c=O(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=Se(t,i,n);if(u.length>0){if(s)continue;let e=Ce(t,n);return me(t,i,u,e,a,o,s)||ie(`sequence-advance`,u,o,a)}if(!to(n,e.patterns))continue;let d=Ce(t,n);for(let e of d)l.add(e);let f=Ae(n.layer,d,a,o);if(c=re(c,f.outcome),f.handled&&(s=!0,f.stop))return te(`sequence-clear`,t,o),r.setPendingSequence(null),c}return te(`sequence-clear`,t,o),r.setPendingSequence(null),c}function de(e,t,n,r){return fe(e,0,t,n,r)}function fe(t,n,r,a,o){let c=s.getActiveCommandView(o),l=O();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=De(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>eo(t,e.patterns,!1)).length>0){let n=u.filter(t=>to(t,e.patterns)),i=P(t,s,r,a,o);return pe(t,s,r,i,n,a,o)||ie(`sequence-start`,i,o,a)}let d=Ae(n,u.filter(t=>to(t,e.patterns)),a,o);if(l=re(l,d.outcome),d.handled&&d.stop)return l}return l}function pe(e,t,n,i,a,o,s){return j({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return O();let c=Ae(i,a,o,s);return c.stop?c.outcome:re(c.outcome,fe(e,t+1,n,o,s))}})}function me(e,t,n,i,a,o,s){return j({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return O();let c=Ae(n,i,a,o);return c.stop?c.outcome:re(c.outcome,ue(e,t+1,s||c.handled,a,o))}})}function j(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>ie(c,a,i,n),p=()=>A(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=ge({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?he(g,a,l,f,p,i,h):(N(h()),f())}function he(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return _e(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function ge(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=La(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:Pa(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:La(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>Ls(`run-exact`),continueSequence:()=>Ls(`continue-sequence`),clear:()=>Ls(`clear`),defer:e=>Ls(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(qo(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!zs(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function _e(e,t,n,r,i){be();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{ve(o,t,n,r)})}function ve(e,n,r,i){if(!xe(e))return;let a={signal:e.controller.signal,sequence:La(i),focused:r,sleep:t=>Vs(t,e.controller.signal),runExact:()=>Rs(`run-exact`),continueSequence:()=>Rs(`continue-sequence`),clear:()=>Rs(`clear`)},o;try{o=n(a)}catch(n){xe(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),M(e));return}if(qo(o)){o.then(t=>{ye(e,t)}).catch(n=>{xe(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),M(e))});return}ye(e,o)}function ye(e,n){if(xe(e)){if(n!==void 0&&!Bs(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),M(e);return}M(e),e.apply(n)}}function M(e){xe(e)&&(d=null)}function be(){let e=d;e&&(d=null,e.controller.abort())}function xe(e){return d===e}function N(e){let n=Ha(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function P(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of De(n,r,a,o,l))eo(t,e.patterns,!1)&&c.push(t)}return c}function Se(t,n,r){return t.filter((t,i)=>i>=n&&eo(t,e.patterns,!1)&&qs(t.parts,r.parts))}function Ce(t,n){return t.filter(t=>t.layer===n.layer&&to(t,e.patterns)&&qs(t.parts,n.parts))}function we(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return Ks(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function Te(e,t,n,r){let o=!1,s=O();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=re(s,E(c,u)),!u){ee(`binding-reject`,e,c,r);continue}if(ee(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function Ee(n,r){return Hs(e.patterns,t,n,r)}function F(t,n,r){return Us(e.patterns,t,n,r)}function De(e,t,n,r,i){let a=lo(e,t,n,Ee,F);return a.some(e=>ke(e,r,i))?a:[]}function I(n){return Ws(e.patterns,t,n)}function Oe(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function ke(e,t,n){return Oe(e.binding,t,n)}function Ae(e,t,n,r){let o=!1,s=O();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,I(c));if(s=re(s,E(t,l)),!l){ee(`binding-reject`,e,t,r);continue}if(ee(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:ae}}function Ks(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function qs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var Js=()=>{};function Ys(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function Xs(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function Zs(e,t,n,r,i){let a;try{a=ja(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Ko(e,`Failed to register keymap token`)),Js}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),Js;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,Ko(e,`Failed to register keymap token "${a}"`)),Js}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,Ko(e,`Failed to register keymap token "${a}"`)),Js}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,Ko(e,`Failed to unregister keymap token "${a}"`))}}}function Qs(e,t,n,r){let i,a;try{i=ja(r.name);let e=Ys(i,`min`,r.min,1),t=Ys(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:Ba(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Ko(e,`Failed to register keymap sequence pattern`)),Js}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),Js):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function $s(e,t,n,r){return Xs(r,{kind:n,reservedFields:n===`layer`?Fo:n===`binding`?Po:No,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var ec=()=>{};function tc(e,t){return t.priority-e.priority||t.order-e.order}function nc(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function rc(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function ic(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),ec;let o,s,c,p,m,v,y;try{y=l(n),o=u(_o(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,Ko(e,`Failed to register keymap layer`)),ec}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return ec;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:ro(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(tc),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>go(e)});t&&(i=_o(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(Fo.has(c)||l===void 0)continue;o[c]=Jo(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Wo({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?Jo(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=ro(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,Ko(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=nc(t),r=rc(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,Ko(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var ac=1e3;function oc(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=ac){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:ac},`[Keymap] Possible infinite state listener feedback loop detected after ${ac} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function sc(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var cc=Object.freeze({});function lc(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:po(),bindingExpanders:po(),bindingParsers:po(),bindingTransformers:po(),bindingFields:new Map,commandTransformers:po(),commandFields:new Map,eventMatchResolvers:po(),disambiguationResolvers:po(),keyHooks:mo(),keyAfterHooks:mo(),rawHooks:mo(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:po(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:cc,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function uc(e){return Ra(e)}var dc=class{#e=lc();#t=!1;#n=new Map;#r=[];#i=uo(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=uo((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=oc(this.#e,this.#i,this.#a),this.#l=Ps(this.#e,this.#o),this.#u=Qo(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=Mo(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=sc(this.#e,this.#o,this.#s),this.#d=ys(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=Es(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=yo(this.#o,this.#u),this.#m=ic(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=Gs(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[Ga](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?uc(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return $s(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return Zs(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Qs(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return $s(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return $s(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},fc=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),pc=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),mc=gc(fc),hc=gc(pc);function gc(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function _c(e){return e>=65&&e<=90?e+32:e}function vc(e){return e>=48&&e<=57}function yc(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(_c(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function bc(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(_c(r));if(i){for(let e of i)if(yc(t,e,n))return e}}function xc(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function Sc(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function Cc(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function wc(e,t){let n=bc(mc,e,t);if(n)return n;if(_c(e.charCodeAt(t))!==102||!vc(e.charCodeAt(t+1)))return;let r=vc(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Tc(e,t){return bc(hc,e,t)}function Ec(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Tc(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=wc(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var Dc=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[Sc(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[Sc(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[xc(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[Sc(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Ec(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=wc(t,n);return s?{parts:[Cc(s,e)],nextIndex:n+s.length}:{parts:[Sc(a,e)],nextIndex:n+1}},Oc=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function kc(e){return e.appendBindingParser(e=>Dc(e))}function Ac(e){return e.appendEventMatchResolver((e,t)=>Oc(e,t))}function jc(e){let t=kc(e),n=Ac(e);return()=>{n(),t()}}var Mc=Symbol(`keymap:mod-bindings`),Nc=/(^|[+,\s])mod(?=\s*\+)/i,Pc=/(^|[+,\s])mod(?=\s*\+)/gi;function Fc(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Ic(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Lc(e){return e.acquireResource(Mc,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Nc.test(t))return;let r=Fc(e.getHostMetadata());return[{key:t.replace(Pc,(e,t)=>`${t}${r}`),displays:n??Ic(t)}]}))}var Rc=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function zc(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Bc(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=zc(t);return n===`unknown`?zc(e?.platform??e?.userAgent):n}function Vc(){let e=Bc();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Hc(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Uc(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Hc(t.name)?[t]:[t,{...t,shift:!1}]}var Wc=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Gc(){return globalThis.MutationObserver}function Kc(e){return Rc.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function qc(e){if(!e)return new Wc(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Wc(Kc(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Jc=class{metadata=Vc();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(qc(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(qc(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return qc()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Gc();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Yc(e){return new Jc(e)}var Xc=(e,t)=>Uc(e).map(e=>t.resolveKey(e)),Zc=`fungi.app.ready`,Qc=`fungi.app.connect`,K=e=>A.pipe(R(be(1)),R(N(e))),$c=e=>Je(K(e)),el=Pe.pipe(R(De()),R(Ke(Number.isSafeInteger,{message:`Expected a safe integer`}))),tl=el.pipe(R(Me(0))),nl=el.pipe(R(ye(0))),rl=k({appId:K(160),releaseId:K(160),surfaceId:K(160)}),il=k({editing:o,surface:_e([K(160),u])}),al=_e([k({kind:f(`compose`),requestId:K(160),text:K(2e3)}),k({kind:f(`navigate`),requestId:K(160),params:Xe(k({key:K(64),value:K(4096)})).pipe(R(N(16)))})]),ol=k({computerId:_e([K(256),u]),teamHasComputers:Je(v(o)),computerAccessGranted:Je(o),focus:il,openRequest:_e([u,al]),visibility:T([`visible`,`hidden`])}),sl=T([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),cl=k({altKey:o,ctrlKey:o,id:K(160),key:K(64),metaKey:o,shiftKey:o}),ll=k({action:Je(Ve),availability:Je(Ve),category:K(160),description:$c(512),id:K(160),projections:Je(Ve),title:K(160)}),ul=k({arguments:Je(Ve),commandId:K(321),origin:T([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:K(160)}),dl=_e([k({result:Je(Ve),status:f(`handled`)}),k({error:Ve,status:f(`failed`)})]),fl=e=>K(e).pipe(R(Ke(e=>{for(let t=0;t<e.length;t+=1)if(Oa(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),pl={id:K(64),text:fl(80),end:de(o)},ml=de(Pe.pipe(R(De()),R(he({minimum:0,maximum:9999})))),hl=Xe(_e([k({...pl,kind:f(`text`),tone:de(T([`neutral`,`success`,`warning`,`error`]))}),k({...pl,kind:f(`button`),icon:de(T([`folder`,`ports`,`processes`,`access`])),count:ml,tone:de(T([`neutral`,`success`,`warning`,`error`])),busy:de(o),title:de(fl(1024)),disabled:de(o),opens:de(f(`dialog`)),expanded:de(o)}),k({...pl,kind:f(`toggle`),pressed:o}),k({...pl,kind:f(`menu`),count:ml,title:de(fl(1024)),options:Xe(k({id:K(64),text:fl(80),checked:de(o),disabled:de(o)})).pipe(R(N(16)),R(Ke(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(R(N(6)),R(Ke(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),gl=k({computerId:K(256),path:K(1024)}),_l=K(80).pipe(R(Ke(e=>e.trim()===e,{message:`Expected a trimmed title`}))),vl=K(64),yl=K(80),bl=e=>new Set(e.map(e=>e.id)).size===e.length,xl=k({id:vl,label:yl,siblings:Je(Xe(k({id:vl,label:yl})).pipe(R(N(16)),R(Ke(bl,{message:`Expected unique crumb sibling ids`}))))}),Sl=k({id:vl,label:yl,icon:Je(f(`play`)),variant:Je(T([`primary`,`outline`,`ghost`])),tone:Je(f(`destructive`)),disabled:Je(o)}),Cl=e=>Xe(Sl).pipe(R(N(e)),R(Ke(bl,{message:`Expected unique header command ids`}))),wl=k({id:vl,label:yl,presentation:Je(f(`bead`)),tone:Je(T([`neutral`,`info`,`warning`,`success`,`error`]))}),Tl={status:Je(Xe(wl).pipe(R(N(4)),R(Ke(bl,{message:`Expected unique header status ids`})))),crumbs:Je(Xe(xl).pipe(R(N(8)),R(Ke(bl,{message:`Expected unique crumb ids`})))),primary:Je(Cl(3)),menu:Je(Cl(12))},El=k({contractVersion:f(1),canGoBack:o,title:Je(_l),...Tl}),Dl=k({canGoBack:o,title:Je(A),...Tl}),Ol=_e([k({kind:f(`crumb`),crumbId:vl,siblingId:Je(vl)}),k({kind:f(`action`),actionId:vl})]),kl=v(k({agentId:K(256),sessionId:K(256)})),Al=k({agents:Je(Xe(T([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(R(N(4)))),computers:Je(Xe(T([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(R(N(4))))}),jl=T([`granted`,`declined`,`customize`]),Ml=k({message:K(512),tone:Je(T([`info`,`success`,`warning`,`error`]))}),Nl=T(d);k({code:Nl.pick([`DELIVERY_PENDING`])});var Pl=k({code:Nl,message:K(512),retryable:o}),Fl=k({protocolVersion:f(2),type:f(Zc)}),Il=k({epoch:K(160),protocolVersion:f(2),type:f(Qc)}),Ll=k({epoch:K(160),protocolVersion:f(2)}),Rl={[Symbol.dispose]:Je(Ve)},zl=_e([k({...Rl,ok:f(!0),value:Ve}),k({...Rl,error:Pl,ok:f(!1)})]);function q(e,t,r=`PROTOCOL`){return n(Ae(e,{onExcessProperty:`error`}),p({onFailure:e=>{throw new E(`The peer sent malformed protocol data`,{cause:e,code:r,retryable:!1})},onSuccess:t}))}function J(e){return Object.freeze(e)}function Bl(e,t){let n=e.arguments===void 0?void 0:Dn(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),J(r)}var Vl=q(ll,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),J(Au(()=>Bn(t)))},`INVALID_ARGUMENT`),Hl=q(K(321),e=>e),Ul=q(ul,e=>{let t=e.arguments===void 0?void 0:Dn(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),J(n)}),Wl=q(_e([r,Ve]),e=>e===void 0?void 0:Dn(e)),Gl=q(Il,e=>J(e));q(Ll,e=>J(e));var Kl=q(ol,e=>{let t={computerId:e.computerId,focus:J({...e.focus}),openRequest:e.openRequest===null?null:J({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),J(t)}),ql=q(Pl,e=>J({...e})),Jl=q(il,e=>J({...e}),`INVALID_ARGUMENT`),Yl=q(rl,e=>J({...e})),Xl=q(sl,e=>e),Zl=q(hl,e=>J(e.map(e=>e.kind===`menu`?J({...e,options:J(e.options.map(e=>J(e)))}):J(e))),`INVALID_ARGUMENT`),Ql=q(k({itemId:K(64),optionId:de(K(64)),anchor:de(k({start:Pe.pipe(R(he({minimum:0,maximum:1e5}))),width:Pe.pipe(R(he({minimum:0,maximum:1e5})))}))}),e=>J(e.anchor===void 0?{...e}:{...e,anchor:J({...e.anchor})}),`INVALID_ARGUMENT`),$l=q(gl,e=>J({...e}),`INVALID_ARGUMENT`);function eu(e){let t={id:e.id,label:e.label};return e.presentation!==void 0&&(t={...t,presentation:e.presentation}),e.tone!==void 0&&(t={...t,tone:e.tone}),J(t)}function tu(e){let t={id:e.id,label:e.label};return e.siblings===void 0?J(t):J({...t,siblings:J(e.siblings.map(e=>J({...e})))})}function nu(e){let t={id:e.id,label:e.label};return e.icon!==void 0&&(t={...t,icon:e.icon}),e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),J(t)}function ru(e){let t={canGoBack:e.canGoBack};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:J(e.crumbs.map(tu))}),e.primary!==void 0&&(t={...t,primary:J(e.primary.map(nu))}),e.menu!==void 0&&(t={...t,menu:J(e.menu.map(nu))}),e.status!==void 0&&(t={...t,status:J(e.status.map(eu))}),J(t)}var iu=q(El,ru,`INVALID_ARGUMENT`),au=q(Dl,e=>{let t=e.title?.trim();return ou({...ru({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:1})},`INVALID_ARGUMENT`),ou=q(El,e=>J({...ru(e),contractVersion:1}),`INVALID_ARGUMENT`),su=q(Ol,e=>e.kind===`action`?J({...e}):J(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),cu=q(kl,e=>e===null?null:J({...e}),`INVALID_ARGUMENT`),lu=q(Al,e=>J({agents:J([...new Set(e.agents??[])]),computers:J([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);q(Fl,e=>J(e));var uu=q(K(512),e=>e),du=q(Ml,e=>J({...e}),`INVALID_ARGUMENT`);q(k({id:K(160),repeat:o}),e=>J(e));var fu=q(Xe(cl).pipe(R(N(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new E(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return J(e.map(e=>J({...e})))});function pu(e){return q(k({value:Ve,version:tl}),t=>J({value:e(t.value),version:t.version}))}var mu=pu(Kl),hu=q(k({capabilities:Xe(Ve).pipe(R(N(128))),context:Ve}),e=>J({capabilities:J(e.capabilities.map(e=>xu(e))),context:mu(e.context)})),gu=pu(Xl),_u=pu(fu),vu=pu(uu),yu=n(gu,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new E(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({value:e.value,version:e.version})});function bu(e){return q(k({handle:Ve,id:K(160),version:nl}),t=>{if(!(t.handle instanceof Ta)&&!(e&&t.handle instanceof Ea))throw new E(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({handle:t.handle,id:t.id,version:t.version})})}var xu=bu(!1),Su=bu(!0);function Cu(e){let t=e?Su:xu;return q(k({capabilities:Xe(Ve).pipe(R(N(128))),context:Ve,identity:Ve,lifecycle:Ve,reservedChords:Ve,theme:Ve}),e=>J({capabilities:J(e.capabilities.map(e=>t(e))),context:mu(e.context),identity:Yl(e.identity),lifecycle:yu(e.lifecycle),reservedChords:_u(e.reservedChords),theme:vu(e.theme)}))}var wu=Cu(!1);Cu(!0);function Tu(e){return q(zl,t=>t.ok?J({ok:!0,value:e(t.value)}):J({ok:!1,error:ql(t.error)}))}var Eu=Tu(wu),Du=Tu(q(k({commandId:K(321)}),e=>J(e)));Tu(q(dl,e=>{if(e.status===`failed`)return J({status:`failed`,error:Au(()=>kn(e.error))});let t=e.result===void 0?void 0:Dn(e.result);return J(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Ou=Tu(q(r,()=>void 0)),ku=Tu(q(jl,e=>e));Tu(q(o,e=>e)),Tu(q(o,e=>e));function Au(e){try{return e()}catch(e){throw new E(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var ju=_e([k({kind:f(`saveFile`),name:K(255).pipe(R(oe(/^[^\p{Cc}/\\]+$/u))),mime:K(255),bytes:C}),k({kind:f(`copyText`),text:A})]);function Mu(e){let t=Ae(ju,{onExcessProperty:`error`})(e);if(c(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var Nu=Tu(q(_e([k({kind:f(`saved`)}),k({kind:f(`copied`)}),k({kind:f(`refused`),reason:T([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>J(e)));function Pu(e){return e instanceof E?{code:e.code,message:Iu(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Fu(e){try{let t=ql(e);return new E(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new E(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Iu(e){return e.trim().slice(0,512)||`Host operation failed`}var Lu=e=>({ok:!0,value:e}),Ru=e=>({error:Pu(e),ok:!1});async function zu(e,t){let n,r=new Set;try{return n=await e,Bu(t(n))}catch(e){throw Vu(e)&&Hu(e,r),e instanceof E?e:new E(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Vu(n)&&Hu(n,r)}}function Bu(e){if(e.ok)return e.value;throw Fu(e.error)}function Vu(e){return O(e)&&Symbol.dispose in e&&ie(e[Symbol.dispose])}function Hu(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Uu(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function Wu(e){let t=fu(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=fu(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Gu(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Yc(r),a=new dc(i);jc(a),Lc(a),a.prependEventMatchResolver(Xc);let o=qu(e.onBroken),s=Zu(a,e.chords,e.remote,o),c=Ku(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Ju(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Yu(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Yu(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Zu(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function Ku(e,t,n,r,i){return()=>{if(!n())return;let a=Ju(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function qu(e){return t=>{try{zu(t(),Ou).catch(t=>{ti(`browser-bridge.host-call`,t),e(t)})}catch(t){ti(`browser-bridge.host-call`,t),e(t)}}}function Ju(e,t){let n=e.activeElement;return Jl({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Yu(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||Xu(e.key)&&n())return!1;e.run()}})),priority:500})}function Xu(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Zu(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:Kc(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function Qu(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=td(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=ed(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of $u)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of $u)e.window.removeEventListener(t,n)}}var $u=[`mousedown`,`mouseup`,`auxclick`];function ed(e){return e===3?`back`:e===4?`forward`:null}function td(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:nd(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function nd(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function rd(){return!S(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function id(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function ad(e){let t=new Map,n=id(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=xu(n),r=ld(e.id,e.version);if(t.has(r))throw sd(e.handle),new E(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())sd(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)sd(t)},o=e=>{if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=ld(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new E(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new E(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var od=qe().transform(e=>{let t=ue(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=Re(k({[Symbol.dispose]:Je(Ee(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function sd(e){try{let t=od.parse(e);if(t===void 0||cd.has(t.owner))return;cd.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var cd=new WeakSet;function ld(e,t){return`${e}@${String(t)}`}var ud=class extends Ea{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(Hl(e))?.abort(),Promise.resolve(Lu(void 0))}catch(e){return Promise.resolve(Ru(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new E(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=Ul(e);if(this.#n.has(t.requestId))throw new E(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new E(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=Wl(await this.#t(Bl(t,n.signal)));return Lu(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Xn)try{return Lu({status:`failed`,error:kn({code:e.code,message:e.message,details:e.details})})}catch(e){return Ru(e)}return Ru(e)}}[Symbol.dispose](){this.dispose()}};function dd(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function fd(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:dd(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{zu(e(),Ou).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:md(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function pd(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new E(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function md(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!ie(s))throw new E(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Vl(o),l=new ud(s),u=pd(n,c,s,l);try{let t=await hd(e,c,u.target);r()&&await gd(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function hd(e,t,n){return zu(e.registerCommand(t,n),Du)}async function gd(e,t,n){throw n.dispose(),await zu(e.unregisterCommand(t),Ou),new E(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var _d=Ce(e=>e instanceof Ta),vd=class extends Ea{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw kd();let t=e===void 0?void 0:ql(e);return setTimeout(()=>this.#t.disconnect?.(t??Nd()),0),Promise.resolve(Lu(void 0))}catch(e){return Promise.resolve(Ru(e))}}async requestClose(){try{if(this.#e)throw kd();return Lu(await(this.#t.beforeClose?.()??!0))}catch(e){return Ru(e)}}async requestBack(){try{if(this.#e)throw kd();return Lu(await(this.#t.back?.()??!1))}catch(e){return Ru(e)}}async activateNavigation(e){try{if(this.#e)throw kd();let t=su(e);return Aa(this.#t.navigation,t)?Lu(await(this.#t.activate?.(t)??!1)):Lu(!1)}catch(e){return Ru(e)}}async activateStatus(e){try{if(this.#e)throw kd();let t=Ql(e);return ka(this.#t.statusItems,t)?Lu(await(this.#t.statusAction?.(t)??!1)):Lu(!1)}catch(e){return Ru(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Ru(kd()):this.#n(e,`context`,Kl,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw kd();let n=hu(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Lu(void 0));for(let e of n.capabilities)t.push({...e,handle:Re(_d)(e.handle).dup()});if(!this.#t.capabilities)throw kd();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Lu(void 0))}catch(e){for(let e of t)sd(e.handle);return Promise.resolve(Ru(e))}}updateLifecycle(e){try{if(this.#e)throw kd();let t=pu(Xl)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Lu(void 0));if(!Pd(this.#t.lifecycle.get(),t.value))throw new E(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Lu(void 0))}catch(e){return Promise.resolve(Ru(e))}}async updateReservedChords(e){return this.#e?Ru(kd()):this.#n(e,`chords`,fu,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Ru(kd()):this.#n(e,`theme`,uu,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=pu(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Lu(void 0))}catch(e){return Promise.resolve(Ru(e))}}};async function yd(e){let t=Cd(),n=new vd(t),r=Da(e.port,n),i,a=Sd(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=Bu(Eu(o));if(!e.isActive())throw xd();let c=wd({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return Id(t,e,n,r,i)}}function bd(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function xd(){return new E(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Sd(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{ti(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new E(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function Cd(){return{statusItems:[],navigation:{canGoBack:!1},bindings:Uu(),chords:Wu([]),context:id({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:id(`connecting`),theme:id(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function wd(e){let t=Yl(e.bootstrap.identity),n=Fd(e.bootstrap);bd(e.state,n);let r=ad(e.bootstrap.capabilities);return e.state.capabilities=r,Ed(e,t,r)}function Td(e,t,n){return Gu({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof E?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function Ed(e,t,n){let r=!1,i=t=>{r||(r=!0,jd([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{sd(e.bootstrapOwner)},()=>{sd(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=fd(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=Od(e.remote,a,e.state),c=Dd(e.state,e.remote,a),l=Td(e,t,i),u=Qu({window:e.options.window,mac:rd(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{ti(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Ad(i)}),Md({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function Dd(e,t,n){let r=Object.freeze({async publish(r){n();let i=au(r);e.canGoBack=i.canGoBack,e.navigation=iu(i),await zu(t.reportNavigation(i),Ou)},onActivate(t){if(n(),e.activate!==void 0)throw new E(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new E(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new E(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function Od(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await zu(e.requestComputerChoice(),Ou)},async requestBrowserAction(n){t();let r=Mu(n);return r.kind===`refused`?r:await zu(e.requestBrowserAction(r),Nu)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new E(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await zu(e.requestAppPermissions(lu(n)),ku)},async openDesktopSettings(){t(),await zu(e.openDesktopSettings(),Ou)},async openTeamBilling(){t(),await zu(e.openTeamBilling(),Ou)},async openNavigation(n){t(),await zu(e.openNavigation($l(n)),Ou)},async reportStatus(r){t();let i=Zl(r);n.statusItems=i,await zu(e.reportStatus(i),Ou)},async reportAgentSessionSelection(n){t(),await zu(e.reportAgentSessionSelection(cu(n)),Ou)},async showToast(n){t(),await zu(e.showToast(du(n)),Ou)}})}function kd(){return new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Ad(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function jd(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function Md(e){return Object.freeze(e)}function Nd(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function Pd(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function Fd(e){let t=pu(Kl)(e.context),n=pu(uu)(e.theme),r=pu(Xl)(e.lifecycle),i=pu(fu)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new E(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Id(e,t,n,r,i){throw jd([()=>{n[Symbol.dispose]()},()=>{i&&sd(i)},()=>{sd(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof E?e:new E(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Ld=!1,Rd=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(Ld=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Bd())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:Zc},`*`)}catch(e){ti(`connect.notify-host`,e),n(Kd(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(Hd())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),Ld=!1,a(e??Hd());return}i(t)}}#s(e,t,n){if(!Gd(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||Ud(e.origin)===void 0){t(Wd());return}let r=qd(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Jd(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),yd({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Ld=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Vd(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Bd();if(Ld)return new E(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(S(globalThis.window)||this.#e.parent===this.#e)return new E(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function zd(e){return new Rd(e).start()}function Bd(){return new E(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Vd(e){return e instanceof E?e:new E(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function Hd(){return new E(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function Ud(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Wd(){return new E(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var Gd=We(k({type:f(Qc)}));function Kd(e){return new E(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function qd(e,t){try{return Gl(e.data)}catch(e){ti(`connect.decode-message`,e),t(e instanceof E?e:new E(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Jd(e){return new E(e,{code:`PROTOCOL`,retryable:!1})}function Yd(e,t,n){e.style.isolation=`isolate`;let r=(0,ei.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=Qr(a),s,c,l,u=!1,d=e=>{let i=(0,V.createElement)(Xd,{state:e,render:n});r.render(t.queryClient?(0,V.createElement)(nt,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):Zr(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),zd({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,Zr(e.theme.get(),a),c=e.theme.subscribe(e=>{Zr(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof E&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof E?e:new E(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new E(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function Xd({state:e,render:t}){return(0,V.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,V.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,V.createElement)(V.Fragment,null,e.status===`not-hosted`?(0,V.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function Zd(e){let t=(0,V.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,V.useCallback)(()=>e?.get(),[e]);return(0,V.useSyncExternalStore)(t,n,n)}function Qd(e){return Zd(e?.context)??null}function $d(e){return Qd(e)?.computerId??null}function ef(e,t,n,r){let i=(0,V.useRef)(t);i.current=t;let a=(0,V.useRef)(n);a.current=n;let o=(0,V.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,V.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,V.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,V.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function tf(e,{sourceId:t,namespace:n},r){let i=(0,V.useMemo)(()=>Qn(),[]),a=(0,V.useMemo)(r,[r]);return(0,V.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,V.useEffect)(()=>e?qr(e.commands,a):void 0,[e,a]),i}function nf(e,{canGoBack:t,title:n,crumbs:r,primary:i,menu:a,status:o,onBack:s,onCrumb:c,onAction:l}){let u=(0,V.useRef)(s),d=(0,V.useRef)(c),f=(0,V.useRef)(l);(0,V.useEffect)(()=>{u.current=s,d.current=c,f.current=l},[s,c,l]),(0,V.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>u.current()),n=e.onActivate(e=>{if(e.kind===`action`){let t=f.current;return t?.(e.actionId),t!==void 0}let t=d.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),rf(e,{canGoBack:!1})}},[e]);let p=JSON.stringify([r,i,a,o]),m=(0,V.useRef)({crumbs:r,primary:i,menu:a,status:o});(0,V.useEffect)(()=>{m.current={crumbs:r,primary:i,menu:a,status:o}},[r,i,a,o]),(0,V.useEffect)(()=>{if(!e)return;let r={canGoBack:t};n!==void 0&&(r={...r,title:n});let i=m.current;i.crumbs!==void 0&&(r={...r,crumbs:i.crumbs}),i.primary!==void 0&&(r={...r,primary:i.primary}),i.menu!==void 0&&(r={...r,menu:i.menu}),i.status!==void 0&&(r={...r,status:i.status}),rf(e,r)},[e,t,n,p])}function rf(e,t){e.publish(t).catch(e=>{e instanceof E&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var af=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function of(e,t,n){return new af(e,t,n)}function sf(e){let t=P(e),n=ue(Object),r=P(Object.fromEntries(Object.keys(e).map(e=>[e,qe().optional()])));return qe().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,we().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){sd(e)}}})}function cf(e){return qe().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof E?e:new E(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{sd(t)}})}function lf(e){return we({output:xe(qe().transform(t=>{try{return e.parse(t)}catch(e){throw sd(t),e instanceof E?e:new E(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var uf=lf(cf(je()));sf({fetch:lf(ue(Response)),close:uf});var df=e=>crypto.getRandomValues(new Uint8Array(e)),ff=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},pf=(e,t=21)=>ff(e,t|0,df),mf=`abcdefghijklmnopqrstuvwxyz0123456789`;function hf(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return pf(mf,e)()}var gf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,_f=/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/,vf=B().min(1).max(64).regex(gf),yf=B().min(1).max(64).regex(gf),bf=B().min(1).max(32).regex(_f),xf=P({prefix:bf}),Sf=P({family:vf,version:L(1),kinds:se(yf,xf)}).superRefine((e,t)=>{let n=Object.entries(e.kinds);if(n.length<1||n.length>64){t.addIssue({code:`custom`,message:`Identifier families must declare between one and 64 kinds`});return}let r=new Set;for(let[,e]of n){if(r.has(e.prefix)){t.addIssue({code:`custom`,message:`Identifier kind prefixes must be distinct`});return}r.add(e.prefix)}}),Cf=B(),wf=/^[a-z0-9]+$/,Tf=new TextEncoder;function Ef(e){return e===32||e>=9&&e<=13}function Df(e){let t=0,n=e.length;for(;t<n&&Ef(e.charCodeAt(t));)t+=1;for(;n>t&&Ef(e.charCodeAt(n-1));)--n;return e.slice(t,n).replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Of(e){let t=`${e.prefix}_`;function n(e){if(!e.startsWith(t))return!1;let n=e.slice(t.length);return n.length===21&&wf.test(n)}let r=M(()=>F(e=>{let t=Cf.safeParse(e);return t.success&&n(t.data)}));function i(i){let a,o=i,s=Tf.encode(o).byteLength,c=r.safeParse(o),l=o.startsWith(t)?o.slice(t.length):void 0;if(s<3||s>96)a=`bounds`;else if(l!==void 0&&Array.from(l).length!==21)a=`bounds`;else if(c.success)return{ok:!0,value:c.data};else a=n(Df(o))?`non_canonical`:`grammar`;return{ok:!1,error:{code:`invalid_id`,family:e.family,kind:e.kind,version:1,reason:a}}}let a=M(()=>Cf.transform((e,t)=>{let n=i(e);return n.ok?n.value:(t.addIssue({code:`custom`,message:n.error.reason}),h)}));function o(){let n;try{n=hf(21)}catch{throw e.entropyUnavailable()}return r.parse(`${t}${n}`)}return{family:e.family,kind:e.kind,version:1,generate:o,schema:a,parse:i,is:e=>i(e).ok}}var kf=se(B(),P({family:B(),kind:B(),version:L(1),generate:we(),schema:ue(Ue),parse:we(),is:we()})),Af=class extends Error{name=`CairnDefinitionError`;code=`invalid_definition`;constructor(){super(`Cairn identifier family definition is invalid`)}},jf=class extends Error{name=`CairnGenerationError`;code=`entropy_unavailable`;family;kind;version=1;constructor(e){super(`Cairn entropy source is unavailable`),this.family=e.family,this.kind=e.kind}};function Mf(e){let t;try{t=Sf.safeParse(e)}catch{throw new Af}if(!t.success)throw new Af;let n=t.data,r={};for(let[t,i]of Object.entries(n.kinds)){let a=i.prefix;r[t]=Of({family:e.family,kind:t,prefix:a,entropyUnavailable:()=>new jf({family:n.family,kind:t})})}let i=F(e=>{let t=kf.safeParse(e);if(!t.success)return!1;let r=Object.entries(t.data);return r.length===Object.keys(n.kinds).length&&r.every(([e,t])=>Object.hasOwn(n.kinds,e)&&t.kind===e&&t.family===n.family)}).safeParse(r);if(!i.success)throw new Af;return i.data}function Nf(e){return e instanceof E?e:new E(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var Pf=new WeakMap,Ff={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function If(e){let t={};return e&&Pf.set(t,e),t}function Lf(){let e=new cn({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&Pf.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function Rf(e,t,n,r){let i=e?.context.get().computerId;return Sn({queryKey:n,meta:If(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new E(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new E(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw Nf(e)}}})}var zf=_e([k({kind:f(`compose`),text:A.pipe(R(be(1)),R(N(2e3)))}),k({kind:f(`navigate`),params:Xe(k({key:A.pipe(R(be(1)),R(N(64))),value:A.pipe(R(N(1024)))})).pipe(R(N(16)))})]);_e([k({role:A.pipe(R(be(1)),R(N(80))),intent:zf}),k({appId:A.pipe(R(be(1)),R(N(128))),intent:zf})],{mode:`oneOf`});var Bf=z({displayName:B().min(1).max(80).nullable()}).nullable();of(`apps.open`,1,M(()=>sf({open:uf,role:lf(cf(Bf))})));var Vf=of(`apps.call`,1,M(()=>sf({call:lf(cf(qe().transform(e=>Dn(e))))}))),Hf={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},Uf=(0,V.forwardRef)(function({action:e,children:t,className:n,description:r,title:i,tone:a=`neutral`,...o},s){return(0,H.jsxs)(`div`,{...o,className:Ye(`alert caps-alert`,Hf[a],n),"data-tone":a,role:o.role??`alert`,ref:s,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i?(0,H.jsx)(`h3`,{className:`font-semibold`,children:i}):null,r?(0,H.jsx)(`p`,{className:`text-sm`,children:r}):null,t]}),e?(0,H.jsx)(`div`,{className:`shrink-0`,children:e}):null]})}),Wf=M(()=>B().regex(/^(container|vm-[a-z0-9][a-z0-9-]{0,62}|local-[a-z2-7]{16})$/)),Gf=new TextEncoder,Kf=131072,qf=16384,Jf=Object.freeze({maximumTimeMs:12e4}),Yf=ge(),Xf=M(()=>B().min(1).max(128).regex(/^[A-Za-z][A-Za-z0-9_]*$/)),Zf=M(()=>I().int().min(1).max(65535));z({port:Zf}),M(()=>z({port:Zf,exposed:j()})),M(()=>z({port:Zf,removed:j()})),M(()=>z({ports:ze(Zf).max(64)}));var Qf=M(()=>se(B(),qe()).refine(e=>Yf.safeParse(e).success,`Capability schema must contain JSON values`));M(()=>ze(z({id:Xf,name:Xf,kind:B(),description:B(),parameters:Qf,output:Qf})));var $f=B().min(1).max(4096).startsWith(`/`).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`),ep=(e=0)=>B().min(e).refine(e=>Gf.encode(e).byteLength<=Kf,`Text exceeds the ${String(Kf)}-byte Computer bound`);z({path:$f}),M(()=>z({path:$f,content:ep()}));var tp=z({path:$f,byteOffset:I().int().nonnegative().optional(),byteLength:I().int().positive().max(Kf).optional()});M(()=>z({path:tp.shape.path,byteOffset:I().int().nonnegative(),content:B(),encoding:L(`base64`),truncated:j()})),M(()=>z({previewUrl:ne(),expiresAt:I().int().positive()}));var np=I().int().min(1).max(256).default(100),rp=I().int().nonnegative().default(0);z({path:$f.default(`/`),limit:np,offset:rp});var ip=M(()=>z({name:B(),size:I().int().nonnegative(),modifiedAt:I(),type:Ie({file:`file`,directory:`directory`,symlink:`symlink`})}));M(()=>z({path:$f,entries:ze(ip).max(256),nextOffset:I().int().nonnegative().nullable()}));var ap=M(()=>B().refine(e=>Gf.encode(e).byteLength<=Kf,`File exceeds the Computer write bound`));z({path:$f,content:ap}),M(()=>z({path:$f,bytes:I().int().nonnegative()})),z({path:$f,expectedContent:ap,content:ap}),M(()=>z({path:$f,pattern:B().min(1).max(512),limit:I().int().min(1).max(256).default(256)})),M(()=>z({path:$f,matches:ze($f).max(256),truncated:j()})),M(()=>z({path:$f,pattern:B().min(1).max(512),regex:j().default(!1),ignoreCase:j().default(!1),include:B().min(1).max(512).optional(),limit:I().int().min(1).max(256).default(256)})),M(()=>z({path:$f,matches:ze(z({path:$f,line:I().int().positive(),text:B()})).max(256),truncated:j()})),M(()=>z({path:$f,oldText:ep(1),newText:ep()})),M(()=>z({path:$f,bytes:I().int().nonnegative(),diff:B(),firstChangedLine:I().int().positive().nullable()})),M(()=>z({path:$f,recursive:j().default(!0)})),z({path:$f});var op=s({version:`v7`});function sp(e){return z({command:B().min(1).max(qf),cwd:$f.optional(),backend:Wf.optional(),timeoutMs:I().int().min(1).max(e.maximumTimeMs).default(1e4)})}sp(Jf).extend({requestId:op});var cp=z({stream:Ie({stdout:`stdout`,stderr:`stderr`}),keptBytes:I().int().nonnegative(),totalBytes:I().int().positive()}),lp=z({status:Ie({completed:`completed`,failed:`failed`,cancelled:`cancelled`}),exitCode:I().int(),stdout:B(),stderr:B(),truncated:fe([L(!1),ze(cp).min(1)])}),up=Mf({family:`computer-process`,version:1,kinds:{process:{prefix:`computer_process`}}}).process,dp=M(()=>B().refine(e=>up.is(e)));z({requestId:B().min(1).max(256),requestScope:B().min(1).max(512),port:Zf.optional(),command:B().min(1).max(qf),cwd:$f.optional()}).omit({requestId:!0,requestScope:!0}),z({id:dp});var fp=Ie({running:`running`,exited:`exited`,uncertain:`uncertain`}),pp=Ie({synced:`synced`,pending:`pending`,unknown:`unknown`}),mp=z({id:dp,port:Zf.nullable(),command:B(),cwd:B().nullable(),state:fp,exitCode:I().int().nullable(),sync:pp,startedAt:I().int(),endedAt:I().int().nullable()});z({processes:ze(mp).max(64)}),M(()=>z({process:mp,signalled:j()}));var hp=Ie({accepted:`accepted`,running:`running`,succeeded:`succeeded`,failed:`failed`,unknown:`unknown`,expired:`expired`});z({requestId:op,status:hp,output:lp.nullable()}).omit({requestId:!0}),Ie({"files.read":`files.read`,"files.readBytes":`files.readBytes`,"files.write":`files.write`,"files.writeBytes":`files.writeBytes`,"files.list":`files.list`,"files.glob":`files.glob`,"files.grep":`files.grep`,"files.edit":`files.edit`,"files.patch":`files.patch`,mkdir:`mkdir`,bash:`bash`,exec:`exec`});var gp=Mf({family:`inkcap`,version:1,kinds:{document:{prefix:`inkcap_document`}}}),_p=I().int().positive().max(2**53-1),vp=z({computerId:B().min(1).max(256),path:$f.refine(e=>!e.split(`/`).includes(`..`),`Parent path segments are not allowed`)}),yp=vp.extend({id:B().refine(e=>gp.document.is(e),`Invalid document identity`),activity:Ie([`opened`,`edited`]),occurredAt:I().int().nonnegative().max(2**53-1),sequence:_p});z({limit:I().int().min(1).max(50).default(20),after:z({before:_p}).optional()}),z({rows:ze(yp).max(50),next:z({before:_p}).nullable()});var bp=z({recorded:L(!0)}),xp=z({error:L(`not_granted`)});of(`app.backend`,1,M(()=>sf({request:lf(cf(qe().transform(e=>Dn(e))))})));var Sp=of(`app.methods`,1,M(()=>sf({call:lf(cf(qe().transform(e=>Dn(e))))})));async function Cp(e,t,n,r){try{let i=vp.parse({computerId:t,path:n}),a=await e.capabilities.require(Sp).call(`documents.${r}`,JSON.stringify(i));if(xp.safeParse(a).success)throw Error(`Document activity was not admitted`);return bp.parse(a),!0}catch(e){return console.error(`Inkcap document activity could not be recorded`,et(e)),!1}}var wp=B().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),Tp=B().regex(/^[0-9a-f]{40}$/);z({ref:B().startsWith(`refs/`).max(1024),before:Tp,after:Tp}),M(()=>B().min(1).max(512));var Ep=z({name:B(),email:B()}),Dp=z({hash:Tp,treeHash:Tp,message:B(),author:Ep,committer:Ep,parents:ze(Tp),authoredAt:I(),committedAt:I()}),Op=z({name:B(),mode:B(),hash:Tp,type:Ie([`blob`,`tree`,`commit`])}),kp=z({ref:B(),commit:Dp,path:B(),entries:ze(Op)}),Ap=65536,jp=B().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),Mp=B().min(1).max(256),Np={repo:wp,branch:Mp,path:jp},Pp=Ie([`pending`,`synced`,`conflict`,`failed`]),Fp=z({text:B(),revision:I().int().positive(),state:Pp,theirs:z({blob:Tp.nullable(),commit:Tp}).optional(),failure:Ie([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()}),Ip=z({...Np,baseBlob:Tp.nullable(),baseCommit:Tp,text:B().max(Ap),revision:I().int().positive().nullable()}),Lp=fe([z({kind:L(`saved`),revision:I().int().positive(),state:L(`pending`)}),z({kind:L(`synced`),revision:I().int().positive(),commit:Tp}),z({kind:L(`conflict`),revision:I().int().nonnegative(),theirs:Fp.shape.theirs.optional()}),z({kind:L(`failed`),revision:I().int().positive(),reason:Ie([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),z({kind:L(`refused`),reason:Ie([`not-source-writer`,`background-unavailable`])})]),Rp=z({...Np,revision:I().int().positive()}),zp=fe([z({kind:Ie([`discarded`,`not_found`])}),z({kind:L(`conflict`),revision:I().int().positive()})]),Bp=z({settled:ze(z({...Np,result:Lp})),more:j()}),Vp=z({version:I().int().positive().nullable(),commit:Tp,blob:Tp.nullable(),pending:Fp.optional(),ref:B(),path:B(),size:I(),binary:j(),text:B().nullable()}),Hp=z({ref:B(),commits:ze(z({commit:Dp,agent:B().nullable()})),next:B().optional()}),Up=z({ref:B(),commit:Dp,paths:ze(B()),truncated:j()}),Wp=z({kind:L(`rebuilding`)}),Gp=z({done:j(),cursor:B().nullable()}),Kp=fe([z({repository:wp,branch:Mp,path:jp}),z({path:B().min(1).max(1024)})]);function qp(e){let t=Kp.safeParse(Object.fromEntries(e.map(({key:e,value:t})=>[e,t])));return t.success?t.data:null}var Jp=le(me(k({error:f(`too_large`)})));async function Yp(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{ti(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=Re(Ee(Response))(n);if(e.status===413){let t=Jp(await e.text());throw new E(`App file exceeds the read bound`,{code:t._tag===`Some`?`FILE_TOO_LARGE`:`PROTOCOL`,retryable:!1})}if(!e.ok)throw Error(`App file unavailable (${String(e.status)})`);let r=await e.blob();return t.signal?.throwIfAborted(),new File([r],t.name,{type:r.type,lastModified:0})}finally{sd(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function Xp(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{ti(`files.write.abort-close`,e)})};n.signal?.addEventListener(`abort`,a,{once:!0});try{n.signal?.throwIfAborted(),await e.write(t.stream())}finally{n.signal?.removeEventListener(`abort`,a);try{await i()}catch(e){ti(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){ti(`files.write.local-dispose`,e)}}}var Zp=k({path:A,entries:Xe(k({name:A,type:T([`file`,`directory`,`symlink`]),size:Pe,modifiedAt:Pe})),nextOffset:v(Pe)}),Qp=of(`computer.list`,1,M(()=>sf({list:lf(cf(qe().transform(e=>Re(Zp)(e))))}))),$p=_e([k({state:T([`running`,`sleeping`,`starting`])}),k({state:f(`queued`),position:Pe.pipe(R(De()),R(ye(0)))})]),em=k({enabled:o,effective:o,blockedBy:v(T([`team`,`global`]))}),tm=k({computerId:D,name:D,runtime:$p,backends:Xe(k({id:D,kind:T([`platform-container`,`on-box-vm`,`local`]),status:T([`ready`,`queued`,`online`,`offline`]),queuePosition:v(Pe.pipe(R(De()),R(ye(0)))),hostId:v(A),hostLabel:v(A),folderLabel:v(A),detachable:o})),internet:em});of(`computer.instrument.read`,1,M(()=>sf({read:lf(cf(qe().transform(e=>Re(tm)(e))))}))),of(`computer.instrument.control`,1,M(()=>sf({start:lf(cf(qe().transform(e=>Re($p)(e)))),setInternetAccess:lf(cf(qe().transform(e=>Re(em)(e)))),detachLocal:lf(cf(qe().transform(e=>Re(k({detached:o}))(e))))})));var nm=k({ports:Xe(k({port:Pe.pipe(R(De()),R(he({minimum:1,maximum:65535}))),previewUrl:D,openMode:T([`inline`,`external-only`]),expiresAt:Pe.pipe(R(De()),R(ye(0)))})).pipe(R(N(64)))}),rm=_e([nm,k({error:f(`port_previews_not_configured`)})]),im=k({port:Pe.annotate({message:`Use a port from 1 to 65535.`}).check(De({message:`Use a port from 1 to 65535.`}),he({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:o}),am=k({port:Pe.pipe(R(De()),R(he({minimum:1,maximum:65535}))),removed:o});of(`computer.ports`,2,M(()=>sf({list:lf(cf(qe().transform(e=>Re(rm)(e)))),expose:lf(cf(qe().transform(e=>Re(im)(e)))),unexpose:lf(cf(qe().transform(e=>Re(am)(e))))})));var om=T([`synced`,`pending`,`unknown`]),sm=k({port:v(im.fields.port),id:D,command:D,cwd:v(A),startedAt:Pe.pipe(R(De()),R(Me(0))),state:T([`running`,`exited`,`uncertain`]),exitCode:v(Pe.pipe(R(De()))),sync:om,endedAt:v(Pe.pipe(R(De()),R(Me(0))))}),cm=k({processes:Xe(sm)}),lm=k({process:sm,signalled:o});k({requestId:D.pipe(R(N(256))),command:D.pipe(R(N(16384))),cwd:de(A),port:de(im.fields.port)}),of(`computer.processes`,1,M(()=>sf({start:lf(cf(qe().transform(e=>Re(sm)(e)))),list:lf(cf(qe().transform(e=>Re(cm)(e)))),kill:lf(cf(qe().transform(e=>Re(lm)(e))))})));var um=of(`computer.readFile`,1,M(()=>sf({open:lf(sf({response:lf(ue(Response)),close:uf}))})));async function dm(e,t,n){return await Yp(await e.require(um).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function fm(e,t){return Re(Zp)(await e.require(Qp).list(t))}var pm=of(`computer.writeFile`,3,M(()=>sf({open:lf(sf({write:uf,close:uf})),mkdir:uf,replace:lf(cf(qe().transform(e=>Re(mm)(e))))}))),mm=_e([k({kind:f(`replaced`),path:D,bytes:Pe.pipe(R(De()),R(Me(0)))}),k({kind:f(`conflict`)})]);async function hm(e,t,n){n.signal?.throwIfAborted();let r=await e.require(pm).replace(t);if(r.kind===`conflict`)throw new E(`Computer file changed since it was opened`,{code:`CONFLICT`,retryable:!1});return{path:r.path,bytes:r.bytes}}var gm=k({computerName:D.pipe(R(N(256))),teamName:D.pipe(R(N(256))),modelDoor:D.pipe(R(N(256))),uptimeSeconds:Pe.pipe(R(De()),R(Me(0))),version:D.pipe(R(N(64)))});of(`computer.terminal`,2,M(()=>sf({open:lf(sf({information:lf(cf(qe().transform(e=>Re(gm)(e)))),output:lf(ue(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(ue(Uint8Array).parse(e))}})))),input:lf(ue(WritableStream)),resize:uf,close:uf}))})));async function _m(e,t,n){await Xp(await e.require(pm).open({path:t.path}),t.content,n)}var vm={entries:[],index:-1};function ym(e,t){if(t.type===`visit`){if(e.entries[e.index]===t.key)return e;let n=[...e.entries.slice(0,e.index+1),t.key];return{entries:n,index:n.length-1}}if(t.type===`remove`){let n=[],r=-1;return e.entries.forEach((i,a)=>{i!==t.key&&(n.at(-1)!==i&&n.push(i),a<=e.index&&(r=n.length-1))}),{entries:n,index:n.length?Math.max(0,r):-1}}let n=e.index-1;return n<0||n>=e.entries.length?e:{...e,index:n}}var bm={id:`new-draft`,title:`New Draft`,category:`File`,description:`Create a new draft in Inkcap`,projections:{bindings:{values:[`<leader>n`],order:0},menu:{order:0},palette:{order:0}},action:{presentation:{type:`action`}}},xm={id:`save`,title:`Save`,category:`File`,description:`Save the focused Inkcap document`,projections:{bindings:{values:[`mod+s`],order:1},menu:{order:1},palette:{order:1}},action:{presentation:{type:`action`}}},Sm={id:`open-file`,title:`Open File`,category:`File`,description:`Open a file handed off by another App`,projections:{menu:{order:2}},action:{inputSchema:{type:`object`,properties:{computerId:{type:`string`},path:{type:`string`}},required:[`computerId`,`path`],additionalProperties:!1},presentation:{type:`action`}}},Cm=k({computerId:A.check(be(1),N(256)),path:A.check(be(1),N(1024))});function wm(e,t){let n=(0,V.useRef)();(0,V.useEffect)(()=>(n.current={app:e,binding:t},()=>{n.current=void 0}),[e,t]);let r=t.save?.()?.availability(),i=r?.status??`unavailable`,a=r?.status===`unavailable`?r.reason:r?void 0:`No focused savable dirty document.`;tf(e,{sourceId:`inkcap-file`,namespace:`inkcap`},(0,V.useCallback)(()=>{let t=t=>{if(!(!e||t?.aborted||n.current?.app!==e||!Tm(e)))return n.current.binding};return[{...bm,handler:({signal:e})=>{t(e)?.newDraft()}},{...xm,availability:()=>i===`available`?{status:`available`}:{status:`unavailable`,reason:a??`No focused savable dirty document.`},handler:async({signal:e})=>{let n=t(e);if(!n)return;let r=n.save?.();if(!r)throw Error(`No focused savable dirty document.`);let i=r.availability();if(i.status===`unavailable`)throw Error(i.reason);if(!await r.save())throw Error(`No focused savable dirty document.`)}},{...Sm,handler:async({arguments:e,signal:n})=>{let r=t(n);if(!r)return;if(!r.openFile)throw Error(`Inkcap is not ready to open a handed-off file.`);let i;try{i=Re(Cm,{onExcessProperty:`error`})(e)}catch(e){throw Error(`Inkcap open-file arguments are invalid.`,{cause:e})}await r.openFile(i)}}]},[e,i,a]))}function Tm(e){let t=e.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}var Em=new Map([[`png`,`image/png`],[`jpg`,`image/jpeg`],[`jpeg`,`image/jpeg`],[`gif`,`image/gif`],[`webp`,`image/webp`],[`svg`,`image/svg+xml`],[`avif`,`image/avif`]]),Dm=new Map([[`mp4`,`video/mp4`],[`webm`,`video/webm`]]);function Om(e){return Em.get(e.split(`.`).pop()?.toLowerCase()??``)}function km(e){return Dm.get(e.split(`.`).pop()?.toLowerCase()??``)}function Am(e){let t=Om(e);if(t)return{kind:`image`,mediaType:t};let n=km(e);if(n)return{kind:`video`,mediaType:n}}function jm(e){return e.toLowerCase().endsWith(`.md`)}async function Mm(e,t){let n=t?.revision,r=await(await e()).arrayBuffer();if(t?.closed)return{kind:`closed`};if(t&&t.revision!==n)return{kind:`changed`};try{return{kind:`ready`,contents:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(r)}}catch{return{kind:`invalid-text`}}}async function Nm(e,t){let n=t?.revision,r=await e();return t?.closed?{kind:`closed`}:t&&t.revision!==n?{kind:`changed`}:{kind:`ready`,blob:r}}async function Pm(e,t,n,r){let i=()=>dm(e.capabilities,{path:t},{signal:n}),a=Am(t);if(a){let e=await Nm(i,r);return e.kind===`ready`?{kind:a.kind,blob:e.blob.slice(0,e.blob.size,a.mediaType)}:e}let o=await Mm(i,r);return o.kind===`ready`?{kind:`text`,contents:o.contents}:o}var Fm=ee(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Im=ee(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),Lm=ee(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Rm=ee(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),zm=ee(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Bm=ee(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Vm={2:`h2`,3:`h3`,4:`h4`};function Hm(e,t){let{reduced:n}=t,r=e&&!n,i=Te(t,600),[a,o]=(0,V.useState)(r);return(0,V.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var Um=(0,V.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,V.useId)(),p=(0,V.useRef)(null),m=x(p),h=Hm(l===`speech`,m)&&!a,g=Vm[r],_=c?c({speaking:h,thinking:a}):s,v=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,H.jsx)(`p`,{children:n}),i&&i.length>0?(0,H.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(ve,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,H.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,H.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:Ye(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,H.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})}),Wm=(0,V.createContext)(null),Gm=(0,V.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,V.useState)(t),c=r??o,l=(0,V.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,H.jsx)(Wm.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,H.jsx)(`div`,{...i,className:Ye(`w-full`,i.className),ref:a,children:e})})});function Km(){let e=(0,V.useContext)(Wm);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var qm=(0,V.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,H.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:Ye(t===`segmented`?`tabs caps-tabs-segmented w-full`:`tabs tabs-border flex w-full items-center gap-xs`,e),"data-variant":t,ref:r,role:`tablist`})}),Jm=(0,V.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=Km(),c=s.selectedValue===i,l=e=>{let t=e.currentTarget.closest(`[role="tablist"]`);if(!(t instanceof HTMLElement))return;let n=Array.from(t.querySelectorAll(`[role="tab"]`)).filter(e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`),r=n.indexOf(e.currentTarget);if(r<0||n.length===0)return;let a;if(e.key===`ArrowRight`)a=(r+1)%n.length;else if(e.key===`ArrowLeft`)a=(r-1+n.length)%n.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=n.length-1;else return;e.preventDefault();let o=n[a];o?.focus(),o&&s.onValueChange(o.dataset.tabValue??i)};return(0,H.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:Ye(`tab whitespace-nowrap text-base-content transition-colors focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,c&&`tab-active`,e),"data-tab-value":i,disabled:t,id:s.tabId(i),onClick:e=>{n?.(e),!e.defaultPrevented&&!t&&s.onValueChange(i)},onKeyDown:e=>{r?.(e),e.defaultPrevented||l(e)},ref:o,role:`tab`,tabIndex:t?-1:c?0:-1,type:a.type??`button`})}),Ym=(0,V.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=Km(),s=o.selectedValue===r;return!s&&!n?null:(0,H.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:Ye(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})}),Xm=(0,V.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,H.jsx)(`kbd`,{...i,ref:a,className:Ye(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})});(0,V.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,H.jsxs)(`button`,{...l,ref:u,type:c,className:Ye(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,H.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,H.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,H.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,H.jsx)(Xm,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function Zm(e,t){let n=e.trim();return n.startsWith(`/`)?n:`${t.endsWith(`/`)?t:`${t}/`}${n}`}function Qm(e){if(e.endsWith(`/`))return e.replace(/\/+$/,``)||`/`;let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)}var $m=`modulepreload`,eh=function(e,t){return new URL(e,t).href},th={},nh=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=eh(t,n),t=s(t),t in th)return;th[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:$m,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},rh=(0,V.lazy)(async()=>({default:(await nh(()=>import(`./FileTab-X5waGVw9.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).FileTab})),ih=(0,V.lazy)(async()=>({default:(await nh(()=>import(`./InkcapFileTree-CKC4p1cH.js`),__vite__mapDeps([4,1,2,3]),import.meta.url)).InkcapFileTree}));function ah({model:e}){let[t,n]=(0,V.useState)(!0),[r,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),c=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=c.current;if(!e||!(`ResizeObserver`in globalThis))return;let t=()=>{a(e.clientWidth<=576)},n=new ResizeObserver(t);return t(),n.observe(e),()=>{n.disconnect()}},[]);let[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),p=(0,V.useId)(),h=e.sourceLabel??e.context.computerName??`Computer`,g=e.tabs.filter(e=>e.dirty).length;ef(e.connection?.app,[{kind:`text`,id:`documents`,text:`${String(e.tabs.length)} ${e.tabs.length===1?`open file`:`open files`}`},{kind:`text`,id:`save`,text:g?`${String(g)} unsaved`:e.downloadedFile?.tabKey===e.active?`Downloaded ${e.downloadedFile.name}`:e.repositoryStatus??(e.tabs.length?`All changes saved`:`Ready`),end:!0}]);let _=e.tabs.find(t=>t.tabKey===e.active);(0,V.useEffect)(()=>{f(null)},[e.selectedConnection?.app.identity.surfaceId,e.context.computerId,e.context.projectPath]),(0,V.useEffect)(()=>{t&&e.selectedConnection&&e.context.computerId!==null&&e.canList&&u(!0)},[t,e.canList,e.context.computerId,e.selectedConnection]);let v=e.fileTree?.(t=>{e.onOpenFile(t),s(!1)})??(0,H.jsx)(oh,{model:e,treeLoadRequested:l,active:_,computer:h,onOpenFile:t=>{e.onOpenFile(t),s(!1)},onSelectPath:f,onDismissExplorerDialog:()=>{s(!1)}});return(0,H.jsxs)(`main`,{ref:c,className:`inkcap-app`,"aria-label":`Inkcap editor`,onKeyDown:e=>{e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.isContentEditable)&&e.stopPropagation()},children:[e.error?(0,H.jsx)(Uf,{className:`inkcap-notice`,tone:`error`,title:`Couldn't complete that action`,description:e.error}):null,(0,H.jsxs)(`div`,{className:`inkcap-work`,"data-explorer":t,children:[r?(0,H.jsx)(Be,{open:o,onOpenChange:s,children:(0,H.jsxs)(`div`,{className:`inkcap-explorer-rail`,children:[(0,H.jsx)(pe,{render:(0,H.jsx)(i,{size:`sm`,icon:(0,H.jsx)(Bm,{}),"aria-label":`Open file explorer`})}),(0,H.jsxs)(Fe,{className:`inkcap-explorer-dialog`,children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:`File explorer`}),(0,H.jsx)(Se,{children:`Browse files on ${e.sourceLabel??(!e.selectedConnection||e.context.computerId===null?`your Computer`:h)}.`})]}),v,(0,H.jsx)(ce,{children:(0,H.jsx)(Oe,{render:(0,H.jsx)(ve,{variant:`outline`}),children:`Close explorer`})})]})]})}):(0,H.jsx)(`div`,{className:`inkcap-explorer`,id:`${p}-explorer`,hidden:!t,children:v}),(0,H.jsxs)(Gm,{className:`inkcap-editors`,value:e.active===null?``:String(e.active),onValueChange:t=>{let n=e.tabs.find(e=>String(e.tabKey)===t);n&&e.onActivate(n.tabKey)},children:[(0,H.jsxs)(`div`,{className:`inkcap-tab-bar`,children:[r?null:(0,H.jsx)(i,{size:`xs`,variant:`ghost`,className:`inkcap-explorer-toggle`,icon:(0,H.jsx)(Bm,{}),"aria-label":`Toggle file explorer`,title:t?`Hide file explorer`:`Show file explorer`,"aria-expanded":t,"aria-controls":`${p}-explorer`,onClick:()=>{n(e=>!e)}}),(0,H.jsx)(qm,{className:`inkcap-tabs gap-0`,"aria-label":`Editor tabs`,children:e.tabs.map(t=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(Jm,{className:`inkcap-tab`,value:String(t.tabKey),title:t.connection?.source?`${t.path} · ${t.connection.source.label}`:t.path,children:[(0,H.jsx)(Fm,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:t.path.split(`/`).at(-1)}),t.dirty?(0,H.jsx)(`span`,{className:`inkcap-dirty`,"aria-label":`Unsaved changes`}):null]}),(0,H.jsx)(i,{size:`xs`,variant:`ghost`,icon:(0,H.jsx)(m,{}),"aria-label":`Close ${t.path}`,onClick:()=>{e.onClose(t.tabKey)}})]},t.tabKey))}),(0,H.jsx)(`div`,{className:`inkcap-tab-actions`,children:(0,H.jsx)(i,{icon:(0,H.jsx)(Im,{}),"aria-label":`New draft`,title:`New draft (⌘K, then N)`,onClick:e.onNewDraft})})]}),e.tabs.map(t=>(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`p`,{role:`status`,children:`Opening editor…`}),children:(0,H.jsx)(rh,{activityNotice:e.activityNotice?.path===t.path&&e.activityNotice.computerId===t.computerId,onDismissActivityNotice:e.onDismissActivityNotice,path:t.path,initial:t.initial,active:e.active===t.tabKey,narrow:r,local:t.connection===null,savable:t.connection===null||sh(t.connection),sourceLabel:(t.connection??e.selectedConnection)?.source?.kind===`repository`?(t.connection??e.selectedConnection)?.source?.label:void 0,previewUrl:t.previewUrl,previewKind:t.previewKind,target:t.target,syncConflict:t.connection?.source!==void 0&&e.repositoryStates?.get(`${t.connection.source.id}:${t.path}`)?.kind===`conflict`,tabKey:t.tabKey,onSaveBinding:e.onSaveBinding,onReopen:t.connection===null?void 0:()=>{e.onReopen(t)},onSaveAs:async(n,r)=>{let i=d&&e.selectedConnection&&(t.connection===null||t.connection===e.selectedConnection)?Qm(d):t.path.startsWith(`/`)?Qm(t.path):e.context.projectPath,a=(t.connection??e.selectedConnection)?.source?.kind===`repository`?jp.parse(n.trim()):t.connection||e.selectedConnection?Zm(n,i):n.trim();return await e.onSaveAs(t,a,r),a},onPathChange:n=>{e.onPathChange(t,n)},onStatus:(n,r)=>{e.onStatus(t,n,r)},write:(n,r)=>e.onWrite(t,n,r),overwrite:n=>e.onOverwrite(t,n),readCurrent:n=>e.onReadCurrent(t,n)})},t.tabKey)),e.tabs.length===0?(0,H.jsx)(Um,{className:`inkcap-empty`,variant:`panel`,visual:(0,H.jsx)(Fm,{className:`inkcap-empty-icon`}),title:`A little room to think.`,description:`Open a file${e.canList?` from the explorer`:``}, or start with a blank page.`,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ve,{size:`sm`,onClick:e.onNewDraft,children:`New draft`}),(0,H.jsxs)(`span`,{className:`inkcap-shortcut`,children:[(0,H.jsx)(Xm,{size:`sm`,children:lh()}),(0,H.jsx)(`span`,{children:`then`}),(0,H.jsx)(Xm,{size:`sm`,children:`N`})]})]})}):null]})]}),(0,H.jsx)(ch,{open:e.windowClosing||e.closing!==null,all:e.windowClosing,reviewWhileSaving:e.windowClosing?e.tabs.some(e=>e.connection?.source?.kind===`repository`):e.tabs.some(t=>t.tabKey===e.closing&&t.connection?.source?.kind===`repository`),busy:e.windowCloseSaving||e.tabs.some(t=>t.tabKey===e.closing&&t.target.saving),error:e.error,onSave:e.windowClosing?e.onSaveWindowClose:()=>{e.closing!==null&&e.onSaveClose(e.closing)},onDiscard:e.windowClosing?e.onDiscardWindowClose:()=>{e.closing!==null&&e.onDiscardClose(e.closing)},onCancel:e.windowClosing?e.onCancelWindowClose:e.onCancelClose})]})}function oh({model:e,treeLoadRequested:t,active:n,computer:r,onOpenFile:i,onSelectPath:a,onDismissExplorerDialog:o}){return!e.selectedConnection||e.context.computerId===null||!e.canList?(0,H.jsx)(Um,{className:`inkcap-tree inkcap-access`,"aria-label":`File tree`,variant:`panel`,visual:(0,H.jsx)(Lm,{"aria-hidden":`true`}),title:e.selectedConnection?e.context.computerId===null?`No Computer selected`:`Files unavailable`:`No Computer connected`,description:e.selectedConnection?e.context.computerId===null?`No Computer is attached to this window. You can still write a draft.`:`File access isn't granted. Your open documents remain available.`:`No Computer is attached to this window. You can still write a draft.`,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ve,{className:`whitespace-nowrap`,size:`sm`,onClick:e.onNewDraft,children:`New draft`}),e.connection&&e.context.computerId===null&&(0,H.jsx)(ve,{className:`whitespace-nowrap`,size:`sm`,variant:`outline`,onClick:()=>{o(),e.onChooseComputer()},children:`Choose Computer`})]})}):t?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`}),children:(0,H.jsx)(ih,{app:e.selectedConnection.app,rootPath:e.context.projectPath,rootLabel:r,activePath:n?.connection===e.selectedConnection&&n.computerId===e.context.computerId?n.path:null,onOpenFile:i,onSelectPath:a},`${e.selectedConnection.app.identity.surfaceId}:${e.context.computerId}:${e.context.projectPath}`)}):(0,H.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`})}function sh(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function ch({open:e,all:t,busy:n,reviewWhileSaving:r,error:i,onSave:a,onDiscard:o,onCancel:s}){return(0,H.jsx)(Be,{open:e&&!(r&&n),onOpenChange:e=>{!e&&!n&&s()},children:(0,H.jsxs)(Fe,{children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:t?`Close Inkcap with unsaved changes`:`Unsaved changes`}),(0,H.jsx)(Se,{children:t?`Save your changed documents before closing Inkcap?`:`Save your changes before closing this document?`})]}),i?(0,H.jsx)(Uf,{tone:`error`,title:`Couldn't save`,description:i}):null,(0,H.jsxs)(ce,{children:[(0,H.jsx)(ve,{variant:`ghost`,size:`sm`,disabled:n,onClick:s,children:`Cancel`}),(0,H.jsx)(ve,{variant:`ghost`,size:`sm`,disabled:n,onClick:o,children:`Discard`}),(0,H.jsx)(ve,{size:`sm`,disabled:n,onClick:a,children:n?`Saving…`:t?`Save all`:`Save`})]})]})})}function lh(){return/Mac|iPhone|iPad/u.test(navigator.userAgent)?`⌘ K`:`Ctrl K`}var uh={computerId:null,computerName:null,projectPath:`/`},dh={read:(e,t,n,r)=>Pm(e,t,n,r),replace:async(e,t,n)=>{await hm(e.capabilities,t,{signal:n})},write:async(e,t,n,r)=>{await _m(e.capabilities,{path:t,content:new Blob([n],{type:`text/plain;charset=utf-8`})},{signal:r})}};function fh(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function ph(e,t,n,r,i){return!e.aborted&&fh(t)&&(t.source?.kind===`repository`||t.app.context.get().computerId===i)&&(n!==void 0||r===t)}function mh(e,t,n,r){let i=t===void 0?void 0:n.find(e=>e.tabKey===t),a=i?.connection??r;if(!a||!fh(a))return null;let o=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(i&&a.source?.kind!==`repository`&&i.computerId!==o)return null;let s=n.find(t=>t.path===e&&t.connection===a&&t.computerId===o);return t!==void 0&&!i?null:{selected:a,replacement:i,existing:s}}function hh(e,t,n,r,i,a,o,s,c){let l=gh(e,t,r,i);if(l){o(l);return}a!==void 0&&s(r,a),o(``),(e.kind===`image`||e.kind===`video`)&&c(t,``,n,URL.createObjectURL(e.blob),e.kind),e.kind===`text`&&c(t,e.contents,n)}function gh(e,t,n,r){if(e.kind===`changed`||e.kind===`closed`)return e.kind===`changed`?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;let i=n!==void 0&&n.target.revision!==r;if(n?.target.closed||i)return i?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;if(e.kind===`invalid-text`)return`The file ${t} is not valid UTF-8 text. Existing edits remain open.`}function _h({connection:e,context:t=uh,files:n=dh}){let r=W();function i(e){return e.source??{kind:`computer`,id:e.app.context.get().computerId??``,label:`Computer`,read:(t,r,i)=>n.read(e.app,t,r,i),replace:(t,r,i,a)=>n.replace(e.app,{path:t,content:r,expectedContent:i},a),write:(t,r,i)=>n.write(e.app,t,r,i)}}let a=$d(e?.app),o=Qd(e?.app)?.openRequest,s=(0,V.useRef)(new Set),c=e?{...t,computerId:a,computerName:t.computerId===a?t.computerName:null}:t,[l,u]=(0,V.useState)([]),[d,f]=(0,V.useReducer)(ym,vm),p=d.entries[d.index]??null,m=(0,V.useCallback)(()=>d.index<=0?!1:(f({type:`back`}),!0),[d.index]);nf(e?.app.window.navigation,{canGoBack:d.index>0,onBack:m});let h=(0,V.useCallback)(e=>{f({type:`visit`,key:e})},[]),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(``),[ee,te]=(0,V.useState)(null),[ne,w]=(0,V.useState)(null),T=(0,V.useRef)([]),re=(0,V.useRef)(0),D=(0,V.useRef)(new Set),O=(0,V.useRef)(new Set),k=(0,V.useRef)(e),ie=(0,V.useRef)(null),A=(0,V.useRef)(new Map),ae=(0,V.useRef)(()=>Promise.reject(Error(`Inkcap is not ready to open a handed-off file.`))),oe=(0,V.useRef)(null);ie.current=p,(0,V.useEffect)(()=>{k.current=e,w(null);let t=e?.app.lifecycle.subscribe(t=>{(t===`disposing`||t===`disposed`||t===`disconnected`)&&k.current===e&&(k.current=null)});return()=>t?.()},[e,a]),(0,V.useEffect)(()=>()=>{oe.current?.resolve(!1),oe.current=null,k.current=null,A.current.clear();for(let e of D.current)e.abort();D.current.clear()},[]),T.current=l,(0,V.useEffect)(()=>()=>{for(let e of T.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let se=(0,V.useCallback)((e,t,n,r,i,a=!0)=>{let o=++re.current,s=n?.source?.kind===`repository`?null:n?.app.context.get().computerId??null;u(a=>[...a,{tabKey:o,path:e,initial:t,connection:n,computerId:s,previewUrl:r,previewKind:i,dirty:!1,target:{revision:0,closed:!1,dirty:!1,saving:!1}}]),a&&h(o)},[h]),ce=(0,V.useCallback)(()=>{se(`Untitled ${String(re.current+1)}`,``,null)},[se]),le=(0,V.useCallback)(()=>{let e=ie.current;return e===null?void 0:A.current.get(e)},[]);wm(e?.app??null,{newDraft:ce,save:le,openFile:e=>ae.current(e)});function ue(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}function de(e,t){e&&(e.target.closed=!0,ue(e),u(e=>e.filter(e=>e.tabKey!==t)),f({type:`remove`,key:t}))}async function fe(e,t,n,r){if(e.source?.kind===`repository`||t===null)return;let i=await Cp(e.app,t,n,r);k.current===e&&e.app.context.get().computerId===t&&fh(e)&&w(i?null:{computerId:t,path:n})}async function pe(e,t,n=!1){let r=mh(e,t,l,k.current);if(!r)return;let{selected:a,replacement:o,existing:s}=r,c=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(s&&t===void 0){h(s.tabKey);return}if(t!==void 0&&!o)return;let u=`${a.app.identity.surfaceId}:${a.source?.id??c??``}:${e}`;if(O.current.has(u))return;let d=o?.target.revision;O.current.add(u);let f=new AbortController;D.current.add(f);try{let r=await i(a).read(e,f.signal,o?.target);if(!ph(f.signal,a,t,k.current,c))return;let s=!gh(r,e,o,d);hh(r,e,a,o,d,t,C,de,(e,r,i,a,o)=>{se(e,r,i,a,o,!n||ie.current===t)}),!n&&s&&await fe(a,c,e,`opened`)}catch(t){console.error(`Inkcap file read failed`,t),f.signal.aborted||C(t instanceof E&&t.code===`FILE_TOO_LARGE`?a.source?.kind===`repository`?`This repository file is too large to edit in Inkcap. Choose a smaller file. Existing edits remain open.`:`This file is too large to preview in Inkcap. Choose a smaller file. Existing edits remain open.`:`Could not read ${e}. Access may be denied or ${a.source?.label??`the Computer`} unavailable. Existing edits remain open.`)}finally{D.current.delete(f),O.current.delete(u)}}ae.current=async({computerId:e,path:t})=>{if(k.current?.source?.kind===`repository`)throw Error(`Open Computer file handoffs in the Computer source.`);if(k.current?.app.context.get().computerId!==e)throw Error(`The handed-off file belongs to a different admitted Computer.`);await pe(t)};function me(e,t=!1){let n=l.find(t=>t.tabKey===e);if(n){if(n.target.saving){C(`Wait for this save to finish before closing. Your edits remain open.`);return}if(n.target.dirty&&!t){_(e),C(``);return}n.target.closed=!0,ue(n),_(t=>t===e?null:t),u(t=>t.filter(t=>t.tabKey!==e)),f({type:`remove`,key:e})}}(0,V.useEffect)(()=>{if(!e||o?.kind!==`navigate`)return;let t=qp(o.params);if(t===null||`repository`in t)return;let n=JSON.stringify([e.app.identity.surfaceId,o.requestId]);if(s.current.has(n))return;if(s.current.add(n),s.current.size>64){let e=s.current.values().next().value;e!==void 0&&s.current.delete(e)}let r=vp.safeParse({computerId:a,path:t.path});if(!r.success||e.source?.kind===`repository`){C(`This Recent File is unavailable on the current Computer source.`);return}let i=!0;return ae.current(r.data).catch(t=>{console.error(`Inkcap Recent File could not be opened`,et(t)),i&&k.current===e&&C(`This Recent File could not be opened. Your existing documents remain open.`)}),()=>{i=!1}},[e,a,o]);async function j(e,t,n){if(!fh(e))throw Error(`${e.source?.label??`Computer`} disconnected`);if(e.source?.kind!==`repository`&&(t===null||e.app.context.get().computerId!==t)){let e=`Select this file's original Computer before saving or reloading. Your edits remain open.`;throw C(e),Error(e)}let r=new AbortController;D.current.add(r);try{return await n(r.signal)}finally{D.current.delete(r)}}function he(e,t,n,r){return j(e,t,async a=>{await i(e).write(n,r,a),await fe(e,t,n,`edited`)})}async function ge(e,t,n){let r=k.current?.app;if(!r)throw Error(`Download requires a connected App host.`);let i=t.split(`/`).at(-1)??t,a=/\.[^.]+$/.test(i)?i:`${i}.txt`,o=await r.ui.requestBrowserAction({kind:`saveFile`,name:a,mime:`text/plain;charset=utf-8`,bytes:new TextEncoder().encode(n)});if(o.kind===`refused`)throw Error(`Download refused: ${o.reason}`);if(o.kind!==`saved`)throw Error(`The App host did not accept this download.`);te({tabKey:e.tabKey,name:a})}function _e(e,t={}){let n=e.connection;if(n){if(e.target.saving){C(`Wait for this save to finish before reopening.`);return}if(e.target.dirty){C(`Save your edits before reopening this file.`);return}if(!fh(n)){C(`Computer disconnected. Existing edits remain open.`);return}if(n.source?.kind!==`repository`&&n.app.context.get().computerId!==e.computerId){C(`Select this file's original Computer before reopening. Existing edits remain open.`);return}pe(e.path,e.tabKey,t.background)}}let ve=e,ye=ve?.app.capabilities.has(Qp)??!1,M=(0,V.useCallback)((e,t)=>{t?A.current.set(e,t):A.current.delete(e)},[]),be=(0,V.useCallback)(e=>{let t=oe.current;oe.current=null,y(!1),x(!1),t?.resolve(e)},[]),xe=(0,V.useCallback)(()=>{let e=oe.current;if(e)return e.promise;if(!T.current.some(e=>e.target.dirty))return Promise.resolve(!0);if(T.current.some(e=>e.target.saving))return C(`Wait for the current save to finish before closing Inkcap.`),Promise.resolve(!1);let t,n=new Promise(e=>{t=e});return oe.current={promise:n,resolve:t},C(``),y(!0),n},[]),N=(0,V.useCallback)(async()=>{if(!(!oe.current||b)){x(!0);try{for(let e of T.current.filter(e=>e.target.dirty)){let t=A.current.get(e.tabKey);if(!t)throw Error(`A dirty document is unavailable to save.`);if(await t.save(),e.target.dirty)throw Error(`A dirty document could not be saved.`)}be(!0)}catch(e){C(e instanceof Error?`${e.message} Inkcap remains open.`:`A document could not be saved. Inkcap remains open.`),x(!1)}}},[be,b]);return{connection:e,selectedConnection:ve,canList:ye,context:c,error:S,downloadedFile:ee,activityNotice:ne,onDismissActivityNotice:()=>{w(null)},tabs:l,active:p,closing:g,windowClosing:v,windowCloseSaving:b,requestWindowClose:xe,onSaveWindowClose:()=>{N()},onDiscardWindowClose:()=>{be(!0)},onCancelWindowClose:()=>{be(!1)},onNewDraft:ce,onChooseComputer:()=>{let e=k.current?.app;if(!e){C(`The Computer picker requires a connected App host.`);return}e.ui.requestComputerChoice().catch(e=>{console.error(`Inkcap Computer choice failed`,et(e)),C(e instanceof Error?e.message:`Couldn't open the Computer picker.`)})},onOpenFile:e=>{pe(e)},onActivate:h,onClose:e=>{me(e)},onSaveClose:e=>{let t=A.current.get(e);if(!t){C(`This document is no longer available to save.`);return}t.save().catch(e=>{C(e instanceof Error?e.message:`Couldn't save. Your document remains open.`)})},onDiscardClose:e=>{me(e,!0)},onCancelClose:()=>{_(null)},onReopen:_e,onSaveAs:async(e,t,n)=>{let i=e.connection??k.current;if(!i||i.source?.kind!==`repository`&&i.app.context.get().computerId===null){await ge(e,t,n);return}let a=i.source?.kind===`repository`?null:e.connection?e.computerId:i.app.context.get().computerId,o=Ff.of(i.app,`tree`);await he(i,a,t,n),r.invalidateQueries({queryKey:o}),e.connection||u(t=>t.map(t=>t.tabKey===e.tabKey?{...t,connection:i,computerId:a}:t))},onPathChange:(e,t)=>{u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,path:t}:n))},onStatus:(e,t,n)=>{t&&te(t=>t?.tabKey===e.tabKey?null:t),u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,dirty:t}:n)),g===e.tabKey&&!t&&!n&&me(e.tabKey)},onSaveBinding:M,onWrite:async(e,t,n)=>{let r=e.connection;if(!r){await ge(e,e.path,t);return}await j(r,e.computerId,async a=>{await i(r).replace(e.path,t,n,a),await fe(r,e.computerId,e.path,`edited`)})},onOverwrite:async(e,t)=>{if(!e.connection){await ge(e,e.path,t);return}await he(e.connection,e.computerId,e.path,t)},onReadCurrent:async e=>{let t=e.connection;if(!t||e.target.closed)throw Error(`File is no longer open on ${t?.source?.label??`a Computer`}`);return j(t,e.computerId,async n=>{let r=await i(t).read(e.path,n);if(n.aborted||e.target.closed||!fh(t)||t.source?.kind!==`repository`&&t.app.context.get().computerId!==e.computerId)throw Error(`The original ${t.source?.label??`Computer`} is no longer available`);if(r.kind!==`text`)throw Error(`The ${t.source?.label??`Computer`} file could not be read as text`);return r.contents})}}}function vh({connection:e,context:t=uh,onReady:n}){let r=_h({connection:e,context:t});return(0,V.useEffect)(()=>{if(e)return e.app.window.onBeforeClose(r.requestWindowClose)},[e,r.requestWindowClose]),(0,V.useEffect)(()=>{n?.({requestWindowClose:r.requestWindowClose})},[n,r.requestWindowClose]),(0,H.jsx)(ah,{model:r})}var yh=(0,V.forwardRef)(function({className:e,message:t,...n},r){return(0,H.jsxs)(`div`,{...n,className:Ye(`caps-loading-state`,e),ref:r,role:`status`,children:[(0,H.jsx)(He,{decorative:!0,size:`sm`}),(0,H.jsx)(`span`,{children:t})]})}),bh=256;async function xh(e,t,n,r,i){r.throwIfAborted();let a=await n(e,t);if(!Wp.safeParse(a).success)return a;i(!0);try{let i=null,a=!1;for(let e=0;e<bh&&!a;e++){r.throwIfAborted();let e=Gp.parse(await n(`rebuildCopies`,{cursor:i}));a=e.done,i=e.cursor}if(!a)throw new E(`Bonsai is still preparing this repository. Try again shortly.`,{code:`TIMEOUT`,retryable:!0});r.throwIfAborted();let o=await n(e,t);if(Wp.safeParse(o).success)throw Error(`The repository changed while loading. Refresh to retry.`);return o}finally{i(!1)}}function Sh({repository:e,branch:t,request:n,onSaved:r,onSaveState:i}){let a=new Map;async function o(r,i){i.throwIfAborted();let a=Vp.parse(await n(`files.read`,{repo:e,ref:t,path:r}));if(i.throwIfAborted(),a.binary)throw Error(`This Bonsai file is not a text document.`);if(a.text===null&&a.blob!==null)throw new E(`This Bonsai file is too large to edit.`,{code:`FILE_TOO_LARGE`,retryable:!1});return a}async function s(o,s){s.throwIfAborted();let c=Bp.parse(await n(`files.sync`,{}));s.throwIfAborted();let l=c.settled.find(n=>n.repo===e&&n.branch===t&&n.path===o);if(l){if(l.result.kind===`refused`)throw new E(`Bonsai refused sync: ${l.result.reason}`,{code:`CAPABILITY_DENIED`,retryable:l.result.reason===`background-unavailable`});let e=a.get(o);if(l.result.revision!==e?.version)throw new E(`Your saved file changed. Compare before syncing.`,{code:`CONFLICT`,retryable:!0});i(o,l.result)}r()}async function c(c,l,u,d){d.throwIfAborted();let f=a.get(c);if(u===void 0){let e=await o(c,d);f={file:e,contents:e.pending?.text??e.text??``,version:e.version}}if(!f)throw Error(`Reopen this Bonsai file before saving.`);if(u!==void 0&&f.contents!==u)throw new E(`The file baseline changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});if(u!==void 0){let e=await o(c,d);if(e.version!==f.version||(e.pending?.text??e.text??``)!==f.contents)throw new E(`The file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});e.pending===void 0&&(f.file=e)}let p=Ip.parse({repo:e,branch:t,path:c,baseCommit:f.file.commit,baseBlob:f.file.blob,text:l,revision:f.version}),m=Lp.parse(await n(`files.save`,p));if(m.kind===`refused`)throw new E(`Bonsai refused this save: ${m.reason}`,{code:`CAPABILITY_DENIED`,retryable:m.reason===`background-unavailable`});if(i(c,m),m.kind===`conflict`)throw new E(`Your saved file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});a.set(c,{file:f.file,contents:l,version:m.revision}),r(),m.kind===`saved`&&s(c,d).catch(e=>{console.error(`Bonsai sync status could not be refreshed`,e),!(a.get(c)?.version!==m.revision||d.aborted)&&i(c,{kind:`failed`,revision:m.revision,reason:`sync_failed`})})}return{kind:`repository`,id:`${e}:${t}`,label:`${e} · ${t}`,async read(e,t,n){let r=n?.revision,s=await o(e,t);if(n?.closed)return{kind:`closed`};if(n&&n.revision!==r)return{kind:`changed`};let c=s.pending?.text??s.text??``;a.set(e,{file:s,contents:c,version:s.version});let l=s.pending;return l?.state===`pending`?i(e,{kind:`saved`,revision:l.revision,state:`pending`}):l?.state===`conflict`?i(e,{kind:`conflict`,revision:l.revision,theirs:l.theirs}):l?.state===`failed`?i(e,{kind:`failed`,revision:l.revision,reason:l.failure??`sync_failed`}):s.version!==null&&i(e,{kind:`synced`,revision:s.version,commit:s.commit}),{kind:`text`,contents:c}},replace:(e,t,n,r)=>c(e,t,n,r),write:(e,t,n)=>c(e,t,void 0,n),retry:s,async discard(o,s){s.throwIfAborted();let c=a.get(o);if(!c)throw Error(`Reopen this saved file before discarding it.`);if(c.version===null)return;let l=Rp.parse({repo:e,branch:t,path:o,revision:c.version}),u=zp.parse(await n(`files.discard`,l));if(s.throwIfAborted(),u.kind===`conflict`)throw new E(`Your saved file changed. Refresh before discarding.`,{code:`CONFLICT`,retryable:!0});a.delete(o),i(o,null),r()},async readCommitted(e,t){let n=await o(e,t),r=n.text??``;return a.has(e)||a.set(e,{file:n,contents:r,version:n.version}),r}}}async function Ch(e,t,n){let r={repo:t,ref:n},i=kp.parse(await e(`files.tree`,{...r,path:``})),a=Up.parse(await e(`files.list`,r)),o=Hp.parse(await e(`commits.list`,{...r,limit:20}));if(i.commit.hash!==a.commit.hash)throw Error(`The repository changed while loading. Refresh to retry.`);return{head:i.commit.hash,branch:n,files:a.paths.map(e=>({path:e})),history:o.commits.map(e=>e.commit),truncated:a.truncated}}var wh=`file-tree-container`,Th=`data-file-tree-style`,Eh=`data-file-tree-unsafe-css`,Dh=`data-file-tree-scrollbar-measure`,Oh=`data-file-tree-scrollbar-gutter-measured`,kh=`--trees-scrollbar-gutter-measured`,Ah=`header`,jh=`context-menu`,Mh=`context-menu-trigger`,Nh=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Ph(e,t,n){let r=e==null?null:(0,H.jsx)(`div`,{slot:Ah,children:e}),i=t!=null&&n!=null?(0,H.jsx)(`div`,{slot:jh,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,H.jsxs)(H.Fragment,{children:[r,i]})}function Fh(e,t){return typeof window>`u`&&t!=null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,H.jsx)(H.Fragment,{children:e})}function Ih(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Lh(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 Rh({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(n.getComposition()),d=(0,V.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,V.useCallback)(()=>{s(null)},[]),m=(0,V.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,V.useMemo)(()=>Lh(h,e,f,p,m),[h,p,m,f,e]),_=(0,V.useCallback)(e=>{l(e)},[]);(0,V.useEffect)(()=>{f||s(null)},[f]),Nh(()=>{n.setComposition(g)},[g,n]),Nh(()=>{if(c!=null)return r!=null&&Ih(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Fh(Ph(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,H.jsx)(wh,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var zh=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
3
|
+
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
4
|
+
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
5
|
+
</symbol>
|
|
6
|
+
<symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
|
|
7
|
+
<circle cx="3" cy="3" r="3" />
|
|
8
|
+
</symbol>
|
|
9
|
+
<symbol id="file-tree-icon-file" viewBox="0 0 16 16">
|
|
10
|
+
<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=".5"/>
|
|
11
|
+
<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"/>
|
|
12
|
+
</symbol>
|
|
13
|
+
<symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
|
|
14
|
+
<path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
|
|
15
|
+
</symbol>
|
|
16
|
+
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
17
|
+
<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" />
|
|
18
|
+
</symbol>
|
|
19
|
+
</svg>`,Bh=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
20
|
+
<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"/>
|
|
21
|
+
<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"/>
|
|
22
|
+
</symbol>`,Vh=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
23
|
+
<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"/>
|
|
24
|
+
</symbol>`,Hh=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
25
|
+
<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"/>
|
|
26
|
+
<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"/>
|
|
27
|
+
</symbol>`,Uh=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
28
|
+
<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"/>
|
|
29
|
+
</symbol>`,Wh=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
30
|
+
<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"/>
|
|
31
|
+
<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"/>
|
|
32
|
+
</symbol>`,Gh=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
33
|
+
<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"/>
|
|
34
|
+
<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"/>
|
|
35
|
+
<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"/>
|
|
36
|
+
</symbol>`,Kh=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
37
|
+
<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"/>
|
|
38
|
+
</symbol>`,qh=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
39
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
40
|
+
</symbol>`,Jh=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
41
|
+
<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"/>
|
|
42
|
+
</symbol>`,Yh=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
|
|
43
|
+
<path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
|
|
44
|
+
</symbol>`,Xh=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
45
|
+
<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"/>
|
|
46
|
+
<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"/>
|
|
47
|
+
</symbol>`,Zh=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
48
|
+
<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"/>
|
|
49
|
+
<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"/>
|
|
50
|
+
<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"/>
|
|
51
|
+
</symbol>`,Qh=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
52
|
+
<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"/>
|
|
53
|
+
<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"/>
|
|
54
|
+
</symbol>`,$h=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
55
|
+
<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"/>
|
|
56
|
+
<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"/>
|
|
57
|
+
</symbol>`,eg=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
58
|
+
<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"/>
|
|
59
|
+
<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"/>
|
|
60
|
+
</symbol>`,tg=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
61
|
+
<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"/>
|
|
62
|
+
</symbol>`,ng=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
63
|
+
<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"/>
|
|
64
|
+
</symbol>`,rg=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
65
|
+
<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"/>
|
|
66
|
+
</symbol>`,ig=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
67
|
+
<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"/>
|
|
68
|
+
</symbol>`,ag=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
69
|
+
<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"/>
|
|
70
|
+
<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"/>
|
|
71
|
+
</symbol>`,og=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
72
|
+
<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"/>
|
|
73
|
+
<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"/>
|
|
74
|
+
</symbol>`,sg=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
75
|
+
<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"/>
|
|
76
|
+
<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"/>
|
|
77
|
+
</symbol>`,cg=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
78
|
+
<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"/>
|
|
79
|
+
</symbol>`,lg=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
80
|
+
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
81
|
+
</symbol>`,ug=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
82
|
+
<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"/>
|
|
83
|
+
<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"/>
|
|
84
|
+
</symbol>`,dg=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
85
|
+
<defs>
|
|
86
|
+
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
87
|
+
<stop stop-color="currentColor"/>
|
|
88
|
+
<stop offset="1" stop-color="currentColor" stop-opacity="0"/>
|
|
89
|
+
</linearGradient>
|
|
90
|
+
</defs>
|
|
91
|
+
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
92
|
+
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
93
|
+
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
94
|
+
</symbol>`,fg=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
95
|
+
<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"/>
|
|
96
|
+
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
97
|
+
</symbol>`,pg=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
98
|
+
<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"/>
|
|
99
|
+
</symbol>`,mg=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
100
|
+
<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"/>
|
|
101
|
+
</symbol>`,hg=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
102
|
+
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
103
|
+
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
104
|
+
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
105
|
+
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
106
|
+
</symbol>`,gg=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
107
|
+
<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"/>
|
|
108
|
+
<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"/>
|
|
109
|
+
</symbol>`,_g=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
110
|
+
<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"/>
|
|
111
|
+
<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"/>
|
|
112
|
+
</symbol>`,vg=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
113
|
+
<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"/>
|
|
114
|
+
</symbol>`,yg=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
115
|
+
<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"/>
|
|
116
|
+
</symbol>`,bg=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
117
|
+
<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"/>
|
|
118
|
+
</symbol>`,xg=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
119
|
+
<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"/>
|
|
120
|
+
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
121
|
+
</symbol>`,Sg=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
122
|
+
<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"/>
|
|
123
|
+
</symbol>`,Cg=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
124
|
+
<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"/>
|
|
125
|
+
<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"/>
|
|
126
|
+
</symbol>`,wg=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
127
|
+
<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"/>
|
|
128
|
+
<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"/>
|
|
129
|
+
</symbol>`,Tg=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
130
|
+
<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"/>
|
|
131
|
+
</symbol>`,Eg=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
132
|
+
<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"/>
|
|
133
|
+
<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"/>
|
|
134
|
+
</symbol>`,Dg=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
135
|
+
<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"/>
|
|
136
|
+
</symbol>`,Og=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
137
|
+
<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"/>
|
|
138
|
+
</symbol>`,kg=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
139
|
+
<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"/>
|
|
140
|
+
<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"/>
|
|
141
|
+
</symbol>`,Ag=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
142
|
+
<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"/>
|
|
143
|
+
<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"/>
|
|
144
|
+
</symbol>`,jg=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
145
|
+
<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"/>
|
|
146
|
+
</symbol>`,Mg=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
147
|
+
<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"/>
|
|
148
|
+
<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"/>
|
|
149
|
+
<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"/>
|
|
150
|
+
</symbol>`,Ng=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
151
|
+
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
152
|
+
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
153
|
+
</symbol>`,Pg=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
154
|
+
<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"/>
|
|
155
|
+
<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"/>
|
|
156
|
+
<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"/>
|
|
157
|
+
</symbol>`,Fg=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
158
|
+
<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"/>
|
|
159
|
+
<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"/>
|
|
160
|
+
</symbol>`,Ig=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
161
|
+
<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"/>
|
|
162
|
+
</symbol>`,Lg=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
163
|
+
<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"/>
|
|
164
|
+
<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"/>
|
|
165
|
+
</symbol>`,Rg=[Hh,qh,Yh,Xh,Zh,Qh,tg,ng,rg,ag,og,sg,cg,lg,ug,gg,vg,yg,Tg,Eg,kg,Ag,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
166
|
+
<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"/>
|
|
167
|
+
<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"/>
|
|
168
|
+
</symbol>`],zg=[Bh,Vh,Uh,Wh,Gh,Kh,Jh,$h,eg,ig,dg,fg,pg,mg,hg,_g,bg,xg,Sg,Cg,wg,Dg,Og,jg,Mg,Ng,Pg,Fg,Ig,Lg];function Bg(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
169
|
+
`)}\n</svg>`)}var Vg=Bg(zh,Rg),Hg={minimal:zh,standard:Vg,complete:Bg(Vg,zg)},Ug={".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`},Wg={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,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`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,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`,mm:`cpp`,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`},Gg={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Kg=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),qg=new Set([`complete`]);function Jg(e){return Hg[e===`none`?`minimal`:e]}function Yg(e){return`file-tree-builtin-${e}`}function Xg(e){return e!==`none`&&qg.has(e)}function Zg(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Ug[t.toLowerCase()];if(i!=null&&(r||Kg.has(i)))return i;for(let e of n){if(r){let t=Gg[e];if(t!=null)return t}let t=Wg[e];if(t!=null&&(r||Kg.has(t)))return t}return`default`}function Qg(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function $g(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(Qg(e)?`none`:`complete`),colored:e.colored??!0}}var e_={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function t_(e,t){if(typeof e==`number`)return{itemHeight:t??e_.default.itemHeight,factor:e};let n=e_[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var n_=e_.default.itemHeight,r_=`@layer base {
|
|
170
|
+
:host {
|
|
171
|
+
--trees-accent: var(--trees-accent-override, #009fff);
|
|
172
|
+
--trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
|
|
173
|
+
--trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a)));
|
|
174
|
+
--trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
|
|
175
|
+
--trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
|
|
176
|
+
var(--trees-accent) var(--trees-bg-alpha-light, 8%),
|
|
177
|
+
var(--trees-bg)), color-mix(in lab,
|
|
178
|
+
var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
|
|
179
|
+
var(--trees-bg)))));
|
|
180
|
+
--trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
|
|
181
|
+
--trees-added-light: #16a994;
|
|
182
|
+
--trees-added-dark: #00cab1;
|
|
183
|
+
--trees-ignored-light: #adadb1;
|
|
184
|
+
--trees-ignored-dark: #4a4a4e;
|
|
185
|
+
--trees-modified-light: #1ca1c7;
|
|
186
|
+
--trees-modified-dark: #08c0ef;
|
|
187
|
+
--trees-renamed-light: #d5a910;
|
|
188
|
+
--trees-renamed-dark: #ffd452;
|
|
189
|
+
--trees-untracked-light: #16a994;
|
|
190
|
+
--trees-untracked-dark: #00cab1;
|
|
191
|
+
--trees-deleted-light: #ff2e3f;
|
|
192
|
+
--trees-deleted-dark: #ff6762;
|
|
193
|
+
--trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
|
|
194
|
+
--trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
|
|
195
|
+
--trees-density: var(--trees-density-override, 1);
|
|
196
|
+
--trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
|
|
197
|
+
--trees-font-family: var(--trees-font-family-override, system-ui);
|
|
198
|
+
--trees-font-size: var(--trees-font-size-override, 13px);
|
|
199
|
+
--trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
|
|
200
|
+
--trees-font-weight-semibold: var(--trees-font-weight-semibold-override, 600);
|
|
201
|
+
--trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
202
|
+
--trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
|
|
203
|
+
--trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
|
|
204
|
+
--trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
|
|
205
|
+
--trees-search-font-weight: var(--trees-search-font-weight-override, 600);
|
|
206
|
+
--trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
|
|
207
|
+
--trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
|
|
208
|
+
--trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
|
|
209
|
+
--trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
|
|
210
|
+
--trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
|
|
211
|
+
--trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
|
|
212
|
+
--trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
|
|
213
|
+
--trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
|
|
214
|
+
--trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
|
|
215
|
+
--trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
|
|
216
|
+
--trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
|
|
217
|
+
--trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
|
|
218
|
+
--trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
|
|
219
|
+
--trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
|
|
220
|
+
--trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
|
|
221
|
+
--trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
|
|
222
|
+
--trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
|
|
223
|
+
--trees-icon-gray: light-dark(#84848a, #adadb1);
|
|
224
|
+
--trees-icon-red: light-dark(#d52c36, #ff6762);
|
|
225
|
+
--trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
|
|
226
|
+
--trees-icon-orange: light-dark(#d47628, #ffa359);
|
|
227
|
+
--trees-icon-yellow: light-dark(#d5a910, #ffd452);
|
|
228
|
+
--trees-icon-green: light-dark(#199f43, #5ecc71);
|
|
229
|
+
--trees-icon-teal: light-dark(#17a5af, #64d1db);
|
|
230
|
+
--trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
|
|
231
|
+
--trees-icon-blue: light-dark(#1a85d4, #69b1ff);
|
|
232
|
+
--trees-icon-indigo: light-dark(#693acf, #9d6afb);
|
|
233
|
+
--trees-icon-purple: light-dark(#a631be, #d568ea);
|
|
234
|
+
--trees-icon-pink: light-dark(#d32a61, #ff678d);
|
|
235
|
+
--trees-icon-mauve: light-dark(#594c5b, #79697b);
|
|
236
|
+
--trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
237
|
+
--trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
238
|
+
--trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
239
|
+
--trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
240
|
+
--trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
241
|
+
--trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
242
|
+
--trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
243
|
+
--trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
|
|
244
|
+
--trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
245
|
+
--trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
246
|
+
--trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
247
|
+
--trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
248
|
+
--trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
249
|
+
--trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
250
|
+
--trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
251
|
+
--trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
|
|
252
|
+
--trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
253
|
+
--trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
254
|
+
--trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
255
|
+
--trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
256
|
+
--trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
|
|
257
|
+
--trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
258
|
+
--trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
259
|
+
--trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
260
|
+
--trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
261
|
+
--trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
|
|
262
|
+
--trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
263
|
+
--trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
264
|
+
--trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
265
|
+
--trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
266
|
+
--trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
267
|
+
--trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
268
|
+
--trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
|
|
269
|
+
--trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
270
|
+
--trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
271
|
+
--trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
272
|
+
--trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
273
|
+
--trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
|
|
274
|
+
--trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
|
|
275
|
+
--trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
|
|
276
|
+
--trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
277
|
+
--trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
278
|
+
--trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
|
|
279
|
+
--trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
280
|
+
--trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
|
|
281
|
+
--trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
|
|
282
|
+
--trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
|
|
283
|
+
--trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
|
|
284
|
+
--trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
285
|
+
--trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
|
|
286
|
+
--trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
|
|
287
|
+
--trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
|
|
288
|
+
--trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
|
|
289
|
+
--trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
|
|
290
|
+
--trees-icon-width: var(--trees-icon-width-override, 16px);
|
|
291
|
+
--trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
|
|
292
|
+
--trees-row-height: var(--trees-item-height, 30px);
|
|
293
|
+
--trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
|
|
294
|
+
--trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
|
|
295
|
+
--trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
|
|
296
|
+
var(--trees-focus-ring-width));
|
|
297
|
+
--trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
|
|
298
|
+
--trees-padding-inline: var(--trees-padding-inline-override, 16px);
|
|
299
|
+
color-scheme: light dark;
|
|
300
|
+
font-size: var(--trees-font-size);
|
|
301
|
+
color: var(--trees-fg);
|
|
302
|
+
background-color: var(--trees-bg);
|
|
303
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
304
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
305
|
+
font-family: var(--trees-font-family);
|
|
306
|
+
font-weight: var(--trees-font-weight-regular);
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
display: flex;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
:host([data-file-tree-virtualized="true"]) {
|
|
312
|
+
height: 100%;
|
|
313
|
+
overflow: hidden;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
[data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
|
|
317
|
+
flex-direction: column;
|
|
318
|
+
height: 100%;
|
|
319
|
+
display: flex;
|
|
320
|
+
overflow: hidden;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
324
|
+
--trees-scrollbar-thumb-current: transparent;
|
|
325
|
+
scrollbar-gutter: stable;
|
|
326
|
+
overflow-y: auto;
|
|
327
|
+
|
|
328
|
+
&:hover {
|
|
329
|
+
--trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
&::-webkit-scrollbar {
|
|
333
|
+
width: var(--trees-scrollbar-gutter);
|
|
334
|
+
height: var(--trees-scrollbar-gutter);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&::-webkit-scrollbar-track {
|
|
338
|
+
background: none;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&::-webkit-scrollbar-thumb {
|
|
342
|
+
background-color: var(--trees-scrollbar-thumb-current);
|
|
343
|
+
border-radius: calc(var(--trees-scrollbar-gutter) / 2);
|
|
344
|
+
background-clip: content-box;
|
|
345
|
+
border: 1px solid #0000;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&::-webkit-scrollbar-corner {
|
|
349
|
+
background-color: #0000;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
[data-file-tree-scrollbar-measure="true"] {
|
|
354
|
+
visibility: hidden;
|
|
355
|
+
pointer-events: none;
|
|
356
|
+
width: 100px;
|
|
357
|
+
height: 100px;
|
|
358
|
+
position: absolute;
|
|
359
|
+
top: 0;
|
|
360
|
+
left: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@supports ((-moz-appearance: none)) {
|
|
364
|
+
[data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
|
|
365
|
+
scrollbar-width: thin;
|
|
366
|
+
scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
371
|
+
min-height: 0;
|
|
372
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
373
|
+
0px)
|
|
374
|
+
/* NOTE(amadeus): We can assume that all Webkit based browser gutters
|
|
375
|
+
* will align to the value of '--trees-scrollbar-gutter', however if not, then
|
|
376
|
+
* \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
|
|
377
|
+
* hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
|
|
378
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
379
|
+
*/
|
|
380
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
381
|
+
var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
|
|
382
|
+
0px);
|
|
383
|
+
flex: 1 1 0;
|
|
384
|
+
position: relative;
|
|
385
|
+
overflow-y: auto;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@supports ((-moz-appearance: none)) {
|
|
389
|
+
[data-file-tree-virtualized-scroll="true"] {
|
|
390
|
+
padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
391
|
+
0px)
|
|
392
|
+
/* NOTE(amadeus): However on Firefox it can vary a little bit, but most
|
|
393
|
+
* likely the majority of cases will default to a 0px width scrollbar lets
|
|
394
|
+
* inherit that first to avoid SSR jumps. In non-SSR'd environments
|
|
395
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
396
|
+
*/
|
|
397
|
+
max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
398
|
+
var(--trees-scrollbar-gutter-measured, 0px)),
|
|
399
|
+
0px);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
[data-file-tree-sticky-overlay="true"] {
|
|
404
|
+
z-index: 4;
|
|
405
|
+
pointer-events: none;
|
|
406
|
+
height: 0;
|
|
407
|
+
position: sticky;
|
|
408
|
+
top: 0;
|
|
409
|
+
overflow: visible;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
[data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
|
|
413
|
+
visibility: hidden;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
[data-file-tree-sticky-overlay-content="true"] {
|
|
417
|
+
background-color: var(--trees-bg);
|
|
418
|
+
pointer-events: none;
|
|
419
|
+
position: relative;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
[data-file-tree-virtualized-list="true"] {
|
|
423
|
+
background-color: var(--trees-bg);
|
|
424
|
+
overflow-anchor: none;
|
|
425
|
+
width: 100%;
|
|
426
|
+
min-height: 100%;
|
|
427
|
+
position: relative;
|
|
428
|
+
|
|
429
|
+
&[data-is-scrolling] {
|
|
430
|
+
pointer-events: none;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
[data-file-tree-virtualized-sticky-offset="true"] {
|
|
435
|
+
contain: layout size;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
[data-file-tree-virtualized-sticky="true"] {
|
|
439
|
+
isolation: isolate;
|
|
440
|
+
will-change: transform;
|
|
441
|
+
flex-direction: column;
|
|
442
|
+
width: 100%;
|
|
443
|
+
display: flex;
|
|
444
|
+
position: sticky;
|
|
445
|
+
top: 0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
[data-file-tree-search-container] {
|
|
449
|
+
padding: 0;
|
|
450
|
+
padding-inline: var(--trees-padding-inline);
|
|
451
|
+
margin-bottom: var(--trees-item-row-gap);
|
|
452
|
+
display: flex;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
[data-file-tree-search-input] {
|
|
456
|
+
--trees-focus-ring-width: 2px;
|
|
457
|
+
font-family: var(--trees-font-family);
|
|
458
|
+
font-size: var(--trees-font-size);
|
|
459
|
+
height: var(--trees-row-height);
|
|
460
|
+
padding-inline: var(--trees-item-padding-x);
|
|
461
|
+
line-height: var(--trees-row-height);
|
|
462
|
+
color: var(--trees-search-fg);
|
|
463
|
+
background-color: var(--trees-search-bg);
|
|
464
|
+
border: 1px solid var(--trees-border-color);
|
|
465
|
+
border-radius: var(--trees-border-radius);
|
|
466
|
+
outline: none;
|
|
467
|
+
flex: 1;
|
|
468
|
+
margin-block: 1px;
|
|
469
|
+
|
|
470
|
+
&::placeholder {
|
|
471
|
+
color: color-mix(in lab,
|
|
472
|
+
var(--trees-search-fg) 65%,
|
|
473
|
+
var(--trees-search-bg));
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
|
|
477
|
+
outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
|
|
478
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
[role="tree"] {
|
|
483
|
+
gap: var(--trees-gap-override, 0);
|
|
484
|
+
flex-direction: column;
|
|
485
|
+
display: flex;
|
|
486
|
+
position: relative;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
[data-type="item"] {
|
|
490
|
+
color: inherit;
|
|
491
|
+
font-family: var(--trees-font-family);
|
|
492
|
+
font-size: var(--trees-font-size);
|
|
493
|
+
text-align: start;
|
|
494
|
+
background-color: var(--trees-bg);
|
|
495
|
+
padding: 0 var(--trees-item-padding-x);
|
|
496
|
+
margin: 0 var(--trees-item-margin-x);
|
|
497
|
+
cursor: pointer;
|
|
498
|
+
user-select: none;
|
|
499
|
+
-webkit-touch-callout: none;
|
|
500
|
+
touch-action: manipulation;
|
|
501
|
+
flex: 0 0 var(--trees-row-height);
|
|
502
|
+
height: var(--trees-row-height);
|
|
503
|
+
line-height: var(--trees-row-height);
|
|
504
|
+
align-items: center;
|
|
505
|
+
gap: var(--trees-item-row-gap);
|
|
506
|
+
border-radius: var(--trees-border-radius);
|
|
507
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
508
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
509
|
+
--truncate-marker-block-inset: 0px;
|
|
510
|
+
border: none;
|
|
511
|
+
outline: none;
|
|
512
|
+
display: flex;
|
|
513
|
+
position: relative;
|
|
514
|
+
|
|
515
|
+
&:hover, &[data-item-context-hover="true"] {
|
|
516
|
+
background-color: var(--trees-bg-muted);
|
|
517
|
+
--truncate-marker-background-overlay-color: var(--trees-bg-muted);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
&[data-item-focused="true"], &:focus-visible {
|
|
521
|
+
z-index: 2;
|
|
522
|
+
|
|
523
|
+
& [data-item-flattened-subitems] {
|
|
524
|
+
--truncate-marker-block-inset: var(--trees-focus-ring-width);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
&:before {
|
|
528
|
+
content: "";
|
|
529
|
+
border-radius: var(--trees-border-radius);
|
|
530
|
+
outline: var(--trees-focus-ring-width) solid
|
|
531
|
+
var(--trees-focus-ring-color);
|
|
532
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
533
|
+
pointer-events: none;
|
|
534
|
+
display: block;
|
|
535
|
+
position: absolute;
|
|
536
|
+
inset: 0;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
&[data-item-selected="true"]:before {
|
|
540
|
+
outline-color: var(--trees-selected-focused-border-color);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
&[data-item-selected="true"] {
|
|
545
|
+
color: var(--trees-selected-fg);
|
|
546
|
+
background-color: var(--trees-selected-bg);
|
|
547
|
+
--truncate-marker-background-overlay-color: var(--trees-selected-bg);
|
|
548
|
+
z-index: 3;
|
|
549
|
+
|
|
550
|
+
& [data-item-section="icon"] {
|
|
551
|
+
color: var(--trees-selected-fg);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
&[data-item-search-match="true"] {
|
|
556
|
+
font-weight: var(--trees-search-font-weight);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
[data-type="item"][data-file-tree-sticky-row="true"] {
|
|
561
|
+
pointer-events: auto;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
|
|
565
|
+
pointer-events: none;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
|
|
569
|
+
background-color: var(--trees-bg);
|
|
570
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
[data-item-selected="true"]:has( + [data-item-selected="true"]) {
|
|
574
|
+
border-bottom-right-radius: 0;
|
|
575
|
+
border-bottom-left-radius: 0;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
[data-item-selected="true"] + [data-item-selected="true"] {
|
|
579
|
+
border-top-left-radius: 0;
|
|
580
|
+
border-top-right-radius: 0;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
[data-item-flattened-subitems] {
|
|
584
|
+
align-items: center;
|
|
585
|
+
gap: 2px;
|
|
586
|
+
display: inline-flex;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
[data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
|
|
590
|
+
text-decoration: underline;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
[data-item-section="icon"] {
|
|
594
|
+
color: var(--trees-fg-muted);
|
|
595
|
+
fill: currentColor;
|
|
596
|
+
width: var(--trees-icon-width);
|
|
597
|
+
flex-shrink: 0;
|
|
598
|
+
justify-content: center;
|
|
599
|
+
align-items: center;
|
|
600
|
+
display: flex;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
:where([data-item-section="icon"] > [data-icon-token]) {
|
|
604
|
+
color: var(--trees-fg-muted);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
[data-file-tree-colored-icons="true"] {
|
|
608
|
+
& [data-icon-token="astro"] {
|
|
609
|
+
color: var(--trees-file-icon-color-astro);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
& [data-icon-token="babel"] {
|
|
613
|
+
color: var(--trees-file-icon-color-babel);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
& [data-icon-token="bash"] {
|
|
617
|
+
color: var(--trees-file-icon-color-bash);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
& [data-icon-token="biome"] {
|
|
621
|
+
color: var(--trees-file-icon-color-biome);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
& [data-icon-token="bootstrap"] {
|
|
625
|
+
color: var(--trees-file-icon-color-bootstrap);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
& [data-icon-token="browserslist"] {
|
|
629
|
+
color: var(--trees-file-icon-color-browserslist);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
& [data-icon-token="bun"] {
|
|
633
|
+
color: var(--trees-file-icon-color-bun);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
& [data-icon-token="c"] {
|
|
637
|
+
color: var(--trees-file-icon-color-c);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
& [data-icon-token="cpp"] {
|
|
641
|
+
color: var(--trees-file-icon-color-cpp);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
& [data-icon-token="claude"] {
|
|
645
|
+
color: var(--trees-file-icon-color-claude);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
& [data-icon-token="css"] {
|
|
649
|
+
color: var(--trees-file-icon-color-css);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
& [data-icon-token="database"] {
|
|
653
|
+
color: var(--trees-file-icon-color-database);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
& [data-icon-token="default"] {
|
|
657
|
+
color: var(--trees-file-icon-color-default);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
& [data-icon-token="docker"] {
|
|
661
|
+
color: var(--trees-file-icon-color-docker);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
& [data-icon-token="eslint"] {
|
|
665
|
+
color: var(--trees-file-icon-color-eslint);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
& [data-icon-token="git"] {
|
|
669
|
+
color: var(--trees-file-icon-color-git);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
& [data-icon-token="go"] {
|
|
673
|
+
color: var(--trees-file-icon-color-go);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
& [data-icon-token="graphql"] {
|
|
677
|
+
color: var(--trees-file-icon-color-graphql);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
& [data-icon-token="html"] {
|
|
681
|
+
color: var(--trees-file-icon-color-html);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
& [data-icon-token="image"] {
|
|
685
|
+
color: var(--trees-file-icon-color-image);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
& [data-icon-token="javascript"] {
|
|
689
|
+
color: var(--trees-file-icon-color-javascript);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
& [data-icon-token="json"] {
|
|
693
|
+
color: var(--trees-file-icon-color-json);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
& [data-icon-token="markdown"] {
|
|
697
|
+
color: var(--trees-file-icon-color-markdown);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
& [data-icon-token="mcp"] {
|
|
701
|
+
color: var(--trees-file-icon-color-mcp);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
& [data-icon-token="npm"] {
|
|
705
|
+
color: var(--trees-file-icon-color-npm);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
& [data-icon-token="oxc"] {
|
|
709
|
+
color: var(--trees-file-icon-color-oxc);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
& [data-icon-token="postcss"] {
|
|
713
|
+
color: var(--trees-file-icon-color-postcss);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
& [data-icon-token="prettier"] {
|
|
717
|
+
color: var(--trees-file-icon-color-prettier);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
& [data-icon-token="python"] {
|
|
721
|
+
color: var(--trees-file-icon-color-python);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
& [data-icon-token="react"] {
|
|
725
|
+
color: var(--trees-file-icon-color-react);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
& [data-icon-token="ruby"] {
|
|
729
|
+
color: var(--trees-file-icon-color-ruby);
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
& [data-icon-token="rust"] {
|
|
733
|
+
color: var(--trees-file-icon-color-rust);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
& [data-icon-token="sass"] {
|
|
737
|
+
color: var(--trees-file-icon-color-sass);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
& [data-icon-token="svg"] {
|
|
741
|
+
color: var(--trees-file-icon-color-svg);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
& [data-icon-token="svelte"] {
|
|
745
|
+
color: var(--trees-file-icon-color-svelte);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
& [data-icon-token="svgo"] {
|
|
749
|
+
color: var(--trees-file-icon-color-svgo);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
& [data-icon-token="swift"] {
|
|
753
|
+
color: var(--trees-file-icon-color-swift);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
& [data-icon-token="table"] {
|
|
757
|
+
color: var(--trees-file-icon-color-table);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
& [data-icon-token="text"] {
|
|
761
|
+
color: var(--trees-file-icon-color-text);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
& [data-icon-token="tailwind"] {
|
|
765
|
+
color: var(--trees-file-icon-color-tailwind);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
& [data-icon-token="terraform"] {
|
|
769
|
+
color: var(--trees-file-icon-color-terraform);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
& [data-icon-token="typescript"] {
|
|
773
|
+
color: var(--trees-file-icon-color-typescript);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
& [data-icon-token="vite"] {
|
|
777
|
+
color: var(--trees-file-icon-color-vite);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
& [data-icon-token="vscode"] {
|
|
781
|
+
color: var(--trees-file-icon-color-vscode);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
& [data-icon-token="vue"] {
|
|
785
|
+
color: var(--trees-file-icon-color-vue);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
& [data-icon-token="wasm"] {
|
|
789
|
+
color: var(--trees-file-icon-color-wasm);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
& [data-icon-token="webpack"] {
|
|
793
|
+
color: var(--trees-file-icon-color-webpack);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
& [data-icon-token="yml"] {
|
|
797
|
+
color: var(--trees-file-icon-color-yml);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
& [data-icon-token="zig"] {
|
|
801
|
+
color: var(--trees-file-icon-color-zig);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
& [data-icon-token="zip"] {
|
|
805
|
+
color: var(--trees-file-icon-color-zip);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
[data-icon-name="file-tree-icon-chevron"] {
|
|
810
|
+
&[data-align-capitals="false"] {
|
|
811
|
+
transform: translate(0, var(--trees-icon-nudge));
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
&[data-align-capitals="true"] {
|
|
815
|
+
transform: translate(0);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
[data-item-section="content"] {
|
|
820
|
+
text-align: start;
|
|
821
|
+
text-overflow: ellipsis;
|
|
822
|
+
flex: 0 auto;
|
|
823
|
+
min-width: 0;
|
|
824
|
+
max-width: 100%;
|
|
825
|
+
overflow: hidden;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
[data-item-section="decoration"] {
|
|
829
|
+
text-align: end;
|
|
830
|
+
min-width: 0;
|
|
831
|
+
color: var(--trees-fg-muted);
|
|
832
|
+
flex: 1 1 0;
|
|
833
|
+
justify-content: flex-end;
|
|
834
|
+
display: flex;
|
|
835
|
+
overflow: hidden;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
[data-item-section="decoration"] > span {
|
|
839
|
+
text-overflow: ellipsis;
|
|
840
|
+
white-space: nowrap;
|
|
841
|
+
justify-content: flex-end;
|
|
842
|
+
align-items: center;
|
|
843
|
+
min-width: 0;
|
|
844
|
+
max-width: 100%;
|
|
845
|
+
display: inline-flex;
|
|
846
|
+
overflow: hidden;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
[data-item-section="git"], [data-item-section="action"] {
|
|
850
|
+
flex: none;
|
|
851
|
+
justify-content: center;
|
|
852
|
+
align-items: center;
|
|
853
|
+
display: flex;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
[data-item-section="git"] {
|
|
857
|
+
width: var(--trees-git-lane-width);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
[data-item-section="action"] {
|
|
861
|
+
width: var(--trees-action-lane-width);
|
|
862
|
+
color: var(--trees-fg-muted);
|
|
863
|
+
fill: currentColor;
|
|
864
|
+
pointer-events: none;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
[data-item-section="git"] > span, [data-item-section="action"] > span {
|
|
868
|
+
justify-content: center;
|
|
869
|
+
align-items: center;
|
|
870
|
+
width: 100%;
|
|
871
|
+
display: inline-flex;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
[data-item-action-affordance="decorative"] {
|
|
875
|
+
opacity: .85;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
[data-item-rename-input] {
|
|
879
|
+
appearance: none;
|
|
880
|
+
width: 100%;
|
|
881
|
+
min-width: 0;
|
|
882
|
+
height: calc(var(--trees-row-height) - 4px);
|
|
883
|
+
font-family: inherit;
|
|
884
|
+
font-size: inherit;
|
|
885
|
+
color: inherit;
|
|
886
|
+
box-sizing: border-box;
|
|
887
|
+
background-color: #0000;
|
|
888
|
+
border: 0;
|
|
889
|
+
outline: none;
|
|
890
|
+
padding-inline: 6px;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
[data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
|
|
894
|
+
display: none;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
[aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
|
|
898
|
+
&[data-align-capitals="true"] {
|
|
899
|
+
transform: rotate(-90deg)
|
|
900
|
+
translate(calc(var(--trees-icon-nudge) / 2),
|
|
901
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
&[data-align-capitals="false"] {
|
|
905
|
+
transform: rotate(-90deg)
|
|
906
|
+
translate(calc(var(--trees-icon-nudge) / 2 * -1),
|
|
907
|
+
calc(var(--trees-icon-nudge) / 2));
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
[data-item-section="spacing"] {
|
|
912
|
+
height: var(--trees-row-height);
|
|
913
|
+
padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
|
|
914
|
+
flex-direction: row;
|
|
915
|
+
justify-content: center;
|
|
916
|
+
align-items: center;
|
|
917
|
+
display: flex;
|
|
918
|
+
|
|
919
|
+
&:empty {
|
|
920
|
+
padding-left: 0;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
[data-item-section="spacing-item"] {
|
|
925
|
+
border-left: 1px solid var(--trees-indent-guide-bg);
|
|
926
|
+
height: 100%;
|
|
927
|
+
margin-right: calc(var(--trees-level-gap) - 1px);
|
|
928
|
+
opacity: 0;
|
|
929
|
+
transition: opacity .15s;
|
|
930
|
+
display: inline-block;
|
|
931
|
+
transform: translateX(-.25px);
|
|
932
|
+
|
|
933
|
+
& + & {
|
|
934
|
+
margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
:host(:hover) [data-item-section="spacing-item"] {
|
|
939
|
+
opacity: .75;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
[data-item-contains-git-change="true"] > [data-item-section="git"] {
|
|
943
|
+
color: var(--trees-git-modified-color);
|
|
944
|
+
opacity: .5;
|
|
945
|
+
fill: currentColor;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
[data-item-git-status] {
|
|
949
|
+
& > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
|
|
950
|
+
color: var(--trees-item-git-status-color);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
& > [data-item-section="git"] {
|
|
954
|
+
color: var(--trees-item-git-status-color);
|
|
955
|
+
font-weight: var(--trees-font-weight-semibold);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
[data-item-git-status="added"] {
|
|
960
|
+
--trees-item-git-status-color: var(--trees-git-added-color);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
[data-item-git-status="deleted"] {
|
|
964
|
+
--trees-item-git-status-color: var(--trees-git-deleted-color);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
[data-item-git-status="ignored"] {
|
|
968
|
+
--trees-item-git-status-color: var(--trees-git-ignored-color);
|
|
969
|
+
|
|
970
|
+
& > [data-item-section="icon"] {
|
|
971
|
+
opacity: .5;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
[data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
|
|
976
|
+
transform: translateY(calc(.65ex - 50%));
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
[data-item-git-status="modified"] {
|
|
980
|
+
--trees-item-git-status-color: var(--trees-git-modified-color);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
[data-item-git-status="renamed"] {
|
|
984
|
+
--trees-item-git-status-color: var(--trees-git-renamed-color);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
[data-item-git-status="untracked"] {
|
|
988
|
+
--trees-item-git-status-color: var(--trees-git-untracked-color);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
[data-item-drag-target="true"] {
|
|
992
|
+
background-color: var(--trees-selected-bg);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
[data-item-dragging="true"] {
|
|
996
|
+
opacity: .5;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
[data-item-section="lock"] {
|
|
1000
|
+
color: var(--trees-fg-muted);
|
|
1001
|
+
flex: none;
|
|
1002
|
+
align-items: center;
|
|
1003
|
+
margin-left: auto;
|
|
1004
|
+
display: flex;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
[data-item-section="lock"] svg {
|
|
1008
|
+
display: block;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
[data-type="header-slot"] {
|
|
1012
|
+
flex: none;
|
|
1013
|
+
display: block;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
[data-type="context-menu-wash"] {
|
|
1017
|
+
z-index: 3;
|
|
1018
|
+
touch-action: none;
|
|
1019
|
+
background-color: #0000;
|
|
1020
|
+
position: absolute;
|
|
1021
|
+
inset: 0;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
[data-type="context-menu-anchor"] {
|
|
1025
|
+
top: 0;
|
|
1026
|
+
right: var(--trees-context-menu-trigger-inline-offset);
|
|
1027
|
+
z-index: 4;
|
|
1028
|
+
align-items: center;
|
|
1029
|
+
display: none;
|
|
1030
|
+
position: absolute;
|
|
1031
|
+
|
|
1032
|
+
&[data-visible="true"] {
|
|
1033
|
+
display: flex;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
[data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
|
|
1038
|
+
display: none;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
[data-type="context-menu-anchor"] > slot[name="context-menu"] {
|
|
1042
|
+
flex: 0 0 0;
|
|
1043
|
+
width: 0;
|
|
1044
|
+
min-width: 0;
|
|
1045
|
+
display: block;
|
|
1046
|
+
overflow: visible;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
[data-type="context-menu-trigger"] {
|
|
1050
|
+
all: unset;
|
|
1051
|
+
width: var(--trees-action-lane-width);
|
|
1052
|
+
color: var(--trees-fg-muted);
|
|
1053
|
+
fill: currentColor;
|
|
1054
|
+
cursor: pointer;
|
|
1055
|
+
font-family: var(--trees-font-family);
|
|
1056
|
+
font-size: var(--trees-font-size);
|
|
1057
|
+
border-top-right-radius: var(--trees-border-radius);
|
|
1058
|
+
border-bottom-right-radius: var(--trees-border-radius);
|
|
1059
|
+
margin: var(--trees-focus-ring-width);
|
|
1060
|
+
height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
|
|
1061
|
+
border-width: 0;
|
|
1062
|
+
justify-content: center;
|
|
1063
|
+
align-items: center;
|
|
1064
|
+
transition: color .12s;
|
|
1065
|
+
display: flex;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
[data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
|
|
1069
|
+
color: var(--trees-fg);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
[data-truncate-container] {
|
|
1073
|
+
--truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
|
|
1074
|
+
--truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
|
|
1075
|
+
--truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
|
|
1076
|
+
--truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
|
|
1077
|
+
--truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
|
|
1078
|
+
--truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
|
|
1079
|
+
--truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
|
|
1080
|
+
--truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
|
|
1081
|
+
--truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
|
|
1082
|
+
--truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
|
|
1083
|
+
--truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
|
|
1084
|
+
--truncate-internal-single-line-height: 1lh;
|
|
1085
|
+
height: var(--truncate-internal-single-line-height);
|
|
1086
|
+
min-width: 0;
|
|
1087
|
+
margin-top: -1px;
|
|
1088
|
+
margin-bottom: -1px;
|
|
1089
|
+
overflow: hidden;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
[data-truncate-marker] {
|
|
1093
|
+
height: var(--truncate-internal-single-line-height);
|
|
1094
|
+
padding-block: var(--truncate-internal-marker-block-inset);
|
|
1095
|
+
box-sizing: border-box;
|
|
1096
|
+
z-index: 2;
|
|
1097
|
+
color: color-mix(in srgb,
|
|
1098
|
+
currentColor var(--truncate-internal-marker-opacity),
|
|
1099
|
+
transparent);
|
|
1100
|
+
opacity: 0;
|
|
1101
|
+
transition: opacity var(--truncate-internal-marker-fade-out-duration)
|
|
1102
|
+
ease-in-out;
|
|
1103
|
+
background-clip: content-box;
|
|
1104
|
+
align-items: center;
|
|
1105
|
+
display: flex;
|
|
1106
|
+
position: absolute;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
@container measure (height > 1lh) {
|
|
1110
|
+
[data-truncate-marker] {
|
|
1111
|
+
opacity: 1;
|
|
1112
|
+
transition: opacity var(--truncate-internal-marker-fade-in-duration)
|
|
1113
|
+
ease-in-out;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
[data-truncate-grid] {
|
|
1118
|
+
display: grid;
|
|
1119
|
+
position: relative;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
[data-truncate-content="visible"] {
|
|
1123
|
+
white-space: nowrap;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
[data-truncate-content="overflow"] {
|
|
1127
|
+
opacity: 0;
|
|
1128
|
+
pointer-events: none;
|
|
1129
|
+
user-select: none;
|
|
1130
|
+
word-break: break-all;
|
|
1131
|
+
margin-top: calc(-1 * var(--truncate-internal-single-line-height));
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
[data-truncate-marker-cell] {
|
|
1135
|
+
user-select: none;
|
|
1136
|
+
pointer-events: none;
|
|
1137
|
+
overflow: visible;
|
|
1138
|
+
container: measure / size;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
[data-truncate-container="truncate"] {
|
|
1142
|
+
& [data-truncate-grid] {
|
|
1143
|
+
grid-template-columns: minmax(0, max-content) 0;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
& [data-truncate-marker] {
|
|
1147
|
+
right: 0;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
& [data-truncate-fade] {
|
|
1151
|
+
margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
[data-truncate-container="fruncate"] {
|
|
1156
|
+
& [data-truncate-grid] {
|
|
1157
|
+
grid-template-columns: 0 minmax(0, max-content) auto;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
& [data-truncate-content] {
|
|
1161
|
+
direction: rtl;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
& [data-truncate-content] > span {
|
|
1165
|
+
unicode-bidi: plaintext;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
& [data-truncate-fade] {
|
|
1169
|
+
margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
[data-truncate-variant="default"] {
|
|
1174
|
+
& [data-truncate-marker] {
|
|
1175
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1176
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1177
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
& [data-truncate-marker]:after, & [data-truncate-marker]:before {
|
|
1181
|
+
content: "";
|
|
1182
|
+
width: calc(var(--truncate-internal-marker-fade-width) +
|
|
1183
|
+
var(--truncate-internal-marker-gap));
|
|
1184
|
+
height: max(0px,
|
|
1185
|
+
calc(var(--truncate-internal-single-line-height) -
|
|
1186
|
+
var(--truncate-internal-marker-block-inset) * 2));
|
|
1187
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1188
|
+
background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
|
|
1189
|
+
var(--truncate-internal-marker-background-overlay-color));
|
|
1190
|
+
-webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1191
|
+
#000 0%,
|
|
1192
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1193
|
+
transparent 100%);
|
|
1194
|
+
mask-image: linear-gradient(var(--truncate-internal-fade-dir),
|
|
1195
|
+
#000 0%,
|
|
1196
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1197
|
+
transparent 100%);
|
|
1198
|
+
position: absolute;
|
|
1199
|
+
inset-block-start: var(--truncate-internal-marker-block-inset);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
& [data-truncate-marker]:after {
|
|
1203
|
+
--truncate-internal-fade-dir: to right;
|
|
1204
|
+
right: calc(-1 *
|
|
1205
|
+
(
|
|
1206
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1207
|
+
var(--truncate-internal-marker-gap)
|
|
1208
|
+
));
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
& [data-truncate-marker]:before {
|
|
1212
|
+
--truncate-internal-fade-dir: to left;
|
|
1213
|
+
left: calc(-1 *
|
|
1214
|
+
(
|
|
1215
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1216
|
+
var(--truncate-internal-marker-gap)
|
|
1217
|
+
));
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
[data-truncate-variant="fade"] {
|
|
1222
|
+
& [data-truncate-marker] {
|
|
1223
|
+
background: none;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
[data-truncate-fade] {
|
|
1228
|
+
box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
|
|
1229
|
+
var(--truncate-internal-fade-marker-color),
|
|
1230
|
+
0 0 var(--truncate-internal-fade-marker-width)
|
|
1231
|
+
var(--truncate-internal-fade-marker-color);
|
|
1232
|
+
width: calc(var(--truncate-internal-fade-marker-width) * 2);
|
|
1233
|
+
height: calc(var(--truncate-internal-single-line-height) -
|
|
1234
|
+
(var(--truncate-internal-fade-marker-width) * 2));
|
|
1235
|
+
margin: var(--truncate-internal-fade-marker-width) 0;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
[data-truncate-group-container="middle"] {
|
|
1239
|
+
& [data-truncate-container] {
|
|
1240
|
+
--truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
min-width: 0;
|
|
1244
|
+
display: flex;
|
|
1245
|
+
|
|
1246
|
+
& > div {
|
|
1247
|
+
min-width: 0;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
& > div[data-truncate-segment-priority="1"] {
|
|
1251
|
+
flex: 0 1 max-content;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
& > div[data-truncate-segment-priority="2"] {
|
|
1255
|
+
flex: 0 999999 max-content;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
@layer theme, unsafe;
|
|
1261
|
+
`,i_=`@layer base, unsafe;`;function a_(e){return`${i_}
|
|
1262
|
+
@layer base {
|
|
1263
|
+
${e}
|
|
1264
|
+
}`}function o_(e){return`${i_}
|
|
1265
|
+
@layer unsafe {
|
|
1266
|
+
${e}
|
|
1267
|
+
}`}var s_=new WeakMap;function c_(e){let t=s_.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(Dh,`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(),s_.set(e,i),i}function l_(e,t){if(!e.isConnected)return;let n=c_(t);if(n==null)return;let r=t.querySelector(`style[${Oh}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Oh,``),t.appendChild(i)),i.textContent=`:host { ${kh}: ${n}px; }`}var u_;function d_(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){u_??(u_=new CSSStyleSheet,u_.replaceSync(a_(r_)));let t=!1;try{e.adoptedStyleSheets=[u_],t=!0}catch{}if(t){e.querySelector(`style[${Th}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Th,``),t.textContent=a_(r_),e.prepend(t)}}function f_(e,t){p_(e,t),d_(t),l_(e,t)}function p_(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`});f_(this,e)}}if(customElements.define(wh,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(wh)))e instanceof HTMLElement&&f_(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var m_=5,h_=32,g_=128;function __(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function v_(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function y_(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 b_(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 x_(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function S_(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 C_(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,D_(e,t)}function w_(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=b_(e).get(t);if(i===void 0)return;let a=i>>m_;e.childVisibleChunkSums[a]+=r}function T_(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=O_(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=h_}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 E_(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>m_;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<m_}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 D_(e,t){if(t.childIds.length<g_){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/h_),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>>m_]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function O_(e,t,n,r){let i=Math.min(t.childIds.length,n+h_),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 k_=7,A_=3,j_=8,M_=4;function N_(e,t,n=0){return e<<M_|n<<A_|t}function P_(e){return e.depthAndFlags>>>M_}function F_(e){return(e.depthAndFlags&j_)>>A_}function Y(e){return(e.depthAndFlags&j_)!==0}function I_(e){return e.depthAndFlags&k_}function L_(e,t){return(I_(e)&t)!==0}function R_(e,t){e.depthAndFlags|=t}function z_(e,t){e.depthAndFlags=N_(t,I_(e),F_(e))}var B_=Symbol(`benchmarkInstrumentation`);function V_(e,t){return t==null||Object.defineProperty(e,B_,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function H_(e){return e==null?null:e[B_]??null}function X(e,t,n){return e==null?n():e.measurePhase(t,n)}function U_(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function W_(e){return e>=48&&e<=57}function G_(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!W_(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&&W_(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 K_(e){let t=e.toLowerCase();return{lowerValue:t,tokens:G_(t)}}function q_(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 J_(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=q_(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Y_(e,t,n){let r=J_(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function X_(e,t){return Y_(e,t,K_)}function Z_(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Q_(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=Z_(e,r);return a===Z_(t,r)?X_(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 $_(e,t){return Q_(e,t)}function ev(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=K_(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=Z_(e,n);return o===Z_(t,n)?Y_(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 tv(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=K_(r);return e.sortKeyById[t]=i,i}function nv(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function rv(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 iv(e){let{hasTrailingSlash:t,segments:n}=rv(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function av(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=rv(e);return{requiresDirectory:t,segments:n}}function ov(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[K_(``)]}}function sv(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 cv(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var lv=Symbol(`pathStorePreparedInputKind`);function uv(e,t){return e[lv]=t,e}function dv(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function fv(e,t,n){return n==="default"?$_(e,t):n(dv(e),dv(t))}function pv(){return{depthAndFlags:N_(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function mv(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 hv(e){return e.isDirectory?e.segments.length:e.segments.length-1}function gv(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 _v(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function vv(e,t={}){return wv(e,t).map(e=>e.path)}function yv(e,t={}){let n=wv(e,t);return uv({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function bv(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 uv({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function xv(e){let t=e,n=t.preparedPaths;if(t[lv]===`prepared`&&n!=null)return n;if(!gv(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Sv(e){let t=e;return t[lv]===`presorted`&&t.presortedPaths!=null||_v(t.presortedPaths)?t.presortedPaths:null}function Cv(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function wv(e,t={}){let n=nv(t),r=H_(t);U_(r,`workload.inputFiles`,e.length);let i=X(r,`store.preparePathEntries.parse`,()=>e.map(e=>iv(e)));return X(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>fv(e,t,n.sort))),i}var Tv=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[pv()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=ov();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=H_(e),this.options=nv(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,__())}appendPaths(e){return X(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>iv(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,X(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return X(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:N_(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:N_(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}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:N_(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=iv(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:N_(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:N_(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=iv(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(X(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||X(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"?ev(this.lastPreparedPath,e,this.segmentSortKeyCache):fv(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=hv(e),i=n==null?0:hv(n),a=n==null?0:mv(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=sv(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:N_(P_(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),x_(i,s),s}createFileChildUnchecked(e,t){let n=sv(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:N_(P_(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),x_(r,a),a}getOrCreateDirectoryChild(e,t){let n=sv(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&&!Y(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:N_(P_(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),x_(r,a),this.directories.set(a,__()),a}createDirectoryChild(e,t){let n=sv(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:N_(P_(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),x_(r,a),this.directories.set(a,__()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Y(n))throw Error(`Path is not a directory: "${t}"`);if(L_(n,1))throw Error(`Duplicate path: "${t}"`);R_(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,v_());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Y(a)){let t=v_();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;Y(n)&&this.directories.set(t,__());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),x_(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Y(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 C_(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Ev(e,t=`closed`,n=null){let r=Ov(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 Dv(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Ov(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 kv(e,t){return L_(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&P_(t)<=e.defaultExpansion}function Av(e,t,n=e.snapshot.nodes[t]){return n==null||!Y(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:kv(e,n)}function jv(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Y(r))return;let i=kv(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 Mv(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 Nv(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Pv(e,t){let n=Mv(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 Fv(e,t){let n=Mv(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Iv(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 Lv(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Rv(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 zv(e,t){e.directoryLoadInfoById.delete(t)}function Bv(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 Vv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Hv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Uv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Wv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Gv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Kv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function qv(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 Jv(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 Yv(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 Xv(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 Zv(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 Qv(e,t,n){return{...n,visibleCountDelta:ly(e)-t}}function $v(e,t){let n=ly(e),r=Dv();e.transactionStack.push(r);try{t()}catch(t){throw ny(e,r,!1),t}ny(e,r,!0,ly(e)-n)}function ey(e,t){let n=e.instrumentation;if(n==null){ty(e,t);return}X(n,`store.events.record`,()=>ty(e,t))}function ty(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){sy(e,t);return}n.events.push(t),oy(n,t)}function ny(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?ay(i,t):X(n,`store.events.batch.merge`,()=>ay(i,t));return}let a=ry(t,r),o=e.instrumentation;if(o==null){sy(e,a);return}X(o,`store.events.batch.commit`,()=>sy(e,a))}function ry(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 iy(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function ay(e,t){for(let n of t.events)e.events.push(n);iy(e,t)}function oy(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function sy(e,t){let n=e.instrumentation;if(n==null){cy(e,t);return}X(n,`store.events.emit`,()=>cy(e,t))}function cy(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function ly(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function uy(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Y(n)||L_(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||!Y(a)?null:i}function dy(e,t){let n=t;for(;;){let t=uy(e,n);if(t==null)return n;n=t}}function fy(e,t){let n=[t],r=t;for(;;){let t=uy(e,r);if(t==null)return n;n.push(t),r=t}}function py(e,t){let n=t==null?e.snapshot.rootId:Cy(e,t);return n==null?[]:Ey(e,n)}function my(e,t){let n=iv(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Vy(e,By(e,r)),{createdNodeIds:a,directoryId:o}=Dy(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=Z(e,o);if(L_(n,1))throw Error(`Path already exists: "${t}"`);R_(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=ky(e,o,n.basename),s.add(c);by(e,o);let l=Vy(e,o);return Vv({affectedAncestorIds:Sy(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Hy(i,l)})}function hy(e,t,n){let r=Cy(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=Z(e,r);if(L_(i,2))throw Error(`The root node cannot be removed`);if(Y(i)&&Ty(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Vy(e,a),s=Ry(e,r);My(e,a,r,i.nameId),zy(e,a),by(e,a);let c=Vy(e,a);return Hv({affectedAncestorIds:Sy(e,a),affectedNodeIds:s,path:t,projectionChanged:Hy(o,c),recursive:n.recursive===!0})}function gy(e,t,n,r){let i=Cy(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=Z(e,i);if(L_(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Iy(e,i,n),c=Vy(e,a.parentId),l=Vy(e,s.parentId),u=cv(e.snapshot.segmentTable,a.nameId),d=sv(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Y(a)&&Ky(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=y_(e.snapshot.nodes,Ty(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Ly(e,p,o,F_(a))===`skip`)return null;let m=a.parentId;My(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Gy(e,i),jy(e,s.parentId,i),zy(e,m),e.pathCacheVersion++,by(e,m),s.parentId!==m&&by(e,s.parentId);let h=Vy(e,m),g=Vy(e,s.parentId);return Uv({affectedAncestorIds:[...new Set([...Sy(e,m),...Sy(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Uy([c,l],[h,g]),to:yy(e,i)})}function _y(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function vy(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function yy(e,t){let n=Z(e,t),r=_y(e,t);if(r!=null)return r;if(L_(n,2))return vy(e,t,``);let i=yy(e,n.parentId),a=cv(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return vy(e,t,Y(n)?`${o}/`:o)}function by(e,t){let n=e.instrumentation;if(n==null){Jy(e,t);return}X(n,`store.recomputeCountsUpwardFrom`,()=>Jy(e,t))}function xy(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||!Y(o)){qy(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){qy(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Sy(e,t){let n=[],r=t;for(;r!=null;){let t=Z(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Cy(e,t){if(t.length===0)return e.snapshot.rootId;let n=av(t);return wy(e,n.segments,n.requiresDirectory)}function wy(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=Ty(e,r),a=y_(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=Z(e,r);return n&&!Y(i)?null:r}function Ty(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 Z(e,t){let n=e.snapshot.nodes[t];if(n===void 0||L_(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ey(e,t){let n=e.snapshot.nodes[t];if(n===void 0||L_(n,4))return[];if(!Y(n))return[yy(e,t)];if(Ty(e,t).childIds.length===0)return L_(n,1)&&!L_(n,2)?[yy(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||L_(n,4)){i.pop();continue}if(!Y(n)){r.push(yy(e,t.nodeId)),i.pop();continue}let a=Ty(e,t.nodeId);if(a.childIds.length===0){L_(n,1)&&!L_(n,2)&&r.push(yy(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 Dy(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=sv(e.snapshot.segmentTable,i),a=Ty(e,r),o=y_(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Y(Z(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Oy(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Oy(e,t,n){let r=Z(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:N_(P_(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,__()),jy(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function ky(e,t,n){let r=sv(e.snapshot.segmentTable,n),i=Ty(e,t);if(y_(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Xy(e,t,n)}"`);let a=Z(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:N_(P_(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),jy(e,t,o),e.activeNodeCount++,o}function Ay(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}Ny(e,n,o)<0?i=a:r=a+1}return r}function jy(e,t,n){let r=Ty(e,t),i=Z(e,n);y_(e.snapshot.nodes,r).set(i.nameId,n),w_(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Ay(e,r,n);r.childIds.splice(a,0,n),S_(r,a),D_(e.snapshot.nodes,r)}function My(e,t,n,r){let i=Ty(e,t),a=b_(i),o=a.get(n)??-1;y_(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&w_(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),S_(i,o),D_(e.snapshot.nodes,i))}function Ny(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Py(e,t,n):r(Fy(e,t),Fy(e,n))}function Py(e,t,n){let r=Z(e,t),i=Z(e,n),a=Y(r);if(a!==Y(i))return a?-1:1;let o=J_(tv(e.snapshot.segmentTable,r.nameId),tv(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=cv(e.snapshot.segmentTable,r.nameId),c=cv(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Fy(e,t){let n=Z(e,t),r=yy(e,t),i=Y(n),a=i?r.slice(0,-1):r;return{basename:cv(e.snapshot.segmentTable,n.nameId),depth:P_(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Iy(e,t,n){let r=Z(e,t),i=Cy(e,n);if(i!=null){let t=Z(e,i);if(Y(t))return{basename:cv(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=av(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=av(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:wy(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Ly(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${yy(e,t)}"`);let i=Z(e,t);if(F_(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Y(i)&&Ty(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Ry(e,t),My(e,a,t,o),zy(e,a),by(e,a),`handled`}function Ry(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=Z(e,t.nodeId);if(t.visitedChildren||!Y(i)){Y(i)&&e.snapshot.directories.delete(t.nodeId),R_(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),zv(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Ty(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 zy(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||L_(t,2)||Ty(e,n).childIds.length>0)return;R_(t,1),n=t.parentId===n?null:t.parentId}}function By(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=y_(e.snapshot.nodes,Ty(e,n)).get(t);if(i==null||!Y(Z(e,i)))break;n=i}return n}function Vy(e,t){let n=Wy(e,t);if(n==null)return null;let r=dy(e,n),i=Z(e,r),a=n===r?null:fy(e,n).map(t=>yy(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Ty(e,r).childIds.length>0,path:yy(e,r),terminalKind:F_(i)})}function Hy(e,t){return Uy([e],[t])}function Uy(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 Wy(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||L_(t,2))return null;if(!Av(e,n,t))return n;n=t.parentId}return null}function Gy(e,t){let n=Z(e,t);if(z_(n,(t===e.snapshot.rootId?-1:P_(Z(e,n.parentId)))+1),!Y(n))return;let r=Ty(e,t);for(let t of r.childIds)Gy(e,t)}function Ky(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=Z(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function qy(e,t,n=Z(e,t),r=!1){let i=e.instrumentation;if(i==null){Yy(e,t,n,r);return}X(i,`store.recomputeNodeCounts`,()=>Yy(e,t,n,r))}function Jy(e,t){let n=t;for(;n!=null;){let t=Z(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(qy(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&w_(Ty(e,s),n,a,o),n=s}}function Yy(e,t,n,r){if(!Y(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Ty(e,t);if(r){let t=e.instrumentation;t==null?C_(e.snapshot.nodes,i):X(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>C_(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,L_(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=uy(e,t)==null?Av(e,t,n)?1+o:1:o}function Xy(e,t,n){let r=yy(e,t);return r.length===0?n:`${r}${n}`}function Zy(e){return e!=null&&!L_(e,4)}function Qy(e,t){let n=e.snapshot.nodes[t];return!Zy(n)||!Y(n)||L_(n,2)?null:n}function $y(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Zy(e.snapshot.nodes[n])&&(t+=1);return t}function eb(e){return Math.max(0,e.valueById.length-1)}function tb(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:$y(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:eb(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function nb(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 rb(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Qy(e,n)!=null&&t.push(yy(e,n));for(let t of e.expandedDirectoryIds)Qy(e,t)!=null&&n.push(yy(e,t));return{collapsedPaths:t,expandedPaths:n}}function ib(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Qy(e,n)!=null&&Nv(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:yy(e,n)});return t}function ab(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Cy(e,n);t!=null&&jv(e,t,!0,Z(e,t))}for(let n of t.collapsedPaths){let t=Cy(e,n);t!=null&&jv(e,t,!1,Z(e,t))}}function ob(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Cy(e,n.path);t!=null&&Qy(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function sb(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function cb(e){let t=e.snapshot.segmentTable,n=ov();for(let r of e.snapshot.nodes)if(Zy(r)){if(L_(r,2)){r.nameId=0;continue}r.nameId=sv(n,cv(t,r.nameId))}e.snapshot.segmentTable=n}function lb(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Zy(r)||!Y(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Zy(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[Z(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),C_(e.snapshot.nodes,n)}}function ub(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Zy(n))break;--t}e.snapshot.nodes.length=t+1}function db(e){let t=rb(e),n=ib(e);X(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>sb(e)),X(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>cb(e)),X(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>lb(e)),X(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>ub(e)),X(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ab(e,t)),X(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ob(e,n)),X(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>xy(e,e.snapshot.rootId))}function fb(e){let t=rb(e),n=ib(e),r=X(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>py(e)),i=V_({...e.snapshot.options},e.instrumentation),a=X(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Tv(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,X(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ab(e,t)),X(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ob(e,n)),X(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>xy(e,e.snapshot.rootId))}function pb(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function mb(e,t){let n=tb(e);t===`stable`?X(e.instrumentation,`store.cleanup.stable`,()=>db(e)):X(e.instrumentation,`store.cleanup.aggressive`,()=>fb(e));let r=tb(e);return nb(t,t===`stable`,n,r)}var hb=64;function gb(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 _b(e){return Z(e,e.snapshot.rootId).visibleSubtreeCount}function vb(e,t,n,r){let i=Z(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function yb(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Rb(e,t.cursor),setSize:t.setSize,subtreeEndIndex:vb(e,t.cursor,t.index,n)}}function bb(e,t,n,r,i,a){let o=Ty(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=T_(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return xb(e,u,l,r+c,i+1,s,o.childIds.length,a)}function xb(e,t,n,r,i,a,o,s){if(!Y(Z(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=Mb(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=Z(e,c.terminalNodeId);if(!Y(l)||!Av(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return bb(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Sb(e,t){let n=_b(e);if(t<0||t>=n)return null;let r=bb(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>yy(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=yb(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Rb(e,r.cursor),setSize:r.setSize,subtreeEndIndex:vb(e,r.cursor,r.index,n)}}function Cb(e,t,n){let r=e.instrumentation,i=_b(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 Lb(e,o+1);let t=[],n=kb(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Rb(e,n);t.push(r),n=Pb(e,n)}return t}let s=[],c=0,l=0,u=X(r,`store.getVisibleSlice.selectFirstRow`,()=>kb(e,a));for(let t=a;t<=o&&u!=null;t++){let t=X(r,`store.getVisibleSlice.materializeRow`,()=>Rb(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=X(r,`store.getVisibleSlice.advanceCursor`,()=>Pb(e,u))}return U_(r,`workload.visibleRowsRead`,s.length),U_(r,`workload.flattenedRowsRead`,c),U_(r,`workload.flattenedSegmentsRead`,l),s}function wb(e,t=_b(e)){let n=e.instrumentation;return n==null?Ib(e,t):X(n,`store.getVisibleTreeProjection`,()=>Ib(e,t))}function Tb(e){return Fb(wb(e))}function Eb(e,t){let n=Cy(e,t);if(n==null||n===e.snapshot.rootId||Y(Z(e,n))&&dy(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=Z(e,i).parentId,n=Ty(e,t),s=b_(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=E_(a,n,s),t!==o){let n=Z(e,t),a=uy(e,t);if(!Av(e,t,n)&&a!==i)return null;dy(e,t)===t&&(r+=1)}i=t}return r}function Db(e,t){let n=Cy(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return Av(e,n,r)?null:(jv(e,n,!0,r),by(e,n),Wv({affectedAncestorIds:Sy(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Ob(e,t){let n=Cy(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return Av(e,n,r)?(jv(e,n,!1,r),by(e,n),Gv({affectedAncestorIds:Sy(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function kb(e,t){return t<0||t>=_b(e)?null:Ab(e,e.snapshot.rootId,t,-1)}function Ab(e,t,n,r){let i=Ty(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?T_(e.snapshot.nodes,i,n):X(a,`store.getVisibleSlice.selectChildIndex`,()=>T_(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return jb(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function jb(e,t,n,r){if(!Y(Z(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=Mb(e,t,r);if(n===0)return i;let a=Z(e,i.terminalNodeId);if(!Y(a)||!Av(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ab(e,i.terminalNodeId,n-1,i.visibleDepth)}function Mb(e,t,n){return Y(Z(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:dy(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:X(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>dy(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Nb(e,t){let n=Z(e,t);if(!Y(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||uy(e,r)!==t}function Pb(e,t){let n=Z(e,t.terminalNodeId);if(Y(n)){let r=Ty(e,t.terminalNodeId);if(Av(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:jb(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=Z(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Ty(e,n),o=b_(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 jb(e,s,0,i);Nb(e,r)&&i--,r=n}}function Fb(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 Ib(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(hb);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=gb(o,y);let x,S=_;if(Y(v))S=f?dy(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:yy(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&&Y(C)&&Av(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 Lb(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(!Y(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:yy(e,f)};continue}let h=l?dy(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Rb(e,g);let _=i[h];_!=null&&Y(_)&&Av(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Rb(e,t){let n=Z(e,t.terminalNodeId),r=Y(n)?zb(e,t):null,i=yy(e,t.terminalNodeId),a=cv(e.snapshot.segmentTable,n.nameId),o=Y(n)&&Ty(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?fy(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:cv(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yy(e,n)}}):X(c,`store.getVisibleSlice.flatten.collectSegments`,()=>fy(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:cv(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yy(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Y(n)&&Av(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Y(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function zb(e,t){if(t.headNodeId===t.terminalNodeId)return Nv(e,t.terminalNodeId);let n=fy(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Nv(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var Bb=8;function Vb(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function Hb(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&Bb)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&Bb)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function Ub(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||!Y(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&&D_(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Y(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,D_(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Wb(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Vb(e.snapshot);Hb(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&D_(n,i)}}function Gb(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Kb=class e{#e;constructor(e={}){let t=H_(e),n=X(t,`store.builder.create`,()=>new Tv(e));if(e.preparedInput!=null){let t=Sv(e.preparedInput);t==null?n.appendPreparedPaths(xv(e.preparedInput),!1):n.appendPresortedPaths(t,Cv(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(X(t,`store.preparePathEntries`,()=>wv(r,e)))}let r=X(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=X(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=X(t,`store.state.create`,()=>Ev(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:X(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Gb(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&X(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?X(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Wb(this.#e)):X(t,`store.state.initializeOpenVisibleCounts`,()=>Ub(this.#e)):X(t,`store.state.recomputeCounts`,()=>xy(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return vv(e,t)}static prepareInput(e,t={}){return yv(e,t)}static preparePresortedInput(e){return bv(e)}list(e){return X(this.#e.instrumentation,`store.list`,()=>py(this.#e,e))}add(e){X(this.#e.instrumentation,`store.add`,()=>{let t=_b(this.#e);ey(this.#e,Qv(this.#e,t,my(this.#e,e)))})}remove(e,t={}){X(this.#e.instrumentation,`store.remove`,()=>{let n=_b(this.#e);ey(this.#e,Qv(this.#e,n,hy(this.#e,e,t)))})}move(e,t,n={}){X(this.#e.instrumentation,`store.move`,()=>{let r=_b(this.#e),i=gy(this.#e,e,t,n);i!=null&&ey(this.#e,Qv(this.#e,r,i))})}batch(e){$v(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})}})}getVisibleCount(){return X(this.#e.instrumentation,`store.getVisibleCount`,()=>_b(this.#e))}getVisibleSlice(e,t){return X(this.#e.instrumentation,`store.getVisibleSlice`,()=>Cb(this.#e,e,t))}getVisibleRowContext(e){return X(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Sb(this.#e,e))}getVisibleTreeProjection(){return Tb(this.#e)}getVisibleTreeProjectionData(e){return wb(this.#e,e)}getVisibleIndex(e){return X(this.#e.instrumentation,`store.getVisibleIndex`,()=>Eb(this.#e,e))}getPathInfo(e){return X(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Cy(this.#e,e);if(t==null)return null;let n=Z(this.#e,t);return{depth:P_(n),kind:Y(n)?`directory`:`file`,path:yy(this.#e,t)}})}isExpanded(e){return X(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=Z(this.#e,t);return Av(this.#e,t,n)})}expand(e){X(this.#e.instrumentation,`store.expand`,()=>{let t=_b(this.#e),n=Db(this.#e,e);n!=null&&ey(this.#e,Qv(this.#e,t,n))})}collapse(e){X(this.#e.instrumentation,`store.collapse`,()=>{let t=_b(this.#e),n=Ob(this.#e,e);n!=null&&ey(this.#e,Qv(this.#e,t,n))})}on(e,t){return Bv(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Nv(this.#e,t)}markDirectoryUnloaded(e){X(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Ty(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=_b(this.#e);Fv(this.#e,t),ey(this.#e,Qv(this.#e,n,Kv({affectedAncestorIds:Sy(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return X(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=_b(this.#e),r=Pv(this.#e,t);return ey(this.#e,Qv(this.#e,n,qv({affectedAncestorIds:Sy(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return X(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Nv(this.#e,n)!==`loading`||!Lv(this.#e,n,e.attemptId))return!1;let r=yy(this.#e,n);this.validateChildPatch(r,t);let i=_b(this.#e),a=[];for(let e of t.operations){qb(r,e);let t=_b(this.#e);switch(e.type){case`add`:a.push(Qv(this.#e,t,my(this.#e,e.path)));break;case`remove`:a.push(Qv(this.#e,t,hy(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=gy(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Qv(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return ey(this.#e,Qv(this.#e,i,Jv({affectedAncestorIds:Sy(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:yy(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return X(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=_b(this.#e),r=Iv(this.#e,t,e.attemptId);return ey(this.#e,Qv(this.#e,n,Yv({affectedAncestorIds:Sy(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:yy(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return X(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=_b(this.#e),i=Rv(this.#e,n,e.attemptId,t);return ey(this.#e,Qv(this.#e,r,Xv({affectedAncestorIds:Sy(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:yy(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return X(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(pb(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=_b(this.#e),n=mb(this.#e,e.mode??`stable`);return ey(this.#e,Qv(this.#e,t,Zv({...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=Ty(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??K_(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=J_(tv(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(!Y(Z(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=Z(this.#e,n);Av(this.#e,n,i)||(jv(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=Z(this.#e,e);if(!Av(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Cy(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Y(Z(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Y(Z(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=Z(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=Z(this.#e,e),r=uy(this.#e,e);if(!Av(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 qb(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}"`)}}var Jb=e=>e.startsWith(`f::`)?e.slice(3):e;function Yb(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Xb(e,t){return e===``?t:`${e}/${t}`}function Zb({files:e,path:t,isFolder:n,nextBasename:r}){let i=Jb(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}=Yb(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Xb(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 Qb(e){return e.endsWith(`/`)}function $b(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 ex(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 tx(e,t){return t.includes(e)?ex(t):[e]}function nx(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 rx(e,t){return{draggedPaths:e,target:t}}function ix(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Qb(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ax(e,t){return t.kind===`root`||t.directoryPath==null?$b(e):t.directoryPath}function ox(e,t){let n=e.map(e=>{let n=ax(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}}}function sx(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 cx(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(!sx(Kb.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 lx(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function ux(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 dx(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function fx(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 dx(e,t.path)?n?e:null:e;case`move`:return ux(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=fx(r,e,n),r==null)return null;return r}}}function px(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function mx(e){switch(e.operation){case`add`:return{...px(e),operation:`add`,path:e.path};case`remove`:return{...px(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...px(e),from:e.from,operation:`move`,to:e.to}}}function hx(e){return{...px(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>mx(e)),operation:`batch`}}function gx(e){switch(e.operation){case`add`:case`remove`:case`move`:return mx(e);case`batch`:return hx(e);default:return null}}function _x(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function vx(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 yx(e){return vx(e).at(-1)??null}function bx(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function xx(e){return e.endsWith(`/`)}var Sx=e=>e.toLowerCase();function Cx(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function wx(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Tx(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ex=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Dx=Symbol(`FILE_TREE_RENAME_VIEW`),Ox=512,kx=512;function Ax(e){return e===`top`||e===`center`?e:`nearest`}function jx(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=vx(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 Mx(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:jx(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Nx=class e{static{Object.defineProperty(e.prototype,Dx,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#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=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=cx({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.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=yx(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Ax(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=kx){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(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.#H.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.#Se(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.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.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.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(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.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=tx(t,n);return this.#r.canDrag?.(r)!==!1&&(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=rx(t.draggedPaths,n);(ix(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}nx(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}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.#De(),!1;let n=rx(e.draggedPaths,t);if(ix(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ox(e.draggedPaths,t);if(r==null)return this.#De(),!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.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),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.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.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.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=xx(r),a=wx(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of vx(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=Cx(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#q(){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,xx(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){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,xx(e)?{recursive:!0}:void 0);return}let t=xx(e),n=Zb({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:wx(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Tx(n.sourcePath,t),Tx(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=cx({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!_x(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=yx(e),n=bx(e,t),r=null,i=null;for(let e of this.#be()){if(yx(e)!==t)continue;let a=bx(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=vx(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(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.#B.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}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!_x(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Kb({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of vx(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Sx),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Sx),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of vx(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;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.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(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)}#Te(e,t){let n=e==null?null:Ex(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),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.#pe(),s=this.#me();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 vx(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of vx(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;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.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Mx(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ox)),e,t?e=>this.#H.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.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s!==e||this.#c!==n)&&(this.#s=e,this.#c=n,t&&this.#De())}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=fx(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=fx(this.#c,e,!0),r=[...this.#B].map(t=>fx(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=fx(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return _x(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&lx(e)&&(this.#i=null);let t=lx(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=gx(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Px=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 Fx(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 Ix(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function Lx(e,t){return t?`${e}/`:e}function Rx(e,t=null){let n=Px(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,o=new Map;for(let t of e??[]){let e=Bx(t);e!=null&&Ux({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function zx(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=Vx(e);t!=null&&(c=Hx({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Bx(e);t!=null&&(c=Ux({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:Kx(i),statusByPath:i}:e}function Bx(e){return Vx(e.path)}function Vx(e){let t=Fx(e);if(t!=null)return{canonicalPath:Lx(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Hx({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),Gx(t,n,e),!0)}function Ux({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??Wx(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function Wx(e,t,n){for(let r of Ix(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Gx(e,t,n){for(let r of Ix(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function Kx(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var qx=e=>e.trim().toLowerCase(),Jx=e=>e.split(`/`).at(-1)??e,Yx=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 Xx(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function Zx(e){let t=$g(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(qx(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 s=Jx(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return Xx(l,e);for(let[t,n]of a)if(c.includes(t))return Xx(n,e);let u=Yx(s);for(let t of u){let n=i.get(t);if(n!=null)return Xx(n,e)}let d=Zg(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return Xx(t,e)}return{name:Yg(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:Xx(s,e)}}}var Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS={},lS=[],uS=Array.isArray,dS=lS.slice,fS=Object.assign;function pS(e){e&&e.parentNode&&e.remove()}function mS(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?dS.call(arguments,2):n),hS(e,o,r,i,null)}function hS(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??++$x,__i:-1,__u:0};return i==null&&Qx.vnode!=null&&Qx.vnode(a),a}function gS(e){return e.children}function _S(e,t){this.props=e,this.context=t,this.__g=0}function vS(e,t){if(t==null)return e.__?vS(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`?vS(e):null}function yS(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 yS(e)}}function bS(e){(8&e.__g||!(e.__g|=8)||!eS.push(e)||nS++)&&tS==Qx.debounceRendering||((tS=Qx.debounceRendering)||queueMicrotask)(xS)}function xS(){for(var e,t,n,r,i,a,o,s,c=1;eS.length;)eS.length>c&&eS.sort(rS),e=eS.shift(),c=eS.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=fS({},r)).__v=r.__v+1,Qx.vnode&&Qx.vnode(n),kS(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??vS(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,jS(a,n,o),n.__e!=i&&yS(n)));nS=0}function SS(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||lS,b=t.length;for(c=CS(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?cS:y[m.__i]||cS,m.__i=f,_=kS(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&PS(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=wS(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function CS(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?hS(null,o,null,null,null):uS(o)?hS(gS,{children:o},null,null,null):o.constructor==null&&o.__b>0?hS(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=TS(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=vS(s)),FS(s,s));return r}function wS(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=wS(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=vS(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function TS(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);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 ES(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function DS(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||ES(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ES(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(iS,`$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=aS,e.addEventListener(t,a?sS:oS,a)):e.removeEventListener(t,a?sS:oS,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 OS(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=aS++;else if(t.u<n.l)return;return n(Qx.event?Qx.event(t):t)}}}function kS(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,ne,w,T,E,re,D,O=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=Qx.__b)&&d(t);n:if(typeof O==`function`)try{if(v=t.props,y=`prototype`in O&&O.prototype.render,b=(d=O.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 O(v,x):(t.__c=f=new _S(v,x),f.constructor=O,f.render=IS),b&&b.sub(f),f.props=v,f.state||(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&&O.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fS({},f.__s)),fS(f.__s,O.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&O.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&O.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=Qx.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),te=0;te<f._sb.length;te++)f.__h.push(f._sb[te]);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&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=fS({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),ne=d,d!=null&&d.type===gS&&d.key==null&&(ne=MS(d.props.children)),s=SS(e,uS(ne)?ne:[ne],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(w=0,T=!1,t.__u|=c?160:128,t.__c.__z=[],E=0;E<a.length;E++)(re=a[E])==null||T||(re.nodeType==8&&re.data==`$s`?(w>0&&t.__c.__z.push(re),w++,a[E]=null):re.nodeType==8&&re.data==`/$s`?(--w>0&&t.__c.__z.push(re),T=w===0,s=a[E],a[E]=null):w>0&&(t.__c.__z.push(re),a[E]=null));if(!T){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(D=a.length;D--;)pS(a[D]);AS(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||AS(t);Qx.__e(e,t,n)}else s=t.__e=NS(n.__e,t,n,r,i,a,o,c,l,u);return(d=Qx.diffed)&&d(t),128&t.__u?void 0:s}function AS(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(AS)}function jS(e,t,n){for(var r=0;r<n.length;r++)PS(n[r],n[++r],n[++r]);Qx.__c&&Qx.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Qx.__e(e,t.__v)}})}function MS(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:uS(e)?e.map(MS):fS({},e)}function NS(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&&=(Qx.__m&&Qx.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=dS.call(e.childNodes),v=n.props||cS,!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;DS(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&&!_||DS(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=``),SS(b==`template`?e.content:e,uS(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&vS(n,0),s,c,l),a!=null)for(u=a.length;u--;)pS(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||DS(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&DS(e,u,g,v[u],i))}return e}function PS(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){Qx.__e(e,n)}}function FS(e,t,n){var r,i;if(Qx.unmount&&Qx.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||PS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Qx.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&FS(r[i],t,n||typeof e.type!=`function`);n||pS(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function IS(e,t,n){return this.constructor(e,n)}function LS(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Qx.__&&Qx.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=mS(gS,null,[e]),i=[],a=[],kS(t,e,r||cS,cS,t.namespaceURI,r?null:t.firstChild?dS.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),jS(i,e,a)}function RS(e,t){e.__u|=32,LS(e,t)}Qx={__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 nS=0,e}},$x=0,_S.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=fS({},this.state);typeof e==`function`&&(e=e(fS({},n),this.props)),e&&fS(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),bS(this))},_S.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),bS(this))},_S.prototype.render=gS,eS=[],nS=0,rS=function(e,t){return e.__v.__b-t.__v.__b},iS=/(PointerCapture)$|Capture$/i,aS=0,oS=OS(!1),sS=OS(!0);var zS=0;Array.isArray;function Q(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:--zS,__i:-1,__u:0,__source:i,__self:a};return Qx.vnode&&Qx.vnode(l),l}var BS=16,VS=16,HS={};function US({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}=HS[e]??{width:BS,height:VS},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`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:Q(`use`,{href:c})})}var WS=e=>e!==void 0&&/\s/.test(e),GS=(e,t)=>{let n=t=>WS(e[t-1])||WS(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},KS=e=>GS(e,Math.ceil(e.length/2)),qS=e=>{if(e.length<2)return[e,``];let t=KS(e);return[e.slice(0,t),e.slice(t)]},JS=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:KS(e);return[e.slice(0,r),e.slice(r)]},YS=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)]},XS=(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)]},ZS=(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)]},QS=(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 $S({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function eC(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function tC({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(eC,{mode:t,children:e},`content`),o=Q($S,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function nC({children:e,...t}){"use no memo";return Q(tC,{mode:`truncate`,...t,children:e})}function rC({children:e,...t}){"use no memo";return Q(tC,{mode:`fruncate`,...t,children:e})}function iC({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=Q(nC,{...s,children:t[0]}),l=Q(rC,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?rC:nC,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=qS:r===`extension`?t=JS:r===`leaf-path`&&(t=YS);else if(typeof r==`number`)t=XS,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=ZS:e===`first`&&(t=QS)}else typeof r==`function`&&(t=r);t??=qS;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=Q(nC,{...s,..._,children:f}),l=Q(rC,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var aC={endIndex:-1,startIndex:-1};function oC(e,t,n){return Math.min(Math.max(e,t),n)}function sC(e,t){return e<0||t<e?aC:{endIndex:t,startIndex:e}}function cC(e){return e.startIndex<0||e.endIndex<e.startIndex}function lC(e,t){return cC(e)?0:(e.endIndex-e.startIndex+1)*t}function uC(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function dC(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function fC(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 pC(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 mC(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 hC(e,t,n){if(e.length===0||t<=0)return[];let r=mC(e),i=fC(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=pC(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 gC(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=oC(t.scrollTop,0,o),c=t.stickyRows??hC(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=uC(s,n,t.itemHeight),m=uC(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?aC:sC(m,dC(u+d,n,t.itemHeight)),y=g+1,b=cC(v)?aC:sC(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=lC(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:cC(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var _C={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},vC={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},yC=`Contains git status items`;function bC(e){return e.current?!0:(e.current=!0,!1)}function xC(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 SC(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return xC({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function CC(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}function wC(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 TC(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 EC(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function DC(e,t){return e!=null&&e>0?e:t}function OC(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 kC(e,t,n,r,i=0){let a=xC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function AC(e,t,n,r,i,a,o=0){let s=SC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function jC(e,t,n,r,i,a){let o=CC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function MC(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function NC(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function PC({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`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 FC(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 IC(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}}var LC,RC,zC,BC,VC=Object.is,HC=0,UC=[],WC=Qx,GC=WC.__b,KC=WC.__r,qC=WC.diffed,JC=WC.__c,YC=WC.unmount,XC=WC.__;function ZC(e,t){WC.__h&&WC.__h(RC,e,HC||t),HC=0;var n=RC.__H||(RC.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function QC(e){return HC=1,$C(uw,e)}function $C(e,t,n){var r=ZC(LC++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):uw(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);VC(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=RC,!RC.__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,VC(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};RC.__f=!0;var a=RC.shouldComponentUpdate,o=RC.componentWillUpdate;RC.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)},RC.shouldComponentUpdate=i}return r.__N||r.__}function ew(e,t){var n=ZC(LC++,3);!WC.__s&&lw(n.__H,t)&&(n.__=e,n.u=t,RC.__H.__h.push(n))}function tw(e,t){var n=ZC(LC++,4);!WC.__s&&lw(n.__H,t)&&(n.__=e,n.u=t,RC.__h.push(n))}function $(e){return HC=5,nw(function(){return{current:e}},[])}function nw(e,t){var n=ZC(LC++,7);return lw(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rw(e,t){return HC=8,nw(function(){return e},t)}function iw(){for(var e;e=UC.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(sw),e.__H.__h.forEach(cw),e.__H.__h=[]}catch(t){e.__H.__h=[],WC.__e(t,e.__v)}}WC.__b=function(e){RC=null,GC&&GC(e)},WC.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),XC&&XC(e,t)},WC.__r=function(e){KC&&KC(e),LC=0;var t=(RC=e.__c).__H;t&&(zC===RC?(t.__h=[],RC.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(sw),t.__h.forEach(cw),t.__h=[],LC=0)),zC=RC},WC.diffed=function(e){qC&&qC(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(UC.push(t)!==1&&BC===WC.requestAnimationFrame||((BC=WC.requestAnimationFrame)||ow)(iw)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),zC=RC=null},WC.__c=function(e,t){t.some(function(e){try{e.__h.forEach(sw),e.__h=e.__h.filter(function(e){return!e.__||cw(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],WC.__e(n,e.__v)}}),JC&&JC(e,t)},WC.unmount=function(e){YC&&YC(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{sw(e)}catch(e){t=e}}),n.__H=void 0,t&&WC.__e(t,n.__v))};var aw=typeof requestAnimationFrame==`function`;function ow(e){var t,n=function(){clearTimeout(r),aw&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);aw&&(t=requestAnimationFrame(n))}function sw(e){var t=RC,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),RC=t}function cw(e){var t=RC;e.__c=e.__(),RC=t}function lw(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!VC(t,e[n])})}function uw(e,t){return typeof t==`function`?t(e):t}function dw(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(gS,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(nC,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function fw(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function pw(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function mw(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 hw({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=gC(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:mw(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?mw(u,1,t,o):i&&r<=0&&c.length>0?hC(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 gw=400,_w=40,vw=18;function yw(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))?bw(e,t,n):a instanceof HTMLElement?a:null}function bw(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 xw(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 Sw(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 Cw(){return navigator.vendor!==`Apple Computer, Inc.`}function ww(e,t){let n=e-t.top;if(n<_w)return-Math.ceil((_w-Math.max(0,n))/_w*vw);let r=t.bottom-e;return r<_w?Math.ceil((_w-Math.max(0,r))/_w*vw):0}function Tw(e,t){if(e!=null){let t=_C[e];return t==null?null:{text:t,title:vC[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:yC}:null}function Ew(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 Dw(e){return e!=null&&`toggle`in e}function Ow(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function kw(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Aw(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function jw(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Mw(e,t){return t&&jw(e)||(e.ctrlKey||e.metaKey)&&Ow(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Nw=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Pw(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 Fw(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 Iw(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Lw(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Rw(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function zw(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 Bw(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 Vw(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 Hw(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=Vw(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 Uw(e,t){return{kind:e.kind,name:pw(e),path:t}}function Ww(e){return e==null?void 0:`${e}__tree`}function Gw(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Kw(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function qw(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Kw(e.icon)?t(e.icon):{name:e.icon}:Kw(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(US,{...n})})}function Jw(e){e!=null&&wC(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Yw(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=fw(e);return Q(gS,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(US,{...t(`file-tree-icon-chevron`)}):Q(US,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?dw(e,c,a):c??Q(iC,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:qw(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:qw(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(US,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Xw(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:ee,contextMenuButtonVisibility:te,contextMenuRightClickEnabled:ne,registerRenameInput:w,registerButton:T,resolveIcon:E,renderDecorationForRow:re,openContextMenuForRow:D,onRowClick:O,onKeyDown:k}=e,ie=fw(t),{isParked:A=!1,mode:ae=`flow`,style:oe}=r,se=ae===`sticky`,ce=_?.get(ie)??null??Ew(t.ancestorPaths,v,y),le=t.kind===`directory`&&(b?.has(ie)??!1),ue=re(t,ie),de=Tw(ce,le),fe=S&&ee,pe=ue!=null||x||fe,me=fe&&te===`always`,j=a.getPath()===ie,he=j?a.getValue():``,ge=se||!j?null:Q(PC,{ref:w,ariaLabel:`Rename ${pw(t)}`,isFlattened:t.isFlattened,value:he,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),_e=Yw(t,E,{actionLaneEnabled:fe,customDecoration:ue,decorationLaneEnabled:pe,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:de,gitLaneActive:x,renameInput:ge,showDecorativeActionAffordance:me}),ve={...FC({ariaLabel:pw(t),domId:t.isFocused?Gw(h,ie,A):void 0,extraStyle:oe,features:{actionLaneEnabled:fe,contextMenuButtonVisibility:fe?te:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:A,itemHeight:g,mode:ae,row:t,state:{containsGitChange:le,effectiveGitStatus:ce,isContextHovered:s===ie,isDragTarget:l?.kind===`directory`&&l.directoryPath===ie,isDragging:c?.has(ie)===!0,isFocusRinged:t.isFocused&&o===ie},targetPath:ie}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),ne&&(i.focusMountedPathFromInput(ie),D(t,ie,{anchorRect:Iw(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:se?void 0:()=>{i.focusMountedPathFromInput(ie)},onKeyDown:se?void 0:k,ref:e=>{T(ie,e)}};return!se&&j?Q(`div`,{...ve,children:_e}):Q(`button`,{...ve,type:`button`,draggable:u&&!A,onDragEnd:u&&!A?p:void 0,onDragStart:u&&!A?e=>{f(e,t,ie)}:void 0,onMouseDown:e=>{if(se){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!A?e=>{m(e,t,ie)}:void 0,onClick:e=>{O(e,t,ie,ae)},children:_e})}function Zw(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(fw(e))).map((n,r)=>Xw(e,n,t.start+r))}function Qw({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=n_,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 _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),ee=$(null),te=$(new Map),ne=$(new Map),w=$(()=>{}),T=$(null),E=$(0),re=$(!1),D=$(null);D.current!==t&&(re.current=!1,D.current=t);let O=$(!1),k=$(null),ie=$(null),A=$(!1),ae=$(null),oe=$(null),se=$(null),ce=$(null),le=$(null),ue=$(null),de=$(null),fe=$(null),pe=$(!1),me=$(null),j=$(null),he=$(null),ge=$(null),_e=nw(()=>new Map,[]),[,ve]=QC(0),ye=$(!1),[M,be]=QC(null),[xe,N]=QC(null),[P,Se]=QC(null),[Ce,we]=QC(null),[Te,Ee]=QC(0),[F,De]=QC(null),I=$(F);I.current=F;let Oe=$(null),ke=$(null),Ae=$(null),je=$(null),Me=$(null),L=$(!1),Ne=()=>{ke.current=null,Ae.current=null,je.current=null},Pe=(e,t)=>{ke.current=e,Ae.current=null,je.current=t==null?null:{path:e,scrollTop:t}},Fe=(e,t)=>{ke.current=null,Ae.current={path:e,viewportOffset:t},je.current=null},R=$(d===`retain`&&t.isSearchOpen()),[Ie,Le]=QC(p);ew(()=>{p||Le(!1)},[p]);let Re=$(!1),ze=rw(()=>{Re.current=!0,Le(e=>e&&!1)},[]),[Be,Ve]=QC(()=>hw({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[He,Ue]=QC(!1);ew(()=>{Ue(!0)},[]);let We=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ge=e?.contextMenu?.triggerMode??(We?`right-click`:`both`),Ke=Ge===`both`||Ge===`button`,z=e?.contextMenu?.buttonVisibility??`when-needed`,qe=Ge===`both`||Ge===`right-click`;tw(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,N(t),we(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(L.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 Je=rw((e,t)=>{Rw(te.current,e,t)},[]),B=rw((e,t)=>{Rw(ne.current,e,t)},[]),Ye=rw(e=>{x.current=e},[]),Xe=rw(e=>zw(e,ne.current,te.current),[]),Ze=n!=null||r!=null||i!=null,{resolveIcon:Qe}=nw(()=>Zx(a),[a]),$e=t[Dx](),et=$e.getPath(),tt=et!=null,V=t.isSearchOpen(),H=t.getSearchValue(),U=t.getFocusedPath(),W=t.getFocusedIndex(),nt=t.getScrollRequest(),rt=t.isDragAndDropEnabled(),it=t.getDragSession(),at=nw(()=>it==null?null:new Set(it.draggedPaths),[it]),ot=it?.target??null,st=it?.primaryPath??null,ct=Ww(o),{overlayHeight:lt,overlayRows:ut,snapshot:G,visibleRows:dt}=Be,ft=G.physical.viewportHeight,pt=nw(()=>({end:G.window.endIndex,start:G.window.startIndex}),[G.window.endIndex,G.window.startIndex]),mt=ut,ht=G.sticky.rows,gt=G.physical.totalHeight,_t=G.sticky.height,vt=nw(()=>new Set(ht.map(e=>fw(e.row))),[ht]),yt=W>=0&&W>=pt.start&&W<=pt.end,bt=rw((e,t)=>u?.({item:Uw(e,t),row:e})??null,[u]),xt=rw(e=>wC(e==null?null:te.current.get(e)??null)?!0:wC(S.current),[]),St=rw(e=>{xt(t.focusNearestPath(e))},[t,xt]),Ct=$(St);Ct.current=St;let wt=$(!0),Tt=$(()=>{}),Et=rw((t=!0)=>{let n=I.current;n!=null&&(wt.current=wt.current&&t,De(null),e?.contextMenu?.onClose?.(),wt.current&&St(n.path))},[e?.contextMenu,St]);Tt.current=Et;let Dt=rw(e=>{let t=e==null?null:Lw(S.current,e);Se(e=>e===t?e:t)},[]),Ot=rw((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Xe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Pe(n,e?.scrollTop??null),O.current=!0,be(e=>e===n?e:n)}i.focus(),Dt(a),wt.current=!0,De({anchorRect:r?.anchorRect??null,item:Uw(e,n),path:n,source:r?.source??`keyboard`})},[t,Xe,Dt]),kt=rw(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=EC(e,ft);ae.current=W<0||e==null?null:Math.max(0,Math.min(W*s-e.scrollTop,Math.max(0,t-s))),A.current=!0}t.startRenaming(e)!==!1&&(we(`focus`),ve(e=>e+1))}},[t,W,s,l,ft]),At=rw((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=EC(i,ft),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:hw({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return O.current=!0,jC(i,a,s,l,u,d),w.current(),Oe.current=n?e:null,!0},[t,s,c,ft,h]),jt=()=>y.current===!0||ge.current!=null||pe.current===!0,Mt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Nt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Pt=()=>{ce.current!=null&&(clearTimeout(ce.current),ce.current=null),se.current=null},Ft=()=>{ue.current?.remove(),ue.current=null},It=()=>{Nt(oe.current),oe.current=null,le.current=null},Lt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Rt=()=>{fe.current?.(),fe.current=null,ge.current!=null&&(clearTimeout(ge.current),ge.current=null),pe.current=!1,me.current=null,he.current=null,j.current!=null&&(j.current.setAttribute(`draggable`,`true`),j.current.style.removeProperty(`touch-action`),j.current=null),Ft(),Pt(),It(),de.current=null},zt=(e,n)=>{let r=S.current?.getRootNode(),i=xw(yw(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Bt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Pt();return}let r=t.getItem(e.directoryPath),i=Dw(r)?r:null;if(i==null||i.isExpanded()){Pt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;se.current!==a&&(Pt(),se.current=a,ce.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Vt=()=>{oe.current=null;let e=le.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=ww(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,w.current()),Bt(zt(e.clientX,e.clientY)),oe.current=Mt(Vt)},Ht=(e,t)=>{le.current={clientX:e,clientY:t},oe.current??=Mt(Vt)},Ut=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Rt(),Ft(),Pt(),It(),t.startDrag(r)===!1){e.preventDefault();return}if(de.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),Cw())){let t=Sw(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Lt(t),ue.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Wt=()=>{Ft(),Pt(),It(),de.current=null,t.cancelDrag()},Gt=(e,n,r)=>{if(ge.current!=null||pe.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;he.current={clientX:i.clientX,clientY:i.clientY},j.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!pe.current;ge.current!=null&&(clearTimeout(ge.current),ge.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),fe.current===o&&(fe.current=null),t&&(a.setAttribute(`draggable`,`true`),j.current===a&&(j.current=null),he.current=null)},s=e=>{let t=e.touches[0],n=he.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),fe.current=o,ge.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),j.current===a&&(j.current=null),he.current=null;return}pe.current=!0,j.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),de.current=n;let e=a.getBoundingClientRect(),s=Sw(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`}),Lt(s),ue.current=s,me.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=me.current;n!=null&&ue.current!=null&&(ue.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Bt(zt(t.clientX,t.clientY)),Ht(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&zt(n.clientX,n.clientY),t.completeDrag(),Rt()},u=()=>{t.cancelDrag(),Rt()};fe.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)},gw)},Kt=e=>{if(F!=null){if(e.key===`Escape`){Et(),e.preventDefault(),e.stopPropagation();return}Nw.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if($e.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)$e.cancel();else if(e.key===`Enter`)$e.commit();else return;we(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){kt(U??void 0),e.preventDefault(),e.stopPropagation();return}if(V){if(e.key===`Escape`)A.current=!1,ae.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=EC(n,ft);ae.current=W<0||n==null?null:Math.max(0,Math.min(W*s-n.scrollTop,Math.max(0,r-s))),A.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;we(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&kw(e)){t.openSearch(e.key),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=We&&jw(e),r=Mw(e,We),i=r&&S.current!=null?TC(S.current):null,a=r?new Set(Bw(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==U&&a.has(o)){let e=C.current;Pe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Dw(p)?p:null,h=u!=null&&(vt.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=zw(u,ne.current,te.current);e==null||n==null?y=!1:Ot(e,u)}else if((e.ctrlKey||e.metaKey)&&Ow(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;we(`focus`);let b=t.getFocusedPath(),x=b!=null&&(vt.has(b)||a.has(b)),ee=g&&b!==u,w=n&&c&&o===u&&b===u;if((h||w)&&b!=null&&(ee&&x||w))Pe(b,v?.scrollTop??null),O.current=!0,be(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Fe(b,Hw(S.current,v,i,u,s,_t,ft)),O.current=!0,be(e=>e===b?e:b)):Ne()}ve(e=>e+1),e.preventDefault(),e.stopPropagation()};tw(()=>{if(!(!f||!V)){if(R.current){R.current=!1;return}wC(ee.current)}},[V,f]),tw(()=>{let e=x.current;switch(NC({hasRenderedInput:e!=null,previousRenamingPath:ie.current,renamingPath:et})){case`reset`:ie.current=null;return;case`reveal-canonical`:et!=null&&At(et,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Oe.current=null,ie.current=et,wC(e),e.select());return}},[pt.end,pt.start,et,At,vt]),tw(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=TC(e)?.dataset.itemPath??null;be(e=>e===t?e:t)},i=()=>{n(),O.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,TC(e)!=null){r();return}O.current=!1,be(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),O.current=!1,be(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;be(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),tw(()=>{let e=S.current;e!=null&&(G.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[G.physical.scrollTop]),tw(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;T.current=EC(n,g);let a=()=>{let e=t.getVisibleCount(),r=DC(T.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ve(hw({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!re.current){re.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=DC(T.current,g),i=t.getVisibleRows(e,e)[0]??null;kC(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}w.current=a;let o=t.subscribe(()=>{bC(ye)&&ve(e=>e+1),a()}),l=()=>{L.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,Ee(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&L.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),I.current!=null&&y.current&&Tt.current(),L.current===!0){y.current=!1;return}N(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{T.current=(e[0]==null?null:OC(e[0]))??EC(n,g),a()}):null;return x?.observe(n),()=>{w.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,T.current=null,x?.disconnect()}},[t,g,s,c,h]),tw(()=>{We||F==null||Et(!1)},[Et,We,F]);let qt=nw(()=>F==null?null:`${F.path}::${F.source}`,[F]);tw(()=>{if(qt==null){m?.clearSlotContent(jh);return}let t=I.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Fw(n.getBoundingClientRect()),close:e=>{Tt.current(e?.restoreFocus??!0)},restoreFocus:()=>{wt.current&&Ct.current(I.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(jh,i),e?.contextMenu?.onOpen?.(t.item,r),Jw(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Jw(i)}),()=>{m?.clearSlotContent(jh)}},[qt,e?.contextMenu,m]),tw(()=>{F!=null&&t.getItem(F.path)==null&&Et()},[Et,F,t]),tw(()=>{if(F==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Pw(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Et())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Et())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Et,F]),tw(()=>{let e=C.current,n=S.current;if(e==null||n==null){k.current=U;return}let r=U==null?null:te.current.get(U)??null,i=TC(n),a=i?.dataset.itemPath??null,o=tt&&x.current===i,c=f&&ee.current===i,l=A.current&&!V,u=ae.current??0,d=Oe.current,p=ke.current,m=Ae.current,g=je.current,_=i!=null,v=O.current||_,y=k.current!==U,b=p!=null&&p===U&&U!=null,ne=!1,T=!1;if(nt!=null&&nt.id!==E.current){E.current=nt.id;let n=nt.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,ft-s))):_t;ne=!0,T=AC(e,n,s,ft,gt,nt.offset,t)}t.clearScrollRequest(nt.id)}let re=!ne&&l&&jC(e,W,s,ft,gt,u),D=!ne&&d!=null&&d===U&&jC(e,W,s,ft,gt,_t),ie=!ne&&m!=null&&m.path===U&&jC(e,W,s,ft,gt,m.viewportOffset),oe=!ne&&g!=null&&g.path===U&&e.scrollTop!==g.scrollTop;if(oe&&(e.scrollTop=g.scrollTop),(oe||T||D||ie||re||v&&y&&d!==U&&!b&&kC(e,W,s,ft,_t))&&w.current(),ne){k.current=U;return}if(!v){k.current=U;return}if(o){k.current=U;return}if(c&&!l){k.current=U;return}if(r==null){l&&W>=0&&(jC(e,W,s,ft,gt,u),w.current()),k.current=U;return}(y||l||d===U||p===U||m?.path===U||g?.path===U||a==null||a!==U)&&(wC(r),d===U&&(Oe.current=null),p===U&&(ke.current=null),m?.path===U&&(Ae.current=null),g?.path===U&&(je.current=null),A.current=!1,ae.current=null),k.current=U},[t,W,U,yt,s,tt,V,pt,ft,f,nt,h,_t,gt,dt]);let Jt=W>=0&&W>=G.visible.startIndex&&W<=G.visible.endIndex,Yt=U!=null&&mt.some(e=>fw(e.row)===U),Xt=Jt||Yt,Zt=Ke&&O.current===!0&&Xt?U:null,Qt=Ce===`pointer`?xe:null,$t=F?.path??Me.current??Qt??Zt??xe,en=F?.source===`right-click`;tw(()=>{y.current&&F==null||Dt(Xe($t))},[F,Xe,pt,ft,Te,mt,$t,Dt,dt]);let tn=rw(e=>{if(y.current||Pw(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&&we(e=>e===`pointer`?e:`pointer`),N(e=>e===i?e:i)},[]),nn=rw(()=>{N(null)},[]);tw(()=>{if(!rt)return;let e=()=>{Rt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Rt(),t.cancelDrag()}},[t,rt]);let rn=e=>{if(!rt||t.getDragSession()==null||pe.current)return;let n=xw(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Bt(t.getDragSession()?.target??null),Ht(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},an=e=>{if(!rt||t.getDragSession()==null||pe.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Pt(),It(),t.setDragTarget(null))},on=e=>{!rt||t.getDragSession()==null||pe.current||(e.preventDefault(),zt(e.clientX,e.clientY),t.completeDrag(),Ft(),Pt(),It(),de.current=null)},sn=G.window.height,cn=G.window.offsetTop,ln=Math.min(0,ft-sn),un=Math.min(0,ft-sn-_t),dn=M===U||A.current,fn=U!=null&&dn&&!yt&&W>=0?dt[W]??t.getVisibleRows(W,W)[0]??null:null,pn=fn==null?null:MC(W,s,pt,sn),mn=de.current,hn=st!=null&&mn!=null&&mn.path===st&&mn.index>=pt.start&&mn.index<=pt.end,gn=st!=null&&mn!=null&&mn.path===st&&!hn&&mn.path!==fn?.path?mn:null,_n=gn==null?null:MC(gn.index,s,pt,sn),vn=Aw((W>=0?dt[W]??t.getVisibleRows(W,W)[0]??null:null)?.ancestorPaths.at(-1)??null),yn=V&&U!=null?Gw(o,U,!yt):void 0,bn=F?.path??(V?U:M),xn=F?.path??xe,Sn=Xe($t),Cn=We&&Ke&&!en&&!tt&&Sn!=null&&P!=null&&$t!=null,wn=We&&(Cn||F!=null),Tn=F?.anchorRect,En=Tn==null&&Sn!=null&&P!=null&&(F!=null||Cn)?P:null,Dn=Tn==null?En==null?void 0:{top:`${En}px`}:{left:`${Tn.left}px`,position:`fixed`,right:`auto`,top:`${Tn.top}px`},On=en?{opacity:`0`}:void 0,kn=rw((e,n,r,i)=>{let a=IC({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:V,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=G.visible.startIndex&&n.index<=G.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(O.current=!0,be(e=>e===c?e:c),we(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&At(c,{targetOffset:`sticky-parents`})},[t,V,G.visible.endIndex,G.visible.startIndex,At]),An=()=>{if(y.current||!Ke||$t==null||Sn==null)return;let e=t.getItem($t);e!=null&&(Dt(Sn),wt.current=!0,De({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Sn.getAttribute(`aria-label`)??$t,path:e.getPath()},path:e.getPath(),source:`button`}))},jn={contextHoverPath:xn,contextMenuButtonTriggerEnabled:Ke,contextMenuButtonVisibility:z,contextMenuEnabled:We,contextMenuRightClickEnabled:qe,contextMenuTriggerMode:Ge,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:rt,draggedPathSet:at,dragTarget:ot,gitLaneActive:Ze,gitStatusByPath:n,handleRowDragEnd:Wt,handleRowDragStart:Ut,handleRowTouchStart:Gt,ignoredGitDirectories:r,ignoredInheritanceCache:_e,instanceId:o,itemHeight:s,onKeyDown:Kt,onRowClick:kn,openContextMenuForRow:Ot,registerButton:Je,registerRenameInput:Ye,renameView:$e,renderDecorationForRow:bt,resolveIcon:Qe,shouldSuppressContextMenu:jt,visualFocusPath:bn},Mn={...jn,registerButton:B};return Q(`div`,{ref:S,id:ct,"data-file-tree-context-menu-button-visibility":We&&Ke?z:void 0,"data-file-tree-context-menu-trigger-mode":We?Ge:void 0,"data-file-tree-has-context-menu-action-lane":We&&Ke?`true`:void 0,"data-file-tree-has-git-lane":Ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:rt?an:void 0,onDragOver:rt?rn:void 0,onDrop:rt?on:void 0,onKeyDown:Kt,onPointerLeave:We?nn:void 0,onPointerOver:We?tn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:vn}}),Q(`slot`,{name:Ah,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":V?`true`:`false`,children:Q(`input`,{ref:ee,"aria-activedescendant":yn,"aria-controls":ct,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ie?`true`:void 0,value:H,onBlur:()=>{d===`retain`&&!Re.current||t.closeSearch()},onFocus:ze,onPointerDown:ze,onInput:e=>{ze();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&He&&mt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${lt}px`},children:mt.map((e,t)=>Xw(Mn,e.row,`sticky:${fw(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${mt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${gt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${cn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${sn}px`,top:`${ln}px`,bottom:`${un}px`},children:[Zw(jn,pt,vt),fn!=null&&pn!=null?Xw(jn,fn,`parked:${fn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:st===fn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${pn}px`}}):null,gn!=null&&_n!=null?Xw(jn,gn,`parked-drag:${gn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${_n}px`}}):null]})]})]}),We?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":wn?`true`:`false`,style:Dn,children:[Q(`button`,{ref:v,type:`button`,"data-type":Mh,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":F==null?`false`:`true`,"data-visible":Cn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),F!=null){Et();return}An()},tabIndex:-1,style:On,children:Q(US,{...Qe(`file-tree-icon-ellipsis`)})}),F==null?null:Q(`slot`,{name:jh})]}):null,F==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Et()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Et()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var $w={hydrateRoot:(e,t)=>{RS(mS(Qw,t),e)},renderRoot:(e,t)=>{LS(mS(Qw,t),e)},unmountRoot:e=>{LS(null,e)}};function eT(e,t){$w.renderRoot(e,t)}function tT(e,t){$w.hydrateRoot(e,t)}function nT(e){$w.unmountRoot(e)}var rT=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)}}};Array.isArray;var iT=0;function aT(e){return e!=null&&e.length>0?e:(iT+=1,`pst_ft_${iT}`)}function oT({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??n_)}function sT(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 cT(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 lT(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var uT=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new rT;#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=aT(a),this.#p=Rx(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=t_(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Nx({...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&&(nT(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}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)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=zx(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&eT(n.wrapper,this.#w())}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){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),eT(t.wrapper,this.#w()))}setGitStatus(e){let t=Rx(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&eT(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),eT(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),tT(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),eT(r,this.#w())}#C(){return{initialViewportHeight:oT({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(Ah,e());return}this.#l.setSlotHtml(Ah,this.#e?.header?.html??null)}#k(e){let t=lT(e).find(e=>cT(e)),n=sT(Jg($g(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=lT(e),n=t.find(e=>cT(e)),r=t.filter(e=>e!==n),i=$g(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=sT(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=$g(this.#m);t.colored&&Xg(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Eh}]`);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(Eh,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=o_(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 f_(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)}};function dT(e){let[t]=(0,V.useState)(()=>new uT(e)),n=(0,V.useRef)({timeout:null,model:t});return(0,V.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function fT({files:e,dirtyPaths:t,activePath:n,busy:r,onRefresh:a,onOpenFile:o}){let s=(0,V.useRef)({files:e,onOpenFile:o});s.current={files:e,onOpenFile:o};let{model:c}=dT({paths:[],initialExpansion:`open`,itemHeight:32,onSelectionChange(e){let t=e[0];t&&!t.endsWith(`/`)&&s.current.files.some(e=>e.path===t)&&s.current.onOpenFile(t)}}),l=(0,V.useMemo)(()=>{let n=new Set(t);return e.flatMap(e=>n.has(e.path)?[{path:e.path,status:`modified`}]:[])},[e,t]);return(0,V.useEffect)(()=>{c.resetPaths(e.map(e=>e.path))},[c,e]),(0,V.useEffect)(()=>{c.setGitStatus(l)},[c,l]),(0,V.useEffect)(()=>{for(let e of c.getSelectedPaths())e!==n&&c.getItem(e)?.deselect();n&&c.getItem(n)?.select()},[c,n]),(0,H.jsxs)(`aside`,{className:`inkcap-tree`,"aria-label":`Repository files`,children:[(0,H.jsxs)(`div`,{className:`inkcap-tree-toolbar`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Lm,{"aria-hidden":`true`}),` Explorer`]}),(0,H.jsx)(i,{icon:(0,H.jsx)(y,{}),"aria-label":`Refresh repository`,variant:`ghost`,size:`xs`,disabled:r,onClick:a})]}),(0,H.jsx)(`p`,{className:`inkcap-repository-legend`,children:`Changes in latest commit · drafts marked modified`}),(0,H.jsx)(Rh,{model:c,style:{flex:`1`,"--trees-item-height":`32px`,"--trees-padding-inline-override":`var(--spacing-xs)`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`var(--spacing-xs)`,"--trees-item-row-gap-override":`var(--spacing-xs)`,"--trees-border-radius-override":`var(--radius-field)`,"--trees-bg-override":`var(--color-base-100)`,"--trees-fg-override":`var(--color-base-content)`,"--trees-bg-muted-override":`var(--color-base-200)`,"--trees-selected-bg-override":`var(--color-base-300)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`12px`}})]})}var pT={all:(e,t)=>[`inkcap-repository`,e,t],branch:(e,t,n)=>[...pT.all(e,t),n]};function mT({connection:e,repository:t,initialBranch:n,initialPath:r,openRequestId:i,transport:a,onReady:o}){let s=W(),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),[f,p]=(0,V.useState)(new Map),[m,h]=(0,V.useState)(``),g=(0,V.useRef)(new AbortController);(0,V.useEffect)(()=>{let e=new AbortController;return g.current=e,()=>{e.abort()}},[]);let _=(0,V.useCallback)((t,n)=>a?a(t,n):e.app.capabilities.require(Vf).call(`app_bonsai`,t,JSON.stringify(n)),[e.app,a]),v=(0,V.useCallback)((e,t)=>xh(e,t,_,g.current.signal,e=>{d(t=>t+(e?1:-1))}),[_]),y=(0,V.useCallback)(()=>{s.invalidateQueries({queryKey:pT.all(e.app.identity.surfaceId,t)})},[s,e.app,t]),b=(0,V.useRef)(new Map),x=(0,V.useMemo)(()=>{let r=`${e.app.identity.surfaceId}:${t}:${n}`,i=b.current.get(r);if(i?.app===e.app)return i;let a=Sh({repository:t,branch:n,request:v,onSaved:y,onSaveState:(e,r)=>{g.current.signal.aborted||p(i=>{let a=new Map(i),o=`${t}:${n}:${e}`;return r===null?a.delete(o):a.set(o,r),a})}}),o={app:e.app,source:a};return b.current.set(r,o),o},[t,n,v,y,e.app]),S=_h({connection:x}),C=xn({queryKey:pT.branch(e.app.identity.surfaceId,t,n),queryFn:()=>Ch(v,t,n),refetchInterval:15e3});(0,V.useEffect)(()=>e.app.window.onBeforeClose(S.requestWindowClose),[e.app,S.requestWindowClose]),(0,V.useEffect)(()=>{o?.({requestWindowClose:S.requestWindowClose})},[o,S.requestWindowClose]);let ee=(0,V.useRef)(),te=(0,V.useRef)(new Map),ne=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{if(!C.data)return;let e=`${x.app.identity.surfaceId}:${x.source.id}:${i}`;ee.current!==e&&(ee.current=e,S.onOpenFile(r));let t=te.current.get(x.source.id),n=t!==void 0&&t!==C.data.head;te.current.set(x.source.id,C.data.head);let a=new Set(S.tabs.map(e=>e.tabKey));for(let e of ne.current)a.has(e)||ne.current.delete(e);for(let e of S.tabs)if(!(e.target.closed||e.connection!==x||!n&&!ne.current.has(e.tabKey))){if(e.target.saving){ne.current.add(e.tabKey);continue}ne.current.delete(e.tabKey),e.target.dirty||S.onReopen(e,{background:!0})}},[C.data,x,r,i,S]);let w=S.tabs.find(e=>e.tabKey===S.active),T=w?.connection?.source?f.get(`${w.connection.source.id}:${w.path}`):void 0,E=T?.kind===`saved`?`Saved · syncing`:T?.kind===`synced`?`Synced · ${T.commit.slice(0,7)}`:T?.kind===`conflict`?`Sync conflict · Compare`:T?.kind===`failed`?`Sync failed · Retry`:void 0;async function re(){if(!w?.connection?.source)return;let e=b.current.get(`${w.connection.app.identity.surfaceId}:${w.connection.source.id}`);if(e)try{h(``),await e.source.retry(w.path,g.current.signal)}catch(e){console.error(`Bonsai sync retry failed`,e),h(`Could not retry sync. Your saved text remains in Bonsai.`)}}async function D(){if(!w?.connection?.source)return;let e=()=>!w.target.dirty&&!w.target.saving&&!w.target.closed;if(!e())return;let t=b.current.get(`${w.connection.app.identity.surfaceId}:${w.connection.source.id}`);if(t)try{h(``);let n=await t.source.read(w.path,g.current.signal);if(n.kind!==`text`)throw Error(`This saved text is unavailable.`);if(!e())return;await t.source.replace(w.path,n.contents,n.contents,g.current.signal)}catch(e){console.error(`Bonsai explicit re-save failed`,e),h(`Could not save again. Your saved text and open edits remain available.`)}}return(0,H.jsxs)(`div`,{className:`inkcap-repository`,children:[(0,H.jsxs)(`div`,{className:`inkcap-repository-toolbar`,children:[(0,H.jsxs)(`span`,{className:`inkcap-repository-name`,children:[(0,H.jsx)(Rm,{"aria-hidden":`true`}),` `,t,` · `,n]}),(0,H.jsxs)(ve,{size:`sm`,variant:`outline`,onClick:()=>{l(!0)},children:[(0,H.jsx)(zm,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),` `,`History`]})]}),u>0&&(0,H.jsx)(yh,{message:`Loading this repository…`}),C.data?.truncated&&(0,H.jsx)(Uf,{tone:`info`,title:`Only the indexed files are shown`}),m&&(0,H.jsx)(Uf,{tone:`error`,title:`Sync unavailable`,description:m}),T?.kind===`failed`&&(0,H.jsx)(Uf,{tone:`warning`,title:T.reason===`permanent_material`?`Sync needs a new save`:`Sync failed`,description:T.reason===`permanent_material`?`Your text is saved. Save again using the current repository state to retry sync.`:`Your file is saved in Bonsai. Retry when access is available.`,action:(0,H.jsx)(ve,{size:`sm`,disabled:T.reason===`permanent_material`&&w!==void 0&&(w.target.dirty||w.target.saving),onClick:()=>void(T.reason===`permanent_material`?D():re()),children:T.reason===`permanent_material`?`Save again`:`Retry`})}),(0,H.jsx)(ah,{model:{...S,repositoryStatus:E,repositoryStates:f,canList:!0,sourceLabel:x.source.label,onReadCurrent:async(e,t)=>{if(e.connection?.source?.kind!==`repository`)return S.onReadCurrent(e);let n=b.current.get(`${e.connection.app.identity.surfaceId}:${e.connection.source.id}`);if(!n||e.target.closed)throw Error(`This Bonsai file is no longer open.`);return t&&await n.source.discard(e.path,g.current.signal),n.source.readCommitted(e.path,g.current.signal)},error:C.error?`Could not refresh this repository. Your open edits remain available.`:S.error,fileTree:e=>(0,H.jsx)(fT,{files:C.data?.files??[],dirtyPaths:S.tabs.filter(e=>e.connection===x&&e.dirty).map(e=>e.path),activePath:w?.connection===x?w.path:null,busy:C.isFetching,onRefresh:y,onOpenFile:e})}}),(0,H.jsx)(Be,{open:c,onOpenChange:l,children:(0,H.jsxs)(Fe,{children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:`Commit history`}),(0,H.jsxs)(Se,{children:[t,` · `,n]})]}),(0,H.jsx)(`ol`,{className:`inkcap-repository-history`,children:C.data?.history.map(e=>(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`code`,{children:e.hash.slice(0,7)}),` `,e.message,(0,H.jsx)(`span`,{className:`text-dim`,children:e.author.name})]},e.hash))})]})})]})}function hT(e){if(e?.kind!==`navigate`||!e.params.some(({key:e})=>e===`repository`))return null;let t=qp(e.params);return t===null||!(`repository`in t)?`invalid`:{repository:t.repository,initialBranch:t.branch,initialPath:t.path,openRequestId:e.requestId}}function gT(e,t){return e.kind===`computer`||t.kind===`computer`?e.kind===t.kind:e.repository===t.repository&&e.initialBranch===t.initialBranch&&e.initialPath===t.initialPath&&e.openRequestId===t.openRequestId}function _T(e){let[t,n]=(0,V.useState)(e),r=(0,V.useRef)(null),i=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{if(!gT(e,t)){if(e.kind===t.kind){n(e);return}i.current||(i.current=!0,(r.current??(()=>Promise.resolve(!0)))().then(t=>{i.current=!1,t&&n(e)}))}},[e,t]),{mounted:t,registerHandle:(0,V.useCallback)(e=>{r.current=e},[])}}function vT({app:e,computerName:t,projectPath:n}){let r=Qd(e),i=hT(r?.openRequest??null),a=e?.capabilities.has(Vf)??!1,{mounted:o,registerHandle:s}=_T(i!==null&&i!==`invalid`&&a?{kind:`repository`,...i}:{kind:`computer`}),c=(0,V.useCallback)(e=>{s(e.requestWindowClose)},[s]);return o.kind===`repository`&&e!==null?(0,H.jsx)(mT,{connection:{app:e},repository:o.repository,initialBranch:o.initialBranch,initialPath:o.initialPath,openRequestId:o.openRequestId,onReady:c}):(0,H.jsxs)(H.Fragment,{children:[i===`invalid`?(0,H.jsx)(Uf,{tone:`warning`,title:`This repository link cannot be opened`,description:`Open the file again from Bonsai. Computer files and local drafts are still available.`}):i!==null&&!a&&(0,H.jsx)(Uf,{tone:`info`,title:`Repositories open from Bonsai`,description:`This host can still open Computer files and local drafts.`}),(0,H.jsx)(vh,{connection:e?{app:e}:null,context:{computerId:r?.computerId??null,computerName:t,projectPath:n},onReady:c})]})}var yT=document.getElementById(`inkcap-root`);if(!yT)throw Error(`Inkcap root is missing`);var bT=new URLSearchParams(window.location.search),xT=Re(k({project:v(A),computerName:v(A)}))({project:bT.get(`project`),computerName:bT.get(`computerName`)}),ST=xT.project?.trim()??`/`;Yd(yT,{name:`Inkcap`,queryClient:Lf()},({app:e})=>(0,V.createElement)(vT,{app:e,computerName:xT.computerName,projectPath:ST.startsWith(`/`)?ST:`/${ST}`}));export{It as A,vn as C,pn as D,hn as E,W as F,et as I,st as M,_t as N,un as O,vt as P,yn as S,gn as T,Ff as _,Zm as a,$r as b,Im as c,Qp as d,pm as f,Rf as g,Uf as h,Qm as i,Mt as j,Xt as k,Om as l,_m as m,Rh as n,Ym as o,fm as p,nh as r,Lm as s,dT as t,jm as u,$d as v,mn as w,_n as x,Qr as y};
|