@openspecui/web 3.12.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/assets/CanvasRenderer-CLQD6X5w.js +1 -0
  2. package/dist/assets/WebGLRenderer-CCytcJrB.js +1 -0
  3. package/dist/assets/WebGPURenderer-DAH_m5D3.js +1 -0
  4. package/dist/assets/browserAll-Dp578vps.js +1 -0
  5. package/dist/assets/{dist-BKjvVOkT.js → dist--fdiDhsa.js} +1 -1
  6. package/dist/assets/{dist-B6xgXKhe.js → dist-56Ibj2m1.js} +1 -1
  7. package/dist/assets/{dist-BxwBNcvc.js → dist-BhkpGj11.js} +1 -1
  8. package/dist/assets/{dist-QQTVUSFN.js → dist-BzodlTBW.js} +1 -1
  9. package/dist/assets/{dist-BK1hUUAT.js → dist-CKjYpdph.js} +1 -1
  10. package/dist/assets/{dist-QFwjfINk.js → dist-DKpbXO9V.js} +1 -1
  11. package/dist/assets/{dist-BXDJblZH.js → dist-DSyaj1iO.js} +1 -1
  12. package/dist/assets/dist-DT99Gaya.js +1 -0
  13. package/dist/assets/dist-D_hpFHgB.js +1 -0
  14. package/dist/assets/dist-DroIyWBO.js +1 -0
  15. package/dist/assets/{dist-BqptbA-e.js → dist-KjL9POKA.js} +1 -1
  16. package/dist/assets/{dist-jKjLdT3J.js → dist-v0p4Oxur.js} +1 -1
  17. package/dist/assets/{init-DDyEaeZC.js → init-CHa3E6Fn.js} +1 -1
  18. package/dist/assets/{main-CUcmBCb3.js → main-BzdJabcp.js} +8 -8
  19. package/dist/assets/trpc-D1nFWwj3.js +1 -0
  20. package/dist/assets/webworkerAll-CONHxfi1.js +1 -0
  21. package/dist/index.html +1 -1
  22. package/package.json +3 -3
  23. package/dist/assets/CanvasRenderer-CrOGFh2A.js +0 -1
  24. package/dist/assets/WebGLRenderer-D1gtW4Wt.js +0 -1
  25. package/dist/assets/WebGPURenderer-BigtxJOU.js +0 -1
  26. package/dist/assets/browserAll-BNotGm1D.js +0 -1
  27. package/dist/assets/dist-BQUZZEUE.js +0 -1
  28. package/dist/assets/dist-CJnrqTgc.js +0 -1
  29. package/dist/assets/dist-CsTUN8si.js +0 -1
  30. package/dist/assets/trpc-sRR2hWAJ.js +0 -1
  31. package/dist/assets/webworkerAll-BvYhXuRe.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trpc-sRR2hWAJ.js","assets/jsx-runtime-1jQlXmIx.js","assets/chunk-VBW0iQ51.js","assets/browserAll-BNotGm1D.js","assets/Geometry-Dr8DqqDe.js","assets/init-DDyEaeZC.js","assets/webworkerAll-BvYhXuRe.js","assets/WebGPURenderer-BigtxJOU.js","assets/WebGLRenderer-D1gtW4Wt.js","assets/CanvasRenderer-CrOGFh2A.js","assets/ghostty-web-CxzCiCWn.js","assets/preload-helper-DgFuoWHe.js","assets/dist-DBzjiykV.js","assets/dist-DhToCcpI.js","assets/dist-vqrjFRzf.js","assets/dist-CaejG1dm.js","assets/dist-CsTUN8si.js","assets/dist-jDblB_T7.js","assets/dist-QFwjfINk.js","assets/dist-Ct1D1r3D.js","assets/dist-DtDYJdOe.js","assets/dist-jKjLdT3J.js","assets/dist-BQUZZEUE.js","assets/dist-BxwBNcvc.js","assets/dist-BK1hUUAT.js","assets/dist-BXDJblZH.js","assets/dist-QQTVUSFN.js","assets/dist-YdUjCFVN.js","assets/dist-D65w4-0d.js","assets/dist-BKjvVOkT.js","assets/dist-CaORa3GR.js","assets/dist-lNuHRy_r.js","assets/dist-CJnrqTgc.js","assets/dockerfile-B9WyxmEu.js","assets/simple-mode-DW6rCJL0.js","assets/factor-DRSLM7tp.js","assets/nsis-BOISW3t0.js","assets/pug-RUWq2f7J.js","assets/javascript-DoCiwYd8.js","assets/dist-B6xgXKhe.js","assets/dist-BqptbA-e.js","assets/angular-html-DRwRMfwy.js","assets/html-BUh_K1Ws.js","assets/css-xQqtr90G.js","assets/javascript-CVtEj2Ax.js","assets/angular-ts-eNLzy5MM.js","assets/scss-CpCId5ps.js","assets/apl-DCKZGJwU.js","assets/json-C5SgWOeO.js","assets/xml-DANbtZOH.js","assets/java-CY_ZDz_b.js","assets/astro-EVzibiTP.js","assets/postcss-Bhprukf5.js","assets/tsx-CsYF3fAD.js","assets/typescript-BmTNzuQ_.js","assets/blade-BlgBU4xi.js","assets/html-derivative-CI0a_UC2.js","assets/sql-BOLSSU4F.js","assets/bsl-ROP5CocM.js","assets/sdbl-DcdijJCo.js","assets/c-CYXkGxNJ.js","assets/cairo-Y91V9cKj.js","assets/python-JifBw8Pd.js","assets/cobol-DwyfNZUw.js","assets/coffee-B8v2Wa7-.js","assets/cpp-ljtJvfZQ.js","assets/glsl-B14Nf0bw.js","assets/regexp-zEw_f83a.js","assets/crystal-D8eXAHcv.js","assets/shellscript-C9ppp5mf.js","assets/edge-BF9yTvjv.js","assets/elixir-B_B5En4k.js","assets/elm-gyEPvRKn.js","assets/erb-CrCiRjX6.js","assets/ruby-B0E3lf9H.js","assets/graphql-sQJ6gIy3.js","assets/jsx-lP4LEWkV.js","assets/haml-b85W5NJa.js","assets/lua-C-xH-Hms.js","assets/yaml-hgQ2rJ8K.js","assets/erlang-Bt6NlFdF.js","assets/markdown-UHPJkTEn.js","assets/fortran-fixed-form-BlyL6vAi.js","assets/fortran-free-form-D7-gzSM8.js","assets/fsharp-CPUyN5V2.js","assets/gdresource-3p4mNHpb.js","assets/gdscript-rt9_TXru.js","assets/gdshader-crF0MxG8.js","assets/git-commit-BUEnSUuI.js","assets/diff-CatgE3dT.js","assets/git-rebase-C31Q9wLE.js","assets/glimmer-js-C52Y4fUH.js","assets/glimmer-ts-BWcx8nGq.js","assets/hack-B3o_6UdT.js","assets/handlebars-D0WfzX4P.js","assets/http-D2LmS59K.js","assets/hurl-COx-msQh.js","assets/csv-BvaZ2T8c.js","assets/hxml-PXekqTur.js","assets/haxe-B256JjEJ.js","assets/jinja-DqDhfavg.js","assets/jison-AZhthQMg.js","assets/julia-Cj513uz1.js","assets/r-BuzK-O4X.js","assets/latex-DwZK1V4M.js","assets/tex-D_8z9IZF.js","assets/liquid-Bq0P5vJ7.js","assets/marko-B0ZA9L6u.js","assets/less-Cgo6VXQL.js","assets/mdc-BjV-9MeS.js","assets/nginx-BlGA_Yc6.js","assets/nim-BRY7cBHe.js","assets/perl-ZYxvPTl8.js","assets/php-BkicJQpQ.js","assets/pug-CtobE3oR.js","assets/qml-bFAbyxEk.js","assets/razor-BdPQn0FN.js","assets/csharp-CRgWAKTP.js","assets/rst-DKhAJU51.js","assets/cmake-CsF3WHAq.js","assets/sas-DURk68cf.js","assets/shaderlab-F_37C8HY.js","assets/hlsl-D0l9oydz.js","assets/shellsession-Bz7lU47b.js","assets/soy-BhKWbuAF.js","assets/sparql-C2li3eXU.js","assets/turtle-vnW9ZH2N.js","assets/stata-BT_KvsDz.js","assets/svelte-CDr7VO4q.js","assets/templ-nVp5md9X.js","assets/go-BD7Erf5u.js","assets/ts-tags-B9PwlsPz.js","assets/twig-DhcsZkOG.js","assets/vue-9hbz3kVV.js","assets/vue-html-DeYWClYd.js","assets/vue-vine-0B8BRjOA.js","assets/stylus-BGkOI8rZ.js","assets/xsl-Dxfe-dB3.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,r,t as i}from"./chunk-VBW0iQ51.js";import"./modulepreload-polyfill-CXK8biUa.js";import{n as a,t as o}from"./client-CNtwgWOm.js";import{n as s,t as c}from"./jsx-runtime-1jQlXmIx.js";import{t as l}from"./preload-helper-DgFuoWHe.js";import{$ as u,A as d,B as f,C as p,E as m,F as h,G as g,H as _,I as v,J as y,K as b,L as x,N as S,O as C,P as w,Q as T,R as E,T as D,U as O,W as k,X as A,Y as j,Z as M,_ as N,a as P,b as F,c as ee,d as I,et as L,f as R,g as z,h as te,i as B,it as V,j as ne,k as re,l as ie,m as ae,n as oe,nt as se,o as ce,q as le,r as ue,rt as H,s as de,t as fe,tt as pe,u as me,v as he,w as ge,x as _e,y as ve,z as ye}from"./Geometry-Dr8DqqDe.js";import{t as be}from"./ImageSource-CGpyv_SH.js";import{C as xe,D as Se,E as Ce,O as we,S as Te,T as Ee,_ as De,a as Oe,b as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,i as Fe,k as Ie,l as Le,m as Re,n as ze,o as Be,p as Ve,r as He,s as Ue,t as We,u as Ge,v as Ke,w as qe,x as Je,y as Ye}from"./RenderTargetSystem-COjjAuAB.js";import{t as Xe}from"./getTextureBatchBindGroup-BfHjyiAV.js";import{a as Ze,c as Qe,d as $e,f as et,i as tt,l as nt,n as rt,o as it,p as at,r as ot,s as st,t as ct,u as lt}from"./BufferResource-C08dlE1_.js";import{$ as ut,A as dt,At as ft,B as pt,C as mt,Ct as ht,D as gt,Dt as _t,E as vt,Et as yt,F as bt,Ft as xt,G as St,H as Ct,I as wt,It as Tt,K as Et,L as Dt,Lt as Ot,M as kt,Mt as At,Nt as jt,O as Mt,Ot as Nt,P as Pt,Pt as Ft,Q as It,R as U,S as Lt,St as Rt,T as zt,Tt as Bt,U as Vt,V as Ht,W as Ut,X as Wt,Y as Gt,Z as Kt,_ as qt,a as Jt,at as Yt,b as Xt,bt as Zt,c as Qt,ct as $t,d as en,dt as tn,et as nn,f as rn,ft as an,g as on,gt as sn,h as cn,i as ln,it as un,j as dn,jt as fn,k as pn,kt as mn,l as W,lt as hn,m as gn,mt as _n,n as vn,nt as yn,o as bn,p as xn,pt as Sn,q as Cn,r as wn,rt as Tn,s as En,st as Dn,t as On,u as kn,ut as An,v as jn,vt as Mn,w as Nn,wt as Pn,x as Fn,xt as In,z as Ln}from"./dist-vqrjFRzf.js";import{a as Rn,i as eee,n as zn,o as tee,r as Bn}from"./dist-Ct1D1r3D.js";import{i as nee,n as ree,o as iee,r as aee,t as oee}from"./dist-DhToCcpI.js";var Vn=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(){}},see={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hn=new class{#e=see;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 cee(e){setTimeout(e,0)}var Un=typeof window>`u`||`Deno`in globalThis;function Wn(){}function lee(e,t){return typeof e==`function`?e(t):e}function Gn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Kn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qn(e,t){return typeof e==`function`?e(t):e}function Jn(e,t){return typeof e==`function`?e(t):e}function Yn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Zn(o,t.options))return!1}else if(!$n(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 Xn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Qn(t.options.mutationKey)!==Qn(a))return!1}else if(!$n(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Zn(e,t){return(t?.queryKeyHashFn||Qn)(e)}function Qn(e){return JSON.stringify(e,(e,t)=>nr(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $n(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>$n(e[n],t[n])):!1}var uee=Object.prototype.hasOwnProperty;function er(e,t){if(e===t)return e;let n=dee(e)&&dee(t);if(!n&&!(nr(e)&&nr(t)))return t;let r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?Array(a):{},s=0;for(let c=0;c<a;c++){let a=n?c:i[c],l=e[a],u=t[a];if(l===u){o[a]=l,(n?c<r:uee.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=er(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function tr(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 dee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nr(e){if(!fee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!fee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function fee(e){return Object.prototype.toString.call(e)===`[object Object]`}function pee(e){return new Promise(t=>{Hn.setTimeout(t,e)})}function rr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:er(e,t)}function mee(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function hee(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ir=Symbol();function ar(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ir?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function or(e,t){return typeof e==`function`?e(...t):!!e}var sr=new class extends Vn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Un&&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`}};function cr(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var gee=cee;function _ee(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=gee,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 lr=_ee(),ur=new class extends Vn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Un&&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 vee(e){return Math.min(1e3*2**e,3e4)}function dr(e){return(e??`online`)===`online`?ur.isOnline():!0}var fr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function pr(e){let t=!1,n=0,r,i=cr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new fr(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>sr.isFocused()&&(e.networkMode===`always`||ur.isOnline())&&e.canRun(),u=()=>dr(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())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(d).catch(r=>{if(a())return;let i=e.retry??(Un?0:3),o=e.retryDelay??vee,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),pee(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var mr=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gn(this.gcTime)&&(this.#e=Hn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Un?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Hn.clearTimeout(this.#e),void 0)}},yee=class extends mr{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=_r(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=_r(this.options);e.data!==void 0&&(this.setState(gr(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=rr(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Wn).catch(Wn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Jn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ir||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>qn(e.options.staleTime,this)===`static`):!1}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:!Kn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.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.#o=!0,n.signal)})},i=()=>{let e=ar(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!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.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=pr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof fr&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof fr){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(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,...hr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...gr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=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`};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),lr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function hr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function gr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function _r(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 vr=class extends Vn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=cr(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),yr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return br(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return br(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 Jn(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&&!tr(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&xr(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Jn(this.options.enabled,this.#t)!==Jn(t.enabled,this.#t)||qn(this.options.staleTime,this.#t)!==qn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Jn(this.options.enabled,this.#t)!==Jn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return xee(this,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),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.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);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Wn)),t}#g(){this.#b();let e=qn(this.options.staleTime,this.#t);if(Un||this.#r.isStale||!Gn(e))return;let t=Kn(this.#r.dataUpdatedAt,e)+1;this.#d=Hn.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.#p=e,!(Un||Jn(this.options.enabled,this.#t)===!1||!Gn(this.#p)||this.#p===0)&&(this.#f=Hn.setInterval(()=>{(this.options.refetchIntervalInBackground||sr.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(Hn.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(Hn.clearInterval(this.#f),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&&yr(e,t),o=i&&xr(e,n,t,r);(a||o)&&(l={...l,...hr(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.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=rr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=rr(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={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:l.dataUpdateCount>0||l.errorUpdateCount>0,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:Sr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Jn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=e=>{x.status===`error`?e.reject(x.error):x.data!==void 0&&e.resolve(x.data)},r=()=>{t(this.#o=x.promise=cr())},i=this.#o;switch(i.status){case`pending`:e.queryHash===n.queryHash&&t(i);break;case`fulfilled`:(x.status===`error`||x.data!==i.value)&&r();break;case`rejected`:(x.status!==`error`||x.error!==i.reason)&&r();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!tr(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);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)})})()}))}#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()}#C(e){lr.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function bee(e,t){return Jn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function yr(e,t){return bee(e,t)||e.state.data!==void 0&&br(e,t,t.refetchOnMount)}function br(e,t,n){if(Jn(t.enabled,e)!==!1&&qn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Sr(e,t)}return!1}function xr(e,t,n,r){return(e!==t||Jn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Sr(e,n)}function Sr(e,t){return Jn(t.enabled,e)!==!1&&e.isStaleByTime(qn(t.staleTime,e))}function xee(e,t){return!tr(e.getCurrentResult(),t)}function Cr(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=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener(`abort`,()=>{n=!0}),t.signal)})},u=ar(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?hee:mee;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?See:wr,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:wr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function wr(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 See(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Cee(e,t){return t?wr(e,t)!=null:!1}function wee(e,t){return!t||!e.getPreviousPageParam?!1:See(e,t)!=null}var Tee=class extends vr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Cr()})}getOptimisticResult(e){return e.behavior=Cr(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Cee(t,n.data),hasPreviousPage:wee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Eee=class extends mr{#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||Dee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=pr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{throw await this.#n.config.onError?.(t,e,this.state.context,this,n),await this.options.onError?.(t,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,t,e,this.state.context,n),t}finally{this.#i({type:`error`,error:t})}}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),lr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Dee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Oee=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Eee({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=Tr(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=Tr(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=Tr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Tr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lr.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=>Xn(t,e))}findAll(e={}){return this.getAll().filter(t=>Xn(e,t))}notify(e){lr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Wn))))}};function Tr(e){return e.options.scope?.id}var kee=class extends Vn{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),tr(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Qn(t.mutationKey)!==Qn(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Dee();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){lr.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type===`success`?(this.#r.onSuccess?.(e.data,t,n,r),this.#r.onSettled?.(e.data,null,t,n,r)):e?.type===`error`&&(this.#r.onError?.(e.error,t,n,r),this.#r.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#t)})})}};function Er(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Aee(e,t,n){let r=e.slice(0);return r[t]=n,r}var jee=class extends Vn{#e;#t;#n;#r;#i;#a;#o;#s;#c=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,lr.batch(()=>{let e=this.#i,t=this.#d(this.#n);this.#c=t,t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!tr(e,n)});!o&&!s||(o&&(this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Er(e,n).forEach(e=>{e.destroy()}),Er(n,e).forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})),this.#p()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#d(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[r,e=>this.#u(e??r,t),()=>this.#l(r,n)]}#l(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#u(e,t){return t?((!this.#a||this.#t!==this.#s||t!==this.#o)&&(this.#o=t,this.#s=this.#t,this.#a=er(this.#a,t(e))),this.#a):e}#d(e){let t=new Map(this.#i.map(e=>[e.options.queryHash,e])),n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new vr(this.#e,r)})}),n}#f(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Aee(this.#t,n,t),this.#p())}#p(){if(this.hasListeners()){let e=this.#a,t=this.#l(this.#t,this.#c);e!==this.#u(t,this.#r?.combine)&&lr.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Mee=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Zn(r,t),a=this.get(i);return a||(a=new yee({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(){lr.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=>Yn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Yn(e,t)):t}notify(e){lr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Nee=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mee,this.#t=e.mutationCache||new Oee,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=sr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ur.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(qn(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=lee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lr.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;lr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lr.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=lr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Wn).catch(Wn)}invalidateQueries(e,t={}){return lr.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=lr.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(Wn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Wn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Wn).catch(Wn)}fetchInfiniteQuery(e){return e.behavior=Cr(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Wn).catch(Wn)}ensureInfiniteQueryData(e){return e.behavior=Cr(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ur.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(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{$n(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{$n(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Zn(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===ir&&(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()}},G=e(s(),1),K=c(),Dr=G.createContext(void 0),Or=e=>{let t=G.useContext(Dr);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Pee=({client:e,children:t})=>(G.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,K.jsx)(Dr.Provider,{value:e,children:t})),kr=G.createContext(!1),Ar=()=>G.useContext(kr);kr.Provider;function Fee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Iee=G.createContext(Fee()),jr=()=>G.useContext(Iee),Mr=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Nr=e=>{G.useEffect(()=>{e.clearReset()},[e])},Pr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||or(n,[e.error,r])),Fr=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))}},Ir=(e,t)=>e.isLoading&&e.isFetching&&!t,Lr=(e,t)=>e?.suspense&&t.isPending,Rr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Lee({queries:e,...t},n){let r=Or(n),i=Ar(),a=jr(),o=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Fr(e),Mr(e,a)}),Nr(a);let[s]=G.useState(()=>new jee(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;G.useSyncExternalStore(G.useCallback(e=>d?s.subscribe(lr.batchCalls(e)):Wn,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),G.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Lr(o[t],e))?c.flatMap((e,t)=>{let n=o[t];if(n){let t=new vr(r,n);if(Lr(n,e))return Rr(n,t,a);Ir(e,i)&&Rr(n,t,a)}return[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Pr({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function zr(e,t,n){let r=Ar(),i=jr(),a=Or(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?`isRestoring`:`optimistic`,Fr(o),Mr(o,i),Nr(i);let s=!a.getQueryCache().get(o.queryHash),[c]=G.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(G.useSyncExternalStore(G.useCallback(e=>{let t=u?c.subscribe(lr.batchCalls(e)):Wn;return c.updateResult(),t},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),G.useEffect(()=>{c.setOptions(o)},[o,c]),Lr(o,l))throw Rr(o,c,i);if(Pr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Un&&Ir(l,r)&&(s?Rr(o,c,i):a.getQueryCache().get(o.queryHash)?.promise)?.catch(Wn).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?l:c.trackResult(l)}function Br(e,t){return zr(e,vr,t)}function Ree(e){return e}function zee(e){return e}function Vr(e,t){let n=Or(t),[r]=G.useState(()=>new kee(n,e));G.useEffect(()=>{r.setOptions(e)},[r,e]);let i=G.useSyncExternalStore(G.useCallback(e=>r.subscribe(lr.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=G.useCallback((e,t)=>{r.mutate(e,t).catch(Wn)},[r]);if(i.error&&or(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Bee(e,t){return zr(e,Tee,t)}var Hr=new WeakMap,Vee=new WeakMap,Ur={current:[]},Wr=!1,Gr=0,Kr=new Set,qr=new Map;function Jr(e){for(let t of e){if(Ur.current.includes(t))continue;Ur.current.push(t),t.recompute();let e=Vee.get(t);if(e)for(let t of e){let e=Hr.get(t);e?.length&&Jr(e)}}}function Hee(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Uee(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Yr(e){if(Gr>0&&!qr.has(e)&&qr.set(e,e.prevState),Kr.add(e),!(Gr>0)&&!Wr)try{for(Wr=!0;Kr.size>0;){let e=Array.from(Kr);Kr.clear();for(let t of e)t.prevState=qr.get(t)??t.prevState,Hee(t);for(let t of e){let e=Hr.get(t);e&&(Ur.current.push(t),Jr(e))}for(let t of e){let e=Hr.get(t);if(e)for(let t of e)Uee(t)}}}finally{Wr=!1,Ur.current=[],qr.clear()}}function Xr(e){Gr++;try{e()}finally{if(Gr--,Gr===0){let e=Kr.values().next().value;e&&Yr(e)}}}function Wee(e){return typeof e==`function`}var Gee=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):Wee(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),Yr(this)}},Zr=`__TSR_index`,Qr=`popstate`,$r=`beforeunload`;function ei(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=ni(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Zr];i=ti(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Zr];i=ti(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Zr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function ti(e,t){t||={};let n=ri();return{...t,key:n,__TSR_key:n,[Zr]:e}}function Kee(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>ni(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ri();t.history.replaceState({[Zr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=ni(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Zr]-l.state[Zr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=ei({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener($r,S,{capture:!0}),t.removeEventListener(Qr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener($r,S,{capture:!0}),t.addEventListener(Qr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function ni(e,t){let n=e.indexOf(`#`),r=e.indexOf(`?`),i=ri();return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):``,search:r>-1?e.slice(r,n===-1?void 0:n):``,state:t||{[Zr]:0,key:i,__TSR_key:i}}}function ri(){return(Math.random()+1).toString(36).substring(7)}function ii(e){return e[e.length-1]}function qee(e){return typeof e==`function`}function ai(e,t){return qee(e)?e(t):e}var Jee=Object.prototype.hasOwnProperty;function oi(e,t){if(e===t)return e;let n=t,r=Zee(e)&&Zee(n);if(!r&&!(si(e)&&si(n)))return n;let i=r?e:Yee(e);if(!i)return n;let a=r?n:Yee(n);if(!a)return n;let o=i.length,s=a.length,c=r?Array(s):{},l=0;for(let t=0;t<s;t++){let i=r?t:a[t],s=e[i],u=n[i];if(s===u){c[i]=s,(r?t<o:Jee.call(e,i))&&l++;continue}if(s===null||u===null||typeof s!=`object`||typeof u!=`object`){c[i]=u;continue}let d=oi(s,u);c[i]=d,d===s&&l++}return o===s&&l===o?e:c}function Yee(e){let t=[],n=Object.getOwnPropertyNames(e);for(let r of n){if(!Object.prototype.propertyIsEnumerable.call(e,r))return!1;t.push(r)}let r=Object.getOwnPropertySymbols(e);for(let n of r){if(!Object.prototype.propertyIsEnumerable.call(e,n))return!1;t.push(n)}return t}function si(e){if(!Xee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Xee(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Xee(e){return Object.prototype.toString.call(e)===`[object Object]`}function Zee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ci(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!ci(e[r],t[r],n))return!1;return!0}if(si(e)&&si(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!ci(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!ci(e[o],t[o],n)))return!1;return i===a}return!1}function li(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function ui(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function di(e){try{return decodeURI(e)}catch{return e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}}function fi(e,t){if(!e)return e;let n=t?RegExp(`${t.join(`|`)}`,`gi`):/%25|%5C/gi,r=0,i=``,a;for(;(a=n.exec(e))!==null;)i+=di(e.slice(r,a.index))+a[0],r=n.lastIndex;return i+di(r?e.slice(r):e)}var Qee=!0,pi=`Invariant failed`;function mi(e,t){if(!e){if(Qee)throw Error(pi);var n=typeof t==`function`?t():t,r=n?`${pi}: ${n}`:pi;throw Error(r)}}function hi(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var $ee=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,ete=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,tte=/^([^{]*)\{\$\}([^}]*)$/;function gi(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.match(tte);if(o){let r=o[1].length;return n[0]=2,n[1]=t+r,n[2]=t+r+1,n[3]=t+r+2,n[4]=t+r+3,n[5]=e.length,n}let s=a.match(ete);if(s){let e=s[1],r=s[2],a=s[3],o=e.length;return n[0]=3,n[1]=t+o,n[2]=t+o+3,n[3]=t+o+3+r.length,n[4]=i-a.length,n[5]=i,n}let c=a.match($ee);if(c){let e=c[1],r=c[2],a=c[3],o=e.length;return n[0]=1,n[1]=t+o,n[2]=t+o+2,n[3]=t+o+2+r.length,n[4]=i-a.length,n[5]=i,n}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function _i(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e;for(;s<o;){let e=gi(r,s,t),o,l=s,u=e[5];switch(s=u+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=bi(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=bi(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=i.dynamic?.find(e=>e.caseSensitive===d&&e.prefix===f&&e.suffix===p);if(m)o=m;else{let e=xi(1,n.fullPath??n.from,d,f,p);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=i.optional?.find(e=>e.caseSensitive===d&&e.prefix===f&&e.suffix===p);if(m)o=m;else{let e=xi(3,n.fullPath??n.from,d,f,p);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=xi(2,n.fullPath??n.from,d,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if((n.path||!n.children)&&!n.isRoot){let e=r.endsWith(`/`);e||(i.notFound=n),(!i.route||!i.isIndex&&e)&&(i.route=n),i.isIndex||=e}}if(n.children)for(let r of n.children)_i(e,t,r,s,i,a,o)}function vi(e,t){if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function yi(e){if(e.static)for(let t of e.static.values())yi(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())yi(t);if(e.dynamic?.length){e.dynamic.sort(vi);for(let t of e.dynamic)yi(t)}if(e.optional?.length){e.optional.sort(vi);for(let t of e.optional)yi(t)}if(e.wildcard?.length){e.wildcard.sort(vi);for(let t of e.wildcard)yi(t)}}function bi(e){return{kind:0,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,isIndex:!1,notFound:null}}function xi(e,t,n,r,i){return{kind:e,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,isIndex:!1,notFound:null,caseSensitive:n,prefix:r,suffix:i}}function nte(e,t){let n=bi(`/`),r=new Uint16Array(6);for(let t of e)_i(!1,r,t,1,n,0);yi(n),t.masksTree=n,t.flatCache=hi(1e3)}function rte(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Si(e,t.masksTree);return t.flatCache.set(e,r),r}function ite(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=bi(`/`),_i(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Si(r,o,n)}function ate(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a=Si(e,t.segmentTree,n);return a&&(a.branch=lte(a.route)),t.matchCache.set(r,a),a}function ote(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ste(e,t=!1,n){let r=bi(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return _i(t,i,e,1,r,0,e=>{if(n?.(e,s),mi(!(e.id in a),`Duplicate routes found with id: ${String(e.id)}`),a[e.id]=e,s!==0&&e.path){let t=ote(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),yi(r),{processedTree:{segmentTree:r,singleCache:hi(1e3),matchCache:hi(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Si(e,t,n=!1){let r=e.split(`/`),i=dte(e,r,t,n);if(!i)return null;let a=cte(e,r,i),o=`**`in i;return o&&(a[`**`]=i[`**`]),{route:o?i.node.notFound??i.node.route:i.node.route,params:a}}function cte(e,t,n){let r=ute(n.node),i=null,a={};for(let o=0,s=0,c=0;s<r.length;o++,s++,c++){let l=r[s],u=t[o],d=c;if(u&&(c+=u.length),l.kind===1){i??=n.node.fullPath.split(`/`);let e=i[s],t=l.prefix?.length??0;if(e.charCodeAt(t)===123){let n=l.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=u.substring(t,u.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(u)}}else if(l.kind===3){if(n.skipped&1<<s){o--;continue}i??=n.node.fullPath.split(`/`);let e=i[s],t=l.prefix?.length??0,r=l.suffix?.length??0,c=e.substring(t+3,e.length-r-1),d=l.suffix||l.prefix?u.substring(t,u.length-r):u;d&&(a[c]=decodeURIComponent(d))}else if(l.kind===2){let t=l,n=e.substring(d+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return a}function lte(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ute(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function dte(e,t,n,r){let i=!ii(t),a=i&&e!==`/`,o=t.length-(i?1:0),s=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}],c=null,l=null,u=null;for(;s.length;){let e=s.pop(),{node:n,index:i,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=e;r&&n.notFound&&Ci(l,e)&&(l=e);let g=i===o;if(g){if(n.route&&(!a||n.isIndex)&&(Ci(u,e)&&(u=e),p===o&&n.isIndex))return u;if(!n.optional&&!n.wildcard)continue}let _=g?void 0:t[i],v;if(n.wildcard&&Ci(c,e))for(let e of n.wildcard){let{prefix:n,suffix:r}=e;if(!(n&&(g||!(e.caseSensitive?_:v??=_.toLowerCase()).startsWith(n)))){if(r){if(g)continue;let n=t.slice(i).join(`/`).slice(-r.length);if((e.caseSensitive?n:n.toLowerCase())!==r)continue}c={node:e,index:i,skipped:d,depth:f,statics:p,dynamics:m,optionals:h};break}}if(n.optional){let e=d|1<<f,t=f+1;for(let r=n.optional.length-1;r>=0;r--){let a=n.optional[r];s.push({node:a,index:i,skipped:e,depth:t,statics:p,dynamics:m,optionals:h})}if(!g)for(let e=n.optional.length-1;e>=0;e--){let r=n.optional[e],{prefix:a,suffix:o}=r;if(a||o){let e=r.caseSensitive?_:v??=_.toLowerCase();if(a&&!e.startsWith(a)||o&&!e.endsWith(o))continue}s.push({node:r,index:i+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+1})}}if(!g&&n.dynamic&&_)for(let e=n.dynamic.length-1;e>=0;e--){let t=n.dynamic[e],{prefix:r,suffix:a}=t;if(r||a){let e=t.caseSensitive?_:v??=_.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:t,index:i+1,skipped:d,depth:f+1,statics:p,dynamics:m+1,optionals:h})}if(!g&&n.staticInsensitive){let e=n.staticInsensitive.get(v??=_.toLowerCase());e&&s.push({node:e,index:i+1,skipped:d,depth:f+1,statics:p+1,dynamics:m,optionals:h})}if(!g&&n.static){let e=n.static.get(_);e&&s.push({node:e,index:i+1,skipped:d,depth:f+1,statics:p+1,dynamics:m,optionals:h})}}if(u)return u;if(c)return c;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return{node:l.node,skipped:l.skipped,"**":decodeURIComponent(r)}}return null}function Ci(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&(t.node.isIndex>e.node.isIndex||t.node.isIndex===e.node.isIndex&&t.depth>e.depth))):!0}function wi(e){return Ti(e.filter(e=>e!==void 0).join(`/`))}function Ti(e){return e.replace(/\/{2,}/g,`/`)}function Ei(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Di(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Oi(e){return Di(Ei(e))}function ki(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function fte(e,t,n){return ki(e,n)===ki(t,n)}function pte({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&ii(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(ii(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c,l=``;for(let e=0;e<s.length;e++){e>0&&(l+=`/`);let t=s[e];if(!t)continue;c=gi(t,0,c);let n=c[0];if(n===0){l+=t;continue}let r=c[5],i=t.substring(0,c[1]),a=t.substring(c[4],r),o=t.substring(c[2],c[3]);n===1?l+=i||a?`${i}{$${o}}${a}`:`$${o}`:n===2?l+=i||a?`${i}{$}${a}`:`$`:l+=`${i}{-$${o}}${a}`}l=Ti(l);let u=l||`/`;return o&&r&&r.set(o,u),u}function Ai(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?encodeURI(r):mte(r,n):r}function ji({path:e,params:t,decodeCharMap:n}){let r=!1,i={};if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:i,isMissingParams:r};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:i,isMissingParams:r};let a=e.length,o=0,s,c=``;for(;o<a;){let a=o;s=gi(e,a,s);let l=s[5];if(o=l+1,a===l)continue;let u=s[0];if(u===0){c+=`/`+e.substring(a,l);continue}if(u===2){let o=t._splat;i._splat=o,i[`*`]=o;let u=e.substring(a,s[1]),d=e.substring(s[4],l);if(!o){r=!0,(u||d)&&(c+=`/`+u+d);continue}let f=Ai(`_splat`,t,n);c+=`/`+u+f+d;continue}if(u===1){let o=e.substring(s[2],s[3]);!r&&!(o in t)&&(r=!0),i[o]=t[o];let u=e.substring(a,s[1]),d=e.substring(s[4],l),f=Ai(o,t,n)??`undefined`;c+=`/`+u+f+d;continue}if(u===3){let r=e.substring(s[2],s[3]),o=t[r];if(o==null)continue;i[r]=o;let u=e.substring(a,s[1]),d=e.substring(s[4],l),f=Ai(r,t,n)??``;c+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(c+=`/`),{usedParams:i,interpolatedPath:c||`/`,isMissingParams:r}}function mte(e,t){let n=encodeURIComponent(e);if(t)for(let[e,r]of t)n=n.replaceAll(e,r);return n}function Mi(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function Ni(e){return!!e?.isNotFound}function hte(){try{if(typeof window<`u`&&typeof window.sessionStorage==`object`)return window.sessionStorage}catch{}}var Pi=`tsr-scroll-restoration-v1_3`,gte=(e,t)=>{let n;return(...r)=>{n||=setTimeout(()=>{e(...r),n=null},t)}};function _te(){let e=hte();if(!e)return null;let t=e.getItem(Pi),n=t?JSON.parse(t):{};return{state:n,set:t=>(n=ai(t,n)||n,e.setItem(Pi,JSON.stringify(n)))}}var Fi=_te(),Ii=e=>e.state.__TSR_key||e.href;function vte(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var Li=!1;function Ri({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:i,location:a}){let o;try{o=JSON.parse(sessionStorage.getItem(e)||`{}`)}catch(e){console.error(e);return}let s=t||window.history.state?.__TSR_key,c=o[s];Li=!0;scroll:{if(r&&c&&Object.keys(c).length>0){for(let e in c){let t=c[e];if(e===`window`)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){let n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}break scroll}let e=(a??window.location).hash.split(`#`,2)[1];if(e){let t=window.history.state?.__hashScrollIntoViewOptions??!0;if(t){let n=document.getElementById(e);n&&n.scrollIntoView(t)}break scroll}let t={top:0,left:0,behavior:n};if(window.scrollTo(t),i)for(let e of i){if(e===`window`)continue;let n=typeof e==`function`?e():document.querySelector(e);n&&n.scrollTo(t)}}Li=!1}function yte(e,t){if(!Fi&&!e.isServer||((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isServer||e.isScrollRestorationSetup||!Fi))return;e.isScrollRestorationSetup=!0,Li=!1;let n=e.options.getScrollRestorationKey||Ii;window.history.scrollRestoration=`manual`,typeof document<`u`&&document.addEventListener(`scroll`,gte(t=>{if(Li||!e.isScrollRestoring)return;let r=``;if(t.target===document||t.target===window)r=`window`;else{let e=t.target.getAttribute(`data-scroll-restoration-id`);r=e?`[data-scroll-restoration-id="${e}"]`:vte(t.target)}let i=n(e.state.location);Fi.set(e=>{let t=e[i]||={},n=t[r]||={};if(r===`window`)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){let e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})},100),!0),e.subscribe(`onRendered`,t=>{let r=n(t.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation})||(Ri({storageKey:Pi,key:r,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Fi.set(e=>(e[r]||={},e)))})}function bte(e){if(typeof document<`u`&&document.querySelector){let t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==``){let n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function xte(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function zi(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Ste(e){let t=new URLSearchParams(e),n={};for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=zi(r):Array.isArray(t)?t.push(zi(r)):n[e]=[t,zi(r)]}return n}var Cte=Tte(JSON.parse),wte=Ete(JSON.stringify,JSON.parse);function Tte(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Ste(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Ete(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=xte(e,r);return t?`?${t}`:``}}var Bi=`__root__`;function Dte(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Vi(e){return e instanceof Response&&!!e.options}var Hi=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Ui=(e,t)=>!!(e.preload&&!e.router.state.matches.some(e=>e.id===t)),Wi=(e,t)=>{let n=e.router.routesById[t.routeId??``]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),mi(n.options.notFoundComponent,`No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.`);let r=e.matches.find(e=>e.routeId===n.id);mi(r,`Could not find match for route: `+n.id),e.updateMatch(r.id,e=>({...e,status:`notFound`,error:t,isFetching:!1})),t.routerCode===`BEFORE_LOAD`&&n.parentRoute&&(t.routeId=n.parentRoute.id,Wi(e,t))},Gi=(e,t,n)=>{if(!(!Vi(n)&&!Ni(n))){if(Vi(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;let r=Vi(n)?`redirected`:`notFound`;t._nonReactive.error=n,e.updateMatch(t.id,e=>({...e,status:r,isFetching:!1,error:n})),Ni(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Vi(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(Wi(e,n),n)}},Ki=(e,t)=>{let n=e.router.getMatch(t);return!!(!e.router.isServer&&n._nonReactive.dehydrated||e.router.isServer&&n.ssr===!1)},qi=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Gi(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,Gi(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},Ote=(e,t,n,r)=>{let i=e.router.getMatch(t),a=e.matches[n-1]?.id,o=a?e.router.getMatch(a):void 0;if(e.router.isShell()){i.ssr=r.id===Bi;return}if(o?.ssr===!1){i.ssr=!1;return}let s=e=>e===!0&&o?.ssr===`data-only`?`data-only`:e,c=e.router.options.defaultSsr??!0;if(r.options.ssr===void 0){i.ssr=s(c);return}if(typeof r.options.ssr!=`function`){i.ssr=s(r.options.ssr);return}let{search:l,params:u}=i,d={search:$i(l,i.searchError),params:$i(u,i.paramsError),location:e.location,matches:e.matches.map(e=>({index:e.index,pathname:e.pathname,fullPath:e.fullPath,staticData:e.staticData,id:e.id,routeId:e.routeId,search:$i(e.search,e.searchError),params:$i(e.params,e.paramsError),ssr:e.ssr}))},f=r.options.ssr(d);if(ui(f))return f.then(e=>{i.ssr=s(e??c)});i.ssr=s(f??c)},Ji=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!e.router.isServer&&!Ui(e,t)&&(n.options.loader||n.options.beforeLoad||Pte(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Hi(e)},i);r._nonReactive.pendingTimeout=t}},kte=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Ji(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Gi(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Ate=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=li(()=>{a?.resolve()});let{paramsError:o,searchError:s}=i;o&&qi(e,n,o,`PARSE_PARAMS`),s&&qi(e,n,s,`VALIDATE_SEARCH`),Ji(e,t,r,i);let c=new AbortController,l=e.matches[n-1]?.id,u={...(l?e.router.getMatch(l):void 0)?.context??e.router.options.context??void 0,...i.__routeContext},d=!1,f=()=>{d||(d=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c,context:u})))},p=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){Xr(()=>{f(),p()});return}i._nonReactive.beforeLoadPromise=li();let{search:m,params:h,cause:g}=i,_=Ui(e,t),v={search:m,abortController:c,params:h,preload:_,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:_?`preload`:g,matches:e.matches,...e.router.options.additionalContext},y=r=>{if(r===void 0){Xr(()=>{f(),p()});return}(Vi(r)||Ni(r))&&(f(),qi(e,n,r,`BEFORE_LOAD`)),Xr(()=>{f(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r,context:{...e.context,...r}})),p()})},b;try{if(b=r.options.beforeLoad(v),ui(b))return f(),b.catch(t=>{qi(e,n,t,`BEFORE_LOAD`)}).then(y)}catch(t){f(),qi(e,n,t,`BEFORE_LOAD`)}y(b)},jte=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>{if(e.router.isServer){let r=Ote(e,n,t,i);if(ui(r))return r.then(s)}return s()},o=()=>Ate(e,n,t,i),s=()=>{if(Ki(e,n))return;let t=kte(e,n,i);return ui(t)?t.then(o):o()};return a()},Yi=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Xi=(e,t,n,r)=>{let i=e.matchPromises[n-1],{params:a,loaderDeps:o,abortController:s,cause:c}=e.router.getMatch(t),l=e.router.options.context??{};for(let t=0;t<=n;t++){let n=e.matches[t];if(!n)continue;let r=e.router.getMatch(n.id);r&&(l={...l,...r.__routeContext??{},...r.__beforeLoadContext??{}})}let u=Ui(e,t);return{params:a,deps:o,preload:!!u,parentMatchPromise:i,abortController:s,context:l,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:u?`preload`:c,route:r,...e.router.options.additionalContext}},Zi=async(e,t,n,r)=>{try{let i=e.router.getMatch(t);try{(!e.router.isServer||i.ssr===!0)&&Nte(r);let a=r.options.loader?.(Xi(e,t,n,r)),o=r.options.loader&&ui(a);if((o||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||i._nonReactive.minPendingPromise)&&e.updateMatch(t,e=>({...e,isFetching:`loader`})),r.options.loader){let n=o?await a:a;Gi(e,e.router.getMatch(t),n),n!==void 0&&e.updateMatch(t,e=>({...e,loaderData:n}))}r._lazyPromise&&await r._lazyPromise;let s=Yi(e,t,r),c=s?await s:void 0,l=i._nonReactive.minPendingPromise;l&&await l,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,e=>({...e,error:void 0,status:`success`,isFetching:!1,updatedAt:Date.now(),...c}))}catch(n){let a=n,o=i._nonReactive.minPendingPromise;o&&await o,Ni(n)&&await r.options.notFoundComponent?.preload?.(),Gi(e,e.router.getMatch(t),n);try{r.options.onError?.(n)}catch(n){a=n,Gi(e,e.router.getMatch(t),n)}let s=Yi(e,t,r),c=s?await s:void 0;e.updateMatch(t,e=>({...e,error:a,status:`error`,isFetching:!1,...c}))}}catch(n){let i=e.router.getMatch(t);if(i){let n=Yi(e,t,r);if(n){let r=await n;e.updateMatch(t,e=>({...e,...r}))}i._nonReactive.loaderPromise=void 0}Gi(e,i,n)}},Mte=async(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=!1,a=!1,o=e.router.looseRoutesById[r];if(Ki(e,n)){if(e.router.isServer){let t=Yi(e,n,o);if(t){let r=await t;e.updateMatch(n,e=>({...e,...r}))}return e.router.getMatch(n)}}else{let r=e.router.getMatch(n);if(r._nonReactive.loaderPromise){if(r.status===`success`&&!e.sync&&!r.preload)return r;await r._nonReactive.loaderPromise;let t=e.router.getMatch(n),i=t._nonReactive.error||t.error;i&&Gi(e,t,i)}else{let s=Date.now()-r.updatedAt,c=Ui(e,n),l=c?o.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:o.options.staleTime??e.router.options.defaultStaleTime??0,u=o.options.shouldReload,d=typeof u==`function`?u(Xi(e,n,t,o)):u,f=!!c&&!e.router.state.matches.some(e=>e.id===n),p=e.router.getMatch(n);p._nonReactive.loaderPromise=li(),f!==p.preload&&e.updateMatch(n,e=>({...e,preload:f}));let{status:m,invalid:h}=p;if(i=m===`success`&&(h||(d??s>l)),!(c&&o.options.preload===!1))if(i&&!e.sync)a=!0,(async()=>{try{await Zi(e,n,t,o);let r=e.router.getMatch(n);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0}catch(t){Vi(t)&&await e.router.navigate(t.options)}})();else if(m!==`success`||i&&e.sync)await Zi(e,n,t,o);else{let t=Yi(e,n,o);if(t){let r=await t;e.updateMatch(n,e=>({...e,...r}))}}}}let s=e.router.getMatch(n);a||(s._nonReactive.loaderPromise?.resolve(),s._nonReactive.loadPromise?.resolve()),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0,a||(s._nonReactive.loaderPromise=void 0),s._nonReactive.dehydrated=void 0;let c=a?s.isFetching:!1;return c!==s.isFetching||s.invalid!==!1?(e.updateMatch(n,e=>({...e,isFetching:c,invalid:!1})),e.router.getMatch(n)):s};async function Qi(e){let t=Object.assign(e,{matchPromises:[]});!t.router.isServer&&t.router.state.matches.some(e=>e._forcePending)&&Hi(t);try{for(let e=0;e<t.matches.length;e++){let n=jte(t,e);ui(n)&&await n}let e=t.firstBadMatchIndex??t.matches.length;for(let n=0;n<e;n++)t.matchPromises.push(Mte(t,n));await Promise.all(t.matchPromises);let n=Hi(t);ui(n)&&await n}catch(e){if(Ni(e)&&!t.preload){let n=Hi(t);throw ui(n)&&await n,e}if(Vi(e))throw e}return t.matches}async function Nte(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){let t=()=>{let t=[];for(let n of Fte){let r=e.options[n]?.preload;r&&t.push(r())}if(t.length)return Promise.all(t).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function $i(e,t){return t?{status:`error`,error:t}:{status:`success`,value:e}}function Pte(e){for(let t of Fte)if(e.options[t]?.preload)return!0;return!1}var Fte=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Ite(e){return{input:({url:t})=>{for(let n of e)t=Rte(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=zte(e[n],t);return t}}}function Lte(e){let t=Oi(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=wi([`/`,t,e.pathname]),e)}}function Rte(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function zte(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ea(e){let t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}var Bte=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn(`The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.`);let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(e=>[encodeURIComponent(e),e])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Kee())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Gee(Hte(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(e=>![`redirected`].includes(e.status))}}}),yte(this));let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[];Oi(o)!==``&&e.push(Lte({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ite(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let{routesById:e,routesByPath:t,processedTree:n}=ste(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});this.options.routeMasks&&nte(this.options.routeMasks,n),this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({href:e,state:n})=>{let r=new URL(e,this.origin),i=Rte(this.rewrite,r),a=this.options.parseSearch(i.search),o=this.options.stringifySearch(a);i.search=o;let s=i.href.replace(i.origin,``),{pathname:c,hash:l}=i;return{href:s,publicHref:e,url:i.href,pathname:fi(c),searchStr:o,search:oi(t?.search,a),hash:l.split(`#`).reverse()[0]??``,state:oi(t?.state,n)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathCache=hi(1e3),this.resolvePathWithBase=(e,t)=>pte({base:e,to:Ti(t),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ute({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{let e=this.state.matches.filter(e=>e.status===`pending`),t=this.state.matches.filter(e=>e.isFetching===`loader`);new Set([...this.state.pendingMatches??[],...e,...t]).forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=ii(this.matchRoutes(n,{_buildLocation:!0}));t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=this.resolvePathWithBase(i,`.`),o=r.search,s={...r.params},c=t.to?this.resolvePathWithBase(a,`${t.to}`):this.resolvePathWithBase(a,`.`),l=t.params===!1||t.params===null?{}:(t.params??!0)===!0?s:Object.assign(s,ai(t.params,s)),u=ji({path:c,params:l}).interpolatedPath,d=this.matchRoutes(u,void 0,{_buildLocation:!0}).map(e=>this.looseRoutesById[e.routeId]);if(Object.keys(l).length>0)for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;t&&Object.assign(l,t(l))}let f=e.leaveParams?c:fi(ji({path:c,params:l,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath),p=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,na(t.options.validateSearch,{...e,...p}))}catch{}}),p=e}p=Wte({search:p,dest:t,destRoutes:d,_includeValidateSearch:e._includeValidateSearch}),p=oi(o,p);let m=this.options.stringifySearch(p),h=t.hash===!0?n.hash:t.hash?ai(t.hash,n.hash):void 0,g=h?`#${h}`:``,_=t.state===!0?n.state:t.state?ai(t.state,n.state):{};_=oi(n.state,_);let v=`${f}${m}${g}`,y=new URL(v,this.origin),b=zte(this.rewrite,y);return{publicHref:b.pathname+b.search+b.hash,href:v,url:b.href,pathname:f,search:p,searchStr:m,state:_,hash:h??``,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n={};if(this.options.routeMasks){let o=rte(i.pathname,this.processedTree);if(o){Object.assign(n,o.params);let{from:i,...s}=o.route;r={from:e.from,...s,params:n},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=ci(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=Di(this.latestLocation.href)===Di(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=li(()=>{a?.resolve()}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=ni(a,{__TSR_index:e?t:t+1});o.to=n.pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,...r})=>{if(!t&&n)try{new URL(`${n}`),t=!0}catch{}if(t){if(n||=this.buildLocation({to:e,...r}).url,!r.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()}return this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){let e=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),t=e=>{try{return encodeURI(decodeURI(e))}catch{return e}};if(Oi(t(this.latestLocation.href))!==Oi(t(e.href))){let t=e.url;throw this.origin&&t.startsWith(this.origin)&&(t=t.replace(this.origin,``)||`/`),Dte({href:t})}}let e=this.matchRoutes(this.latestLocation);this.__store.setState(t=>({...t,status:`pending`,statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:t.cachedMatches.filter(t=>!e.some(e=>e.id===t.id))}))},this.load=async e=>{let t,n,r;for(r=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=this.state.resolvedLocation;this.state.redirect||this.emit({type:`onBeforeNavigate`,...ea({resolvedLocation:n,location:t})}),this.emit({type:`onBeforeLoad`,...ea({resolvedLocation:n,location:t})}),await Qi({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=[],t=[],n=[];Xr(()=>{this.__store.setState(r=>{let i=r.matches,a=r.pendingMatches||r.matches;return e=i.filter(e=>!a.some(t=>t.id===e.id)),t=a.filter(e=>!i.some(t=>t.id===e.id)),n=a.filter(e=>i.some(t=>t.id===e.id)),{...r,isLoading:!1,loadedAt:Date.now(),matches:a,pendingMatches:void 0,cachedMatches:[...r.cachedMatches,...e.filter(e=>e.status!==`error`&&e.status!==`notFound`)]}}),this.clearExpiredCache()}),[[e,`onLeave`],[t,`onEnter`],[n,`onStay`]].forEach(([e,t])=>{e.forEach(e=>{this.looseRoutesById[e.routeId].options[t]?.(e)})})})})}})}catch(e){Vi(e)?(t=e,this.isServer||this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):Ni(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.status:n?404:e.matches.some(e=>e.status===`error`)?500:200,redirect:t}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(e=>e.status===`error`)&&(i=500),i!==void 0&&this.__store.setState(e=>({...e,statusCode:i}))},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.state.resolvedLocation,a=typeof t.types==`function`?t.types(ea({resolvedLocation:i,location:r})):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.state.pendingMatches?.some(t=>t.id===e)?`pendingMatches`:this.state.matches.some(t=>t.id===e)?`matches`:this.state.cachedMatches.some(t=>t.id===e)?`cachedMatches`:``;n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(n=>n.id===e?t(n):n)}))})},this.getMatch=e=>{let t=t=>t.id===e;return this.state.cachedMatches.find(t)??this.state.pendingMatches?.find(t)??this.state.matches.find(t)},this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){let t=this.buildLocation(e.options),n=t.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,``)||`/`),e.options.href=t.href,e.headers.set(`Location`,n)}return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.__store.setState(e=>({...e,cachedMatches:[]})):this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))}))},this.clearExpiredCache=()=>{this.clearCache({filter:e=>{let t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;let n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??300*1e3;return e.status===`error`?!0:Date.now()-e.updatedAt>=n}})},this.loadRouteChunk=Nte,this.preloadRoute=async e=>{let t=this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);Xr(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await Qi({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Vi(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Ni(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.state.status!==`pending`)return!1;let i=(t?.pending===void 0?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=ite(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!ci(a.params,e.params,{partial:!0})?!1:t?.includeSearch??!0?ci(i.search,r.search,{partial:!0})?a.params:!1:a.params},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status===`notFound`||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??wte,parseSearch:e.parseSearch??Cte}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:Di(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=(()=>{if(o){if(this.options.notFoundMode!==`root`)for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.children)return t.id}return Bi}})(),c=[],l=e=>e?.id?e.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((n,r)=>{let a=c[r-1],[o,u,d]=(()=>{let r=a?.search??e.search,i=a?._strictSearch??void 0;try{let e=na(n.options.validateSearch,{...r})??void 0;return[{...r,...e},{...i,...e},void 0]}catch(e){let n=e;if(e instanceof ta||(n=new ta(e.message,{cause:e})),t?.throwOnError)throw n;return[r,{},n]}})(),f=n.options.loaderDeps?.({search:o})??``,p=f?JSON.stringify(f):``,{interpolatedPath:m,usedParams:h}=ji({path:n.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),g=n.id+m+p,_=this.getMatch(g),v=this.state.matches.find(e=>e.routeId===n.id),y=_?._strictParams??h,b;if(!_){let e=n.options.params?.parse??n.options.parseParams;if(e)try{Object.assign(y,e(y))}catch(e){if(b=Ni(e)||Vi(e)?e:new Vte(e.message,{cause:e}),t?.throwOnError)throw b}}Object.assign(i,y);let x=v?`stay`:`enter`,S;if(_)S={..._,cause:x,params:v?oi(v.params,i):i,_strictParams:y,search:oi(v?v.search:_.search,o),_strictSearch:u};else{let e=n.options.loader||n.options.beforeLoad||n.lazyFn||Pte(n)?`pending`:`success`;S={id:g,index:r,routeId:n.id,params:v?oi(v.params,i):i,_strictParams:y,pathname:m,updatedAt:Date.now(),search:v?oi(v.search,o):o,_strictSearch:u,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:b,__routeContext:void 0,_nonReactive:{loadPromise:li()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:x,loaderDeps:v?oi(v.loaderDeps,f):f,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:n.options.staticData||{},fullPath:n.fullPath}}t?.preload||(S.globalNotFound=s===n.id),S.searchError=d;let C=l(a);S.context={...C,...S.__routeContext,...S.__beforeLoadContext},c.push(S)}),c.forEach((n,r)=>{let i=this.looseRoutesById[n.routeId];if(!this.getMatch(n.id)&&t?._buildLocation!==!0){let t=c[r-1],a=l(t);if(i.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c};n.__routeContext=i.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}),c}},ta=class extends Error{},Vte=class extends Error{};function Hte(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function na(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new ta(`Async validation not supported`);if(n.issues)throw new ta(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Ute({pathname:e,routesById:t,processedTree:n}){let r={},i=Di(e),a,o=ate(i,n,!0);return o&&(a=o.route,Object.assign(r,o.params)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Wte({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){let i=n.reduce((e,t)=>{let n=[];return`search`in t.options?t.options.search?.middlewares&&n.push(...t.options.search.middlewares):(t.options.preSearchFilters||t.options.postSearchFilters)&&n.push(({search:e,next:n})=>{let r=e;`preSearchFilters`in t.options&&t.options.preSearchFilters&&(r=t.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=n(r);return`postSearchFilters`in t.options&&t.options.postSearchFilters?t.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),r&&t.options.validateSearch&&n.push(({search:e,next:n})=>{let r=n(e);try{return{...r,...na(t.options.validateSearch,r)??void 0}}catch{return r}}),e.concat(n)},[])??[];i.push(({search:e})=>t.search?t.search===!0?e:ai(t.search,e):{});let a=(e,t)=>{if(e>=i.length)return t;let n=i[e];return n({search:t,next:t=>a(e+1,t)})};return a(0,e)}var Gte=`Error preloading route! ☝️`,ra=class{constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Bi:this.parentRoute||mi(!1,`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let r=n?Bi:t?.path;r&&r!==`/`&&(r=Ei(r));let i=t?.id||r,a=n?Bi:wi([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=wi([`/`,a]));let o=a===`__root__`?`/`:wi([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=o},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}},Kte=class{constructor({id:e}){this.notFound=e=>Mi({routeId:this.id,...e}),this.id=e}},qte=class extends ra{constructor(e){super(e)}};function ia(e){let t=e.errorComponent??aa;return(0,K.jsx)(Jte,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?G.createElement(t,{error:n,reset:r}):e.children})}var Jte=class extends G.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function aa({error:e}){let[t,n]=G.useState(!1);return(0,K.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,K.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,K.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,K.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,K.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,K.jsx)(`div`,{children:(0,K.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,K.jsx)(`code`,{children:e.message}):null})}):null]})}function Yte({children:e,fallback:t=null}){return Xte()?(0,K.jsx)(G.Fragment,{children:e}):(0,K.jsx)(G.Fragment,{children:t})}function Xte(){return G.useSyncExternalStore(Zte,()=>!0,()=>!1)}function Zte(){return()=>{}}var Qte=!0;function oa(e,t){if(!Qte){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}var $te=i((e=>{var t=s();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),sa=i(((e,t)=>{t.exports=$te()})),ene=i((e=>{var t=s(),n=sa();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),ca=i(((e,t)=>{t.exports=ene()}))();function tne(e,t=e=>e,n={}){let r=n.equal??nne;return(0,ca.useSyncExternalStoreWithSelector)(e.subscribe,()=>e.state,()=>e.state,t,r)}function nne(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=la(e);if(n.length!==la(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function la(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var ua=G.createContext(null);function da(){return typeof document>`u`?ua:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ua,ua)}function fa(e){let t=G.useContext(da());return oa(!((e?.warn??!0)&&!t),`useRouter must be used inside a <RouterProvider> component!`),t}function pa(e){let t=fa({warn:e?.router===void 0}),n=e?.router||t,r=(0,G.useRef)(void 0);return tne(n.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=oi(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var ma=G.createContext(void 0),rne=G.createContext(void 0);function ha(e){let t=G.useContext(e.from?rne:ma);return pa({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(mi(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function ga(e){return ha({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function _a(e){let{select:t,...n}=e;return ha({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function va(e){return ha({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ya(e){return ha({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}var ba=typeof window<`u`?G.useLayoutEffect:G.useEffect;function xa(e){let t=G.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function ine(e,t,n={},r={}){G.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ane(e){let t=G.useRef(null);return G.useImperativeHandle(e,()=>t.current,[]),t}function Sa(e){let t=fa();return G.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var Ca=e(a(),1);function one(e,t){let n=fa(),[r,i]=G.useState(!1),a=G.useRef(!1),o=ane(t),{activeProps:s,inactiveProps:c,activeOptions:l,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onFocus:w,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:O,params:k,search:A,hash:j,state:M,mask:N,reloadDocument:P,unsafeRelative:F,from:ee,_fromLocation:I,...L}=e,R=pa({select:e=>e.location.search,structuralSharing:!0}),z=e.from,te=G.useMemo(()=>({...e,from:z}),[n,R,z,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),B=G.useMemo(()=>n.buildLocation({...te}),[n,te]),V=G.useMemo(()=>{if(b)return;let e=B.maskedLocation?B.maskedLocation.url:B.url,t=!1;return n.origin&&(e.startsWith(n.origin)?e=n.history.createHref(e.replace(n.origin,``))||`/`:t=!0),{href:e,external:t}},[b,B.maskedLocation,B.url,n.origin,n.history]),ne=G.useMemo(()=>{if(V?.external)return V.href;try{return new URL(u),u}catch{}},[u,V]),re=e.reloadDocument||ne?!1:d??n.options.defaultPreload,ie=f??n.options.defaultPreloadDelay??0,ae=pa({select:e=>{if(ne)return!1;if(l?.exact){if(!fte(e.location.pathname,B.pathname,n.basepath))return!1}else{let t=ki(e.location.pathname,n.basepath),r=ki(B.pathname,n.basepath);if(!(t.startsWith(r)&&(t.length===r.length||t[r.length]===`/`)))return!1}return(l?.includeSearch??!0)&&!ci(e.location.search,B.search,{partial:!l?.exact,ignoreUndefined:!l?.explicitUndefined})?!1:l?.includeHash?e.location.hash===B.hash:!0}}),oe=G.useCallback(()=>{n.preloadRoute({...te}).catch(e=>{console.warn(e),console.warn(Gte)})},[n,te]);ine(o,G.useCallback(e=>{e?.isIntersecting&&oe()},[oe]),dne,{disabled:!!b||re!==`viewport`}),G.useEffect(()=>{a.current||!b&&re===`render`&&(oe(),a.current=!0)},[b,oe,re]);let se=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!fne(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ca.flushSync)(()=>{i(!0)});let t=n.subscribe(`onResolved`,()=>{t(),i(!1)});n.navigate({...te,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:O})}};if(ne)return{...L,ref:o,href:ne,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let ce=e=>{b||re&&oe()},le=ce,ue=e=>{if(!(b||!re))if(!ie)oe();else{let t=e.target;if(Ta.has(t))return;let n=setTimeout(()=>{Ta.delete(t),oe()},ie);Ta.set(t,n)}},H=e=>{if(b||!re||!ie)return;let t=e.target,n=Ta.get(t);n&&(clearTimeout(n),Ta.delete(t))},de=ae?ai(s,{})??sne:wa,fe=ae?wa:ai(c,{})??wa,pe=[S,de.className,fe.className].filter(Boolean).join(` `),me=(x||de.style||fe.style)&&{...x,...de.style,...fe.style};return{...L,...de,...fe,href:V?.href,ref:o,onClick:Ea([C,se]),onFocus:Ea([w,ce]),onMouseEnter:Ea([T,ue]),onMouseLeave:Ea([E,H]),onTouchStart:Ea([D,le]),disabled:!!b,target:y,...me&&{style:me},...pe&&{className:pe},...b&&cne,...ae&&lne,...r&&une}}var wa={},sne={className:`active`},cne={role:`link`,"aria-disabled":!0},lne={"data-status":`active`,"aria-current":`page`},une={"data-transitioning":`transitioning`},Ta=new WeakMap,dne={rootMargin:`100px`},Ea=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}},Da=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,ref:a,...o}=one(r,t),s=typeof r.children==`function`?r.children({isActive:o[`data-status`]===`active`}):r.children;return n===void 0&&delete o.disabled,G.createElement(n||`a`,{...o,ref:a},s)});function fne(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pne(e){return new mne({id:e})}var mne=class extends Kte{constructor({id:e}){super({id:e}),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id,strict:!1}),this.useLoaderData=e=>ga({...e,from:this.id,strict:!1}),this.useNavigate=()=>Sa({from:fa().routesById[this.id].fullPath}),this.notFound=e=>Mi({routeId:this.id,...e}),this.Link=G.forwardRef((e,t)=>{let n=fa().routesById[this.id].fullPath;return(0,K.jsx)(Da,{ref:t,from:n,...e})})}},hne=class extends ra{constructor(e){super(e),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id}),this.useLoaderData=e=>ga({...e,from:this.id}),this.useNavigate=()=>Sa({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Da,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function Oa(e){return new hne(e)}var gne=class extends qte{constructor(e){super(e),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id}),this.useLoaderData=e=>ga({...e,from:this.id}),this.useNavigate=()=>Sa({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Da,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function ka(e){return new gne(e)}function Aa(e){return typeof e==`object`?new ja(e,{silent:!0}).createRoute(e):new ja(e,{silent:!0}).createRoute}var ja=class{constructor(e,t){this.path=e,this.createRoute=e=>{oa(this.silent,`FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.`);let t=Oa(e);return t.isRoot=!1,t},this.silent=t?.silent}},Ma=class{constructor(e){this.useMatch=e=>ha({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({from:this.options.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>_a({...e,from:this.options.id}),this.useLoaderData=e=>ga({...e,from:this.options.id}),this.useNavigate=()=>Sa({from:fa().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for(`react.memo`)}};function Na(e){return typeof e==`object`?new Ma(e):t=>new Ma({id:e,...t})}function _ne(){let e=fa(),t=G.useRef({router:e,mounted:!1}),[n,r]=G.useState(!1),{hasPendingMatches:i,isLoading:a}=pa({select:e=>({isLoading:e.isLoading,hasPendingMatches:e.matches.some(e=>e.status===`pending`)}),structuralSharing:!0}),o=xa(a),s=a||n||i,c=xa(s),l=a||i,u=xa(l);return e.startTransition=e=>{r(!0),G.startTransition(()=>{e(),r(!1)})},G.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Di(e.latestLocation.href)!==Di(n.href)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ba(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),ba(()=>{o&&!a&&e.emit({type:`onLoad`,...ea(e.state)})},[o,e,a]),ba(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...ea(e.state)})},[l,u,e]),ba(()=>{if(c&&!s){let t=ea(e.state);e.emit({type:`onResolved`,...t}),e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})),t.hrefChanged&&bte(e)}},[s,c,e]),null}function vne(e){let t=pa({select:e=>`not-found-${e.location.pathname}-${e.status}`});return(0,K.jsx)(ia,{getResetKey:()=>t,onCatch:(t,n)=>{if(Ni(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Ni(t))return e.fallback?.(t);throw t},children:e.children})}function yne(){return(0,K.jsx)(`p`,{children:`Not Found`})}function Pa(e){return(0,K.jsx)(K.Fragment,{children:e.children})}function Fa(e,t,n){return t.options.notFoundComponent?(0,K.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,K.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,K.jsx)(yne,{})}function bne({children:e}){let t=fa();return t.isServer?(0,K.jsx)(`script`,{nonce:t.options.ssr?.nonce,className:`$tsr`,dangerouslySetInnerHTML:{__html:e+`;typeof $_TSR !== "undefined" && $_TSR.c()`}}):null}function xne(){let e=fa();if(!e.isScrollRestoring||!e.isServer||typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return null;let t=(e.options.getScrollRestorationKey||Ii)(e.latestLocation),n=t===Ii(e.latestLocation)?void 0:t,r={storageKey:Pi,shouldScrollRestoration:!0};return n&&(r.key=n),(0,K.jsx)(bne,{children:`(${Ri.toString()})(${JSON.stringify(r)})`})}var Ia=G.memo(function({matchId:e}){let t=fa(),n=pa({select:t=>{let n=t.matches.find(t=>t.id===e);return mi(n,`Could not find match for matchId "${e}". Please file an issue!`),{routeId:n.routeId,ssr:n.ssr,_displayPending:n._displayPending}},structuralSharing:!0}),r=t.routesById[n.routeId],i=r.options.pendingComponent??t.options.defaultPendingComponent,a=i?(0,K.jsx)(i,{}):null,o=r.options.errorComponent??t.options.defaultErrorComponent,s=r.options.onCatch??t.options.defaultOnCatch,c=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=n.ssr===!1||n.ssr===`data-only`,u=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||l))?G.Suspense:Pa,d=o?ia:Pa,f=c?vne:Pa,p=pa({select:e=>e.loadedAt}),m=pa({select:t=>{let n=t.matches.findIndex(t=>t.id===e);return t.matches[n-1]?.routeId}});return(0,K.jsxs)(r.isRoot?r.options.shellComponent??Pa:Pa,{children:[(0,K.jsx)(ma.Provider,{value:e,children:(0,K.jsx)(u,{fallback:a,children:(0,K.jsx)(d,{getResetKey:()=>p,errorComponent:o||aa,onCatch:(t,n)=>{if(Ni(t))throw t;oa(!1,`Error in route match: ${e}`),s?.(t,n)},children:(0,K.jsx)(f,{fallback:e=>{if(!c||e.routeId&&e.routeId!==n.routeId||!e.routeId&&!r.isRoot)throw e;return G.createElement(c,e)},children:l||n._displayPending?(0,K.jsx)(Yte,{fallback:a,children:(0,K.jsx)(La,{matchId:e})}):(0,K.jsx)(La,{matchId:e})})})})}),m===`__root__`&&t.options.scrollRestoration?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Sne,{}),(0,K.jsx)(xne,{})]}):null]})});function Sne(){let e=fa(),t=G.useRef(void 0);return(0,K.jsx)(`script`,{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:`onRendered`,...ea(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var La=G.memo(function({matchId:e}){let t=fa(),{match:n,key:r,routeId:i}=pa({select:n=>{let r=n.matches.find(t=>t.id===e),i=r.routeId,a=(t.routesById[i].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return{key:a?JSON.stringify(a):void 0,routeId:i,match:{id:r.id,status:r.status,error:r.error,_forcePending:r._forcePending,_displayPending:r._displayPending}}},structuralSharing:!0}),a=t.routesById[i],o=G.useMemo(()=>{let e=a.options.component??t.options.defaultComponent;return e?(0,K.jsx)(e,{},r):(0,K.jsx)(Ra,{})},[r,a.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status===`pending`){let e=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let r=t.getMatch(n.id);if(r&&!r._nonReactive.minPendingPromise&&!t.isServer){let t=li();r._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),r._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if(n.status===`notFound`)return mi(Ni(n.error),`Expected a notFound error`),Fa(t,a,n.error);if(n.status===`redirected`)throw mi(Vi(n.error),`Expected a redirect error`),t.getMatch(n.id)?._nonReactive.loadPromise;if(n.status===`error`){if(t.isServer)return(0,K.jsx)((a.options.errorComponent??t.options.defaultErrorComponent)||aa,{error:n.error,reset:void 0,info:{componentStack:``}});throw n.error}return o}),Ra=G.memo(function(){let e=fa(),t=G.useContext(ma),n=pa({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=pa({select:e=>{let n=e.matches.find(e=>e.id===t);return mi(n,`Could not find parent match for matchId "${t}"`),n.globalNotFound}}),a=pa({select:e=>{let n=e.matches;return n[n.findIndex(e=>e.id===t)+1]?.id}}),o=e.options.defaultPendingComponent?(0,K.jsx)(e.options.defaultPendingComponent,{}):null;if(i)return Fa(e,r,void 0);if(!a)return null;let s=(0,K.jsx)(Ia,{matchId:a});return n===`__root__`?(0,K.jsx)(G.Suspense,{fallback:o,children:s}):s});function Cne(){let e=fa(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,K.jsx)(t,{}):null,r=(0,K.jsxs)(e.isServer||typeof document<`u`&&e.ssr?Pa:G.Suspense,{fallback:n,children:[!e.isServer&&(0,K.jsx)(_ne,{}),(0,K.jsx)(wne,{})]});return e.options.InnerWrap?(0,K.jsx)(e.options.InnerWrap,{children:r}):r}function wne(){let e=fa(),t=pa({select:e=>e.matches[0]?.id}),n=pa({select:e=>e.loadedAt}),r=t?(0,K.jsx)(Ia,{matchId:t}):null;return(0,K.jsx)(ma.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,K.jsx)(ia,{getResetKey:()=>n,errorComponent:aa,onCatch:e=>{oa(!1,`The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`),oa(!1,e.message||e.toString())},children:r})})}var za=e=>new Tne(e),Tne=class extends Bte{constructor(e){super(e)}};typeof globalThis<`u`?(globalThis.createFileRoute=Aa,globalThis.createLazyFileRoute=Na):typeof window<`u`&&(window.createFileRoute=Aa,window.createLazyFileRoute=Na);function Ene({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,K.jsx)(da().Provider,{value:e,children:t});return e.options.Wrap?(0,K.jsx)(e.options.Wrap,{children:r}):r}function Ba({router:e,...t}){return(0,K.jsx)(Ene,{router:e,...t,children:(0,K.jsx)(Cne,{})})}function Va(e){return pa({select:t=>e?.select?e.select(t.location):t.location})}var Ha=e(o(),1);function Dne(e){let t=e.trim();if(!t)return null;let n;try{n=new URL(t)}catch{return null}n.hash=``,n.search=``;let r=n.pathname.replace(/\/+$/,``);return n.pathname=r.length>0?r:`/`,n.toString().replace(/\/$/,(n.pathname,``))}function Ua(e,t){return new URLSearchParams(e).get(t)?.trim()||null}function Wa(e){let t=Ua(e.search,`session`);return{hosted:t!==null,apiBaseUrl:Dne(Ua(e.search,`api`)??``),sessionId:t}}function Ga(e,t){let n=Wa(t);return n.hosted&&n.sessionId?`hosted-session:${n.sessionId}:${e}`:e}var Ka=null;typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0&&(Ka=!0,console.log(`[static-mode] Detected static export mode (via flag)`));async function One(){return Ka===null&&(Ka=typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0),Ka}function qa(){return Ka===!0}function kne(e){Ka=e}var Ja=null;function Ya(){return Ja===null?typeof window<`u`&&window.__OPENSPEC_BASE_PATH__||`./`:Ja}function Ane(){return typeof window<`u`&&window.__INITIAL_DATA__?window.__INITIAL_DATA__:null}function jne(e){let t=new MutationObserver(t=>{for(let n of t)n.attributeName===`class`&&e()});return t.observe(document.documentElement,{attributes:!0}),()=>t.disconnect()}function Mne(){return document.documentElement.classList.contains(`dark`)}function Nne(){return!1}function Xa(){return(0,G.useSyncExternalStore)(jne,Mne,Nne)}function Za(){return typeof window<`u`&&window.location!==void 0}function Qa(){return Za()?Wa(window.location):{hosted:!1,apiBaseUrl:null,sessionId:null}}function $a(){return Za()?Qa().apiBaseUrl??``:``}function eo(e){if(!Za())return``;let t=$a();if(t){let n=new URL(t);return`${n.protocol===`https:`?`wss:`:`ws:`}//${n.host}${e}`}return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${e}`}function Pne(){return eo(`/trpc`)}function Fne(){return eo(`/ws/pty`)}function to(){let e=$a();return e?`${e}/trpc`:`/trpc`}function Ine(){let e=$a();return e?`${e}/api/health`:`/api/health`}var no=[`/dashboard`,`/config`,`/git`,`/specs`,`/changes`,`/archive`,`/settings`,`/terminal`],Lne=[`/dashboard`,`/config`,`/specs`,`/changes`,`/archive`,`/settings`],ro=qa()?[]:[`/git`,`/terminal`],Rne=[`/search`,`/notifications`,`/opsx-new`,`/opsx-propose`,`/opsx-verify`,`/opsx-compose`];function io(){return Ga(`nav-layout`,window.location)}function zne(e){return Ga(`nav-layout:${encodeURIComponent(e)}`,window.location)}var Bne=300;function Vne(e){return no.includes(e)}function ao(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&Vne(e)):[]}function oo(e){if(typeof e!=`object`||!e)return null;let t=e;return!Array.isArray(t.mainTabs)||!Array.isArray(t.bottomTabs)?null:{mainTabs:ao(t.mainTabs),bottomTabs:ao(t.bottomTabs),updatedAt:typeof t.updatedAt==`number`?t.updatedAt:0}}function Hne(e,t){if(typeof e!=`object`||!e)return{__TSR_index:0,key:t,__TSR_key:t};let n=e,r=typeof n.key==`string`?n.key:t,i=typeof n.__TSR_key==`string`?n.__TSR_key:r,a=typeof n.__TSR_index==`number`?n.__TSR_index:0;return{...n,key:r,__TSR_key:i,__TSR_index:a}}function so(e,t){let n=new URL(e,`http://nav.local`),r=`${n.pathname}${n.search}${n.hash}`,i=Math.random().toString(36).slice(2);return{href:r,pathname:n.pathname||`/`,search:n.search,hash:n.hash,state:Hne(t,i)}}function co(e){let t=e.trim();if(!t||t===`./`||t===`.`)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return(n.endsWith(`/`)?n:`${n}/`).replace(/\/+/g,`/`)}function lo(e,t){return t===`/`?e||`/`:e===t.slice(0,-1)?`/`:e.startsWith(t)?e.slice(t.length-1)||`/`:e||`/`}function Une(e,t){if(t===`/`)return e||`/`;let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`?t.slice(0,-1)||`/`:`${t.slice(0,-1)}${n}`}function uo(e){if(typeof window>`u`)return e;let t=new URL(e,window.location.origin),n=co(Ya());return t.pathname=lo(t.pathname,n),`${t.pathname}${t.search}${t.hash}`}function Wne(e,t){for(let n of[`api`,`session`]){let r=t.searchParams.get(n);r&&!e.searchParams.has(n)&&e.searchParams.set(n,r)}}function fo(e){for(let t of no)if(e===t||e.startsWith(t+`/`))return t;return null}function po(e,t){if(t===`pop`)return null;let n=t===`main`?e.mainLocation:e.bottomLocation,r=t===`main`?e.mainTabs:e.bottomTabs,i=fo(n.pathname);return i&&r.includes(i)?i:null}function mo(e){return Rne.some(t=>e===t||e.startsWith(t+`/`))}function ho(e,t){if(mo(t))return`pop`;let n=fo(t);return n&&e.bottomTabs.includes(n)?`bottom`:`main`}function go(e){let t=new Set,n=[],r=[];for(let r of e.mainTabs)t.has(r)||(n.push(r),t.add(r));for(let n of e.bottomTabs)t.has(n)||(r.push(n),t.add(n));for(let e of no)t.has(e)||(ro.includes(e)?r.push(e):n.push(e));return{mainTabs:n,bottomTabs:r}}function _o(e,t){if(t.length===0)return so(`/`);let n=fo(e.pathname);return n&&!t.includes(n)?so(`/`):e}function vo(e,t){if(t.length===0)return so(`/`);if(e.pathname===`/`)return so(`/`,e.state);let n=fo(e.pathname);return!n||!t.includes(n)?so(`/`):e}function yo(e){return e.pathname===`/`?so(`/`,e.state):mo(e.pathname)?e:so(`/`)}function bo(e){let t=go({mainTabs:e.mainTabs,bottomTabs:e.bottomTabs});return{...e,mainTabs:t.mainTabs,bottomTabs:t.bottomTabs,mainLocation:_o(e.mainLocation,t.mainTabs),bottomLocation:vo(e.bottomLocation,t.bottomTabs),popLocation:yo(e.popLocation)}}function xo(e,t){let n=new URL(e.href),r=co(Ya());n.pathname=lo(n.pathname,r);let i=n.searchParams.get(`_b`),a=n.searchParams.get(`_p`);n.searchParams.delete(`_b`),n.searchParams.delete(`_p`);let o=window.history.state,s=so(`${n.pathname}${n.search}${n.hash}`,o?.main),c=so(i??`/`,o?.bottom),l=so(a??`/`,o?.pop);if(!i&&!a){let e=ho(t,s.pathname);e===`bottom`?(c=s,s=so(`/`,o?.main)):e===`pop`&&(l=s,s=so(`/`,o?.main))}return{main:_o(s,t.mainTabs),bottom:vo(c,t.bottomTabs),pop:yo(l)}}function So(e){let t=new URL(window.location.href),n=new URL(e.mainLocation.href,window.location.origin),r=co(Ya());return n.pathname=Une(n.pathname,r),Wne(n,t),n.searchParams.delete(`_b`),n.searchParams.delete(`_p`),e.bottomTabs.length>0&&n.searchParams.set(`_b`,e.bottomLocation.href),e.popLocation.pathname!==`/`&&n.searchParams.set(`_p`,e.popLocation.href),`${n.pathname}${n.search}${n.hash}`}function Co(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Gne(){return{mainTabs:[...Lne],bottomTabs:[...ro],updatedAt:0,mainLocation:so(`/dashboard`),bottomLocation:so(`/`),popLocation:so(`/`)}}function Kne(){try{let e=localStorage.getItem(io());return e?oo(JSON.parse(e)):null}catch{return null}}function qne(e){try{let t=localStorage.getItem(e);return t?oo(JSON.parse(t)):null}catch{return null}}function wo(e,t=io()){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var Jne=[({prevState:e,nextState:t,event:n})=>{if(n.type!==`MOVE_TAB`)return t;let r=e.bottomTabs.includes(n.tabId)?`bottom`:`main`;if(po(e,r)!==n.tabId)return t;let i=r===`main`?e.mainLocation:e.bottomLocation,a=so(i.href,i.state);return n.targetArea===`main`?{...t,mainLocation:a}:{...t,bottomLocation:a}},({nextState:e})=>e.mainTabs.length===0||po(e,`main`)!=null?e:{...e,mainLocation:so(e.mainTabs[0])}];function To(e,t,n){let r=t;for(let t of Jne)r=t({prevState:e,nextState:r,event:n});return r}function Eo(e,t){switch(t.type){case`NAVIGATE`:{let n=t.sourceArea===`pop`?`pop`:ho(e,t.location.pathname);return{nextState:n===`main`?{...e,mainLocation:t.location}:n===`bottom`?{...e,bottomLocation:t.location}:{...e,popLocation:t.location},changed:!0,urlAction:t.action,notify:n===t.sourceArea?[]:[{area:n,type:t.action}],persist:`none`}}case`POPSTATE`:return{nextState:{...e,mainLocation:t.mainLocation,bottomLocation:t.bottomLocation,popLocation:t.popLocation},changed:!0,notify:[{area:`main`,type:`BACK`},{area:`bottom`,type:`BACK`},{area:`pop`,type:`BACK`}],persist:`none`};case`MOVE_TAB`:{let n=e.bottomTabs.includes(t.tabId)?`bottom`:`main`;if(n===t.targetArea)return{nextState:e,changed:!1,notify:[],persist:`none`};let r=e.mainTabs.filter(e=>e!==t.tabId),i=e.bottomTabs.filter(e=>e!==t.tabId),a=t.targetArea===`main`?[...r,t.tabId]:r,o=t.targetArea===`bottom`?[...i,t.tabId]:i,s=e.mainLocation,c=e.bottomLocation;return fo((n===`main`?e.mainLocation:e.bottomLocation).pathname)===t.tabId&&(n===`main`?s=so(`/`):c=so(`/`)),{nextState:{...e,mainTabs:a,bottomTabs:o,mainLocation:s,bottomLocation:c},changed:!0,urlAction:`REPLACE`,notify:[{area:`main`,type:`REPLACE`},{area:`bottom`,type:`REPLACE`}],persist:`local_and_remote`}}case`REORDER`:{let n=t.area===`main`?e.mainTabs:e.bottomTabs,r=new Set(n),i=t.tabIds.filter(e=>r.has(e));for(let e of n)i.includes(e)||i.push(e);return Co(n,i)?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:t.area===`main`?{...e,mainTabs:i}:{...e,bottomTabs:i},changed:!0,notify:[],persist:`local_and_remote`}}case`CLOSE_TAB`:{let n=e.bottomTabs.includes(t.tabId),r=e.mainTabs.includes(t.tabId);return!n&&!r?{nextState:e,changed:!1,notify:[],persist:`none`}:n?fo(e.bottomLocation.pathname)===t.tabId?{nextState:{...e,bottomLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`}:fo(e.mainLocation.pathname)===t.tabId?{nextState:{...e,mainLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`}}case`ACTIVATE_BOTTOM`:return ho(e,t.location.pathname)===`bottom`?{nextState:{...e,bottomLocation:t.location},changed:!0,urlAction:`PUSH`,notify:[{area:`bottom`,type:`PUSH`}],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`};case`DEACTIVATE_BOTTOM`:return e.bottomLocation.pathname===`/`?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,bottomLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`};case`ACTIVATE_POP`:return ho(e,t.location.pathname)===`pop`?{nextState:{...e,popLocation:t.location},changed:!0,urlAction:`PUSH`,notify:[{area:`pop`,type:`PUSH`}],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`};case`DEACTIVATE_POP`:return e.popLocation.pathname===`/`?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,popLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`};case`APPLY_LAYOUT`:{let n=go(t.layout);return!(t.layout.updatedAt!==e.updatedAt||!Co(e.mainTabs,n.mainTabs)||!Co(e.bottomTabs,n.bottomTabs))||!t.force&&t.layout.updatedAt<=e.updatedAt?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,mainTabs:n.mainTabs,bottomTabs:n.bottomTabs,updatedAt:t.layout.updatedAt},changed:!0,urlAction:`REPLACE`,notify:[{area:`main`,type:`REPLACE`},{area:`bottom`,type:`REPLACE`}],persist:`local_only`}}}}function Do(e,t,n){return n===`main`?e.mainLocation.href!==t.mainLocation.href:n===`bottom`?e.bottomLocation.href!==t.bottomLocation.href:e.popLocation.href!==t.popLocation.href}function Yne(e,t,n){let r=[...e];for(let e of[`main`,`bottom`,`pop`])Do(t,n,e)&&(r.some(t=>t.area===e)||r.push({area:e,type:`REPLACE`}));return r}var Oo=new class{mainHistory=null;bottomHistory=null;popHistory=null;state=Gne();listeners=new Set;snapshotCache=null;persistTimer=null;kvUnsubscribe=null;initialized=!1;storageKey=typeof window>`u`?`nav-layout`:Ga(`nav-layout`,window.location);constructor(){if(typeof window>`u`)return;let e=qa()?null:Kne();if(e!=null){let t=go(e);this.state={...this.state,mainTabs:t.mainTabs,bottomTabs:t.bottomTabs,updatedAt:e.updatedAt}}let t=xo(window.location,this.state),n=bo({...this.state,mainLocation:t.main,bottomLocation:t.bottom,popLocation:t.pop});n=bo(To(n,n,{type:`BOOTSTRAP`})),this.state=n,this.normalizeUrl(),window.addEventListener(`popstate`,this.handlePopState)}setHistoryRef(e,t){e===`main`?this.mainHistory=t:e===`bottom`?this.bottomHistory=t:this.popHistory=t}getLocation(e){return e===`main`?this.state.mainLocation:e===`bottom`?this.state.bottomLocation:this.state.popLocation}push(e,t,n){this.dispatch({type:`NAVIGATE`,sourceArea:e,action:`PUSH`,location:so(uo(t),n)})}replace(e,t,n){this.dispatch({type:`NAVIGATE`,sourceArea:e,action:`REPLACE`,location:so(uo(t),n)})}createHref(e,t,n){if(typeof window>`u`)return t;let{nextState:r}=this.computeTransition({type:`NAVIGATE`,sourceArea:e,action:`PUSH`,location:so(uo(t),n)});return So(r)}get mainTabs(){return this.state.mainTabs}get bottomTabs(){return this.state.bottomTabs}getAreaForPath(e){return ho(this.state,e)}moveTab(e,t){this.dispatch({type:`MOVE_TAB`,tabId:e,targetArea:t})}reorder(e,t){this.dispatch({type:`REORDER`,area:e,tabIds:t})}closeTab(e){this.dispatch({type:`CLOSE_TAB`,tabId:e})}activateBottom(e){this.dispatch({type:`ACTIVATE_BOTTOM`,location:so(e)})}deactivateBottom(){this.dispatch({type:`DEACTIVATE_BOTTOM`})}activatePop(e){this.dispatch({type:`ACTIVATE_POP`,location:so(e)})}deactivatePop(){this.dispatch({type:`DEACTIVATE_POP`})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){if(this.snapshotCache)return this.snapshotCache;let e=fo(this.state.bottomLocation.pathname);return this.snapshotCache={mainTabs:[...this.state.mainTabs],bottomTabs:[...this.state.bottomTabs],mainLocation:this.state.mainLocation,bottomLocation:this.state.bottomLocation,popLocation:this.state.popLocation,bottomActive:e!=null&&this.state.bottomTabs.includes(e),popActive:this.state.popLocation.pathname!==`/`},this.snapshotCache}async init(){if(!(this.initialized||qa())){this.initialized=!0;try{let e=await this.resolveProjectScopedStorageKey();e&&e!==this.storageKey&&(this.storageKey=e,this.rebindProjectScopedLayout(e));let{trpcClient:t}=await l(async()=>{let{trpcClient:e}=await import(`./trpc-sRR2hWAJ.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])),n=oo(await t.kv.get.query({key:this.storageKey}));n?n.updatedAt>this.state.updatedAt?this.dispatch({type:`APPLY_LAYOUT`,layout:n}):this.state.updatedAt>n.updatedAt&&t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt}}).catch(()=>{}):this.state.updatedAt>0&&t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt}}).catch(()=>{});let r=t.kv.subscribe.subscribe({key:this.storageKey},{onData:e=>{let t=oo(e);t&&this.dispatch({type:`APPLY_LAYOUT`,layout:t})}});this.kvUnsubscribe=()=>r.unsubscribe()}catch{}}}destroy(){typeof window<`u`&&window.removeEventListener(`popstate`,this.handlePopState),this.cancelPersistTimer(),this.kvUnsubscribe&&=(this.kvUnsubscribe(),null)}handlePopState=()=>{let e=xo(window.location,this.state);this.dispatch({type:`POPSTATE`,mainLocation:e.main,bottomLocation:e.bottom,popLocation:e.pop})};computeTransition(e){let t=Eo(this.state,e);if(!t.changed)return{transition:t,nextState:this.state};let n=To(this.state,t.nextState,e);return n=bo(n),{transition:t,nextState:n}}dispatch(e){if(typeof window<`u`&&e.type!==`POPSTATE`&&this.mainHistory==null){let e=xo(window.location,this.state);this.state=bo({...this.state,mainLocation:e.main,bottomLocation:e.bottom,popLocation:e.pop})}let t=Eo(this.state,e);if(!t.changed)return;let n=this.state,r=To(n,t.nextState,e);r=bo(r),this.state=r,t.persist===`local_and_remote`?this.persistLayout():t.persist===`local_only`&&(this.cancelPersistTimer(),wo({mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt},this.storageKey));let i=t.urlAction??(Do(n,this.state,`main`)||Do(n,this.state,`bottom`)||Do(n,this.state,`pop`)?`REPLACE`:void 0);i&&this.syncToUrl(i);let a=Yne(t.notify,n,this.state);this.notifyRouters(a),this.notifyListeners()}notifyRouters(e){for(let t of e)(t.area===`main`?this.mainHistory:t.area===`bottom`?this.bottomHistory:this.popHistory)?.notify({type:t.type})}notifyListeners(){this.snapshotCache=null;for(let e of this.listeners)e()}syncToUrl(e){let t=So(this.state),n=`${window.location.pathname}${window.location.search}${window.location.hash}`;if(e===`REPLACE`&&t===n)return;let r={main:this.state.mainLocation.state,bottom:this.state.bottomLocation.state,pop:this.state.popLocation.state};e===`PUSH`?window.history.pushState(r,``,t):window.history.replaceState(r,``,t)}normalizeUrl(){let e=So(this.state);if(e===`${window.location.pathname}${window.location.search}${window.location.hash}`)return;let t={main:this.state.mainLocation.state,bottom:this.state.bottomLocation.state,pop:this.state.popLocation.state};window.history.replaceState(t,``,e)}cancelPersistTimer(){this.persistTimer&&=(clearTimeout(this.persistTimer),null)}persistLayout(){let e=Date.now();this.state={...this.state,updatedAt:e},wo({mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:e},this.storageKey),this.cancelPersistTimer(),this.persistTimer=setTimeout(()=>{this.persistTimer=null,l(async()=>{let{trpcClient:e}=await import(`./trpc-sRR2hWAJ.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])).then(({trpcClient:t})=>t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:e}})).catch(()=>{})},Bne)}async resolveProjectScopedStorageKey(){try{let e=await fetch(Ine());if(!e.ok)return null;let t=await e.json();return typeof t.projectDir!=`string`||t.projectDir.length===0?null:zne(t.projectDir)}catch{return null}}rebindProjectScopedLayout(e){let t=qne(e);if(t){this.dispatch({type:`APPLY_LAYOUT`,layout:t,force:!0});return}this.state=bo({...this.state,updatedAt:0}),this.normalizeUrl(),this.notifyListeners()}};typeof window<`u`&&!qa()&&Oo.init();function ko(){return(0,G.useSyncExternalStore)(e=>Oo.subscribe(e),()=>Oo.getSnapshot(),()=>Oo.getSnapshot())}function Xne(e,t){return t.updatedAt-e.updatedAt||e.id.localeCompare(t.id)}function Zne(e){return[...e].sort(Xne)}function Ao(e,t=10){return Zne(e).slice(0,Math.max(0,Math.trunc(t)))}var jo;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(jo||={});var Qne;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Qne||={});var Mo=jo.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),No=e=>{switch(typeof e){case`undefined`:return Mo.undefined;case`string`:return Mo.string;case`number`:return Number.isNaN(e)?Mo.nan:Mo.number;case`boolean`:return Mo.boolean;case`function`:return Mo.function;case`bigint`:return Mo.bigint;case`symbol`:return Mo.symbol;case`object`:return Array.isArray(e)?Mo.array:e===null?Mo.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Mo.promise:typeof Map<`u`&&e instanceof Map?Mo.map:typeof Set<`u`&&e instanceof Set?Mo.set:typeof Date<`u`&&e instanceof Date?Mo.date:Mo.object;default:return Mo.unknown}},q=jo.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Po=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jo.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Po.create=e=>new Po(e);var Fo=(e,t)=>{let n;switch(e.code){case q.invalid_type:n=e.received===Mo.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,jo.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:n=`Unrecognized key(s) in object: ${jo.joinValues(e.keys,`, `)}`;break;case q.invalid_union:n=`Invalid input`;break;case q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${jo.joinValues(e.options)}`;break;case q.invalid_enum_value:n=`Invalid enum value. Expected ${jo.joinValues(e.options)}, received '${e.received}'`;break;case q.invalid_arguments:n=`Invalid function arguments`;break;case q.invalid_return_type:n=`Invalid function return type`;break;case q.invalid_date:n=`Invalid date`;break;case q.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:jo.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case q.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case q.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case q.custom:n=`Invalid input`;break;case q.invalid_intersection_types:n=`Intersection results could not be merged`;break;case q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case q.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,jo.assertNever(e)}return{message:n}},$ne=Fo;function Io(){return $ne}var Lo=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Ro(e,t){let n=Io(),r=Lo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Fo?void 0:Fo].filter(e=>!!e)});e.common.issues.push(r)}var zo=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Bo;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Bo;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Bo=Object.freeze({status:`aborted`}),Vo=e=>({status:`dirty`,value:e}),Ho=e=>({status:`valid`,value:e}),Uo=e=>e.status===`aborted`,Wo=e=>e.status===`dirty`,Go=e=>e.status===`valid`,Ko=e=>typeof Promise<`u`&&e instanceof Promise,qo;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(qo||={});var Jo=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Yo=(e,t)=>{if(Go(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new Po(e.common.issues),this._error}}};function Xo(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var Zo=class{get description(){return this._def.description}_getType(e){return No(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:No(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zo,ctx:{common:e.parent.common,data:e.data,parsedType:No(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ko(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)};return Yo(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Go(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Go(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)},r=this._parse({data:e,path:n.path,parent:n});return Yo(n,await(Ko(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:q.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ks({schema:this,typeName:zs.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return As.create(this,this._def)}nullable(){return js.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ps.create(this)}promise(){return Os.create(this,this._def)}or(e){return gs.create([this,e],this._def)}and(e){return ys.create(this,e,this._def)}transform(e){return new ks({...Xo(this._def),schema:this,typeName:zs.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Ms({...Xo(this._def),innerType:this,defaultValue:t,typeName:zs.ZodDefault})}brand(){return new Fs({typeName:zs.ZodBranded,type:this,...Xo(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Ns({...Xo(this._def),innerType:this,catchValue:t,typeName:zs.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Is.create(this,e)}readonly(){return Ls.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ere=/^c[^\s-]{8,}$/i,tre=/^[0-9a-z]+$/,nre=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rre=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ire=/^[a-z0-9_-]{21}$/i,are=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ore=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sre=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cre=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Qo,lre=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ure=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dre=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,fre=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pre=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mre=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$o=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,hre=RegExp(`^${$o}$`);function es(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function gre(e){return RegExp(`^${es(e)}$`)}function _re(e){let t=`${$o}T${es(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function vre(e,t){return!!((t===`v4`||!t)&&lre.test(e)||(t===`v6`||!t)&&dre.test(e))}function yre(e,t){if(!are.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function bre(e,t){return!!((t===`v4`||!t)&&ure.test(e)||(t===`v6`||!t)&&fre.test(e))}var ts=class e extends Zo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Mo.string){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.string,received:t.parsedType}),Bo}let t=new zo,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Ro(n,{code:q.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Ro(n,{code:q.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)sre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`email`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Qo||=new RegExp(cre,`u`),Qo.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`emoji`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)rre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`uuid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ire.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`nanoid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ere.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cuid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)tre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cuid2`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)nre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`ulid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Ro(n,{validation:`url`,code:q.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`regex`,code:q.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?_re(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?hre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?gre(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?ore.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`duration`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?vre(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`ip`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?yre(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`jwt`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?bre(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cidr`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?pre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`base64`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?mre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`base64url`,code:q.invalid_string,message:r.message}),t.dirty()):jo.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:q.invalid_string,...qo.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...qo.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...qo.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...qo.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...qo.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...qo.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...qo.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...qo.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...qo.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...qo.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...qo.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...qo.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...qo.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...qo.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...qo.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...qo.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...qo.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...qo.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...qo.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...qo.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...qo.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...qo.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...qo.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...qo.errToObj(t)})}nonempty(e){return this.min(1,qo.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ts.create=e=>new ts({checks:[],typeName:zs.ZodString,coerce:e?.coerce??!1,...Xo(e)});function xre(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var ns=class e extends Zo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Mo.number){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.number,received:t.parsedType}),Bo}let t,n=new zo;for(let r of this._def.checks)r.kind===`int`?jo.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?xre(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_finite,message:r.message}),n.dirty()):jo.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,qo.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,qo.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,qo.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,qo.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:qo.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:qo.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:qo.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:qo.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:qo.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:qo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:qo.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:qo.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:qo.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:qo.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&jo.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};ns.create=e=>new ns({checks:[],typeName:zs.ZodNumber,coerce:e?.coerce||!1,...Xo(e)});var rs=class e extends Zo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Mo.bigint)return this._getInvalidInput(e);let t,n=new zo;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):jo.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.bigint,received:t.parsedType}),Bo}gte(e,t){return this.setLimit(`min`,e,!0,qo.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,qo.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,qo.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,qo.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:qo.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:qo.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:qo.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:qo.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:qo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:qo.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};rs.create=e=>new rs({checks:[],typeName:zs.ZodBigInt,coerce:e?.coerce??!1,...Xo(e)});var is=class extends Zo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Mo.boolean){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.boolean,received:t.parsedType}),Bo}return Ho(e.data)}};is.create=e=>new is({typeName:zs.ZodBoolean,coerce:e?.coerce||!1,...Xo(e)});var as=class e extends Zo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Mo.date){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.date,received:t.parsedType}),Bo}if(Number.isNaN(e.data.getTime()))return Ro(this._getOrReturnCtx(e),{code:q.invalid_date}),Bo;let t=new zo,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):jo.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:qo.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:qo.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};as.create=e=>new as({checks:[],coerce:e?.coerce||!1,typeName:zs.ZodDate,...Xo(e)});var os=class extends Zo{_parse(e){if(this._getType(e)!==Mo.symbol){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.symbol,received:t.parsedType}),Bo}return Ho(e.data)}};os.create=e=>new os({typeName:zs.ZodSymbol,...Xo(e)});var ss=class extends Zo{_parse(e){if(this._getType(e)!==Mo.undefined){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.undefined,received:t.parsedType}),Bo}return Ho(e.data)}};ss.create=e=>new ss({typeName:zs.ZodUndefined,...Xo(e)});var cs=class extends Zo{_parse(e){if(this._getType(e)!==Mo.null){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.null,received:t.parsedType}),Bo}return Ho(e.data)}};cs.create=e=>new cs({typeName:zs.ZodNull,...Xo(e)});var ls=class extends Zo{constructor(){super(...arguments),this._any=!0}_parse(e){return Ho(e.data)}};ls.create=e=>new ls({typeName:zs.ZodAny,...Xo(e)});var us=class extends Zo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ho(e.data)}};us.create=e=>new us({typeName:zs.ZodUnknown,...Xo(e)});var ds=class extends Zo{_parse(e){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.never,received:t.parsedType}),Bo}};ds.create=e=>new ds({typeName:zs.ZodNever,...Xo(e)});var fs=class extends Zo{_parse(e){if(this._getType(e)!==Mo.undefined){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.void,received:t.parsedType}),Bo}return Ho(e.data)}};fs.create=e=>new fs({typeName:zs.ZodVoid,...Xo(e)});var ps=class e extends Zo{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Mo.array)return Ro(t,{code:q.invalid_type,expected:Mo.array,received:t.parsedType}),Bo;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Ro(t,{code:e?q.too_big:q.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Ro(t,{code:q.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Ro(t,{code:q.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Jo(t,e,t.path,n)))).then(e=>zo.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Jo(t,e,t.path,n)));return zo.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:qo.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:qo.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:qo.toString(n)}})}nonempty(e){return this.min(1,e)}};ps.create=(e,t)=>new ps({type:e,minLength:null,maxLength:null,exactLength:null,typeName:zs.ZodArray,...Xo(t)});function ms(e){if(e instanceof hs){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=As.create(ms(r))}return new hs({...e._def,shape:()=>t})}else if(e instanceof ps)return new ps({...e._def,type:ms(e.element)});else if(e instanceof As)return As.create(ms(e.unwrap()));else if(e instanceof js)return js.create(ms(e.unwrap()));else if(e instanceof bs)return bs.create(e.items.map(e=>ms(e)));else return e}var hs=class e extends Zo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:jo.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==Mo.object){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.object,received:t.parsedType}),Bo}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ds&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Jo(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ds){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Ro(n,{code:q.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Jo(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>zo.mergeObjectSync(t,e)):zo.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return qo.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:qo.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:zs.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of jo.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of jo.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ms(this)}partial(t){let n={};for(let e of jo.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of jo.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof As;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ts(jo.objectKeys(this.shape))}};hs.create=(e,t)=>new hs({shape:()=>e,unknownKeys:`strip`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)}),hs.strictCreate=(e,t)=>new hs({shape:()=>e,unknownKeys:`strict`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)}),hs.lazycreate=(e,t)=>new hs({shape:e,unknownKeys:`strip`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)});var gs=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Po(e.ctx.common.issues));return Ro(t,{code:q.invalid_union,unionErrors:n}),Bo}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Po(e));return Ro(t,{code:q.invalid_union,unionErrors:i}),Bo}}get options(){return this._def.options}};gs.create=(e,t)=>new gs({options:e,typeName:zs.ZodUnion,...Xo(t)});var _s=e=>e instanceof Cs?_s(e.schema):e instanceof ks?_s(e.innerType()):e instanceof ws?[e.value]:e instanceof Es?e.options:e instanceof Ds?jo.objectValues(e.enum):e instanceof Ms?_s(e._def.innerType):e instanceof ss?[void 0]:e instanceof cs?[null]:e instanceof As?[void 0,..._s(e.unwrap())]:e instanceof js?[null,..._s(e.unwrap())]:e instanceof Fs||e instanceof Ls?_s(e.unwrap()):e instanceof Ns?_s(e._def.innerType):[],Sre=class e extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Mo.object)return Ro(t,{code:q.invalid_type,expected:Mo.object,received:t.parsedType}),Bo;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Ro(t,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Bo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=_s(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:zs.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Xo(r)})}};function vs(e,t){let n=No(e),r=No(t);if(e===t)return{valid:!0,data:e};if(n===Mo.object&&r===Mo.object){let n=jo.objectKeys(t),r=jo.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=vs(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Mo.array&&r===Mo.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=vs(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Mo.date&&r===Mo.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var ys=class extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Uo(e)||Uo(r))return Bo;let i=vs(e.value,r.value);return i.valid?((Wo(e)||Wo(r))&&t.dirty(),{status:t.value,value:i.data}):(Ro(n,{code:q.invalid_intersection_types}),Bo)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ys.create=(e,t,n)=>new ys({left:e,right:t,typeName:zs.ZodIntersection,...Xo(n)});var bs=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.array)return Ro(n,{code:q.invalid_type,expected:Mo.array,received:n.parsedType}),Bo;if(n.data.length<this._def.items.length)return Ro(n,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Bo;!this._def.rest&&n.data.length>this._def.items.length&&(Ro(n,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Jo(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>zo.mergeArray(t,e)):zo.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};bs.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new bs({items:e,typeName:zs.ZodTuple,rest:null,...Xo(t)})};var Cre=class e extends Zo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.object)return Ro(n,{code:q.invalid_type,expected:Mo.object,received:n.parsedType}),Bo;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Jo(n,e,n.path,e)),value:a._parse(new Jo(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?zo.mergeObjectAsync(t,r):zo.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Zo?new e({keyType:t,valueType:n,typeName:zs.ZodRecord,...Xo(r)}):new e({keyType:ts.create(),valueType:t,typeName:zs.ZodRecord,...Xo(n)})}},xs=class extends Zo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.map)return Ro(n,{code:q.invalid_type,expected:Mo.map,received:n.parsedType}),Bo;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Jo(n,e,n.path,[a,`key`])),value:i._parse(new Jo(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Bo;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Bo;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};xs.create=(e,t,n)=>new xs({valueType:t,keyType:e,typeName:zs.ZodMap,...Xo(n)});var Ss=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.set)return Ro(n,{code:q.invalid_type,expected:Mo.set,received:n.parsedType}),Bo;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Ro(n,{code:q.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Ro(n,{code:q.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Bo;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Jo(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:qo.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:qo.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ss.create=(e,t)=>new Ss({valueType:e,minSize:null,maxSize:null,typeName:zs.ZodSet,...Xo(t)});var wre=class e extends Zo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Mo.function)return Ro(t,{code:q.invalid_type,expected:Mo.function,received:t.parsedType}),Bo;function n(e,n){return Lo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Io(),Fo].filter(e=>!!e),issueData:{code:q.invalid_arguments,argumentsError:n}})}function r(e,n){return Lo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Io(),Fo].filter(e=>!!e),issueData:{code:q.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Os){let e=this;return Ho(async function(...t){let o=new Po([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Ho(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Po([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Po([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:bs.create(t).rest(us.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||bs.create([]).rest(us.create()),returns:n||us.create(),typeName:zs.ZodFunction,...Xo(r)})}},Cs=class extends Zo{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Cs.create=(e,t)=>new Cs({getter:e,typeName:zs.ZodLazy,...Xo(t)});var ws=class extends Zo{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Ro(t,{received:t.data,code:q.invalid_literal,expected:this._def.value}),Bo}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ws.create=(e,t)=>new ws({value:e,typeName:zs.ZodLiteral,...Xo(t)});function Ts(e,t){return new Es({values:e,typeName:zs.ZodEnum,...Xo(t)})}var Es=class e extends Zo{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Ro(t,{expected:jo.joinValues(n),received:t.parsedType,code:q.invalid_type}),Bo}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Ro(t,{received:t.data,code:q.invalid_enum_value,options:n}),Bo}return Ho(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Es.create=Ts;var Ds=class extends Zo{_parse(e){let t=jo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Mo.string&&n.parsedType!==Mo.number){let e=jo.objectValues(t);return Ro(n,{expected:jo.joinValues(e),received:n.parsedType,code:q.invalid_type}),Bo}if(this._cache||=new Set(jo.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=jo.objectValues(t);return Ro(n,{received:n.data,code:q.invalid_enum_value,options:e}),Bo}return Ho(e.data)}get enum(){return this._def.values}};Ds.create=(e,t)=>new Ds({values:e,typeName:zs.ZodNativeEnum,...Xo(t)});var Os=class extends Zo{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Mo.promise&&t.common.async===!1?(Ro(t,{code:q.invalid_type,expected:Mo.promise,received:t.parsedType}),Bo):Ho((t.parsedType===Mo.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Os.create=(e,t)=>new Os({type:e,typeName:zs.ZodPromise,...Xo(t)});var ks=class extends Zo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zs.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Ro(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Bo;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Bo:r.status===`dirty`||t.value===`dirty`?Vo(r.value):r});{if(t.value===`aborted`)return Bo;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Bo:r.status===`dirty`||t.value===`dirty`?Vo(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Bo:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Bo:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Go(e))return Bo;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Go(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Bo);jo.assertNever(r)}};ks.create=(e,t,n)=>new ks({schema:e,typeName:zs.ZodEffects,effect:t,...Xo(n)}),ks.createWithPreprocess=(e,t,n)=>new ks({schema:t,effect:{type:`preprocess`,transform:e},typeName:zs.ZodEffects,...Xo(n)});var As=class extends Zo{_parse(e){return this._getType(e)===Mo.undefined?Ho(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};As.create=(e,t)=>new As({innerType:e,typeName:zs.ZodOptional,...Xo(t)});var js=class extends Zo{_parse(e){return this._getType(e)===Mo.null?Ho(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};js.create=(e,t)=>new js({innerType:e,typeName:zs.ZodNullable,...Xo(t)});var Ms=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Mo.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ms.create=(e,t)=>new Ms({innerType:e,typeName:zs.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Xo(t)});var Ns=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ko(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Po(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Po(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ns.create=(e,t)=>new Ns({innerType:e,typeName:zs.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Xo(t)});var Ps=class extends Zo{_parse(e){if(this._getType(e)!==Mo.nan){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.nan,received:t.parsedType}),Bo}return{status:`valid`,value:e.data}}};Ps.create=e=>new Ps({typeName:zs.ZodNaN,...Xo(e)});var Fs=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Is=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Bo:e.status===`dirty`?(t.dirty(),Vo(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Bo:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:zs.ZodPipeline})}},Ls=class extends Zo{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Go(e)&&(e.value=Object.freeze(e.value)),e);return Ko(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Ls.create=(e,t)=>new Ls({innerType:e,typeName:zs.ZodReadonly,...Xo(t)});function Rs(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function Tre(e,t={},n){return e?ls.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Rs(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Rs(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):ls.create()}hs.lazycreate;var zs;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(zs||={});var J=ts.create,Bs=ns.create;Ps.create,rs.create;var Vs=is.create;as.create,os.create,ss.create,cs.create,ls.create;var Hs=us.create;ds.create,fs.create;var Us=ps.create,Y=hs.create;hs.strictCreate;var Ws=gs.create,Gs=Sre.create;ys.create,bs.create;var Ks=Cre.create;xs.create,Ss.create,wre.create,Cs.create;var qs=ws.create,Js=Es.create;Ds.create,Os.create,ks.create,As.create,js.create;var Ere=ks.createWithPreprocess;Is.create;var Ys=[`timeout`,`memory-limit`,`runtime`,`abort`];async function Dre(e,t={}){let n=new AbortController,r=[],i=t.signal,a=Ore(t.timeoutMs);if(i)if(i.aborted)n.abort(i.reason);else{let e=()=>n.abort(i.reason);i.addEventListener(`abort`,e,{once:!0}),r.push(()=>i.removeEventListener(`abort`,e))}if(n.signal.aborted)return r.forEach(e=>e()),{ok:!1,error:Xs(n.signal.reason,i)};let o,s,c=Promise.resolve().then(()=>e(n.signal));c.catch(()=>void 0);let l=[c];n.signal.aborted||l.push(new Promise((e,t)=>{let i=()=>t(new DOMException(`Translation cancelled.`,`AbortError`));n.signal.addEventListener(`abort`,i,{once:!0}),r.push(()=>n.signal.removeEventListener(`abort`,i))})),a!==void 0&&l.push(new Promise((e,t)=>{o=setTimeout(()=>{s=Error(`Translation task timed out after ${a}ms.`),n.abort(s),t(s)},a)}));try{return{ok:!0,value:await Promise.race(l)}}catch(e){return n.abort(e),s&&n.signal.reason===s?{ok:!1,error:{kind:`timeout`,message:s.message}}:{ok:!1,error:Xs(e,i)}}finally{o&&clearTimeout(o),r.forEach(e=>e())}}function Xs(e,t){if(Mre(e))return e;if(t?.aborted)return{kind:`abort`,message:Zs(t.reason)??`Translation cancelled.`};if(e instanceof DOMException&&e.name===`AbortError`)return{kind:`abort`,message:Zs(e)??`Translation cancelled.`};let n=kre(e);return Are(n)?{kind:`timeout`,message:n}:jre(n)?{kind:`memory-limit`,message:n}:{kind:`runtime`,message:n}}function Ore(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):void 0}function kre(e){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:`Translation failed.`}function Zs(e){if(e instanceof Error&&e.message.trim().length>0)return e.message;if(typeof e==`string`&&e.trim().length>0)return e}function Are(e){return/\btime(?:d)?\s*out\b/i.test(e)}function jre(e){return/out of memory/i.test(e)||/memory limit/i.test(e)||/insufficient memory/i.test(e)||/ERR_WORKER_OUT_OF_MEMORY/i.test(e)}function Mre(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`kind`),n=Reflect.get(e,`message`);return typeof t==`string`&&Ys.includes(t)&&typeof n==`string`&&n.length>0}var Qs=[`browser`,`local`,`local-ct2`,`local-llama`,`openai`],$s=Js(Qs),ec=`browser`;function tc(e){return e===`local`||e===`local-ct2`||e===`local-llama`}function nc(e){return e===`local`||e===`local-ct2`}Js([`local`,`local-ct2`,`local-llama`,`openai`]);var rc=15e3,ic=Js([`not-downloaded`,`queued`,`downloading`,`paused`,`downloaded`,`error`,`deleting`]),Nre=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),required:Vs(),etag:J().min(1).optional(),revision:J().min(1).optional(),sourceUrl:J().min(1).optional(),raw:Hs().optional()}),Pre=Y({id:J().min(1),label:J().min(1),description:J().optional(),profile:J().min(1).optional(),dtype:J().min(1).optional(),estimatedTotalBytes:Bs().int().nonnegative().optional(),baseGroupId:J().min(1).optional(),commitHash:J().min(1).optional(),shortCommitHash:J().min(1).optional(),rootDir:J().min(1).optional(),status:ic.optional(),progress:Bs().min(0).max(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),resumable:Vs().optional(),error:J().optional(),selectable:Vs(),selected:Vs(),files:Us(Nre)}),Fre=Js([`idle`,`loading`,`ready`,`error`]),Ire=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),required:Vs(),etag:J().min(1).optional(),revision:J().min(1).optional(),sourceUrl:J().min(1).optional(),raw:Hs().optional()}),Lre=Y({id:J().min(1),baseGroupId:J().min(1),label:J().min(1),displayLabel:J().min(1),description:J().optional(),profile:J().min(1).optional(),dtype:J().min(1).optional(),commitHash:J().min(1),shortCommitHash:J().min(1),rootDir:J().min(1),estimatedTotalBytes:Bs().int().nonnegative().optional(),selectable:Vs(),files:Us(Ire)}),Rre=Y({modelId:J().min(1),source:qs(`huggingface`),endpoint:J().default(``),revision:J().min(1),commitHash:J().min(1),shortCommitHash:J().min(1),fetchedAt:Bs().int().nonnegative(),updatedAt:Bs().int().nonnegative(),raw:Hs().optional(),groups:Ks(J(),Lre).default({}),groupOrder:Us(J().min(1)).default([])}),zre=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional(),required:Vs().default(!0),status:ic.default(`not-downloaded`),updatedAt:Bs().int().nonnegative().optional(),error:J().optional()}),Bre=Y({groupId:J().min(1),baseGroupId:J().min(1).optional(),status:ic.default(`not-downloaded`),rootDir:J().min(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),progress:Bs().min(0).max(1).optional(),resumable:Vs().default(!1),error:J().optional(),installedAt:Bs().int().nonnegative().optional(),updatedAt:Bs().int().nonnegative().optional(),files:Us(zre).default([])}),Vre=Y({status:Fre.default(`idle`),message:J().optional(),error:J().optional(),updatedAt:Bs().int().nonnegative().optional()});Y({engineId:Js([`local`,`local-ct2`,`local-llama`]),modelId:J().min(1),selectedGroupId:J().min(1).optional(),groupId:J().min(1).optional(),status:ic,message:J(),progress:Bs().min(0).max(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),sessionId:J().optional(),resumable:Vs().optional(),files:Us(Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional()})).optional(),updatedAt:Bs().int().nonnegative()});var Hre=Y({modelId:J().min(1),estimatedTotalBytes:Bs().int().nonnegative().optional(),files:Us(Nre),profile:J().min(1).optional(),selectedGroupId:J().min(1).optional(),groups:Us(Pre).optional()});Y({modelId:J().min(1),version:qs(2).default(2),status:ic.default(`not-downloaded`),selected:Vs().default(!1),selectedGroupId:J().min(1).optional(),installedAt:Bs().int().nonnegative().optional(),updatedAt:Bs().int().nonnegative().optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),progress:Bs().min(0).max(1).optional(),resumable:Vs().default(!1),error:J().optional(),profileLoad:Vre.default(Vre.parse({})),profileManifest:Rre.optional(),groupsState:Ks(J(),Bre).default({}),plan:Hre.optional(),files:Us(Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional()})).default([])}),Js([`local`,`network`,`recommended`]);var Ure=Js([`installed`,`installing`,`missing`,`error`,`not-applicable`]),Wre=Js([`ready`,`probing`,`failed`,`error`,`not-applicable`]),Gre=Js([`ready`,`missing`,`downloading`,`error`,`not-applicable`]),ac=Y({message:J().optional(),progress:Bs().min(0).max(1).optional(),error:J().optional()}),Kre=Y({dependency:ac.extend({state:Ure}),runtime:ac.extend({state:Wre}),assets:ac.extend({state:Gre}),summary:J().optional()});function oc(e={}){return{dependency:{state:`not-applicable`,...e.dependency},runtime:{state:`not-applicable`,...e.runtime},assets:{state:`not-applicable`,...e.assets},...e.summary?{summary:e.summary}:{}}}function qre(e){return e.dependency.state===`installed`||e.dependency.state===`not-applicable`}function Jre(e){return e.runtime.state===`ready`||e.runtime.state===`not-applicable`}function sc(e){return e?!qre(e)||!Jre(e):!1}function cc(e){if(e)return e.summary??e.runtime.error??e.runtime.message??e.dependency.error??e.dependency.message??e.assets.error??e.assets.message}var Yre=Js([`stdout`,`stderr`]);Y({stream:Yre,text:J()}),Gs(`type`,[Y({type:qs(`status`),lifecycle:Kre}),Y({type:qs(`log`),stream:Yre,text:J()}),Y({type:qs(`exit`),lifecycle:Kre})]);var Xre=[{id:`browser`,label:`Browser`,description:`Uses the browser Translator API and future browser-side providers.`,technicalSummary:`Browser-native Web Translator adapter. Package payload is about 5 KB; browser language packs are managed by the browser.`,runtime:`browser`,kind:`browser`,installDescription:`Browser translation support is built into the browser runtime.`,moduleName:`@openspecui/browser-translator`,factoryExport:`createBrowserTranslatorFactory`},{id:`local`,label:`Local-Transformers`,description:`Runs an ONNX Runtime-backed local translation adapter through Transformers.js with managed ONNX model files.`,technicalSummary:`Server-side ONNX Runtime adapter via Transformers.js. Runtime package is installed on demand; selected ONNX model groups are downloaded separately and can range from tens to hundreds of MB.`,runtime:`server`,kind:`managed-local`,settingsKey:`local`,defaultModel:`Xenova/nllb-200-distilled-600M`,runtimePackageName:`@huggingface/transformers`,installDescription:`Install the Local-Transformers runtime package to enable server-side translation.`,modelLabel:`Local Model`,downloadGroupsLabel:`Local download profiles`,refreshTooltip:`Refresh local model profiles`,moduleName:`@openspecui/local-translator`,factoryExport:`createLocalTranslatorFactory`},{id:`local-ct2`,label:`Local-CT2`,description:`Runs a bundled local CTranslate2 translation runtime with managed model files.`,technicalSummary:`Server-side native CTranslate2 adapter. Runtime package is installed on demand; selected model artifacts are downloaded separately and can range from tens to hundreds of MB.`,runtime:`server`,kind:`managed-local`,settingsKey:`localCt2`,defaultModel:`ooeoeo/opus-mt-en-zh-ct2-float16`,runtimePackageName:`ctranslate2`,installDescription:`Install the Local-CT2 runtime package to enable server-side translation.`,modelLabel:`CT2 Model`,downloadGroupsLabel:`Local CT2 download groups`,refreshTooltip:`Refresh local model artifacts`,moduleName:`@openspecui/local-ct2-translator`,factoryExport:`createLocalCt2TranslatorFactory`},{id:`local-llama`,label:`Local-Llama`,description:`Runs a local GGUF translation-capable LLM through node-llama-cpp with managed GGUF model files.`,technicalSummary:`Server-side llama.cpp adapter via node-llama-cpp. Runtime package is installed on demand; selected GGUF model files are downloaded separately and can range from hundreds of MB to multiple GB.`,runtime:`server`,kind:`managed-local`,settingsKey:`localLlama`,defaultModel:`bartowski/Qwen2.5-0.5B-Instruct-GGUF`,runtimePackageName:`node-llama-cpp`,installDescription:`Install the Local-Llama runtime package to enable server-side GGUF translation.`,modelLabel:`Llama Model`,downloadGroupsLabel:`Local GGUF files`,refreshTooltip:`Refresh local GGUF artifacts`,moduleName:`@openspecui/local-llama-translator`,factoryExport:`createLocalLlamaTranslatorFactory`},{id:`openai`,label:`OpenAI-Completion`,description:`Uses an OpenAI-compatible TanStack AI completion provider for context-aware translation.`,technicalSummary:`Server-side TanStack AI adapter for OpenAI-compatible APIs. Package payload is about 5 KB; model size stays with the remote provider.`,runtime:`server`,kind:`remote-provider`,settingsKey:`openai`,defaultModel:`gpt-4.1-mini`,installDescription:`OpenAI completion translation is bundled with the server runtime.`,moduleName:`@openspecui/openai-completion-translator`,factoryExport:`createOpenAICompletionTranslatorFactory`}];function lc(e){let t=Xre.find(t=>t.id===e);if(!t)throw Error(`Unknown translation engine: ${e}`);return t}function Zre(e){let t=lc(e);if(t.kind!==`managed-local`)throw Error(`Translation engine ${e} is not a managed-local engine.`);return t}var uc=Y({baseUrl:J().default(``),token:J().default(``),model:J().default(`gpt-4.1-mini`)}),Qre=Y({baseUrl:J().optional(),token:J().optional(),model:J().optional()}),dc=Y({model:J().default(`Xenova/nllb-200-distilled-600M`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),$re=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()}),fc=Y({model:J().default(`ooeoeo/opus-mt-en-zh-ct2-float16`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),eie=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()}),pc=Y({model:J().default(`bartowski/Qwen2.5-0.5B-Instruct-GGUF`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),tie=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()});Y({engineId:$s.default(ec),openai:uc.default(uc.parse({})),local:dc.default(dc.parse({})),localCt2:fc.default(fc.parse({})),localLlama:pc.default(pc.parse({}))}),Y({engineId:$s.optional(),openai:Qre.optional(),local:$re.optional(),localCt2:eie.optional(),localLlama:tie.optional()}),Y({engineId:$s,sourceLanguage:J().min(1),targetLanguage:J().min(1),model:J().min(1).optional(),selectedGroupId:J().min(1).optional(),inputs:Us(J()).min(1),instructions:J().optional(),context:J().optional(),timeoutMs:Bs().int().positive().default(rc)}),Y({index:Bs().int().nonnegative(),output:J().optional(),error:Y({kind:Js(Ys),message:J().min(1)}).optional()});var mc=Js([`direct`,`bilingual`]),nie=Y({local:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),localCt2:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),localLlama:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),openai:Y({model:J().min(1).optional()}).default({})}).default({}),rie=Y({local:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),localCt2:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),localLlama:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),openai:Y({model:J().min(1).optional()}).optional()}),hc=Y({enabled:Vs().default(!1),targetLanguage:J().min(1).default(`zh`),displayMode:mc.default(`direct`),cacheEnabled:Vs().default(!1),engineId:$s.default(ec),engines:nie});Y({enabled:Vs().optional(),targetLanguage:J().min(1).optional(),displayMode:mc.optional(),cacheEnabled:Vs().optional(),engineId:$s.optional(),engines:rie.optional()});var gc=1e4,_c=2e5;Y({entryLimit:Bs().int().min(100).max(_c).default(gc)}),Y({entryLimit:Bs().int().min(100).max(_c).optional()}),Y({key:J().min(1),keyHash:J().min(1),sourceText:J(),translatedText:J(),targetNodesJson:J().optional(),sourceLanguage:J().min(1),targetLanguage:J().min(1),placeholderTopologyHash:J().min(1),attributeTopologyHash:J().min(1),displayPolicyVersion:Bs().int().positive(),engineId:$s.default(ec),engineVersion:J().optional(),model:J().optional(),translatorContractVersion:Bs().int().positive().default(1),createdAt:Bs().int().nonnegative(),lastAccessedAt:Bs().int().nonnegative()}).omit({createdAt:!0,lastAccessedAt:!0}),Y({keyHash:J().min(1)}),Y({enabled:Vs(),entryLimit:Bs().int().positive(),entries:Bs().int().nonnegative(),databasePath:J().optional()});var iie=`project`,aie=/^[A-Za-z]:\//;function vc(e){return e.replace(/\\/g,`/`).replace(/\/+$/g,``)}function oie(e){return e.startsWith(`/`)||aie.test(e)}function sie(e){return e.replace(/^\.?\//,``)}function yc(e){return vc(e).split(`/`).filter(Boolean)}function cie(e){let t=vc(e),n=/(?:^|\/)node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(@[^/]+\/[^/]+|[^/]+)(\/.*)?/.exec(t),r=n?.[1];return r?`npm:${r}${n[2]??``}`:null}function bc(e){return`${iie}:${sie(e)}`}function lie(e,t){let n=vc(e),r=vc(t),i=n.toLowerCase(),a=r.toLowerCase();return a===i||a.startsWith(`${i}/`)}function uie(e,t){let n=yc(e),r=yc(t),i=0;for(;i<n.length&&i<r.length&&n[i]?.toLowerCase()===r[i]?.toLowerCase();)i+=1;return r.slice(i).join(`/`)}function die(e){let t=yc(e),n=t.lastIndexOf(`openspec`);return n<0?null:t.slice(n).join(`/`)}function xc(e,t){let n=vc(e),r=cie(n);return(t?.source===`package`||r)&&r?r:oie(n)?t?.projectDir&&lie(t.projectDir,n)?bc(uie(t.projectDir,n)):bc(die(n)||yc(n).slice(-4).join(`/`)):bc(n)}var Sc=Symbol.for(`yaml.alias`),Cc=Symbol.for(`yaml.document`),wc=Symbol.for(`yaml.map`),Tc=Symbol.for(`yaml.pair`),Ec=Symbol.for(`yaml.scalar`),Dc=Symbol.for(`yaml.seq`),Oc=Symbol.for(`yaml.node.type`),kc=e=>!!e&&typeof e==`object`&&e[Oc]===Sc,Ac=e=>!!e&&typeof e==`object`&&e[Oc]===Cc,jc=e=>!!e&&typeof e==`object`&&e[Oc]===wc,Mc=e=>!!e&&typeof e==`object`&&e[Oc]===Tc,Nc=e=>!!e&&typeof e==`object`&&e[Oc]===Ec,Pc=e=>!!e&&typeof e==`object`&&e[Oc]===Dc;function Fc(e){if(e&&typeof e==`object`)switch(e[Oc]){case wc:case Dc:return!0}return!1}function Ic(e){if(e&&typeof e==`object`)switch(e[Oc]){case Sc:case wc:case Ec:case Dc:return!0}return!1}var Lc=e=>(Nc(e)||Fc(e))&&!!e.anchor,Rc=Symbol(`break visit`),zc=Symbol(`skip children`),Bc=Symbol(`remove node`);function Vc(e,t){let n=Gc(t);Ac(e)?Hc(null,e.contents,n,Object.freeze([e]))===Bc&&(e.contents=null):Hc(null,e,n,Object.freeze([]))}Vc.BREAK=Rc,Vc.SKIP=zc,Vc.REMOVE=Bc;function Hc(e,t,n,r){let i=Kc(e,t,n,r);if(Ic(i)||Mc(i))return qc(e,r,i),Hc(e,i,n,r);if(typeof i!=`symbol`){if(Fc(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Hc(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Rc)return Rc;else i===Bc&&(t.items.splice(e,1),--e)}}else if(Mc(t)){r=Object.freeze(r.concat(t));let e=Hc(`key`,t.key,n,r);if(e===Rc)return Rc;e===Bc&&(t.key=null);let i=Hc(`value`,t.value,n,r);if(i===Rc)return Rc;i===Bc&&(t.value=null)}}return i}async function Uc(e,t){let n=Gc(t);Ac(e)?await Wc(null,e.contents,n,Object.freeze([e]))===Bc&&(e.contents=null):await Wc(null,e,n,Object.freeze([]))}Uc.BREAK=Rc,Uc.SKIP=zc,Uc.REMOVE=Bc;async function Wc(e,t,n,r){let i=await Kc(e,t,n,r);if(Ic(i)||Mc(i))return qc(e,r,i),Wc(e,i,n,r);if(typeof i!=`symbol`){if(Fc(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await Wc(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Rc)return Rc;else i===Bc&&(t.items.splice(e,1),--e)}}else if(Mc(t)){r=Object.freeze(r.concat(t));let e=await Wc(`key`,t.key,n,r);if(e===Rc)return Rc;e===Bc&&(t.key=null);let i=await Wc(`value`,t.value,n,r);if(i===Rc)return Rc;i===Bc&&(t.value=null)}}return i}function Gc(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Kc(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(jc(t))return n.Map?.(e,t,r);if(Pc(t))return n.Seq?.(e,t,r);if(Mc(t))return n.Pair?.(e,t,r);if(Nc(t))return n.Scalar?.(e,t,r);if(kc(t))return n.Alias?.(e,t,r)}function qc(e,t,n){let r=t[t.length-1];if(Fc(r))r.items[e]=n;else if(Mc(r))e===`key`?r.key=n:r.value=n;else if(Ac(r))r.contents=n;else{let e=kc(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var fie={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},pie=e=>e.replace(/[!,[\]{}]/g,e=>fie[e]),Jc=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+pie(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Ic(e.contents)){let t={};Vc(e.contents,(e,n)=>{Ic(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/trpc-D1nFWwj3.js","assets/jsx-runtime-1jQlXmIx.js","assets/chunk-VBW0iQ51.js","assets/browserAll-Dp578vps.js","assets/Geometry-Dr8DqqDe.js","assets/init-CHa3E6Fn.js","assets/webworkerAll-CONHxfi1.js","assets/WebGPURenderer-DAH_m5D3.js","assets/WebGLRenderer-CCytcJrB.js","assets/CanvasRenderer-CLQD6X5w.js","assets/ghostty-web-CxzCiCWn.js","assets/preload-helper-DgFuoWHe.js","assets/dist-DBzjiykV.js","assets/dist-DhToCcpI.js","assets/dist-vqrjFRzf.js","assets/dist-CaejG1dm.js","assets/dist-DT99Gaya.js","assets/dist-jDblB_T7.js","assets/dist-DKpbXO9V.js","assets/dist-Ct1D1r3D.js","assets/dist-DtDYJdOe.js","assets/dist-v0p4Oxur.js","assets/dist-DroIyWBO.js","assets/dist-BhkpGj11.js","assets/dist-CKjYpdph.js","assets/dist-DSyaj1iO.js","assets/dist-BzodlTBW.js","assets/dist-YdUjCFVN.js","assets/dist-D65w4-0d.js","assets/dist--fdiDhsa.js","assets/dist-CaORa3GR.js","assets/dist-lNuHRy_r.js","assets/dist-D_hpFHgB.js","assets/dockerfile-B9WyxmEu.js","assets/simple-mode-DW6rCJL0.js","assets/factor-DRSLM7tp.js","assets/nsis-BOISW3t0.js","assets/pug-RUWq2f7J.js","assets/javascript-DoCiwYd8.js","assets/dist-56Ibj2m1.js","assets/dist-KjL9POKA.js","assets/angular-html-DRwRMfwy.js","assets/html-BUh_K1Ws.js","assets/css-xQqtr90G.js","assets/javascript-CVtEj2Ax.js","assets/angular-ts-eNLzy5MM.js","assets/scss-CpCId5ps.js","assets/apl-DCKZGJwU.js","assets/json-C5SgWOeO.js","assets/xml-DANbtZOH.js","assets/java-CY_ZDz_b.js","assets/astro-EVzibiTP.js","assets/postcss-Bhprukf5.js","assets/tsx-CsYF3fAD.js","assets/typescript-BmTNzuQ_.js","assets/blade-BlgBU4xi.js","assets/html-derivative-CI0a_UC2.js","assets/sql-BOLSSU4F.js","assets/bsl-ROP5CocM.js","assets/sdbl-DcdijJCo.js","assets/c-CYXkGxNJ.js","assets/cairo-Y91V9cKj.js","assets/python-JifBw8Pd.js","assets/cobol-DwyfNZUw.js","assets/coffee-B8v2Wa7-.js","assets/cpp-ljtJvfZQ.js","assets/glsl-B14Nf0bw.js","assets/regexp-zEw_f83a.js","assets/crystal-D8eXAHcv.js","assets/shellscript-C9ppp5mf.js","assets/edge-BF9yTvjv.js","assets/elixir-B_B5En4k.js","assets/elm-gyEPvRKn.js","assets/erb-CrCiRjX6.js","assets/ruby-B0E3lf9H.js","assets/graphql-sQJ6gIy3.js","assets/jsx-lP4LEWkV.js","assets/haml-b85W5NJa.js","assets/lua-C-xH-Hms.js","assets/yaml-hgQ2rJ8K.js","assets/erlang-Bt6NlFdF.js","assets/markdown-UHPJkTEn.js","assets/fortran-fixed-form-BlyL6vAi.js","assets/fortran-free-form-D7-gzSM8.js","assets/fsharp-CPUyN5V2.js","assets/gdresource-3p4mNHpb.js","assets/gdscript-rt9_TXru.js","assets/gdshader-crF0MxG8.js","assets/git-commit-BUEnSUuI.js","assets/diff-CatgE3dT.js","assets/git-rebase-C31Q9wLE.js","assets/glimmer-js-C52Y4fUH.js","assets/glimmer-ts-BWcx8nGq.js","assets/hack-B3o_6UdT.js","assets/handlebars-D0WfzX4P.js","assets/http-D2LmS59K.js","assets/hurl-COx-msQh.js","assets/csv-BvaZ2T8c.js","assets/hxml-PXekqTur.js","assets/haxe-B256JjEJ.js","assets/jinja-DqDhfavg.js","assets/jison-AZhthQMg.js","assets/julia-Cj513uz1.js","assets/r-BuzK-O4X.js","assets/latex-DwZK1V4M.js","assets/tex-D_8z9IZF.js","assets/liquid-Bq0P5vJ7.js","assets/marko-B0ZA9L6u.js","assets/less-Cgo6VXQL.js","assets/mdc-BjV-9MeS.js","assets/nginx-BlGA_Yc6.js","assets/nim-BRY7cBHe.js","assets/perl-ZYxvPTl8.js","assets/php-BkicJQpQ.js","assets/pug-CtobE3oR.js","assets/qml-bFAbyxEk.js","assets/razor-BdPQn0FN.js","assets/csharp-CRgWAKTP.js","assets/rst-DKhAJU51.js","assets/cmake-CsF3WHAq.js","assets/sas-DURk68cf.js","assets/shaderlab-F_37C8HY.js","assets/hlsl-D0l9oydz.js","assets/shellsession-Bz7lU47b.js","assets/soy-BhKWbuAF.js","assets/sparql-C2li3eXU.js","assets/turtle-vnW9ZH2N.js","assets/stata-BT_KvsDz.js","assets/svelte-CDr7VO4q.js","assets/templ-nVp5md9X.js","assets/go-BD7Erf5u.js","assets/ts-tags-B9PwlsPz.js","assets/twig-DhcsZkOG.js","assets/vue-9hbz3kVV.js","assets/vue-html-DeYWClYd.js","assets/vue-vine-0B8BRjOA.js","assets/stylus-BGkOI8rZ.js","assets/xsl-Dxfe-dB3.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,i as t,n,r,t as i}from"./chunk-VBW0iQ51.js";import"./modulepreload-polyfill-CXK8biUa.js";import{n as a,t as o}from"./client-CNtwgWOm.js";import{n as s,t as c}from"./jsx-runtime-1jQlXmIx.js";import{t as l}from"./preload-helper-DgFuoWHe.js";import{$ as u,A as d,B as f,C as p,E as m,F as h,G as g,H as _,I as v,J as y,K as b,L as x,N as S,O as C,P as w,Q as T,R as E,T as D,U as O,W as k,X as A,Y as j,Z as M,_ as N,a as P,b as F,c as ee,d as I,et as L,f as R,g as z,h as te,i as B,it as V,j as ne,k as re,l as ie,m as ae,n as oe,nt as se,o as ce,q as le,r as ue,rt as H,s as de,t as fe,tt as pe,u as me,v as he,w as ge,x as _e,y as ve,z as ye}from"./Geometry-Dr8DqqDe.js";import{t as be}from"./ImageSource-CGpyv_SH.js";import{C as xe,D as Se,E as Ce,O as we,S as Te,T as Ee,_ as De,a as Oe,b as ke,c as Ae,d as je,f as Me,g as Ne,h as Pe,i as Fe,k as Ie,l as Le,m as Re,n as ze,o as Be,p as Ve,r as He,s as Ue,t as We,u as Ge,v as Ke,w as qe,x as Je,y as Ye}from"./RenderTargetSystem-COjjAuAB.js";import{t as Xe}from"./getTextureBatchBindGroup-BfHjyiAV.js";import{a as Ze,c as Qe,d as $e,f as et,i as tt,l as nt,n as rt,o as it,p as at,r as ot,s as st,t as ct,u as lt}from"./BufferResource-C08dlE1_.js";import{$ as ut,A as dt,At as ft,B as pt,C as mt,Ct as ht,D as gt,Dt as _t,E as vt,Et as yt,F as bt,Ft as xt,G as St,H as Ct,I as wt,It as Tt,K as Et,L as Dt,Lt as Ot,M as kt,Mt as At,Nt as jt,O as Mt,Ot as Nt,P as Pt,Pt as Ft,Q as It,R as U,S as Lt,St as Rt,T as zt,Tt as Bt,U as Vt,V as Ht,W as Ut,X as Wt,Y as Gt,Z as Kt,_ as qt,a as Jt,at as Yt,b as Xt,bt as Zt,c as Qt,ct as $t,d as en,dt as tn,et as nn,f as rn,ft as an,g as on,gt as sn,h as cn,i as ln,it as un,j as dn,jt as fn,k as pn,kt as mn,l as W,lt as hn,m as gn,mt as _n,n as vn,nt as yn,o as bn,p as xn,pt as Sn,q as Cn,r as wn,rt as Tn,s as En,st as Dn,t as On,u as kn,ut as An,v as jn,vt as Mn,w as Nn,wt as Pn,x as Fn,xt as In,z as Ln}from"./dist-vqrjFRzf.js";import{a as Rn,i as eee,n as zn,o as tee,r as Bn}from"./dist-Ct1D1r3D.js";import{i as nee,n as ree,o as iee,r as aee,t as oee}from"./dist-DhToCcpI.js";var Vn=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(){}},see={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Hn=new class{#e=see;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 cee(e){setTimeout(e,0)}var Un=typeof window>`u`||`Deno`in globalThis;function Wn(){}function lee(e,t){return typeof e==`function`?e(t):e}function Gn(e){return typeof e==`number`&&e>=0&&e!==1/0}function Kn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function qn(e,t){return typeof e==`function`?e(t):e}function Jn(e,t){return typeof e==`function`?e(t):e}function Yn(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Zn(o,t.options))return!1}else if(!$n(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 Xn(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Qn(t.options.mutationKey)!==Qn(a))return!1}else if(!$n(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Zn(e,t){return(t?.queryKeyHashFn||Qn)(e)}function Qn(e){return JSON.stringify(e,(e,t)=>nr(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $n(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>$n(e[n],t[n])):!1}var uee=Object.prototype.hasOwnProperty;function er(e,t){if(e===t)return e;let n=dee(e)&&dee(t);if(!n&&!(nr(e)&&nr(t)))return t;let r=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,o=n?Array(a):{},s=0;for(let c=0;c<a;c++){let a=n?c:i[c],l=e[a],u=t[a];if(l===u){o[a]=l,(n?c<r:uee.call(e,a))&&s++;continue}if(l===null||u===null||typeof l!=`object`||typeof u!=`object`){o[a]=u;continue}let d=er(l,u);o[a]=d,d===l&&s++}return r===a&&s===r?e:o}function tr(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 dee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nr(e){if(!fee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!fee(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function fee(e){return Object.prototype.toString.call(e)===`[object Object]`}function pee(e){return new Promise(t=>{Hn.setTimeout(t,e)})}function rr(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:er(e,t)}function mee(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function hee(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ir=Symbol();function ar(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ir?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function or(e,t){return typeof e==`function`?e(...t):!!e}var sr=new class extends Vn{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Un&&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`}};function cr(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var gee=cee;function _ee(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=gee,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 lr=_ee(),ur=new class extends Vn{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Un&&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 vee(e){return Math.min(1e3*2**e,3e4)}function dr(e){return(e??`online`)===`online`?ur.isOnline():!0}var fr=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function pr(e){let t=!1,n=0,r,i=cr(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new fr(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>sr.isFocused()&&(e.networkMode===`always`||ur.isOnline())&&e.canRun(),u=()=>dr(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())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(d).catch(r=>{if(a())return;let i=e.retry??(Un?0:3),o=e.retryDelay??vee,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),pee(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var mr=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gn(this.gcTime)&&(this.#e=Hn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Un?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(Hn.clearTimeout(this.#e),void 0)}},yee=class extends mr{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=_r(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=_r(this.options);e.data!==void 0&&(this.setState(gr(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=rr(this.state.data,e,this.options);return this.#s({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(Wn).catch(Wn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Jn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ir||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>qn(e.options.staleTime,this)===`static`):!1}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:!Kn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.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.#o=!0,n.signal)})},i=()=>{let e=ar(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!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.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=pr({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof fr&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#s({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#s({type:`pause`})},onContinue:()=>{this.#s({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof fr){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#s({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#s(e){this.state=(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,...hr(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...gr(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=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`};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}})(this.state),lr.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function hr(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dr(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function gr(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function _r(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 vr=class extends Vn{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=cr(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),yr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return br(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return br(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 Jn(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&&!tr(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&xr(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Jn(this.options.enabled,this.#t)!==Jn(t.enabled,this.#t)||qn(this.options.staleTime,this.#t)!==qn(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Jn(this.options.enabled,this.#t)!==Jn(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return xee(this,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),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.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);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Wn)),t}#g(){this.#b();let e=qn(this.options.staleTime,this.#t);if(Un||this.#r.isStale||!Gn(e))return;let t=Kn(this.#r.dataUpdatedAt,e)+1;this.#d=Hn.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.#p=e,!(Un||Jn(this.options.enabled,this.#t)===!1||!Gn(this.#p)||this.#p===0)&&(this.#f=Hn.setInterval(()=>{(this.options.refetchIntervalInBackground||sr.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(Hn.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(Hn.clearInterval(this.#f),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&&yr(e,t),o=i&&xr(e,n,t,r);(a||o)&&(l={...l,...hr(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.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=rr(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=rr(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={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:l.dataUpdateCount>0||l.errorUpdateCount>0,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:Sr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Jn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=e=>{x.status===`error`?e.reject(x.error):x.data!==void 0&&e.resolve(x.data)},r=()=>{t(this.#o=x.promise=cr())},i=this.#o;switch(i.status){case`pending`:e.queryHash===n.queryHash&&t(i);break;case`fulfilled`:(x.status===`error`||x.data!==i.value)&&r();break;case`rejected`:(x.status!==`error`||x.error!==i.reason)&&r();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!tr(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);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)})})()}))}#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()}#C(e){lr.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function bee(e,t){return Jn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function yr(e,t){return bee(e,t)||e.state.data!==void 0&&br(e,t,t.refetchOnMount)}function br(e,t,n){if(Jn(t.enabled,e)!==!1&&qn(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Sr(e,t)}return!1}function xr(e,t,n,r){return(e!==t||Jn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Sr(e,n)}function Sr(e,t){return Jn(t.enabled,e)!==!1&&e.isStaleByTime(qn(t.staleTime,e))}function xee(e,t){return!tr(e.getCurrentResult(),t)}function Cr(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=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener(`abort`,()=>{n=!0}),t.signal)})},u=ar(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?hee:mee;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?See:wr,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:wr(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function wr(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 See(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Cee(e,t){return t?wr(e,t)!=null:!1}function wee(e,t){return!t||!e.getPreviousPageParam?!1:See(e,t)!=null}var Tee=class extends vr{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Cr()})}getOptimisticResult(e){return e.behavior=Cr(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Cee(t,n.data),hasPreviousPage:wee(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Eee=class extends mr{#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||Dee(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=pr({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{throw await this.#n.config.onError?.(t,e,this.state.context,this,n),await this.options.onError?.(t,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,t,e,this.state.context,n),t}finally{this.#i({type:`error`,error:t})}}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),lr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Dee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Oee=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Eee({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=Tr(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=Tr(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=Tr(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Tr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lr.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=>Xn(t,e))}findAll(e={}){return this.getAll().filter(t=>Xn(e,t))}notify(e){lr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lr.batch(()=>Promise.all(e.map(e=>e.continue().catch(Wn))))}};function Tr(e){return e.options.scope?.id}var kee=class extends Vn{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),tr(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Qn(t.mutationKey)!==Qn(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Dee();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){lr.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type===`success`?(this.#r.onSuccess?.(e.data,t,n,r),this.#r.onSettled?.(e.data,null,t,n,r)):e?.type===`error`&&(this.#r.onError?.(e.error,t,n,r),this.#r.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#t)})})}};function Er(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Aee(e,t,n){let r=e.slice(0);return r[t]=n,r}var jee=class extends Vn{#e;#t;#n;#r;#i;#a;#o;#s;#c=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,lr.batch(()=>{let e=this.#i,t=this.#d(this.#n);this.#c=t,t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!tr(e,n)});!o&&!s||(o&&(this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Er(e,n).forEach(e=>{e.destroy()}),Er(n,e).forEach(e=>{e.subscribe(t=>{this.#f(e,t)})})),this.#p()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#d(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[r,e=>this.#u(e??r,t),()=>this.#l(r,n)]}#l(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#u(e,t){return t?((!this.#a||this.#t!==this.#s||t!==this.#o)&&(this.#o=t,this.#s=this.#t,this.#a=er(this.#a,t(e))),this.#a):e}#d(e){let t=new Map(this.#i.map(e=>[e.options.queryHash,e])),n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new vr(this.#e,r)})}),n}#f(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Aee(this.#t,n,t),this.#p())}#p(){if(this.hasListeners()){let e=this.#a,t=this.#l(this.#t,this.#c);e!==this.#u(t,this.#r?.combine)&&lr.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Mee=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Zn(r,t),a=this.get(i);return a||(a=new yee({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(){lr.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=>Yn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Yn(e,t)):t}notify(e){lr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Nee=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mee,this.#t=e.mutationCache||new Oee,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=sr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ur.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(qn(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=lee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lr.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;lr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lr.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=lr.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Wn).catch(Wn)}invalidateQueries(e,t={}){return lr.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=lr.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(Wn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Wn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Wn).catch(Wn)}fetchInfiniteQuery(e){return e.behavior=Cr(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Wn).catch(Wn)}ensureInfiniteQueryData(e){return e.behavior=Cr(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ur.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(Qn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{$n(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Qn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{$n(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Zn(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===ir&&(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()}},G=e(s(),1),K=c(),Dr=G.createContext(void 0),Or=e=>{let t=G.useContext(Dr);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Pee=({client:e,children:t})=>(G.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,K.jsx)(Dr.Provider,{value:e,children:t})),kr=G.createContext(!1),Ar=()=>G.useContext(kr);kr.Provider;function Fee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Iee=G.createContext(Fee()),jr=()=>G.useContext(Iee),Mr=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Nr=e=>{G.useEffect(()=>{e.clearReset()},[e])},Pr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||or(n,[e.error,r])),Fr=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))}},Ir=(e,t)=>e.isLoading&&e.isFetching&&!t,Lr=(e,t)=>e?.suspense&&t.isPending,Rr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Lee({queries:e,...t},n){let r=Or(n),i=Ar(),a=jr(),o=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Fr(e),Mr(e,a)}),Nr(a);let[s]=G.useState(()=>new jee(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;G.useSyncExternalStore(G.useCallback(e=>d?s.subscribe(lr.batchCalls(e)):Wn,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),G.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Lr(o[t],e))?c.flatMap((e,t)=>{let n=o[t];if(n){let t=new vr(r,n);if(Lr(n,e))return Rr(n,t,a);Ir(e,i)&&Rr(n,t,a)}return[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Pr({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function zr(e,t,n){let r=Ar(),i=jr(),a=Or(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?`isRestoring`:`optimistic`,Fr(o),Mr(o,i),Nr(i);let s=!a.getQueryCache().get(o.queryHash),[c]=G.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(G.useSyncExternalStore(G.useCallback(e=>{let t=u?c.subscribe(lr.batchCalls(e)):Wn;return c.updateResult(),t},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),G.useEffect(()=>{c.setOptions(o)},[o,c]),Lr(o,l))throw Rr(o,c,i);if(Pr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Un&&Ir(l,r)&&(s?Rr(o,c,i):a.getQueryCache().get(o.queryHash)?.promise)?.catch(Wn).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?l:c.trackResult(l)}function Br(e,t){return zr(e,vr,t)}function Ree(e){return e}function zee(e){return e}function Vr(e,t){let n=Or(t),[r]=G.useState(()=>new kee(n,e));G.useEffect(()=>{r.setOptions(e)},[r,e]);let i=G.useSyncExternalStore(G.useCallback(e=>r.subscribe(lr.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=G.useCallback((e,t)=>{r.mutate(e,t).catch(Wn)},[r]);if(i.error&&or(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Bee(e,t){return zr(e,Tee,t)}var Hr=new WeakMap,Vee=new WeakMap,Ur={current:[]},Wr=!1,Gr=0,Kr=new Set,qr=new Map;function Jr(e){for(let t of e){if(Ur.current.includes(t))continue;Ur.current.push(t),t.recompute();let e=Vee.get(t);if(e)for(let t of e){let e=Hr.get(t);e?.length&&Jr(e)}}}function Hee(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Uee(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function Yr(e){if(Gr>0&&!qr.has(e)&&qr.set(e,e.prevState),Kr.add(e),!(Gr>0)&&!Wr)try{for(Wr=!0;Kr.size>0;){let e=Array.from(Kr);Kr.clear();for(let t of e)t.prevState=qr.get(t)??t.prevState,Hee(t);for(let t of e){let e=Hr.get(t);e&&(Ur.current.push(t),Jr(e))}for(let t of e){let e=Hr.get(t);if(e)for(let t of e)Uee(t)}}}finally{Wr=!1,Ur.current=[],qr.clear()}}function Xr(e){Gr++;try{e()}finally{if(Gr--,Gr===0){let e=Kr.values().next().value;e&&Yr(e)}}}function Wee(e){return typeof e==`function`}var Gee=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):Wee(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),Yr(this)}},Zr=`__TSR_index`,Qr=`popstate`,$r=`beforeunload`;function ei(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=ni(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Zr];i=ti(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Zr];i=ti(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Zr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function ti(e,t){t||={};let n=ri();return{...t,key:n,__TSR_key:n,[Zr]:e}}function Kee(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>ni(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ri();t.history.replaceState({[Zr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=ni(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Zr]-l.state[Zr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=ei({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener($r,S,{capture:!0}),t.removeEventListener(Qr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener($r,S,{capture:!0}),t.addEventListener(Qr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function ni(e,t){let n=e.indexOf(`#`),r=e.indexOf(`?`),i=ri();return{href:e,pathname:e.substring(0,n>0?r>0?Math.min(n,r):n:r>0?r:e.length),hash:n>-1?e.substring(n):``,search:r>-1?e.slice(r,n===-1?void 0:n):``,state:t||{[Zr]:0,key:i,__TSR_key:i}}}function ri(){return(Math.random()+1).toString(36).substring(7)}function ii(e){return e[e.length-1]}function qee(e){return typeof e==`function`}function ai(e,t){return qee(e)?e(t):e}var Jee=Object.prototype.hasOwnProperty;function oi(e,t){if(e===t)return e;let n=t,r=Zee(e)&&Zee(n);if(!r&&!(si(e)&&si(n)))return n;let i=r?e:Yee(e);if(!i)return n;let a=r?n:Yee(n);if(!a)return n;let o=i.length,s=a.length,c=r?Array(s):{},l=0;for(let t=0;t<s;t++){let i=r?t:a[t],s=e[i],u=n[i];if(s===u){c[i]=s,(r?t<o:Jee.call(e,i))&&l++;continue}if(s===null||u===null||typeof s!=`object`||typeof u!=`object`){c[i]=u;continue}let d=oi(s,u);c[i]=d,d===s&&l++}return o===s&&l===o?e:c}function Yee(e){let t=[],n=Object.getOwnPropertyNames(e);for(let r of n){if(!Object.prototype.propertyIsEnumerable.call(e,r))return!1;t.push(r)}let r=Object.getOwnPropertySymbols(e);for(let n of r){if(!Object.prototype.propertyIsEnumerable.call(e,n))return!1;t.push(n)}return t}function si(e){if(!Xee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Xee(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Xee(e){return Object.prototype.toString.call(e)===`[object Object]`}function Zee(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ci(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!ci(e[r],t[r],n))return!1;return!0}if(si(e)&&si(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!ci(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!ci(e[o],t[o],n)))return!1;return i===a}return!1}function li(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function ui(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function di(e){try{return decodeURI(e)}catch{return e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}}function fi(e,t){if(!e)return e;let n=t?RegExp(`${t.join(`|`)}`,`gi`):/%25|%5C/gi,r=0,i=``,a;for(;(a=n.exec(e))!==null;)i+=di(e.slice(r,a.index))+a[0],r=n.lastIndex;return i+di(r?e.slice(r):e)}var Qee=!0,pi=`Invariant failed`;function mi(e,t){if(!e){if(Qee)throw Error(pi);var n=typeof t==`function`?t():t,r=n?`${pi}: ${n}`:pi;throw Error(r)}}function hi(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var $ee=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,ete=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,tte=/^([^{]*)\{\$\}([^}]*)$/;function gi(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.match(tte);if(o){let r=o[1].length;return n[0]=2,n[1]=t+r,n[2]=t+r+1,n[3]=t+r+2,n[4]=t+r+3,n[5]=e.length,n}let s=a.match(ete);if(s){let e=s[1],r=s[2],a=s[3],o=e.length;return n[0]=3,n[1]=t+o,n[2]=t+o+3,n[3]=t+o+3+r.length,n[4]=i-a.length,n[5]=i,n}let c=a.match($ee);if(c){let e=c[1],r=c[2],a=c[3],o=e.length;return n[0]=1,n[1]=t+o,n[2]=t+o+2,n[3]=t+o+2+r.length,n[4]=i-a.length,n[5]=i,n}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function _i(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e;for(;s<o;){let e=gi(r,s,t),o,l=s,u=e[5];switch(s=u+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=bi(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=bi(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=i.dynamic?.find(e=>e.caseSensitive===d&&e.prefix===f&&e.suffix===p);if(m)o=m;else{let e=xi(1,n.fullPath??n.from,d,f,p);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=i.optional?.find(e=>e.caseSensitive===d&&e.prefix===f&&e.suffix===p);if(m)o=m;else{let e=xi(3,n.fullPath??n.from,d,f,p);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(l,e[1]),s=r.substring(e[4],u),d=c&&!!(t||s),f=t?d?t:t.toLowerCase():void 0,p=s?d?s:s.toLowerCase():void 0,m=xi(2,n.fullPath??n.from,d,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if((n.path||!n.children)&&!n.isRoot){let e=r.endsWith(`/`);e||(i.notFound=n),(!i.route||!i.isIndex&&e)&&(i.route=n),i.isIndex||=e}}if(n.children)for(let r of n.children)_i(e,t,r,s,i,a,o)}function vi(e,t){if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function yi(e){if(e.static)for(let t of e.static.values())yi(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())yi(t);if(e.dynamic?.length){e.dynamic.sort(vi);for(let t of e.dynamic)yi(t)}if(e.optional?.length){e.optional.sort(vi);for(let t of e.optional)yi(t)}if(e.wildcard?.length){e.wildcard.sort(vi);for(let t of e.wildcard)yi(t)}}function bi(e){return{kind:0,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,isIndex:!1,notFound:null}}function xi(e,t,n,r,i){return{kind:e,depth:0,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,isIndex:!1,notFound:null,caseSensitive:n,prefix:r,suffix:i}}function nte(e,t){let n=bi(`/`),r=new Uint16Array(6);for(let t of e)_i(!1,r,t,1,n,0);yi(n),t.masksTree=n,t.flatCache=hi(1e3)}function rte(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Si(e,t.masksTree);return t.flatCache.set(e,r),r}function ite(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=bi(`/`),_i(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Si(r,o,n)}function ate(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a=Si(e,t.segmentTree,n);return a&&(a.branch=lte(a.route)),t.matchCache.set(r,a),a}function ote(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function ste(e,t=!1,n){let r=bi(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return _i(t,i,e,1,r,0,e=>{if(n?.(e,s),mi(!(e.id in a),`Duplicate routes found with id: ${String(e.id)}`),a[e.id]=e,s!==0&&e.path){let t=ote(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),yi(r),{processedTree:{segmentTree:r,singleCache:hi(1e3),matchCache:hi(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function Si(e,t,n=!1){let r=e.split(`/`),i=dte(e,r,t,n);if(!i)return null;let a=cte(e,r,i),o=`**`in i;return o&&(a[`**`]=i[`**`]),{route:o?i.node.notFound??i.node.route:i.node.route,params:a}}function cte(e,t,n){let r=ute(n.node),i=null,a={};for(let o=0,s=0,c=0;s<r.length;o++,s++,c++){let l=r[s],u=t[o],d=c;if(u&&(c+=u.length),l.kind===1){i??=n.node.fullPath.split(`/`);let e=i[s],t=l.prefix?.length??0;if(e.charCodeAt(t)===123){let n=l.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=u.substring(t,u.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(u)}}else if(l.kind===3){if(n.skipped&1<<s){o--;continue}i??=n.node.fullPath.split(`/`);let e=i[s],t=l.prefix?.length??0,r=l.suffix?.length??0,c=e.substring(t+3,e.length-r-1),d=l.suffix||l.prefix?u.substring(t,u.length-r):u;d&&(a[c]=decodeURIComponent(d))}else if(l.kind===2){let t=l,n=e.substring(d+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return a}function lte(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ute(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function dte(e,t,n,r){let i=!ii(t),a=i&&e!==`/`,o=t.length-(i?1:0),s=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}],c=null,l=null,u=null;for(;s.length;){let e=s.pop(),{node:n,index:i,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=e;r&&n.notFound&&Ci(l,e)&&(l=e);let g=i===o;if(g){if(n.route&&(!a||n.isIndex)&&(Ci(u,e)&&(u=e),p===o&&n.isIndex))return u;if(!n.optional&&!n.wildcard)continue}let _=g?void 0:t[i],v;if(n.wildcard&&Ci(c,e))for(let e of n.wildcard){let{prefix:n,suffix:r}=e;if(!(n&&(g||!(e.caseSensitive?_:v??=_.toLowerCase()).startsWith(n)))){if(r){if(g)continue;let n=t.slice(i).join(`/`).slice(-r.length);if((e.caseSensitive?n:n.toLowerCase())!==r)continue}c={node:e,index:i,skipped:d,depth:f,statics:p,dynamics:m,optionals:h};break}}if(n.optional){let e=d|1<<f,t=f+1;for(let r=n.optional.length-1;r>=0;r--){let a=n.optional[r];s.push({node:a,index:i,skipped:e,depth:t,statics:p,dynamics:m,optionals:h})}if(!g)for(let e=n.optional.length-1;e>=0;e--){let r=n.optional[e],{prefix:a,suffix:o}=r;if(a||o){let e=r.caseSensitive?_:v??=_.toLowerCase();if(a&&!e.startsWith(a)||o&&!e.endsWith(o))continue}s.push({node:r,index:i+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+1})}}if(!g&&n.dynamic&&_)for(let e=n.dynamic.length-1;e>=0;e--){let t=n.dynamic[e],{prefix:r,suffix:a}=t;if(r||a){let e=t.caseSensitive?_:v??=_.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:t,index:i+1,skipped:d,depth:f+1,statics:p,dynamics:m+1,optionals:h})}if(!g&&n.staticInsensitive){let e=n.staticInsensitive.get(v??=_.toLowerCase());e&&s.push({node:e,index:i+1,skipped:d,depth:f+1,statics:p+1,dynamics:m,optionals:h})}if(!g&&n.static){let e=n.static.get(_);e&&s.push({node:e,index:i+1,skipped:d,depth:f+1,statics:p+1,dynamics:m,optionals:h})}}if(u)return u;if(c)return c;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return{node:l.node,skipped:l.skipped,"**":decodeURIComponent(r)}}return null}function Ci(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&(t.node.isIndex>e.node.isIndex||t.node.isIndex===e.node.isIndex&&t.depth>e.depth))):!0}function wi(e){return Ti(e.filter(e=>e!==void 0).join(`/`))}function Ti(e){return e.replace(/\/{2,}/g,`/`)}function Ei(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Di(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Oi(e){return Di(Ei(e))}function ki(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function fte(e,t,n){return ki(e,n)===ki(t,n)}function pte({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&ii(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(ii(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c,l=``;for(let e=0;e<s.length;e++){e>0&&(l+=`/`);let t=s[e];if(!t)continue;c=gi(t,0,c);let n=c[0];if(n===0){l+=t;continue}let r=c[5],i=t.substring(0,c[1]),a=t.substring(c[4],r),o=t.substring(c[2],c[3]);n===1?l+=i||a?`${i}{$${o}}${a}`:`$${o}`:n===2?l+=i||a?`${i}{$}${a}`:`$`:l+=`${i}{-$${o}}${a}`}l=Ti(l);let u=l||`/`;return o&&r&&r.set(o,u),u}function Ai(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?encodeURI(r):mte(r,n):r}function ji({path:e,params:t,decodeCharMap:n}){let r=!1,i={};if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:i,isMissingParams:r};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:i,isMissingParams:r};let a=e.length,o=0,s,c=``;for(;o<a;){let a=o;s=gi(e,a,s);let l=s[5];if(o=l+1,a===l)continue;let u=s[0];if(u===0){c+=`/`+e.substring(a,l);continue}if(u===2){let o=t._splat;i._splat=o,i[`*`]=o;let u=e.substring(a,s[1]),d=e.substring(s[4],l);if(!o){r=!0,(u||d)&&(c+=`/`+u+d);continue}let f=Ai(`_splat`,t,n);c+=`/`+u+f+d;continue}if(u===1){let o=e.substring(s[2],s[3]);!r&&!(o in t)&&(r=!0),i[o]=t[o];let u=e.substring(a,s[1]),d=e.substring(s[4],l),f=Ai(o,t,n)??`undefined`;c+=`/`+u+f+d;continue}if(u===3){let r=e.substring(s[2],s[3]),o=t[r];if(o==null)continue;i[r]=o;let u=e.substring(a,s[1]),d=e.substring(s[4],l),f=Ai(r,t,n)??``;c+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(c+=`/`),{usedParams:i,interpolatedPath:c||`/`,isMissingParams:r}}function mte(e,t){let n=encodeURIComponent(e);if(t)for(let[e,r]of t)n=n.replaceAll(e,r);return n}function Mi(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function Ni(e){return!!e?.isNotFound}function hte(){try{if(typeof window<`u`&&typeof window.sessionStorage==`object`)return window.sessionStorage}catch{}}var Pi=`tsr-scroll-restoration-v1_3`,gte=(e,t)=>{let n;return(...r)=>{n||=setTimeout(()=>{e(...r),n=null},t)}};function _te(){let e=hte();if(!e)return null;let t=e.getItem(Pi),n=t?JSON.parse(t):{};return{state:n,set:t=>(n=ai(t,n)||n,e.setItem(Pi,JSON.stringify(n)))}}var Fi=_te(),Ii=e=>e.state.__TSR_key||e.href;function vte(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var Li=!1;function Ri({storageKey:e,key:t,behavior:n,shouldScrollRestoration:r,scrollToTopSelectors:i,location:a}){let o;try{o=JSON.parse(sessionStorage.getItem(e)||`{}`)}catch(e){console.error(e);return}let s=t||window.history.state?.__TSR_key,c=o[s];Li=!0;scroll:{if(r&&c&&Object.keys(c).length>0){for(let e in c){let t=c[e];if(e===`window`)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){let n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}break scroll}let e=(a??window.location).hash.split(`#`,2)[1];if(e){let t=window.history.state?.__hashScrollIntoViewOptions??!0;if(t){let n=document.getElementById(e);n&&n.scrollIntoView(t)}break scroll}let t={top:0,left:0,behavior:n};if(window.scrollTo(t),i)for(let e of i){if(e===`window`)continue;let n=typeof e==`function`?e():document.querySelector(e);n&&n.scrollTo(t)}}Li=!1}function yte(e,t){if(!Fi&&!e.isServer||((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isServer||e.isScrollRestorationSetup||!Fi))return;e.isScrollRestorationSetup=!0,Li=!1;let n=e.options.getScrollRestorationKey||Ii;window.history.scrollRestoration=`manual`,typeof document<`u`&&document.addEventListener(`scroll`,gte(t=>{if(Li||!e.isScrollRestoring)return;let r=``;if(t.target===document||t.target===window)r=`window`;else{let e=t.target.getAttribute(`data-scroll-restoration-id`);r=e?`[data-scroll-restoration-id="${e}"]`:vte(t.target)}let i=n(e.state.location);Fi.set(e=>{let t=e[i]||={},n=t[r]||={};if(r===`window`)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){let e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})},100),!0),e.subscribe(`onRendered`,t=>{let r=n(t.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation})||(Ri({storageKey:Pi,key:r,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Fi.set(e=>(e[r]||={},e)))})}function bte(e){if(typeof document<`u`&&document.querySelector){let t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==``){let n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function xte(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function zi(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Ste(e){let t=new URLSearchParams(e),n={};for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=zi(r):Array.isArray(t)?t.push(zi(r)):n[e]=[t,zi(r)]}return n}var Cte=Tte(JSON.parse),wte=Ete(JSON.stringify,JSON.parse);function Tte(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Ste(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Ete(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=xte(e,r);return t?`?${t}`:``}}var Bi=`__root__`;function Dte(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Vi(e){return e instanceof Response&&!!e.options}var Hi=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Ui=(e,t)=>!!(e.preload&&!e.router.state.matches.some(e=>e.id===t)),Wi=(e,t)=>{let n=e.router.routesById[t.routeId??``]??e.router.routeTree;!n.options.notFoundComponent&&e.router.options?.defaultNotFoundComponent&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),mi(n.options.notFoundComponent,`No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.`);let r=e.matches.find(e=>e.routeId===n.id);mi(r,`Could not find match for route: `+n.id),e.updateMatch(r.id,e=>({...e,status:`notFound`,error:t,isFetching:!1})),t.routerCode===`BEFORE_LOAD`&&n.parentRoute&&(t.routeId=n.parentRoute.id,Wi(e,t))},Gi=(e,t,n)=>{if(!(!Vi(n)&&!Ni(n))){if(Vi(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;let r=Vi(n)?`redirected`:`notFound`;t._nonReactive.error=n,e.updateMatch(t.id,e=>({...e,status:r,isFetching:!1,error:n})),Ni(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()}throw Vi(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(Wi(e,n),n)}},Ki=(e,t)=>{let n=e.router.getMatch(t);return!!(!e.router.isServer&&n._nonReactive.dehydrated||e.router.isServer&&n.ssr===!1)},qi=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,Gi(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,Gi(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},Ote=(e,t,n,r)=>{let i=e.router.getMatch(t),a=e.matches[n-1]?.id,o=a?e.router.getMatch(a):void 0;if(e.router.isShell()){i.ssr=r.id===Bi;return}if(o?.ssr===!1){i.ssr=!1;return}let s=e=>e===!0&&o?.ssr===`data-only`?`data-only`:e,c=e.router.options.defaultSsr??!0;if(r.options.ssr===void 0){i.ssr=s(c);return}if(typeof r.options.ssr!=`function`){i.ssr=s(r.options.ssr);return}let{search:l,params:u}=i,d={search:$i(l,i.searchError),params:$i(u,i.paramsError),location:e.location,matches:e.matches.map(e=>({index:e.index,pathname:e.pathname,fullPath:e.fullPath,staticData:e.staticData,id:e.id,routeId:e.routeId,search:$i(e.search,e.searchError),params:$i(e.params,e.paramsError),ssr:e.ssr}))},f=r.options.ssr(d);if(ui(f))return f.then(e=>{i.ssr=s(e??c)});i.ssr=s(f??c)},Ji=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!e.router.isServer&&!Ui(e,t)&&(n.options.loader||n.options.beforeLoad||Pte(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Hi(e)},i);r._nonReactive.pendingTimeout=t}},kte=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Ji(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&Gi(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Ate=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=li(()=>{a?.resolve()});let{paramsError:o,searchError:s}=i;o&&qi(e,n,o,`PARSE_PARAMS`),s&&qi(e,n,s,`VALIDATE_SEARCH`),Ji(e,t,r,i);let c=new AbortController,l=e.matches[n-1]?.id,u={...(l?e.router.getMatch(l):void 0)?.context??e.router.options.context??void 0,...i.__routeContext},d=!1,f=()=>{d||(d=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c,context:u})))},p=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){Xr(()=>{f(),p()});return}i._nonReactive.beforeLoadPromise=li();let{search:m,params:h,cause:g}=i,_=Ui(e,t),v={search:m,abortController:c,params:h,preload:_,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:_?`preload`:g,matches:e.matches,...e.router.options.additionalContext},y=r=>{if(r===void 0){Xr(()=>{f(),p()});return}(Vi(r)||Ni(r))&&(f(),qi(e,n,r,`BEFORE_LOAD`)),Xr(()=>{f(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r,context:{...e.context,...r}})),p()})},b;try{if(b=r.options.beforeLoad(v),ui(b))return f(),b.catch(t=>{qi(e,n,t,`BEFORE_LOAD`)}).then(y)}catch(t){f(),qi(e,n,t,`BEFORE_LOAD`)}y(b)},jte=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>{if(e.router.isServer){let r=Ote(e,n,t,i);if(ui(r))return r.then(s)}return s()},o=()=>Ate(e,n,t,i),s=()=>{if(Ki(e,n))return;let t=kte(e,n,i);return ui(t)?t.then(o):o()};return a()},Yi=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Xi=(e,t,n,r)=>{let i=e.matchPromises[n-1],{params:a,loaderDeps:o,abortController:s,cause:c}=e.router.getMatch(t),l=e.router.options.context??{};for(let t=0;t<=n;t++){let n=e.matches[t];if(!n)continue;let r=e.router.getMatch(n.id);r&&(l={...l,...r.__routeContext??{},...r.__beforeLoadContext??{}})}let u=Ui(e,t);return{params:a,deps:o,preload:!!u,parentMatchPromise:i,abortController:s,context:l,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:u?`preload`:c,route:r,...e.router.options.additionalContext}},Zi=async(e,t,n,r)=>{try{let i=e.router.getMatch(t);try{(!e.router.isServer||i.ssr===!0)&&Nte(r);let a=r.options.loader?.(Xi(e,t,n,r)),o=r.options.loader&&ui(a);if((o||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||i._nonReactive.minPendingPromise)&&e.updateMatch(t,e=>({...e,isFetching:`loader`})),r.options.loader){let n=o?await a:a;Gi(e,e.router.getMatch(t),n),n!==void 0&&e.updateMatch(t,e=>({...e,loaderData:n}))}r._lazyPromise&&await r._lazyPromise;let s=Yi(e,t,r),c=s?await s:void 0,l=i._nonReactive.minPendingPromise;l&&await l,r._componentsPromise&&await r._componentsPromise,e.updateMatch(t,e=>({...e,error:void 0,status:`success`,isFetching:!1,updatedAt:Date.now(),...c}))}catch(n){let a=n,o=i._nonReactive.minPendingPromise;o&&await o,Ni(n)&&await r.options.notFoundComponent?.preload?.(),Gi(e,e.router.getMatch(t),n);try{r.options.onError?.(n)}catch(n){a=n,Gi(e,e.router.getMatch(t),n)}let s=Yi(e,t,r),c=s?await s:void 0;e.updateMatch(t,e=>({...e,error:a,status:`error`,isFetching:!1,...c}))}}catch(n){let i=e.router.getMatch(t);if(i){let n=Yi(e,t,r);if(n){let r=await n;e.updateMatch(t,e=>({...e,...r}))}i._nonReactive.loaderPromise=void 0}Gi(e,i,n)}},Mte=async(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=!1,a=!1,o=e.router.looseRoutesById[r];if(Ki(e,n)){if(e.router.isServer){let t=Yi(e,n,o);if(t){let r=await t;e.updateMatch(n,e=>({...e,...r}))}return e.router.getMatch(n)}}else{let r=e.router.getMatch(n);if(r._nonReactive.loaderPromise){if(r.status===`success`&&!e.sync&&!r.preload)return r;await r._nonReactive.loaderPromise;let t=e.router.getMatch(n),i=t._nonReactive.error||t.error;i&&Gi(e,t,i)}else{let s=Date.now()-r.updatedAt,c=Ui(e,n),l=c?o.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:o.options.staleTime??e.router.options.defaultStaleTime??0,u=o.options.shouldReload,d=typeof u==`function`?u(Xi(e,n,t,o)):u,f=!!c&&!e.router.state.matches.some(e=>e.id===n),p=e.router.getMatch(n);p._nonReactive.loaderPromise=li(),f!==p.preload&&e.updateMatch(n,e=>({...e,preload:f}));let{status:m,invalid:h}=p;if(i=m===`success`&&(h||(d??s>l)),!(c&&o.options.preload===!1))if(i&&!e.sync)a=!0,(async()=>{try{await Zi(e,n,t,o);let r=e.router.getMatch(n);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0}catch(t){Vi(t)&&await e.router.navigate(t.options)}})();else if(m!==`success`||i&&e.sync)await Zi(e,n,t,o);else{let t=Yi(e,n,o);if(t){let r=await t;e.updateMatch(n,e=>({...e,...r}))}}}}let s=e.router.getMatch(n);a||(s._nonReactive.loaderPromise?.resolve(),s._nonReactive.loadPromise?.resolve()),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0,a||(s._nonReactive.loaderPromise=void 0),s._nonReactive.dehydrated=void 0;let c=a?s.isFetching:!1;return c!==s.isFetching||s.invalid!==!1?(e.updateMatch(n,e=>({...e,isFetching:c,invalid:!1})),e.router.getMatch(n)):s};async function Qi(e){let t=Object.assign(e,{matchPromises:[]});!t.router.isServer&&t.router.state.matches.some(e=>e._forcePending)&&Hi(t);try{for(let e=0;e<t.matches.length;e++){let n=jte(t,e);ui(n)&&await n}let e=t.firstBadMatchIndex??t.matches.length;for(let n=0;n<e;n++)t.matchPromises.push(Mte(t,n));await Promise.all(t.matchPromises);let n=Hi(t);ui(n)&&await n}catch(e){if(Ni(e)&&!t.preload){let n=Hi(t);throw ui(n)&&await n,e}if(Vi(e))throw e}return t.matches}async function Nte(e){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){let t=()=>{let t=[];for(let n of Fte){let r=e.options[n]?.preload;r&&t.push(r())}if(t.length)return Promise.all(t).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise}function $i(e,t){return t?{status:`error`,error:t}:{status:`success`,value:e}}function Pte(e){for(let t of Fte)if(e.options[t]?.preload)return!0;return!1}var Fte=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Ite(e){return{input:({url:t})=>{for(let n of e)t=Rte(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=zte(e[n],t);return t}}}function Lte(e){let t=Oi(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=wi([`/`,t,e.pathname]),e)}}function Rte(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function zte(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ea(e){let t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}var Bte=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn(`The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.`);let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(e=>[encodeURIComponent(e),e])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=Kee())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new Gee(Hte(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(e=>![`redirected`].includes(e.status))}}}),yte(this));let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[];Oi(o)!==``&&e.push(Lte({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ite(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let{routesById:e,routesByPath:t,processedTree:n}=ste(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});this.options.routeMasks&&nte(this.options.routeMasks,n),this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({href:e,state:n})=>{let r=new URL(e,this.origin),i=Rte(this.rewrite,r),a=this.options.parseSearch(i.search),o=this.options.stringifySearch(a);i.search=o;let s=i.href.replace(i.origin,``),{pathname:c,hash:l}=i;return{href:s,publicHref:e,url:i.href,pathname:fi(c),searchStr:o,search:oi(t?.search,a),hash:l.split(`#`).reverse()[0]??``,state:oi(t?.state,n)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathCache=hi(1e3),this.resolvePathWithBase=(e,t)=>pte({base:e,to:Ti(t),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ute({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{let e=this.state.matches.filter(e=>e.status===`pending`),t=this.state.matches.filter(e=>e.isFetching===`loader`);new Set([...this.state.pendingMatches??[],...e,...t]).forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=ii(this.matchRoutes(n,{_buildLocation:!0}));t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=this.resolvePathWithBase(i,`.`),o=r.search,s={...r.params},c=t.to?this.resolvePathWithBase(a,`${t.to}`):this.resolvePathWithBase(a,`.`),l=t.params===!1||t.params===null?{}:(t.params??!0)===!0?s:Object.assign(s,ai(t.params,s)),u=ji({path:c,params:l}).interpolatedPath,d=this.matchRoutes(u,void 0,{_buildLocation:!0}).map(e=>this.looseRoutesById[e.routeId]);if(Object.keys(l).length>0)for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;t&&Object.assign(l,t(l))}let f=e.leaveParams?c:fi(ji({path:c,params:l,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath),p=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,na(t.options.validateSearch,{...e,...p}))}catch{}}),p=e}p=Wte({search:p,dest:t,destRoutes:d,_includeValidateSearch:e._includeValidateSearch}),p=oi(o,p);let m=this.options.stringifySearch(p),h=t.hash===!0?n.hash:t.hash?ai(t.hash,n.hash):void 0,g=h?`#${h}`:``,_=t.state===!0?n.state:t.state?ai(t.state,n.state):{};_=oi(n.state,_);let v=`${f}${m}${g}`,y=new URL(v,this.origin),b=zte(this.rewrite,y);return{publicHref:b.pathname+b.search+b.hash,href:v,url:b.href,pathname:f,search:p,searchStr:m,state:_,hash:h??``,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n={};if(this.options.routeMasks){let o=rte(i.pathname,this.processedTree);if(o){Object.assign(n,o.params);let{from:i,...s}=o.route;r={from:e.from,...s,params:n},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=ci(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=Di(this.latestLocation.href)===Di(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=li(()=>{a?.resolve()}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=ni(a,{__TSR_index:e?t:t+1});o.to=n.pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,...r})=>{if(!t&&n)try{new URL(`${n}`),t=!0}catch{}if(t){if(n||=this.buildLocation({to:e,...r}).url,!r.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return r.replace?window.location.replace(n):window.location.href=n,Promise.resolve()}return this.buildAndCommitLocation({...r,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){let e=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0}),t=e=>{try{return encodeURI(decodeURI(e))}catch{return e}};if(Oi(t(this.latestLocation.href))!==Oi(t(e.href))){let t=e.url;throw this.origin&&t.startsWith(this.origin)&&(t=t.replace(this.origin,``)||`/`),Dte({href:t})}}let e=this.matchRoutes(this.latestLocation);this.__store.setState(t=>({...t,status:`pending`,statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:e,cachedMatches:t.cachedMatches.filter(t=>!e.some(e=>e.id===t.id))}))},this.load=async e=>{let t,n,r;for(r=new Promise(i=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=this.state.resolvedLocation;this.state.redirect||this.emit({type:`onBeforeNavigate`,...ea({resolvedLocation:n,location:t})}),this.emit({type:`onBeforeLoad`,...ea({resolvedLocation:n,location:t})}),await Qi({router:this,sync:e?.sync,matches:this.state.pendingMatches,location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=[],t=[],n=[];Xr(()=>{this.__store.setState(r=>{let i=r.matches,a=r.pendingMatches||r.matches;return e=i.filter(e=>!a.some(t=>t.id===e.id)),t=a.filter(e=>!i.some(t=>t.id===e.id)),n=a.filter(e=>i.some(t=>t.id===e.id)),{...r,isLoading:!1,loadedAt:Date.now(),matches:a,pendingMatches:void 0,cachedMatches:[...r.cachedMatches,...e.filter(e=>e.status!==`error`&&e.status!==`notFound`)]}}),this.clearExpiredCache()}),[[e,`onLeave`],[t,`onEnter`],[n,`onStay`]].forEach(([e,t])=>{e.forEach(e=>{this.looseRoutesById[e.routeId].options[t]?.(e)})})})})}})}catch(e){Vi(e)?(t=e,this.isServer||this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):Ni(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.status:n?404:e.matches.some(e=>e.status===`error`)?500:200,redirect:t}))}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let i;this.hasNotFoundMatch()?i=404:this.__store.state.matches.some(e=>e.status===`error`)&&(i=500),i!==void 0&&this.__store.setState(e=>({...e,statusCode:i}))},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.state.resolvedLocation,a=typeof t.types==`function`?t.types(ea({resolvedLocation:i,location:r})):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.state.pendingMatches?.some(t=>t.id===e)?`pendingMatches`:this.state.matches.some(t=>t.id===e)?`matches`:this.state.cachedMatches.some(t=>t.id===e)?`cachedMatches`:``;n&&this.__store.setState(r=>({...r,[n]:r[n]?.map(n=>n.id===e?t(n):n)}))})},this.getMatch=e=>{let t=t=>t.id===e;return this.state.cachedMatches.find(t)??this.state.pendingMatches?.find(t)??this.state.matches.find(t)},this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(t),cachedMatches:e.cachedMatches.map(t),pendingMatches:e.pendingMatches?.map(t)})),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{if(!e.options.href){let t=this.buildLocation(e.options),n=t.url;this.origin&&n.startsWith(this.origin)&&(n=n.replace(this.origin,``)||`/`),e.options.href=t.href,e.headers.set(`Location`,n)}return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.__store.setState(e=>({...e,cachedMatches:[]})):this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))}))},this.clearExpiredCache=()=>{this.clearCache({filter:e=>{let t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;let n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??300*1e3;return e.status===`error`?!0:Date.now()-e.updatedAt>=n}})},this.loadRouteChunk=Nte,this.preloadRoute=async e=>{let t=this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);Xr(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await Qi({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Vi(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Ni(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.state.status!==`pending`)return!1;let i=(t?.pending===void 0?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=ite(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!ci(a.params,e.params,{partial:!0})?!1:t?.includeSearch??!0?ci(i.search,r.search,{partial:!0})?a.params:!1:a.params},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status===`notFound`||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??wte,parseSearch:e.parseSearch??Cte}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:Di(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=(()=>{if(o){if(this.options.notFoundMode!==`root`)for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.children)return t.id}return Bi}})(),c=[],l=e=>e?.id?e.context??this.options.context??void 0:this.options.context??void 0;return a.forEach((n,r)=>{let a=c[r-1],[o,u,d]=(()=>{let r=a?.search??e.search,i=a?._strictSearch??void 0;try{let e=na(n.options.validateSearch,{...r})??void 0;return[{...r,...e},{...i,...e},void 0]}catch(e){let n=e;if(e instanceof ta||(n=new ta(e.message,{cause:e})),t?.throwOnError)throw n;return[r,{},n]}})(),f=n.options.loaderDeps?.({search:o})??``,p=f?JSON.stringify(f):``,{interpolatedPath:m,usedParams:h}=ji({path:n.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),g=n.id+m+p,_=this.getMatch(g),v=this.state.matches.find(e=>e.routeId===n.id),y=_?._strictParams??h,b;if(!_){let e=n.options.params?.parse??n.options.parseParams;if(e)try{Object.assign(y,e(y))}catch(e){if(b=Ni(e)||Vi(e)?e:new Vte(e.message,{cause:e}),t?.throwOnError)throw b}}Object.assign(i,y);let x=v?`stay`:`enter`,S;if(_)S={..._,cause:x,params:v?oi(v.params,i):i,_strictParams:y,search:oi(v?v.search:_.search,o),_strictSearch:u};else{let e=n.options.loader||n.options.beforeLoad||n.lazyFn||Pte(n)?`pending`:`success`;S={id:g,index:r,routeId:n.id,params:v?oi(v.params,i):i,_strictParams:y,pathname:m,updatedAt:Date.now(),search:v?oi(v.search,o):o,_strictSearch:u,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:b,__routeContext:void 0,_nonReactive:{loadPromise:li()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:x,loaderDeps:v?oi(v.loaderDeps,f):f,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:n.options.staticData||{},fullPath:n.fullPath}}t?.preload||(S.globalNotFound=s===n.id),S.searchError=d;let C=l(a);S.context={...C,...S.__routeContext,...S.__beforeLoadContext},c.push(S)}),c.forEach((n,r)=>{let i=this.looseRoutesById[n.routeId];if(!this.getMatch(n.id)&&t?._buildLocation!==!0){let t=c[r-1],a=l(t);if(i.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c};n.__routeContext=i.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}),c}},ta=class extends Error{},Vte=class extends Error{};function Hte(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function na(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new ta(`Async validation not supported`);if(n.issues)throw new ta(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Ute({pathname:e,routesById:t,processedTree:n}){let r={},i=Di(e),a,o=ate(i,n,!0);return o&&(a=o.route,Object.assign(r,o.params)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Wte({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){let i=n.reduce((e,t)=>{let n=[];return`search`in t.options?t.options.search?.middlewares&&n.push(...t.options.search.middlewares):(t.options.preSearchFilters||t.options.postSearchFilters)&&n.push(({search:e,next:n})=>{let r=e;`preSearchFilters`in t.options&&t.options.preSearchFilters&&(r=t.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=n(r);return`postSearchFilters`in t.options&&t.options.postSearchFilters?t.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),r&&t.options.validateSearch&&n.push(({search:e,next:n})=>{let r=n(e);try{return{...r,...na(t.options.validateSearch,r)??void 0}}catch{return r}}),e.concat(n)},[])??[];i.push(({search:e})=>t.search?t.search===!0?e:ai(t.search,e):{});let a=(e,t)=>{if(e>=i.length)return t;let n=i[e];return n({search:t,next:t=>a(e+1,t)})};return a(0,e)}var Gte=`Error preloading route! ☝️`,ra=class{constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Bi:this.parentRoute||mi(!1,`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let r=n?Bi:t?.path;r&&r!==`/`&&(r=Ei(r));let i=t?.id||r,a=n?Bi:wi([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=wi([`/`,a]));let o=a===`__root__`?`/`:wi([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=o},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}},Kte=class{constructor({id:e}){this.notFound=e=>Mi({routeId:this.id,...e}),this.id=e}},qte=class extends ra{constructor(e){super(e)}};function ia(e){let t=e.errorComponent??aa;return(0,K.jsx)(Jte,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?G.createElement(t,{error:n,reset:r}):e.children})}var Jte=class extends G.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function aa({error:e}){let[t,n]=G.useState(!1);return(0,K.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,K.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,K.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,K.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,K.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,K.jsx)(`div`,{children:(0,K.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,K.jsx)(`code`,{children:e.message}):null})}):null]})}function Yte({children:e,fallback:t=null}){return Xte()?(0,K.jsx)(G.Fragment,{children:e}):(0,K.jsx)(G.Fragment,{children:t})}function Xte(){return G.useSyncExternalStore(Zte,()=>!0,()=>!1)}function Zte(){return()=>{}}var Qte=!0;function oa(e,t){if(!Qte){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}var $te=i((e=>{var t=s();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),sa=i(((e,t)=>{t.exports=$te()})),ene=i((e=>{var t=s(),n=sa();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),ca=i(((e,t)=>{t.exports=ene()}))();function tne(e,t=e=>e,n={}){let r=n.equal??nne;return(0,ca.useSyncExternalStoreWithSelector)(e.subscribe,()=>e.state,()=>e.state,t,r)}function nne(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=la(e);if(n.length!==la(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function la(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var ua=G.createContext(null);function da(){return typeof document>`u`?ua:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=ua,ua)}function fa(e){let t=G.useContext(da());return oa(!((e?.warn??!0)&&!t),`useRouter must be used inside a <RouterProvider> component!`),t}function pa(e){let t=fa({warn:e?.router===void 0}),n=e?.router||t,r=(0,G.useRef)(void 0);return tne(n.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=oi(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var ma=G.createContext(void 0),rne=G.createContext(void 0);function ha(e){let t=G.useContext(e.from?rne:ma);return pa({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(mi(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function ga(e){return ha({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function _a(e){let{select:t,...n}=e;return ha({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function va(e){return ha({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ya(e){return ha({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}var ba=typeof window<`u`?G.useLayoutEffect:G.useEffect;function xa(e){let t=G.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function ine(e,t,n={},r={}){G.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ane(e){let t=G.useRef(null);return G.useImperativeHandle(e,()=>t.current,[]),t}function Sa(e){let t=fa();return G.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var Ca=e(a(),1);function one(e,t){let n=fa(),[r,i]=G.useState(!1),a=G.useRef(!1),o=ane(t),{activeProps:s,inactiveProps:c,activeOptions:l,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onFocus:w,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:O,params:k,search:A,hash:j,state:M,mask:N,reloadDocument:P,unsafeRelative:F,from:ee,_fromLocation:I,...L}=e,R=pa({select:e=>e.location.search,structuralSharing:!0}),z=e.from,te=G.useMemo(()=>({...e,from:z}),[n,R,z,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),B=G.useMemo(()=>n.buildLocation({...te}),[n,te]),V=G.useMemo(()=>{if(b)return;let e=B.maskedLocation?B.maskedLocation.url:B.url,t=!1;return n.origin&&(e.startsWith(n.origin)?e=n.history.createHref(e.replace(n.origin,``))||`/`:t=!0),{href:e,external:t}},[b,B.maskedLocation,B.url,n.origin,n.history]),ne=G.useMemo(()=>{if(V?.external)return V.href;try{return new URL(u),u}catch{}},[u,V]),re=e.reloadDocument||ne?!1:d??n.options.defaultPreload,ie=f??n.options.defaultPreloadDelay??0,ae=pa({select:e=>{if(ne)return!1;if(l?.exact){if(!fte(e.location.pathname,B.pathname,n.basepath))return!1}else{let t=ki(e.location.pathname,n.basepath),r=ki(B.pathname,n.basepath);if(!(t.startsWith(r)&&(t.length===r.length||t[r.length]===`/`)))return!1}return(l?.includeSearch??!0)&&!ci(e.location.search,B.search,{partial:!l?.exact,ignoreUndefined:!l?.explicitUndefined})?!1:l?.includeHash?e.location.hash===B.hash:!0}}),oe=G.useCallback(()=>{n.preloadRoute({...te}).catch(e=>{console.warn(e),console.warn(Gte)})},[n,te]);ine(o,G.useCallback(e=>{e?.isIntersecting&&oe()},[oe]),dne,{disabled:!!b||re!==`viewport`}),G.useEffect(()=>{a.current||!b&&re===`render`&&(oe(),a.current=!0)},[b,oe,re]);let se=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!fne(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ca.flushSync)(()=>{i(!0)});let t=n.subscribe(`onResolved`,()=>{t(),i(!1)});n.navigate({...te,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:O})}};if(ne)return{...L,ref:o,href:ne,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let ce=e=>{b||re&&oe()},le=ce,ue=e=>{if(!(b||!re))if(!ie)oe();else{let t=e.target;if(Ta.has(t))return;let n=setTimeout(()=>{Ta.delete(t),oe()},ie);Ta.set(t,n)}},H=e=>{if(b||!re||!ie)return;let t=e.target,n=Ta.get(t);n&&(clearTimeout(n),Ta.delete(t))},de=ae?ai(s,{})??sne:wa,fe=ae?wa:ai(c,{})??wa,pe=[S,de.className,fe.className].filter(Boolean).join(` `),me=(x||de.style||fe.style)&&{...x,...de.style,...fe.style};return{...L,...de,...fe,href:V?.href,ref:o,onClick:Ea([C,se]),onFocus:Ea([w,ce]),onMouseEnter:Ea([T,ue]),onMouseLeave:Ea([E,H]),onTouchStart:Ea([D,le]),disabled:!!b,target:y,...me&&{style:me},...pe&&{className:pe},...b&&cne,...ae&&lne,...r&&une}}var wa={},sne={className:`active`},cne={role:`link`,"aria-disabled":!0},lne={"data-status":`active`,"aria-current":`page`},une={"data-transitioning":`transitioning`},Ta=new WeakMap,dne={rootMargin:`100px`},Ea=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}},Da=G.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,ref:a,...o}=one(r,t),s=typeof r.children==`function`?r.children({isActive:o[`data-status`]===`active`}):r.children;return n===void 0&&delete o.disabled,G.createElement(n||`a`,{...o,ref:a},s)});function fne(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pne(e){return new mne({id:e})}var mne=class extends Kte{constructor({id:e}){super({id:e}),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id,strict:!1}),this.useLoaderData=e=>ga({...e,from:this.id,strict:!1}),this.useNavigate=()=>Sa({from:fa().routesById[this.id].fullPath}),this.notFound=e=>Mi({routeId:this.id,...e}),this.Link=G.forwardRef((e,t)=>{let n=fa().routesById[this.id].fullPath;return(0,K.jsx)(Da,{ref:t,from:n,...e})})}},hne=class extends ra{constructor(e){super(e),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id}),this.useLoaderData=e=>ga({...e,from:this.id}),this.useNavigate=()=>Sa({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Da,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function Oa(e){return new hne(e)}var gne=class extends qte{constructor(e){super(e),this.useMatch=e=>ha({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>_a({...e,from:this.id}),this.useLoaderData=e=>ga({...e,from:this.id}),this.useNavigate=()=>Sa({from:this.fullPath}),this.Link=G.forwardRef((e,t)=>(0,K.jsx)(Da,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function ka(e){return new gne(e)}function Aa(e){return typeof e==`object`?new ja(e,{silent:!0}).createRoute(e):new ja(e,{silent:!0}).createRoute}var ja=class{constructor(e,t){this.path=e,this.createRoute=e=>{oa(this.silent,`FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.`);let t=Oa(e);return t.isRoot=!1,t},this.silent=t?.silent}},Ma=class{constructor(e){this.useMatch=e=>ha({select:e?.select,from:this.options.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>ha({from:this.options.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>ya({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useParams=e=>va({select:e?.select,structuralSharing:e?.structuralSharing,from:this.options.id}),this.useLoaderDeps=e=>_a({...e,from:this.options.id}),this.useLoaderData=e=>ga({...e,from:this.options.id}),this.useNavigate=()=>Sa({from:fa().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for(`react.memo`)}};function Na(e){return typeof e==`object`?new Ma(e):t=>new Ma({id:e,...t})}function _ne(){let e=fa(),t=G.useRef({router:e,mounted:!1}),[n,r]=G.useState(!1),{hasPendingMatches:i,isLoading:a}=pa({select:e=>({isLoading:e.isLoading,hasPendingMatches:e.matches.some(e=>e.status===`pending`)}),structuralSharing:!0}),o=xa(a),s=a||n||i,c=xa(s),l=a||i,u=xa(l);return e.startTransition=e=>{r(!0),G.startTransition(()=>{e(),r(!1)})},G.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Di(e.latestLocation.href)!==Di(n.href)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ba(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),ba(()=>{o&&!a&&e.emit({type:`onLoad`,...ea(e.state)})},[o,e,a]),ba(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...ea(e.state)})},[l,u,e]),ba(()=>{if(c&&!s){let t=ea(e.state);e.emit({type:`onResolved`,...t}),e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})),t.hrefChanged&&bte(e)}},[s,c,e]),null}function vne(e){let t=pa({select:e=>`not-found-${e.location.pathname}-${e.status}`});return(0,K.jsx)(ia,{getResetKey:()=>t,onCatch:(t,n)=>{if(Ni(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Ni(t))return e.fallback?.(t);throw t},children:e.children})}function yne(){return(0,K.jsx)(`p`,{children:`Not Found`})}function Pa(e){return(0,K.jsx)(K.Fragment,{children:e.children})}function Fa(e,t,n){return t.options.notFoundComponent?(0,K.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,K.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,K.jsx)(yne,{})}function bne({children:e}){let t=fa();return t.isServer?(0,K.jsx)(`script`,{nonce:t.options.ssr?.nonce,className:`$tsr`,dangerouslySetInnerHTML:{__html:e+`;typeof $_TSR !== "undefined" && $_TSR.c()`}}):null}function xne(){let e=fa();if(!e.isScrollRestoring||!e.isServer||typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return null;let t=(e.options.getScrollRestorationKey||Ii)(e.latestLocation),n=t===Ii(e.latestLocation)?void 0:t,r={storageKey:Pi,shouldScrollRestoration:!0};return n&&(r.key=n),(0,K.jsx)(bne,{children:`(${Ri.toString()})(${JSON.stringify(r)})`})}var Ia=G.memo(function({matchId:e}){let t=fa(),n=pa({select:t=>{let n=t.matches.find(t=>t.id===e);return mi(n,`Could not find match for matchId "${e}". Please file an issue!`),{routeId:n.routeId,ssr:n.ssr,_displayPending:n._displayPending}},structuralSharing:!0}),r=t.routesById[n.routeId],i=r.options.pendingComponent??t.options.defaultPendingComponent,a=i?(0,K.jsx)(i,{}):null,o=r.options.errorComponent??t.options.defaultErrorComponent,s=r.options.onCatch??t.options.defaultOnCatch,c=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=n.ssr===!1||n.ssr===`data-only`,u=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||l))?G.Suspense:Pa,d=o?ia:Pa,f=c?vne:Pa,p=pa({select:e=>e.loadedAt}),m=pa({select:t=>{let n=t.matches.findIndex(t=>t.id===e);return t.matches[n-1]?.routeId}});return(0,K.jsxs)(r.isRoot?r.options.shellComponent??Pa:Pa,{children:[(0,K.jsx)(ma.Provider,{value:e,children:(0,K.jsx)(u,{fallback:a,children:(0,K.jsx)(d,{getResetKey:()=>p,errorComponent:o||aa,onCatch:(t,n)=>{if(Ni(t))throw t;oa(!1,`Error in route match: ${e}`),s?.(t,n)},children:(0,K.jsx)(f,{fallback:e=>{if(!c||e.routeId&&e.routeId!==n.routeId||!e.routeId&&!r.isRoot)throw e;return G.createElement(c,e)},children:l||n._displayPending?(0,K.jsx)(Yte,{fallback:a,children:(0,K.jsx)(La,{matchId:e})}):(0,K.jsx)(La,{matchId:e})})})})}),m===`__root__`&&t.options.scrollRestoration?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Sne,{}),(0,K.jsx)(xne,{})]}):null]})});function Sne(){let e=fa(),t=G.useRef(void 0);return(0,K.jsx)(`script`,{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:`onRendered`,...ea(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var La=G.memo(function({matchId:e}){let t=fa(),{match:n,key:r,routeId:i}=pa({select:n=>{let r=n.matches.find(t=>t.id===e),i=r.routeId,a=(t.routesById[i].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:i,loaderDeps:r.loaderDeps,params:r._strictParams,search:r._strictSearch});return{key:a?JSON.stringify(a):void 0,routeId:i,match:{id:r.id,status:r.status,error:r.error,_forcePending:r._forcePending,_displayPending:r._displayPending}}},structuralSharing:!0}),a=t.routesById[i],o=G.useMemo(()=>{let e=a.options.component??t.options.defaultComponent;return e?(0,K.jsx)(e,{},r):(0,K.jsx)(Ra,{})},[r,a.options.component,t.options.defaultComponent]);if(n._displayPending)throw t.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw t.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status===`pending`){let e=a.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let r=t.getMatch(n.id);if(r&&!r._nonReactive.minPendingPromise&&!t.isServer){let t=li();r._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),r._nonReactive.minPendingPromise=void 0},e)}}throw t.getMatch(n.id)?._nonReactive.loadPromise}if(n.status===`notFound`)return mi(Ni(n.error),`Expected a notFound error`),Fa(t,a,n.error);if(n.status===`redirected`)throw mi(Vi(n.error),`Expected a redirect error`),t.getMatch(n.id)?._nonReactive.loadPromise;if(n.status===`error`){if(t.isServer)return(0,K.jsx)((a.options.errorComponent??t.options.defaultErrorComponent)||aa,{error:n.error,reset:void 0,info:{componentStack:``}});throw n.error}return o}),Ra=G.memo(function(){let e=fa(),t=G.useContext(ma),n=pa({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=pa({select:e=>{let n=e.matches.find(e=>e.id===t);return mi(n,`Could not find parent match for matchId "${t}"`),n.globalNotFound}}),a=pa({select:e=>{let n=e.matches;return n[n.findIndex(e=>e.id===t)+1]?.id}}),o=e.options.defaultPendingComponent?(0,K.jsx)(e.options.defaultPendingComponent,{}):null;if(i)return Fa(e,r,void 0);if(!a)return null;let s=(0,K.jsx)(Ia,{matchId:a});return n===`__root__`?(0,K.jsx)(G.Suspense,{fallback:o,children:s}):s});function Cne(){let e=fa(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,K.jsx)(t,{}):null,r=(0,K.jsxs)(e.isServer||typeof document<`u`&&e.ssr?Pa:G.Suspense,{fallback:n,children:[!e.isServer&&(0,K.jsx)(_ne,{}),(0,K.jsx)(wne,{})]});return e.options.InnerWrap?(0,K.jsx)(e.options.InnerWrap,{children:r}):r}function wne(){let e=fa(),t=pa({select:e=>e.matches[0]?.id}),n=pa({select:e=>e.loadedAt}),r=t?(0,K.jsx)(Ia,{matchId:t}):null;return(0,K.jsx)(ma.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,K.jsx)(ia,{getResetKey:()=>n,errorComponent:aa,onCatch:e=>{oa(!1,`The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`),oa(!1,e.message||e.toString())},children:r})})}var za=e=>new Tne(e),Tne=class extends Bte{constructor(e){super(e)}};typeof globalThis<`u`?(globalThis.createFileRoute=Aa,globalThis.createLazyFileRoute=Na):typeof window<`u`&&(window.createFileRoute=Aa,window.createLazyFileRoute=Na);function Ene({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,K.jsx)(da().Provider,{value:e,children:t});return e.options.Wrap?(0,K.jsx)(e.options.Wrap,{children:r}):r}function Ba({router:e,...t}){return(0,K.jsx)(Ene,{router:e,...t,children:(0,K.jsx)(Cne,{})})}function Va(e){return pa({select:t=>e?.select?e.select(t.location):t.location})}var Ha=e(o(),1);function Dne(e){let t=e.trim();if(!t)return null;let n;try{n=new URL(t)}catch{return null}n.hash=``,n.search=``;let r=n.pathname.replace(/\/+$/,``);return n.pathname=r.length>0?r:`/`,n.toString().replace(/\/$/,(n.pathname,``))}function Ua(e,t){return new URLSearchParams(e).get(t)?.trim()||null}function Wa(e){let t=Ua(e.search,`session`);return{hosted:t!==null,apiBaseUrl:Dne(Ua(e.search,`api`)??``),sessionId:t}}function Ga(e,t){let n=Wa(t);return n.hosted&&n.sessionId?`hosted-session:${n.sessionId}:${e}`:e}var Ka=null;typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0&&(Ka=!0,console.log(`[static-mode] Detected static export mode (via flag)`));async function One(){return Ka===null&&(Ka=typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0),Ka}function qa(){return Ka===!0}function kne(e){Ka=e}var Ja=null;function Ya(){return Ja===null?typeof window<`u`&&window.__OPENSPEC_BASE_PATH__||`./`:Ja}function Ane(){return typeof window<`u`&&window.__INITIAL_DATA__?window.__INITIAL_DATA__:null}function jne(e){let t=new MutationObserver(t=>{for(let n of t)n.attributeName===`class`&&e()});return t.observe(document.documentElement,{attributes:!0}),()=>t.disconnect()}function Mne(){return document.documentElement.classList.contains(`dark`)}function Nne(){return!1}function Xa(){return(0,G.useSyncExternalStore)(jne,Mne,Nne)}function Za(){return typeof window<`u`&&window.location!==void 0}function Qa(){return Za()?Wa(window.location):{hosted:!1,apiBaseUrl:null,sessionId:null}}function $a(){return Za()?Qa().apiBaseUrl??``:``}function eo(e){if(!Za())return``;let t=$a();if(t){let n=new URL(t);return`${n.protocol===`https:`?`wss:`:`ws:`}//${n.host}${e}`}return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${e}`}function Pne(){return eo(`/trpc`)}function Fne(){return eo(`/ws/pty`)}function to(){let e=$a();return e?`${e}/trpc`:`/trpc`}function Ine(){let e=$a();return e?`${e}/api/health`:`/api/health`}var no=[`/dashboard`,`/config`,`/git`,`/specs`,`/changes`,`/archive`,`/settings`,`/terminal`],Lne=[`/dashboard`,`/config`,`/specs`,`/changes`,`/archive`,`/settings`],ro=qa()?[]:[`/git`,`/terminal`],Rne=[`/search`,`/notifications`,`/opsx-new`,`/opsx-propose`,`/opsx-verify`,`/opsx-compose`];function io(){return Ga(`nav-layout`,window.location)}function zne(e){return Ga(`nav-layout:${encodeURIComponent(e)}`,window.location)}var Bne=300;function Vne(e){return no.includes(e)}function ao(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&Vne(e)):[]}function oo(e){if(typeof e!=`object`||!e)return null;let t=e;return!Array.isArray(t.mainTabs)||!Array.isArray(t.bottomTabs)?null:{mainTabs:ao(t.mainTabs),bottomTabs:ao(t.bottomTabs),updatedAt:typeof t.updatedAt==`number`?t.updatedAt:0}}function Hne(e,t){if(typeof e!=`object`||!e)return{__TSR_index:0,key:t,__TSR_key:t};let n=e,r=typeof n.key==`string`?n.key:t,i=typeof n.__TSR_key==`string`?n.__TSR_key:r,a=typeof n.__TSR_index==`number`?n.__TSR_index:0;return{...n,key:r,__TSR_key:i,__TSR_index:a}}function so(e,t){let n=new URL(e,`http://nav.local`),r=`${n.pathname}${n.search}${n.hash}`,i=Math.random().toString(36).slice(2);return{href:r,pathname:n.pathname||`/`,search:n.search,hash:n.hash,state:Hne(t,i)}}function co(e){let t=e.trim();if(!t||t===`./`||t===`.`)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return(n.endsWith(`/`)?n:`${n}/`).replace(/\/+/g,`/`)}function lo(e,t){return t===`/`?e||`/`:e===t.slice(0,-1)?`/`:e.startsWith(t)?e.slice(t.length-1)||`/`:e||`/`}function Une(e,t){if(t===`/`)return e||`/`;let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`?t.slice(0,-1)||`/`:`${t.slice(0,-1)}${n}`}function uo(e){if(typeof window>`u`)return e;let t=new URL(e,window.location.origin),n=co(Ya());return t.pathname=lo(t.pathname,n),`${t.pathname}${t.search}${t.hash}`}function Wne(e,t){for(let n of[`api`,`session`]){let r=t.searchParams.get(n);r&&!e.searchParams.has(n)&&e.searchParams.set(n,r)}}function fo(e){for(let t of no)if(e===t||e.startsWith(t+`/`))return t;return null}function po(e,t){if(t===`pop`)return null;let n=t===`main`?e.mainLocation:e.bottomLocation,r=t===`main`?e.mainTabs:e.bottomTabs,i=fo(n.pathname);return i&&r.includes(i)?i:null}function mo(e){return Rne.some(t=>e===t||e.startsWith(t+`/`))}function ho(e,t){if(mo(t))return`pop`;let n=fo(t);return n&&e.bottomTabs.includes(n)?`bottom`:`main`}function go(e){let t=new Set,n=[],r=[];for(let r of e.mainTabs)t.has(r)||(n.push(r),t.add(r));for(let n of e.bottomTabs)t.has(n)||(r.push(n),t.add(n));for(let e of no)t.has(e)||(ro.includes(e)?r.push(e):n.push(e));return{mainTabs:n,bottomTabs:r}}function _o(e,t){if(t.length===0)return so(`/`);let n=fo(e.pathname);return n&&!t.includes(n)?so(`/`):e}function vo(e,t){if(t.length===0)return so(`/`);if(e.pathname===`/`)return so(`/`,e.state);let n=fo(e.pathname);return!n||!t.includes(n)?so(`/`):e}function yo(e){return e.pathname===`/`?so(`/`,e.state):mo(e.pathname)?e:so(`/`)}function bo(e){let t=go({mainTabs:e.mainTabs,bottomTabs:e.bottomTabs});return{...e,mainTabs:t.mainTabs,bottomTabs:t.bottomTabs,mainLocation:_o(e.mainLocation,t.mainTabs),bottomLocation:vo(e.bottomLocation,t.bottomTabs),popLocation:yo(e.popLocation)}}function xo(e,t){let n=new URL(e.href),r=co(Ya());n.pathname=lo(n.pathname,r);let i=n.searchParams.get(`_b`),a=n.searchParams.get(`_p`);n.searchParams.delete(`_b`),n.searchParams.delete(`_p`);let o=window.history.state,s=so(`${n.pathname}${n.search}${n.hash}`,o?.main),c=so(i??`/`,o?.bottom),l=so(a??`/`,o?.pop);if(!i&&!a){let e=ho(t,s.pathname);e===`bottom`?(c=s,s=so(`/`,o?.main)):e===`pop`&&(l=s,s=so(`/`,o?.main))}return{main:_o(s,t.mainTabs),bottom:vo(c,t.bottomTabs),pop:yo(l)}}function So(e){let t=new URL(window.location.href),n=new URL(e.mainLocation.href,window.location.origin),r=co(Ya());return n.pathname=Une(n.pathname,r),Wne(n,t),n.searchParams.delete(`_b`),n.searchParams.delete(`_p`),e.bottomTabs.length>0&&n.searchParams.set(`_b`,e.bottomLocation.href),e.popLocation.pathname!==`/`&&n.searchParams.set(`_p`,e.popLocation.href),`${n.pathname}${n.search}${n.hash}`}function Co(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Gne(){return{mainTabs:[...Lne],bottomTabs:[...ro],updatedAt:0,mainLocation:so(`/dashboard`),bottomLocation:so(`/`),popLocation:so(`/`)}}function Kne(){try{let e=localStorage.getItem(io());return e?oo(JSON.parse(e)):null}catch{return null}}function qne(e){try{let t=localStorage.getItem(e);return t?oo(JSON.parse(t)):null}catch{return null}}function wo(e,t=io()){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var Jne=[({prevState:e,nextState:t,event:n})=>{if(n.type!==`MOVE_TAB`)return t;let r=e.bottomTabs.includes(n.tabId)?`bottom`:`main`;if(po(e,r)!==n.tabId)return t;let i=r===`main`?e.mainLocation:e.bottomLocation,a=so(i.href,i.state);return n.targetArea===`main`?{...t,mainLocation:a}:{...t,bottomLocation:a}},({nextState:e})=>e.mainTabs.length===0||po(e,`main`)!=null?e:{...e,mainLocation:so(e.mainTabs[0])}];function To(e,t,n){let r=t;for(let t of Jne)r=t({prevState:e,nextState:r,event:n});return r}function Eo(e,t){switch(t.type){case`NAVIGATE`:{let n=t.sourceArea===`pop`?`pop`:ho(e,t.location.pathname);return{nextState:n===`main`?{...e,mainLocation:t.location}:n===`bottom`?{...e,bottomLocation:t.location}:{...e,popLocation:t.location},changed:!0,urlAction:t.action,notify:n===t.sourceArea?[]:[{area:n,type:t.action}],persist:`none`}}case`POPSTATE`:return{nextState:{...e,mainLocation:t.mainLocation,bottomLocation:t.bottomLocation,popLocation:t.popLocation},changed:!0,notify:[{area:`main`,type:`BACK`},{area:`bottom`,type:`BACK`},{area:`pop`,type:`BACK`}],persist:`none`};case`MOVE_TAB`:{let n=e.bottomTabs.includes(t.tabId)?`bottom`:`main`;if(n===t.targetArea)return{nextState:e,changed:!1,notify:[],persist:`none`};let r=e.mainTabs.filter(e=>e!==t.tabId),i=e.bottomTabs.filter(e=>e!==t.tabId),a=t.targetArea===`main`?[...r,t.tabId]:r,o=t.targetArea===`bottom`?[...i,t.tabId]:i,s=e.mainLocation,c=e.bottomLocation;return fo((n===`main`?e.mainLocation:e.bottomLocation).pathname)===t.tabId&&(n===`main`?s=so(`/`):c=so(`/`)),{nextState:{...e,mainTabs:a,bottomTabs:o,mainLocation:s,bottomLocation:c},changed:!0,urlAction:`REPLACE`,notify:[{area:`main`,type:`REPLACE`},{area:`bottom`,type:`REPLACE`}],persist:`local_and_remote`}}case`REORDER`:{let n=t.area===`main`?e.mainTabs:e.bottomTabs,r=new Set(n),i=t.tabIds.filter(e=>r.has(e));for(let e of n)i.includes(e)||i.push(e);return Co(n,i)?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:t.area===`main`?{...e,mainTabs:i}:{...e,bottomTabs:i},changed:!0,notify:[],persist:`local_and_remote`}}case`CLOSE_TAB`:{let n=e.bottomTabs.includes(t.tabId),r=e.mainTabs.includes(t.tabId);return!n&&!r?{nextState:e,changed:!1,notify:[],persist:`none`}:n?fo(e.bottomLocation.pathname)===t.tabId?{nextState:{...e,bottomLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`}:fo(e.mainLocation.pathname)===t.tabId?{nextState:{...e,mainLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`}}case`ACTIVATE_BOTTOM`:return ho(e,t.location.pathname)===`bottom`?{nextState:{...e,bottomLocation:t.location},changed:!0,urlAction:`PUSH`,notify:[{area:`bottom`,type:`PUSH`}],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`};case`DEACTIVATE_BOTTOM`:return e.bottomLocation.pathname===`/`?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,bottomLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`};case`ACTIVATE_POP`:return ho(e,t.location.pathname)===`pop`?{nextState:{...e,popLocation:t.location},changed:!0,urlAction:`PUSH`,notify:[{area:`pop`,type:`PUSH`}],persist:`none`}:{nextState:e,changed:!1,notify:[],persist:`none`};case`DEACTIVATE_POP`:return e.popLocation.pathname===`/`?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,popLocation:so(`/`)},changed:!0,urlAction:`REPLACE`,notify:[],persist:`none`};case`APPLY_LAYOUT`:{let n=go(t.layout);return!(t.layout.updatedAt!==e.updatedAt||!Co(e.mainTabs,n.mainTabs)||!Co(e.bottomTabs,n.bottomTabs))||!t.force&&t.layout.updatedAt<=e.updatedAt?{nextState:e,changed:!1,notify:[],persist:`none`}:{nextState:{...e,mainTabs:n.mainTabs,bottomTabs:n.bottomTabs,updatedAt:t.layout.updatedAt},changed:!0,urlAction:`REPLACE`,notify:[{area:`main`,type:`REPLACE`},{area:`bottom`,type:`REPLACE`}],persist:`local_only`}}}}function Do(e,t,n){return n===`main`?e.mainLocation.href!==t.mainLocation.href:n===`bottom`?e.bottomLocation.href!==t.bottomLocation.href:e.popLocation.href!==t.popLocation.href}function Yne(e,t,n){let r=[...e];for(let e of[`main`,`bottom`,`pop`])Do(t,n,e)&&(r.some(t=>t.area===e)||r.push({area:e,type:`REPLACE`}));return r}var Oo=new class{mainHistory=null;bottomHistory=null;popHistory=null;state=Gne();listeners=new Set;snapshotCache=null;persistTimer=null;kvUnsubscribe=null;initialized=!1;storageKey=typeof window>`u`?`nav-layout`:Ga(`nav-layout`,window.location);constructor(){if(typeof window>`u`)return;let e=qa()?null:Kne();if(e!=null){let t=go(e);this.state={...this.state,mainTabs:t.mainTabs,bottomTabs:t.bottomTabs,updatedAt:e.updatedAt}}let t=xo(window.location,this.state),n=bo({...this.state,mainLocation:t.main,bottomLocation:t.bottom,popLocation:t.pop});n=bo(To(n,n,{type:`BOOTSTRAP`})),this.state=n,this.normalizeUrl(),window.addEventListener(`popstate`,this.handlePopState)}setHistoryRef(e,t){e===`main`?this.mainHistory=t:e===`bottom`?this.bottomHistory=t:this.popHistory=t}getLocation(e){return e===`main`?this.state.mainLocation:e===`bottom`?this.state.bottomLocation:this.state.popLocation}push(e,t,n){this.dispatch({type:`NAVIGATE`,sourceArea:e,action:`PUSH`,location:so(uo(t),n)})}replace(e,t,n){this.dispatch({type:`NAVIGATE`,sourceArea:e,action:`REPLACE`,location:so(uo(t),n)})}createHref(e,t,n){if(typeof window>`u`)return t;let{nextState:r}=this.computeTransition({type:`NAVIGATE`,sourceArea:e,action:`PUSH`,location:so(uo(t),n)});return So(r)}get mainTabs(){return this.state.mainTabs}get bottomTabs(){return this.state.bottomTabs}getAreaForPath(e){return ho(this.state,e)}moveTab(e,t){this.dispatch({type:`MOVE_TAB`,tabId:e,targetArea:t})}reorder(e,t){this.dispatch({type:`REORDER`,area:e,tabIds:t})}closeTab(e){this.dispatch({type:`CLOSE_TAB`,tabId:e})}activateBottom(e){this.dispatch({type:`ACTIVATE_BOTTOM`,location:so(e)})}deactivateBottom(){this.dispatch({type:`DEACTIVATE_BOTTOM`})}activatePop(e){this.dispatch({type:`ACTIVATE_POP`,location:so(e)})}deactivatePop(){this.dispatch({type:`DEACTIVATE_POP`})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){if(this.snapshotCache)return this.snapshotCache;let e=fo(this.state.bottomLocation.pathname);return this.snapshotCache={mainTabs:[...this.state.mainTabs],bottomTabs:[...this.state.bottomTabs],mainLocation:this.state.mainLocation,bottomLocation:this.state.bottomLocation,popLocation:this.state.popLocation,bottomActive:e!=null&&this.state.bottomTabs.includes(e),popActive:this.state.popLocation.pathname!==`/`},this.snapshotCache}async init(){if(!(this.initialized||qa())){this.initialized=!0;try{let e=await this.resolveProjectScopedStorageKey();e&&e!==this.storageKey&&(this.storageKey=e,this.rebindProjectScopedLayout(e));let{trpcClient:t}=await l(async()=>{let{trpcClient:e}=await import(`./trpc-D1nFWwj3.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])),n=oo(await t.kv.get.query({key:this.storageKey}));n?n.updatedAt>this.state.updatedAt?this.dispatch({type:`APPLY_LAYOUT`,layout:n}):this.state.updatedAt>n.updatedAt&&t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt}}).catch(()=>{}):this.state.updatedAt>0&&t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt}}).catch(()=>{});let r=t.kv.subscribe.subscribe({key:this.storageKey},{onData:e=>{let t=oo(e);t&&this.dispatch({type:`APPLY_LAYOUT`,layout:t})}});this.kvUnsubscribe=()=>r.unsubscribe()}catch{}}}destroy(){typeof window<`u`&&window.removeEventListener(`popstate`,this.handlePopState),this.cancelPersistTimer(),this.kvUnsubscribe&&=(this.kvUnsubscribe(),null)}handlePopState=()=>{let e=xo(window.location,this.state);this.dispatch({type:`POPSTATE`,mainLocation:e.main,bottomLocation:e.bottom,popLocation:e.pop})};computeTransition(e){let t=Eo(this.state,e);if(!t.changed)return{transition:t,nextState:this.state};let n=To(this.state,t.nextState,e);return n=bo(n),{transition:t,nextState:n}}dispatch(e){if(typeof window<`u`&&e.type!==`POPSTATE`&&this.mainHistory==null){let e=xo(window.location,this.state);this.state=bo({...this.state,mainLocation:e.main,bottomLocation:e.bottom,popLocation:e.pop})}let t=Eo(this.state,e);if(!t.changed)return;let n=this.state,r=To(n,t.nextState,e);r=bo(r),this.state=r,t.persist===`local_and_remote`?this.persistLayout():t.persist===`local_only`&&(this.cancelPersistTimer(),wo({mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:this.state.updatedAt},this.storageKey));let i=t.urlAction??(Do(n,this.state,`main`)||Do(n,this.state,`bottom`)||Do(n,this.state,`pop`)?`REPLACE`:void 0);i&&this.syncToUrl(i);let a=Yne(t.notify,n,this.state);this.notifyRouters(a),this.notifyListeners()}notifyRouters(e){for(let t of e)(t.area===`main`?this.mainHistory:t.area===`bottom`?this.bottomHistory:this.popHistory)?.notify({type:t.type})}notifyListeners(){this.snapshotCache=null;for(let e of this.listeners)e()}syncToUrl(e){let t=So(this.state),n=`${window.location.pathname}${window.location.search}${window.location.hash}`;if(e===`REPLACE`&&t===n)return;let r={main:this.state.mainLocation.state,bottom:this.state.bottomLocation.state,pop:this.state.popLocation.state};e===`PUSH`?window.history.pushState(r,``,t):window.history.replaceState(r,``,t)}normalizeUrl(){let e=So(this.state);if(e===`${window.location.pathname}${window.location.search}${window.location.hash}`)return;let t={main:this.state.mainLocation.state,bottom:this.state.bottomLocation.state,pop:this.state.popLocation.state};window.history.replaceState(t,``,e)}cancelPersistTimer(){this.persistTimer&&=(clearTimeout(this.persistTimer),null)}persistLayout(){let e=Date.now();this.state={...this.state,updatedAt:e},wo({mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:e},this.storageKey),this.cancelPersistTimer(),this.persistTimer=setTimeout(()=>{this.persistTimer=null,l(async()=>{let{trpcClient:e}=await import(`./trpc-D1nFWwj3.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])).then(({trpcClient:t})=>t.kv.set.mutate({key:this.storageKey,value:{mainTabs:this.state.mainTabs,bottomTabs:this.state.bottomTabs,updatedAt:e}})).catch(()=>{})},Bne)}async resolveProjectScopedStorageKey(){try{let e=await fetch(Ine());if(!e.ok)return null;let t=await e.json();return typeof t.projectDir!=`string`||t.projectDir.length===0?null:zne(t.projectDir)}catch{return null}}rebindProjectScopedLayout(e){let t=qne(e);if(t){this.dispatch({type:`APPLY_LAYOUT`,layout:t,force:!0});return}this.state=bo({...this.state,updatedAt:0}),this.normalizeUrl(),this.notifyListeners()}};typeof window<`u`&&!qa()&&Oo.init();function ko(){return(0,G.useSyncExternalStore)(e=>Oo.subscribe(e),()=>Oo.getSnapshot(),()=>Oo.getSnapshot())}function Xne(e,t){return t.updatedAt-e.updatedAt||e.id.localeCompare(t.id)}function Zne(e){return[...e].sort(Xne)}function Ao(e,t=10){return Zne(e).slice(0,Math.max(0,Math.trunc(t)))}var jo;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(jo||={});var Qne;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Qne||={});var Mo=jo.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),No=e=>{switch(typeof e){case`undefined`:return Mo.undefined;case`string`:return Mo.string;case`number`:return Number.isNaN(e)?Mo.nan:Mo.number;case`boolean`:return Mo.boolean;case`function`:return Mo.function;case`bigint`:return Mo.bigint;case`symbol`:return Mo.symbol;case`object`:return Array.isArray(e)?Mo.array:e===null?Mo.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Mo.promise:typeof Map<`u`&&e instanceof Map?Mo.map:typeof Set<`u`&&e instanceof Set?Mo.set:typeof Date<`u`&&e instanceof Date?Mo.date:Mo.object;default:return Mo.unknown}},q=jo.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Po=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jo.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Po.create=e=>new Po(e);var Fo=(e,t)=>{let n;switch(e.code){case q.invalid_type:n=e.received===Mo.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,jo.jsonStringifyReplacer)}`;break;case q.unrecognized_keys:n=`Unrecognized key(s) in object: ${jo.joinValues(e.keys,`, `)}`;break;case q.invalid_union:n=`Invalid input`;break;case q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${jo.joinValues(e.options)}`;break;case q.invalid_enum_value:n=`Invalid enum value. Expected ${jo.joinValues(e.options)}, received '${e.received}'`;break;case q.invalid_arguments:n=`Invalid function arguments`;break;case q.invalid_return_type:n=`Invalid function return type`;break;case q.invalid_date:n=`Invalid date`;break;case q.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:jo.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case q.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case q.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case q.custom:n=`Invalid input`;break;case q.invalid_intersection_types:n=`Intersection results could not be merged`;break;case q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case q.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,jo.assertNever(e)}return{message:n}},$ne=Fo;function Io(){return $ne}var Lo=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function Ro(e,t){let n=Io(),r=Lo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Fo?void 0:Fo].filter(e=>!!e)});e.common.issues.push(r)}var zo=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Bo;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Bo;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Bo=Object.freeze({status:`aborted`}),Vo=e=>({status:`dirty`,value:e}),Ho=e=>({status:`valid`,value:e}),Uo=e=>e.status===`aborted`,Wo=e=>e.status===`dirty`,Go=e=>e.status===`valid`,Ko=e=>typeof Promise<`u`&&e instanceof Promise,qo;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(qo||={});var Jo=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Yo=(e,t)=>{if(Go(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new Po(e.common.issues),this._error}}};function Xo(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var Zo=class{get description(){return this._def.description}_getType(e){return No(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:No(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zo,ctx:{common:e.parent.common,data:e.data,parsedType:No(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ko(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)};return Yo(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Go(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Go(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:No(e)},r=this._parse({data:e,path:n.path,parent:n});return Yo(n,await(Ko(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:q.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ks({schema:this,typeName:zs.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return As.create(this,this._def)}nullable(){return js.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ps.create(this)}promise(){return Os.create(this,this._def)}or(e){return gs.create([this,e],this._def)}and(e){return ys.create(this,e,this._def)}transform(e){return new ks({...Xo(this._def),schema:this,typeName:zs.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new Ms({...Xo(this._def),innerType:this,defaultValue:t,typeName:zs.ZodDefault})}brand(){return new Fs({typeName:zs.ZodBranded,type:this,...Xo(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Ns({...Xo(this._def),innerType:this,catchValue:t,typeName:zs.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Is.create(this,e)}readonly(){return Ls.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ere=/^c[^\s-]{8,}$/i,tre=/^[0-9a-z]+$/,nre=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rre=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ire=/^[a-z0-9_-]{21}$/i,are=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ore=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sre=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cre=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Qo,lre=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ure=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dre=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,fre=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pre=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mre=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$o=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,hre=RegExp(`^${$o}$`);function es(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function gre(e){return RegExp(`^${es(e)}$`)}function _re(e){let t=`${$o}T${es(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function vre(e,t){return!!((t===`v4`||!t)&&lre.test(e)||(t===`v6`||!t)&&dre.test(e))}function yre(e,t){if(!are.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function bre(e,t){return!!((t===`v4`||!t)&&ure.test(e)||(t===`v6`||!t)&&fre.test(e))}var ts=class e extends Zo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Mo.string){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.string,received:t.parsedType}),Bo}let t=new zo,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Ro(n,{code:q.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&Ro(n,{code:q.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)sre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`email`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Qo||=new RegExp(cre,`u`),Qo.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`emoji`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)rre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`uuid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ire.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`nanoid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ere.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cuid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)tre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cuid2`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)nre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`ulid`,code:q.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Ro(n,{validation:`url`,code:q.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`regex`,code:q.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?_re(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?hre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?gre(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?ore.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`duration`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?vre(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`ip`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?yre(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`jwt`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?bre(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`cidr`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?pre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`base64`,code:q.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?mre.test(e.data)||(n=this._getOrReturnCtx(e,n),Ro(n,{validation:`base64url`,code:q.invalid_string,message:r.message}),t.dirty()):jo.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:q.invalid_string,...qo.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...qo.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...qo.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...qo.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...qo.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...qo.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...qo.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...qo.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...qo.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...qo.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...qo.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...qo.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...qo.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...qo.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...qo.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...qo.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...qo.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...qo.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...qo.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...qo.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...qo.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...qo.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...qo.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...qo.errToObj(t)})}nonempty(e){return this.min(1,qo.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ts.create=e=>new ts({checks:[],typeName:zs.ZodString,coerce:e?.coerce??!1,...Xo(e)});function xre(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var ns=class e extends Zo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Mo.number){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.number,received:t.parsedType}),Bo}let t,n=new zo;for(let r of this._def.checks)r.kind===`int`?jo.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?xre(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_finite,message:r.message}),n.dirty()):jo.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,qo.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,qo.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,qo.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,qo.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:qo.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:qo.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:qo.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:qo.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:qo.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:qo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:qo.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:qo.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:qo.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:qo.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&jo.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};ns.create=e=>new ns({checks:[],typeName:zs.ZodNumber,coerce:e?.coerce||!1,...Xo(e)});var rs=class e extends Zo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Mo.bigint)return this._getInvalidInput(e);let t,n=new zo;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ro(t,{code:q.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):jo.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.bigint,received:t.parsedType}),Bo}gte(e,t){return this.setLimit(`min`,e,!0,qo.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,qo.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,qo.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,qo.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:qo.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:qo.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:qo.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:qo.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:qo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:qo.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};rs.create=e=>new rs({checks:[],typeName:zs.ZodBigInt,coerce:e?.coerce??!1,...Xo(e)});var is=class extends Zo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Mo.boolean){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.boolean,received:t.parsedType}),Bo}return Ho(e.data)}};is.create=e=>new is({typeName:zs.ZodBoolean,coerce:e?.coerce||!1,...Xo(e)});var as=class e extends Zo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Mo.date){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.date,received:t.parsedType}),Bo}if(Number.isNaN(e.data.getTime()))return Ro(this._getOrReturnCtx(e),{code:q.invalid_date}),Bo;let t=new zo,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Ro(n,{code:q.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):jo.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:qo.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:qo.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};as.create=e=>new as({checks:[],coerce:e?.coerce||!1,typeName:zs.ZodDate,...Xo(e)});var os=class extends Zo{_parse(e){if(this._getType(e)!==Mo.symbol){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.symbol,received:t.parsedType}),Bo}return Ho(e.data)}};os.create=e=>new os({typeName:zs.ZodSymbol,...Xo(e)});var ss=class extends Zo{_parse(e){if(this._getType(e)!==Mo.undefined){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.undefined,received:t.parsedType}),Bo}return Ho(e.data)}};ss.create=e=>new ss({typeName:zs.ZodUndefined,...Xo(e)});var cs=class extends Zo{_parse(e){if(this._getType(e)!==Mo.null){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.null,received:t.parsedType}),Bo}return Ho(e.data)}};cs.create=e=>new cs({typeName:zs.ZodNull,...Xo(e)});var ls=class extends Zo{constructor(){super(...arguments),this._any=!0}_parse(e){return Ho(e.data)}};ls.create=e=>new ls({typeName:zs.ZodAny,...Xo(e)});var us=class extends Zo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ho(e.data)}};us.create=e=>new us({typeName:zs.ZodUnknown,...Xo(e)});var ds=class extends Zo{_parse(e){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.never,received:t.parsedType}),Bo}};ds.create=e=>new ds({typeName:zs.ZodNever,...Xo(e)});var fs=class extends Zo{_parse(e){if(this._getType(e)!==Mo.undefined){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.void,received:t.parsedType}),Bo}return Ho(e.data)}};fs.create=e=>new fs({typeName:zs.ZodVoid,...Xo(e)});var ps=class e extends Zo{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Mo.array)return Ro(t,{code:q.invalid_type,expected:Mo.array,received:t.parsedType}),Bo;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Ro(t,{code:e?q.too_big:q.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Ro(t,{code:q.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Ro(t,{code:q.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Jo(t,e,t.path,n)))).then(e=>zo.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Jo(t,e,t.path,n)));return zo.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:qo.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:qo.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:qo.toString(n)}})}nonempty(e){return this.min(1,e)}};ps.create=(e,t)=>new ps({type:e,minLength:null,maxLength:null,exactLength:null,typeName:zs.ZodArray,...Xo(t)});function ms(e){if(e instanceof hs){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=As.create(ms(r))}return new hs({...e._def,shape:()=>t})}else if(e instanceof ps)return new ps({...e._def,type:ms(e.element)});else if(e instanceof As)return As.create(ms(e.unwrap()));else if(e instanceof js)return js.create(ms(e.unwrap()));else if(e instanceof bs)return bs.create(e.items.map(e=>ms(e)));else return e}var hs=class e extends Zo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:jo.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==Mo.object){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.object,received:t.parsedType}),Bo}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof ds&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Jo(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ds){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(Ro(n,{code:q.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Jo(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>zo.mergeObjectSync(t,e)):zo.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return qo.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:qo.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:zs.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of jo.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of jo.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return ms(this)}partial(t){let n={};for(let e of jo.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of jo.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof As;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ts(jo.objectKeys(this.shape))}};hs.create=(e,t)=>new hs({shape:()=>e,unknownKeys:`strip`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)}),hs.strictCreate=(e,t)=>new hs({shape:()=>e,unknownKeys:`strict`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)}),hs.lazycreate=(e,t)=>new hs({shape:e,unknownKeys:`strip`,catchall:ds.create(),typeName:zs.ZodObject,...Xo(t)});var gs=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Po(e.ctx.common.issues));return Ro(t,{code:q.invalid_union,unionErrors:n}),Bo}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Po(e));return Ro(t,{code:q.invalid_union,unionErrors:i}),Bo}}get options(){return this._def.options}};gs.create=(e,t)=>new gs({options:e,typeName:zs.ZodUnion,...Xo(t)});var _s=e=>e instanceof Cs?_s(e.schema):e instanceof ks?_s(e.innerType()):e instanceof ws?[e.value]:e instanceof Es?e.options:e instanceof Ds?jo.objectValues(e.enum):e instanceof Ms?_s(e._def.innerType):e instanceof ss?[void 0]:e instanceof cs?[null]:e instanceof As?[void 0,..._s(e.unwrap())]:e instanceof js?[null,..._s(e.unwrap())]:e instanceof Fs||e instanceof Ls?_s(e.unwrap()):e instanceof Ns?_s(e._def.innerType):[],Sre=class e extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Mo.object)return Ro(t,{code:q.invalid_type,expected:Mo.object,received:t.parsedType}),Bo;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(Ro(t,{code:q.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Bo)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=_s(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:zs.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Xo(r)})}};function vs(e,t){let n=No(e),r=No(t);if(e===t)return{valid:!0,data:e};if(n===Mo.object&&r===Mo.object){let n=jo.objectKeys(t),r=jo.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=vs(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Mo.array&&r===Mo.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=vs(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Mo.date&&r===Mo.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var ys=class extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Uo(e)||Uo(r))return Bo;let i=vs(e.value,r.value);return i.valid?((Wo(e)||Wo(r))&&t.dirty(),{status:t.value,value:i.data}):(Ro(n,{code:q.invalid_intersection_types}),Bo)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ys.create=(e,t,n)=>new ys({left:e,right:t,typeName:zs.ZodIntersection,...Xo(n)});var bs=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.array)return Ro(n,{code:q.invalid_type,expected:Mo.array,received:n.parsedType}),Bo;if(n.data.length<this._def.items.length)return Ro(n,{code:q.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Bo;!this._def.rest&&n.data.length>this._def.items.length&&(Ro(n,{code:q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Jo(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>zo.mergeArray(t,e)):zo.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};bs.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new bs({items:e,typeName:zs.ZodTuple,rest:null,...Xo(t)})};var Cre=class e extends Zo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.object)return Ro(n,{code:q.invalid_type,expected:Mo.object,received:n.parsedType}),Bo;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Jo(n,e,n.path,e)),value:a._parse(new Jo(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?zo.mergeObjectAsync(t,r):zo.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Zo?new e({keyType:t,valueType:n,typeName:zs.ZodRecord,...Xo(r)}):new e({keyType:ts.create(),valueType:t,typeName:zs.ZodRecord,...Xo(n)})}},xs=class extends Zo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.map)return Ro(n,{code:q.invalid_type,expected:Mo.map,received:n.parsedType}),Bo;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Jo(n,e,n.path,[a,`key`])),value:i._parse(new Jo(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Bo;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Bo;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};xs.create=(e,t,n)=>new xs({valueType:t,keyType:e,typeName:zs.ZodMap,...Xo(n)});var Ss=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Mo.set)return Ro(n,{code:q.invalid_type,expected:Mo.set,received:n.parsedType}),Bo;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Ro(n,{code:q.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Ro(n,{code:q.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Bo;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Jo(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:qo.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:qo.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ss.create=(e,t)=>new Ss({valueType:e,minSize:null,maxSize:null,typeName:zs.ZodSet,...Xo(t)});var wre=class e extends Zo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Mo.function)return Ro(t,{code:q.invalid_type,expected:Mo.function,received:t.parsedType}),Bo;function n(e,n){return Lo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Io(),Fo].filter(e=>!!e),issueData:{code:q.invalid_arguments,argumentsError:n}})}function r(e,n){return Lo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Io(),Fo].filter(e=>!!e),issueData:{code:q.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Os){let e=this;return Ho(async function(...t){let o=new Po([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Ho(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Po([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Po([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:bs.create(t).rest(us.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||bs.create([]).rest(us.create()),returns:n||us.create(),typeName:zs.ZodFunction,...Xo(r)})}},Cs=class extends Zo{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Cs.create=(e,t)=>new Cs({getter:e,typeName:zs.ZodLazy,...Xo(t)});var ws=class extends Zo{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Ro(t,{received:t.data,code:q.invalid_literal,expected:this._def.value}),Bo}return{status:`valid`,value:e.data}}get value(){return this._def.value}};ws.create=(e,t)=>new ws({value:e,typeName:zs.ZodLiteral,...Xo(t)});function Ts(e,t){return new Es({values:e,typeName:zs.ZodEnum,...Xo(t)})}var Es=class e extends Zo{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return Ro(t,{expected:jo.joinValues(n),received:t.parsedType,code:q.invalid_type}),Bo}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return Ro(t,{received:t.data,code:q.invalid_enum_value,options:n}),Bo}return Ho(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Es.create=Ts;var Ds=class extends Zo{_parse(e){let t=jo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Mo.string&&n.parsedType!==Mo.number){let e=jo.objectValues(t);return Ro(n,{expected:jo.joinValues(e),received:n.parsedType,code:q.invalid_type}),Bo}if(this._cache||=new Set(jo.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=jo.objectValues(t);return Ro(n,{received:n.data,code:q.invalid_enum_value,options:e}),Bo}return Ho(e.data)}get enum(){return this._def.values}};Ds.create=(e,t)=>new Ds({values:e,typeName:zs.ZodNativeEnum,...Xo(t)});var Os=class extends Zo{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Mo.promise&&t.common.async===!1?(Ro(t,{code:q.invalid_type,expected:Mo.promise,received:t.parsedType}),Bo):Ho((t.parsedType===Mo.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Os.create=(e,t)=>new Os({type:e,typeName:zs.ZodPromise,...Xo(t)});var ks=class extends Zo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zs.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Ro(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Bo;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Bo:r.status===`dirty`||t.value===`dirty`?Vo(r.value):r});{if(t.value===`aborted`)return Bo;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Bo:r.status===`dirty`||t.value===`dirty`?Vo(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Bo:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Bo:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Go(e))return Bo;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Go(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Bo);jo.assertNever(r)}};ks.create=(e,t,n)=>new ks({schema:e,typeName:zs.ZodEffects,effect:t,...Xo(n)}),ks.createWithPreprocess=(e,t,n)=>new ks({schema:t,effect:{type:`preprocess`,transform:e},typeName:zs.ZodEffects,...Xo(n)});var As=class extends Zo{_parse(e){return this._getType(e)===Mo.undefined?Ho(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};As.create=(e,t)=>new As({innerType:e,typeName:zs.ZodOptional,...Xo(t)});var js=class extends Zo{_parse(e){return this._getType(e)===Mo.null?Ho(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};js.create=(e,t)=>new js({innerType:e,typeName:zs.ZodNullable,...Xo(t)});var Ms=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Mo.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ms.create=(e,t)=>new Ms({innerType:e,typeName:zs.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...Xo(t)});var Ns=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ko(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Po(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Po(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ns.create=(e,t)=>new Ns({innerType:e,typeName:zs.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...Xo(t)});var Ps=class extends Zo{_parse(e){if(this._getType(e)!==Mo.nan){let t=this._getOrReturnCtx(e);return Ro(t,{code:q.invalid_type,expected:Mo.nan,received:t.parsedType}),Bo}return{status:`valid`,value:e.data}}};Ps.create=e=>new Ps({typeName:zs.ZodNaN,...Xo(e)});var Fs=class extends Zo{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Is=class e extends Zo{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Bo:e.status===`dirty`?(t.dirty(),Vo(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Bo:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:zs.ZodPipeline})}},Ls=class extends Zo{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Go(e)&&(e.value=Object.freeze(e.value)),e);return Ko(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Ls.create=(e,t)=>new Ls({innerType:e,typeName:zs.ZodReadonly,...Xo(t)});function Rs(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function Tre(e,t={},n){return e?ls.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Rs(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Rs(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):ls.create()}hs.lazycreate;var zs;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(zs||={});var J=ts.create,Bs=ns.create;Ps.create,rs.create;var Vs=is.create;as.create,os.create,ss.create,cs.create,ls.create;var Hs=us.create;ds.create,fs.create;var Us=ps.create,Y=hs.create;hs.strictCreate;var Ws=gs.create,Gs=Sre.create;ys.create,bs.create;var Ks=Cre.create;xs.create,Ss.create,wre.create,Cs.create;var qs=ws.create,Js=Es.create;Ds.create,Os.create,ks.create,As.create,js.create;var Ere=ks.createWithPreprocess;Is.create;var Ys=[`timeout`,`memory-limit`,`runtime`,`abort`];async function Dre(e,t={}){let n=new AbortController,r=[],i=t.signal,a=Ore(t.timeoutMs);if(i)if(i.aborted)n.abort(i.reason);else{let e=()=>n.abort(i.reason);i.addEventListener(`abort`,e,{once:!0}),r.push(()=>i.removeEventListener(`abort`,e))}if(n.signal.aborted)return r.forEach(e=>e()),{ok:!1,error:Xs(n.signal.reason,i)};let o,s,c=Promise.resolve().then(()=>e(n.signal));c.catch(()=>void 0);let l=[c];n.signal.aborted||l.push(new Promise((e,t)=>{let i=()=>t(new DOMException(`Translation cancelled.`,`AbortError`));n.signal.addEventListener(`abort`,i,{once:!0}),r.push(()=>n.signal.removeEventListener(`abort`,i))})),a!==void 0&&l.push(new Promise((e,t)=>{o=setTimeout(()=>{s=Error(`Translation task timed out after ${a}ms.`),n.abort(s),t(s)},a)}));try{return{ok:!0,value:await Promise.race(l)}}catch(e){return n.abort(e),s&&n.signal.reason===s?{ok:!1,error:{kind:`timeout`,message:s.message}}:{ok:!1,error:Xs(e,i)}}finally{o&&clearTimeout(o),r.forEach(e=>e())}}function Xs(e,t){if(Mre(e))return e;if(t?.aborted)return{kind:`abort`,message:Zs(t.reason)??`Translation cancelled.`};if(e instanceof DOMException&&e.name===`AbortError`)return{kind:`abort`,message:Zs(e)??`Translation cancelled.`};let n=kre(e);return Are(n)?{kind:`timeout`,message:n}:jre(n)?{kind:`memory-limit`,message:n}:{kind:`runtime`,message:n}}function Ore(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):void 0}function kre(e){return e instanceof Error&&e.message.trim().length>0?e.message:typeof e==`string`&&e.trim().length>0?e:`Translation failed.`}function Zs(e){if(e instanceof Error&&e.message.trim().length>0)return e.message;if(typeof e==`string`&&e.trim().length>0)return e}function Are(e){return/\btime(?:d)?\s*out\b/i.test(e)}function jre(e){return/out of memory/i.test(e)||/memory limit/i.test(e)||/insufficient memory/i.test(e)||/ERR_WORKER_OUT_OF_MEMORY/i.test(e)}function Mre(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`kind`),n=Reflect.get(e,`message`);return typeof t==`string`&&Ys.includes(t)&&typeof n==`string`&&n.length>0}var Qs=[`browser`,`local`,`local-ct2`,`local-llama`,`openai`],$s=Js(Qs),ec=`browser`;function tc(e){return e===`local`||e===`local-ct2`||e===`local-llama`}function nc(e){return e===`local`||e===`local-ct2`}Js([`local`,`local-ct2`,`local-llama`,`openai`]);var rc=15e3,ic=Js([`not-downloaded`,`queued`,`downloading`,`paused`,`downloaded`,`error`,`deleting`]),Nre=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),required:Vs(),etag:J().min(1).optional(),revision:J().min(1).optional(),sourceUrl:J().min(1).optional(),raw:Hs().optional()}),Pre=Y({id:J().min(1),label:J().min(1),description:J().optional(),profile:J().min(1).optional(),dtype:J().min(1).optional(),estimatedTotalBytes:Bs().int().nonnegative().optional(),baseGroupId:J().min(1).optional(),commitHash:J().min(1).optional(),shortCommitHash:J().min(1).optional(),rootDir:J().min(1).optional(),status:ic.optional(),progress:Bs().min(0).max(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),resumable:Vs().optional(),error:J().optional(),selectable:Vs(),selected:Vs(),files:Us(Nre)}),Fre=Js([`idle`,`loading`,`ready`,`error`]),Ire=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),required:Vs(),etag:J().min(1).optional(),revision:J().min(1).optional(),sourceUrl:J().min(1).optional(),raw:Hs().optional()}),Lre=Y({id:J().min(1),baseGroupId:J().min(1),label:J().min(1),displayLabel:J().min(1),description:J().optional(),profile:J().min(1).optional(),dtype:J().min(1).optional(),commitHash:J().min(1),shortCommitHash:J().min(1),rootDir:J().min(1),estimatedTotalBytes:Bs().int().nonnegative().optional(),selectable:Vs(),files:Us(Ire)}),Rre=Y({modelId:J().min(1),source:qs(`huggingface`),endpoint:J().default(``),revision:J().min(1),commitHash:J().min(1),shortCommitHash:J().min(1),fetchedAt:Bs().int().nonnegative(),updatedAt:Bs().int().nonnegative(),raw:Hs().optional(),groups:Ks(J(),Lre).default({}),groupOrder:Us(J().min(1)).default([])}),zre=Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional(),required:Vs().default(!0),status:ic.default(`not-downloaded`),updatedAt:Bs().int().nonnegative().optional(),error:J().optional()}),Bre=Y({groupId:J().min(1),baseGroupId:J().min(1).optional(),status:ic.default(`not-downloaded`),rootDir:J().min(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),progress:Bs().min(0).max(1).optional(),resumable:Vs().default(!1),error:J().optional(),installedAt:Bs().int().nonnegative().optional(),updatedAt:Bs().int().nonnegative().optional(),files:Us(zre).default([])}),Vre=Y({status:Fre.default(`idle`),message:J().optional(),error:J().optional(),updatedAt:Bs().int().nonnegative().optional()});Y({engineId:Js([`local`,`local-ct2`,`local-llama`]),modelId:J().min(1),selectedGroupId:J().min(1).optional(),groupId:J().min(1).optional(),status:ic,message:J(),progress:Bs().min(0).max(1).optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),sessionId:J().optional(),resumable:Vs().optional(),files:Us(Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional()})).optional(),updatedAt:Bs().int().nonnegative()});var Hre=Y({modelId:J().min(1),estimatedTotalBytes:Bs().int().nonnegative().optional(),files:Us(Nre),profile:J().min(1).optional(),selectedGroupId:J().min(1).optional(),groups:Us(Pre).optional()});Y({modelId:J().min(1),version:qs(2).default(2),status:ic.default(`not-downloaded`),selected:Vs().default(!1),selectedGroupId:J().min(1).optional(),installedAt:Bs().int().nonnegative().optional(),updatedAt:Bs().int().nonnegative().optional(),bytesDownloaded:Bs().int().nonnegative().optional(),totalBytes:Bs().int().nonnegative().optional(),progress:Bs().min(0).max(1).optional(),resumable:Vs().default(!1),error:J().optional(),profileLoad:Vre.default(Vre.parse({})),profileManifest:Rre.optional(),groupsState:Ks(J(),Bre).default({}),plan:Hre.optional(),files:Us(Y({path:J().min(1),sizeBytes:Bs().int().nonnegative().optional(),downloadedBytes:Bs().int().nonnegative().optional()})).default([])}),Js([`local`,`network`,`recommended`]);var Ure=Js([`installed`,`installing`,`missing`,`error`,`not-applicable`]),Wre=Js([`ready`,`probing`,`failed`,`error`,`not-applicable`]),Gre=Js([`ready`,`missing`,`downloading`,`error`,`not-applicable`]),ac=Y({message:J().optional(),progress:Bs().min(0).max(1).optional(),error:J().optional()}),Kre=Y({dependency:ac.extend({state:Ure}),runtime:ac.extend({state:Wre}),assets:ac.extend({state:Gre}),summary:J().optional()});function oc(e={}){return{dependency:{state:`not-applicable`,...e.dependency},runtime:{state:`not-applicable`,...e.runtime},assets:{state:`not-applicable`,...e.assets},...e.summary?{summary:e.summary}:{}}}function qre(e){return e.dependency.state===`installed`||e.dependency.state===`not-applicable`}function Jre(e){return e.runtime.state===`ready`||e.runtime.state===`not-applicable`}function sc(e){return e?!qre(e)||!Jre(e):!1}function cc(e){if(e)return e.summary??e.runtime.error??e.runtime.message??e.dependency.error??e.dependency.message??e.assets.error??e.assets.message}var Yre=Js([`stdout`,`stderr`]);Y({stream:Yre,text:J()}),Gs(`type`,[Y({type:qs(`status`),lifecycle:Kre}),Y({type:qs(`log`),stream:Yre,text:J()}),Y({type:qs(`exit`),lifecycle:Kre})]);var Xre=[{id:`browser`,label:`Browser`,description:`Uses the browser Translator API and future browser-side providers.`,technicalSummary:`Browser-native Web Translator adapter. Package payload is about 5 KB; browser language packs are managed by the browser.`,runtime:`browser`,kind:`browser`,installDescription:`Browser translation support is built into the browser runtime.`,moduleName:`@openspecui/browser-translator`,factoryExport:`createBrowserTranslatorFactory`},{id:`local`,label:`Local-Transformers`,description:`Runs an ONNX Runtime-backed local translation adapter through Transformers.js with managed ONNX model files.`,technicalSummary:`Server-side ONNX Runtime adapter via Transformers.js. Runtime package is installed on demand; selected ONNX model groups are downloaded separately and can range from tens to hundreds of MB.`,runtime:`server`,kind:`managed-local`,settingsKey:`local`,defaultModel:`Xenova/nllb-200-distilled-600M`,runtimePackageName:`@huggingface/transformers`,installDescription:`Install the Local-Transformers runtime package to enable server-side translation.`,modelLabel:`Local Model`,downloadGroupsLabel:`Local download profiles`,refreshTooltip:`Refresh local model profiles`,moduleName:`@openspecui/local-translator`,factoryExport:`createLocalTranslatorFactory`},{id:`local-ct2`,label:`Local-CT2`,description:`Runs a bundled local CTranslate2 translation runtime with managed model files.`,technicalSummary:`Server-side native CTranslate2 adapter. Runtime package is installed on demand; selected model artifacts are downloaded separately and can range from tens to hundreds of MB.`,runtime:`server`,kind:`managed-local`,settingsKey:`localCt2`,defaultModel:`ooeoeo/opus-mt-en-zh-ct2-float16`,runtimePackageName:`ctranslate2`,installDescription:`Install the Local-CT2 runtime package to enable server-side translation.`,modelLabel:`CT2 Model`,downloadGroupsLabel:`Local CT2 download groups`,refreshTooltip:`Refresh local model artifacts`,moduleName:`@openspecui/local-ct2-translator`,factoryExport:`createLocalCt2TranslatorFactory`},{id:`local-llama`,label:`Local-Llama`,description:`Runs a local GGUF translation-capable LLM through node-llama-cpp with managed GGUF model files.`,technicalSummary:`Server-side llama.cpp adapter via node-llama-cpp. Runtime package is installed on demand; selected GGUF model files are downloaded separately and can range from hundreds of MB to multiple GB.`,runtime:`server`,kind:`managed-local`,settingsKey:`localLlama`,defaultModel:`bartowski/Qwen2.5-0.5B-Instruct-GGUF`,runtimePackageName:`node-llama-cpp`,installDescription:`Install the Local-Llama runtime package to enable server-side GGUF translation.`,modelLabel:`Llama Model`,downloadGroupsLabel:`Local GGUF files`,refreshTooltip:`Refresh local GGUF artifacts`,moduleName:`@openspecui/local-llama-translator`,factoryExport:`createLocalLlamaTranslatorFactory`},{id:`openai`,label:`OpenAI-Completion`,description:`Uses an OpenAI-compatible TanStack AI completion provider for context-aware translation.`,technicalSummary:`Server-side TanStack AI adapter for OpenAI-compatible APIs. Package payload is about 5 KB; model size stays with the remote provider.`,runtime:`server`,kind:`remote-provider`,settingsKey:`openai`,defaultModel:`gpt-4.1-mini`,installDescription:`OpenAI completion translation is bundled with the server runtime.`,moduleName:`@openspecui/openai-completion-translator`,factoryExport:`createOpenAICompletionTranslatorFactory`}];function lc(e){let t=Xre.find(t=>t.id===e);if(!t)throw Error(`Unknown translation engine: ${e}`);return t}function Zre(e){let t=lc(e);if(t.kind!==`managed-local`)throw Error(`Translation engine ${e} is not a managed-local engine.`);return t}var uc=Y({baseUrl:J().default(``),token:J().default(``),model:J().default(`gpt-4.1-mini`)}),Qre=Y({baseUrl:J().optional(),token:J().optional(),model:J().optional()}),dc=Y({model:J().default(`Xenova/nllb-200-distilled-600M`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),$re=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()}),fc=Y({model:J().default(`ooeoeo/opus-mt-en-zh-ct2-float16`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),eie=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()}),pc=Y({model:J().default(`bartowski/Qwen2.5-0.5B-Instruct-GGUF`),selectedGroupId:J().optional(),hfEndpoint:J().default(``),memoryBudgetPercent:Bs().min(0).max(100).default(25)}),tie=Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional(),hfEndpoint:J().optional(),memoryBudgetPercent:Bs().min(0).max(100).optional()});Y({engineId:$s.default(ec),openai:uc.default(uc.parse({})),local:dc.default(dc.parse({})),localCt2:fc.default(fc.parse({})),localLlama:pc.default(pc.parse({}))}),Y({engineId:$s.optional(),openai:Qre.optional(),local:$re.optional(),localCt2:eie.optional(),localLlama:tie.optional()}),Y({engineId:$s,sourceLanguage:J().min(1),targetLanguage:J().min(1),model:J().min(1).optional(),selectedGroupId:J().min(1).optional(),inputs:Us(J()).min(1),instructions:J().optional(),context:J().optional(),timeoutMs:Bs().int().positive().default(rc)}),Y({index:Bs().int().nonnegative(),output:J().optional(),error:Y({kind:Js(Ys),message:J().min(1)}).optional()});var mc=Js([`direct`,`bilingual`]),nie=Y({local:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),localCt2:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),localLlama:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).optional()}).default({}),openai:Y({model:J().min(1).optional()}).default({})}).default({}),rie=Y({local:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),localCt2:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),localLlama:Y({model:J().min(1).optional(),selectedGroupId:J().min(1).nullable().optional()}).optional(),openai:Y({model:J().min(1).optional()}).optional()}),hc=Y({enabled:Vs().default(!1),targetLanguage:J().min(1).default(`zh`),displayMode:mc.default(`direct`),cacheEnabled:Vs().default(!1),engineId:$s.default(ec),engines:nie});Y({enabled:Vs().optional(),targetLanguage:J().min(1).optional(),displayMode:mc.optional(),cacheEnabled:Vs().optional(),engineId:$s.optional(),engines:rie.optional()});var gc=1e4,_c=2e5;Y({entryLimit:Bs().int().min(100).max(_c).default(gc)}),Y({entryLimit:Bs().int().min(100).max(_c).optional()}),Y({key:J().min(1),keyHash:J().min(1),sourceText:J(),translatedText:J(),targetNodesJson:J().optional(),sourceLanguage:J().min(1),targetLanguage:J().min(1),placeholderTopologyHash:J().min(1),attributeTopologyHash:J().min(1),displayPolicyVersion:Bs().int().positive(),engineId:$s.default(ec),engineVersion:J().optional(),model:J().optional(),translatorContractVersion:Bs().int().positive().default(1),createdAt:Bs().int().nonnegative(),lastAccessedAt:Bs().int().nonnegative()}).omit({createdAt:!0,lastAccessedAt:!0}),Y({keyHash:J().min(1)}),Y({enabled:Vs(),entryLimit:Bs().int().positive(),entries:Bs().int().nonnegative(),databasePath:J().optional()});var iie=`project`,aie=/^[A-Za-z]:\//;function vc(e){return e.replace(/\\/g,`/`).replace(/\/+$/g,``)}function oie(e){return e.startsWith(`/`)||aie.test(e)}function sie(e){return e.replace(/^\.?\//,``)}function yc(e){return vc(e).split(`/`).filter(Boolean)}function cie(e){let t=vc(e),n=/(?:^|\/)node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(@[^/]+\/[^/]+|[^/]+)(\/.*)?/.exec(t),r=n?.[1];return r?`npm:${r}${n[2]??``}`:null}function bc(e){return`${iie}:${sie(e)}`}function lie(e,t){let n=vc(e),r=vc(t),i=n.toLowerCase(),a=r.toLowerCase();return a===i||a.startsWith(`${i}/`)}function uie(e,t){let n=yc(e),r=yc(t),i=0;for(;i<n.length&&i<r.length&&n[i]?.toLowerCase()===r[i]?.toLowerCase();)i+=1;return r.slice(i).join(`/`)}function die(e){let t=yc(e),n=t.lastIndexOf(`openspec`);return n<0?null:t.slice(n).join(`/`)}function xc(e,t){let n=vc(e),r=cie(n);return(t?.source===`package`||r)&&r?r:oie(n)?t?.projectDir&&lie(t.projectDir,n)?bc(uie(t.projectDir,n)):bc(die(n)||yc(n).slice(-4).join(`/`)):bc(n)}var Sc=Symbol.for(`yaml.alias`),Cc=Symbol.for(`yaml.document`),wc=Symbol.for(`yaml.map`),Tc=Symbol.for(`yaml.pair`),Ec=Symbol.for(`yaml.scalar`),Dc=Symbol.for(`yaml.seq`),Oc=Symbol.for(`yaml.node.type`),kc=e=>!!e&&typeof e==`object`&&e[Oc]===Sc,Ac=e=>!!e&&typeof e==`object`&&e[Oc]===Cc,jc=e=>!!e&&typeof e==`object`&&e[Oc]===wc,Mc=e=>!!e&&typeof e==`object`&&e[Oc]===Tc,Nc=e=>!!e&&typeof e==`object`&&e[Oc]===Ec,Pc=e=>!!e&&typeof e==`object`&&e[Oc]===Dc;function Fc(e){if(e&&typeof e==`object`)switch(e[Oc]){case wc:case Dc:return!0}return!1}function Ic(e){if(e&&typeof e==`object`)switch(e[Oc]){case Sc:case wc:case Ec:case Dc:return!0}return!1}var Lc=e=>(Nc(e)||Fc(e))&&!!e.anchor,Rc=Symbol(`break visit`),zc=Symbol(`skip children`),Bc=Symbol(`remove node`);function Vc(e,t){let n=Gc(t);Ac(e)?Hc(null,e.contents,n,Object.freeze([e]))===Bc&&(e.contents=null):Hc(null,e,n,Object.freeze([]))}Vc.BREAK=Rc,Vc.SKIP=zc,Vc.REMOVE=Bc;function Hc(e,t,n,r){let i=Kc(e,t,n,r);if(Ic(i)||Mc(i))return qc(e,r,i),Hc(e,i,n,r);if(typeof i!=`symbol`){if(Fc(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Hc(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Rc)return Rc;else i===Bc&&(t.items.splice(e,1),--e)}}else if(Mc(t)){r=Object.freeze(r.concat(t));let e=Hc(`key`,t.key,n,r);if(e===Rc)return Rc;e===Bc&&(t.key=null);let i=Hc(`value`,t.value,n,r);if(i===Rc)return Rc;i===Bc&&(t.value=null)}}return i}async function Uc(e,t){let n=Gc(t);Ac(e)?await Wc(null,e.contents,n,Object.freeze([e]))===Bc&&(e.contents=null):await Wc(null,e,n,Object.freeze([]))}Uc.BREAK=Rc,Uc.SKIP=zc,Uc.REMOVE=Bc;async function Wc(e,t,n,r){let i=await Kc(e,t,n,r);if(Ic(i)||Mc(i))return qc(e,r,i),Wc(e,i,n,r);if(typeof i!=`symbol`){if(Fc(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await Wc(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Rc)return Rc;else i===Bc&&(t.items.splice(e,1),--e)}}else if(Mc(t)){r=Object.freeze(r.concat(t));let e=await Wc(`key`,t.key,n,r);if(e===Rc)return Rc;e===Bc&&(t.key=null);let i=await Wc(`value`,t.value,n,r);if(i===Rc)return Rc;i===Bc&&(t.value=null)}}return i}function Gc(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Kc(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(jc(t))return n.Map?.(e,t,r);if(Pc(t))return n.Seq?.(e,t,r);if(Mc(t))return n.Pair?.(e,t,r);if(Nc(t))return n.Scalar?.(e,t,r);if(kc(t))return n.Alias?.(e,t,r)}function qc(e,t,n){let r=t[t.length-1];if(Fc(r))r.items[e]=n;else if(Mc(r))e===`key`?r.key=n:r.value=n;else if(Ac(r))r.contents=n;else{let e=kc(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var fie={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},pie=e=>e.replace(/[!,[\]{}]/g,e=>fie[e]),Jc=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+pie(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Ic(e.contents)){let t={};Vc(e.contents,(e,n)=>{Ic(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
3
3
  `)}};Jc.defaultYaml={explicit:!1,version:`1.2`},Jc.defaultTags={"!!":`tag:yaml.org,2002:`};function Yc(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Xc(e){let t=new Set;return Vc(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Zc(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function mie(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Xc(e);let a=Zc(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Nc(t.node)||Fc(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Qc(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Qc(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Qc(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Qc(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Qc(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function $c(e,t,n){if(Array.isArray(e))return e.map((e,t)=>$c(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Lc(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var el=class{constructor(e){Object.defineProperty(this,Oc,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ac(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=$c(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Qc(i,{"":o},``,o):o}},tl=class extends el{constructor(e){super(Sc),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Vc(e,{Node:(e,t)=>{(kc(t)||Lc(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=($c(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=nl(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Yc(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function nl(e,t,n){if(kc(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Fc(t)){let r=0;for(let i of t.items){let t=nl(e,i,n);t>r&&(r=t)}return r}else if(Mc(t)){let r=nl(e,t.key,n),i=nl(e,t.value,n);return Math.max(r,i)}return 1}var rl=e=>!e||typeof e!=`function`&&typeof e!=`object`,il=class extends el{constructor(e){super(Ec),this.value=e}toJSON(e,t){return t?.keep?this.value:$c(this.value,e,t)}toString(){return String(this.value)}};il.BLOCK_FOLDED=`BLOCK_FOLDED`,il.BLOCK_LITERAL=`BLOCK_LITERAL`,il.PLAIN=`PLAIN`,il.QUOTE_DOUBLE=`QUOTE_DOUBLE`,il.QUOTE_SINGLE=`QUOTE_SINGLE`;var hie=`tag:yaml.org,2002:`;function gie(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function al(e,t,n){if(Ac(e)&&(e=e.contents),Ic(e))return e;if(Mc(e)){let t=n.schema[wc].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new tl(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=hie+t.slice(2));let l=gie(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new il(e);return c&&(c.node=t),t}l=e instanceof Map?o[wc]:Symbol.iterator in Object(e)?o[Dc]:o[wc]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new il(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ol(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return al(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var sl=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,cl=class extends el{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>Ic(t)||Mc(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(sl(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Fc(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ol(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Fc(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Nc(i)?i.value:i:Fc(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Mc(t))return!1;let n=t.value;return n==null||e&&Nc(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Fc(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Fc(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ol(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},_ie=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ll(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var ul=(e,t,n)=>e.endsWith(`
4
4
  `)?ll(n,t):n.includes(`
5
5
  `)?`
@@ -722,7 +722,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
722
722
  @pointerdown=${e=>this._onResizeStart(e,`br`)}
723
723
  ></div>
724
724
  <div class="panel-body">${e}</div>
725
- </dialog>`:e}};customElements.define(`input-panel`,tye);var nye={extension:{type:H.Environment,name:`browser`,priority:-1},test:()=>!0,load:async()=>{await l(()=>import(`./browserAll-BNotGm1D.js`),__vite__mapDeps([3,4,2,5]))}},rye={extension:{type:H.Environment,name:`webworker`,priority:0},test:()=>typeof self<`u`&&self.WorkerGlobalScope!==void 0,load:async()=>{await l(()=>import(`./webworkerAll-BvYhXuRe.js`),__vite__mapDeps([6,4,2,5]))}},iye=new E;function Lw(e,t,n){let r=iye;e.measurable=!0,re(e,n,r),t.addBoundsMask(r),e.measurable=!1}function Rw(e,t,n){let r=d.get();e.measurable=!0;let i=ne.get().identity();D(e,r,aye(e,n,i)),e.measurable=!1,t.addBoundsMask(r),ne.return(i),d.return(r)}function aye(e,t,n){return e?(e!==t&&(aye(e.parent,t,n),e.updateLocalTransform(),n.append(e.localTransform)),n):(v(`Mask bounds, renderable is not inside the root container`),n)}var oye=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe=`alphaMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ve),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||Lw(this.mask,e,t)}addLocalBounds(e,t){Rw(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof ve}};oye.extension=H.MaskEffect;var zw=class{constructor(e){this.priority=0,this.pipe=`colorMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e==`number`}};zw.extension=H.MaskEffect;var Bw=class{constructor(e){this.priority=0,this.pipe=`stencilMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){Lw(this.mask,e,t)}addLocalBounds(e,t){Rw(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof _e}};Bw.extension=H.MaskEffect;var Vw;async function sye(){return Vw??=(async()=>{let e=he.get().createCanvas(1,1).getContext(`webgl`);if(!e)return`premultiply-alpha-on-upload`;let t=await new Promise(e=>{let t=document.createElement(`video`);t.onloadeddata=()=>e(t),t.onerror=()=>e(null),t.autoplay=!1,t.crossOrigin=`anonymous`,t.preload=`auto`,t.src=`data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=`,t.load()});if(!t)return`premultiply-alpha-on-upload`;let n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(r),e.deleteTexture(n),e.getExtension(`WEBGL_lose_context`)?.loseContext(),i[0]<=i[3]?`premultiplied-alpha`:`premultiply-alpha-on-upload`})(),Vw}var Hw=class e extends O{constructor(t){super(t),this.isReady=!1,this.uploadMethodId=`video`,t={...e.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??`premultiply-alpha-on-upload`,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=te.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener(`play`,this._onPlayStart),e.addEventListener(`pause`,this._onPlayStop),e.addEventListener(`seeked`,this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener(`canplay`,this._onCanPlay),e.addEventListener(`canplaythrough`,this._onCanPlayThrough),e.addEventListener(`error`,this._onError,!0)),this.alphaMode=await sye(),this._load=new Promise((n,r)=>{this.isValid?n(this):(this._resolve=n,this._reject=r,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener(`error`,this._onError,!0),this.emit(`error`,e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener(`canplay`,this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener(`canplaythrough`,this._onCanPlay),this._preloadTimeout&&=(clearTimeout(this._preloadTimeout),void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener(`play`,this._onPlayStart),e.removeEventListener(`pause`,this._onPlayStop),e.removeEventListener(`seeked`,this._onSeeked),e.removeEventListener(`canplay`,this._onCanPlay),e.removeEventListener(`canplaythrough`,this._onCanPlayThrough),e.removeEventListener(`error`,this._onError,!0),e.pause(),e.src=``,e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(te.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(te.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(te.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Hw.extension=H.TextureSource,Hw.defaultOptions={...O.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Hw.MIME_TYPES={ogv:`video/ogg`,mov:`video/quicktime`,m4v:`video/mp4`};var cye=Hw,Uw=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>typeof e==`string`||n?t(e):e):e),Ww=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||v(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let n=Uw(e),r;for(let e=0;e<this.parsers.length;e++){let i=this.parsers[e];if(i.test(t)){r=i.getCacheableAssets(n,t);break}}let i=new Map(Object.entries(r||{}));r||n.forEach(e=>{i.set(e,t)});let a=[...i.keys()],o={cacheKeys:a,keys:n};n.forEach(e=>{this._cacheMap.set(e,o)}),a.forEach(e=>{let n=r?r[e]:t;this._cache.has(e)&&this._cache.get(e)!==n&&v(`[Cache] already has key:`,e),this._cache.set(e,i.get(e))})}remove(e){if(!this._cacheMap.has(e)){v(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(e=>{this._cache.delete(e)}),t.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}},Gw=[];V.handleByList(H.TextureSource,Gw);function Kw(e={}){let t=e&&e.resource,n=t?e.resource:e,r=t?e:{resource:e};for(let e=0;e<Gw.length;e++){let t=Gw[e];if(t.test(n))return new t(r)}throw Error(`Could not find a source type for resource: ${r.resource}`)}function lye(e={},t=!1){let n=e&&e.resource,r=n?e.resource:e,i=n?e:{resource:e};if(!t&&Ww.has(r))return Ww.get(r);let a=new f({source:Kw(i)});return a.on(`destroy`,()=>{Ww.has(r)&&Ww.remove(r)}),t||Ww.set(r,a),a}function uye(e,t=!1){return typeof e==`string`?Ww.get(e):e instanceof O?new f({source:e}):lye(e,t)}f.from=uye,O.from=Kw,V.add(oye,zw,Bw,cye,be,N,_);var qw=(e=>(e[e.Low=0]=`Low`,e[e.Normal=1]=`Normal`,e[e.High=2]=`High`,e))(qw||{});function Jw(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Yw(e){return e.split(`?`)[0].split(`#`)[0]}function dye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fye(e,t,n){return e.replace(new RegExp(dye(t),`g`),n)}function pye(e,t){let n=``,r=0,i=-1,a=0,o=-1;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}var Xw={toPosix(e){return fye(e,`\\`,`/`)},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith(`blob:`)},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Jw(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let n=/^[^/:]+:\/{0,2}/.exec(e);return n?n[0]:``},toAbsolute(e,t,n){if(Jw(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=Yw(this.toPosix(t??he.get().getBaseUrl())),i=Yw(this.toPosix(n??this.rootname(r)));return e=this.toPosix(e),e.startsWith(`/`)?Xw.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(Jw(e),e.length===0)return`.`;if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t=``,n=e.startsWith(`/`);this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith(`/`);return e=pye(e,!1),e.length>0&&r&&(e+=`/`),n?`/${e}`:t+e},isAbsolute(e){return Jw(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith(`/`)},join(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];if(Jw(r),r.length>0)if(t===void 0)t=r;else{let i=e[n-1]??``;this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?`.`:this.normalize(t)},dirname(e){if(Jw(e),e.length===0)return`.`;e=this.toPosix(e);let t=e.charCodeAt(0),n=t===47,r=-1,i=!0,a=this.getProtocol(e),o=e;e=e.slice(a.length);for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:this.isUrl(o)?a+e:a:n&&r===1?`//`:a+e.slice(0,r)},rootname(e){Jw(e),e=this.toPosix(e);let t=``;if(t=e.startsWith(`/`)?`/`:this.getProtocol(e),this.isUrl(e)){let n=e.indexOf(`/`,t.length);t=n===-1?e:e.slice(0,n),t.endsWith(`/`)||(t+=`/`)}return t},basename(e,t){Jw(e),t&&Jw(t),e=Yw(this.toPosix(e));let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)},extname(e){Jw(e),e=Yw(this.toPosix(e));let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},parse(e){Jw(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;e=Yw(this.toPosix(e));let n=e.charCodeAt(0),r=this.isAbsolute(e),i;t.root=this.rootname(e),i=r||this.hasProtocol(e)?1:0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),t.dir=this.dirname(e),t},sep:`/`,delimiter:`:`,joinExtensions:[`.html`]};function Zw(e,t,n,r,i){let a=t[n];for(let o=0;o<a.length;o++){let s=a[o];n<t.length-1?Zw(e.replace(r[n],s),t,n+1,r,i):i.push(e.replace(r[n],s))}}function mye(e){let t=e.match(/\{(.*?)\}/g),n=[];if(t){let r=[];t.forEach(e=>{let t=e.substring(1,e.length-1).split(`,`);r.push(t)}),Zw(e,r,0,t,n)}else n.push(e);return n}var Qw=e=>!Array.isArray(e),$w=class{constructor(){this._defaultBundleIdentifierOptions={connector:`-`,createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,``)},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle(`foo`,this._createBundleAssetId(`foo`,`bar`))!==`bar`)throw Error(`[Resolver] GenerateBundleAssetId are not working correctly`)}prefer(...e){e.forEach(e=>{this._preferredOrder.push(e),e.priority||=Object.keys(e.params)}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e==`string`)this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join(`&`)}}getAlias(e){let{alias:t,src:n}=e;return Uw(t||n,e=>typeof e==`string`?e:Array.isArray(e)?e.map(e=>e?.src??e):e?.src?e.src:e,!0)}addManifest(e){this._manifest&&v(`[Resolver] Manifest already exists, this will be overwritten`),this._manifest=e,e.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(e,t){let n=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([e,t])=>typeof t==`string`||Array.isArray(t)?{alias:e,src:t}:{alias:e,...t})),r.forEach(t=>{let r=t.src,i=t.alias,a;if(typeof i==`string`){let t=this._createBundleAssetId(e,i);n.push(t),a=[i,t]}else{let t=i.map(t=>this._createBundleAssetId(e,t));n.push(...t),a=[...i,...t]}this.add({...t,alias:a,src:r})}),this._bundles[e]=n}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let n=e=>{this.hasKey(e)&&v(`[Resolver] already has key: ${e} overwriting`)};Uw(t).forEach(e=>{let{src:t}=e,{data:r,format:i,loadParser:a,parser:o}=e,s=Uw(t).map(e=>typeof e==`string`?mye(e):Array.isArray(e)?e:[e]),c=this.getAlias(e);Array.isArray(c)?c.forEach(n):n(c);let l=[],u=e=>({src:e,...this._parsers.find(t=>t.test(e))?.parse(e)});s.forEach(t=>{t.forEach(t=>{let n={};if(typeof t==`object`?(r=t.data??r,i=t.format??i,(t.loadParser||t.parser)&&(a=t.loadParser??a,o=t.parser??o),n={...u(t.src),...t}):n=u(t),!c)throw Error(`[Resolver] alias is undefined for this asset: ${n.src}`);n=this._buildResolvedAsset(n,{aliases:c,data:r,format:i,loadParser:a,parser:o,progressSize:e.progressSize}),l.push(n)})}),c.forEach(e=>{this._assetMap[e]=l})})}resolveBundle(e){let t=Qw(e);e=Uw(e);let n={};return e.forEach(e=>{let t=this._bundles[e];if(t){let r=this.resolve(t),i={};for(let t in r){let n=r[t];i[this._extractAssetIdFromBundle(e,t)]=n}n[e]=i}}),t?n[e[0]]:n}resolveUrl(e){let t=this.resolve(e);if(typeof e!=`string`){let e={};for(let n in t)e[n]=t[n].src;return e}return t.src}resolve(e){let t=Qw(e);e=Uw(e);let n={};return e.forEach(e=>{if(!this._resolverHash[e])if(this._assetMap[e]){let t=this._assetMap[e],n=this._getPreferredOrder(t);n?.priority.forEach(e=>{n.params[e].forEach(n=>{let r=t.filter(t=>t[e]?t[e]===n:!1);r.length&&(t=r)})}),this._resolverHash[e]=t[0]}else this._resolverHash[e]=this._buildResolvedAsset({alias:[e],src:e},{});n[e]=this._resolverHash[e]}),t?n[e[0]]:n}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){let n=e[t],r=this._preferredOrder.find(e=>e.params.format.includes(n.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){return this._defaultSearchParams?`${e}${/\?/.test(e)?`&`:`?`}${this._defaultSearchParams}`:e}_buildResolvedAsset(e,t){let{aliases:n,data:r,loadParser:i,parser:a,format:o,progressSize:s}=t;return(this._basePath||this._rootPath)&&(e.src=Xw.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=n??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=i??e.loadParser,e.parser=a??e.parser,e.format=o??e.format??hye(e.src),s!==void 0&&(e.progressSize=s),e}};$w.RETINA_PREFIX=/@([0-9\.]+)x/;function hye(e){return e.split(`.`).pop().split(`?`).shift().split(`#`).shift()}var eT=(e,t)=>{let n=t.split(`?`)[1];return n&&(e+=`?${n}`),e},tT=class e{constructor(e,t){this.linkedSheets=[];let n=e;e?.source instanceof O&&(n={texture:e,data:t});let{texture:r,data:i,cachePrefix:a=``}=n;this.cachePrefix=a,this._texture=r instanceof f?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=i;let o=parseFloat(i.meta.scale);o?(this.resolution=o,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,n=!1){let r=t,i=n?1/0:e.BATCH_SIZE;for(;r-t<i&&r<this._frameKeys.length;){let e=this._frameKeys[r],t=this._frames[e],n=t.frame;if(n){let r=null,i=null,a=t.trimmed!==!1&&t.sourceSize?t.sourceSize:t.frame,o=new M(0,0,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution);r=t.rotated?new M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),t.trimmed!==!1&&t.spriteSourceSize&&(i=new M(Math.floor(t.spriteSourceSize.x)/this.resolution,Math.floor(t.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[e]=new f({source:this.textureSource,frame:r,orig:o,trim:i,rotate:t.rotated?2:0,defaultAnchor:t.anchor,defaultBorders:t.borders,label:e.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let t in e){this.animations[t]=[];for(let n=0;n<e[t].length;n++){let r=e[t][n];this.animations[t].push(this.textures[r])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*e.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*e.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};tT.BATCH_SIZE=1e3;var nT=tT,gye=[`jpg`,`png`,`jpeg`,`avif`,`webp`,`basis`,`etc2`,`bc7`,`bc6h`,`bc5`,`bc4`,`bc3`,`bc2`,`bc1`,`eac`,`astc`];function rT(e,t,n){let r={};if(e.forEach(e=>{r[e]=t}),Object.keys(t.textures).forEach(e=>{r[`${t.cachePrefix}${e}`]=t.textures[e]}),!n){let n=Xw.dirname(e[0]);t.linkedSheets.forEach((e,i)=>{let a=rT([`${n}/${t.data.meta.related_multi_packs[i]}`],e,!0);Object.assign(r,a)})}return r}var _ye={extension:H.Asset,cache:{test:e=>e instanceof nT,getCacheableAssets:(e,t)=>rT(e,t,!1)},resolver:{extension:{type:H.ResolveParser,name:`resolveSpritesheet`},test:e=>{let t=e.split(`?`)[0].split(`.`),n=t.pop(),r=t.pop();return n===`json`&&gye.includes(r)},parse:e=>{let t=e.split(`.`);return{resolution:parseFloat($w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:t[t.length-2],src:e}}},loader:{name:`spritesheetLoader`,id:`spritesheet`,extension:{type:H.LoadParser,priority:qw.Normal,name:`spritesheetLoader`},async testParse(e,t){return Xw.extname(t.src).toLowerCase()===`.json`&&!!e.frames},async parse(e,t,n){let{texture:r,imageFilename:i,textureOptions:a,cachePrefix:o}=t?.data??{},s=Xw.dirname(t.src);s&&s.lastIndexOf(`/`)!==s.length-1&&(s+=`/`);let c;if(r instanceof f)c=r;else{let r=eT(s+(i??e.meta.image),t.src);c=(await n.load([{src:r,data:a}]))[r]}let l=new nT({texture:c.source,data:e,cachePrefix:o});await l.parse();let u=e?.meta?.related_multi_packs;if(Array.isArray(u)){let e=[];for(let r of u){if(typeof r!=`string`)continue;let i=s+r;t.data?.ignoreMultiPack||(i=eT(i,t.src),e.push(n.load({src:i,data:{textureOptions:a,ignoreMultiPack:!0}})))}let r=await Promise.all(e);l.linkedSheets=r,r.forEach(e=>{e.linkedSheets=[l].concat(l.linkedSheets.filter(t=>t!==e))})}return l},async unload(e,t,n){await n.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}};V.add(_ye);var vye=class{constructor(e){this._lastTransform=``,this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),t=this._canvas.width,n=this._canvas.height,r=e.width/t*this._renderer.resolution,i=e.height/n*this._renderer.resolution,a=`translate(${e.left}px, ${e.top}px) scale(${r}, ${i})`;a!==this._lastTransform&&(this._domElement.style.transform=a,this._lastTransform=a)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){`ResizeObserver`in globalThis?(this._observer&&=(this._observer.disconnect(),null),this._observer=new ResizeObserver(e=>{for(let t of e){if(t.target!==this._canvas)continue;let e=this.canvas.width,n=this.canvas.height,r=t.contentRect.width/e*this._renderer.resolution,i=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==r||this._lastScaleY!==i)&&(this.updateTranslation(),this._lastScaleX=r,this._lastScaleY=i)}}),this._observer.observe(this._canvas)):this._tickerAttached||te.shared.add(this.updateTranslation,this,z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&te.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform=``,this._lastScaleX=null,this._lastScaleY=null}},iT=class e{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=e.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new L,this.page=new L,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,n){throw Error(`initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}initUIEvent(e,t,n,r,i){throw Error(`initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}},aT=/iPhone/i,oT=/iPod/i,sT=/iPad/i,cT=/\biOS-universal(?:.+)Mac\b/i,lT=/\bAndroid(?:.+)Mobile\b/i,uT=/Android/i,dT=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,fT=/Silk/i,pT=/Windows Phone/i,mT=/\bWindows(?:.+)ARM\b/i,hT=/BlackBerry/i,gT=/BB10/i,_T=/Opera Mini/i,vT=/\b(CriOS|Chrome)(?:.+)Mobile/i,yT=/Mobile(?:.+)Firefox\b/i,bT=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function yye(e){return function(t){return t.test(e)}}function bye(e){var t={userAgent:``,platform:``,maxTouchPoints:0};!e&&typeof navigator<`u`?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e==`string`?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=yye(n),a={apple:{phone:i(aT)&&!i(pT),ipod:i(oT),tablet:!i(aT)&&(i(sT)||bT(t))&&!i(pT),universal:i(cT),device:(i(aT)||i(oT)||i(sT)||i(cT)||bT(t))&&!i(pT)},amazon:{phone:i(dT),tablet:!i(dT)&&i(fT),device:i(dT)||i(fT)},android:{phone:!i(pT)&&i(dT)||!i(pT)&&i(lT),tablet:!i(pT)&&!i(dT)&&!i(lT)&&(i(fT)||i(uT)),device:!i(pT)&&(i(dT)||i(fT)||i(lT)||i(uT))||i(/\bokhttp\b/i)},windows:{phone:i(pT),tablet:i(mT),device:i(pT)||i(mT)},other:{blackberry:i(hT),blackberry10:i(gT),opera:i(_T),firefox:i(yT),chrome:i(vT),device:i(hT)||i(gT)||i(_T)||i(yT)||i(vT)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var xye=(bye.default??bye)(globalThis.navigator),Sye=9,Cye=100,wye=0,Tye=0,Eye=2,Dye=1,Oye=-1e3,kye=-1e3,Aye=2,xT=class e{constructor(e,t=xye){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let e=document.createElement(`button`);e.style.width=`${Dye}px`,e.style.height=`${Dye}px`,e.style.position=`absolute`,e.style.top=`${Oye}px`,e.style.left=`${kye}px`,e.style.zIndex=Aye.toString(),e.style.backgroundColor=`#FF0000`,e.title=`select to enable accessibility for this content`,e.addEventListener(`focus`,()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&=(document.body.removeChild(this._hookDiv),null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement(`div`),this._div.style.position=`absolute`,this._div.style.top=`${wye}px`,this._div.style.left=`${Tye}px`,this._div.style.pointerEvents=`none`,this._div.style.zIndex=Eye.toString(),this._canvasObserver=new vye({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener(`mousemove`,this._boundOnMouseMove,!0);let e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener(`mousemove`,this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(let e in this._pools)this._pools[e].forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let e=0;e<t.length;e++)this._updateAccessibleObjects(t[e])}init(t){let n={accessibilityOptions:{...e.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=n.accessibilityOptions.debug,this._activateOnTab=n.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=n.accessibilityOptions.deactivateOnMouseMove,n.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;let t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let e of this._children)e._renderId===this._renderId&&t.add(this._children.indexOf(e))}for(let e=this._children.length-1;e>=0;e--){let n=this._children[e];t.has(e)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,S(this._children,e,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let e=0;e<this._children.length;e++){let t=this._children[e];if(!t._accessibleActive||!t._accessibleDiv)continue;let n=t._accessibleDiv,r=t.hitArea||t.getBounds().rectangle;if(t.hitArea){let e=t.worldTransform;n.style.left=`${e.tx+r.x*e.a}px`,n.style.top=`${e.ty+r.y*e.d}px`,n.style.width=`${r.width*e.a}px`,n.style.height=`${r.height*e.d}px`}else this._capHitArea(r),n.style.left=`${r.x}px`,n.style.top=`${r.y}px`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:n}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>n&&(e.height=n-e.y)}_addChild(e){let t=this._getPool(e.accessibleType).pop();t?(t.innerHTML=``,t.removeAttribute(`title`),t.removeAttribute(`aria-label`),t.tabIndex=0):(e.accessibleType===`button`?t=document.createElement(`button`):(t=document.createElement(e.accessibleType),t.style.cssText=`
725
+ </dialog>`:e}};customElements.define(`input-panel`,tye);var nye={extension:{type:H.Environment,name:`browser`,priority:-1},test:()=>!0,load:async()=>{await l(()=>import(`./browserAll-Dp578vps.js`),__vite__mapDeps([3,4,2,5]))}},rye={extension:{type:H.Environment,name:`webworker`,priority:0},test:()=>typeof self<`u`&&self.WorkerGlobalScope!==void 0,load:async()=>{await l(()=>import(`./webworkerAll-CONHxfi1.js`),__vite__mapDeps([6,4,2,5]))}},iye=new E;function Lw(e,t,n){let r=iye;e.measurable=!0,re(e,n,r),t.addBoundsMask(r),e.measurable=!1}function Rw(e,t,n){let r=d.get();e.measurable=!0;let i=ne.get().identity();D(e,r,aye(e,n,i)),e.measurable=!1,t.addBoundsMask(r),ne.return(i),d.return(r)}function aye(e,t,n){return e?(e!==t&&(aye(e.parent,t,n),e.updateLocalTransform(),n.append(e.localTransform)),n):(v(`Mask bounds, renderable is not inside the root container`),n)}var oye=class{constructor(e){this.priority=0,this.inverse=!1,this.pipe=`alphaMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof ve),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||Lw(this.mask,e,t)}addLocalBounds(e,t){Rw(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof ve}};oye.extension=H.MaskEffect;var zw=class{constructor(e){this.priority=0,this.pipe=`colorMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e==`number`}};zw.extension=H.MaskEffect;var Bw=class{constructor(e){this.priority=0,this.pipe=`stencilMask`,e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){Lw(this.mask,e,t)}addLocalBounds(e,t){Rw(this.mask,e,t)}containsPoint(e,t){let n=this.mask;return t(n,e)}destroy(){this.reset()}static test(e){return e instanceof _e}};Bw.extension=H.MaskEffect;var Vw;async function sye(){return Vw??=(async()=>{let e=he.get().createCanvas(1,1).getContext(`webgl`);if(!e)return`premultiply-alpha-on-upload`;let t=await new Promise(e=>{let t=document.createElement(`video`);t.onloadeddata=()=>e(t),t.onerror=()=>e(null),t.autoplay=!1,t.crossOrigin=`anonymous`,t.preload=`auto`,t.src=`data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=`,t.load()});if(!t)return`premultiply-alpha-on-upload`;let n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(r),e.deleteTexture(n),e.getExtension(`WEBGL_lose_context`)?.loseContext(),i[0]<=i[3]?`premultiplied-alpha`:`premultiply-alpha-on-upload`})(),Vw}var Hw=class e extends O{constructor(t){super(t),this.isReady=!1,this.uploadMethodId=`video`,t={...e.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??`premultiply-alpha-on-upload`,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let e=te.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener(`play`,this._onPlayStart),e.addEventListener(`pause`,this._onPlayStop),e.addEventListener(`seeked`,this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener(`canplay`,this._onCanPlay),e.addEventListener(`canplaythrough`,this._onCanPlayThrough),e.addEventListener(`error`,this._onError,!0)),this.alphaMode=await sye(),this._load=new Promise((n,r)=>{this.isValid?n(this):(this._resolve=n,this._reject=r,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener(`error`,this._onError,!0),this.emit(`error`,e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener(`canplay`,this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener(`canplaythrough`,this._onCanPlay),this._preloadTimeout&&=(clearTimeout(this._preloadTimeout),void 0),this._mediaReady()}_mediaReady(){let e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let e=this.resource;e&&(e.removeEventListener(`play`,this._onPlayStart),e.removeEventListener(`pause`,this._onPlayStop),e.removeEventListener(`seeked`,this._onSeeked),e.removeEventListener(`canplay`,this._onCanPlay),e.removeEventListener(`canplaythrough`,this._onCanPlayThrough),e.removeEventListener(`error`,this._onError,!0),e.pause(),e.src=``,e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(te.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(te.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(te.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Hw.extension=H.TextureSource,Hw.defaultOptions={...O.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Hw.MIME_TYPES={ogv:`video/ogg`,mov:`video/quicktime`,m4v:`video/mp4`};var cye=Hw,Uw=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>typeof e==`string`||n?t(e):e):e),Ww=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||v(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let n=Uw(e),r;for(let e=0;e<this.parsers.length;e++){let i=this.parsers[e];if(i.test(t)){r=i.getCacheableAssets(n,t);break}}let i=new Map(Object.entries(r||{}));r||n.forEach(e=>{i.set(e,t)});let a=[...i.keys()],o={cacheKeys:a,keys:n};n.forEach(e=>{this._cacheMap.set(e,o)}),a.forEach(e=>{let n=r?r[e]:t;this._cache.has(e)&&this._cache.get(e)!==n&&v(`[Cache] already has key:`,e),this._cache.set(e,i.get(e))})}remove(e){if(!this._cacheMap.has(e)){v(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(e=>{this._cache.delete(e)}),t.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}},Gw=[];V.handleByList(H.TextureSource,Gw);function Kw(e={}){let t=e&&e.resource,n=t?e.resource:e,r=t?e:{resource:e};for(let e=0;e<Gw.length;e++){let t=Gw[e];if(t.test(n))return new t(r)}throw Error(`Could not find a source type for resource: ${r.resource}`)}function lye(e={},t=!1){let n=e&&e.resource,r=n?e.resource:e,i=n?e:{resource:e};if(!t&&Ww.has(r))return Ww.get(r);let a=new f({source:Kw(i)});return a.on(`destroy`,()=>{Ww.has(r)&&Ww.remove(r)}),t||Ww.set(r,a),a}function uye(e,t=!1){return typeof e==`string`?Ww.get(e):e instanceof O?new f({source:e}):lye(e,t)}f.from=uye,O.from=Kw,V.add(oye,zw,Bw,cye,be,N,_);var qw=(e=>(e[e.Low=0]=`Low`,e[e.Normal=1]=`Normal`,e[e.High=2]=`High`,e))(qw||{});function Jw(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function Yw(e){return e.split(`?`)[0].split(`#`)[0]}function dye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fye(e,t,n){return e.replace(new RegExp(dye(t),`g`),n)}function pye(e,t){let n=``,r=0,i=-1,a=0,o=-1;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}var Xw={toPosix(e){return fye(e,`\\`,`/`)},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith(`blob:`)},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){Jw(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let n=/^[^/:]+:\/{0,2}/.exec(e);return n?n[0]:``},toAbsolute(e,t,n){if(Jw(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=Yw(this.toPosix(t??he.get().getBaseUrl())),i=Yw(this.toPosix(n??this.rootname(r)));return e=this.toPosix(e),e.startsWith(`/`)?Xw.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(Jw(e),e.length===0)return`.`;if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t=``,n=e.startsWith(`/`);this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith(`/`);return e=pye(e,!1),e.length>0&&r&&(e+=`/`),n?`/${e}`:t+e},isAbsolute(e){return Jw(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith(`/`)},join(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];if(Jw(r),r.length>0)if(t===void 0)t=r;else{let i=e[n-1]??``;this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?`.`:this.normalize(t)},dirname(e){if(Jw(e),e.length===0)return`.`;e=this.toPosix(e);let t=e.charCodeAt(0),n=t===47,r=-1,i=!0,a=this.getProtocol(e),o=e;e=e.slice(a.length);for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:this.isUrl(o)?a+e:a:n&&r===1?`//`:a+e.slice(0,r)},rootname(e){Jw(e),e=this.toPosix(e);let t=``;if(t=e.startsWith(`/`)?`/`:this.getProtocol(e),this.isUrl(e)){let n=e.indexOf(`/`,t.length);t=n===-1?e:e.slice(0,n),t.endsWith(`/`)||(t+=`/`)}return t},basename(e,t){Jw(e),t&&Jw(t),e=Yw(this.toPosix(e));let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)},extname(e){Jw(e),e=Yw(this.toPosix(e));let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},parse(e){Jw(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;e=Yw(this.toPosix(e));let n=e.charCodeAt(0),r=this.isAbsolute(e),i;t.root=this.rootname(e),i=r||this.hasProtocol(e)?1:0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),t.dir=this.dirname(e),t},sep:`/`,delimiter:`:`,joinExtensions:[`.html`]};function Zw(e,t,n,r,i){let a=t[n];for(let o=0;o<a.length;o++){let s=a[o];n<t.length-1?Zw(e.replace(r[n],s),t,n+1,r,i):i.push(e.replace(r[n],s))}}function mye(e){let t=e.match(/\{(.*?)\}/g),n=[];if(t){let r=[];t.forEach(e=>{let t=e.substring(1,e.length-1).split(`,`);r.push(t)}),Zw(e,r,0,t,n)}else n.push(e);return n}var Qw=e=>!Array.isArray(e),$w=class{constructor(){this._defaultBundleIdentifierOptions={connector:`-`,createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,``)},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle(`foo`,this._createBundleAssetId(`foo`,`bar`))!==`bar`)throw Error(`[Resolver] GenerateBundleAssetId are not working correctly`)}prefer(...e){e.forEach(e=>{this._preferredOrder.push(e),e.priority||=Object.keys(e.params)}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e==`string`)this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join(`&`)}}getAlias(e){let{alias:t,src:n}=e;return Uw(t||n,e=>typeof e==`string`?e:Array.isArray(e)?e.map(e=>e?.src??e):e?.src?e.src:e,!0)}addManifest(e){this._manifest&&v(`[Resolver] Manifest already exists, this will be overwritten`),this._manifest=e,e.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(e,t){let n=[],r=t;Array.isArray(t)||(r=Object.entries(t).map(([e,t])=>typeof t==`string`||Array.isArray(t)?{alias:e,src:t}:{alias:e,...t})),r.forEach(t=>{let r=t.src,i=t.alias,a;if(typeof i==`string`){let t=this._createBundleAssetId(e,i);n.push(t),a=[i,t]}else{let t=i.map(t=>this._createBundleAssetId(e,t));n.push(...t),a=[...i,...t]}this.add({...t,alias:a,src:r})}),this._bundles[e]=n}add(e){let t=[];Array.isArray(e)?t.push(...e):t.push(e);let n=e=>{this.hasKey(e)&&v(`[Resolver] already has key: ${e} overwriting`)};Uw(t).forEach(e=>{let{src:t}=e,{data:r,format:i,loadParser:a,parser:o}=e,s=Uw(t).map(e=>typeof e==`string`?mye(e):Array.isArray(e)?e:[e]),c=this.getAlias(e);Array.isArray(c)?c.forEach(n):n(c);let l=[],u=e=>({src:e,...this._parsers.find(t=>t.test(e))?.parse(e)});s.forEach(t=>{t.forEach(t=>{let n={};if(typeof t==`object`?(r=t.data??r,i=t.format??i,(t.loadParser||t.parser)&&(a=t.loadParser??a,o=t.parser??o),n={...u(t.src),...t}):n=u(t),!c)throw Error(`[Resolver] alias is undefined for this asset: ${n.src}`);n=this._buildResolvedAsset(n,{aliases:c,data:r,format:i,loadParser:a,parser:o,progressSize:e.progressSize}),l.push(n)})}),c.forEach(e=>{this._assetMap[e]=l})})}resolveBundle(e){let t=Qw(e);e=Uw(e);let n={};return e.forEach(e=>{let t=this._bundles[e];if(t){let r=this.resolve(t),i={};for(let t in r){let n=r[t];i[this._extractAssetIdFromBundle(e,t)]=n}n[e]=i}}),t?n[e[0]]:n}resolveUrl(e){let t=this.resolve(e);if(typeof e!=`string`){let e={};for(let n in t)e[n]=t[n].src;return e}return t.src}resolve(e){let t=Qw(e);e=Uw(e);let n={};return e.forEach(e=>{if(!this._resolverHash[e])if(this._assetMap[e]){let t=this._assetMap[e],n=this._getPreferredOrder(t);n?.priority.forEach(e=>{n.params[e].forEach(n=>{let r=t.filter(t=>t[e]?t[e]===n:!1);r.length&&(t=r)})}),this._resolverHash[e]=t[0]}else this._resolverHash[e]=this._buildResolvedAsset({alias:[e],src:e},{});n[e]=this._resolverHash[e]}),t?n[e[0]]:n}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){let n=e[t],r=this._preferredOrder.find(e=>e.params.format.includes(n.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){return this._defaultSearchParams?`${e}${/\?/.test(e)?`&`:`?`}${this._defaultSearchParams}`:e}_buildResolvedAsset(e,t){let{aliases:n,data:r,loadParser:i,parser:a,format:o,progressSize:s}=t;return(this._basePath||this._rootPath)&&(e.src=Xw.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=n??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=i??e.loadParser,e.parser=a??e.parser,e.format=o??e.format??hye(e.src),s!==void 0&&(e.progressSize=s),e}};$w.RETINA_PREFIX=/@([0-9\.]+)x/;function hye(e){return e.split(`.`).pop().split(`?`).shift().split(`#`).shift()}var eT=(e,t)=>{let n=t.split(`?`)[1];return n&&(e+=`?${n}`),e},tT=class e{constructor(e,t){this.linkedSheets=[];let n=e;e?.source instanceof O&&(n={texture:e,data:t});let{texture:r,data:i,cachePrefix:a=``}=n;this.cachePrefix=a,this._texture=r instanceof f?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=i;let o=parseFloat(i.meta.scale);o?(this.resolution=o,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,n=!1){let r=t,i=n?1/0:e.BATCH_SIZE;for(;r-t<i&&r<this._frameKeys.length;){let e=this._frameKeys[r],t=this._frames[e],n=t.frame;if(n){let r=null,i=null,a=t.trimmed!==!1&&t.sourceSize?t.sourceSize:t.frame,o=new M(0,0,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution);r=t.rotated?new M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new M(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),t.trimmed!==!1&&t.spriteSourceSize&&(i=new M(Math.floor(t.spriteSourceSize.x)/this.resolution,Math.floor(t.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[e]=new f({source:this.textureSource,frame:r,orig:o,trim:i,rotate:t.rotated?2:0,defaultAnchor:t.anchor,defaultBorders:t.borders,label:e.toString()})}r++}}_processAnimations(){let e=this.data.animations||{};for(let t in e){this.animations[t]=[];for(let n=0;n<e[t].length;n++){let r=e[t][n];this.animations[t].push(this.textures[r])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*e.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*e.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};tT.BATCH_SIZE=1e3;var nT=tT,gye=[`jpg`,`png`,`jpeg`,`avif`,`webp`,`basis`,`etc2`,`bc7`,`bc6h`,`bc5`,`bc4`,`bc3`,`bc2`,`bc1`,`eac`,`astc`];function rT(e,t,n){let r={};if(e.forEach(e=>{r[e]=t}),Object.keys(t.textures).forEach(e=>{r[`${t.cachePrefix}${e}`]=t.textures[e]}),!n){let n=Xw.dirname(e[0]);t.linkedSheets.forEach((e,i)=>{let a=rT([`${n}/${t.data.meta.related_multi_packs[i]}`],e,!0);Object.assign(r,a)})}return r}var _ye={extension:H.Asset,cache:{test:e=>e instanceof nT,getCacheableAssets:(e,t)=>rT(e,t,!1)},resolver:{extension:{type:H.ResolveParser,name:`resolveSpritesheet`},test:e=>{let t=e.split(`?`)[0].split(`.`),n=t.pop(),r=t.pop();return n===`json`&&gye.includes(r)},parse:e=>{let t=e.split(`.`);return{resolution:parseFloat($w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:t[t.length-2],src:e}}},loader:{name:`spritesheetLoader`,id:`spritesheet`,extension:{type:H.LoadParser,priority:qw.Normal,name:`spritesheetLoader`},async testParse(e,t){return Xw.extname(t.src).toLowerCase()===`.json`&&!!e.frames},async parse(e,t,n){let{texture:r,imageFilename:i,textureOptions:a,cachePrefix:o}=t?.data??{},s=Xw.dirname(t.src);s&&s.lastIndexOf(`/`)!==s.length-1&&(s+=`/`);let c;if(r instanceof f)c=r;else{let r=eT(s+(i??e.meta.image),t.src);c=(await n.load([{src:r,data:a}]))[r]}let l=new nT({texture:c.source,data:e,cachePrefix:o});await l.parse();let u=e?.meta?.related_multi_packs;if(Array.isArray(u)){let e=[];for(let r of u){if(typeof r!=`string`)continue;let i=s+r;t.data?.ignoreMultiPack||(i=eT(i,t.src),e.push(n.load({src:i,data:{textureOptions:a,ignoreMultiPack:!0}})))}let r=await Promise.all(e);l.linkedSheets=r,r.forEach(e=>{e.linkedSheets=[l].concat(l.linkedSheets.filter(t=>t!==e))})}return l},async unload(e,t,n){await n.unload(e.textureSource._sourceOrigin),e.destroy(!1)}}};V.add(_ye);var vye=class{constructor(e){this._lastTransform=``,this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;let e=this._canvas.getBoundingClientRect(),t=this._canvas.width,n=this._canvas.height,r=e.width/t*this._renderer.resolution,i=e.height/n*this._renderer.resolution,a=`translate(${e.left}px, ${e.top}px) scale(${r}, ${i})`;a!==this._lastTransform&&(this._domElement.style.transform=a,this._lastTransform=a)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){`ResizeObserver`in globalThis?(this._observer&&=(this._observer.disconnect(),null),this._observer=new ResizeObserver(e=>{for(let t of e){if(t.target!==this._canvas)continue;let e=this.canvas.width,n=this.canvas.height,r=t.contentRect.width/e*this._renderer.resolution,i=t.contentRect.height/n*this._renderer.resolution;(this._lastScaleX!==r||this._lastScaleY!==i)&&(this.updateTranslation(),this._lastScaleX=r,this._lastScaleY=i)}}),this._observer.observe(this._canvas)):this._tickerAttached||te.shared.add(this.updateTranslation,this,z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&te.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform=``,this._lastScaleX=null,this._lastScaleY=null}},iT=class e{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=e.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new L,this.page=new L,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,n){throw Error(`initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}initUIEvent(e,t,n,r,i){throw Error(`initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}},aT=/iPhone/i,oT=/iPod/i,sT=/iPad/i,cT=/\biOS-universal(?:.+)Mac\b/i,lT=/\bAndroid(?:.+)Mobile\b/i,uT=/Android/i,dT=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,fT=/Silk/i,pT=/Windows Phone/i,mT=/\bWindows(?:.+)ARM\b/i,hT=/BlackBerry/i,gT=/BB10/i,_T=/Opera Mini/i,vT=/\b(CriOS|Chrome)(?:.+)Mobile/i,yT=/Mobile(?:.+)Firefox\b/i,bT=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function yye(e){return function(t){return t.test(e)}}function bye(e){var t={userAgent:``,platform:``,maxTouchPoints:0};!e&&typeof navigator<`u`?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e==`string`?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=yye(n),a={apple:{phone:i(aT)&&!i(pT),ipod:i(oT),tablet:!i(aT)&&(i(sT)||bT(t))&&!i(pT),universal:i(cT),device:(i(aT)||i(oT)||i(sT)||i(cT)||bT(t))&&!i(pT)},amazon:{phone:i(dT),tablet:!i(dT)&&i(fT),device:i(dT)||i(fT)},android:{phone:!i(pT)&&i(dT)||!i(pT)&&i(lT),tablet:!i(pT)&&!i(dT)&&!i(lT)&&(i(fT)||i(uT)),device:!i(pT)&&(i(dT)||i(fT)||i(lT)||i(uT))||i(/\bokhttp\b/i)},windows:{phone:i(pT),tablet:i(mT),device:i(pT)||i(mT)},other:{blackberry:i(hT),blackberry10:i(gT),opera:i(_T),firefox:i(yT),chrome:i(vT),device:i(hT)||i(gT)||i(_T)||i(yT)||i(vT)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var xye=(bye.default??bye)(globalThis.navigator),Sye=9,Cye=100,wye=0,Tye=0,Eye=2,Dye=1,Oye=-1e3,kye=-1e3,Aye=2,xT=class e{constructor(e,t=xye){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){let e=document.createElement(`button`);e.style.width=`${Dye}px`,e.style.height=`${Dye}px`,e.style.position=`absolute`,e.style.top=`${Oye}px`,e.style.left=`${kye}px`,e.style.zIndex=Aye.toString(),e.style.backgroundColor=`#FF0000`,e.title=`select to enable accessibility for this content`,e.addEventListener(`focus`,()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&=(document.body.removeChild(this._hookDiv),null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement(`div`),this._div.style.position=`absolute`,this._div.style.top=`${wye}px`,this._div.style.left=`${Tye}px`,this._div.style.pointerEvents=`none`,this._div.style.zIndex=Eye.toString(),this._canvasObserver=new vye({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener(`mousemove`,this._boundOnMouseMove,!0);let e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{let t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener(`mousemove`,this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener(`keydown`,this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(let e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(let e in this._pools)this._pools[e].forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);let t=e.children;if(t)for(let e=0;e<t.length;e++)this._updateAccessibleObjects(t[e])}init(t){let n={accessibilityOptions:{...e.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=n.accessibilityOptions.debug,this._activateOnTab=n.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=n.accessibilityOptions.deactivateOnMouseMove,n.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){let e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;let t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let e of this._children)e._renderId===this._renderId&&t.add(this._children.indexOf(e))}for(let e=this._children.length-1;e>=0;e--){let n=this._children[e];t.has(e)||(n._accessibleDiv&&n._accessibleDiv.parentNode&&(n._accessibleDiv.parentNode.removeChild(n._accessibleDiv),this._getPool(n.accessibleType).push(n._accessibleDiv),n._accessibleDiv=null),n._accessibleActive=!1,S(this._children,e,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let e=0;e<this._children.length;e++){let t=this._children[e];if(!t._accessibleActive||!t._accessibleDiv)continue;let n=t._accessibleDiv,r=t.hitArea||t.getBounds().rectangle;if(t.hitArea){let e=t.worldTransform;n.style.left=`${e.tx+r.x*e.a}px`,n.style.top=`${e.ty+r.y*e.d}px`,n.style.width=`${r.width*e.a}px`,n.style.height=`${r.height*e.d}px`}else this._capHitArea(r),n.style.left=`${r.x}px`,n.style.top=`${r.y}px`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:n}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>n&&(e.height=n-e.y)}_addChild(e){let t=this._getPool(e.accessibleType).pop();t?(t.innerHTML=``,t.removeAttribute(`title`),t.removeAttribute(`aria-label`),t.tabIndex=0):(e.accessibleType===`button`?t=document.createElement(`button`):(t=document.createElement(e.accessibleType),t.style.cssText=`
726
726
  color: transparent;
727
727
  pointer-events: none;
728
728
  padding: 0;
@@ -735,7 +735,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
735
735
  -webkit-user-select: none;
736
736
  -moz-user-select: none;
737
737
  -ms-user-select: none;
738
- `,e.accessibleText&&(t.innerText=e.accessibleText)),t.style.width=`${Cye}px`,t.style.height=`${Cye}px`,t.style.backgroundColor=this.debug?`rgba(255,255,255,0.5)`:`transparent`,t.style.position=`absolute`,t.style.zIndex=Eye.toString(),t.style.borderStyle=`none`,navigator.userAgent.toLowerCase().includes(`chrome`)?t.setAttribute(`aria-live`,`off`):t.setAttribute(`aria-live`,`polite`),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute(`aria-relevant`,`additions`):t.setAttribute(`aria-relevant`,`text`),t.addEventListener(`click`,this._onClick.bind(this)),t.addEventListener(`focus`,this._onFocus.bind(this)),t.addEventListener(`focusout`,this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute(`aria-label`,e.accessibleHint),e.interactive?t.tabIndex=e.tabIndex:t.tabIndex=0,this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){let{container:n}=e.target,r=this._renderer.events.rootBoundary,i=Object.assign(new iT(r),{target:n});r.rootTarget=this._renderer.lastObjectRendered,t.forEach(e=>r.dispatchEvent(i,e))}_onClick(e){this._dispatchEvent(e,[`click`,`pointertap`,`tap`])}_onFocus(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`assertive`),this._dispatchEvent(e,[`mouseover`])}_onFocusOut(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`polite`),this._dispatchEvent(e,[`mouseout`])}_onKeyDown(e){e.keyCode!==Sye||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener(`keydown`,this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener(`mousemove`,this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};xT.extension={type:[H.WebGLSystem,H.WebGPUSystem],name:`accessibility`},xT.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};var jye=xT,Mye={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:`button`,accessibleText:null,accessiblePointerEvents:`auto`,accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1},ST;function Nye(e){return ST===void 0&&(ST=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??Se.defaultOptions.failIfMajorPerformanceCaveat};try{if(!he.get().getWebGLRenderingContext())return!1;let e=he.get().createCanvas().getContext(`webgl`,t),n=!!e?.getContextAttributes()?.stencil;if(e){let t=e.getExtension(`WEBGL_lose_context`);t&&t.loseContext()}return e=null,n}catch{return!1}})()),ST}var CT;async function Pye(e={}){return CT===void 0&&(CT=await(async()=>{let t=he.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),CT}var Fye=[`webgl`,`webgpu`,`canvas`];async function Iye(e){let t=[];e.preference?(t.push(e.preference),Fye.forEach(n=>{n!==e.preference&&t.push(n)})):t=Fye.slice();let n,r={};for(let i=0;i<t.length;i++){let a=t[i];if(a===`webgpu`&&await Pye()){let{WebGPURenderer:t}=await l(async()=>{let{WebGPURenderer:e}=await import(`./WebGPURenderer-BigtxJOU.js`);return{WebGPURenderer:e}},__vite__mapDeps([7,4,2]));n=t,r={...e,...e.webgpu};break}else if(a===`webgl`&&Nye(e.failIfMajorPerformanceCaveat??Se.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:t}=await l(async()=>{let{WebGLRenderer:e}=await import(`./WebGLRenderer-D1gtW4Wt.js`);return{WebGLRenderer:e}},__vite__mapDeps([8,4,2]));n=t,r={...e,...e.webgl};break}else if(a===`canvas`){let{CanvasRenderer:t}=await l(async()=>{let{CanvasRenderer:e}=await import(`./CanvasRenderer-CrOGFh2A.js`);return{CanvasRenderer:e}},__vite__mapDeps([9,4,2]));n=t,r={...e,...e.canvasOptions};break}}if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!n)throw Error(`No available renderer for the current environment`);let i=new n;return await i.init(r),i}var Lye=class{static init(e){Object.defineProperty(this,`resizeTo`,{configurable:!0,set(e){globalThis.removeEventListener(`resize`,this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener(`resize`,this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&=(cancelAnimationFrame(this._resizeId),null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,t;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{let{clientWidth:n,clientHeight:r}=this._resizeTo;e=n,t=r}this.renderer.resize(e,t),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener(`resize`,this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Lye.extension=H.Application;var wT=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,`ticker`,{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,z.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?te.shared:new te,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};wT.extension=H.Application,V.add(Lye),V.add(wT);var TT=class e{constructor(...e){this.stage=new _e,e[0]!==void 0&&le(y,`Application constructor options are deprecated, please use Application.init() instead.`)}async init(t){t={...t},this.stage||=new _e,this.renderer=await Iye(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return le(y,`Application.view is deprecated, please use Application.canvas instead.`),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,n=!1){let r=e._plugins.slice(0);r.reverse(),r.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(n),this.stage=null,this.renderer.destroy(t),this.renderer=null}};TT._plugins=[];var ET=TT;V.handleByList(H.Application,ET._plugins),V.add(Ce);var Rye=e(i(((e,t)=>{t.exports=i;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function i(e){var t=[];return e.replace(r,function(e,r,i){var a=r.toLowerCase();for(i=o(i),a==`m`&&i.length>2&&(t.push([r].concat(i.splice(0,2))),a=`l`,r=r==`m`?`l`:`L`);;){if(i.length==n[a])return i.unshift(r),t.push(i);if(i.length<n[a])throw Error(`malformed path data`);t.push([r].concat(i.splice(0,n[a])))}}),t}var a=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function o(e){var t=e.match(a);return t?t.map(Number):[]}}))(),1);function zye(e,t){let n=(0,Rye.default)(e),r=[],i=null,a=0,o=0;for(let e=0;e<n.length;e++){let s=n[e],c=s[0],l=s;switch(c){case`M`:a=l[1],o=l[2],t.moveTo(a,o);break;case`m`:a+=l[1],o+=l[2],t.moveTo(a,o);break;case`H`:a=l[1],t.lineTo(a,o);break;case`h`:a+=l[1],t.lineTo(a,o);break;case`V`:o=l[1],t.lineTo(a,o);break;case`v`:o+=l[1],t.lineTo(a,o);break;case`L`:a=l[1],o=l[2],t.lineTo(a,o);break;case`l`:a+=l[1],o+=l[2],t.lineTo(a,o);break;case`C`:a=l[5],o=l[6],t.bezierCurveTo(l[1],l[2],l[3],l[4],a,o);break;case`c`:t.bezierCurveTo(a+l[1],o+l[2],a+l[3],o+l[4],a+l[5],o+l[6]),a+=l[5],o+=l[6];break;case`S`:a=l[3],o=l[4],t.bezierCurveToShort(l[1],l[2],a,o);break;case`s`:t.bezierCurveToShort(a+l[1],o+l[2],a+l[3],o+l[4]),a+=l[3],o+=l[4];break;case`Q`:a=l[3],o=l[4],t.quadraticCurveTo(l[1],l[2],a,o);break;case`q`:t.quadraticCurveTo(a+l[1],o+l[2],a+l[3],o+l[4]),a+=l[3],o+=l[4];break;case`T`:a=l[1],o=l[2],t.quadraticCurveToShort(a,o);break;case`t`:a+=l[1],o+=l[2],t.quadraticCurveToShort(a,o);break;case`A`:a=l[6],o=l[7],t.arcToSvg(l[1],l[2],l[3],l[4],l[5],a,o);break;case`a`:a+=l[6],o+=l[7],t.arcToSvg(l[1],l[2],l[3],l[4],l[5],a,o);break;case`Z`:case`z`:t.closePath(),r.length>0&&(i=r.pop(),i?(a=i.startX,o=i.startY):(a=0,o=0)),i=null;break;default:v(`Unknown SVG path command: ${c}`)}c!==`Z`&&c!==`z`&&i===null&&(i={startX:a,startY:o},r.push(i))}return t}var Bye=class e{constructor(e=0,t=0,n=0){this.type=`circle`,this.x=e,this.y=t,this.radius=n}clone(){return new e(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let n=this.radius*this.radius,r=this.x-e,i=this.y-t;return r*=r,i*=i,r+i<=n}strokeContains(e,t,n,r=.5){if(this.radius===0)return!1;let i=this.x-e,a=this.y-t,o=this.radius,s=(1-r)*n,c=Math.sqrt(i*i+a*a);return c<=o+s&&c>o-(n-s)}getBounds(e){return e||=new M,e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}},Vye=class e{constructor(e=0,t=0,n=0,r=0){this.type=`ellipse`,this.x=e,this.y=t,this.halfWidth=n,this.halfHeight=r}clone(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let n=(e-this.x)/this.halfWidth,r=(t-this.y)/this.halfHeight;return n*=n,r*=r,n+r<=1}strokeContains(e,t,n,r=.5){let{halfWidth:i,halfHeight:a}=this;if(i<=0||a<=0)return!1;let o=n*(1-r),s=n-o,c=i-s,l=a-s,u=i+o,d=a+o,f=e-this.x,p=t-this.y,m=f*f/(c*c)+p*p/(l*l),h=f*f/(u*u)+p*p/(d*d);return m>1&&h<=1}getBounds(e){return e||=new M,e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};function Hye(e,t,n,r,i,a){let o=e-n,s=t-r,c=i-n,l=a-r,u=o*c+s*l,d=c*c+l*l,f=-1;d!==0&&(f=u/d);let p,m;f<0?(p=n,m=r):f>1?(p=i,m=a):(p=n+f*c,m=r+f*l);let h=e-p,g=t-m;return h*h+g*g}var Uye,Wye,DT=class e{constructor(...e){this.type=`polygon`;let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!=`number`){let e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n].x,t[n].y);t=e}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,n=t.length;for(let r=0;r<n;r+=2){let i=t[r],a=t[r+1],o=t[(r+2)%n],s=t[(r+3)%n];e+=(o-i)*(s+a)}return e<0}containsPolygon(e){let t=this.getBounds(Uye),n=e.getBounds(Wye);if(!t.containsRect(n))return!1;let r=e.points;for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];if(!this.contains(t,n))return!1}return!0}clone(){let t=new e(this.points.slice());return t.closePath=this.closePath,t}contains(e,t){let n=!1,r=this.points.length/2;for(let i=0,a=r-1;i<r;a=i++){let r=this.points[i*2],o=this.points[i*2+1],s=this.points[a*2],c=this.points[a*2+1];o>t!=c>t&&e<(s-r)*((t-o)/(c-o))+r&&(n=!n)}return n}strokeContains(e,t,n,r=.5){let i=n*n,a=i*(1-r),o=i-a,{points:s}=this,c=s.length-(this.closePath?0:2);for(let n=0;n<c;n+=2){let r=s[n],i=s[n+1],c=s[(n+2)%s.length],l=s[(n+3)%s.length];if(Hye(e,t,r,i,c,l)<=(Math.sign((c-r)*(t-i)-(l-i)*(e-r))<0?o:a))return!0}return!1}getBounds(e){e||=new M;let t=this.points,n=1/0,r=-1/0,i=1/0,a=-1/0;for(let e=0,o=t.length;e<o;e+=2){let o=t[e],s=t[e+1];n=o<n?o:n,r=o>r?o:r,i=s<i?s:i,a=s>a?s:a}return e.x=n,e.width=r-n,e.y=i,e.height=a-i,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,``)}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return le(`8.11.0`,`Polygon.lastX is deprecated, please use Polygon.lastX instead.`),this.points[this.points.length-2]}get y(){return le(`8.11.0`,`Polygon.y is deprecated, please use Polygon.lastY instead.`),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}},OT=(e,t,n,r,i,a,o)=>{let s=e-n,c=t-r,l=Math.sqrt(s*s+c*c);return l>=i-a&&l<=i+o},Gye=class e{constructor(e=0,t=0,n=0,r=0,i=20){this.type=`roundedRectangle`,this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i}getBounds(e){return e||=new M,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new e(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+n&&t<=this.y+this.height-n||e>=this.x+n&&e<=this.x+this.width-n)return!0;let r=e-(this.x+n),i=t-(this.y+n),a=n*n;if(r*r+i*i<=a||(r=e-(this.x+this.width-n),r*r+i*i<=a)||(i=t-(this.y+this.height-n),r*r+i*i<=a)||(r=e-(this.x+n),r*r+i*i<=a))return!0}return!1}strokeContains(e,t,n,r=.5){let{x:i,y:a,width:o,height:s,radius:c}=this,l=n*(1-r),u=n-l,d=i+c,f=a+c,p=o-c*2,m=s-c*2,h=i+o,g=a+s;return(e>=i-l&&e<=i+u||e>=h-u&&e<=h+l)&&t>=f&&t<=f+m||(t>=a-l&&t<=a+u||t>=g-u&&t<=g+l)&&e>=d&&e<=d+p?!0:e<d&&t<f&&OT(e,t,d,f,c,u,l)||e>h-c&&t<f&&OT(e,t,h-c,f,c,u,l)||e>h-c&&t>g-c&&OT(e,t,h-c,g-c,c,u,l)||e<d&&t>g-c&&OT(e,t,d,g-c,c,u,l)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};function Kye(e,t,n,r,i,a,o,s=null){let c=0;n*=t,i*=a;let l=s.a,u=s.b,d=s.c,f=s.d,p=s.tx,m=s.ty;for(;c<o;){let o=e[n],s=e[n+1];r[i]=l*o+d*s+p,r[i+1]=u*o+f*s+m,i+=a,n+=t,c++}}function qye(e,t,n,r){let i=0;for(t*=n;i<r;)e[t]=0,e[t+1]=0,t+=n,i++}function kT(e,t,n,r,i){let a=t.a,o=t.b,s=t.c,c=t.d,l=t.tx,u=t.ty;n||=0,r||=2,i||=e.length/r-n;let d=n*r;for(let t=0;t<i;t++){let t=e[d],n=e[d+1];e[d]=a*t+s*n+l,e[d+1]=o*t+c*n+u,d+=r}}var Jye=new u,AT=class{constructor(){this.packAsQuad=!1,this.batcherName=`default`,this.topology=`triangle-list`,this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:`normal`}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,n=this.renderable;return n?C(t,n.groupColor)+(this.alpha*n.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Jye}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology=`triangle-list`}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}},jT={extension:{type:H.ShapeBuilder,name:`circle`},build(e,t){let n,r,i,a,o,s;if(e.type===`circle`){let t=e;if(o=s=t.radius,o<=0)return!1;n=t.x,r=t.y,i=a=0}else if(e.type===`ellipse`){let t=e;if(o=t.halfWidth,s=t.halfHeight,o<=0||s<=0)return!1;n=t.x,r=t.y,i=a=0}else{let t=e,c=t.width/2,l=t.height/2;n=t.x+c,r=t.y+l,o=s=Math.max(0,Math.min(t.radius,Math.min(c,l))),i=c-o,a=l-s}if(i<0||a<0)return!1;let c=Math.ceil(2.3*Math.sqrt(o+s)),l=c*8+(i?4:0)+(a?4:0);if(l===0)return!1;if(c===0)return t[0]=t[6]=n+i,t[1]=t[3]=r+a,t[2]=t[4]=n-i,t[5]=t[7]=r-a,!0;let u=0,d=c*4+(i?2:0)+2,f=d,p=l,m=i+o,h=a,g=n+m,_=n-m,v=r+h;if(t[u++]=g,t[u++]=v,t[--d]=v,t[--d]=_,a){let e=r-h;t[f++]=_,t[f++]=e,t[--p]=e,t[--p]=g}for(let e=1;e<c;e++){let l=Math.PI/2*(e/c),m=i+Math.cos(l)*o,h=a+Math.sin(l)*s,g=n+m,_=n-m,v=r+h,y=r-h;t[u++]=g,t[u++]=v,t[--d]=v,t[--d]=_,t[f++]=_,t[f++]=y,t[--p]=y,t[--p]=g}m=i,h=a+s,g=n+m,_=n-m,v=r+h;let y=r-h;return t[u++]=g,t[u++]=v,t[--p]=y,t[--p]=g,i&&(t[u++]=_,t[u++]=v,t[--p]=y,t[--p]=_),!0},triangulate(e,t,n,r,i,a){if(e.length===0)return;let o=0,s=0;for(let t=0;t<e.length;t+=2)o+=e[t],s+=e[t+1];o/=e.length/2,s/=e.length/2;let c=r;t[c*n]=o,t[c*n+1]=s;let l=c++;for(let r=0;r<e.length;r+=2)t[c*n]=e[r],t[c*n+1]=e[r+1],r>0&&(i[a++]=c,i[a++]=l,i[a++]=c-1),c++;i[a++]=l+1,i[a++]=l,i[a++]=c-1}},Yye={...jT,extension:{...jT.extension,name:`ellipse`}},Xye={...jT,extension:{...jT.extension,name:`roundedRectangle`}},MT=1e-4,NT=1e-4;function Zye(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function PT(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function FT(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}function IT(e,t,n,r,i,a){let o=MT;if(e.length===0)return;let s=t,c=s.alignment;if(t.alignment!==.5){let t=Zye(e);n&&(t*=-1),c=(c-.5)*t+.5}let l=new L(e[0],e[1]),u=new L(e[e.length-2],e[e.length-1]),d=r,f=Math.abs(l.x-u.x)<o&&Math.abs(l.y-u.y)<o;if(d){e=e.slice(),f&&(e.pop(),e.pop(),u.set(e[e.length-2],e[e.length-1]));let t=(l.x+u.x)*.5,n=(u.y+l.y)*.5;e.unshift(t,n),e.push(t,n)}let p=i,m=e.length/2,h=e.length,g=p.length/2,_=s.width/2,v=_*_,y=s.miterLimit*s.miterLimit,b=e[0],x=e[1],S=e[2],C=e[3],w=0,T=0,E=-(x-C),D=b-S,O=0,k=0,A=Math.sqrt(E*E+D*D);E/=A,D/=A,E*=_,D*=_;let j=c,M=(1-j)*2,N=j*2;d||(s.cap===`round`?h+=FT(b-E*(M-N)*.5,x-D*(M-N)*.5,b-E*M,x-D*M,b+E*N,x+D*N,p,!0)+2:s.cap===`square`&&(h+=PT(b,x,E,D,M,N,!0,p))),p.push(b-E*M,x-D*M),p.push(b+E*N,x+D*N);for(let t=1;t<m-1;++t){b=e[(t-1)*2],x=e[(t-1)*2+1],S=e[t*2],C=e[t*2+1],w=e[(t+1)*2],T=e[(t+1)*2+1],E=-(x-C),D=b-S,A=Math.sqrt(E*E+D*D),E/=A,D/=A,E*=_,D*=_,O=-(C-T),k=S-w,A=Math.sqrt(O*O+k*k),O/=A,k/=A,O*=_,k*=_;let n=S-b,r=x-C,i=S-w,a=T-C,o=n*i+r*a,c=r*i-a*n,l=c<0;if(Math.abs(c)<.001*Math.abs(o)){p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),o>=0&&(s.join===`round`?h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+4:h+=2,p.push(S-O*N,C-k*N),p.push(S+O*M,C+k*M));continue}let u=(-E+b)*(-D+C)-(-E+S)*(-D+x),d=(-O+w)*(-k+C)-(-O+S)*(-k+T),f=(n*d-i*u)/c,m=(a*u-r*d)/c,g=(f-S)*(f-S)+(m-C)*(m-C),j=S+(f-S)*M,P=C+(m-C)*M,F=S-(f-S)*N,ee=C-(m-C)*N,I=Math.min(n*n+r*r,i*i+a*a),L=l?M:N;g<=I+L*L*v?s.join===`bevel`||g/v>y?(l?(p.push(j,P),p.push(S+E*N,C+D*N),p.push(j,P),p.push(S+O*N,C+k*N)):(p.push(S-E*M,C-D*M),p.push(F,ee),p.push(S-O*M,C-k*M),p.push(F,ee)),h+=2):s.join===`round`?l?(p.push(j,P),p.push(S+E*N,C+D*N),h+=FT(S,C,S+E*N,C+D*N,S+O*N,C+k*N,p,!0)+4,p.push(j,P),p.push(S+O*N,C+k*N)):(p.push(S-E*M,C-D*M),p.push(F,ee),h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+4,p.push(S-O*M,C-k*M),p.push(F,ee)):(p.push(j,P),p.push(F,ee)):(p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),s.join===`round`?l?h+=FT(S,C,S+E*N,C+D*N,S+O*N,C+k*N,p,!0)+2:h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+2:s.join===`miter`&&g/v<=y&&(l?(p.push(F,ee),p.push(F,ee)):(p.push(j,P),p.push(j,P)),h+=2),p.push(S-O*M,C-k*M),p.push(S+O*N,C+k*N),h+=2)}b=e[(m-2)*2],x=e[(m-2)*2+1],S=e[(m-1)*2],C=e[(m-1)*2+1],E=-(x-C),D=b-S,A=Math.sqrt(E*E+D*D),E/=A,D/=A,E*=_,D*=_,p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),d||(s.cap===`round`?h+=FT(S-E*(M-N)*.5,C-D*(M-N)*.5,S-E*M,C-D*M,S+E*N,C+D*N,p,!1)+2:s.cap===`square`&&(h+=PT(S,C,E,D,M,N,!1,p)));let P=NT*NT;for(let e=g;e<h+g-2;++e)b=p[e*2],x=p[e*2+1],S=p[(e+1)*2],C=p[(e+1)*2+1],w=p[(e+2)*2],T=p[(e+2)*2+1],!(Math.abs(b*(C-T)+S*(T-x)+w*(x-C))<P)&&a.push(e,e+1,e+2)}function Qye(e,t,n,r){let i=MT;if(e.length===0)return;let a=e[0],o=e[1],s=e[e.length-2],c=e[e.length-1],l=t||Math.abs(a-s)<i&&Math.abs(o-c)<i,u=n,d=e.length/2,f=u.length/2;for(let t=0;t<d;t++)u.push(e[t*2]),u.push(e[t*2+1]);for(let e=0;e<d-1;e++)r.push(f+e,f+e+1);l&&r.push(f+d-1,f)}function LT(e,t,n,r,i,a,o){let s=Ie(e,t,2);if(!s)return;for(let e=0;e<s.length;e+=3)a[o++]=s[e]+i,a[o++]=s[e+1]+i,a[o++]=s[e+2]+i;let c=i*r;for(let t=0;t<e.length;t+=2)n[c]=e[t],n[c+1]=e[t+1],c+=r}var $ye=[],ebe={extension:{type:H.ShapeBuilder,name:`polygon`},build(e,t){for(let n=0;n<e.points.length;n++)t[n]=e.points[n];return!0},triangulate(e,t,n,r,i,a){LT(e,$ye,t,n,r,i,a)}},tbe={extension:{type:H.ShapeBuilder,name:`rectangle`},build(e,t){let n=e,r=n.x,i=n.y,a=n.width,o=n.height;return a>0&&o>0?(t[0]=r,t[1]=i,t[2]=r+a,t[3]=i,t[4]=r+a,t[5]=i+o,t[6]=r,t[7]=i+o,!0):!1},triangulate(e,t,n,r,i,a){let o=0;r*=n,t[r+o]=e[0],t[r+o+1]=e[1],o+=n,t[r+o]=e[2],t[r+o+1]=e[3],o+=n,t[r+o]=e[6],t[r+o+1]=e[7],o+=n,t[r+o]=e[4],t[r+o+1]=e[5],o+=n;let s=r/n;i[a++]=s,i[a++]=s+1,i[a++]=s+2,i[a++]=s+1,i[a++]=s+3,i[a++]=s+2}},nbe={extension:{type:H.ShapeBuilder,name:`triangle`},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,!0},triangulate(e,t,n,r,i,a){let o=0;r*=n,t[r+o]=e[0],t[r+o+1]=e[1],o+=n,t[r+o]=e[2],t[r+o+1]=e[3],o+=n,t[r+o]=e[4],t[r+o+1]=e[5];let s=r/n;i[a++]=s,i[a++]=s+1,i[a++]=s+2}},RT=[{offset:0,color:`white`},{offset:1,color:`black`}],zT=class e{constructor(...t){this.uid=A(`fillGradient`),this._tick=0,this.type=`linear`,this.colorStops=[];let n=rbe(t);n={...n.type===`radial`?e.defaultRadialOptions:e.defaultLinearOptions,...g(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,n.type===`radial`?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach(e=>{this.addColorStop(e.offset,e.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:x.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:n,y:r}=this.end,i=n-e,a=r-t,o=i<0||a<0;if(this._wrapMode===`clamp-to-edge`){if(i<0){let t=e;e=n,n=t,i*=-1}if(a<0){let e=t;t=r,r=e,a*=-1}}let s=this.colorStops.length?this.colorStops:RT,c=this._textureSize,{canvas:l,context:d}=HT(c,1),p=o?d.createLinearGradient(this._textureSize,0,0,0):d.createLinearGradient(0,0,this._textureSize,0);VT(p,s),d.fillStyle=p,d.fillRect(0,0,c,1),this.texture=new f({source:new be({resource:l,addressMode:this._wrapMode})});let m=Math.sqrt(i*i+a*a),h=Math.atan2(a,i),g=new u;g.scale(m/c,1),g.rotate(h),g.translate(e,t),this.textureSpace===`local`&&g.scale(c,c),this.transform=g}buildGradient(){this.texture||this._tick++,this.type===`linear`?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:RT,t=this._textureSize,{canvas:n,context:r}=HT(t,t),{x:i,y:a}=this.center,{x:o,y:s}=this.outerCenter,c=this.innerRadius,l=this.outerRadius,d=o-l,p=s-l,m=t/(l*2),h=(i-d)*m,g=(a-p)*m,_=r.createRadialGradient(h,g,c*m,(o-d)*m,(s-p)*m,l*m);VT(_,e),r.fillStyle=e[e.length-1].color,r.fillRect(0,0,t,t),r.fillStyle=_,r.translate(h,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-h,-g),r.fillRect(0,0,t,t),this.texture=new f({source:new be({resource:n,addressMode:this._wrapMode})});let v=new u;v.scale(1/m,1/m),v.translate(d,p),this.textureSpace===`local`&&v.scale(t,t),this.transform=v}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};zT.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:`local`,type:`linear`,textureSize:256,wrapMode:`clamp-to-edge`},zT.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:`local`,type:`radial`,textureSize:256,wrapMode:`clamp-to-edge`};var BT=zT;function VT(e,t){for(let n=0;n<t.length;n++){let r=t[n];e.addColorStop(r.offset,r.color)}}function HT(e,t){let n=he.get().createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`)}}function rbe(e){let t=e[0]??{};return(typeof t==`number`||e[1])&&(le(`8.5.2`,`use options object instead`),t={type:`linear`,start:{x:e[0],y:e[1]},end:{x:e[2],y:e[3]},textureSpace:e[4],textureSize:e[5]??BT.defaultLinearOptions.textureSize}),t}var ibe=new u,abe=new M;function UT(e,t,n,r){let i=t.matrix?e.copyFrom(t.matrix).invert():e.identity();if(t.textureSpace===`local`){let e=n.getBounds(abe);t.width&&e.pad(t.width);let{x:r,y:a}=e,o=1/e.width,s=1/e.height,c=-r*o,l=-a*s,u=i.a,d=i.b,f=i.c,p=i.d;i.a*=o,i.b*=o,i.c*=s,i.d*=s,i.tx=c*u+l*f+i.tx,i.ty=c*d+l*p+i.ty}else i.translate(t.texture.frame.x,t.texture.frame.y),i.scale(1/t.texture.source.width,1/t.texture.source.height);let a=t.texture.source.style;return!(t.fill instanceof BT)&&a.addressMode===`clamp-to-edge`&&(a.addressMode=`repeat`,a.update()),r&&i.append(ibe.copyFrom(r).invert()),i}var WT={};V.handleByMap(H.ShapeBuilder,WT),V.add(tbe,ebe,nbe,jT,Yye,Xye);var obe=new M,sbe=new u;function cbe(e,t){let{geometryData:n,batches:r}=t;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let t=0;t<e.instructions.length;t++){let i=e.instructions[t];if(i.action===`texture`)lbe(i.data,r,n);else if(i.action===`fill`||i.action===`stroke`){let e=i.action===`stroke`,t=i.data.path.shapePath,a=i.data.style,o=i.data.hole;e&&o&&GT(o.shapePath,a,!0,r,n),o&&(t.shapePrimitives[t.shapePrimitives.length-1].holes=o.shapePath.shapePrimitives),GT(t,a,e,r,n)}}}function lbe(e,t,n){let r=[],i=WT.rectangle,a=obe;a.x=e.dx,a.y=e.dy,a.width=e.dw,a.height=e.dh;let o=e.transform;if(!i.build(a,r))return;let{vertices:s,uvs:c,indices:l}=n,u=l.length,d=s.length/2;o&&kT(r,o),i.triangulate(r,s,2,d,l,u);let f=e.image,p=f.uvs;c.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);let m=w.get(AT);m.indexOffset=u,m.indexSize=l.length-u,m.attributeOffset=d,m.attributeSize=s.length/2-d,m.baseColor=e.style,m.alpha=e.alpha,m.texture=f,m.geometryData=n,t.push(m)}function GT(e,t,n,r,i){let{vertices:a,uvs:o,indices:s}=i;e.shapePrimitives.forEach(({shape:e,transform:c,holes:l})=>{let u=[],d=WT[e.type];if(!d.build(e,u))return;let p=s.length,m=a.length/2,h=`triangle-list`;if(c&&kT(u,c),n){let n=e.closePath??!0,r=t;r.pixelLine?(Qye(u,n,a,s),h=`line-list`):IT(u,r,!1,n,a,s)}else if(l){let e=[],t=u.slice();ube(l).forEach(n=>{e.push(t.length/2),t.push(...n)}),LT(t,e,a,2,m,s,p)}else d.triangulate(u,a,2,m,s,p);let g=o.length/2,_=t.texture;if(_!==f.WHITE){let n=UT(sbe,t,e,c);Kye(a,2,m,o,g,2,a.length/2-m,n)}else qye(o,g,2,a.length/2-m);let v=w.get(AT);v.indexOffset=p,v.indexSize=s.length-p,v.attributeOffset=m,v.attributeSize=a.length/2-m,v.baseColor=t.color,v.alpha=t.alpha,v.texture=_,v.geometryData=i,v.topology=h,r.push(v)})}function ube(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].shape,i=[];WT[r.type].build(r,i)&&t.push(i)}return t}var dbe=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{w.return(e)}),this.graphicsData&&w.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}},fbe=class{constructor(){this.instructions=new ge}init(e){let t=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(t):this.batcher=new Ve({maxTextures:t}),this.instructions.reset()}get geometry(){return le(j,`GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead.`),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}},KT=class e{constructor(e){this._renderer=e,this._managedContexts=new Me({renderer:e,type:`resource`,name:`graphicsContext`})}init(t){e.defaultOptions.bezierSmoothness=t?.bezierSmoothness??e.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){let t=!!e._gpuData[this._renderer.uid],n=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!t){t&&n.reset(),cbe(e,n);let r=e.batchMode;e.customShader||r===`no-batch`?n.isBatchable=!1:r===`auto`?n.isBatchable=n.geometryData.vertices.length<400:n.isBatchable=!0,e.dirty=!1}return n}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){let t=w.get(fbe,{maxTextures:this._renderer.limits.maxBatchableTextures}),n=e._gpuData[this._renderer.uid],{batches:r,geometryData:i}=n;n.graphicsData=t;let a=i.vertices.length,o=i.indices.length;for(let e=0;e<r.length;e++)r[e].applyTransform=!1;let s=t.batcher;s.ensureAttributeBuffer(a),s.ensureIndexBuffer(o),s.begin();for(let e=0;e<r.length;e++){let t=r[e];s.add(t)}s.finish(t.instructions);let c=s.geometry;c.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),c.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!0);let l=s.batches;for(let e=0;e<l.length;e++){let t=l[e];t.bindGroup=Xe(t.textures.textures,t.textures.count,this._renderer.limits.maxBatchableTextures)}return t}_initContext(e){let t=new dbe;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};KT.extension={type:[H.WebGLSystem,H.WebGPUSystem],name:`graphicsContext`},KT.defaultOptions={bezierSmoothness:.5};var qT=KT,pbe=8,JT=1.1920929e-7,mbe=1,YT=.01,XT=0,ZT=0;function QT(e,t,n,r,i,a,o,s,c,l){let u=(mbe-Math.min(.99,Math.max(0,l??qT.defaultOptions.bezierSmoothness)))/1;return u*=u,hbe(t,n,r,i,a,o,s,c,e,u),e}function hbe(e,t,n,r,i,a,o,s,c,l){$T(e,t,n,r,i,a,o,s,c,l,0),c.push(o,s)}function $T(e,t,n,r,i,a,o,s,c,l,u){if(u>pbe)return;let d=Math.PI,f=(e+n)/2,p=(t+r)/2,m=(n+i)/2,h=(r+a)/2,g=(i+o)/2,_=(a+s)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(h+_)/2,S=(v+b)/2,C=(y+x)/2;if(u>0){let u=o-e,f=s-t,p=Math.abs((n-o)*f-(r-s)*u),m=Math.abs((i-o)*f-(a-s)*u),h,g;if(p>JT&&m>JT){if((p+m)*(p+m)<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}let l=Math.atan2(a-r,i-n);if(h=Math.abs(l-Math.atan2(r-t,n-e)),g=Math.abs(Math.atan2(s-a,o-i)-l),h>=d&&(h=2*d-h),g>=d&&(g=2*d-g),h+g<XT){c.push(S,C);return}if(ZT!==0){if(h>ZT){c.push(n,r);return}if(g>ZT){c.push(i,a);return}}}}else if(p>JT){if(p*p<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}if(h=Math.abs(Math.atan2(a-r,i-n)-Math.atan2(r-t,n-e)),h>=d&&(h=2*d-h),h<XT){c.push(n,r),c.push(i,a);return}if(ZT!==0&&h>ZT){c.push(n,r);return}}}else if(m>JT){if(m*m<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}if(h=Math.abs(Math.atan2(s-a,o-i)-Math.atan2(a-r,i-n)),h>=d&&(h=2*d-h),h<XT){c.push(n,r),c.push(i,a);return}if(ZT!==0&&h>ZT){c.push(i,a);return}}}else if(u=S-(e+o)/2,f=C-(t+s)/2,u*u+f*f<=l){c.push(S,C);return}}$T(e,t,f,p,v,y,S,C,c,l,u+1),$T(S,C,b,x,g,_,o,s,c,l,u+1)}var gbe=8,_be=1.1920929e-7,vbe=1,ybe=.01,eE=0;function bbe(e,t,n,r,i,a,o,s){let c=(vbe-Math.min(.99,Math.max(0,s??qT.defaultOptions.bezierSmoothness)))/1;return c*=c,xbe(t,n,r,i,a,o,e,c),e}function xbe(e,t,n,r,i,a,o,s){tE(o,e,t,n,r,i,a,s,0),o.push(i,a)}function tE(e,t,n,r,i,a,o,s,c){if(c>gbe)return;let l=Math.PI,u=(t+r)/2,d=(n+i)/2,f=(r+a)/2,p=(i+o)/2,m=(u+f)/2,h=(d+p)/2,g=a-t,_=o-n,v=Math.abs((r-a)*_-(i-o)*g);if(v>_be){if(v*v<=s*(g*g+_*_)){if(eE<ybe){e.push(m,h);return}let s=Math.abs(Math.atan2(o-i,a-r)-Math.atan2(i-n,r-t));if(s>=l&&(s=2*l-s),s<eE){e.push(m,h);return}}}else if(g=m-(t+a)/2,_=h-(n+o)/2,g*g+_*_<=s){e.push(m,h);return}tE(e,t,n,u,d,m,h,s,c+1),tE(e,m,h,f,p,a,o,s,c+1)}function nE(e,t,n,r,i,a,o,s){let c=Math.abs(i-a);(!o&&i>a||o&&a>i)&&(c=2*Math.PI-c),s||=Math.max(6,Math.floor(6*r**(1/3)*(c/Math.PI))),s=Math.max(s,3);let l=c/s,u=i;l*=o?-1:1;for(let i=0;i<s+1;i++){let i=Math.cos(u),a=Math.sin(u),o=t+i*r,s=n+a*r;e.push(o,s),u+=l}}function Sbe(e,t,n,r,i,a){let o=e[e.length-2],s=e[e.length-1]-n,c=o-t,l=i-n,u=r-t,d=Math.abs(s*u-c*l);if(d<1e-8||a===0){(e[e.length-2]!==t||e[e.length-1]!==n)&&e.push(t,n);return}let f=s*s+c*c,p=l*l+u*u,m=s*l+c*u,h=a*Math.sqrt(f)/d,g=a*Math.sqrt(p)/d,_=h*m/f,v=g*m/p,y=h*u+g*c,b=h*l+g*s,x=c*(g+_),S=s*(g+_),C=u*(h+v),w=l*(h+v),T=Math.atan2(S-b,x-y),E=Math.atan2(w-b,C-y);nE(e,y+t,b+n,a,T,E,c*l>u*s)}var rE=Math.PI*2,iE={centerX:0,centerY:0,ang1:0,ang2:0},aE=({x:e,y:t},n,r,i,a,o,s,c)=>{e*=n,t*=r;let l=i*e-a*t,u=a*e+i*t;return c.x=l+o,c.y=u+s,c};function Cbe(e,t){let n=t===-1.5707963267948966?-.551915024494:4/3*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:n,i=Math.cos(e),a=Math.sin(e),o=Math.cos(e+t),s=Math.sin(e+t);return[{x:i-a*r,y:a+i*r},{x:o+s*r,y:s-o*r},{x:o,y:s}]}var oE=(e,t,n,r)=>{let i=e*r-t*n<0?-1:1,a=e*n+t*r;return a>1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)},wbe=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=i**2,m=a**2,h=u**2,g=d**2,_=p*m-p*g-m*h;_<0&&(_=0),_/=p*g+m*h,_=Math.sqrt(_)*(o===s?-1:1);let v=_*i/a*d,y=_*-a/i*u,b=l*v-c*y+(e+n)/2,x=c*v+l*y+(t+r)/2,S=(u-v)/i,C=(d-y)/a,w=(-u-v)/i,T=(-d-y)/a,E=oE(1,0,S,C),D=oE(S,C,w,T);s===0&&D>0&&(D-=rE),s===1&&D<0&&(D+=rE),f.centerX=b,f.centerY=x,f.ang1=E,f.ang2=D};function Tbe(e,t,n,r,i,a,o,s=0,c=0,l=0){if(a===0||o===0)return;let u=Math.sin(s*rE/360),d=Math.cos(s*rE/360),f=d*(t-r)/2+u*(n-i)/2,p=-u*(t-r)/2+d*(n-i)/2;if(f===0&&p===0)return;a=Math.abs(a),o=Math.abs(o);let m=f**2/a**2+p**2/o**2;m>1&&(a*=Math.sqrt(m),o*=Math.sqrt(m)),wbe(t,n,r,i,a,o,c,l,u,d,f,p,iE);let{ang1:h,ang2:g}=iE,{centerX:_,centerY:v}=iE,y=Math.abs(g)/(rE/4);Math.abs(1-y)<1e-7&&(y=1);let b=Math.max(Math.ceil(y),1);g/=b;let x=e[e.length-2],S=e[e.length-1],C={x:0,y:0};for(let t=0;t<b;t++){let t=Cbe(h,g),{x:n,y:r}=aE(t[0],a,o,d,u,_,v,C),{x:i,y:s}=aE(t[1],a,o,d,u,_,v,C),{x:c,y:l}=aE(t[2],a,o,d,u,_,v,C);QT(e,x,S,n,r,i,s,c,l),x=c,S=l,h+=g}}function Ebe(e,t,n){let r=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r);return{len:i,nx:n/i,ny:r/i}},i=(t,n)=>{t===0?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y)},a=t[t.length-1];for(let o=0;o<t.length;o++){let s=t[o%t.length],c=s.radius??n;if(c<=0){i(o,s),a=s;continue}let l=t[(o+1)%t.length],u=r(s,a),d=r(s,l);if(u.len<1e-4||d.len<1e-4){i(o,s),a=s;continue}let f=Math.asin(u.nx*d.ny-u.ny*d.nx),p=1,m=!1;u.nx*d.nx-u.ny*-d.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,p=-1,m=!0):f>0&&(p=-1,m=!0);let h=f/2,g,_=Math.abs(Math.cos(h)*c/Math.sin(h));_>Math.min(u.len/2,d.len/2)?(_=Math.min(u.len/2,d.len/2),g=Math.abs(_*Math.sin(h)/Math.cos(h))):g=c;let v=s.x+d.nx*_+-d.ny*g*p,y=s.y+d.ny*_+d.nx*g*p,b=Math.atan2(u.ny,u.nx)+Math.PI/2*p,x=Math.atan2(d.ny,d.nx)-Math.PI/2*p;o===0&&e.moveTo(v+Math.cos(b)*g,y+Math.sin(b)*g),e.arc(v,y,g,b,x,m),a=s}}function Dbe(e,t,n,r){let i=(e,t)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),a=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}),o=t.length;for(let s=0;s<o;s++){let c=t[(s+1)%o],l=c.radius??n;if(l<=0){s===0?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y);continue}let u=t[s],d=t[(s+2)%o],f=i(u,c),p;p=f<1e-4?c:a(c,u,Math.min(f/2,l)/f);let m=i(d,c),h;h=m<1e-4?c:a(c,d,Math.min(m/2,l)/m),s===0?e.moveTo(p.x,p.y):e.lineTo(p.x,p.y),e.quadraticCurveTo(c.x,c.y,h.x,h.y,r)}}var Obe=new M,kbe=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new E,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let n=this._currentPoly.points,r=n[n.length-2],i=n[n.length-1];return(r!==e||i!==t)&&n.push(e,t),this}arc(e,t,n,r,i,a){this._ensurePoly(!1);let o=this._currentPoly.points;return nE(o,e,t,n,r,i,a),this}arcTo(e,t,n,r,i){this._ensurePoly();let a=this._currentPoly.points;return Sbe(a,e,t,n,r,i),this}arcToSvg(e,t,n,r,i,a,o){let s=this._currentPoly.points;return Tbe(s,this._currentPoly.lastX,this._currentPoly.lastY,a,o,e,t,n,r,i),this}bezierCurveTo(e,t,n,r,i,a,o){this._ensurePoly();let s=this._currentPoly;return QT(this._currentPoly.points,s.lastX,s.lastY,e,t,n,r,i,a,o),this}quadraticCurveTo(e,t,n,r,i){this._ensurePoly();let a=this._currentPoly;return bbe(this._currentPoly.points,a.lastX,a.lastY,e,t,n,r,i),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));let n=this.shapePrimitives,r=n.length;for(let t=0;t<e.instructions.length;t++){let n=e.instructions[t];this[n.action](...n.data)}if(e.checkForHoles&&n.length-r>1){let e=null;for(let t=r;t<n.length;t++){let r=n[t];if(r.shape.type===`polygon`){let i=r.shape,a=e?.shape;a&&a.containsPolygon(i)?(e.holes||=[],e.holes.push(r),n.copyWithin(t,t+1),n.length--,t--):e=r}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,n,r,i){return this.drawShape(new M(e,t,n,r),i),this}circle(e,t,n,r){return this.drawShape(new Bye(e,t,n),r),this}poly(e,t,n){let r=new DT(e);return r.closePath=t,this.drawShape(r,n),this}regularPoly(e,t,n,r,i=0,a){r=Math.max(r|0,3);let o=-1*Math.PI/2+i,s=Math.PI*2/r,c=[];for(let i=0;i<r;i++){let r=o-i*s;c.push(e+n*Math.cos(r),t+n*Math.sin(r))}return this.poly(c,!0,a),this}roundPoly(e,t,n,r,i,a=0,o){if(r=Math.max(r|0,3),i<=0)return this.regularPoly(e,t,n,r,a);let s=n*Math.sin(Math.PI/r)-.001;i=Math.min(i,s);let c=-1*Math.PI/2+a,l=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let a=0;a<r;a++){let r=a*l+c,s=e+n*Math.cos(r),d=t+n*Math.sin(r),f=r+Math.PI+u,p=r-Math.PI-u,m=s+i*Math.cos(f),h=d+i*Math.sin(f),g=s+i*Math.cos(p),_=d+i*Math.sin(p);a===0?this.moveTo(m,h):this.lineTo(m,h),this.quadraticCurveTo(s,d,g,_,o)}return this.closePath()}roundShape(e,t,n=!1,r){return e.length<3?this:(n?Dbe(this,e,t,r):Ebe(this,e,t),this.closePath())}filletRect(e,t,n,r,i){if(i===0)return this.rect(e,t,n,r);let a=Math.min(n,r)/2,o=Math.min(a,Math.max(-a,i)),s=e+n,c=t+r,l=o<0?-o:0,u=Math.abs(o);return this.moveTo(e,t+u).arcTo(e+l,t+l,e+u,t,u).lineTo(s-u,t).arcTo(s-l,t+l,s,t+u,u).lineTo(s,c-u).arcTo(s-l,c-l,e+n-u,c,u).lineTo(e+u,c).arcTo(e+l,c-l,e,c-u,u).closePath()}chamferRect(e,t,n,r,i,a){if(i<=0)return this.rect(e,t,n,r);let o=Math.min(i,Math.min(n,r)/2),s=e+n,c=t+r,l=[e+o,t,s-o,t,s,t+o,s,c-o,s-o,c,e+o,c,e,c-o,e,t+o];for(let e=l.length-1;e>=2;e-=2)l[e]===l[e-2]&&l[e-1]===l[e-3]&&l.splice(e-1,2);return this.poly(l,!0,a)}ellipse(e,t,n,r,i){return this.drawShape(new Vye(e,t,n,r),i),this}roundRect(e,t,n,r,i,a){return this.drawShape(new Gye(e,t,n,r,i),a),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let n=this._currentPoly;return n&&this.endPoly(),n=new DT,n.points.push(e,t),this._currentPoly=n,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new DT,e)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let t=e.shape.x,n=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let r=e.transform,i=t;t=r.a*t+r.c*n+r.tx,n=r.b*i+r.d*n+r.ty}this._currentPoly.points.push(t,n)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t<e.instructions.length;t++){let n=e.instructions[t];this[n.action](...n.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let n=0;n<t.length;n++){let r=t[n],i=r.shape.getBounds(Obe);r.transform?e.addRect(i,r.transform):e.addRect(i)}return e}},sE=class e{constructor(e,t=!1){this.instructions=[],this.uid=A(`graphicsPath`),this._dirty=!0,this.checkForHoles=t,typeof e==`string`?zye(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||=new kbe(this),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:`addPath`,data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:`arc`,data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:`arcTo`,data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:`arcToSvg`,data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:`bezierCurveTo`,data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,n,r,i){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(L.shared),s=0,c=0;if(!a||a.action!==`bezierCurveTo`)s=o.x,c=o.y;else{s=a.data[2],c=a.data[3];let e=o.x,t=o.y;s=e+(e-s),c=t+(t-c)}return this.instructions.push({action:`bezierCurveTo`,data:[s,c,e,t,n,r,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:`closePath`,data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:`ellipse`,data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:`lineTo`,data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:`moveTo`,data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:`quadraticCurveTo`,data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,n){let r=this.instructions[this.instructions.length-1],i=this.getLastPoint(L.shared),a=0,o=0;if(!r||r.action!==`quadraticCurveTo`)a=i.x,o=i.y;else{a=r.data[0],o=r.data[1];let e=i.x,t=i.y;a=e+(e-a),o=t+(t-o)}return this.instructions.push({action:`quadraticCurveTo`,data:[a,o,e,t,n]}),this._dirty=!0,this}rect(e,t,n,r,i){return this.instructions.push({action:`rect`,data:[e,t,n,r,i]}),this._dirty=!0,this}circle(e,t,n,r){return this.instructions.push({action:`circle`,data:[e,t,n,r]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:`roundRect`,data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:`poly`,data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:`regularPoly`,data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:`roundPoly`,data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:`roundShape`,data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:`filletRect`,data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:`chamferRect`,data:e}),this._dirty=!0,this}star(e,t,n,r,i,a,o){i||=r/2;let s=-1*Math.PI/2+a,c=n*2,l=Math.PI*2/c,u=[];for(let n=0;n<c;n++){let a=n%2?i:r,o=n*l+s;u.push(e+a*Math.cos(o),t+a*Math.sin(o))}return this.poly(u,!0,o),this}clone(t=!1){let n=new e;if(n.checkForHoles=this.checkForHoles,!t)n.instructions=this.instructions.slice();else for(let e=0;e<this.instructions.length;e++){let t=this.instructions[e];n.instructions.push({action:t.action,data:t.data.slice()})}return n}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=e.a,n=e.b,r=e.c,i=e.d,a=e.tx,o=e.ty,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0;for(let h=0;h<this.instructions.length;h++){let g=this.instructions[h],_=g.data;switch(g.action){case`moveTo`:case`lineTo`:s=_[0],c=_[1],_[0]=t*s+r*c+a,_[1]=n*s+i*c+o;break;case`bezierCurveTo`:l=_[0],u=_[1],d=_[2],f=_[3],s=_[4],c=_[5],_[0]=t*l+r*u+a,_[1]=n*l+i*u+o,_[2]=t*d+r*f+a,_[3]=n*d+i*f+o,_[4]=t*s+r*c+a,_[5]=n*s+i*c+o;break;case`quadraticCurveTo`:l=_[0],u=_[1],s=_[2],c=_[3],_[0]=t*l+r*u+a,_[1]=n*l+i*u+o,_[2]=t*s+r*c+a,_[3]=n*s+i*c+o;break;case`arcToSvg`:s=_[5],c=_[6],p=_[0],m=_[1],_[0]=t*p+r*m,_[1]=n*p+i*m,_[5]=t*s+r*c+a,_[6]=n*s+i*c+o;break;case`circle`:_[4]=cE(_[3],e);break;case`rect`:_[4]=cE(_[4],e);break;case`ellipse`:_[8]=cE(_[8],e);break;case`roundRect`:_[5]=cE(_[5],e);break;case`addPath`:_[0].transform(e);break;case`poly`:_[2]=cE(_[2],e);break;default:v(`unknown transform action`,g.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,n=this.instructions[t];if(!n)return e.x=0,e.y=0,e;for(;n.action===`closePath`;){if(t--,t<0)return e.x=0,e.y=0,e;n=this.instructions[t]}switch(n.action){case`moveTo`:case`lineTo`:e.x=n.data[0],e.y=n.data[1];break;case`quadraticCurveTo`:e.x=n.data[2],e.y=n.data[3];break;case`bezierCurveTo`:e.x=n.data[4],e.y=n.data[5];break;case`arc`:case`arcToSvg`:e.x=n.data[5],e.y=n.data[6];break;case`addPath`:n.data[0].getLastPoint(e);break}return e}};function cE(e,t){return e?e.prepend(t):t.clone()}function lE(e,t,n){let r=e.getAttribute(t);return r?Number(r):n}function Abe(e,t){let n=e.querySelectorAll(`defs`);for(let e=0;e<n.length;e++){let r=n[e];for(let e=0;e<r.children.length;e++){let n=r.children[e];switch(n.nodeName.toLowerCase()){case`lineargradient`:t.defs[n.id]=jbe(n);break;case`radialgradient`:t.defs[n.id]=Mbe(n);break;default:break}}}}function jbe(e){let t=new BT(lE(e,`x1`,0),lE(e,`y1`,0),lE(e,`x2`,1),lE(e,`y2`,0),(e.getAttribute(`gradientUnits`)||`objectBoundingBox`)===`objectBoundingBox`?`local`:`global`);for(let n=0;n<e.children.length;n++){let r=e.children[n],i=lE(r,`offset`,0),a=x.shared.setValue(r.getAttribute(`stop-color`)).toNumber();t.addColorStop(i,a)}return t}function Mbe(e){return v(`[SVG Parser] Radial gradients are not yet supported`),new BT(0,0,1,0)}function uE(e){let t=e.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:``}var dE={fill:{type:`paint`,default:0},"fill-opacity":{type:`number`,default:1},stroke:{type:`paint`,default:0},"stroke-width":{type:`number`,default:1},"stroke-opacity":{type:`number`,default:1},"stroke-linecap":{type:`string`,default:`butt`},"stroke-linejoin":{type:`string`,default:`miter`},"stroke-miterlimit":{type:`number`,default:10},"stroke-dasharray":{type:`string`,default:`none`},"stroke-dashoffset":{type:`number`,default:0},opacity:{type:`number`,default:1}};function fE(e,t){let n=e.getAttribute(`style`),r={},i={},a={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(let n in dE){let r=e.getAttribute(n);r&&pE(t,a,n,r.trim())}if(n){let e=n.split(`;`);for(let n=0;n<e.length;n++){let[r,i]=e[n].trim().split(`:`);dE[r]&&pE(t,a,r,i.trim())}}return{strokeStyle:a.useStroke?r:null,fillStyle:a.useFill?i:null,useFill:a.useFill,useStroke:a.useStroke}}function pE(e,t,n,r){switch(n){case`stroke`:if(r!==`none`){if(r.startsWith(`url(`)){let n=uE(r);t.strokeStyle.fill=e.defs[n]}else t.strokeStyle.color=x.shared.setValue(r).toNumber();t.useStroke=!0}break;case`stroke-width`:t.strokeStyle.width=Number(r);break;case`fill`:if(r!==`none`){if(r.startsWith(`url(`)){let n=uE(r);t.fillStyle.fill=e.defs[n]}else t.fillStyle.color=x.shared.setValue(r).toNumber();t.useFill=!0}break;case`fill-opacity`:t.fillStyle.alpha=Number(r);break;case`stroke-opacity`:t.strokeStyle.alpha=Number(r);break;case`opacity`:t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}function Nbe(e){if(e.length<=2)return!0;let t=e.map(e=>e.area).sort((e,t)=>t-e),[n,r]=t,i=t[t.length-1],a=n/r,o=r/i;return!(a>3&&o<2)}function Pbe(e){return e.split(/(?=[Mm])/).filter(e=>e.trim().length>0)}function Fbe(e){let t=e.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;let n=t.map(Number),r=[],i=[];for(let e=0;e<n.length;e+=2)e+1<n.length&&(r.push(n[e]),i.push(n[e+1]));if(r.length===0||i.length===0)return 0;let a=Math.min(...r),o=Math.max(...r),s=Math.min(...i),c=Math.max(...i);return(o-a)*(c-s)}function mE(e,t){let n=new sE(e,!1);for(let e of n.instructions)t.instructions.push(e)}function Ibe(e,t){if(typeof e==`string`){let t=document.createElement(`div`);t.innerHTML=e.trim(),e=t.querySelector(`svg`)}let n={context:t,defs:{},path:new sE};Abe(e,n);let r=e.children,{fillStyle:i,strokeStyle:a}=fE(e,n);for(let e=0;e<r.length;e++){let t=r[e];t.nodeName.toLowerCase()!==`defs`&&hE(t,n,i,a)}return t}function hE(e,t,n,r){let i=e.children,{fillStyle:a,strokeStyle:o}=fE(e,t);a&&n?n={...n,...a}:a&&(n=a),o&&r?r={...r,...o}:o&&(r=o);let s=!n&&!r;s&&(n={color:0});let c,l,u,d,f,p,m,h,g,_,y,b,x,S,C,w,T;switch(e.nodeName.toLowerCase()){case`path`:{S=e.getAttribute(`d`);let i=e.getAttribute(`fill-rule`),a=Pbe(S),o=i===`evenodd`,s=a.length>1;if(o&&s){let e=a.map(e=>({path:e,area:Fbe(e)}));if(e.sort((e,t)=>t.area-e.area),a.length>3||!Nbe(e))for(let i=0;i<e.length;i++){let a=e[i],o=i===0;t.context.beginPath();let s=new sE(void 0,!0);mE(a.path,s),t.context.path(s),o?(n&&t.context.fill(n),r&&t.context.stroke(r)):t.context.cut()}else for(let i=0;i<e.length;i++){let a=e[i],o=i%2==1;t.context.beginPath();let s=new sE(void 0,!0);mE(a.path,s),t.context.path(s),o?t.context.cut():(n&&t.context.fill(n),r&&t.context.stroke(r))}}else C=new sE(S,i?i===`evenodd`:!0),t.context.path(C),n&&t.context.fill(n),r&&t.context.stroke(r);break}case`circle`:m=lE(e,`cx`,0),h=lE(e,`cy`,0),g=lE(e,`r`,0),t.context.ellipse(m,h,g,g),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`rect`:c=lE(e,`x`,0),l=lE(e,`y`,0),w=lE(e,`width`,0),T=lE(e,`height`,0),_=lE(e,`rx`,0),y=lE(e,`ry`,0),_||y?t.context.roundRect(c,l,w,T,_||y):t.context.rect(c,l,w,T),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`ellipse`:m=lE(e,`cx`,0),h=lE(e,`cy`,0),_=lE(e,`rx`,0),y=lE(e,`ry`,0),t.context.beginPath(),t.context.ellipse(m,h,_,y),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`line`:u=lE(e,`x1`,0),d=lE(e,`y1`,0),f=lE(e,`x2`,0),p=lE(e,`y2`,0),t.context.beginPath(),t.context.moveTo(u,d),t.context.lineTo(f,p),r&&t.context.stroke(r);break;case`polygon`:x=e.getAttribute(`points`),b=x.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!0),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`polyline`:x=e.getAttribute(`points`),b=x.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!1),r&&t.context.stroke(r);break;case`g`:case`svg`:break;default:v(`[SVG parser] <${e.nodeName}> elements unsupported`);break}s&&(n=null);for(let e=0;e<i.length;e++)hE(i[e],t,n,r)}var gE={repeat:{addressModeU:`repeat`,addressModeV:`repeat`},"repeat-x":{addressModeU:`repeat`,addressModeV:`clamp-to-edge`},"repeat-y":{addressModeU:`clamp-to-edge`,addressModeV:`repeat`},"no-repeat":{addressModeU:`clamp-to-edge`,addressModeV:`clamp-to-edge`}},_E=class{constructor(e,t){this.uid=A(`fillPattern`),this._tick=0,this.transform=new u,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=gE[t].addressModeU,e.source.style.addressModeV=gE[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}};function Lbe(e){return x.isColorLike(e)}function vE(e){return e instanceof _E}function yE(e){return e instanceof BT}function Rbe(e){return e instanceof f}function zbe(e,t,n){let r=x.shared.setValue(t??0);return e.color=r.toNumber(),e.alpha=r.alpha===1?n.alpha:r.alpha,e.texture=f.WHITE,{...n,...e}}function Bbe(e,t,n){return e.texture=t,{...n,...e}}function bE(e,t,n){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...n,...e}}function xE(e,t,n){return t.buildGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,e.textureSpace=t.textureSpace,{...n,...e}}function Vbe(e,t){let n={...t,...e},r=x.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function SE(e,t){if(e==null)return null;let n={},r=e;return Lbe(e)?zbe(n,e,t):Rbe(e)?Bbe(n,e,t):vE(e)?bE(n,e,t):yE(e)?xE(n,e,t):r.fill&&vE(r.fill)?bE(r,r.fill,t):r.fill&&yE(r.fill)?xE(r,r.fill,t):Vbe(r,t)}function CE(e,t){let{width:n,alignment:r,miterLimit:i,cap:a,join:o,pixelLine:s,...c}=t,l=SE(e,c);return l?{width:n,alignment:r,miterLimit:i,cap:a,join:o,pixelLine:s,...l}:null}var Hbe=new L,wE=new u,TE=class e extends pe{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=A(`graphicsContext`),this.dirty=!0,this.batchMode=`auto`,this.instructions=[],this.destroyed=!1,this._activePath=new sE,this._transform=new u,this._fillStyle={...e.defaultFillStyle},this._strokeStyle={...e.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new E,this._boundsDirty=!0}clone(){let t=new e;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=SE(t,e.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=CE(t,e.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=SE(t,e.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=SE(t,e.defaultStrokeStyle),this}texture(e,t,n,r,i,a){return this.instructions.push({action:`texture`,data:{image:e,dx:n||0,dy:r||0,dw:i||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t||t===0?x.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new sE,this}fill(t,n){let r,i=this.instructions[this.instructions.length-1];return r=this._tick===0&&i?.action===`stroke`?i.data.path:this._activePath.clone(),r?(t!=null&&(n!==void 0&&typeof t==`number`&&(le(y,`GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead`),t={color:t,alpha:n}),this._fillStyle=SE(t,e.defaultFillStyle)),this.instructions.push({action:`fill`,data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:t}=this._activePath.getLastPoint(L.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(t){let n,r=this.instructions[this.instructions.length-1];return n=this._tick===0&&r?.action===`fill`?r.data.path:this._activePath.clone(),n?(t!=null&&(this._strokeStyle=CE(t,e.defaultStrokeStyle)),this.instructions.push({action:`stroke`,data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],n=this._activePath.clone();if(t&&(t.action===`stroke`||t.action===`fill`))if(t.data.hole)t.data.hole.addPath(n);else{t.data.hole=n;break}}return this._initNextPathLocation(),this}arc(e,t,n,r,i,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*t+o.tx,o.b*e+o.d*t+o.ty,n,r,i,a),this}arcTo(e,t,n,r,i){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,i),this}arcToSvg(e,t,n,r,i,a,o){this._tick++;let s=this._transform;return this._activePath.arcToSvg(e,t,n,r,i,s.a*a+s.c*o+s.tx,s.b*a+s.d*o+s.ty),this}bezierCurveTo(e,t,n,r,i,a,o){this._tick++;let s=this._transform;return this._activePath.bezierCurveTo(s.a*e+s.c*t+s.tx,s.b*e+s.d*t+s.ty,s.a*n+s.c*r+s.tx,s.b*n+s.d*r+s.ty,s.a*i+s.c*a+s.tx,s.b*i+s.d*a+s.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,n,r){return this._tick++,this._activePath.ellipse(e,t,n,r,this._transform.clone()),this}circle(e,t,n){return this._tick++,this._activePath.circle(e,t,n,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let n=this._transform;return this._activePath.lineTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty),this}moveTo(e,t){this._tick++;let n=this._transform,r=this._activePath.instructions,i=n.a*e+n.c*t+n.tx,a=n.b*e+n.d*t+n.ty;return r.length===1&&r[0].action===`moveTo`?(r[0].data[0]=i,r[0].data[1]=a,this):(this._activePath.moveTo(i,a),this)}quadraticCurveTo(e,t,n,r,i){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,i),this}rect(e,t,n,r){return this._tick++,this._activePath.rect(e,t,n,r,this._transform.clone()),this}roundRect(e,t,n,r,i){return this._tick++,this._activePath.roundRect(e,t,n,r,i,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,n,r,i=0,a){return this._tick++,this._activePath.regularPoly(e,t,n,r,i,a),this}roundPoly(e,t,n,r,i,a){return this._tick++,this._activePath.roundPoly(e,t,n,r,i,a),this}roundShape(e,t,n,r){return this._tick++,this._activePath.roundShape(e,t,n,r),this}filletRect(e,t,n,r,i){return this._tick++,this._activePath.filletRect(e,t,n,r,i),this}chamferRect(e,t,n,r,i,a){return this._tick++,this._activePath.chamferRect(e,t,n,r,i,a),this}star(e,t,n,r,i=0,a=0){return this._tick++,this._activePath.star(e,t,n,r,i,a,this._transform.clone()),this}svg(e){return this._tick++,Ibe(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,n,r,i,a){return e instanceof u?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,n,r,i,a),this)}transform(e,t,n,r,i,a){return e instanceof u?(this._transform.append(e),this):(wE.set(e,t,n,r,i,a),this._transform.append(wE),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,!this.dirty&&(this.emit(`update`,this,16),this.dirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;let e=this._bounds;e.clear();for(let t=0;t<this.instructions.length;t++){let n=this.instructions[t],r=n.action;if(r===`fill`){let t=n.data;e.addBounds(t.path.bounds)}else if(r===`texture`){let t=n.data;e.addFrame(t.dx,t.dy,t.dx+t.dw,t.dy+t.dh,t.transform)}if(r===`stroke`){let t=n.data,r=t.style.alignment,i=t.style.width*(1-r),a=t.path.bounds;e.addFrame(a.minX-i,a.minY-i,a.maxX+i,a.maxY+i)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let t=this.instructions,n=!1;for(let r=0;r<t.length;r++){let i=t[r],a=i.data,o=a.path;if(!i.action||!o)continue;let s=a.style,c=o.shapePath.shapePrimitives;for(let t=0;t<c.length;t++){let r=c[t].shape;if(!s||!r)continue;let o=c[t].transform,l=o?o.applyInverse(e,Hbe):e;if(i.action===`fill`)n=r.contains(l.x,l.y);else{let e=s;n=r.strokeContains(l.x,l.y,e.width,e.alignment)}let u=a.hole;if(u){let e=u.shapePath?.shapePrimitives;if(e)for(let t=0;t<e.length;t++)e[t].shape.contains(l.x,l.y)&&(n=!1)}if(n)return!0}}return n}unload(){this.emit(`unload`,this);for(let e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(e=!1){if(!this.destroyed){if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit(`destroy`,this),this.removeAllListeners(),typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&`uid`in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(t)),this._strokeStyle.texture&&(this._strokeStyle.fill&&`uid`in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(t))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}}};TE.defaultFillStyle={color:16777215,alpha:1,texture:f.WHITE,matrix:null,fill:null,textureSpace:`local`},TE.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:`butt`,join:`miter`,texture:f.WHITE,matrix:null,fill:null,textureSpace:`local`,pixelLine:!1};var EE=TE,DE=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(te.system.add(this._tickerUpdate,this,z.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&=(te.system.remove(this._tickerUpdate,this),!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType===`touch`||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent(`pointermove`,{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}):new MouseEvent(`mousemove`,{clientX:e.clientX,clientY:e.clientY}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}},OE=class extends iT{constructor(){super(...arguments),this.client=new L,this.movement=new L,this.offset=new L,this.global=new L,this.screen=new L}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,n){return e.worldTransform.applyInverse(n||this.global,t)}getModifierState(e){return`getModifierState`in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){throw Error(`Method not implemented.`)}},kE=class extends OE{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type===`pointermove`||this.type===`mousemove`||this.type===`touchmove`?[this]:[]}getPredictedEvents(){throw Error(`getPredictedEvents is not supported!`)}},AE=class extends OE{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};AE.DOM_DELTA_PIXEL=0,AE.DOM_DELTA_LINE=1,AE.DOM_DELTA_PAGE=2;var Ube=2048,Wbe=new L,jE=new L,Gbe=class{constructor(e){this.dispatch=new pe,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping(`pointerdown`,this.mapPointerDown),this.addEventMapping(`pointermove`,this.mapPointerMove),this.addEventMapping(`pointerout`,this.mapPointerOut),this.addEventMapping(`pointerleave`,this.mapPointerOut),this.addEventMapping(`pointerover`,this.mapPointerOver),this.addEventMapping(`pointerup`,this.mapPointerUp),this.addEventMapping(`pointerupoutside`,this.mapPointerUpOutside),this.addEventMapping(`wheel`,this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((e,t)=>e.priority-t.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let n=0,r=t.length;n<r;n++)t[n].fn(e);else v(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){DE.pauseUpdate=!0;let n=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?`hitTestMoveRecursive`:`hitTestRecursive`,r=this[n](this.rootTarget,this.rootTarget.eventMode,Wbe.set(e,t),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(e,t){if(!e.target)return;let n=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let r=0,i=n.length-1;r<i;r++)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let r=n.length-2;r>=0;r--)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,n=this._allInteractiveElements){if(n.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let t=n.length-1;t>=0;t--)r.forEach(r=>{e.currentTarget=n[t],this.notifyTarget(e,r)})}propagationPath(e){let t=[e];for(let n=0;n<Ube&&e!==this.rootTarget&&e.parent;n++){if(!e.parent)throw Error(`Cannot find propagation path to disconnected target`);t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,n,r,i,a=!1){let o=!1;if(this._interactivePrune(e))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(DE.pauseUpdate=!1),e.interactiveChildren&&e.children){let s=e.children;for(let c=s.length-1;c>=0;c--){let l=s[c],u=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,n,r,i,a||i(e,n));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let t=e.isInteractive();(u.length>0||t)&&(t&&this._allInteractiveElements.push(e),u.push(e)),this._hitElements.length===0&&(this._hitElements=u),o=!0}}}let s=this._isInteractive(t),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:s&&!i(e,n)&&r(e,n)?c?[e]:[]:null}hitTestRecursive(e,t,n,r,i){if(this._interactivePrune(e)||i(e,n))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(DE.pauseUpdate=!1),e.interactiveChildren&&e.children){let a=e.children,o=n;for(let n=a.length-1;n>=0;n--){let s=a[n],c=this.hitTestRecursive(s,this._isInteractive(t)?t:s.eventMode,o,r,i);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let t=e.isInteractive();return(c.length>0||t)&&c.push(e),c}}}let a=this._isInteractive(t),o=e.isInteractive();return a&&r(e,n)?o?[e]:[]:null}_isInteractive(e){return e===`static`||e===`dynamic`}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode===`none`||e.eventMode===`passive`&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,jE),!e.hitArea.contains(jE.x,jE.y)))return!0;if(e.effects&&e.effects.length)for(let n=0;n<e.effects.length;n++){let r=e.effects[n];if(r.containsPoint&&!r.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e?.containsPoint?(e.worldTransform.applyInverse(t,jE),e.containsPoint(jE)):!1}notifyTarget(e,t){if(!e.currentTarget.isInteractive())return;t??=e.type;let n=`on${t}`;e.currentTarget[n]?.(e);let r=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,r),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.createPointerEvent(e);if(this.dispatchEvent(t,`pointerdown`),t.pointerType===`touch`)this.dispatchEvent(t,`touchstart`);else if(t.pointerType===`mouse`||t.pointerType===`pen`){let e=t.button===2;this.dispatchEvent(t,e?`rightdown`:`mousedown`)}let n=this.trackingData(e.pointerId);n.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let n=t.pointerType===`mouse`||t.pointerType===`pen`,r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&i!==t.target){let r=e.type===`mousemove`?`mouseout`:`pointerout`,a=this.createPointerEvent(e,r,i);if(this.dispatchEvent(a,`pointerout`),n&&this.dispatchEvent(a,`mouseout`),!t.composedPath().includes(i)){let r=this.createPointerEvent(e,`pointerleave`,i);for(r.eventPhase=r.AT_TARGET;r.target&&!t.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,`mouseleave`),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(a)}if(i!==t.target){let r=e.type===`mousemove`?`mouseover`:`pointerover`,a=this.clonePointerEvent(t,r);this.dispatchEvent(a,`pointerover`),n&&this.dispatchEvent(a,`mouseover`);let o=i?.parent;for(;o&&o!==this.rootTarget.parent&&o!==t.target;)o=o.parent;if(!o||o===this.rootTarget.parent){let e=this.clonePointerEvent(t,`pointerenter`);for(e.eventPhase=e.AT_TARGET;e.target&&e.target!==i&&e.target!==this.rootTarget.parent;)e.currentTarget=e.target,this.notifyTarget(e),n&&this.notifyTarget(e,`mouseenter`),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(a)}let a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push(`pointermove`):this.dispatchEvent(t,`pointermove`),o&&a.push(`globalpointermove`),t.pointerType===`touch`&&(this.moveOnAll?a.splice(1,0,`touchmove`):this.dispatchEvent(t,`touchmove`),o&&a.push(`globaltouchmove`)),n&&(this.moveOnAll?a.splice(1,0,`mousemove`):this.dispatchEvent(t,`mousemove`),o&&a.push(`globalmousemove`),this.cursor=t.target?.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.createPointerEvent(e),r=n.pointerType===`mouse`||n.pointerType===`pen`;this.dispatchEvent(n,`pointerover`),r&&this.dispatchEvent(n,`mouseover`),n.pointerType===`mouse`&&(this.cursor=n.target?.cursor);let i=this.clonePointerEvent(n,`pointerenter`);for(i.eventPhase=i.AT_TARGET;i.target&&i.target!==this.rootTarget.parent;)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,`mouseenter`),i.target=i.target.parent;t.overTargets=n.composedPath(),this.freeEvent(n),this.freeEvent(i)}mapPointerOut(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId);if(t.overTargets){let n=e.pointerType===`mouse`||e.pointerType===`pen`,r=this.findMountedTarget(t.overTargets),i=this.createPointerEvent(e,`pointerout`,r);this.dispatchEvent(i),n&&this.dispatchEvent(i,`mouseout`);let a=this.createPointerEvent(e,`pointerleave`,r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,`mouseleave`),a.target=a.target.parent;t.overTargets=null,this.freeEvent(i),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=performance.now(),n=this.createPointerEvent(e);if(this.dispatchEvent(n,`pointerup`),n.pointerType===`touch`)this.dispatchEvent(n,`touchend`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.dispatchEvent(n,e?`rightup`:`mouseup`)}let r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[e.button]),a=i;if(i&&!n.composedPath().includes(i)){let t=i;for(;t&&!n.composedPath().includes(t);){if(n.currentTarget=t,this.notifyTarget(n,`pointerupoutside`),n.pointerType===`touch`)this.notifyTarget(n,`touchendoutside`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.notifyTarget(n,e?`rightupoutside`:`mouseupoutside`)}t=t.parent}delete r.pressTargetsByButton[e.button],a=t}if(a){let i=this.clonePointerEvent(n,`click`);i.target=a,i.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:i.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===i.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=t,i.detail=o.clickCount,i.pointerType===`mouse`){let e=i.button===2;this.dispatchEvent(i,e?`rightclick`:`click`)}else i.pointerType===`touch`&&this.dispatchEvent(i,`tap`);this.dispatchEvent(i,`pointertap`),this.freeEvent(i)}this.freeEvent(n)}mapPointerUpOutside(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(n){let i=n;for(;i;)r.currentTarget=i,this.notifyTarget(r,`pointerupoutside`),r.pointerType===`touch`?this.notifyTarget(r,`touchendoutside`):(r.pointerType===`mouse`||r.pointerType===`pen`)&&this.notifyTarget(r,r.button===2?`rightupoutside`:`mouseupoutside`),i=i.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof AE)){v(`EventBoundary cannot map a non-wheel event as a wheel event`);return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let n=1;n<e.length&&e[n].parent===t;n++)t=e[n];return t}createPointerEvent(e,t,n){let r=this.allocateEvent(kE);return this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=n??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof t==`string`&&(r.type=t),r}createWheelEvent(e){let t=this.allocateEvent(AE);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){let n=this.allocateEvent(kE);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=t??n.type,n}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof kE&&t instanceof kE&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof OE&&t instanceof OE&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw Error(`It is illegal to free an event not managed by this EventBoundary!`);let t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){let n=e.currentTarget._events[t];if(n)if(`fn`in n)n.once&&e.currentTarget.removeListener(t,n.fn,void 0,!0),n.fn.call(n.context,e);else for(let r=0,i=n.length;r<i&&!e.propagationImmediatelyStopped;r++)n[r].once&&e.currentTarget.removeListener(t,n[r].fn,void 0,!0),n[r].fn.call(n[r].context,e)}},Kbe=1,qbe={touchstart:`pointerdown`,touchend:`pointerup`,touchendoutside:`pointerupoutside`,touchmove:`pointermove`,touchcancel:`pointercancel`},ME=class e{constructor(t){this.supportsTouchEvents=`ontouchstart`in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gbe(null),DE.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new kE(null),this._rootWheelEvent=new AE(null),this.cursorStyles={default:`inherit`,pointer:`pointer`},this.features=new Proxy({...e.defaultEventFeatures},{set:(e,t,n)=>(t===`globalMove`&&(this.rootBoundary.enableGlobalMoveEvents=n),e[t]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:n,resolution:r}=this.renderer;this.setTargetElement(n),this.resolution=r,e._defaultEventMode=t.eventMode??`passive`,Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){DE.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||=`default`;let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;let n=this.cursorStyles[e];if(n)switch(typeof n){case`string`:t&&(this.domElement.style.cursor=n);break;case`function`:n(e);break;case`object`:t&&Object.assign(this.domElement.style,n);break}else t&&typeof e==`string`&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!(`cancelable`in e))&&e.preventDefault();for(let e=0,n=t.length;e<n;e++){let n=t[e],r=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,DE.pointerMoved();let t=this._normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);let n=t===this.domElement?``:`outside`,r=this._normalizeToPointerData(e);for(let e=0,t=r.length;e<t;e++){let t=this._bootstrapEvent(this._rootPointerEvent,r[e]);t.type+=n,this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this._normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,DE.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;DE.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming=`none`,e.msTouchAction=`none`):this.supportsPointerEvents&&(e.touchAction=`none`)),this.supportsPointerEvents?(globalThis.document.addEventListener(`pointermove`,this._onPointerMove,!0),this.domElement.addEventListener(`pointerdown`,this._onPointerDown,!0),this.domElement.addEventListener(`pointerleave`,this._onPointerOverOut,!0),this.domElement.addEventListener(`pointerover`,this._onPointerOverOut,!0),globalThis.addEventListener(`pointerup`,this._onPointerUp,!0)):(globalThis.document.addEventListener(`mousemove`,this._onPointerMove,!0),this.domElement.addEventListener(`mousedown`,this._onPointerDown,!0),this.domElement.addEventListener(`mouseout`,this._onPointerOverOut,!0),this.domElement.addEventListener(`mouseover`,this._onPointerOverOut,!0),globalThis.addEventListener(`mouseup`,this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener(`touchstart`,this._onPointerDown,!0),this.domElement.addEventListener(`touchend`,this._onPointerUp,!0),this.domElement.addEventListener(`touchmove`,this._onPointerMove,!0))),this.domElement.addEventListener(`wheel`,this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;DE.removeTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming=``,e.msTouchAction=``):this.supportsPointerEvents&&(e.touchAction=``)),this.supportsPointerEvents?(globalThis.document.removeEventListener(`pointermove`,this._onPointerMove,!0),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.domElement.removeEventListener(`pointerleave`,this._onPointerOverOut,!0),this.domElement.removeEventListener(`pointerover`,this._onPointerOverOut,!0),globalThis.removeEventListener(`pointerup`,this._onPointerUp,!0)):(globalThis.document.removeEventListener(`mousemove`,this._onPointerMove,!0),this.domElement.removeEventListener(`mousedown`,this._onPointerDown,!0),this.domElement.removeEventListener(`mouseout`,this._onPointerOverOut,!0),this.domElement.removeEventListener(`mouseover`,this._onPointerOverOut,!0),globalThis.removeEventListener(`mouseup`,this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener(`touchstart`,this._onPointerDown,!0),this.domElement.removeEventListener(`touchend`,this._onPointerUp,!0),this.domElement.removeEventListener(`touchmove`,this._onPointerMove,!0))),this.domElement.removeEventListener(`wheel`,this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,t,n){let r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},i=1/this.resolution;e.x=(t-r.left)*(this.domElement.width/r.width)*i,e.y=(n-r.top)*(this.domElement.height/r.height)*i}_normalizeToPointerData(e){let t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches[n];r.button===void 0&&(r.button=0),r.buttons===void 0&&(r.buttons=1),r.isPrimary===void 0&&(r.isPrimary=e.touches.length===1&&e.type===`touchstart`),r.width===void 0&&(r.width=r.radiusX||1),r.height===void 0&&(r.height=r.radiusY||1),r.tiltX===void 0&&(r.tiltX=0),r.tiltY===void 0&&(r.tiltY=0),r.pointerType===void 0&&(r.pointerType=`touch`),r.pointerId===void 0&&(r.pointerId=r.identifier||0),r.pressure===void 0&&(r.pressure=r.force||.5),r.twist===void 0&&(r.twist=0),r.tangentialPressure===void 0&&(r.tangentialPressure=0),r.layerX===void 0&&(r.layerX=r.offsetX=r.clientX),r.layerY===void 0&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let n=e;n.isPrimary===void 0&&(n.isPrimary=!0),n.width===void 0&&(n.width=1),n.height===void 0&&(n.height=1),n.tiltX===void 0&&(n.tiltX=0),n.tiltY===void 0&&(n.tiltY=0),n.pointerType===void 0&&(n.pointerType=`mouse`),n.pointerId===void 0&&(n.pointerId=Kbe),n.pressure===void 0&&(n.pressure=.5),n.twist===void 0&&(n.twist=0),n.tangentialPressure===void 0&&(n.tangentialPressure=0),n.isNormalized=!0,t.push(n)}else t.push(e);return t}normalizeWheelEvent(e){let t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type===`pointerleave`&&(e.type=`pointerout`),e.type.startsWith(`mouse`)&&(e.type=e.type.replace(`mouse`,`pointer`)),e.type.startsWith(`touch`)&&(e.type=qbe[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};ME.extension={name:`events`,type:[H.WebGLSystem,H.CanvasSystem,H.WebGPUSystem],priority:-1},ME.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};var NE=ME,Jbe={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode===`dynamic`||this.eventMode===`static`},set interactive(e){this.eventMode=e?`static`:`passive`},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??NE.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode===`static`||this.eventMode===`dynamic`},interactiveChildren:!0,hitArea:null,addEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof n==`object`?n.signal:void 0,a=typeof n==`object`?n.once===!0:!1,o=typeof t==`function`?void 0:t;e=r?`${e}capture`:e;let s=typeof t==`function`?t:t.handleEvent,c=this;i&&i.addEventListener(`abort`,()=>{c.off(e,s,o)}),a?c.once(e,s,o):c.on(e,s,o)},removeEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof t==`function`?void 0:t;e=r?`${e}capture`:e,t=typeof t==`function`?t:t.handleEvent,this.off(e,t,i)},dispatchEvent(e){if(!(e instanceof iT))throw Error(`Container cannot propagate events outside of the Federated Events API`);return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}},Ybe=`in vec2 aPosition;
738
+ `,e.accessibleText&&(t.innerText=e.accessibleText)),t.style.width=`${Cye}px`,t.style.height=`${Cye}px`,t.style.backgroundColor=this.debug?`rgba(255,255,255,0.5)`:`transparent`,t.style.position=`absolute`,t.style.zIndex=Eye.toString(),t.style.borderStyle=`none`,navigator.userAgent.toLowerCase().includes(`chrome`)?t.setAttribute(`aria-live`,`off`):t.setAttribute(`aria-live`,`polite`),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute(`aria-relevant`,`additions`):t.setAttribute(`aria-relevant`,`text`),t.addEventListener(`click`,this._onClick.bind(this)),t.addEventListener(`focus`,this._onFocus.bind(this)),t.addEventListener(`focusout`,this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute(`aria-label`,e.accessibleHint),e.interactive?t.tabIndex=e.tabIndex:t.tabIndex=0,this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){let{container:n}=e.target,r=this._renderer.events.rootBoundary,i=Object.assign(new iT(r),{target:n});r.rootTarget=this._renderer.lastObjectRendered,t.forEach(e=>r.dispatchEvent(i,e))}_onClick(e){this._dispatchEvent(e,[`click`,`pointertap`,`tap`])}_onFocus(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`assertive`),this._dispatchEvent(e,[`mouseover`])}_onFocusOut(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`polite`),this._dispatchEvent(e,[`mouseout`])}_onKeyDown(e){e.keyCode!==Sye||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._canvasObserver?.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener(`keydown`,this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener(`mousemove`,this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};xT.extension={type:[H.WebGLSystem,H.WebGPUSystem],name:`accessibility`},xT.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};var jye=xT,Mye={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:`button`,accessibleText:null,accessiblePointerEvents:`auto`,accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1},ST;function Nye(e){return ST===void 0&&(ST=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:e??Se.defaultOptions.failIfMajorPerformanceCaveat};try{if(!he.get().getWebGLRenderingContext())return!1;let e=he.get().createCanvas().getContext(`webgl`,t),n=!!e?.getContextAttributes()?.stencil;if(e){let t=e.getExtension(`WEBGL_lose_context`);t&&t.loseContext()}return e=null,n}catch{return!1}})()),ST}var CT;async function Pye(e={}){return CT===void 0&&(CT=await(async()=>{let t=he.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(e)).requestDevice(),!0}catch{return!1}})()),CT}var Fye=[`webgl`,`webgpu`,`canvas`];async function Iye(e){let t=[];e.preference?(t.push(e.preference),Fye.forEach(n=>{n!==e.preference&&t.push(n)})):t=Fye.slice();let n,r={};for(let i=0;i<t.length;i++){let a=t[i];if(a===`webgpu`&&await Pye()){let{WebGPURenderer:t}=await l(async()=>{let{WebGPURenderer:e}=await import(`./WebGPURenderer-DAH_m5D3.js`);return{WebGPURenderer:e}},__vite__mapDeps([7,4,2]));n=t,r={...e,...e.webgpu};break}else if(a===`webgl`&&Nye(e.failIfMajorPerformanceCaveat??Se.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:t}=await l(async()=>{let{WebGLRenderer:e}=await import(`./WebGLRenderer-CCytcJrB.js`);return{WebGLRenderer:e}},__vite__mapDeps([8,4,2]));n=t,r={...e,...e.webgl};break}else if(a===`canvas`){let{CanvasRenderer:t}=await l(async()=>{let{CanvasRenderer:e}=await import(`./CanvasRenderer-CLQD6X5w.js`);return{CanvasRenderer:e}},__vite__mapDeps([9,4,2]));n=t,r={...e,...e.canvasOptions};break}}if(delete r.webgpu,delete r.webgl,delete r.canvasOptions,!n)throw Error(`No available renderer for the current environment`);let i=new n;return await i.init(r),i}var Lye=class{static init(e){Object.defineProperty(this,`resizeTo`,{configurable:!0,set(e){globalThis.removeEventListener(`resize`,this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener(`resize`,this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&=(cancelAnimationFrame(this._resizeId),null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,t;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{let{clientWidth:n,clientHeight:r}=this._resizeTo;e=n,t=r}this.renderer.resize(e,t),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener(`resize`,this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};Lye.extension=H.Application;var wT=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,`ticker`,{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,z.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?te.shared:new te,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};wT.extension=H.Application,V.add(Lye),V.add(wT);var TT=class e{constructor(...e){this.stage=new _e,e[0]!==void 0&&le(y,`Application constructor options are deprecated, please use Application.init() instead.`)}async init(t){t={...t},this.stage||=new _e,this.renderer=await Iye(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return le(y,`Application.view is deprecated, please use Application.canvas instead.`),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,n=!1){let r=e._plugins.slice(0);r.reverse(),r.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(n),this.stage=null,this.renderer.destroy(t),this.renderer=null}};TT._plugins=[];var ET=TT;V.handleByList(H.Application,ET._plugins),V.add(Ce);var Rye=e(i(((e,t)=>{t.exports=i;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=/([astvzqmhlc])([^astvzqmhlc]*)/gi;function i(e){var t=[];return e.replace(r,function(e,r,i){var a=r.toLowerCase();for(i=o(i),a==`m`&&i.length>2&&(t.push([r].concat(i.splice(0,2))),a=`l`,r=r==`m`?`l`:`L`);;){if(i.length==n[a])return i.unshift(r),t.push(i);if(i.length<n[a])throw Error(`malformed path data`);t.push([r].concat(i.splice(0,n[a])))}}),t}var a=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function o(e){var t=e.match(a);return t?t.map(Number):[]}}))(),1);function zye(e,t){let n=(0,Rye.default)(e),r=[],i=null,a=0,o=0;for(let e=0;e<n.length;e++){let s=n[e],c=s[0],l=s;switch(c){case`M`:a=l[1],o=l[2],t.moveTo(a,o);break;case`m`:a+=l[1],o+=l[2],t.moveTo(a,o);break;case`H`:a=l[1],t.lineTo(a,o);break;case`h`:a+=l[1],t.lineTo(a,o);break;case`V`:o=l[1],t.lineTo(a,o);break;case`v`:o+=l[1],t.lineTo(a,o);break;case`L`:a=l[1],o=l[2],t.lineTo(a,o);break;case`l`:a+=l[1],o+=l[2],t.lineTo(a,o);break;case`C`:a=l[5],o=l[6],t.bezierCurveTo(l[1],l[2],l[3],l[4],a,o);break;case`c`:t.bezierCurveTo(a+l[1],o+l[2],a+l[3],o+l[4],a+l[5],o+l[6]),a+=l[5],o+=l[6];break;case`S`:a=l[3],o=l[4],t.bezierCurveToShort(l[1],l[2],a,o);break;case`s`:t.bezierCurveToShort(a+l[1],o+l[2],a+l[3],o+l[4]),a+=l[3],o+=l[4];break;case`Q`:a=l[3],o=l[4],t.quadraticCurveTo(l[1],l[2],a,o);break;case`q`:t.quadraticCurveTo(a+l[1],o+l[2],a+l[3],o+l[4]),a+=l[3],o+=l[4];break;case`T`:a=l[1],o=l[2],t.quadraticCurveToShort(a,o);break;case`t`:a+=l[1],o+=l[2],t.quadraticCurveToShort(a,o);break;case`A`:a=l[6],o=l[7],t.arcToSvg(l[1],l[2],l[3],l[4],l[5],a,o);break;case`a`:a+=l[6],o+=l[7],t.arcToSvg(l[1],l[2],l[3],l[4],l[5],a,o);break;case`Z`:case`z`:t.closePath(),r.length>0&&(i=r.pop(),i?(a=i.startX,o=i.startY):(a=0,o=0)),i=null;break;default:v(`Unknown SVG path command: ${c}`)}c!==`Z`&&c!==`z`&&i===null&&(i={startX:a,startY:o},r.push(i))}return t}var Bye=class e{constructor(e=0,t=0,n=0){this.type=`circle`,this.x=e,this.y=t,this.radius=n}clone(){return new e(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let n=this.radius*this.radius,r=this.x-e,i=this.y-t;return r*=r,i*=i,r+i<=n}strokeContains(e,t,n,r=.5){if(this.radius===0)return!1;let i=this.x-e,a=this.y-t,o=this.radius,s=(1-r)*n,c=Math.sqrt(i*i+a*a);return c<=o+s&&c>o-(n-s)}getBounds(e){return e||=new M,e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}},Vye=class e{constructor(e=0,t=0,n=0,r=0){this.type=`ellipse`,this.x=e,this.y=t,this.halfWidth=n,this.halfHeight=r}clone(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)}contains(e,t){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let n=(e-this.x)/this.halfWidth,r=(t-this.y)/this.halfHeight;return n*=n,r*=r,n+r<=1}strokeContains(e,t,n,r=.5){let{halfWidth:i,halfHeight:a}=this;if(i<=0||a<=0)return!1;let o=n*(1-r),s=n-o,c=i-s,l=a-s,u=i+o,d=a+o,f=e-this.x,p=t-this.y,m=f*f/(c*c)+p*p/(l*l),h=f*f/(u*u)+p*p/(d*d);return m>1&&h<=1}getBounds(e){return e||=new M,e.x=this.x-this.halfWidth,e.y=this.y-this.halfHeight,e.width=this.halfWidth*2,e.height=this.halfHeight*2,e}copyFrom(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}};function Hye(e,t,n,r,i,a){let o=e-n,s=t-r,c=i-n,l=a-r,u=o*c+s*l,d=c*c+l*l,f=-1;d!==0&&(f=u/d);let p,m;f<0?(p=n,m=r):f>1?(p=i,m=a):(p=n+f*c,m=r+f*l);let h=e-p,g=t-m;return h*h+g*g}var Uye,Wye,DT=class e{constructor(...e){this.type=`polygon`;let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!=`number`){let e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n].x,t[n].y);t=e}this.points=t,this.closePath=!0}isClockwise(){let e=0,t=this.points,n=t.length;for(let r=0;r<n;r+=2){let i=t[r],a=t[r+1],o=t[(r+2)%n],s=t[(r+3)%n];e+=(o-i)*(s+a)}return e<0}containsPolygon(e){let t=this.getBounds(Uye),n=e.getBounds(Wye);if(!t.containsRect(n))return!1;let r=e.points;for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];if(!this.contains(t,n))return!1}return!0}clone(){let t=new e(this.points.slice());return t.closePath=this.closePath,t}contains(e,t){let n=!1,r=this.points.length/2;for(let i=0,a=r-1;i<r;a=i++){let r=this.points[i*2],o=this.points[i*2+1],s=this.points[a*2],c=this.points[a*2+1];o>t!=c>t&&e<(s-r)*((t-o)/(c-o))+r&&(n=!n)}return n}strokeContains(e,t,n,r=.5){let i=n*n,a=i*(1-r),o=i-a,{points:s}=this,c=s.length-(this.closePath?0:2);for(let n=0;n<c;n+=2){let r=s[n],i=s[n+1],c=s[(n+2)%s.length],l=s[(n+3)%s.length];if(Hye(e,t,r,i,c,l)<=(Math.sign((c-r)*(t-i)-(l-i)*(e-r))<0?o:a))return!0}return!1}getBounds(e){e||=new M;let t=this.points,n=1/0,r=-1/0,i=1/0,a=-1/0;for(let e=0,o=t.length;e<o;e+=2){let o=t[e],s=t[e+1];n=o<n?o:n,r=o>r?o:r,i=s<i?s:i,a=s>a?s:a}return e.x=n,e.width=r-n,e.y=i,e.height=a-i,e}copyFrom(e){return this.points=e.points.slice(),this.closePath=e.closePath,this}copyTo(e){return e.copyFrom(this),e}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((e,t)=>`${e}, ${t}`,``)}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return le(`8.11.0`,`Polygon.lastX is deprecated, please use Polygon.lastX instead.`),this.points[this.points.length-2]}get y(){return le(`8.11.0`,`Polygon.y is deprecated, please use Polygon.lastY instead.`),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}},OT=(e,t,n,r,i,a,o)=>{let s=e-n,c=t-r,l=Math.sqrt(s*s+c*c);return l>=i-a&&l<=i+o},Gye=class e{constructor(e=0,t=0,n=0,r=0,i=20){this.type=`roundedRectangle`,this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i}getBounds(e){return e||=new M,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}clone(){return new e(this.x,this.y,this.width,this.height,this.radius)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+n&&t<=this.y+this.height-n||e>=this.x+n&&e<=this.x+this.width-n)return!0;let r=e-(this.x+n),i=t-(this.y+n),a=n*n;if(r*r+i*i<=a||(r=e-(this.x+this.width-n),r*r+i*i<=a)||(i=t-(this.y+this.height-n),r*r+i*i<=a)||(r=e-(this.x+n),r*r+i*i<=a))return!0}return!1}strokeContains(e,t,n,r=.5){let{x:i,y:a,width:o,height:s,radius:c}=this,l=n*(1-r),u=n-l,d=i+c,f=a+c,p=o-c*2,m=s-c*2,h=i+o,g=a+s;return(e>=i-l&&e<=i+u||e>=h-u&&e<=h+l)&&t>=f&&t<=f+m||(t>=a-l&&t<=a+u||t>=g-u&&t<=g+l)&&e>=d&&e<=d+p?!0:e<d&&t<f&&OT(e,t,d,f,c,u,l)||e>h-c&&t<f&&OT(e,t,h-c,f,c,u,l)||e>h-c&&t>g-c&&OT(e,t,h-c,g-c,c,u,l)||e<d&&t>g-c&&OT(e,t,d,g-c,c,u,l)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}};function Kye(e,t,n,r,i,a,o,s=null){let c=0;n*=t,i*=a;let l=s.a,u=s.b,d=s.c,f=s.d,p=s.tx,m=s.ty;for(;c<o;){let o=e[n],s=e[n+1];r[i]=l*o+d*s+p,r[i+1]=u*o+f*s+m,i+=a,n+=t,c++}}function qye(e,t,n,r){let i=0;for(t*=n;i<r;)e[t]=0,e[t+1]=0,t+=n,i++}function kT(e,t,n,r,i){let a=t.a,o=t.b,s=t.c,c=t.d,l=t.tx,u=t.ty;n||=0,r||=2,i||=e.length/r-n;let d=n*r;for(let t=0;t<i;t++){let t=e[d],n=e[d+1];e[d]=a*t+s*n+l,e[d+1]=o*t+c*n+u,d+=r}}var Jye=new u,AT=class{constructor(){this.packAsQuad=!1,this.batcherName=`default`,this.topology=`triangle-list`,this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:`normal`}get color(){let e=this.baseColor,t=e>>16|e&65280|(e&255)<<16,n=this.renderable;return n?C(t,n.groupColor)+(this.alpha*n.groupAlpha*255<<24):t+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||Jye}copyTo(e){e.indexOffset=this.indexOffset,e.indexSize=this.indexSize,e.attributeOffset=this.attributeOffset,e.attributeSize=this.attributeSize,e.baseColor=this.baseColor,e.alpha=this.alpha,e.texture=this.texture,e.geometryData=this.geometryData,e.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology=`triangle-list`}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}},jT={extension:{type:H.ShapeBuilder,name:`circle`},build(e,t){let n,r,i,a,o,s;if(e.type===`circle`){let t=e;if(o=s=t.radius,o<=0)return!1;n=t.x,r=t.y,i=a=0}else if(e.type===`ellipse`){let t=e;if(o=t.halfWidth,s=t.halfHeight,o<=0||s<=0)return!1;n=t.x,r=t.y,i=a=0}else{let t=e,c=t.width/2,l=t.height/2;n=t.x+c,r=t.y+l,o=s=Math.max(0,Math.min(t.radius,Math.min(c,l))),i=c-o,a=l-s}if(i<0||a<0)return!1;let c=Math.ceil(2.3*Math.sqrt(o+s)),l=c*8+(i?4:0)+(a?4:0);if(l===0)return!1;if(c===0)return t[0]=t[6]=n+i,t[1]=t[3]=r+a,t[2]=t[4]=n-i,t[5]=t[7]=r-a,!0;let u=0,d=c*4+(i?2:0)+2,f=d,p=l,m=i+o,h=a,g=n+m,_=n-m,v=r+h;if(t[u++]=g,t[u++]=v,t[--d]=v,t[--d]=_,a){let e=r-h;t[f++]=_,t[f++]=e,t[--p]=e,t[--p]=g}for(let e=1;e<c;e++){let l=Math.PI/2*(e/c),m=i+Math.cos(l)*o,h=a+Math.sin(l)*s,g=n+m,_=n-m,v=r+h,y=r-h;t[u++]=g,t[u++]=v,t[--d]=v,t[--d]=_,t[f++]=_,t[f++]=y,t[--p]=y,t[--p]=g}m=i,h=a+s,g=n+m,_=n-m,v=r+h;let y=r-h;return t[u++]=g,t[u++]=v,t[--p]=y,t[--p]=g,i&&(t[u++]=_,t[u++]=v,t[--p]=y,t[--p]=_),!0},triangulate(e,t,n,r,i,a){if(e.length===0)return;let o=0,s=0;for(let t=0;t<e.length;t+=2)o+=e[t],s+=e[t+1];o/=e.length/2,s/=e.length/2;let c=r;t[c*n]=o,t[c*n+1]=s;let l=c++;for(let r=0;r<e.length;r+=2)t[c*n]=e[r],t[c*n+1]=e[r+1],r>0&&(i[a++]=c,i[a++]=l,i[a++]=c-1),c++;i[a++]=l+1,i[a++]=l,i[a++]=c-1}},Yye={...jT,extension:{...jT.extension,name:`ellipse`}},Xye={...jT,extension:{...jT.extension,name:`roundedRectangle`}},MT=1e-4,NT=1e-4;function Zye(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function PT(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function FT(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}function IT(e,t,n,r,i,a){let o=MT;if(e.length===0)return;let s=t,c=s.alignment;if(t.alignment!==.5){let t=Zye(e);n&&(t*=-1),c=(c-.5)*t+.5}let l=new L(e[0],e[1]),u=new L(e[e.length-2],e[e.length-1]),d=r,f=Math.abs(l.x-u.x)<o&&Math.abs(l.y-u.y)<o;if(d){e=e.slice(),f&&(e.pop(),e.pop(),u.set(e[e.length-2],e[e.length-1]));let t=(l.x+u.x)*.5,n=(u.y+l.y)*.5;e.unshift(t,n),e.push(t,n)}let p=i,m=e.length/2,h=e.length,g=p.length/2,_=s.width/2,v=_*_,y=s.miterLimit*s.miterLimit,b=e[0],x=e[1],S=e[2],C=e[3],w=0,T=0,E=-(x-C),D=b-S,O=0,k=0,A=Math.sqrt(E*E+D*D);E/=A,D/=A,E*=_,D*=_;let j=c,M=(1-j)*2,N=j*2;d||(s.cap===`round`?h+=FT(b-E*(M-N)*.5,x-D*(M-N)*.5,b-E*M,x-D*M,b+E*N,x+D*N,p,!0)+2:s.cap===`square`&&(h+=PT(b,x,E,D,M,N,!0,p))),p.push(b-E*M,x-D*M),p.push(b+E*N,x+D*N);for(let t=1;t<m-1;++t){b=e[(t-1)*2],x=e[(t-1)*2+1],S=e[t*2],C=e[t*2+1],w=e[(t+1)*2],T=e[(t+1)*2+1],E=-(x-C),D=b-S,A=Math.sqrt(E*E+D*D),E/=A,D/=A,E*=_,D*=_,O=-(C-T),k=S-w,A=Math.sqrt(O*O+k*k),O/=A,k/=A,O*=_,k*=_;let n=S-b,r=x-C,i=S-w,a=T-C,o=n*i+r*a,c=r*i-a*n,l=c<0;if(Math.abs(c)<.001*Math.abs(o)){p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),o>=0&&(s.join===`round`?h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+4:h+=2,p.push(S-O*N,C-k*N),p.push(S+O*M,C+k*M));continue}let u=(-E+b)*(-D+C)-(-E+S)*(-D+x),d=(-O+w)*(-k+C)-(-O+S)*(-k+T),f=(n*d-i*u)/c,m=(a*u-r*d)/c,g=(f-S)*(f-S)+(m-C)*(m-C),j=S+(f-S)*M,P=C+(m-C)*M,F=S-(f-S)*N,ee=C-(m-C)*N,I=Math.min(n*n+r*r,i*i+a*a),L=l?M:N;g<=I+L*L*v?s.join===`bevel`||g/v>y?(l?(p.push(j,P),p.push(S+E*N,C+D*N),p.push(j,P),p.push(S+O*N,C+k*N)):(p.push(S-E*M,C-D*M),p.push(F,ee),p.push(S-O*M,C-k*M),p.push(F,ee)),h+=2):s.join===`round`?l?(p.push(j,P),p.push(S+E*N,C+D*N),h+=FT(S,C,S+E*N,C+D*N,S+O*N,C+k*N,p,!0)+4,p.push(j,P),p.push(S+O*N,C+k*N)):(p.push(S-E*M,C-D*M),p.push(F,ee),h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+4,p.push(S-O*M,C-k*M),p.push(F,ee)):(p.push(j,P),p.push(F,ee)):(p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),s.join===`round`?l?h+=FT(S,C,S+E*N,C+D*N,S+O*N,C+k*N,p,!0)+2:h+=FT(S,C,S-E*M,C-D*M,S-O*M,C-k*M,p,!1)+2:s.join===`miter`&&g/v<=y&&(l?(p.push(F,ee),p.push(F,ee)):(p.push(j,P),p.push(j,P)),h+=2),p.push(S-O*M,C-k*M),p.push(S+O*N,C+k*N),h+=2)}b=e[(m-2)*2],x=e[(m-2)*2+1],S=e[(m-1)*2],C=e[(m-1)*2+1],E=-(x-C),D=b-S,A=Math.sqrt(E*E+D*D),E/=A,D/=A,E*=_,D*=_,p.push(S-E*M,C-D*M),p.push(S+E*N,C+D*N),d||(s.cap===`round`?h+=FT(S-E*(M-N)*.5,C-D*(M-N)*.5,S-E*M,C-D*M,S+E*N,C+D*N,p,!1)+2:s.cap===`square`&&(h+=PT(S,C,E,D,M,N,!1,p)));let P=NT*NT;for(let e=g;e<h+g-2;++e)b=p[e*2],x=p[e*2+1],S=p[(e+1)*2],C=p[(e+1)*2+1],w=p[(e+2)*2],T=p[(e+2)*2+1],!(Math.abs(b*(C-T)+S*(T-x)+w*(x-C))<P)&&a.push(e,e+1,e+2)}function Qye(e,t,n,r){let i=MT;if(e.length===0)return;let a=e[0],o=e[1],s=e[e.length-2],c=e[e.length-1],l=t||Math.abs(a-s)<i&&Math.abs(o-c)<i,u=n,d=e.length/2,f=u.length/2;for(let t=0;t<d;t++)u.push(e[t*2]),u.push(e[t*2+1]);for(let e=0;e<d-1;e++)r.push(f+e,f+e+1);l&&r.push(f+d-1,f)}function LT(e,t,n,r,i,a,o){let s=Ie(e,t,2);if(!s)return;for(let e=0;e<s.length;e+=3)a[o++]=s[e]+i,a[o++]=s[e+1]+i,a[o++]=s[e+2]+i;let c=i*r;for(let t=0;t<e.length;t+=2)n[c]=e[t],n[c+1]=e[t+1],c+=r}var $ye=[],ebe={extension:{type:H.ShapeBuilder,name:`polygon`},build(e,t){for(let n=0;n<e.points.length;n++)t[n]=e.points[n];return!0},triangulate(e,t,n,r,i,a){LT(e,$ye,t,n,r,i,a)}},tbe={extension:{type:H.ShapeBuilder,name:`rectangle`},build(e,t){let n=e,r=n.x,i=n.y,a=n.width,o=n.height;return a>0&&o>0?(t[0]=r,t[1]=i,t[2]=r+a,t[3]=i,t[4]=r+a,t[5]=i+o,t[6]=r,t[7]=i+o,!0):!1},triangulate(e,t,n,r,i,a){let o=0;r*=n,t[r+o]=e[0],t[r+o+1]=e[1],o+=n,t[r+o]=e[2],t[r+o+1]=e[3],o+=n,t[r+o]=e[6],t[r+o+1]=e[7],o+=n,t[r+o]=e[4],t[r+o+1]=e[5],o+=n;let s=r/n;i[a++]=s,i[a++]=s+1,i[a++]=s+2,i[a++]=s+1,i[a++]=s+3,i[a++]=s+2}},nbe={extension:{type:H.ShapeBuilder,name:`triangle`},build(e,t){return t[0]=e.x,t[1]=e.y,t[2]=e.x2,t[3]=e.y2,t[4]=e.x3,t[5]=e.y3,!0},triangulate(e,t,n,r,i,a){let o=0;r*=n,t[r+o]=e[0],t[r+o+1]=e[1],o+=n,t[r+o]=e[2],t[r+o+1]=e[3],o+=n,t[r+o]=e[4],t[r+o+1]=e[5];let s=r/n;i[a++]=s,i[a++]=s+1,i[a++]=s+2}},RT=[{offset:0,color:`white`},{offset:1,color:`black`}],zT=class e{constructor(...t){this.uid=A(`fillGradient`),this._tick=0,this.type=`linear`,this.colorStops=[];let n=rbe(t);n={...n.type===`radial`?e.defaultRadialOptions:e.defaultLinearOptions,...g(n)},this._textureSize=n.textureSize,this._wrapMode=n.wrapMode,n.type===`radial`?(this.center=n.center,this.outerCenter=n.outerCenter??this.center,this.innerRadius=n.innerRadius,this.outerRadius=n.outerRadius,this.scale=n.scale,this.rotation=n.rotation):(this.start=n.start,this.end=n.end),this.textureSpace=n.textureSpace,this.type=n.type,n.colorStops.forEach(e=>{this.addColorStop(e.offset,e.color)})}addColorStop(e,t){return this.colorStops.push({offset:e,color:x.shared.setValue(t).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:e,y:t}=this.start,{x:n,y:r}=this.end,i=n-e,a=r-t,o=i<0||a<0;if(this._wrapMode===`clamp-to-edge`){if(i<0){let t=e;e=n,n=t,i*=-1}if(a<0){let e=t;t=r,r=e,a*=-1}}let s=this.colorStops.length?this.colorStops:RT,c=this._textureSize,{canvas:l,context:d}=HT(c,1),p=o?d.createLinearGradient(this._textureSize,0,0,0):d.createLinearGradient(0,0,this._textureSize,0);VT(p,s),d.fillStyle=p,d.fillRect(0,0,c,1),this.texture=new f({source:new be({resource:l,addressMode:this._wrapMode})});let m=Math.sqrt(i*i+a*a),h=Math.atan2(a,i),g=new u;g.scale(m/c,1),g.rotate(h),g.translate(e,t),this.textureSpace===`local`&&g.scale(c,c),this.transform=g}buildGradient(){this.texture||this._tick++,this.type===`linear`?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let e=this.colorStops.length?this.colorStops:RT,t=this._textureSize,{canvas:n,context:r}=HT(t,t),{x:i,y:a}=this.center,{x:o,y:s}=this.outerCenter,c=this.innerRadius,l=this.outerRadius,d=o-l,p=s-l,m=t/(l*2),h=(i-d)*m,g=(a-p)*m,_=r.createRadialGradient(h,g,c*m,(o-d)*m,(s-p)*m,l*m);VT(_,e),r.fillStyle=e[e.length-1].color,r.fillRect(0,0,t,t),r.fillStyle=_,r.translate(h,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-h,-g),r.fillRect(0,0,t,t),this.texture=new f({source:new be({resource:n,addressMode:this._wrapMode})});let v=new u;v.scale(1/m,1/m),v.translate(d,p),this.textureSpace===`local`&&v.scale(t,t),this.transform=v}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};zT.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:`local`,type:`linear`,textureSize:256,wrapMode:`clamp-to-edge`},zT.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:`local`,type:`radial`,textureSize:256,wrapMode:`clamp-to-edge`};var BT=zT;function VT(e,t){for(let n=0;n<t.length;n++){let r=t[n];e.addColorStop(r.offset,r.color)}}function HT(e,t){let n=he.get().createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`)}}function rbe(e){let t=e[0]??{};return(typeof t==`number`||e[1])&&(le(`8.5.2`,`use options object instead`),t={type:`linear`,start:{x:e[0],y:e[1]},end:{x:e[2],y:e[3]},textureSpace:e[4],textureSize:e[5]??BT.defaultLinearOptions.textureSize}),t}var ibe=new u,abe=new M;function UT(e,t,n,r){let i=t.matrix?e.copyFrom(t.matrix).invert():e.identity();if(t.textureSpace===`local`){let e=n.getBounds(abe);t.width&&e.pad(t.width);let{x:r,y:a}=e,o=1/e.width,s=1/e.height,c=-r*o,l=-a*s,u=i.a,d=i.b,f=i.c,p=i.d;i.a*=o,i.b*=o,i.c*=s,i.d*=s,i.tx=c*u+l*f+i.tx,i.ty=c*d+l*p+i.ty}else i.translate(t.texture.frame.x,t.texture.frame.y),i.scale(1/t.texture.source.width,1/t.texture.source.height);let a=t.texture.source.style;return!(t.fill instanceof BT)&&a.addressMode===`clamp-to-edge`&&(a.addressMode=`repeat`,a.update()),r&&i.append(ibe.copyFrom(r).invert()),i}var WT={};V.handleByMap(H.ShapeBuilder,WT),V.add(tbe,ebe,nbe,jT,Yye,Xye);var obe=new M,sbe=new u;function cbe(e,t){let{geometryData:n,batches:r}=t;r.length=0,n.indices.length=0,n.vertices.length=0,n.uvs.length=0;for(let t=0;t<e.instructions.length;t++){let i=e.instructions[t];if(i.action===`texture`)lbe(i.data,r,n);else if(i.action===`fill`||i.action===`stroke`){let e=i.action===`stroke`,t=i.data.path.shapePath,a=i.data.style,o=i.data.hole;e&&o&&GT(o.shapePath,a,!0,r,n),o&&(t.shapePrimitives[t.shapePrimitives.length-1].holes=o.shapePath.shapePrimitives),GT(t,a,e,r,n)}}}function lbe(e,t,n){let r=[],i=WT.rectangle,a=obe;a.x=e.dx,a.y=e.dy,a.width=e.dw,a.height=e.dh;let o=e.transform;if(!i.build(a,r))return;let{vertices:s,uvs:c,indices:l}=n,u=l.length,d=s.length/2;o&&kT(r,o),i.triangulate(r,s,2,d,l,u);let f=e.image,p=f.uvs;c.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);let m=w.get(AT);m.indexOffset=u,m.indexSize=l.length-u,m.attributeOffset=d,m.attributeSize=s.length/2-d,m.baseColor=e.style,m.alpha=e.alpha,m.texture=f,m.geometryData=n,t.push(m)}function GT(e,t,n,r,i){let{vertices:a,uvs:o,indices:s}=i;e.shapePrimitives.forEach(({shape:e,transform:c,holes:l})=>{let u=[],d=WT[e.type];if(!d.build(e,u))return;let p=s.length,m=a.length/2,h=`triangle-list`;if(c&&kT(u,c),n){let n=e.closePath??!0,r=t;r.pixelLine?(Qye(u,n,a,s),h=`line-list`):IT(u,r,!1,n,a,s)}else if(l){let e=[],t=u.slice();ube(l).forEach(n=>{e.push(t.length/2),t.push(...n)}),LT(t,e,a,2,m,s,p)}else d.triangulate(u,a,2,m,s,p);let g=o.length/2,_=t.texture;if(_!==f.WHITE){let n=UT(sbe,t,e,c);Kye(a,2,m,o,g,2,a.length/2-m,n)}else qye(o,g,2,a.length/2-m);let v=w.get(AT);v.indexOffset=p,v.indexSize=s.length-p,v.attributeOffset=m,v.attributeSize=a.length/2-m,v.baseColor=t.color,v.alpha=t.alpha,v.texture=_,v.geometryData=i,v.topology=h,r.push(v)})}function ube(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].shape,i=[];WT[r.type].build(r,i)&&t.push(i)}return t}var dbe=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(e=>{w.return(e)}),this.graphicsData&&w.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}},fbe=class{constructor(){this.instructions=new ge}init(e){let t=e.maxTextures;this.batcher?this.batcher._updateMaxTextures(t):this.batcher=new Ve({maxTextures:t}),this.instructions.reset()}get geometry(){return le(j,`GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead.`),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}},KT=class e{constructor(e){this._renderer=e,this._managedContexts=new Me({renderer:e,type:`resource`,name:`graphicsContext`})}init(t){e.defaultOptions.bezierSmoothness=t?.bezierSmoothness??e.defaultOptions.bezierSmoothness}getContextRenderData(e){return e._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(e)}updateGpuContext(e){let t=!!e._gpuData[this._renderer.uid],n=e._gpuData[this._renderer.uid]||this._initContext(e);if(e.dirty||!t){t&&n.reset(),cbe(e,n);let r=e.batchMode;e.customShader||r===`no-batch`?n.isBatchable=!1:r===`auto`?n.isBatchable=n.geometryData.vertices.length<400:n.isBatchable=!0,e.dirty=!1}return n}getGpuContext(e){return e._gpuData[this._renderer.uid]||this._initContext(e)}_initContextRenderData(e){let t=w.get(fbe,{maxTextures:this._renderer.limits.maxBatchableTextures}),n=e._gpuData[this._renderer.uid],{batches:r,geometryData:i}=n;n.graphicsData=t;let a=i.vertices.length,o=i.indices.length;for(let e=0;e<r.length;e++)r[e].applyTransform=!1;let s=t.batcher;s.ensureAttributeBuffer(a),s.ensureIndexBuffer(o),s.begin();for(let e=0;e<r.length;e++){let t=r[e];s.add(t)}s.finish(t.instructions);let c=s.geometry;c.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),c.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!0);let l=s.batches;for(let e=0;e<l.length;e++){let t=l[e];t.bindGroup=Xe(t.textures.textures,t.textures.count,this._renderer.limits.maxBatchableTextures)}return t}_initContext(e){let t=new dbe;return t.context=e,e._gpuData[this._renderer.uid]=t,this._managedContexts.add(e),t}destroy(){this._managedContexts.destroy(),this._renderer=null}};KT.extension={type:[H.WebGLSystem,H.WebGPUSystem],name:`graphicsContext`},KT.defaultOptions={bezierSmoothness:.5};var qT=KT,pbe=8,JT=1.1920929e-7,mbe=1,YT=.01,XT=0,ZT=0;function QT(e,t,n,r,i,a,o,s,c,l){let u=(mbe-Math.min(.99,Math.max(0,l??qT.defaultOptions.bezierSmoothness)))/1;return u*=u,hbe(t,n,r,i,a,o,s,c,e,u),e}function hbe(e,t,n,r,i,a,o,s,c,l){$T(e,t,n,r,i,a,o,s,c,l,0),c.push(o,s)}function $T(e,t,n,r,i,a,o,s,c,l,u){if(u>pbe)return;let d=Math.PI,f=(e+n)/2,p=(t+r)/2,m=(n+i)/2,h=(r+a)/2,g=(i+o)/2,_=(a+s)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(h+_)/2,S=(v+b)/2,C=(y+x)/2;if(u>0){let u=o-e,f=s-t,p=Math.abs((n-o)*f-(r-s)*u),m=Math.abs((i-o)*f-(a-s)*u),h,g;if(p>JT&&m>JT){if((p+m)*(p+m)<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}let l=Math.atan2(a-r,i-n);if(h=Math.abs(l-Math.atan2(r-t,n-e)),g=Math.abs(Math.atan2(s-a,o-i)-l),h>=d&&(h=2*d-h),g>=d&&(g=2*d-g),h+g<XT){c.push(S,C);return}if(ZT!==0){if(h>ZT){c.push(n,r);return}if(g>ZT){c.push(i,a);return}}}}else if(p>JT){if(p*p<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}if(h=Math.abs(Math.atan2(a-r,i-n)-Math.atan2(r-t,n-e)),h>=d&&(h=2*d-h),h<XT){c.push(n,r),c.push(i,a);return}if(ZT!==0&&h>ZT){c.push(n,r);return}}}else if(m>JT){if(m*m<=l*(u*u+f*f)){if(XT<YT){c.push(S,C);return}if(h=Math.abs(Math.atan2(s-a,o-i)-Math.atan2(a-r,i-n)),h>=d&&(h=2*d-h),h<XT){c.push(n,r),c.push(i,a);return}if(ZT!==0&&h>ZT){c.push(i,a);return}}}else if(u=S-(e+o)/2,f=C-(t+s)/2,u*u+f*f<=l){c.push(S,C);return}}$T(e,t,f,p,v,y,S,C,c,l,u+1),$T(S,C,b,x,g,_,o,s,c,l,u+1)}var gbe=8,_be=1.1920929e-7,vbe=1,ybe=.01,eE=0;function bbe(e,t,n,r,i,a,o,s){let c=(vbe-Math.min(.99,Math.max(0,s??qT.defaultOptions.bezierSmoothness)))/1;return c*=c,xbe(t,n,r,i,a,o,e,c),e}function xbe(e,t,n,r,i,a,o,s){tE(o,e,t,n,r,i,a,s,0),o.push(i,a)}function tE(e,t,n,r,i,a,o,s,c){if(c>gbe)return;let l=Math.PI,u=(t+r)/2,d=(n+i)/2,f=(r+a)/2,p=(i+o)/2,m=(u+f)/2,h=(d+p)/2,g=a-t,_=o-n,v=Math.abs((r-a)*_-(i-o)*g);if(v>_be){if(v*v<=s*(g*g+_*_)){if(eE<ybe){e.push(m,h);return}let s=Math.abs(Math.atan2(o-i,a-r)-Math.atan2(i-n,r-t));if(s>=l&&(s=2*l-s),s<eE){e.push(m,h);return}}}else if(g=m-(t+a)/2,_=h-(n+o)/2,g*g+_*_<=s){e.push(m,h);return}tE(e,t,n,u,d,m,h,s,c+1),tE(e,m,h,f,p,a,o,s,c+1)}function nE(e,t,n,r,i,a,o,s){let c=Math.abs(i-a);(!o&&i>a||o&&a>i)&&(c=2*Math.PI-c),s||=Math.max(6,Math.floor(6*r**(1/3)*(c/Math.PI))),s=Math.max(s,3);let l=c/s,u=i;l*=o?-1:1;for(let i=0;i<s+1;i++){let i=Math.cos(u),a=Math.sin(u),o=t+i*r,s=n+a*r;e.push(o,s),u+=l}}function Sbe(e,t,n,r,i,a){let o=e[e.length-2],s=e[e.length-1]-n,c=o-t,l=i-n,u=r-t,d=Math.abs(s*u-c*l);if(d<1e-8||a===0){(e[e.length-2]!==t||e[e.length-1]!==n)&&e.push(t,n);return}let f=s*s+c*c,p=l*l+u*u,m=s*l+c*u,h=a*Math.sqrt(f)/d,g=a*Math.sqrt(p)/d,_=h*m/f,v=g*m/p,y=h*u+g*c,b=h*l+g*s,x=c*(g+_),S=s*(g+_),C=u*(h+v),w=l*(h+v),T=Math.atan2(S-b,x-y),E=Math.atan2(w-b,C-y);nE(e,y+t,b+n,a,T,E,c*l>u*s)}var rE=Math.PI*2,iE={centerX:0,centerY:0,ang1:0,ang2:0},aE=({x:e,y:t},n,r,i,a,o,s,c)=>{e*=n,t*=r;let l=i*e-a*t,u=a*e+i*t;return c.x=l+o,c.y=u+s,c};function Cbe(e,t){let n=t===-1.5707963267948966?-.551915024494:4/3*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:n,i=Math.cos(e),a=Math.sin(e),o=Math.cos(e+t),s=Math.sin(e+t);return[{x:i-a*r,y:a+i*r},{x:o+s*r,y:s-o*r},{x:o,y:s}]}var oE=(e,t,n,r)=>{let i=e*r-t*n<0?-1:1,a=e*n+t*r;return a>1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)},wbe=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=i**2,m=a**2,h=u**2,g=d**2,_=p*m-p*g-m*h;_<0&&(_=0),_/=p*g+m*h,_=Math.sqrt(_)*(o===s?-1:1);let v=_*i/a*d,y=_*-a/i*u,b=l*v-c*y+(e+n)/2,x=c*v+l*y+(t+r)/2,S=(u-v)/i,C=(d-y)/a,w=(-u-v)/i,T=(-d-y)/a,E=oE(1,0,S,C),D=oE(S,C,w,T);s===0&&D>0&&(D-=rE),s===1&&D<0&&(D+=rE),f.centerX=b,f.centerY=x,f.ang1=E,f.ang2=D};function Tbe(e,t,n,r,i,a,o,s=0,c=0,l=0){if(a===0||o===0)return;let u=Math.sin(s*rE/360),d=Math.cos(s*rE/360),f=d*(t-r)/2+u*(n-i)/2,p=-u*(t-r)/2+d*(n-i)/2;if(f===0&&p===0)return;a=Math.abs(a),o=Math.abs(o);let m=f**2/a**2+p**2/o**2;m>1&&(a*=Math.sqrt(m),o*=Math.sqrt(m)),wbe(t,n,r,i,a,o,c,l,u,d,f,p,iE);let{ang1:h,ang2:g}=iE,{centerX:_,centerY:v}=iE,y=Math.abs(g)/(rE/4);Math.abs(1-y)<1e-7&&(y=1);let b=Math.max(Math.ceil(y),1);g/=b;let x=e[e.length-2],S=e[e.length-1],C={x:0,y:0};for(let t=0;t<b;t++){let t=Cbe(h,g),{x:n,y:r}=aE(t[0],a,o,d,u,_,v,C),{x:i,y:s}=aE(t[1],a,o,d,u,_,v,C),{x:c,y:l}=aE(t[2],a,o,d,u,_,v,C);QT(e,x,S,n,r,i,s,c,l),x=c,S=l,h+=g}}function Ebe(e,t,n){let r=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.sqrt(n*n+r*r);return{len:i,nx:n/i,ny:r/i}},i=(t,n)=>{t===0?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y)},a=t[t.length-1];for(let o=0;o<t.length;o++){let s=t[o%t.length],c=s.radius??n;if(c<=0){i(o,s),a=s;continue}let l=t[(o+1)%t.length],u=r(s,a),d=r(s,l);if(u.len<1e-4||d.len<1e-4){i(o,s),a=s;continue}let f=Math.asin(u.nx*d.ny-u.ny*d.nx),p=1,m=!1;u.nx*d.nx-u.ny*-d.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,p=-1,m=!0):f>0&&(p=-1,m=!0);let h=f/2,g,_=Math.abs(Math.cos(h)*c/Math.sin(h));_>Math.min(u.len/2,d.len/2)?(_=Math.min(u.len/2,d.len/2),g=Math.abs(_*Math.sin(h)/Math.cos(h))):g=c;let v=s.x+d.nx*_+-d.ny*g*p,y=s.y+d.ny*_+d.nx*g*p,b=Math.atan2(u.ny,u.nx)+Math.PI/2*p,x=Math.atan2(d.ny,d.nx)-Math.PI/2*p;o===0&&e.moveTo(v+Math.cos(b)*g,y+Math.sin(b)*g),e.arc(v,y,g,b,x,m),a=s}}function Dbe(e,t,n,r){let i=(e,t)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2),a=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n}),o=t.length;for(let s=0;s<o;s++){let c=t[(s+1)%o],l=c.radius??n;if(l<=0){s===0?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y);continue}let u=t[s],d=t[(s+2)%o],f=i(u,c),p;p=f<1e-4?c:a(c,u,Math.min(f/2,l)/f);let m=i(d,c),h;h=m<1e-4?c:a(c,d,Math.min(m/2,l)/m),s===0?e.moveTo(p.x,p.y):e.lineTo(p.x,p.y),e.quadraticCurveTo(c.x,c.y,h.x,h.y,r)}}var Obe=new M,kbe=class{constructor(e){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new E,this._graphicsPath2D=e,this.signed=e.checkForHoles}moveTo(e,t){return this.startPoly(e,t),this}lineTo(e,t){this._ensurePoly();let n=this._currentPoly.points,r=n[n.length-2],i=n[n.length-1];return(r!==e||i!==t)&&n.push(e,t),this}arc(e,t,n,r,i,a){this._ensurePoly(!1);let o=this._currentPoly.points;return nE(o,e,t,n,r,i,a),this}arcTo(e,t,n,r,i){this._ensurePoly();let a=this._currentPoly.points;return Sbe(a,e,t,n,r,i),this}arcToSvg(e,t,n,r,i,a,o){let s=this._currentPoly.points;return Tbe(s,this._currentPoly.lastX,this._currentPoly.lastY,a,o,e,t,n,r,i),this}bezierCurveTo(e,t,n,r,i,a,o){this._ensurePoly();let s=this._currentPoly;return QT(this._currentPoly.points,s.lastX,s.lastY,e,t,n,r,i,a,o),this}quadraticCurveTo(e,t,n,r,i){this._ensurePoly();let a=this._currentPoly;return bbe(this._currentPoly.points,a.lastX,a.lastY,e,t,n,r,i),this}closePath(){return this.endPoly(!0),this}addPath(e,t){this.endPoly(),t&&!t.isIdentity()&&(e=e.clone(!0),e.transform(t));let n=this.shapePrimitives,r=n.length;for(let t=0;t<e.instructions.length;t++){let n=e.instructions[t];this[n.action](...n.data)}if(e.checkForHoles&&n.length-r>1){let e=null;for(let t=r;t<n.length;t++){let r=n[t];if(r.shape.type===`polygon`){let i=r.shape,a=e?.shape;a&&a.containsPolygon(i)?(e.holes||=[],e.holes.push(r),n.copyWithin(t,t+1),n.length--,t--):e=r}}}return this}finish(e=!1){this.endPoly(e)}rect(e,t,n,r,i){return this.drawShape(new M(e,t,n,r),i),this}circle(e,t,n,r){return this.drawShape(new Bye(e,t,n),r),this}poly(e,t,n){let r=new DT(e);return r.closePath=t,this.drawShape(r,n),this}regularPoly(e,t,n,r,i=0,a){r=Math.max(r|0,3);let o=-1*Math.PI/2+i,s=Math.PI*2/r,c=[];for(let i=0;i<r;i++){let r=o-i*s;c.push(e+n*Math.cos(r),t+n*Math.sin(r))}return this.poly(c,!0,a),this}roundPoly(e,t,n,r,i,a=0,o){if(r=Math.max(r|0,3),i<=0)return this.regularPoly(e,t,n,r,a);let s=n*Math.sin(Math.PI/r)-.001;i=Math.min(i,s);let c=-1*Math.PI/2+a,l=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let a=0;a<r;a++){let r=a*l+c,s=e+n*Math.cos(r),d=t+n*Math.sin(r),f=r+Math.PI+u,p=r-Math.PI-u,m=s+i*Math.cos(f),h=d+i*Math.sin(f),g=s+i*Math.cos(p),_=d+i*Math.sin(p);a===0?this.moveTo(m,h):this.lineTo(m,h),this.quadraticCurveTo(s,d,g,_,o)}return this.closePath()}roundShape(e,t,n=!1,r){return e.length<3?this:(n?Dbe(this,e,t,r):Ebe(this,e,t),this.closePath())}filletRect(e,t,n,r,i){if(i===0)return this.rect(e,t,n,r);let a=Math.min(n,r)/2,o=Math.min(a,Math.max(-a,i)),s=e+n,c=t+r,l=o<0?-o:0,u=Math.abs(o);return this.moveTo(e,t+u).arcTo(e+l,t+l,e+u,t,u).lineTo(s-u,t).arcTo(s-l,t+l,s,t+u,u).lineTo(s,c-u).arcTo(s-l,c-l,e+n-u,c,u).lineTo(e+u,c).arcTo(e+l,c-l,e,c-u,u).closePath()}chamferRect(e,t,n,r,i,a){if(i<=0)return this.rect(e,t,n,r);let o=Math.min(i,Math.min(n,r)/2),s=e+n,c=t+r,l=[e+o,t,s-o,t,s,t+o,s,c-o,s-o,c,e+o,c,e,c-o,e,t+o];for(let e=l.length-1;e>=2;e-=2)l[e]===l[e-2]&&l[e-1]===l[e-3]&&l.splice(e-1,2);return this.poly(l,!0,a)}ellipse(e,t,n,r,i){return this.drawShape(new Vye(e,t,n,r),i),this}roundRect(e,t,n,r,i,a){return this.drawShape(new Gye(e,t,n,r,i),a),this}drawShape(e,t){return this.endPoly(),this.shapePrimitives.push({shape:e,transform:t}),this}startPoly(e,t){let n=this._currentPoly;return n&&this.endPoly(),n=new DT,n.points.push(e,t),this._currentPoly=n,this}endPoly(e=!1){let t=this._currentPoly;return t&&t.points.length>2&&(t.closePath=e,this.shapePrimitives.push({shape:t})),this._currentPoly=null,this}_ensurePoly(e=!0){if(!this._currentPoly&&(this._currentPoly=new DT,e)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let t=e.shape.x,n=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let r=e.transform,i=t;t=r.a*t+r.c*n+r.tx,n=r.b*i+r.d*n+r.ty}this._currentPoly.points.push(t,n)}else this._currentPoly.points.push(0,0)}}buildPath(){let e=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let t=0;t<e.instructions.length;t++){let n=e.instructions[t];this[n.action](...n.data)}this.finish()}get bounds(){let e=this._bounds;e.clear();let t=this.shapePrimitives;for(let n=0;n<t.length;n++){let r=t[n],i=r.shape.getBounds(Obe);r.transform?e.addRect(i,r.transform):e.addRect(i)}return e}},sE=class e{constructor(e,t=!1){this.instructions=[],this.uid=A(`graphicsPath`),this._dirty=!0,this.checkForHoles=t,typeof e==`string`?zye(e,this):this.instructions=e?.slice()??[]}get shapePath(){return this._shapePath||=new kbe(this),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(e,t){return e=e.clone(),this.instructions.push({action:`addPath`,data:[e,t]}),this._dirty=!0,this}arc(...e){return this.instructions.push({action:`arc`,data:e}),this._dirty=!0,this}arcTo(...e){return this.instructions.push({action:`arcTo`,data:e}),this._dirty=!0,this}arcToSvg(...e){return this.instructions.push({action:`arcToSvg`,data:e}),this._dirty=!0,this}bezierCurveTo(...e){return this.instructions.push({action:`bezierCurveTo`,data:e}),this._dirty=!0,this}bezierCurveToShort(e,t,n,r,i){let a=this.instructions[this.instructions.length-1],o=this.getLastPoint(L.shared),s=0,c=0;if(!a||a.action!==`bezierCurveTo`)s=o.x,c=o.y;else{s=a.data[2],c=a.data[3];let e=o.x,t=o.y;s=e+(e-s),c=t+(t-c)}return this.instructions.push({action:`bezierCurveTo`,data:[s,c,e,t,n,r,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:`closePath`,data:[]}),this._dirty=!0,this}ellipse(...e){return this.instructions.push({action:`ellipse`,data:e}),this._dirty=!0,this}lineTo(...e){return this.instructions.push({action:`lineTo`,data:e}),this._dirty=!0,this}moveTo(...e){return this.instructions.push({action:`moveTo`,data:e}),this}quadraticCurveTo(...e){return this.instructions.push({action:`quadraticCurveTo`,data:e}),this._dirty=!0,this}quadraticCurveToShort(e,t,n){let r=this.instructions[this.instructions.length-1],i=this.getLastPoint(L.shared),a=0,o=0;if(!r||r.action!==`quadraticCurveTo`)a=i.x,o=i.y;else{a=r.data[0],o=r.data[1];let e=i.x,t=i.y;a=e+(e-a),o=t+(t-o)}return this.instructions.push({action:`quadraticCurveTo`,data:[a,o,e,t,n]}),this._dirty=!0,this}rect(e,t,n,r,i){return this.instructions.push({action:`rect`,data:[e,t,n,r,i]}),this._dirty=!0,this}circle(e,t,n,r){return this.instructions.push({action:`circle`,data:[e,t,n,r]}),this._dirty=!0,this}roundRect(...e){return this.instructions.push({action:`roundRect`,data:e}),this._dirty=!0,this}poly(...e){return this.instructions.push({action:`poly`,data:e}),this._dirty=!0,this}regularPoly(...e){return this.instructions.push({action:`regularPoly`,data:e}),this._dirty=!0,this}roundPoly(...e){return this.instructions.push({action:`roundPoly`,data:e}),this._dirty=!0,this}roundShape(...e){return this.instructions.push({action:`roundShape`,data:e}),this._dirty=!0,this}filletRect(...e){return this.instructions.push({action:`filletRect`,data:e}),this._dirty=!0,this}chamferRect(...e){return this.instructions.push({action:`chamferRect`,data:e}),this._dirty=!0,this}star(e,t,n,r,i,a,o){i||=r/2;let s=-1*Math.PI/2+a,c=n*2,l=Math.PI*2/c,u=[];for(let n=0;n<c;n++){let a=n%2?i:r,o=n*l+s;u.push(e+a*Math.cos(o),t+a*Math.sin(o))}return this.poly(u,!0,o),this}clone(t=!1){let n=new e;if(n.checkForHoles=this.checkForHoles,!t)n.instructions=this.instructions.slice();else for(let e=0;e<this.instructions.length;e++){let t=this.instructions[e];n.instructions.push({action:t.action,data:t.data.slice()})}return n}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(e){if(e.isIdentity())return this;let t=e.a,n=e.b,r=e.c,i=e.d,a=e.tx,o=e.ty,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0;for(let h=0;h<this.instructions.length;h++){let g=this.instructions[h],_=g.data;switch(g.action){case`moveTo`:case`lineTo`:s=_[0],c=_[1],_[0]=t*s+r*c+a,_[1]=n*s+i*c+o;break;case`bezierCurveTo`:l=_[0],u=_[1],d=_[2],f=_[3],s=_[4],c=_[5],_[0]=t*l+r*u+a,_[1]=n*l+i*u+o,_[2]=t*d+r*f+a,_[3]=n*d+i*f+o,_[4]=t*s+r*c+a,_[5]=n*s+i*c+o;break;case`quadraticCurveTo`:l=_[0],u=_[1],s=_[2],c=_[3],_[0]=t*l+r*u+a,_[1]=n*l+i*u+o,_[2]=t*s+r*c+a,_[3]=n*s+i*c+o;break;case`arcToSvg`:s=_[5],c=_[6],p=_[0],m=_[1],_[0]=t*p+r*m,_[1]=n*p+i*m,_[5]=t*s+r*c+a,_[6]=n*s+i*c+o;break;case`circle`:_[4]=cE(_[3],e);break;case`rect`:_[4]=cE(_[4],e);break;case`ellipse`:_[8]=cE(_[8],e);break;case`roundRect`:_[5]=cE(_[5],e);break;case`addPath`:_[0].transform(e);break;case`poly`:_[2]=cE(_[2],e);break;default:v(`unknown transform action`,g.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(e){let t=this.instructions.length-1,n=this.instructions[t];if(!n)return e.x=0,e.y=0,e;for(;n.action===`closePath`;){if(t--,t<0)return e.x=0,e.y=0,e;n=this.instructions[t]}switch(n.action){case`moveTo`:case`lineTo`:e.x=n.data[0],e.y=n.data[1];break;case`quadraticCurveTo`:e.x=n.data[2],e.y=n.data[3];break;case`bezierCurveTo`:e.x=n.data[4],e.y=n.data[5];break;case`arc`:case`arcToSvg`:e.x=n.data[5],e.y=n.data[6];break;case`addPath`:n.data[0].getLastPoint(e);break}return e}};function cE(e,t){return e?e.prepend(t):t.clone()}function lE(e,t,n){let r=e.getAttribute(t);return r?Number(r):n}function Abe(e,t){let n=e.querySelectorAll(`defs`);for(let e=0;e<n.length;e++){let r=n[e];for(let e=0;e<r.children.length;e++){let n=r.children[e];switch(n.nodeName.toLowerCase()){case`lineargradient`:t.defs[n.id]=jbe(n);break;case`radialgradient`:t.defs[n.id]=Mbe(n);break;default:break}}}}function jbe(e){let t=new BT(lE(e,`x1`,0),lE(e,`y1`,0),lE(e,`x2`,1),lE(e,`y2`,0),(e.getAttribute(`gradientUnits`)||`objectBoundingBox`)===`objectBoundingBox`?`local`:`global`);for(let n=0;n<e.children.length;n++){let r=e.children[n],i=lE(r,`offset`,0),a=x.shared.setValue(r.getAttribute(`stop-color`)).toNumber();t.addColorStop(i,a)}return t}function Mbe(e){return v(`[SVG Parser] Radial gradients are not yet supported`),new BT(0,0,1,0)}function uE(e){let t=e.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:``}var dE={fill:{type:`paint`,default:0},"fill-opacity":{type:`number`,default:1},stroke:{type:`paint`,default:0},"stroke-width":{type:`number`,default:1},"stroke-opacity":{type:`number`,default:1},"stroke-linecap":{type:`string`,default:`butt`},"stroke-linejoin":{type:`string`,default:`miter`},"stroke-miterlimit":{type:`number`,default:10},"stroke-dasharray":{type:`string`,default:`none`},"stroke-dashoffset":{type:`number`,default:0},opacity:{type:`number`,default:1}};function fE(e,t){let n=e.getAttribute(`style`),r={},i={},a={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(let n in dE){let r=e.getAttribute(n);r&&pE(t,a,n,r.trim())}if(n){let e=n.split(`;`);for(let n=0;n<e.length;n++){let[r,i]=e[n].trim().split(`:`);dE[r]&&pE(t,a,r,i.trim())}}return{strokeStyle:a.useStroke?r:null,fillStyle:a.useFill?i:null,useFill:a.useFill,useStroke:a.useStroke}}function pE(e,t,n,r){switch(n){case`stroke`:if(r!==`none`){if(r.startsWith(`url(`)){let n=uE(r);t.strokeStyle.fill=e.defs[n]}else t.strokeStyle.color=x.shared.setValue(r).toNumber();t.useStroke=!0}break;case`stroke-width`:t.strokeStyle.width=Number(r);break;case`fill`:if(r!==`none`){if(r.startsWith(`url(`)){let n=uE(r);t.fillStyle.fill=e.defs[n]}else t.fillStyle.color=x.shared.setValue(r).toNumber();t.useFill=!0}break;case`fill-opacity`:t.fillStyle.alpha=Number(r);break;case`stroke-opacity`:t.strokeStyle.alpha=Number(r);break;case`opacity`:t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}function Nbe(e){if(e.length<=2)return!0;let t=e.map(e=>e.area).sort((e,t)=>t-e),[n,r]=t,i=t[t.length-1],a=n/r,o=r/i;return!(a>3&&o<2)}function Pbe(e){return e.split(/(?=[Mm])/).filter(e=>e.trim().length>0)}function Fbe(e){let t=e.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;let n=t.map(Number),r=[],i=[];for(let e=0;e<n.length;e+=2)e+1<n.length&&(r.push(n[e]),i.push(n[e+1]));if(r.length===0||i.length===0)return 0;let a=Math.min(...r),o=Math.max(...r),s=Math.min(...i),c=Math.max(...i);return(o-a)*(c-s)}function mE(e,t){let n=new sE(e,!1);for(let e of n.instructions)t.instructions.push(e)}function Ibe(e,t){if(typeof e==`string`){let t=document.createElement(`div`);t.innerHTML=e.trim(),e=t.querySelector(`svg`)}let n={context:t,defs:{},path:new sE};Abe(e,n);let r=e.children,{fillStyle:i,strokeStyle:a}=fE(e,n);for(let e=0;e<r.length;e++){let t=r[e];t.nodeName.toLowerCase()!==`defs`&&hE(t,n,i,a)}return t}function hE(e,t,n,r){let i=e.children,{fillStyle:a,strokeStyle:o}=fE(e,t);a&&n?n={...n,...a}:a&&(n=a),o&&r?r={...r,...o}:o&&(r=o);let s=!n&&!r;s&&(n={color:0});let c,l,u,d,f,p,m,h,g,_,y,b,x,S,C,w,T;switch(e.nodeName.toLowerCase()){case`path`:{S=e.getAttribute(`d`);let i=e.getAttribute(`fill-rule`),a=Pbe(S),o=i===`evenodd`,s=a.length>1;if(o&&s){let e=a.map(e=>({path:e,area:Fbe(e)}));if(e.sort((e,t)=>t.area-e.area),a.length>3||!Nbe(e))for(let i=0;i<e.length;i++){let a=e[i],o=i===0;t.context.beginPath();let s=new sE(void 0,!0);mE(a.path,s),t.context.path(s),o?(n&&t.context.fill(n),r&&t.context.stroke(r)):t.context.cut()}else for(let i=0;i<e.length;i++){let a=e[i],o=i%2==1;t.context.beginPath();let s=new sE(void 0,!0);mE(a.path,s),t.context.path(s),o?t.context.cut():(n&&t.context.fill(n),r&&t.context.stroke(r))}}else C=new sE(S,i?i===`evenodd`:!0),t.context.path(C),n&&t.context.fill(n),r&&t.context.stroke(r);break}case`circle`:m=lE(e,`cx`,0),h=lE(e,`cy`,0),g=lE(e,`r`,0),t.context.ellipse(m,h,g,g),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`rect`:c=lE(e,`x`,0),l=lE(e,`y`,0),w=lE(e,`width`,0),T=lE(e,`height`,0),_=lE(e,`rx`,0),y=lE(e,`ry`,0),_||y?t.context.roundRect(c,l,w,T,_||y):t.context.rect(c,l,w,T),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`ellipse`:m=lE(e,`cx`,0),h=lE(e,`cy`,0),_=lE(e,`rx`,0),y=lE(e,`ry`,0),t.context.beginPath(),t.context.ellipse(m,h,_,y),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`line`:u=lE(e,`x1`,0),d=lE(e,`y1`,0),f=lE(e,`x2`,0),p=lE(e,`y2`,0),t.context.beginPath(),t.context.moveTo(u,d),t.context.lineTo(f,p),r&&t.context.stroke(r);break;case`polygon`:x=e.getAttribute(`points`),b=x.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!0),n&&t.context.fill(n),r&&t.context.stroke(r);break;case`polyline`:x=e.getAttribute(`points`),b=x.match(/-?\d+/g).map(e=>parseInt(e,10)),t.context.poly(b,!1),r&&t.context.stroke(r);break;case`g`:case`svg`:break;default:v(`[SVG parser] <${e.nodeName}> elements unsupported`);break}s&&(n=null);for(let e=0;e<i.length;e++)hE(i[e],t,n,r)}var gE={repeat:{addressModeU:`repeat`,addressModeV:`repeat`},"repeat-x":{addressModeU:`repeat`,addressModeV:`clamp-to-edge`},"repeat-y":{addressModeU:`clamp-to-edge`,addressModeV:`repeat`},"no-repeat":{addressModeU:`clamp-to-edge`,addressModeV:`clamp-to-edge`}},_E=class{constructor(e,t){this.uid=A(`fillPattern`),this._tick=0,this.transform=new u,this.texture=e,this.transform.scale(1/e.frame.width,1/e.frame.height),t&&(e.source.style.addressModeU=gE[t].addressModeU,e.source.style.addressModeV=gE[t].addressModeV)}setTransform(e){let t=this.texture;this.transform.copyFrom(e),this.transform.invert(),this.transform.scale(1/t.frame.width,1/t.frame.height),this._tick++}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture=e,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}};function Lbe(e){return x.isColorLike(e)}function vE(e){return e instanceof _E}function yE(e){return e instanceof BT}function Rbe(e){return e instanceof f}function zbe(e,t,n){let r=x.shared.setValue(t??0);return e.color=r.toNumber(),e.alpha=r.alpha===1?n.alpha:r.alpha,e.texture=f.WHITE,{...n,...e}}function Bbe(e,t,n){return e.texture=t,{...n,...e}}function bE(e,t,n){return e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,{...n,...e}}function xE(e,t,n){return t.buildGradient(),e.fill=t,e.color=16777215,e.texture=t.texture,e.matrix=t.transform,e.textureSpace=t.textureSpace,{...n,...e}}function Vbe(e,t){let n={...t,...e},r=x.shared.setValue(n.color);return n.alpha*=r.alpha,n.color=r.toNumber(),n}function SE(e,t){if(e==null)return null;let n={},r=e;return Lbe(e)?zbe(n,e,t):Rbe(e)?Bbe(n,e,t):vE(e)?bE(n,e,t):yE(e)?xE(n,e,t):r.fill&&vE(r.fill)?bE(r,r.fill,t):r.fill&&yE(r.fill)?xE(r,r.fill,t):Vbe(r,t)}function CE(e,t){let{width:n,alignment:r,miterLimit:i,cap:a,join:o,pixelLine:s,...c}=t,l=SE(e,c);return l?{width:n,alignment:r,miterLimit:i,cap:a,join:o,pixelLine:s,...l}:null}var Hbe=new L,wE=new u,TE=class e extends pe{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=A(`graphicsContext`),this.dirty=!0,this.batchMode=`auto`,this.instructions=[],this.destroyed=!1,this._activePath=new sE,this._transform=new u,this._fillStyle={...e.defaultFillStyle},this._strokeStyle={...e.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new E,this._boundsDirty=!0}clone(){let t=new e;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=SE(t,e.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=CE(t,e.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=SE(t,e.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=SE(t,e.defaultStrokeStyle),this}texture(e,t,n,r,i,a){return this.instructions.push({action:`texture`,data:{image:e,dx:n||0,dy:r||0,dw:i||e.frame.width,dh:a||e.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:t||t===0?x.shared.setValue(t).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new sE,this}fill(t,n){let r,i=this.instructions[this.instructions.length-1];return r=this._tick===0&&i?.action===`stroke`?i.data.path:this._activePath.clone(),r?(t!=null&&(n!==void 0&&typeof t==`number`&&(le(y,`GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead`),t={color:t,alpha:n}),this._fillStyle=SE(t,e.defaultFillStyle)),this.instructions.push({action:`fill`,data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:e,y:t}=this._activePath.getLastPoint(L.shared);this._activePath.clear(),this._activePath.moveTo(e,t)}stroke(t){let n,r=this.instructions[this.instructions.length-1];return n=this._tick===0&&r?.action===`fill`?r.data.path:this._activePath.clone(),n?(t!=null&&(this._strokeStyle=CE(t,e.defaultStrokeStyle)),this.instructions.push({action:`stroke`,data:{style:this.strokeStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let e=0;e<2;e++){let t=this.instructions[this.instructions.length-1-e],n=this._activePath.clone();if(t&&(t.action===`stroke`||t.action===`fill`))if(t.data.hole)t.data.hole.addPath(n);else{t.data.hole=n;break}}return this._initNextPathLocation(),this}arc(e,t,n,r,i,a){this._tick++;let o=this._transform;return this._activePath.arc(o.a*e+o.c*t+o.tx,o.b*e+o.d*t+o.ty,n,r,i,a),this}arcTo(e,t,n,r,i){this._tick++;let a=this._transform;return this._activePath.arcTo(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,i),this}arcToSvg(e,t,n,r,i,a,o){this._tick++;let s=this._transform;return this._activePath.arcToSvg(e,t,n,r,i,s.a*a+s.c*o+s.tx,s.b*a+s.d*o+s.ty),this}bezierCurveTo(e,t,n,r,i,a,o){this._tick++;let s=this._transform;return this._activePath.bezierCurveTo(s.a*e+s.c*t+s.tx,s.b*e+s.d*t+s.ty,s.a*n+s.c*r+s.tx,s.b*n+s.d*r+s.ty,s.a*i+s.c*a+s.tx,s.b*i+s.d*a+s.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(e,t,n,r){return this._tick++,this._activePath.ellipse(e,t,n,r,this._transform.clone()),this}circle(e,t,n){return this._tick++,this._activePath.circle(e,t,n,this._transform.clone()),this}path(e){return this._tick++,this._activePath.addPath(e,this._transform.clone()),this}lineTo(e,t){this._tick++;let n=this._transform;return this._activePath.lineTo(n.a*e+n.c*t+n.tx,n.b*e+n.d*t+n.ty),this}moveTo(e,t){this._tick++;let n=this._transform,r=this._activePath.instructions,i=n.a*e+n.c*t+n.tx,a=n.b*e+n.d*t+n.ty;return r.length===1&&r[0].action===`moveTo`?(r[0].data[0]=i,r[0].data[1]=a,this):(this._activePath.moveTo(i,a),this)}quadraticCurveTo(e,t,n,r,i){this._tick++;let a=this._transform;return this._activePath.quadraticCurveTo(a.a*e+a.c*t+a.tx,a.b*e+a.d*t+a.ty,a.a*n+a.c*r+a.tx,a.b*n+a.d*r+a.ty,i),this}rect(e,t,n,r){return this._tick++,this._activePath.rect(e,t,n,r,this._transform.clone()),this}roundRect(e,t,n,r,i){return this._tick++,this._activePath.roundRect(e,t,n,r,i,this._transform.clone()),this}poly(e,t){return this._tick++,this._activePath.poly(e,t,this._transform.clone()),this}regularPoly(e,t,n,r,i=0,a){return this._tick++,this._activePath.regularPoly(e,t,n,r,i,a),this}roundPoly(e,t,n,r,i,a){return this._tick++,this._activePath.roundPoly(e,t,n,r,i,a),this}roundShape(e,t,n,r){return this._tick++,this._activePath.roundShape(e,t,n,r),this}filletRect(e,t,n,r,i){return this._tick++,this._activePath.filletRect(e,t,n,r,i),this}chamferRect(e,t,n,r,i,a){return this._tick++,this._activePath.chamferRect(e,t,n,r,i,a),this}star(e,t,n,r,i=0,a=0){return this._tick++,this._activePath.star(e,t,n,r,i,a,this._transform.clone()),this}svg(e){return this._tick++,Ibe(e,this),this}restore(){let e=this._stateStack.pop();return e&&(this._transform=e.transform,this._fillStyle=e.fillStyle,this._strokeStyle=e.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(e){return this._transform.rotate(e),this}scale(e,t=e){return this._transform.scale(e,t),this}setTransform(e,t,n,r,i,a){return e instanceof u?(this._transform.set(e.a,e.b,e.c,e.d,e.tx,e.ty),this):(this._transform.set(e,t,n,r,i,a),this)}transform(e,t,n,r,i,a){return e instanceof u?(this._transform.append(e),this):(wE.set(e,t,n,r,i,a),this._transform.append(wE),this)}translate(e,t=e){return this._transform.translate(e,t),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,!this.dirty&&(this.emit(`update`,this,16),this.dirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;let e=this._bounds;e.clear();for(let t=0;t<this.instructions.length;t++){let n=this.instructions[t],r=n.action;if(r===`fill`){let t=n.data;e.addBounds(t.path.bounds)}else if(r===`texture`){let t=n.data;e.addFrame(t.dx,t.dy,t.dx+t.dw,t.dy+t.dh,t.transform)}if(r===`stroke`){let t=n.data,r=t.style.alignment,i=t.style.width*(1-r),a=t.path.bounds;e.addFrame(a.minX-i,a.minY-i,a.maxX+i,a.maxY+i)}}return e}containsPoint(e){if(!this.bounds.containsPoint(e.x,e.y))return!1;let t=this.instructions,n=!1;for(let r=0;r<t.length;r++){let i=t[r],a=i.data,o=a.path;if(!i.action||!o)continue;let s=a.style,c=o.shapePath.shapePrimitives;for(let t=0;t<c.length;t++){let r=c[t].shape;if(!s||!r)continue;let o=c[t].transform,l=o?o.applyInverse(e,Hbe):e;if(i.action===`fill`)n=r.contains(l.x,l.y);else{let e=s;n=r.strokeContains(l.x,l.y,e.width,e.alignment)}let u=a.hole;if(u){let e=u.shapePath?.shapePrimitives;if(e)for(let t=0;t<e.length;t++)e[t].shape.contains(l.x,l.y)&&(n=!1)}if(n)return!0}}return n}unload(){this.emit(`unload`,this);for(let e in this._gpuData)this._gpuData[e]?.destroy();this._gpuData=Object.create(null)}destroy(e=!1){if(!this.destroyed){if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit(`destroy`,this),this.removeAllListeners(),typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&`uid`in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(t)),this._strokeStyle.texture&&(this._strokeStyle.fill&&`uid`in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(t))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}}};TE.defaultFillStyle={color:16777215,alpha:1,texture:f.WHITE,matrix:null,fill:null,textureSpace:`local`},TE.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:`butt`,join:`miter`,texture:f.WHITE,matrix:null,fill:null,textureSpace:`local`,pixelLine:!1};var EE=TE,DE=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(te.system.add(this._tickerUpdate,this,z.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&=(te.system.remove(this._tickerUpdate,this),!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType===`touch`||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent(`pointermove`,{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}):new MouseEvent(`mousemove`,{clientX:e.clientX,clientY:e.clientY}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}},OE=class extends iT{constructor(){super(...arguments),this.client=new L,this.movement=new L,this.offset=new L,this.global=new L,this.screen=new L}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,n){return e.worldTransform.applyInverse(n||this.global,t)}getModifierState(e){return`getModifierState`in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){throw Error(`Method not implemented.`)}},kE=class extends OE{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type===`pointermove`||this.type===`mousemove`||this.type===`touchmove`?[this]:[]}getPredictedEvents(){throw Error(`getPredictedEvents is not supported!`)}},AE=class extends OE{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};AE.DOM_DELTA_PIXEL=0,AE.DOM_DELTA_LINE=1,AE.DOM_DELTA_PAGE=2;var Ube=2048,Wbe=new L,jE=new L,Gbe=class{constructor(e){this.dispatch=new pe,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping(`pointerdown`,this.mapPointerDown),this.addEventMapping(`pointermove`,this.mapPointerMove),this.addEventMapping(`pointerout`,this.mapPointerOut),this.addEventMapping(`pointerleave`,this.mapPointerOut),this.addEventMapping(`pointerover`,this.mapPointerOver),this.addEventMapping(`pointerup`,this.mapPointerUp),this.addEventMapping(`pointerupoutside`,this.mapPointerUpOutside),this.addEventMapping(`wheel`,this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((e,t)=>e.priority-t.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let n=0,r=t.length;n<r;n++)t[n].fn(e);else v(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){DE.pauseUpdate=!0;let n=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?`hitTestMoveRecursive`:`hitTestRecursive`,r=this[n](this.rootTarget,this.rootTarget.eventMode,Wbe.set(e,t),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(e,t){if(!e.target)return;let n=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let r=0,i=n.length-1;r<i;r++)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let r=n.length-2;r>=0;r--)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,n=this._allInteractiveElements){if(n.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let t=n.length-1;t>=0;t--)r.forEach(r=>{e.currentTarget=n[t],this.notifyTarget(e,r)})}propagationPath(e){let t=[e];for(let n=0;n<Ube&&e!==this.rootTarget&&e.parent;n++){if(!e.parent)throw Error(`Cannot find propagation path to disconnected target`);t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,n,r,i,a=!1){let o=!1;if(this._interactivePrune(e))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(DE.pauseUpdate=!1),e.interactiveChildren&&e.children){let s=e.children;for(let c=s.length-1;c>=0;c--){let l=s[c],u=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,n,r,i,a||i(e,n));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let t=e.isInteractive();(u.length>0||t)&&(t&&this._allInteractiveElements.push(e),u.push(e)),this._hitElements.length===0&&(this._hitElements=u),o=!0}}}let s=this._isInteractive(t),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:s&&!i(e,n)&&r(e,n)?c?[e]:[]:null}hitTestRecursive(e,t,n,r,i){if(this._interactivePrune(e)||i(e,n))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(DE.pauseUpdate=!1),e.interactiveChildren&&e.children){let a=e.children,o=n;for(let n=a.length-1;n>=0;n--){let s=a[n],c=this.hitTestRecursive(s,this._isInteractive(t)?t:s.eventMode,o,r,i);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let t=e.isInteractive();return(c.length>0||t)&&c.push(e),c}}}let a=this._isInteractive(t),o=e.isInteractive();return a&&r(e,n)?o?[e]:[]:null}_isInteractive(e){return e===`static`||e===`dynamic`}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode===`none`||e.eventMode===`passive`&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,jE),!e.hitArea.contains(jE.x,jE.y)))return!0;if(e.effects&&e.effects.length)for(let n=0;n<e.effects.length;n++){let r=e.effects[n];if(r.containsPoint&&!r.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e?.containsPoint?(e.worldTransform.applyInverse(t,jE),e.containsPoint(jE)):!1}notifyTarget(e,t){if(!e.currentTarget.isInteractive())return;t??=e.type;let n=`on${t}`;e.currentTarget[n]?.(e);let r=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,r),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.createPointerEvent(e);if(this.dispatchEvent(t,`pointerdown`),t.pointerType===`touch`)this.dispatchEvent(t,`touchstart`);else if(t.pointerType===`mouse`||t.pointerType===`pen`){let e=t.button===2;this.dispatchEvent(t,e?`rightdown`:`mousedown`)}let n=this.trackingData(e.pointerId);n.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let n=t.pointerType===`mouse`||t.pointerType===`pen`,r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&i!==t.target){let r=e.type===`mousemove`?`mouseout`:`pointerout`,a=this.createPointerEvent(e,r,i);if(this.dispatchEvent(a,`pointerout`),n&&this.dispatchEvent(a,`mouseout`),!t.composedPath().includes(i)){let r=this.createPointerEvent(e,`pointerleave`,i);for(r.eventPhase=r.AT_TARGET;r.target&&!t.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,`mouseleave`),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(a)}if(i!==t.target){let r=e.type===`mousemove`?`mouseover`:`pointerover`,a=this.clonePointerEvent(t,r);this.dispatchEvent(a,`pointerover`),n&&this.dispatchEvent(a,`mouseover`);let o=i?.parent;for(;o&&o!==this.rootTarget.parent&&o!==t.target;)o=o.parent;if(!o||o===this.rootTarget.parent){let e=this.clonePointerEvent(t,`pointerenter`);for(e.eventPhase=e.AT_TARGET;e.target&&e.target!==i&&e.target!==this.rootTarget.parent;)e.currentTarget=e.target,this.notifyTarget(e),n&&this.notifyTarget(e,`mouseenter`),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(a)}let a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push(`pointermove`):this.dispatchEvent(t,`pointermove`),o&&a.push(`globalpointermove`),t.pointerType===`touch`&&(this.moveOnAll?a.splice(1,0,`touchmove`):this.dispatchEvent(t,`touchmove`),o&&a.push(`globaltouchmove`)),n&&(this.moveOnAll?a.splice(1,0,`mousemove`):this.dispatchEvent(t,`mousemove`),o&&a.push(`globalmousemove`),this.cursor=t.target?.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.createPointerEvent(e),r=n.pointerType===`mouse`||n.pointerType===`pen`;this.dispatchEvent(n,`pointerover`),r&&this.dispatchEvent(n,`mouseover`),n.pointerType===`mouse`&&(this.cursor=n.target?.cursor);let i=this.clonePointerEvent(n,`pointerenter`);for(i.eventPhase=i.AT_TARGET;i.target&&i.target!==this.rootTarget.parent;)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,`mouseenter`),i.target=i.target.parent;t.overTargets=n.composedPath(),this.freeEvent(n),this.freeEvent(i)}mapPointerOut(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId);if(t.overTargets){let n=e.pointerType===`mouse`||e.pointerType===`pen`,r=this.findMountedTarget(t.overTargets),i=this.createPointerEvent(e,`pointerout`,r);this.dispatchEvent(i),n&&this.dispatchEvent(i,`mouseout`);let a=this.createPointerEvent(e,`pointerleave`,r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,`mouseleave`),a.target=a.target.parent;t.overTargets=null,this.freeEvent(i),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=performance.now(),n=this.createPointerEvent(e);if(this.dispatchEvent(n,`pointerup`),n.pointerType===`touch`)this.dispatchEvent(n,`touchend`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.dispatchEvent(n,e?`rightup`:`mouseup`)}let r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[e.button]),a=i;if(i&&!n.composedPath().includes(i)){let t=i;for(;t&&!n.composedPath().includes(t);){if(n.currentTarget=t,this.notifyTarget(n,`pointerupoutside`),n.pointerType===`touch`)this.notifyTarget(n,`touchendoutside`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.notifyTarget(n,e?`rightupoutside`:`mouseupoutside`)}t=t.parent}delete r.pressTargetsByButton[e.button],a=t}if(a){let i=this.clonePointerEvent(n,`click`);i.target=a,i.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:i.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===i.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=t,i.detail=o.clickCount,i.pointerType===`mouse`){let e=i.button===2;this.dispatchEvent(i,e?`rightclick`:`click`)}else i.pointerType===`touch`&&this.dispatchEvent(i,`tap`);this.dispatchEvent(i,`pointertap`),this.freeEvent(i)}this.freeEvent(n)}mapPointerUpOutside(e){if(!(e instanceof kE)){v(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(n){let i=n;for(;i;)r.currentTarget=i,this.notifyTarget(r,`pointerupoutside`),r.pointerType===`touch`?this.notifyTarget(r,`touchendoutside`):(r.pointerType===`mouse`||r.pointerType===`pen`)&&this.notifyTarget(r,r.button===2?`rightupoutside`:`mouseupoutside`),i=i.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof AE)){v(`EventBoundary cannot map a non-wheel event as a wheel event`);return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let n=1;n<e.length&&e[n].parent===t;n++)t=e[n];return t}createPointerEvent(e,t,n){let r=this.allocateEvent(kE);return this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=n??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof t==`string`&&(r.type=t),r}createWheelEvent(e){let t=this.allocateEvent(AE);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){let n=this.allocateEvent(kE);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=t??n.type,n}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof kE&&t instanceof kE&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof OE&&t instanceof OE&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw Error(`It is illegal to free an event not managed by this EventBoundary!`);let t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){let n=e.currentTarget._events[t];if(n)if(`fn`in n)n.once&&e.currentTarget.removeListener(t,n.fn,void 0,!0),n.fn.call(n.context,e);else for(let r=0,i=n.length;r<i&&!e.propagationImmediatelyStopped;r++)n[r].once&&e.currentTarget.removeListener(t,n[r].fn,void 0,!0),n[r].fn.call(n[r].context,e)}},Kbe=1,qbe={touchstart:`pointerdown`,touchend:`pointerup`,touchendoutside:`pointerupoutside`,touchmove:`pointermove`,touchcancel:`pointercancel`},ME=class e{constructor(t){this.supportsTouchEvents=`ontouchstart`in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Gbe(null),DE.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new kE(null),this._rootWheelEvent=new AE(null),this.cursorStyles={default:`inherit`,pointer:`pointer`},this.features=new Proxy({...e.defaultEventFeatures},{set:(e,t,n)=>(t===`globalMove`&&(this.rootBoundary.enableGlobalMoveEvents=n),e[t]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){let{canvas:n,resolution:r}=this.renderer;this.setTargetElement(n),this.resolution=r,e._defaultEventMode=t.eventMode??`passive`,Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){DE.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||=`default`;let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;let n=this.cursorStyles[e];if(n)switch(typeof n){case`string`:t&&(this.domElement.style.cursor=n);break;case`function`:n(e);break;case`object`:t&&Object.assign(this.domElement.style,n);break}else t&&typeof e==`string`&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!(`cancelable`in e))&&e.preventDefault();for(let e=0,n=t.length;e<n;e++){let n=t[e],r=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,DE.pointerMoved();let t=this._normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);let n=t===this.domElement?``:`outside`,r=this._normalizeToPointerData(e);for(let e=0,t=r.length;e<t;e++){let t=this._bootstrapEvent(this._rootPointerEvent,r[e]);t.type+=n,this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this._normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this._bootstrapEvent(this._rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,DE.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;DE.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming=`none`,e.msTouchAction=`none`):this.supportsPointerEvents&&(e.touchAction=`none`)),this.supportsPointerEvents?(globalThis.document.addEventListener(`pointermove`,this._onPointerMove,!0),this.domElement.addEventListener(`pointerdown`,this._onPointerDown,!0),this.domElement.addEventListener(`pointerleave`,this._onPointerOverOut,!0),this.domElement.addEventListener(`pointerover`,this._onPointerOverOut,!0),globalThis.addEventListener(`pointerup`,this._onPointerUp,!0)):(globalThis.document.addEventListener(`mousemove`,this._onPointerMove,!0),this.domElement.addEventListener(`mousedown`,this._onPointerDown,!0),this.domElement.addEventListener(`mouseout`,this._onPointerOverOut,!0),this.domElement.addEventListener(`mouseover`,this._onPointerOverOut,!0),globalThis.addEventListener(`mouseup`,this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener(`touchstart`,this._onPointerDown,!0),this.domElement.addEventListener(`touchend`,this._onPointerUp,!0),this.domElement.addEventListener(`touchmove`,this._onPointerMove,!0))),this.domElement.addEventListener(`wheel`,this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;DE.removeTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming=``,e.msTouchAction=``):this.supportsPointerEvents&&(e.touchAction=``)),this.supportsPointerEvents?(globalThis.document.removeEventListener(`pointermove`,this._onPointerMove,!0),this.domElement.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.domElement.removeEventListener(`pointerleave`,this._onPointerOverOut,!0),this.domElement.removeEventListener(`pointerover`,this._onPointerOverOut,!0),globalThis.removeEventListener(`pointerup`,this._onPointerUp,!0)):(globalThis.document.removeEventListener(`mousemove`,this._onPointerMove,!0),this.domElement.removeEventListener(`mousedown`,this._onPointerDown,!0),this.domElement.removeEventListener(`mouseout`,this._onPointerOverOut,!0),this.domElement.removeEventListener(`mouseover`,this._onPointerOverOut,!0),globalThis.removeEventListener(`mouseup`,this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener(`touchstart`,this._onPointerDown,!0),this.domElement.removeEventListener(`touchend`,this._onPointerUp,!0),this.domElement.removeEventListener(`touchmove`,this._onPointerMove,!0))),this.domElement.removeEventListener(`wheel`,this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(e,t,n){let r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},i=1/this.resolution;e.x=(t-r.left)*(this.domElement.width/r.width)*i,e.y=(n-r.top)*(this.domElement.height/r.height)*i}_normalizeToPointerData(e){let t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches[n];r.button===void 0&&(r.button=0),r.buttons===void 0&&(r.buttons=1),r.isPrimary===void 0&&(r.isPrimary=e.touches.length===1&&e.type===`touchstart`),r.width===void 0&&(r.width=r.radiusX||1),r.height===void 0&&(r.height=r.radiusY||1),r.tiltX===void 0&&(r.tiltX=0),r.tiltY===void 0&&(r.tiltY=0),r.pointerType===void 0&&(r.pointerType=`touch`),r.pointerId===void 0&&(r.pointerId=r.identifier||0),r.pressure===void 0&&(r.pressure=r.force||.5),r.twist===void 0&&(r.twist=0),r.tangentialPressure===void 0&&(r.tangentialPressure=0),r.layerX===void 0&&(r.layerX=r.offsetX=r.clientX),r.layerY===void 0&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let n=e;n.isPrimary===void 0&&(n.isPrimary=!0),n.width===void 0&&(n.width=1),n.height===void 0&&(n.height=1),n.tiltX===void 0&&(n.tiltX=0),n.tiltY===void 0&&(n.tiltY=0),n.pointerType===void 0&&(n.pointerType=`mouse`),n.pointerId===void 0&&(n.pointerId=Kbe),n.pressure===void 0&&(n.pressure=.5),n.twist===void 0&&(n.twist=0),n.tangentialPressure===void 0&&(n.tangentialPressure=0),n.isNormalized=!0,t.push(n)}else t.push(e);return t}normalizeWheelEvent(e){let t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type===`pointerleave`&&(e.type=`pointerout`),e.type.startsWith(`mouse`)&&(e.type=e.type.replace(`mouse`,`pointer`)),e.type.startsWith(`touch`)&&(e.type=qbe[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};ME.extension={name:`events`,type:[H.WebGLSystem,H.CanvasSystem,H.WebGPUSystem],priority:-1},ME.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};var NE=ME,Jbe={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode===`dynamic`||this.eventMode===`static`},set interactive(e){this.eventMode=e?`static`:`passive`},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??NE.defaultEventMode},set eventMode(e){this._internalEventMode=e},isInteractive(){return this.eventMode===`static`||this.eventMode===`dynamic`},interactiveChildren:!0,hitArea:null,addEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof n==`object`?n.signal:void 0,a=typeof n==`object`?n.once===!0:!1,o=typeof t==`function`?void 0:t;e=r?`${e}capture`:e;let s=typeof t==`function`?t:t.handleEvent,c=this;i&&i.addEventListener(`abort`,()=>{c.off(e,s,o)}),a?c.once(e,s,o):c.on(e,s,o)},removeEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof t==`function`?void 0:t;e=r?`${e}capture`:e,t=typeof t==`function`?t:t.handleEvent,this.off(e,t,i)},dispatchEvent(e){if(!(e instanceof iT))throw Error(`Container cannot propagate events outside of the Federated Events API`);return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}},Ybe=`in vec2 aPosition;
739
739
  out vec2 vTextureCoord;
740
740
 
741
741
  uniform vec4 uInputSize;
@@ -1170,7 +1170,7 @@ fn mainFragment(
1170
1170
  <div class="pixi-host">
1171
1171
  <div class="edge-glow"></div>
1172
1172
  </div>
1173
- `}};customElements.define(`virtual-trackpad-tab`,xwe);function Swe(e){return new URLSearchParams(e.search).get(`session`)?.trim()||null}function ak(e,t=window.location){let n=Swe(t);return n?`hosted-session:${n}:${e}`:e}var ok=1.5,sk=30,Cwe=50,ck=15;function lk(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function uk(e){return e instanceof HTMLElement&&e.classList.contains(`terminal-touch-mouse-overlay`)}function wwe(e,t,n){let r=document.elementFromPoint(t,n);if(r&&uk(r)){let e=r,i=e.style.pointerEvents;e.style.pointerEvents=`none`,r=document.elementFromPoint(t,n),e.style.pointerEvents=i}return r&&e.contains(r)&&!uk(r)?r:e.querySelector(`.xterm-screen`)??e}function dk(e){return e===`input`||e===`keys`||e===`shortcuts`||e===`trackpad`||e===`settings`}function Twe(e){return e===`copy`||e===`paste`||e===`select-all`}function fk(e){return typeof e==`object`&&!!e}function pk(){try{let e=localStorage.getItem(ak(`xtermInputPanelState`));if(!e)return{};let t=JSON.parse(e);return fk(t)?t:{}}catch{return{}}}function Ewe(e){try{localStorage.setItem(ak(`xtermInputPanelState`),JSON.stringify(e))}catch{}}function Dwe(e){let t=pk().sessions;if(!t)return null;let n=t[e];if(!fk(n))return null;let r={activeTab:`input`,inputDraft:``};return dk(n.activeTab)&&(r.activeTab=n.activeTab),typeof n.inputDraft==`string`&&(r.inputDraft=n.inputDraft),r}function mk(){let e=pk();return dk(e.lastActiveTab)?e.lastActiveTab:`input`}var hk=class e{static _lastActiveTab=`input`;static _active=null;static _lastFocused=null;static _instances=new Set;static _onActiveChangeFn=null;static _mountTarget=null;static get activeInstance(){return e._active}static set onActiveChange(t){e._onActiveChangeFn=t}static set mountTarget(t){e._mountTarget=t,e._fabEl&&t&&t.appendChild(e._fabEl)}static get mountTarget(){return e._mountTarget}static _fabEl=null;static _fabSubscriberCount=0;static _ensureFab(t){if(e._fabEl){e._fabEl.parentElement!==t&&t.appendChild(e._fabEl);return}let n=document.createElement(`button`);n.type=`button`,n.title=`Open InputPanel`,n.replaceChildren(zve(24)),Object.assign(n.style,{position:`fixed`,zIndex:`50`,width:`56px`,height:`56px`,borderRadius:`50%`,border:`2px solid currentColor`,display:`flex`,alignItems:`center`,justifyContent:`center`,touchAction:`none`,userSelect:`none`,webkitUserSelect:`none`,webkitTouchCallout:`none`,cursor:`pointer`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`,background:`var(--primary, #e04a2f)`,color:`var(--primary-foreground, #fff)`,padding:`0`,margin:`0`,outline:`none`});let r=window.innerWidth-72,i=window.innerHeight-140;try{let e=localStorage.getItem(`input-panel-fab-pos`);if(e){let t=JSON.parse(e);r=t.x??r,i=t.y??i}}catch{}r=Math.max(0,Math.min(window.innerWidth-56,r)),i=Math.max(0,Math.min(window.innerHeight-56,i)),n.style.left=`${r}px`,n.style.top=`${i}px`;let a=!1,o=!1,s=0,c=0,l=0,u=0,d=()=>{let t=e._lastFocused,n=(t&&e._instances.has(t)?t:null)??[...e._instances].find(e=>e._terminal!=null)??null;n&&(e._lastFocused=n,n.open())};n.addEventListener(`pointerdown`,e=>{a=!0,o=!1,s=e.clientX,c=e.clientY,l=parseInt(n.style.left)||0,u=parseInt(n.style.top)||0,n.setPointerCapture(e.pointerId),e.preventDefault()}),n.addEventListener(`pointermove`,e=>{if(!a)return;let t=e.clientX-s,r=e.clientY-c;(Math.abs(t)>4||Math.abs(r)>4)&&(o=!0);let i=Math.max(0,Math.min(window.innerWidth-56,l+t)),d=Math.max(0,Math.min(window.innerHeight-56,u+r));n.style.left=`${i}px`,n.style.top=`${d}px`}),n.addEventListener(`pointerup`,()=>{if(a){a=!1;try{localStorage.setItem(`input-panel-fab-pos`,JSON.stringify({x:parseInt(n.style.left),y:parseInt(n.style.top)}))}catch{}o||d()}}),n.addEventListener(`pointercancel`,()=>{a=!1});let f=!1;n.addEventListener(`pointerdown`,()=>{f=!0},{capture:!0}),n.addEventListener(`click`,()=>{if(f){f=!1;return}d()}),n.addEventListener(`contextmenu`,e=>{e.preventDefault(),e.stopPropagation()}),n.addEventListener(`dragstart`,e=>{e.preventDefault()}),window.addEventListener(`resize`,()=>{let e=Math.min(parseInt(n.style.left)||0,window.innerWidth-56),t=Math.min(parseInt(n.style.top)||0,window.innerHeight-56);n.style.left=`${Math.max(0,e)}px`,n.style.top=`${Math.max(0,t)}px`}),t.appendChild(n),e._fabEl=n}static _setFabVisible(t){e._fabEl&&(e._fabEl.style.display=t&&e._fabSubscriberCount>0?`flex`:`none`)}_terminal=null;_panel=null;_cursorEl=null;_cursorPos={x:0,y:0};_isDragging=!1;_isOpen=!1;_edgeScrollTimer=null;_cleanups=[];_persistentCleanups=[];_listenersAttached=!1;_onInput;_onCommand;_onOpenCb;_onCloseCb;_getHistory;_addHistory;_subscribeHistory;_onSettingsChange;_platform;_defaultLayout;_showFab;_fabSubscribed;_panelSessionState;_stateKey;_hasOwnPersistedState;constructor(t){this._onInput=t?.onInput??(()=>{}),this._onCommand=t?.onCommand??null,this._onOpenCb=t?.onOpen??null,this._onCloseCb=t?.onClose??null,this._getHistory=t?.getHistory??null,this._addHistory=t?.addHistory??null,this._subscribeHistory=t?.subscribeHistory??null,this._onSettingsChange=t?.onSettingsChange??null,this._platform=t?.platform??`common`,this._defaultLayout=t?.defaultLayout??`floating`,this._showFab=t?.showFab??!0,this._fabSubscribed=!1,this._stateKey=t?.stateKey?.trim()?t.stateKey:`default`,this._hasOwnPersistedState=!1,this._panelSessionState={activeTab:`input`,inputDraft:``};let n=Dwe(this._stateKey);n?(this._panelSessionState=n,this._hasOwnPersistedState=!0):this._panelSessionState.activeTab=e._lastActiveTab||mk()}get isOpen(){return this._isOpen}set onOpen(e){this._onOpenCb=e}set onClose(e){this._onCloseCb=e}set onInput(e){this._onInput=e}set onCommand(e){this._onCommand=e}setPlatform(e){this._platform=e,this._applyPlatformToPanel()}setDefaultLayout(e){this._defaultLayout=e}_persistPanelState(){e._lastActiveTab=this._panelSessionState.activeTab;let t=pk(),n={...t.sessions,[this._stateKey]:{activeTab:this._panelSessionState.activeTab,inputDraft:this._panelSessionState.inputDraft}};Ewe({...t,lastActiveTab:this._panelSessionState.activeTab,sessions:n})}_getMountTarget(){return e._mountTarget??this._getTerminalHostElement()??document.body}_getTerminalHostElement(){let e=this._terminal?.element;return e instanceof HTMLElement?e.classList.contains(`xterm`)&&e.parentElement instanceof HTMLElement?e.parentElement:e:null}_detectTerminalEngine(){let e=this._terminal?.element;return e instanceof HTMLElement&&e.classList.contains(`xterm`)?`xterm`:`non-xterm`}activate(t){this._terminal=t,e._instances.add(this)}dispose(){this.close();for(let e of this._persistentCleanups)e();this._persistentCleanups=[],this._listenersAttached=!1,this._fabSubscribed&&(e._fabSubscriberCount=Math.max(0,e._fabSubscriberCount-1),this._fabSubscribed=!1,e._setFabVisible(e._active===null)),e._instances.delete(this),e._lastFocused===this&&(e._lastFocused=null),this._terminal=null}attachListeners(){if(this._listenersAttached||!this._terminal)return;let t=this._terminal.textarea;if(!t)return;this._listenersAttached=!0,this._showFab?(e._ensureFab(this._getMountTarget()),this._fabSubscribed||=(e._fabSubscriberCount+=1,!0),e._setFabVisible(!0)):e._fabSubscriberCount===0&&e._setFabVisible(!1),e._lastFocused||=this;let n=()=>{e._lastFocused=this,lk()&&!this._isOpen&&this.open()};t.addEventListener(`focus`,n),this._persistentCleanups.push(()=>t.removeEventListener(`focus`,n)),lk()&&t.setAttribute(`inputmode`,`none`)}open(){if(!this._terminal)return;if(this._isOpen){if(this._panel?.isConnected)return;this.close()}if(e._active&&e._active!==this&&e._active.close(),this._isOpen=!0,e._active=this,e._lastFocused=this,this._showFab&&e._setFabVisible(!1),this._suppressKeyboard(),!this._hasOwnPersistedState){let t=mk();this._panelSessionState.activeTab=t,e._lastActiveTab=t}let t=document.createElement(`input-panel`);t.setAttribute(`layout`,this._defaultLayout),this._applyPanelThemeBindings(t),t.activeTab=this._panelSessionState.activeTab;let n=document.createElement(`input-method-tab`);n.setAttribute(`slot`,`input`),n.value=this._panelSessionState.inputDraft,t.appendChild(n);let r=document.createElement(`virtual-keyboard-tab`);r.setAttribute(`slot`,`keys`),r.setAttribute(`floating`,``),r.setAttribute(`platform`,this._platform),t.appendChild(r);let i=document.createElement(`shortcut-tab`);i.setAttribute(`slot`,`shortcuts`),i.setAttribute(`platform`,this._platform),t.appendChild(i);let a=document.createElement(`virtual-trackpad-tab`);a.setAttribute(`slot`,`trackpad`),a.setAttribute(`floating`,``),t.appendChild(a),this._panel=t;let o=e=>{this._renderHistory(n,e)};if(this._getHistory&&this._getHistory().then(e=>o(e)).catch(()=>{}),this._subscribeHistory)try{let e=this._subscribeHistory(e=>{o(e)});this._cleanups.push(e)}catch{}this._on(t,`input-panel:close`,()=>this.close()),this._on(t,`input-panel:send`,e=>{let t=e.detail?.data;if(t&&this._onInput(t),e.composedPath()[0]===n&&this._addHistory&&t){let e=this._normalizeHistoryText(t);e&&Promise.resolve(this._addHistory(e)).then(()=>this._getHistory?.()).then(e=>{e&&o(e)}).catch(()=>{})}}),this._on(t,`input-panel:command`,e=>{let t=e.detail;if(!fk(t))return;let n=t.command;if(!Twe(n))return;let r=typeof t.fallbackData==`string`?t.fallbackData:void 0;Promise.resolve(this._onCommand?.(n,{fallbackData:r})??!1).then(e=>{!e&&r&&this._onInput(r)}).catch(()=>{r&&this._onInput(r)})}),this._on(n,`input-panel:input-change`,e=>{let t=e.detail?.value;typeof t==`string`&&(this._panelSessionState.inputDraft=t,this._hasOwnPersistedState=!0,this._persistPanelState())}),this._on(t,`input-panel:tab-change`,e=>{let t=e.detail?.tab;dk(t)&&(this._panelSessionState.activeTab=t,this._hasOwnPersistedState=!0,this._persistPanelState()),t===`trackpad`?this._showCursor():this._hideCursor()}),this._on(t,`input-panel:settings-change`,e=>{if(!this._onSettingsChange)return;let t=e.detail;if(typeof t!=`object`||!t)return;let n=t;typeof n.fixedHeight!=`number`||typeof n.floatingWidth!=`number`||typeof n.floatingHeight!=`number`||typeof n.vibrationIntensity!=`number`||typeof n.historyLimit!=`number`||this._onSettingsChange({fixedHeight:n.fixedHeight,floatingWidth:n.floatingWidth,floatingHeight:n.floatingHeight,vibrationIntensity:n.vibrationIntensity,historyLimit:n.historyLimit})}),this._on(t,`trackpad:move`,e=>{let{dx:t,dy:n}=e.detail;this._moveCursor(t,n)}),this._on(t,`trackpad:tap`,()=>this._dispatchClick(1)),this._on(t,`trackpad:double-tap`,()=>this._dispatchDblClick()),this._on(t,`trackpad:long-press`,()=>this._dispatchRightClick()),this._on(t,`trackpad:two-finger-tap`,()=>this._dispatchRightClick()),this._on(t,`trackpad:drag-start`,()=>{this._isDragging=!0,this._dispatchMouse(`mousedown`,{detail:1})}),this._on(t,`trackpad:drag-move`,e=>{let{dx:t,dy:n}=e.detail;this._moveCursor(t,n),this._dispatchMouse(`mousemove`,{buttons:1}),this._updateEdgeScroll()}),this._on(t,`trackpad:drag-end`,()=>{this._isDragging=!1,this._stopEdgeScroll(),this._dispatchMouse(`mouseup`,{detail:1})}),this._on(t,`trackpad:scroll`,e=>{let{deltaY:t}=e.detail;this._dispatchWheel(t)}),this._getMountTarget().appendChild(t),this._createCursor(),this._focusTerminal(),this._onOpenCb?.(),e._onActiveChangeFn?.(this)}_applyPlatformToPanel(){if(!this._panel)return;let e=this._panel.querySelector(`virtual-keyboard-tab`),t=this._panel.querySelector(`shortcut-tab`);e?.setAttribute(`platform`,this._platform),t?.setAttribute(`platform`,this._platform)}_readThemeVar(e,t,n){for(let n of t){let t=e.getPropertyValue(n).trim();if(t)return t}return n}_applyPanelThemeBindings(e){let t=this._getTerminalHostElement()??this._getMountTarget(),n=getComputedStyle(t),r=this._readThemeVar(n,[`--input-panel-background`,`--terminal`,`--background`],`#1a1a1a`),i=this._readThemeVar(n,[`--input-panel-foreground`,`--terminal-foreground`,`--foreground`],`#ffffff`),a=this._readThemeVar(n,[`--input-panel-primary`,`--primary`],`#e04a2f`),o=this._readThemeVar(n,[`--input-panel-primary-foreground`,`--primary-foreground`],`#ffffff`),s=this._readThemeVar(n,[`--input-panel-border`,`--border`],`color-mix(in srgb, ${i} 24%, transparent)`),c=this._readThemeVar(n,[`--input-panel-muted`,`--muted`],`color-mix(in srgb, ${r} 86%, ${i} 14%)`),l=this._readThemeVar(n,[`--input-panel-muted-foreground`,`--muted-foreground`],`color-mix(in srgb, ${i} 62%, transparent)`);e.style.setProperty(`--input-panel-background`,r),e.style.setProperty(`--input-panel-foreground`,i),e.style.setProperty(`--input-panel-primary`,a),e.style.setProperty(`--input-panel-primary-foreground`,o),e.style.setProperty(`--input-panel-border`,s),e.style.setProperty(`--input-panel-muted`,c),e.style.setProperty(`--input-panel-muted-foreground`,l)}close(){if(this._isOpen){this._isOpen=!1,e._active===this&&(e._active=null),this._stopEdgeScroll();for(let e of this._cleanups)e();this._cleanups=[],this._panel?.remove(),this._panel=null,this._cursorEl?.remove(),this._cursorEl=null,lk()||this._restoreKeyboard(),this._showFab&&e._setFabVisible(!0),this._onCloseCb?.(),e._onActiveChangeFn?.(null)}}toggle(){if(this._isOpen){this.close();return}this.open()}syncFocusLifecycle(){if(e._lastFocused=this,this._isOpen&&!this._panel?.isConnected){this.open();return}if(e._active&&e._active!==this){this.open();return}this._isOpen&&this._focusTerminal()}_focusTerminal(){let e=this._terminal?.textarea;e&&(lk()&&e.setAttribute(`inputmode`,`none`),e.focus())}_createCursor(){let e=this._getTerminalHostElement();if(!e)return;let t=document.createElement(`div`);t.setAttribute(`data-input-panel-cursor`,`virtual-mouse`),t.setAttribute(`data-terminal-engine`,this._detectTerminalEngine()),t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:absolute;z-index:10;pointer-events:none;opacity:0;transition:opacity 0.15s;color:#fff;`;let n=Vve(20);n.style.filter=`drop-shadow(0 0 1px rgba(0,0,0,0.9))`,t.replaceChildren(n),e.appendChild(t),this._cursorEl=t;let r=e.getBoundingClientRect();this._cursorPos={x:r.width/2,y:r.height/2},this._positionCursor()}_positionCursor(){this._cursorEl&&(this._cursorEl.style.left=`${this._cursorPos.x-4}px`,this._cursorEl.style.top=`${this._cursorPos.y-2}px`)}_showCursor(){if(this._cursorEl||this._createCursor(),this._cursorEl){let e=this._getTerminalHostElement();if(e){let t=e.getBoundingClientRect();this._cursorPos={x:t.width/2,y:t.height/2},this._positionCursor()}this._cursorEl.style.opacity=`1`}}_hideCursor(){this._cursorEl&&(this._cursorEl.style.opacity=`0.3`)}_moveCursor(e,t){let n=this._getTerminalHostElement();if(!n)return;let r=n.getBoundingClientRect();this._cursorPos.x=Math.max(0,Math.min(r.width,this._cursorPos.x+e*ok)),this._cursorPos.y=Math.max(0,Math.min(r.height,this._cursorPos.y+t*ok)),this._positionCursor()}_getClientCoords(){let e=this._getTerminalHostElement();if(!e)return null;let t=e.getBoundingClientRect();return{clientX:t.left+this._cursorPos.x,clientY:t.top+this._cursorPos.y}}_resolveTarget(e,t){let n=this._getTerminalHostElement();return n?wwe(n,e,t):document.body}_dispatchMouse(e,t={}){let n=this._getClientCoords();if(!n)return;let r=t.button??0,i=t.detail??1,a=t.buttons??(e===`mousedown`?r===0?1:r===2?2:4:0);this._resolveTarget(n.clientX,n.clientY).dispatchEvent(new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,detail:i,clientX:n.clientX,clientY:n.clientY,button:r,buttons:a}))}_dispatchClick(e){this._dispatchMouse(`mousedown`,{detail:e}),this._dispatchMouse(`mouseup`,{detail:e}),this._dispatchMouse(`click`,{detail:e})}_dispatchDblClick(){this._dispatchMouse(`mousedown`,{detail:2}),this._dispatchMouse(`mouseup`,{detail:2}),this._dispatchMouse(`click`,{detail:2}),this._dispatchMouse(`dblclick`,{detail:2})}_dispatchRightClick(){this._dispatchMouse(`mousedown`,{button:2}),this._dispatchMouse(`mouseup`,{button:2}),this._dispatchMouse(`contextmenu`,{button:2})}_dispatchWheel(e){let t=this._getClientCoords();t&&this._resolveTarget(t.clientX,t.clientY).dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY,deltaY:e,deltaMode:WheelEvent.DOM_DELTA_PIXEL}))}_updateEdgeScroll(){let e=this._getTerminalHostElement();if(!e||!this._isDragging){this._stopEdgeScroll();return}let t=e.getBoundingClientRect(),n=this._cursorPos.y<sk,r=this._cursorPos.y>t.height-sk;if(!n&&!r){this._stopEdgeScroll();return}this._stopEdgeScroll(),this._edgeScrollTimer=setInterval(()=>{let e=this._getTerminalHostElement();if(!e||!this._isDragging){this._stopEdgeScroll();return}let t=e.getBoundingClientRect(),n=t.left+this._cursorPos.x,r=this._cursorPos.y<sk?t.top-ck:t.bottom+ck;this._resolveTarget(t.left+this._cursorPos.x,t.top+this._cursorPos.y).dispatchEvent(new MouseEvent(`mousemove`,{bubbles:!0,cancelable:!0,view:window,clientX:n,clientY:r,button:0,buttons:1}))},Cwe)}_stopEdgeScroll(){this._edgeScrollTimer&&=(clearInterval(this._edgeScrollTimer),null)}_suppressKeyboard(){if(!lk())return;let e=this._terminal?.textarea;e&&e.setAttribute(`inputmode`,`none`)}_restoreKeyboard(){let e=this._terminal?.textarea;e&&e.removeAttribute(`inputmode`)}_on(e,t,n){e.addEventListener(t,n),this._cleanups.push(()=>e.removeEventListener(t,n))}_normalizeHistoryText(e){return e.replace(/[\r\n]+$/u,``).trim()||null}_renderHistory(e,t){if(e.querySelectorAll(`[data-input-history-root="true"]`).forEach(e=>e.remove()),t.length===0)return;let n=document.createElement(`div`);n.dataset.inputHistoryRoot=`true`,n.setAttribute(`slot`,`history`),n.style.display=`flex`,n.style.flexDirection=`column`,n.style.gap=`4px`,n.style.padding=`4px 0`;for(let e of t){let t=document.createElement(`button`);t.type=`button`,t.title=e.text,t.style.display=`flex`,t.style.alignItems=`center`,t.style.gap=`8px`,t.style.width=`100%`,t.style.padding=`4px 6px`,t.style.border=`1px solid transparent`,t.style.borderRadius=`4px`,t.style.background=`transparent`,t.style.color=`var(--foreground, #fff)`,t.style.fontFamily=`inherit`,t.style.fontSize=`12px`,t.style.textAlign=`left`;let r=document.createElement(`span`);r.textContent=new Date(e.time).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),r.style.opacity=`0.65`,r.style.fontSize=`10px`,r.style.flexShrink=`0`;let i=document.createElement(`span`);i.textContent=e.text,i.style.overflow=`hidden`,i.style.textOverflow=`ellipsis`,i.style.whiteSpace=`nowrap`,t.appendChild(r),t.appendChild(i),t.addEventListener(`click`,()=>{this._onInput(`${e.text}\n`)}),n.appendChild(t)}e.appendChild(n)}};function gk(e){let t=/^zh\b/i.test(e);return{apiHost:t?`https://fonts.googleapis.cn`:`https://fonts.googleapis.com`,staticHost:t?`https://fonts.gstatic.cn`:`https://fonts.gstatic.com`}}function Owe(e){return e.trim().replace(/ /g,`+`)}function kwe(e){let t=e.families.map(Owe).filter(Boolean),{apiHost:n}=gk(e.lang??``),r=t.map(e=>`family=${e}`),i=`display=${e.display??`swap`}`;return`${n}/css2?${[...r,i].join(`&`)}`}function Awe(e){let t=e.documentRef??(typeof document>`u`?null:document);if(!t||e.families.length===0)return null;let n=e.lang??(typeof navigator>`u`?``:navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||``),r=gk(n),i=kwe({...e,lang:n});if(t.head.querySelector(`link[href="${i}"]`))return null;let a=t.createElement(`link`);a.rel=`preconnect`,a.href=r.apiHost,a.dataset.openspecGoogleFonts=`preconnect-api`;let o=t.createElement(`link`);o.rel=`preconnect`,o.href=r.staticHost,o.crossOrigin=`anonymous`,o.dataset.openspecGoogleFonts=`preconnect-static`;let s=t.createElement(`link`);return s.rel=`stylesheet`,s.href=i,s.dataset.openspecGoogleFonts=`stylesheet`,t.head.append(a,o,s),s}var _k=null,vk=null,yk=null,bk=null,xk=!1,Sk=!1;function Ck(){return typeof window>`u`?null:window.AudioContext??window.webkitAudioContext??null}function wk(){return xk?!0:typeof navigator>`u`?!1:navigator.userActivation?.hasBeenActive===!0||navigator.userActivation?.isActive===!0}function jwe(){typeof window>`u`||!Sk||(window.removeEventListener(`pointerdown`,Tk,!0),window.removeEventListener(`keydown`,Tk,!0),Sk=!1)}function Tk(){xk=!0,jwe(),bk?.(),bk=null,yk=null}function Ek(){typeof window>`u`||Sk||wk()||(window.addEventListener(`pointerdown`,Tk,{capture:!0,once:!0,passive:!0}),window.addEventListener(`keydown`,Tk,{capture:!0,once:!0}),Sk=!0)}function Mwe(){Ek()}function Nwe(){return typeof window>`u`||wk()?Promise.resolve():yk||(yk=new Promise(e=>{bk=e,Ek()}),yk)}async function Pwe(){return _k||vk||(Ck()?(vk=Nwe().then(async()=>{let e=Ck();if(!e)return null;let t=_k??new e;return _k=t,t.state===`suspended`&&await t.resume(),t}).finally(()=>{vk=null}),vk):null)}var Dk=class{fallbackSound;unlocked=!1;unlockPromise=null;silentAudio=null;activeAudios=new Set;constructor(e){this.fallbackSound=e===`bell`?ld:ud}init(){Mwe()}async unlock(){if(!this.unlocked)return this.unlockPromise||=this.unlockAudioContext().finally(()=>{this.unlockPromise=null}),this.unlockPromise}async play(e,t=1){e!==`silent`&&(await this.unlock().catch(()=>{}),await this.playAudio(e,t))}async unlockAudioContext(){if(!await Pwe()){this.unlocked=!0;return}this.silentAudio??=new Audio(`data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=`),this.silentAudio.volume=0,await this.silentAudio.play().catch(()=>{}),this.unlocked=!0}async playAudio(e,t){let n=this.getSoundUrl(e)??this.getSoundUrl(this.fallbackSound);n&&await this.createManagedAudio(n,t).play().catch(async r=>{if(e!==this.fallbackSound){if(await this.isMissingSound(n)){let e=this.getSoundUrl(this.fallbackSound);e&&await this.createManagedAudio(e,t).play().catch(()=>{});return}throw r}})}getSoundUrl(e){let t=Dae(e);if(t)return t;let n=_d(e);if(!n)return null;let r=$a(),i=`/api/sounds/custom/${n}`;return r?`${r}${i}`:i}async isMissingSound(e){try{return(await fetch(e,{method:`HEAD`})).status===404}catch{return!1}}createManagedAudio(e,t){let n=new Audio(e);n.volume=Fwe(t),this.activeAudios.add(n);let r=()=>{n.removeEventListener(`ended`,r),n.removeEventListener(`error`,r),this.activeAudios.delete(n)};return n.addEventListener(`ended`,r,{once:!0}),n.addEventListener(`error`,r,{once:!0}),n}};function Fwe(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}var Ok=class extends Dk{constructor(){super(`bell`)}},kk=`xtermInputPanelSettings`,Iwe=50,Lwe=1e3,Rwe=1,zwe=1,Ak=`terminal-meta`;function jk(){return Ga(`terminal-input-history`,window.location)}function Bwe(){return Ga(`openspecui-terminal`,window.location)}function Mk(){return Ga(`input-history`,window.location)}function Nk(){return Ga(`terminal-input-history-fallback`,window.location)}function Pk(e){return Math.max(Rwe,Math.min(Lwe,Math.round(e)))}function Fk(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(typeof e.text!=`string`||typeof e.time!=`number`||!Number.isFinite(e.time))continue;let r=e.text.trim();r&&t.push({text:r,time:e.time})}return t}function Ik(e,t){let n=new Map;for(let t of e){let e=`${t.time}::${t.text}`;n.has(e)||n.set(e,t)}return[...n.values()].sort((e,t)=>t.time-e.time).slice(0,Pk(t))}function Lk(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.text!==t[n]?.text||e[n]?.time!==t[n]?.time)return!1;return!0}function Rk(){try{let e=localStorage.getItem(kk);if(!e)return{};let t=JSON.parse(e);return typeof t!=`object`||!t?{}:t}catch{return{}}}function Vwe(e){let t=Rk();try{localStorage.setItem(kk,JSON.stringify({...t,...e}))}catch{}}async function zk(){return typeof window>`u`||!(`indexedDB`in window)?null:await new Promise(e=>{let t=window.indexedDB.open(Bwe(),zwe);t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(Ak)||e.createObjectStore(Ak)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)})}async function Hwe(){let e=await zk();return e?await new Promise(t=>{let n=e.transaction(Ak,`readonly`),r=n.objectStore(Ak).get(Mk());r.onsuccess=()=>{t(Fk(r.result))},r.onerror=()=>t([]),n.oncomplete=()=>e.close(),n.onerror=()=>e.close(),n.onabort=()=>e.close()}):null}async function Uwe(e){let t=await zk();return t?await new Promise(n=>{let r=t.transaction(Ak,`readwrite`);r.objectStore(Ak).put(e,Mk()),r.oncomplete=()=>{t.close(),n(!0)},r.onerror=()=>{t.close(),n(!1)},r.onabort=()=>{t.close(),n(!1)}}):!1}function Wwe(){try{let e=localStorage.getItem(Nk());return e?Fk(JSON.parse(e)):[]}catch{return[]}}function Gwe(e){try{localStorage.setItem(Nk(),JSON.stringify(e))}catch{}}async function Kwe(){return await Hwe()||Wwe()}async function Bk(e){await Uwe(e)||Gwe(e)}var qwe=class{records=[];listeners=new Set;kvUnsubscribe=null;initPromise=null;subscribe(e){return this.listeners.add(e),this.ensureInitialized(),e(this.records),()=>{this.listeners.delete(e)}}async list(){return await this.ensureInitialized(),[...this.records]}getLimit(){let e=Rk().historyLimit;return typeof e==`number`&&Number.isFinite(e)?Pk(e):Iwe}async setLimit(e){let t=Pk(e);Vwe({historyLimit:t}),await this.ensureInitialized();let n=Ik(this.records,t);await this.commit(n,{persistRemote:!0})}async add(e){let t=e.trim();if(!t)return;await this.ensureInitialized();let n=Ik([{text:t,time:Date.now()},...this.records],this.getLimit());await this.commit(n,{persistRemote:!0})}destroy(){this.kvUnsubscribe&&=(this.kvUnsubscribe(),null)}async ensureInitialized(){if(this.initPromise){await this.initPromise;return}this.initPromise=this.initialize(),await this.initPromise}async initialize(){if(this.records=Ik(await Kwe(),this.getLimit()),this.emit(),!qa())try{let e=Fk(await X.kv.get.query({key:jk()})),t=Ik([...this.records,...e],this.getLimit());Lk(this.records,t)||(this.records=t,await Bk(this.records),this.emit()),Lk(e,this.records)||this.persistRemote(this.records);let n=X.kv.subscribe.subscribe({key:jk()},{onData:e=>{this.onRemoteData(e)}});this.kvUnsubscribe=()=>n.unsubscribe()}catch{}}async onRemoteData(e){let t=Fk(e),n=Ik([...this.records,...t],this.getLimit());await this.commit(n,{persistRemote:!1})}async commit(e,t){Lk(this.records,e)||(this.records=e,await Bk(this.records),this.emit(),t.persistRemote&&!qa()&&this.persistRemote(this.records))}async persistRemote(e){try{await X.kv.set.mutate({key:jk(),value:e})}catch{}}emit(){for(let e of this.listeners)e(this.records)}};function Vk(e){return e.type===`keydown`}function Hk(e,t){return e.key.toLowerCase()===t}function Uk(e){return e.metaKey||e.ctrlKey}function Wk(e){return Uk(e)&&!e.altKey}function Gk(e){return e.clipboard?e.clipboard:typeof navigator>`u`?null:navigator.clipboard??null}function Kk(e,t){e.catch(e=>{t.onAsyncError?.(e)})}async function Jwe(e,t){let n=Gk(e);n?.writeText&&await n.writeText(t)}async function Ywe(e){let t=Gk(e);if(!t?.readText)return;let n=await t.readText();if(n){try{if(e.terminal.paste?.(n),e.terminal.paste)return}catch{}e.writeInput(n)}}var Xwe=[{id:`terminal.copy-selection`,handle:(e,t)=>!Vk(e)||!Wk(e)||!Hk(e,`c`)?null:t.terminal.hasSelection?.()?qk(t):`allow`},{id:`terminal.paste-clipboard`,handle:(e,t)=>!Vk(e)||!Wk(e)||!Hk(e,`v`)?null:Jk(t)},{id:`terminal.select-all`,handle:(e,t)=>!Vk(e)||!e.metaKey||e.ctrlKey||e.altKey||!Hk(e,`a`)?null:Yk(t)},{id:`terminal.zoom-in`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`=`&&e.key!==`+`?null:(t.zoomFont(1),`block`)},{id:`terminal.zoom-out`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`-`?null:(t.zoomFont(-1),`block`)},{id:`terminal.zoom-reset`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`0`?null:(t.resetFontSize(),`block`)}];function qk(e){if(!e.terminal.hasSelection?.())return`allow`;let t=e.terminal.getSelection?.()??``;return t?(Kk(Jwe(e,t),e),`block`):`allow`}function Jk(e){return Gk(e)?.readText?(Kk(Ywe(e),e),`block`):`allow`}function Yk(e){return e.terminal.selectAll?(e.terminal.selectAll(),`block`):`allow`}var Zwe=[{id:`terminal.command.copy-selection`,command:`copy`,run:qk},{id:`terminal.command.paste-clipboard`,command:`paste`,run:Jk},{id:`terminal.command.select-all`,command:`select-all`,run:Yk}],Qwe=class{constructor(e=Xwe,t=Zwe){this.bindings=e,this.commandBindings=t}handleKeyEvent(e,t){for(let n of this.bindings){let r=n.handle(e,t);if(r)return r}return`allow`}runCommand(e,t){return this.commandBindings.find(t=>t.command===e)?.run(t)??`allow`}},Xk=[`app`,`light`,`dark`,`system`],$we=[`default-light`,`default-dark`,`monokai`,`nord`,`solarized-light`,`solarized-dark`],eTe=[{value:`default-light`,label:`Default Light`},{value:`default-dark`,label:`Default Dark`},{value:`monokai`,label:`Monokai`},{value:`nord`,label:`Nord`},{value:`solarized-light`,label:`Solarized Light`},{value:`solarized-dark`,label:`Solarized Dark`}],tTe={"default-light":{id:`default-light`,label:`Default Light`,modeHint:`light`,palette:{background:`#f6f5f2`,foreground:`#1b1b1b`,cursor:`#ea580c`,cursorAccent:`#f6f5f2`,selectionBackground:`rgba(234, 88, 12, 0.22)`,black:`#111111`,red:`#b91c1c`,green:`#15803d`,yellow:`#a16207`,blue:`#1d4ed8`,magenta:`#a21caf`,cyan:`#0f766e`,white:`#f6f5f2`,brightBlack:`#4b5563`,brightRed:`#dc2626`,brightGreen:`#16a34a`,brightYellow:`#ca8a04`,brightBlue:`#2563eb`,brightMagenta:`#c026d3`,brightCyan:`#0891b2`,brightWhite:`#ffffff`}},"default-dark":{id:`default-dark`,label:`Default Dark`,modeHint:`dark`,palette:{background:`#141414`,foreground:`#e5dfd2`,cursor:`#f97316`,cursorAccent:`#141414`,selectionBackground:`rgba(249, 115, 22, 0.28)`,black:`#151515`,red:`#f87171`,green:`#4ade80`,yellow:`#facc15`,blue:`#60a5fa`,magenta:`#e879f9`,cyan:`#67e8f9`,white:`#f4f1ea`,brightBlack:`#6b7280`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#f0abfc`,brightCyan:`#a5f3fc`,brightWhite:`#fffdf8`}},monokai:{id:`monokai`,label:`Monokai`,modeHint:`either`,palette:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`rgba(73, 72, 62, 0.9)`,black:`#272822`,red:`#f92672`,green:`#a6e22e`,yellow:`#f4bf75`,blue:`#66d9ef`,magenta:`#ae81ff`,cyan:`#a1efe4`,white:`#f8f8f2`,brightBlack:`#75715e`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#f4bf75`,brightBlue:`#66d9ef`,brightMagenta:`#ae81ff`,brightCyan:`#a1efe4`,brightWhite:`#f9f8f5`}},nord:{id:`nord`,label:`Nord`,modeHint:`either`,palette:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#88c0d0`,cursorAccent:`#2e3440`,selectionBackground:`rgba(94, 129, 172, 0.38)`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#d08770`,brightGreen:`#8fbcbb`,brightYellow:`#eceff4`,brightBlue:`#5e81ac`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},"solarized-light":{id:`solarized-light`,label:`Solarized Light`,modeHint:`light`,palette:{background:`#fdf6e3`,foreground:`#586e75`,cursor:`#cb4b16`,cursorAccent:`#fdf6e3`,selectionBackground:`rgba(147, 161, 161, 0.32)`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#657b83`,brightRed:`#cb4b16`,brightGreen:`#93a1a1`,brightYellow:`#839496`,brightBlue:`#6c71c4`,brightMagenta:`#d33682`,brightCyan:`#2aa198`,brightWhite:`#fdf6e3`}},"solarized-dark":{id:`solarized-dark`,label:`Solarized Dark`,modeHint:`dark`,palette:{background:`#002b36`,foreground:`#93a1a1`,cursor:`#cb4b16`,cursorAccent:`#002b36`,selectionBackground:`rgba(88, 110, 117, 0.5)`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#657b83`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}}};function nTe(e){return Xk.includes(e)}function Zk(e){return $we.includes(e)}function rTe(e){let t=e.useTheme??`app`;return t===`light`?`light`:t===`dark`?`dark`:t===`system`?e.systemDarkMode?`dark`:`light`:e.appDarkMode?`dark`:`light`}function Qk(e){let t=rTe(e),n=t===`dark`?e.darkTheme??`default-dark`:e.lightTheme??`default-light`;return{id:n,mode:t,definition:tTe[n]}}var $k=[`xterm`,`ghostty`];function eA(e){return $k.includes(e)}var tA=`"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,nA={fontSize:13,fontFamily:``,cursorBlink:!0,cursorStyle:`block`,scrollback:1e3,useTheme:`app`,lightTheme:`default-light`,darkTheme:`default-dark`,rendererEngine:`xterm`,bellSound:ld,bellVolume:1},rA=1500,iA=1e3,iTe=1e4,aA=`common`,aTe=512*1024,oTe=8,sTe=32,oA=13,cTe=800,lTe={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`},uTe={ArrowLeft:`\x1Bb`,ArrowRight:`\x1Bf`,ArrowUp:`\x1B[1;3A`,ArrowDown:`\x1B[1;3B`},dTe={ArrowLeft:``,ArrowUp:``,ArrowRight:``,ArrowDown:``},sA=[`JetBrains Mono`,`Fira Code`,`Source Code Pro`,`IBM Plex Mono`,`Inconsolata`,`Roboto Mono`,`Ubuntu Mono`,`Space Mono`],fTe={"JetBrains Mono":`"JetBrains Mono Variable"`,"Share Tech Mono":`"Share Tech Mono"`},cA=new Set;function lA(e){try{return(new URL(e).pathname.split(`/`).pop()??``).replace(/\.[^.]+$/,``).replace(/[-_]/g,` `)||`CustomFont`}catch{return`CustomFont`}}async function pTe(e){let t=e.trim();if(!t)return``;if(!/^https?:\/\//i.test(t))return t;if(cA.has(t))return lA(t);try{let e=(await fetch(t,{method:`HEAD`})).headers.get(`content-type`)??``;if(e.includes(`text/css`)){let e=document.createElement(`link`);return e.rel=`stylesheet`,e.href=t,e.dataset.fontSrc=t,document.head.appendChild(e),cA.add(t),``}if(e.startsWith(`font/`)){let e=lA(t),n=document.createElement(`style`);return n.dataset.fontSrc=t,n.textContent=`@font-face { font-family: '${e}'; src: url('${t}'); }`,document.head.appendChild(n),cA.add(t),e}}catch{}return t}function mTe(e){let t=`google:${e}`;if(cA.has(t))return;let n=Awe({families:[e]});n&&(n.dataset.fontSrc=t),cA.add(t)}var hTe=class{instances=new Map;listeners=new Set;activationListeners=new Set;idCounter=0;config={...nA};snapshotCache=null;inputHistoryStore=new qwe;bellSoundEngine=new Ok;keybindings=new Qwe;ghosttyModule=null;ghosttyInitPromise=null;appDarkMode=!1;systemDarkMode=!1;resolvedTheme=Qk({useTheme:nA.useTheme,lightTheme:nA.lightTheme,darkTheme:nA.darkTheme,appDarkMode:!1,systemDarkMode:!1});ws=null;wsConnected=!1;reconnectTimer=null;reconnectDelay=iA;pendingCreates=[];pendingCloseSessionIds=new Set;serverToLocalSessionId=new Map;hasDiscoveredSessions=!1;inputPanelDefaultLayout=`floating`;activeSessionId=null;constructor(){this.bellSoundEngine.init()}createSession(e){let t=`term-${++this.idCounter}`,n=e?.label??`Shell ${this.idCounter}`,r=this.createTerminalInstance(t,{label:n,command:e?.command,args:e?.args,isDedicated:e?.isDedicated??!1,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl,initialInput:e?.initialInput,customTitle:e?.customTitle??null,restored:!1,serverSessionId:null,platform:aA});return this.instances.set(t,r),this._applyFonts(),this.bindTerminalInput(r),this.wsConnected&&this.ws?this.wsSend({type:`create`,requestId:t,cols:r.terminal.cols||80,rows:r.terminal.rows||24,command:e?.command,args:e?.args,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl}):(this.pendingCreates.push({requestId:t,command:e?.command,args:e?.args,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl,cols:r.terminal.cols||80,rows:r.terminal.rows||24}),this.ensureWsConnected()),e?.initialInput&&this.scheduleInitialInput(t,e.initialInput),this.notify(),t}scheduleInitialInput(e,t){let n=0,r=()=>{this.writeToSession(e,t)||(n+=1,!(n>75)&&globalThis.setTimeout(r,80))};globalThis.setTimeout(r,80)}createTerminalInstance(e,t){let{terminal:n,fitAddon:r,afterOpenHook:i,engine:a}=this.createRendererTerminal(),o=this.createInputPanelAddon(e,t.platform);return n.loadAddon(o),this.attachTerminalShortcuts(n,a,t=>this.writeToSession(e,t)),{id:e,serverSessionId:t.serverSessionId,terminal:n,fitAddon:r,inputPanelAddon:o,isConnected:!1,label:t.label,customTitle:t.customTitle,processTitle:null,oscTitle:null,cwd:null,progress:null,promptState:null,isDedicated:t.isDedicated,isExited:!1,exitCode:null,command:t.command,args:t.args,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,mountedContainer:null,resizeObserver:null,hasOpened:!1,afterOpenHook:i,pendingOutput:[],pendingOutputBytes:0,lastOutputTime:0,lastBellAt:null,outputIdleTimer:null,restored:t.restored,platform:t.platform,rendererEngine:a}}getTerminalOptions(){let e=Qk({useTheme:this.config.useTheme,lightTheme:this.config.lightTheme,darkTheme:this.config.darkTheme,appDarkMode:this.appDarkMode,systemDarkMode:this.systemDarkMode});return{cursorBlink:this.config.cursorBlink,cursorStyle:this.config.cursorStyle,fontSize:this.config.fontSize,fontFamily:tA,theme:e.definition.palette,allowTransparency:!1,convertEol:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,scrollback:this.config.scrollback}}createRendererTerminal(){let e=this.getTerminalOptions();if(this.config.rendererEngine===`xterm`){let t=new L_e(e),n=new ohe;return t.loadAddon(n),t.loadAddon(new fhe),{terminal:t,fitAddon:n,afterOpenHook:null,engine:`xterm`}}let t=this.ghosttyModule;if(!t)throw Error(`ghostty-web is not initialized. Open Settings and switch engine again.`);let n=new t.Terminal(e),r=new t.FitAddon;return n.loadAddon(r),{terminal:n,fitAddon:r,afterOpenHook:()=>{let e=n;e.registerLinkProvider&&e.registerLinkProvider(new t.UrlRegexProvider(n))},engine:`ghostty`}}createInputPanelAddon(e,t){return new hk({onInput:t=>this.writeToSession(e,t),onCommand:t=>this.runInputPanelCommand(e,t),getHistory:async()=>this.inputHistoryStore.list(),addHistory:async e=>this.inputHistoryStore.add(e),subscribeHistory:e=>this.inputHistoryStore.subscribe(e),platform:t,defaultLayout:this.inputPanelDefaultLayout,showFab:!1,stateKey:e,onSettingsChange:async e=>{await this.inputHistoryStore.setLimit(e.historyLimit)}})}runInputPanelCommand(e,t){let n=this.instances.get(e);return n?this.keybindings.runCommand(t,{terminal:n.terminal,writeInput:t=>this.writeToSession(e,t),zoomFont:e=>this.zoomFont(e),resetFontSize:()=>this.resetFontSize(),onAsyncError:e=>console.error(`[terminal] input panel command failed:`,e)})===`block`:!1}applyGhosttyBackground(e,t){if(e.rendererEngine!==`ghostty`)return;let n=e.terminal.options.theme??{},r=typeof n.background==`string`&&n.background.trim().length>0?n.background:this.resolveNearestOpaqueBackground(t);e.terminal.options.allowTransparency=!1,e.terminal.options.theme={...n,background:r}}isTransparentColor(e){let t=e.trim().toLowerCase();return t.length===0||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`rgba(0,0,0,0)`}resolveNearestOpaqueBackground(e){let t=e;for(;t;){let e=window.getComputedStyle(t).backgroundColor;if(!this.isTransparentColor(e))return e;t=t.parentElement}return`rgb(26, 26, 26)`}resolveTerminalKeyInput(e){return e.type===`keydown`?e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey?uTe[e.key]??null:e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey?dTe[e.key]??null:!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey?lTe[e.key]??null:null:null}getKeyEventResult(e,t){return e===`xterm`?t===`allow`:t===`block`}attachTerminalShortcuts(e,t,n){e.attachCustomKeyEventHandler(r=>{let i=this.resolveTerminalKeyInput(r);if(i&&n(i))return r.preventDefault(),r.stopPropagation(),this.getKeyEventResult(t,`block`);let a=r.metaKey||r.ctrlKey;if(r.type!==`keydown`||!a)return this.getKeyEventResult(t,`allow`);let o=this.keybindings.handleKeyEvent(r,{terminal:e,writeInput:n,zoomFont:e=>this.zoomFont(e),resetFontSize:()=>this.resetFontSize(),onAsyncError:e=>console.error(`[terminal] keybinding failed:`,e)});return o===`block`&&(r.preventDefault(),r.stopPropagation()),this.getKeyEventResult(t,o)})}bindTerminalInput(e){e.terminal.onData(t=>{if(e.isExited){this.closeSession(e.id);return}let n=this.resolveServerSessionId(e.id);n&&this.wsSend({type:`input`,sessionId:n,data:t})})}isTerminalNotOpenedError(e){if(!(e instanceof Error))return!1;let t=e.message;return t.includes(`Terminal must be opened before use`)||t.includes(`Call terminal.open(parent) first`)}enqueuePendingOutput(e,t){if(t)for(e.pendingOutput.push(t),e.pendingOutputBytes+=t.length;e.pendingOutputBytes>aTe&&e.pendingOutput.length;){let t=e.pendingOutput.shift();if(!t)break;e.pendingOutputBytes-=t.length}}writeTerminalOutput(e,t){if(t){if(!e.hasOpened){this.enqueuePendingOutput(e,t);return}try{e.terminal.write(t)}catch(n){if(this.isTerminalNotOpenedError(n)){this.enqueuePendingOutput(e,t);return}console.error(`[terminal] failed to write output:`,n)}}}flushPendingOutput(e){if(!e.hasOpened||e.pendingOutput.length===0)return;let t=e.pendingOutput.join(``);e.pendingOutput=[],e.pendingOutputBytes=0,this.writeTerminalOutput(e,t)}replaceInstanceRenderer(e){let t=e.mountedContainer,n=e.serverSessionId;e.mountedContainer&&this.unmount(e.id),e.terminal.dispose();let{terminal:r,fitAddon:i,afterOpenHook:a,engine:o}=this.createRendererTerminal(),s=this.createInputPanelAddon(e.id,e.platform);r.loadAddon(s),this.attachTerminalShortcuts(r,o,t=>this.writeToSession(e.id,t)),e.terminal=r,e.fitAddon=i,e.inputPanelAddon=s,e.hasOpened=!1,e.afterOpenHook=a,e.mountedContainer=null,e.resizeObserver=null,e.rendererEngine=o,this.bindTerminalInput(e),t&&this.mount(e.id,t),n&&this.wsSend({type:`attach`,sessionId:n,cols:e.terminal.cols||80,rows:e.terminal.rows||24})}async ensureGhosttyModule(){return this.ghosttyModule?this.ghosttyModule:(this.ghosttyInitPromise||=l(()=>import(`./ghostty-web-CxzCiCWn.js`).then(async e=>(await e.init(),this.ghosttyModule=e,e)),__vite__mapDeps([10,11])).finally(()=>{this.ghosttyInitPromise=null}),this.ghosttyInitPromise)}async setRendererEngine(e){if(e!==this.config.rendererEngine){e===`ghostty`&&await this.ensureGhosttyModule(),this.config.rendererEngine=e;for(let e of this.instances.values())this.replaceInstanceRenderer(e);this._applyFonts(),this.notify()}}closeSession(e,t){let n=this.instances.get(e);if(!n)return;let r=t?.triggerCloseCallback!==!1;if(n.mountedContainer&&this.unmount(e),n.outputIdleTimer&&=(clearTimeout(n.outputIdleTimer),null),this.pendingCreates=this.pendingCreates.filter(t=>t.requestId!==e),n.serverSessionId){let e=n.serverSessionId;this.serverToLocalSessionId.delete(e),this.wsConnected&&this.ws?.readyState===WebSocket.OPEN?this.wsSend({type:`close`,sessionId:e}):this.pendingCloseSessionIds.add(e)}n.terminal.dispose(),r&&this.runCloseCallback(n),this.instances.delete(e),this.activeSessionId===e&&(this.activeSessionId=null),this.notify()}closeAll(){for(let e of this.instances.keys())this.closeSession(e,{triggerCloseCallback:!1});this.activeSessionId=null}mount(e,t){let n=this.instances.get(e);if(!n)return;if(n.mountedContainer===t){requestAnimationFrame(()=>{try{n.fitAddon.fit()}catch{}});return}if(n.mountedContainer&&this.unmount(e),!n.hasOpened)this.applyGhosttyBackground(n,t),n.terminal.open(t),n.hasOpened=!0,n.afterOpenHook?.(),n.afterOpenHook=null,this.flushPendingOutput(n),n.inputPanelAddon.attachListeners();else{let e=n.terminal.element;e&&!e.contains(t)&&e.parentNode!==t&&t.appendChild(e),this.flushPendingOutput(n),this.applyGhosttyBackground(n,t),n.inputPanelAddon.attachListeners()}n.mountedContainer=t,requestAnimationFrame(()=>{try{n.fitAddon.fit()}catch{}});let r=new ResizeObserver(()=>{try{if(n.fitAddon.fit(),n.terminal.cols&&n.terminal.rows){let t=this.resolveServerSessionId(e);if(!t)return;this.wsSend({type:`resize`,sessionId:t,cols:n.terminal.cols,rows:n.terminal.rows})}}catch{}});r.observe(t),n.resizeObserver=r,requestAnimationFrame(()=>{this.focusSession(e)})}unmount(e){let t=this.instances.get(e);!t||!t.mountedContainer||(t.resizeObserver&&=(t.resizeObserver.disconnect(),null),t.mountedContainer=null)}focusSession(e){let t=this.instances.get(e);if(!t||!t.hasOpened)return;let n=!1;try{t.terminal.focus?.(),n=!0}catch{}if(!n){let e=t.terminal.element;if(e instanceof HTMLElement)try{e.focus()}catch{}}t.inputPanelAddon.syncFocusLifecycle()}setActiveSessionId(e){e&&!this.instances.has(e)||(this.activeSessionId=e)}setCustomTitle(e,t){let n=this.instances.get(e);n&&(n.customTitle=t,this.notify())}getDisplayTitle(e){let t=this.instances.get(e);return t?t.customTitle??t.oscTitle??t.processTitle??t.label:``}getConfig(){return{...this.config}}getResolvedTheme(){return this.resolvedTheme}setThemeContext(e){(this.appDarkMode!==e.appDarkMode||this.systemDarkMode!==e.systemDarkMode)&&(this.appDarkMode=e.appDarkMode,this.systemDarkMode=e.systemDarkMode,this.refreshResolvedTheme())}applyConfig(e){let{rendererEngine:t,...n}=e;Object.assign(this.config,n);for(let e of this.instances.values()){let t=e.terminal;t.options.fontSize=this.config.fontSize,t.options.cursorBlink=this.config.cursorBlink,t.options.cursorStyle=this.config.cursorStyle,t.options.scrollback=this.config.scrollback}this.refreshResolvedTheme(),this._applyFonts(),t&&t!==this.config.rendererEngine&&this.setRendererEngine(t).catch(e=>{console.error(`[terminal] failed to switch renderer engine:`,e)}),this.notify()}refreshResolvedTheme(){let e=Qk({useTheme:this.config.useTheme,lightTheme:this.config.lightTheme,darkTheme:this.config.darkTheme,appDarkMode:this.appDarkMode,systemDarkMode:this.systemDarkMode});this.resolvedTheme=e;for(let t of this.instances.values())t.terminal.options.theme=e.definition.palette,t.terminal.options.allowTransparency=!1,t.mountedContainer&&this.applyGhosttyBackground(t,t.mountedContainer)}async _applyFonts(){let e=this.config.fontFamily;if(!e){this._setFontFamily(tA);return}let t=e.split(/[,]+/).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){let t=fTe[e];if(t)n.push(t);else if(sA.includes(e))mTe(e),n.push(e);else{let t=await pTe(e);t&&n.push(t)}}n.push(tA),this._setFontFamily(n.join(`, `))}_setFontFamily(e){for(let t of this.instances.values())if(t.terminal.options.fontFamily=e,t.mountedContainer)try{t.fitAddon.fit()}catch{}}configPersistTimer=null;persistFontSize(){this.configPersistTimer&&clearTimeout(this.configPersistTimer),this.configPersistTimer=setTimeout(()=>{this.configPersistTimer=null,l(async()=>{let{trpcClient:e}=await import(`./trpc-sRR2hWAJ.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])).then(({trpcClient:e})=>{e.config.update.mutate({terminal:{fontSize:this.config.fontSize}})}).catch(()=>{})},cTe)}zoomFont(e){let t=Math.min(sTe,Math.max(oTe,this.config.fontSize+e));t!==this.config.fontSize&&(this.applyConfig({fontSize:t}),this.persistFontSize())}resetFontSize(){this.config.fontSize!==oA&&(this.applyConfig({fontSize:oA}),this.persistFontSize())}writeToSession(e,t){let n=this.resolveServerSessionId(e);return n?this.wsSend({type:`input`,sessionId:n,data:t}):!1}openInputPanel(e){let t=[e?this.instances.get(e):void 0,...this.instances.values()],n=t.find(e=>e&&e.mountedContainer)?.id??t.find(e=>e)?.id;if(!n)return!1;this.focusSession(n);let r=this.instances.get(n);return r?(r.inputPanelAddon.open(),!0):!1}hasServerSession(e){let t=this.getInstanceByServerSessionId(e);return!!t&&!t.isExited}focusServerSession(e){let t=this.getInstanceByServerSessionId(e);return!t||t.isExited?!1:(this.focusSession(t.id),!0)}subscribeActivation(e){return this.activationListeners.add(e),()=>{this.activationListeners.delete(e)}}requestActivateSession(e){let t=this.instances.get(e);return!t||t.isExited?!1:(this.emitActivationRequest(t.id),!0)}requestActivateServerSession(e){let t=this.getInstanceByServerSessionId(e);return!t||t.isExited?!1:(this.emitActivationRequest(t.id),!0)}getLocalSessionIdForServerSession(e){return this.getInstanceByServerSessionId(e)?.id??null}isSessionActive(e){return this.activeSessionId===e}async addInputHistory(e){await this.inputHistoryStore.add(e)}resolveServerSessionId(e){let t=this.instances.get(e);return t?t.serverSessionId:null}getInstanceByServerSessionId(e){let t=this.serverToLocalSessionId.get(e)??e;return this.instances.get(t)}getLocalSessionIdByServerSessionId(e){return this.serverToLocalSessionId.get(e)??e}handleCreatedResponse(e){let t=this.instances.get(e.requestId);if(!t){this.wsSend({type:`close`,sessionId:e.sessionId});return}t.serverSessionId=e.sessionId,t.platform=e.platform,t.inputPanelAddon.setPlatform(e.platform),t.isConnected=!0,this.serverToLocalSessionId.set(e.sessionId,e.requestId),this.notify()}handleOutputResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(this.writeTerminalOutput(t,e.data),t.lastOutputTime=Date.now(),this.notify(),t.outputIdleTimer&&clearTimeout(t.outputIdleTimer),t.outputIdleTimer=setTimeout(()=>{t.outputIdleTimer=null,this.notify()},rA))}handleExitResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);if(t){if(t.isExited=!0,t.exitCode=e.exitCode,t.closeTip||t.isDedicated){let n=t.closeTip??`Press any key to close (equivalent to close action).`;this.writeTerminalOutput(t,`\r\n\x1b[90m[Process exited with code ${e.exitCode}. ${n}]\x1b[0m`)}this.notify()}}handleTitleResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.oscTitle=e.title,this.notify())}handleProcessTitleResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.processTitle=e.title,this.notify())}handleCwdResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.cwd=e.cwd,this.notify())}handleProgressResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.progress=e.state===`clear`?null:{state:e.state,value:e.value},this.notify())}handlePromptStateResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.promptState=e.state,this.notify())}handleBellResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);!t||t.isExited||(t.lastBellAt=e.createdAt??Date.now(),this.bellSoundEngine.play(this.config.bellSound,this.config.bellVolume).catch(()=>{}),this.notify())}handleBufferResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);!t||!e.data||this.writeTerminalOutput(t,e.data)}handleErrorResponse(e){if(e.code===`PTY_CREATE_FAILED`&&e.sessionId){let t=this.instances.get(e.sessionId);t&&!t.serverSessionId&&(t.isExited=!0,t.exitCode=-1,this.writeTerminalOutput(t,`\r\n\x1b[31m[Failed to start PTY: ${e.message}]\x1b[0m`),this.notify())}console.warn(`[pty] ${e.code}: ${e.message}`,e)}setInputPanelMountTarget(e){hk.mountTarget=e}setInputPanelDefaultLayout(e){this.inputPanelDefaultLayout=e;for(let t of this.instances.values())t.inputPanelAddon.setDefaultLayout(e)}getTerminalDimensions(e){let t=this.instances.get(e);return t?{cols:t.terminal.cols||80,rows:t.terminal.rows||24}:null}subscribe(e){return this.listeners.add(e),this.ensureWsConnected(),()=>{this.listeners.delete(e)}}getSnapshot(){if(this.snapshotCache)return this.snapshotCache;let e=[];for(let t of this.instances.values())e.push({id:t.id,serverSessionId:t.serverSessionId,label:t.label,customTitle:t.customTitle,processTitle:t.processTitle,oscTitle:t.oscTitle,cwd:t.cwd,progress:t.progress,promptState:t.promptState,displayTitle:t.customTitle??t.oscTitle??t.processTitle??t.label,isDedicated:t.isDedicated,isExited:t.isExited,exitCode:t.exitCode,outputActive:t.lastOutputTime>0&&Date.now()-t.lastOutputTime<rA,lastBellAt:t.lastBellAt,command:t.command,args:t.args,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,platform:t.platform});return this.snapshotCache={sessions:e},this.snapshotCache}notify(){this.snapshotCache=null;for(let e of this.listeners)e()}emitActivationRequest(e){this.setActiveSessionId(e);for(let t of this.activationListeners)t(e);this.scheduleSessionFocus(e)}scheduleSessionFocus(e){(typeof globalThis.requestAnimationFrame==`function`?globalThis.requestAnimationFrame.bind(globalThis):e=>globalThis.setTimeout(()=>e(Date.now()),0))(()=>{this.focusSession(e)})}ensureWsConnected(){this.ws&&(this.ws.readyState===WebSocket.CONNECTING||this.ws.readyState===WebSocket.OPEN)||this.connectSharedWebSocket()}connectSharedWebSocket(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null);let e=new WebSocket(Fne());this.ws=e,e.onopen=()=>{this.wsConnected=!0,this.reconnectDelay=iA;for(let e of this.pendingCloseSessionIds)this.wsSend({type:`close`,sessionId:e});this.pendingCloseSessionIds.clear(),this.wsSend({type:`list`});for(let e of this.pendingCreates)this.wsSend({type:`create`,requestId:e.requestId,cols:e.cols,rows:e.rows,command:e.command,args:e.args,closeTip:e.closeTip,closeCallbackUrl:e.closeCallbackUrl});this.pendingCreates=[];for(let e of this.instances.values())if(!e.restored)continue;this.notify()},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let n=nhe.safeParse(t);n.success&&this.handleServerMessage(n.data)},e.onclose=()=>{this.wsConnected=!1,this.ws=null,this.notify(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,(this.listeners.size>0||this.instances.size>0)&&this.connectSharedWebSocket()},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*1.5,iTe)},e.onerror=()=>{}}handleServerMessage(e){switch(e.type){case`list`:this.handleListResponse(e);break;case`created`:this.handleCreatedResponse(e);break;case`buffer`:this.handleBufferResponse(e);break;case`output`:this.handleOutputResponse(e);break;case`exit`:this.handleExitResponse(e);break;case`title`:this.handleTitleResponse(e);break;case`process-title`:this.handleProcessTitleResponse(e);break;case`cwd`:this.handleCwdResponse(e);break;case`progress`:this.handleProgressResponse(e);break;case`prompt-state`:this.handlePromptStateResponse(e);break;case`bell`:this.handleBellResponse(e);break;case`error`:this.handleErrorResponse(e);break}}handleListResponse(e){let t=new Set(e.sessions.map(e=>e.id));for(let t of e.sessions){let e=this.getLocalSessionIdByServerSessionId(t.id),n=this.instances.get(e);if(n)n.serverSessionId||=t.id;else{let e=t.title||`${t.command} ${t.args.join(` `)}`.trim();n=this.createTerminalInstance(t.id,{label:e.length>40?`${e.slice(0,37)}...`:e,command:t.command,args:t.args,isDedicated:!1,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,initialInput:void 0,customTitle:null,restored:!0,serverSessionId:t.id,platform:t.platform??aA}),t.isExited&&(n.isExited=!0,n.exitCode=t.exitCode),this.bindTerminalInput(n),this.instances.set(n.id,n),this._applyFonts()}n.closeTip=t.closeTip,n.closeCallbackUrl=t.closeCallbackUrl,n.platform=t.platform??aA,n.inputPanelAddon.setPlatform(n.platform),this.serverToLocalSessionId.set(t.id,n.id),this.wsSend({type:`attach`,sessionId:t.id,cols:n.terminal.cols||80,rows:n.terminal.rows||24})}for(let e of this.instances.values())e.restored&&e.serverSessionId&&!t.has(e.serverSessionId)&&!e.isExited&&(e.isExited=!0,e.exitCode=-1);this.hasDiscoveredSessions=!0,this.notify()}get discoveredSessions(){return this.hasDiscoveredSessions}runCloseCallback(e){if(!e.isExited)return;let t=gTe(e.closeCallbackUrl,e.exitCode);t&&_Te(t)}wsSend(e){return this.ws?.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(e)),!0):!1}};function gTe(e,t){if(!e)return null;if(typeof e==`string`){let t=e.trim();return t.length>0?t:null}let n=e[t==null?`null`:String(t)];if(typeof n==`string`&&n.trim().length>0)return n.trim();let r=e[`*`];return typeof r==`string`&&r.trim().length>0?r.trim():null}function _Te(e){let t;try{t=new URL(e,window.location.origin)}catch{return}if(t.origin===window.location.origin){let e=`${t.pathname}${t.search}${t.hash}`,n=Oo.getAreaForPath(t.pathname);Oo.push(n,e,null);return}window.open(t.toString(),`_blank`,`noopener,noreferrer`)}var uA=new hTe,dA=md;Y({sound:dA.default(ud),volume:Eae,systemNotificationsEnabled:Vs().default(!1)});var vTe=Gs(`type`,[Y({type:qs(`terminal`),sessionId:J().min(1),title:J().optional()}),Y({type:qs(`openspec-change`),changeId:J().min(1),title:J().optional()}),Y({type:qs(`hooks-plugin`),pluginId:J().min(1),title:J().optional()}),Y({type:qs(`custom`),groupId:J().min(1),title:J().optional()})]),yTe=Gs(`type`,[Y({type:qs(`terminal.focus`),label:J().default(`Focus terminal`),target:Y({sessionId:J().min(1)})}),Y({type:qs(`href.open`),label:J().default(`Open`),target:Y({href:J().min(1)})})]),bTe=J().min(1);Y({title:J().min(1).max(160),body:J().max(2e3).default(``),source:vTe,actions:Us(yTe).default([]),level:Js([`info`,`success`,`warning`,`error`]).default(`info`),createdAt:Bs().int().positive().optional()}).extend({id:J().min(1),createdAt:Bs().int().positive(),groupKey:bTe});function xTe(e){return e.type===`terminal`?e.title?.trim()||`Terminal ${e.sessionId}`:e.type===`openspec-change`?e.title?.trim()||`Change ${e.changeId}`:e.type===`hooks-plugin`?e.title?.trim()||`Plugin ${e.pluginId}`:e.title?.trim()||e.groupId}function fA(e){return Array.isArray(e)?`[${e.map(e=>fA(e)).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${fA(t)}`).join(`,`)}}`:JSON.stringify(e)}function STe(e){return fA({groupKey:e.groupKey,title:e.title,body:e.body,source:e.source,actions:e.actions,level:e.level})}function CTe(e){let t=new Map;for(let n of e){let e=STe(n),r=t.get(e);r?r.push(n):t.set(e,[n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort((e,t)=>t.createdAt-e.createdAt);return{key:e,notifications:n,latest:n[0],count:n.length}}).sort((e,t)=>t.latest.createdAt-e.latest.createdAt)}function wTe(e){let t=new Map;for(let n of e){let e=t.get(n.groupKey);e?e.push(n):t.set(n.groupKey,[n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort((e,t)=>t.createdAt-e.createdAt),r=n[0];return{key:e,label:xTe(r.source),source:r.source,notifications:n,aggregates:CTe(n),latest:r,unreadCount:n.length}}).sort((e,t)=>t.latest.createdAt-e.latest.createdAt)}function pA(){if(typeof window>`u`)return;let e=Ya(),t=e.endsWith(`/`)?e:`${e}/`;return new URL(`${t}icon.rounded.svg`,window.location.href).href}var TTe=class extends Dk{constructor(){super(`notification`)}},mA=(0,G.createContext)(null);function ETe({value:e,children:t}){return(0,K.jsx)(mA,{value:e,children:t})}var DTe={notifications:[],latestNotification:null,groups:[],unreadCount:0,highlightedId:null,browserSupported:!1,browserPermission:`unsupported`,panelOpen:!1,openPanel:()=>void 0,requestBrowserPermission:async()=>`unsupported`,previewSound:async()=>void 0,resolveAction:(e,t)=>({action:t,disabled:!0,reason:`Notifications are not available in this render tree.`,run:async()=>void 0}),markRead:async()=>void 0,markManyRead:async()=>void 0,clearGroup:async()=>void 0,clearAll:async()=>void 0,clearTerminalSession:async()=>void 0};function hA(){return typeof window<`u`&&`Notification`in window}function OTe(){return hA()?Notification.permission:`unsupported`}function kTe(e){if(!e)return`/notifications`;let t=new URLSearchParams;return t.set(`highlight`,e),`/notifications?${t.toString()}`}function ATe(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function jTe(e){return e.body.trim()||e.title}function MTe(e){let t=e[0];if(!t)return``;let n=ATe(t.createdAt);return e.length<=1?`${n} - 1 unread`:`${n} - ${e.length} unread notifications`}async function NTe(){if(Oo.getAreaForPath(`/terminal`)===`bottom`){await Bp.activateBottom(`/terminal`);return}await Bp.push(`main`,`/terminal`,null)}function PTe({children:e}){let{data:t}=hce(),{data:n}=op(),r=ko(),i=t??[],a=(0,G.useMemo)(()=>wTe(i),[i]),o=i[0]??null,[s,c]=(0,G.useState)(()=>OTe()),[l,u]=(0,G.useState)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=r.popActive&&r.popLocation.pathname===`/notifications`,h=n?.notifications?.systemNotificationsEnabled??!1,g=n?.notifications?.sound??`builtin:Blow`,_=n?.notifications?.volume??1;(0,G.useEffect)(()=>{let e=new TTe;e.init(),d.current=e},[]);let v=(0,G.useCallback)(e=>{typeof window<`u`&&window.focus(),u(e??null),Bp.activatePop(kTe(e))},[]),y=(0,G.useCallback)(async e=>{await X.notifications.markRead.mutate({id:e})},[]),b=(0,G.useCallback)(async e=>{await X.notifications.markManyRead.mutate({ids:[...e]})},[]),x=(0,G.useCallback)(async e=>{await X.notifications.clearGroup.mutate({groupKey:e})},[]),S=(0,G.useCallback)(async()=>{await X.notifications.clearAll.mutate()},[]),C=(0,G.useCallback)(async e=>{await X.notifications.clearTerminalSession.mutate({sessionId:e})},[]),w=(0,G.useCallback)(async()=>{if(!hA())return c(`unsupported`),`unsupported`;let e=await Notification.requestPermission();return c(e),e===`granted`&&await X.config.update.mutate({notifications:{systemNotificationsEnabled:!0}}),e},[]),T=(0,G.useCallback)(async(e,t)=>{await d.current?.play(e??g,t??_)},[g,_]),E=(0,G.useCallback)((e,t,n)=>{let r=n?.markReadOnRun??!0;if(t.type===`terminal.focus`){let n=uA.hasServerSession(t.target.sessionId);return{action:t,disabled:!n,reason:n?void 0:`Target terminal is no longer available.`,run:async()=>{uA.hasServerSession(t.target.sessionId)&&(await Bp.deactivatePop(),await NTe(),uA.requestActivateServerSession(t.target.sessionId)&&r&&await y(e.id))}}}return{action:t,disabled:!1,run:async()=>{let n=Oo.getAreaForPath(t.target.href);m&&await Bp.deactivatePop(),await Bp.push(n,t.target.href,null),r&&await y(e.id)}}},[y,m]);return(0,G.useEffect)(()=>{let e=o?.id??null;if(!e||f.current===e){f.current=e;return}if(f.current=e,d.current?.play(g,_).catch(()=>{}),!h||m||!hA()||Notification.permission!==`granted`)return;p.current?.close();let t=new Notification(jTe(o),{body:MTe(i),icon:pA(),tag:`openspecui-notifications`});t.onclick=()=>{v(o.id),t.close()},p.current=t},[o,i,v,m,g,h,_]),(0,G.useEffect)(()=>{m&&(p.current?.close(),p.current=null)},[m]),(0,G.useEffect)(()=>{r.popLocation.pathname===`/notifications`&&u(new URLSearchParams(r.popLocation.search).get(`highlight`))},[r.popLocation.pathname,r.popLocation.search]),(0,K.jsx)(ETe,{value:(0,G.useMemo)(()=>({notifications:i,latestNotification:o,groups:a,unreadCount:i.length,highlightedId:l,browserSupported:hA(),browserPermission:s,panelOpen:m,openPanel:v,requestBrowserPermission:w,previewSound:T,resolveAction:E,markRead:y,markManyRead:b,clearGroup:x,clearAll:S,clearTerminalSession:C}),[s,S,x,C,a,l,o,b,y,i,v,m,T,w,E]),children:e})}function gA(){return(0,G.useContext)(mA)||DTe}function _A({className:e,badgeClassName:t,iconClassName:n,size:r=`mobile`}){let{unreadCount:i,openPanel:a}=gA();return(0,K.jsx)(nb,{label:i>0?`Open notifications, ${i} unread`:`Open notifications`,icon:(0,K.jsx)(Jp,{className:bh(`h-4 w-4`,n)}),badge:i>0?(0,K.jsx)(sb,{count:i,className:bh(`ring-background absolute -right-1.5 -top-1.5 ring-2`,t),"aria-hidden":`true`}):void 0,size:r,className:e,onClick:()=>a(),"data-notification-entry-button":`true`})}function vA({children:e,maxWidth:t=300,duration:n=10,gap:r=20,className:i=``}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(null),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=()=>{if(l.current&&u.current){let e=l.current.offsetWidth,t=u.current.scrollWidth;c(t>e)}};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[e]);let d=(0,G.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch(e){console.error(`Failed to copy path:`,e)}},[e]),f=typeof t==`number`?`${t}px`:t;return(0,K.jsxs)(`button`,{onClick:d,className:`hover:bg-muted/50 group flex cursor-pointer items-center gap-1.5 rounded transition-colors ${i}`,title:`${e}\n\nClick to copy`,children:[(0,K.jsx)(`div`,{ref:l,className:`relative overflow-hidden whitespace-nowrap`,style:{maxWidth:f},children:(0,K.jsx)(`div`,{ref:u,"data-content":e,className:`relative inline-block ${s?`animate-marquee group-hover:[animation-play-state:paused]!`:``}`,style:s?{"--marquee-duration":`${n}s`,"--marquee-gap":`${r}px`}:void 0,children:e})}),(0,K.jsx)(`span`,{className:`text-muted-foreground group-hover:text-foreground shrink-0 transition-colors`,children:a?(0,K.jsx)(Yp,{className:`h-3.5 w-3.5 text-green-500`}):(0,K.jsx)(tm,{className:`h-3.5 w-3.5`})})]})}function yA({compact:e=!1}){if(qa())return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,title:`Live features disabled (no file watching, task toggling, or AI integration)`,children:[(0,K.jsx)(rle,{className:`h-3.5 w-3.5 text-blue-500`}),!e&&(0,K.jsx)(`span`,{className:`status-text text-blue-600`,children:`Static`})]});let t=ab(),n=Rme();if(t.connected){let n=t.watcherEnabled?`Watching for changes`:`File watcher disabled`;return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,children:[(0,K.jsx)(Cm,{className:`h-3.5 w-3.5 text-green-500`}),!e&&(0,K.jsx)(Xy,{content:n,children:(0,K.jsx)(`span`,{className:`status-text cursor-default text-green-600`,children:`Live`})})]})}return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,children:[(0,K.jsx)(Um,{className:`h-3.5 w-3.5 text-red-500`}),!e&&(0,K.jsx)(`span`,{className:`status-text text-red-600`,children:`Offline`}),t.reconnectCountdown!==null&&(0,K.jsxs)(`button`,{onClick:n,className:`text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1 transition-colors`,title:`Click to reconnect now`,children:[(0,K.jsxs)(`span`,{className:`text-xs`,children:[`(`,t.reconnectCountdown,`s)`]}),(0,K.jsx)(Am,{className:`h-3 w-3`})]})]})}function FTe(){let e=qa(),[t,n]=(0,G.useState)(`Unknown`),[r,i]=(0,G.useState)(null);if((0,G.useEffect)(()=>{e&&zd().then(e=>{e?.meta?.timestamp?n(new Date(e.meta.timestamp).toLocaleString()):n(`Unknown`),i(e?.git?.repositoryUrl??null)}).catch(()=>{n(`Unknown`),i(null)})},[e]),e)return(0,K.jsx)(`div`,{className:`desktop-status border-border bg-muted/30 text-muted-foreground flex h-8 items-center justify-between gap-4 border-t px-2 text-xs`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,K.jsx)(yA,{}),(0,K.jsxs)(`span`,{className:`truncate`,children:[`Generated: `,t]}),r&&(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(gle,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(vA,{children:r,maxWidth:280,duration:12,className:`text-xs`})]})]})});let a=ab();return(0,K.jsxs)(`div`,{className:`desktop-status border-border bg-muted/30 text-muted-foreground flex h-8 items-center justify-between gap-4 border-t px-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(yA,{}),a.projectDir&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(pm,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(vA,{children:a.projectDir,maxWidth:300,duration:12,className:`text-xs`})]})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsx)(_A,{})})]})}function ITe(){let[e,t]=(0,G.useState)(!1),n=Xa(),r=ab(),i=ko(),a=r.dirName??`OpenSpec`,o=Ya(),s=qa(),c=()=>t(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`mobile-header border-border bg-background flex h-12 items-center justify-between border-b px-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`button`,{onClick:()=>t(!0),className:`hover:bg-muted -ml-1.5 rounded-md p-1.5`,"aria-label":`Open menu`,children:(0,K.jsx)(vle,{className:`h-5 w-5`})}),(0,K.jsx)(`span`,{className:`font-nav text-[12px] tracking-[0.04em]`,children:a})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(nb,{label:`Open search`,icon:(0,K.jsx)(Pm,{className:`h-4 w-4`}),onClick:()=>Bp.activatePop(`/search`)}),!s&&(0,K.jsx)(_A,{}),(0,K.jsx)(yA,{compact:!0})]})]}),e&&(0,K.jsxs)(`div`,{className:`fixed inset-0 z-50 flex`,children:[(0,K.jsx)(`div`,{className:`animate-in fade-in absolute inset-0 bg-black/50 duration-200`,onClick:c}),(0,K.jsxs)(`nav`,{className:`bg-background border-border animate-in slide-in-from-left relative flex h-full w-64 max-w-[80vw] flex-col border-r p-4 duration-200`,children:[(0,K.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,K.jsx)(`img`,{src:n?`${o}openspec_pixel_dark.svg`:`${o}openspec_pixel_light.svg`,alt:`OpenSpec`,className:`h-5`}),(0,K.jsx)(`button`,{onClick:c,className:`hover:bg-muted rounded-md p-1.5`,"aria-label":`Close menu`,children:(0,K.jsx)(Wm,{className:`h-5 w-5`})})]}),s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`flex-1 space-y-1`,children:Qy.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(Lp,{to:e.to,onClick:c,className:`hover:bg-muted [&.active]:bg-primary [&.active]:text-primary-foreground flex items-center gap-2 rounded-md px-3 py-2`,children:[(0,K.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-base tracking-[0.04em]`,children:e.label})]})},e.to))}),(0,K.jsx)(`div`,{className:`border-border space-y-1 border-t pt-4`,children:(0,K.jsxs)(Lp,{to:$y.to,onClick:c,className:`hover:bg-muted [&.active]:bg-primary [&.active]:text-primary-foreground flex items-center gap-2 rounded-md px-3 py-2`,children:[(0,K.jsx)($y.icon,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-base tracking-[0.04em]`,children:$y.label})]})})]}):(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,children:[(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(tb,{area:`main`,tabs:i.mainTabs,className:`scrollbar-thin scrollbar-track-transparent h-full overflow-auto`,useLinks:!0,onNavigate:c})}),(0,K.jsx)(`div`,{className:`text-muted-foreground text-[10px] font-medium uppercase tracking-wider`,children:`Bottom`}),(0,K.jsx)(`div`,{className:`border-border border-t pt-2`,children:(0,K.jsx)(tb,{area:`bottom`,tabs:i.bottomTabs,onNavigate:c})})]})]})]})]})}function LTe(){let e=ko();return(0,K.jsx)(`nav`,{className:`mobile-tabbar border-border bg-background flex h-14 items-stretch border-t`,children:(qa()?Pme:e.mainTabs.map(e=>Zy.find(t=>t.to===e)).filter(e=>e!=null)).map(e=>(0,K.jsxs)(Lp,{to:e.to,className:`text-muted-foreground hover:text-foreground [&.active]:text-primary flex flex-1 flex-col items-center justify-center gap-0.5`,children:[(0,K.jsx)(e.icon,{className:`h-5 w-5 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-[10px] tracking-[0.03em]`,children:e.label})]},e.to))})}function bA(e,t){(0,G.useInsertionEffect)(()=>{if(typeof document>`u`)return;let n=[...document.head.querySelectorAll(`style[data-head-style]`)].find(t=>t.dataset.headStyle===e);if(n){let e=Number(n.dataset.refCount??`1`);return n.dataset.refCount=String(e+1),n.textContent!==t&&(n.textContent=t),()=>{let e=Number(n.dataset.refCount??`1`)-1;if(e<=0){n.remove();return}n.dataset.refCount=String(e)}}let r=document.createElement(`style`);return r.setAttribute(`data-head-style`,e),r.dataset.refCount=`1`,r.textContent=t,document.head.appendChild(r),()=>{let e=Number(r.dataset.refCount??`1`)-1;if(e>0){r.dataset.refCount=String(e);return}r.remove()}},[t,e])}function xA({open:e,title:t,headerActions:n,onClose:r,onDismissRequest:i,onClosed:a,children:o,footer:s,dialogClassName:c=``,contentClassName:l=``,contentShellClassName:u=``,className:d=``,bodyClassName:f=``,maxHeight:p=`86vh`,borderVariant:m=`default`}){let h=(0,G.useRef)(null),g=(0,G.useRef)(null),_=(0,G.useId)(),v=i===void 0?r:i;(0,G.useEffect)(()=>{let e=h.current;if(!e||!a)return;let t=()=>{a()};return e.addEventListener(`close`,t),()=>{e.removeEventListener(`close`,t)}},[a]),(0,G.useLayoutEffect)(()=>{let t=h.current;t&&(e&&!t.open?typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``):!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e]),(0,G.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{e.preventDefault(),v?.()},n=e=>{let t=g.current;if(!t||e.target instanceof Node&&t.contains(e.target))return;let n=t.getBoundingClientRect();e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom||v?.()};return e.addEventListener(`cancel`,t),e.addEventListener(`click`,n),()=>{e.removeEventListener(`cancel`,t),e.removeEventListener(`click`,n)}},[v]);let y=m===`error`?`border-red-500/60`:m===`success`?`border-green-500/50`:`border-border`;return bA(`dialog:openspec-dialog`,(0,G.useMemo)(()=>String.raw`
1173
+ `}};customElements.define(`virtual-trackpad-tab`,xwe);function Swe(e){return new URLSearchParams(e.search).get(`session`)?.trim()||null}function ak(e,t=window.location){let n=Swe(t);return n?`hosted-session:${n}:${e}`:e}var ok=1.5,sk=30,Cwe=50,ck=15;function lk(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function uk(e){return e instanceof HTMLElement&&e.classList.contains(`terminal-touch-mouse-overlay`)}function wwe(e,t,n){let r=document.elementFromPoint(t,n);if(r&&uk(r)){let e=r,i=e.style.pointerEvents;e.style.pointerEvents=`none`,r=document.elementFromPoint(t,n),e.style.pointerEvents=i}return r&&e.contains(r)&&!uk(r)?r:e.querySelector(`.xterm-screen`)??e}function dk(e){return e===`input`||e===`keys`||e===`shortcuts`||e===`trackpad`||e===`settings`}function Twe(e){return e===`copy`||e===`paste`||e===`select-all`}function fk(e){return typeof e==`object`&&!!e}function pk(){try{let e=localStorage.getItem(ak(`xtermInputPanelState`));if(!e)return{};let t=JSON.parse(e);return fk(t)?t:{}}catch{return{}}}function Ewe(e){try{localStorage.setItem(ak(`xtermInputPanelState`),JSON.stringify(e))}catch{}}function Dwe(e){let t=pk().sessions;if(!t)return null;let n=t[e];if(!fk(n))return null;let r={activeTab:`input`,inputDraft:``};return dk(n.activeTab)&&(r.activeTab=n.activeTab),typeof n.inputDraft==`string`&&(r.inputDraft=n.inputDraft),r}function mk(){let e=pk();return dk(e.lastActiveTab)?e.lastActiveTab:`input`}var hk=class e{static _lastActiveTab=`input`;static _active=null;static _lastFocused=null;static _instances=new Set;static _onActiveChangeFn=null;static _mountTarget=null;static get activeInstance(){return e._active}static set onActiveChange(t){e._onActiveChangeFn=t}static set mountTarget(t){e._mountTarget=t,e._fabEl&&t&&t.appendChild(e._fabEl)}static get mountTarget(){return e._mountTarget}static _fabEl=null;static _fabSubscriberCount=0;static _ensureFab(t){if(e._fabEl){e._fabEl.parentElement!==t&&t.appendChild(e._fabEl);return}let n=document.createElement(`button`);n.type=`button`,n.title=`Open InputPanel`,n.replaceChildren(zve(24)),Object.assign(n.style,{position:`fixed`,zIndex:`50`,width:`56px`,height:`56px`,borderRadius:`50%`,border:`2px solid currentColor`,display:`flex`,alignItems:`center`,justifyContent:`center`,touchAction:`none`,userSelect:`none`,webkitUserSelect:`none`,webkitTouchCallout:`none`,cursor:`pointer`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`,background:`var(--primary, #e04a2f)`,color:`var(--primary-foreground, #fff)`,padding:`0`,margin:`0`,outline:`none`});let r=window.innerWidth-72,i=window.innerHeight-140;try{let e=localStorage.getItem(`input-panel-fab-pos`);if(e){let t=JSON.parse(e);r=t.x??r,i=t.y??i}}catch{}r=Math.max(0,Math.min(window.innerWidth-56,r)),i=Math.max(0,Math.min(window.innerHeight-56,i)),n.style.left=`${r}px`,n.style.top=`${i}px`;let a=!1,o=!1,s=0,c=0,l=0,u=0,d=()=>{let t=e._lastFocused,n=(t&&e._instances.has(t)?t:null)??[...e._instances].find(e=>e._terminal!=null)??null;n&&(e._lastFocused=n,n.open())};n.addEventListener(`pointerdown`,e=>{a=!0,o=!1,s=e.clientX,c=e.clientY,l=parseInt(n.style.left)||0,u=parseInt(n.style.top)||0,n.setPointerCapture(e.pointerId),e.preventDefault()}),n.addEventListener(`pointermove`,e=>{if(!a)return;let t=e.clientX-s,r=e.clientY-c;(Math.abs(t)>4||Math.abs(r)>4)&&(o=!0);let i=Math.max(0,Math.min(window.innerWidth-56,l+t)),d=Math.max(0,Math.min(window.innerHeight-56,u+r));n.style.left=`${i}px`,n.style.top=`${d}px`}),n.addEventListener(`pointerup`,()=>{if(a){a=!1;try{localStorage.setItem(`input-panel-fab-pos`,JSON.stringify({x:parseInt(n.style.left),y:parseInt(n.style.top)}))}catch{}o||d()}}),n.addEventListener(`pointercancel`,()=>{a=!1});let f=!1;n.addEventListener(`pointerdown`,()=>{f=!0},{capture:!0}),n.addEventListener(`click`,()=>{if(f){f=!1;return}d()}),n.addEventListener(`contextmenu`,e=>{e.preventDefault(),e.stopPropagation()}),n.addEventListener(`dragstart`,e=>{e.preventDefault()}),window.addEventListener(`resize`,()=>{let e=Math.min(parseInt(n.style.left)||0,window.innerWidth-56),t=Math.min(parseInt(n.style.top)||0,window.innerHeight-56);n.style.left=`${Math.max(0,e)}px`,n.style.top=`${Math.max(0,t)}px`}),t.appendChild(n),e._fabEl=n}static _setFabVisible(t){e._fabEl&&(e._fabEl.style.display=t&&e._fabSubscriberCount>0?`flex`:`none`)}_terminal=null;_panel=null;_cursorEl=null;_cursorPos={x:0,y:0};_isDragging=!1;_isOpen=!1;_edgeScrollTimer=null;_cleanups=[];_persistentCleanups=[];_listenersAttached=!1;_onInput;_onCommand;_onOpenCb;_onCloseCb;_getHistory;_addHistory;_subscribeHistory;_onSettingsChange;_platform;_defaultLayout;_showFab;_fabSubscribed;_panelSessionState;_stateKey;_hasOwnPersistedState;constructor(t){this._onInput=t?.onInput??(()=>{}),this._onCommand=t?.onCommand??null,this._onOpenCb=t?.onOpen??null,this._onCloseCb=t?.onClose??null,this._getHistory=t?.getHistory??null,this._addHistory=t?.addHistory??null,this._subscribeHistory=t?.subscribeHistory??null,this._onSettingsChange=t?.onSettingsChange??null,this._platform=t?.platform??`common`,this._defaultLayout=t?.defaultLayout??`floating`,this._showFab=t?.showFab??!0,this._fabSubscribed=!1,this._stateKey=t?.stateKey?.trim()?t.stateKey:`default`,this._hasOwnPersistedState=!1,this._panelSessionState={activeTab:`input`,inputDraft:``};let n=Dwe(this._stateKey);n?(this._panelSessionState=n,this._hasOwnPersistedState=!0):this._panelSessionState.activeTab=e._lastActiveTab||mk()}get isOpen(){return this._isOpen}set onOpen(e){this._onOpenCb=e}set onClose(e){this._onCloseCb=e}set onInput(e){this._onInput=e}set onCommand(e){this._onCommand=e}setPlatform(e){this._platform=e,this._applyPlatformToPanel()}setDefaultLayout(e){this._defaultLayout=e}_persistPanelState(){e._lastActiveTab=this._panelSessionState.activeTab;let t=pk(),n={...t.sessions,[this._stateKey]:{activeTab:this._panelSessionState.activeTab,inputDraft:this._panelSessionState.inputDraft}};Ewe({...t,lastActiveTab:this._panelSessionState.activeTab,sessions:n})}_getMountTarget(){return e._mountTarget??this._getTerminalHostElement()??document.body}_getTerminalHostElement(){let e=this._terminal?.element;return e instanceof HTMLElement?e.classList.contains(`xterm`)&&e.parentElement instanceof HTMLElement?e.parentElement:e:null}_detectTerminalEngine(){let e=this._terminal?.element;return e instanceof HTMLElement&&e.classList.contains(`xterm`)?`xterm`:`non-xterm`}activate(t){this._terminal=t,e._instances.add(this)}dispose(){this.close();for(let e of this._persistentCleanups)e();this._persistentCleanups=[],this._listenersAttached=!1,this._fabSubscribed&&(e._fabSubscriberCount=Math.max(0,e._fabSubscriberCount-1),this._fabSubscribed=!1,e._setFabVisible(e._active===null)),e._instances.delete(this),e._lastFocused===this&&(e._lastFocused=null),this._terminal=null}attachListeners(){if(this._listenersAttached||!this._terminal)return;let t=this._terminal.textarea;if(!t)return;this._listenersAttached=!0,this._showFab?(e._ensureFab(this._getMountTarget()),this._fabSubscribed||=(e._fabSubscriberCount+=1,!0),e._setFabVisible(!0)):e._fabSubscriberCount===0&&e._setFabVisible(!1),e._lastFocused||=this;let n=()=>{e._lastFocused=this,lk()&&!this._isOpen&&this.open()};t.addEventListener(`focus`,n),this._persistentCleanups.push(()=>t.removeEventListener(`focus`,n)),lk()&&t.setAttribute(`inputmode`,`none`)}open(){if(!this._terminal)return;if(this._isOpen){if(this._panel?.isConnected)return;this.close()}if(e._active&&e._active!==this&&e._active.close(),this._isOpen=!0,e._active=this,e._lastFocused=this,this._showFab&&e._setFabVisible(!1),this._suppressKeyboard(),!this._hasOwnPersistedState){let t=mk();this._panelSessionState.activeTab=t,e._lastActiveTab=t}let t=document.createElement(`input-panel`);t.setAttribute(`layout`,this._defaultLayout),this._applyPanelThemeBindings(t),t.activeTab=this._panelSessionState.activeTab;let n=document.createElement(`input-method-tab`);n.setAttribute(`slot`,`input`),n.value=this._panelSessionState.inputDraft,t.appendChild(n);let r=document.createElement(`virtual-keyboard-tab`);r.setAttribute(`slot`,`keys`),r.setAttribute(`floating`,``),r.setAttribute(`platform`,this._platform),t.appendChild(r);let i=document.createElement(`shortcut-tab`);i.setAttribute(`slot`,`shortcuts`),i.setAttribute(`platform`,this._platform),t.appendChild(i);let a=document.createElement(`virtual-trackpad-tab`);a.setAttribute(`slot`,`trackpad`),a.setAttribute(`floating`,``),t.appendChild(a),this._panel=t;let o=e=>{this._renderHistory(n,e)};if(this._getHistory&&this._getHistory().then(e=>o(e)).catch(()=>{}),this._subscribeHistory)try{let e=this._subscribeHistory(e=>{o(e)});this._cleanups.push(e)}catch{}this._on(t,`input-panel:close`,()=>this.close()),this._on(t,`input-panel:send`,e=>{let t=e.detail?.data;if(t&&this._onInput(t),e.composedPath()[0]===n&&this._addHistory&&t){let e=this._normalizeHistoryText(t);e&&Promise.resolve(this._addHistory(e)).then(()=>this._getHistory?.()).then(e=>{e&&o(e)}).catch(()=>{})}}),this._on(t,`input-panel:command`,e=>{let t=e.detail;if(!fk(t))return;let n=t.command;if(!Twe(n))return;let r=typeof t.fallbackData==`string`?t.fallbackData:void 0;Promise.resolve(this._onCommand?.(n,{fallbackData:r})??!1).then(e=>{!e&&r&&this._onInput(r)}).catch(()=>{r&&this._onInput(r)})}),this._on(n,`input-panel:input-change`,e=>{let t=e.detail?.value;typeof t==`string`&&(this._panelSessionState.inputDraft=t,this._hasOwnPersistedState=!0,this._persistPanelState())}),this._on(t,`input-panel:tab-change`,e=>{let t=e.detail?.tab;dk(t)&&(this._panelSessionState.activeTab=t,this._hasOwnPersistedState=!0,this._persistPanelState()),t===`trackpad`?this._showCursor():this._hideCursor()}),this._on(t,`input-panel:settings-change`,e=>{if(!this._onSettingsChange)return;let t=e.detail;if(typeof t!=`object`||!t)return;let n=t;typeof n.fixedHeight!=`number`||typeof n.floatingWidth!=`number`||typeof n.floatingHeight!=`number`||typeof n.vibrationIntensity!=`number`||typeof n.historyLimit!=`number`||this._onSettingsChange({fixedHeight:n.fixedHeight,floatingWidth:n.floatingWidth,floatingHeight:n.floatingHeight,vibrationIntensity:n.vibrationIntensity,historyLimit:n.historyLimit})}),this._on(t,`trackpad:move`,e=>{let{dx:t,dy:n}=e.detail;this._moveCursor(t,n)}),this._on(t,`trackpad:tap`,()=>this._dispatchClick(1)),this._on(t,`trackpad:double-tap`,()=>this._dispatchDblClick()),this._on(t,`trackpad:long-press`,()=>this._dispatchRightClick()),this._on(t,`trackpad:two-finger-tap`,()=>this._dispatchRightClick()),this._on(t,`trackpad:drag-start`,()=>{this._isDragging=!0,this._dispatchMouse(`mousedown`,{detail:1})}),this._on(t,`trackpad:drag-move`,e=>{let{dx:t,dy:n}=e.detail;this._moveCursor(t,n),this._dispatchMouse(`mousemove`,{buttons:1}),this._updateEdgeScroll()}),this._on(t,`trackpad:drag-end`,()=>{this._isDragging=!1,this._stopEdgeScroll(),this._dispatchMouse(`mouseup`,{detail:1})}),this._on(t,`trackpad:scroll`,e=>{let{deltaY:t}=e.detail;this._dispatchWheel(t)}),this._getMountTarget().appendChild(t),this._createCursor(),this._focusTerminal(),this._onOpenCb?.(),e._onActiveChangeFn?.(this)}_applyPlatformToPanel(){if(!this._panel)return;let e=this._panel.querySelector(`virtual-keyboard-tab`),t=this._panel.querySelector(`shortcut-tab`);e?.setAttribute(`platform`,this._platform),t?.setAttribute(`platform`,this._platform)}_readThemeVar(e,t,n){for(let n of t){let t=e.getPropertyValue(n).trim();if(t)return t}return n}_applyPanelThemeBindings(e){let t=this._getTerminalHostElement()??this._getMountTarget(),n=getComputedStyle(t),r=this._readThemeVar(n,[`--input-panel-background`,`--terminal`,`--background`],`#1a1a1a`),i=this._readThemeVar(n,[`--input-panel-foreground`,`--terminal-foreground`,`--foreground`],`#ffffff`),a=this._readThemeVar(n,[`--input-panel-primary`,`--primary`],`#e04a2f`),o=this._readThemeVar(n,[`--input-panel-primary-foreground`,`--primary-foreground`],`#ffffff`),s=this._readThemeVar(n,[`--input-panel-border`,`--border`],`color-mix(in srgb, ${i} 24%, transparent)`),c=this._readThemeVar(n,[`--input-panel-muted`,`--muted`],`color-mix(in srgb, ${r} 86%, ${i} 14%)`),l=this._readThemeVar(n,[`--input-panel-muted-foreground`,`--muted-foreground`],`color-mix(in srgb, ${i} 62%, transparent)`);e.style.setProperty(`--input-panel-background`,r),e.style.setProperty(`--input-panel-foreground`,i),e.style.setProperty(`--input-panel-primary`,a),e.style.setProperty(`--input-panel-primary-foreground`,o),e.style.setProperty(`--input-panel-border`,s),e.style.setProperty(`--input-panel-muted`,c),e.style.setProperty(`--input-panel-muted-foreground`,l)}close(){if(this._isOpen){this._isOpen=!1,e._active===this&&(e._active=null),this._stopEdgeScroll();for(let e of this._cleanups)e();this._cleanups=[],this._panel?.remove(),this._panel=null,this._cursorEl?.remove(),this._cursorEl=null,lk()||this._restoreKeyboard(),this._showFab&&e._setFabVisible(!0),this._onCloseCb?.(),e._onActiveChangeFn?.(null)}}toggle(){if(this._isOpen){this.close();return}this.open()}syncFocusLifecycle(){if(e._lastFocused=this,this._isOpen&&!this._panel?.isConnected){this.open();return}if(e._active&&e._active!==this){this.open();return}this._isOpen&&this._focusTerminal()}_focusTerminal(){let e=this._terminal?.textarea;e&&(lk()&&e.setAttribute(`inputmode`,`none`),e.focus())}_createCursor(){let e=this._getTerminalHostElement();if(!e)return;let t=document.createElement(`div`);t.setAttribute(`data-input-panel-cursor`,`virtual-mouse`),t.setAttribute(`data-terminal-engine`,this._detectTerminalEngine()),t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:absolute;z-index:10;pointer-events:none;opacity:0;transition:opacity 0.15s;color:#fff;`;let n=Vve(20);n.style.filter=`drop-shadow(0 0 1px rgba(0,0,0,0.9))`,t.replaceChildren(n),e.appendChild(t),this._cursorEl=t;let r=e.getBoundingClientRect();this._cursorPos={x:r.width/2,y:r.height/2},this._positionCursor()}_positionCursor(){this._cursorEl&&(this._cursorEl.style.left=`${this._cursorPos.x-4}px`,this._cursorEl.style.top=`${this._cursorPos.y-2}px`)}_showCursor(){if(this._cursorEl||this._createCursor(),this._cursorEl){let e=this._getTerminalHostElement();if(e){let t=e.getBoundingClientRect();this._cursorPos={x:t.width/2,y:t.height/2},this._positionCursor()}this._cursorEl.style.opacity=`1`}}_hideCursor(){this._cursorEl&&(this._cursorEl.style.opacity=`0.3`)}_moveCursor(e,t){let n=this._getTerminalHostElement();if(!n)return;let r=n.getBoundingClientRect();this._cursorPos.x=Math.max(0,Math.min(r.width,this._cursorPos.x+e*ok)),this._cursorPos.y=Math.max(0,Math.min(r.height,this._cursorPos.y+t*ok)),this._positionCursor()}_getClientCoords(){let e=this._getTerminalHostElement();if(!e)return null;let t=e.getBoundingClientRect();return{clientX:t.left+this._cursorPos.x,clientY:t.top+this._cursorPos.y}}_resolveTarget(e,t){let n=this._getTerminalHostElement();return n?wwe(n,e,t):document.body}_dispatchMouse(e,t={}){let n=this._getClientCoords();if(!n)return;let r=t.button??0,i=t.detail??1,a=t.buttons??(e===`mousedown`?r===0?1:r===2?2:4:0);this._resolveTarget(n.clientX,n.clientY).dispatchEvent(new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,detail:i,clientX:n.clientX,clientY:n.clientY,button:r,buttons:a}))}_dispatchClick(e){this._dispatchMouse(`mousedown`,{detail:e}),this._dispatchMouse(`mouseup`,{detail:e}),this._dispatchMouse(`click`,{detail:e})}_dispatchDblClick(){this._dispatchMouse(`mousedown`,{detail:2}),this._dispatchMouse(`mouseup`,{detail:2}),this._dispatchMouse(`click`,{detail:2}),this._dispatchMouse(`dblclick`,{detail:2})}_dispatchRightClick(){this._dispatchMouse(`mousedown`,{button:2}),this._dispatchMouse(`mouseup`,{button:2}),this._dispatchMouse(`contextmenu`,{button:2})}_dispatchWheel(e){let t=this._getClientCoords();t&&this._resolveTarget(t.clientX,t.clientY).dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY,deltaY:e,deltaMode:WheelEvent.DOM_DELTA_PIXEL}))}_updateEdgeScroll(){let e=this._getTerminalHostElement();if(!e||!this._isDragging){this._stopEdgeScroll();return}let t=e.getBoundingClientRect(),n=this._cursorPos.y<sk,r=this._cursorPos.y>t.height-sk;if(!n&&!r){this._stopEdgeScroll();return}this._stopEdgeScroll(),this._edgeScrollTimer=setInterval(()=>{let e=this._getTerminalHostElement();if(!e||!this._isDragging){this._stopEdgeScroll();return}let t=e.getBoundingClientRect(),n=t.left+this._cursorPos.x,r=this._cursorPos.y<sk?t.top-ck:t.bottom+ck;this._resolveTarget(t.left+this._cursorPos.x,t.top+this._cursorPos.y).dispatchEvent(new MouseEvent(`mousemove`,{bubbles:!0,cancelable:!0,view:window,clientX:n,clientY:r,button:0,buttons:1}))},Cwe)}_stopEdgeScroll(){this._edgeScrollTimer&&=(clearInterval(this._edgeScrollTimer),null)}_suppressKeyboard(){if(!lk())return;let e=this._terminal?.textarea;e&&e.setAttribute(`inputmode`,`none`)}_restoreKeyboard(){let e=this._terminal?.textarea;e&&e.removeAttribute(`inputmode`)}_on(e,t,n){e.addEventListener(t,n),this._cleanups.push(()=>e.removeEventListener(t,n))}_normalizeHistoryText(e){return e.replace(/[\r\n]+$/u,``).trim()||null}_renderHistory(e,t){if(e.querySelectorAll(`[data-input-history-root="true"]`).forEach(e=>e.remove()),t.length===0)return;let n=document.createElement(`div`);n.dataset.inputHistoryRoot=`true`,n.setAttribute(`slot`,`history`),n.style.display=`flex`,n.style.flexDirection=`column`,n.style.gap=`4px`,n.style.padding=`4px 0`;for(let e of t){let t=document.createElement(`button`);t.type=`button`,t.title=e.text,t.style.display=`flex`,t.style.alignItems=`center`,t.style.gap=`8px`,t.style.width=`100%`,t.style.padding=`4px 6px`,t.style.border=`1px solid transparent`,t.style.borderRadius=`4px`,t.style.background=`transparent`,t.style.color=`var(--foreground, #fff)`,t.style.fontFamily=`inherit`,t.style.fontSize=`12px`,t.style.textAlign=`left`;let r=document.createElement(`span`);r.textContent=new Date(e.time).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),r.style.opacity=`0.65`,r.style.fontSize=`10px`,r.style.flexShrink=`0`;let i=document.createElement(`span`);i.textContent=e.text,i.style.overflow=`hidden`,i.style.textOverflow=`ellipsis`,i.style.whiteSpace=`nowrap`,t.appendChild(r),t.appendChild(i),t.addEventListener(`click`,()=>{this._onInput(`${e.text}\n`)}),n.appendChild(t)}e.appendChild(n)}};function gk(e){let t=/^zh\b/i.test(e);return{apiHost:t?`https://fonts.googleapis.cn`:`https://fonts.googleapis.com`,staticHost:t?`https://fonts.gstatic.cn`:`https://fonts.gstatic.com`}}function Owe(e){return e.trim().replace(/ /g,`+`)}function kwe(e){let t=e.families.map(Owe).filter(Boolean),{apiHost:n}=gk(e.lang??``),r=t.map(e=>`family=${e}`),i=`display=${e.display??`swap`}`;return`${n}/css2?${[...r,i].join(`&`)}`}function Awe(e){let t=e.documentRef??(typeof document>`u`?null:document);if(!t||e.families.length===0)return null;let n=e.lang??(typeof navigator>`u`?``:navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||``),r=gk(n),i=kwe({...e,lang:n});if(t.head.querySelector(`link[href="${i}"]`))return null;let a=t.createElement(`link`);a.rel=`preconnect`,a.href=r.apiHost,a.dataset.openspecGoogleFonts=`preconnect-api`;let o=t.createElement(`link`);o.rel=`preconnect`,o.href=r.staticHost,o.crossOrigin=`anonymous`,o.dataset.openspecGoogleFonts=`preconnect-static`;let s=t.createElement(`link`);return s.rel=`stylesheet`,s.href=i,s.dataset.openspecGoogleFonts=`stylesheet`,t.head.append(a,o,s),s}var _k=null,vk=null,yk=null,bk=null,xk=!1,Sk=!1;function Ck(){return typeof window>`u`?null:window.AudioContext??window.webkitAudioContext??null}function wk(){return xk?!0:typeof navigator>`u`?!1:navigator.userActivation?.hasBeenActive===!0||navigator.userActivation?.isActive===!0}function jwe(){typeof window>`u`||!Sk||(window.removeEventListener(`pointerdown`,Tk,!0),window.removeEventListener(`keydown`,Tk,!0),Sk=!1)}function Tk(){xk=!0,jwe(),bk?.(),bk=null,yk=null}function Ek(){typeof window>`u`||Sk||wk()||(window.addEventListener(`pointerdown`,Tk,{capture:!0,once:!0,passive:!0}),window.addEventListener(`keydown`,Tk,{capture:!0,once:!0}),Sk=!0)}function Mwe(){Ek()}function Nwe(){return typeof window>`u`||wk()?Promise.resolve():yk||(yk=new Promise(e=>{bk=e,Ek()}),yk)}async function Pwe(){return _k||vk||(Ck()?(vk=Nwe().then(async()=>{let e=Ck();if(!e)return null;let t=_k??new e;return _k=t,t.state===`suspended`&&await t.resume(),t}).finally(()=>{vk=null}),vk):null)}var Dk=class{fallbackSound;unlocked=!1;unlockPromise=null;silentAudio=null;activeAudios=new Set;constructor(e){this.fallbackSound=e===`bell`?ld:ud}init(){Mwe()}async unlock(){if(!this.unlocked)return this.unlockPromise||=this.unlockAudioContext().finally(()=>{this.unlockPromise=null}),this.unlockPromise}async play(e,t=1){e!==`silent`&&(await this.unlock().catch(()=>{}),await this.playAudio(e,t))}async unlockAudioContext(){if(!await Pwe()){this.unlocked=!0;return}this.silentAudio??=new Audio(`data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=`),this.silentAudio.volume=0,await this.silentAudio.play().catch(()=>{}),this.unlocked=!0}async playAudio(e,t){let n=this.getSoundUrl(e)??this.getSoundUrl(this.fallbackSound);n&&await this.createManagedAudio(n,t).play().catch(async r=>{if(e!==this.fallbackSound){if(await this.isMissingSound(n)){let e=this.getSoundUrl(this.fallbackSound);e&&await this.createManagedAudio(e,t).play().catch(()=>{});return}throw r}})}getSoundUrl(e){let t=Dae(e);if(t)return t;let n=_d(e);if(!n)return null;let r=$a(),i=`/api/sounds/custom/${n}`;return r?`${r}${i}`:i}async isMissingSound(e){try{return(await fetch(e,{method:`HEAD`})).status===404}catch{return!1}}createManagedAudio(e,t){let n=new Audio(e);n.volume=Fwe(t),this.activeAudios.add(n);let r=()=>{n.removeEventListener(`ended`,r),n.removeEventListener(`error`,r),this.activeAudios.delete(n)};return n.addEventListener(`ended`,r,{once:!0}),n.addEventListener(`error`,r,{once:!0}),n}};function Fwe(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}var Ok=class extends Dk{constructor(){super(`bell`)}},kk=`xtermInputPanelSettings`,Iwe=50,Lwe=1e3,Rwe=1,zwe=1,Ak=`terminal-meta`;function jk(){return Ga(`terminal-input-history`,window.location)}function Bwe(){return Ga(`openspecui-terminal`,window.location)}function Mk(){return Ga(`input-history`,window.location)}function Nk(){return Ga(`terminal-input-history-fallback`,window.location)}function Pk(e){return Math.max(Rwe,Math.min(Lwe,Math.round(e)))}function Fk(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(typeof e.text!=`string`||typeof e.time!=`number`||!Number.isFinite(e.time))continue;let r=e.text.trim();r&&t.push({text:r,time:e.time})}return t}function Ik(e,t){let n=new Map;for(let t of e){let e=`${t.time}::${t.text}`;n.has(e)||n.set(e,t)}return[...n.values()].sort((e,t)=>t.time-e.time).slice(0,Pk(t))}function Lk(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.text!==t[n]?.text||e[n]?.time!==t[n]?.time)return!1;return!0}function Rk(){try{let e=localStorage.getItem(kk);if(!e)return{};let t=JSON.parse(e);return typeof t!=`object`||!t?{}:t}catch{return{}}}function Vwe(e){let t=Rk();try{localStorage.setItem(kk,JSON.stringify({...t,...e}))}catch{}}async function zk(){return typeof window>`u`||!(`indexedDB`in window)?null:await new Promise(e=>{let t=window.indexedDB.open(Bwe(),zwe);t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(Ak)||e.createObjectStore(Ak)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)})}async function Hwe(){let e=await zk();return e?await new Promise(t=>{let n=e.transaction(Ak,`readonly`),r=n.objectStore(Ak).get(Mk());r.onsuccess=()=>{t(Fk(r.result))},r.onerror=()=>t([]),n.oncomplete=()=>e.close(),n.onerror=()=>e.close(),n.onabort=()=>e.close()}):null}async function Uwe(e){let t=await zk();return t?await new Promise(n=>{let r=t.transaction(Ak,`readwrite`);r.objectStore(Ak).put(e,Mk()),r.oncomplete=()=>{t.close(),n(!0)},r.onerror=()=>{t.close(),n(!1)},r.onabort=()=>{t.close(),n(!1)}}):!1}function Wwe(){try{let e=localStorage.getItem(Nk());return e?Fk(JSON.parse(e)):[]}catch{return[]}}function Gwe(e){try{localStorage.setItem(Nk(),JSON.stringify(e))}catch{}}async function Kwe(){return await Hwe()||Wwe()}async function Bk(e){await Uwe(e)||Gwe(e)}var qwe=class{records=[];listeners=new Set;kvUnsubscribe=null;initPromise=null;subscribe(e){return this.listeners.add(e),this.ensureInitialized(),e(this.records),()=>{this.listeners.delete(e)}}async list(){return await this.ensureInitialized(),[...this.records]}getLimit(){let e=Rk().historyLimit;return typeof e==`number`&&Number.isFinite(e)?Pk(e):Iwe}async setLimit(e){let t=Pk(e);Vwe({historyLimit:t}),await this.ensureInitialized();let n=Ik(this.records,t);await this.commit(n,{persistRemote:!0})}async add(e){let t=e.trim();if(!t)return;await this.ensureInitialized();let n=Ik([{text:t,time:Date.now()},...this.records],this.getLimit());await this.commit(n,{persistRemote:!0})}destroy(){this.kvUnsubscribe&&=(this.kvUnsubscribe(),null)}async ensureInitialized(){if(this.initPromise){await this.initPromise;return}this.initPromise=this.initialize(),await this.initPromise}async initialize(){if(this.records=Ik(await Kwe(),this.getLimit()),this.emit(),!qa())try{let e=Fk(await X.kv.get.query({key:jk()})),t=Ik([...this.records,...e],this.getLimit());Lk(this.records,t)||(this.records=t,await Bk(this.records),this.emit()),Lk(e,this.records)||this.persistRemote(this.records);let n=X.kv.subscribe.subscribe({key:jk()},{onData:e=>{this.onRemoteData(e)}});this.kvUnsubscribe=()=>n.unsubscribe()}catch{}}async onRemoteData(e){let t=Fk(e),n=Ik([...this.records,...t],this.getLimit());await this.commit(n,{persistRemote:!1})}async commit(e,t){Lk(this.records,e)||(this.records=e,await Bk(this.records),this.emit(),t.persistRemote&&!qa()&&this.persistRemote(this.records))}async persistRemote(e){try{await X.kv.set.mutate({key:jk(),value:e})}catch{}}emit(){for(let e of this.listeners)e(this.records)}};function Vk(e){return e.type===`keydown`}function Hk(e,t){return e.key.toLowerCase()===t}function Uk(e){return e.metaKey||e.ctrlKey}function Wk(e){return Uk(e)&&!e.altKey}function Gk(e){return e.clipboard?e.clipboard:typeof navigator>`u`?null:navigator.clipboard??null}function Kk(e,t){e.catch(e=>{t.onAsyncError?.(e)})}async function Jwe(e,t){let n=Gk(e);n?.writeText&&await n.writeText(t)}async function Ywe(e){let t=Gk(e);if(!t?.readText)return;let n=await t.readText();if(n){try{if(e.terminal.paste?.(n),e.terminal.paste)return}catch{}e.writeInput(n)}}var Xwe=[{id:`terminal.copy-selection`,handle:(e,t)=>!Vk(e)||!Wk(e)||!Hk(e,`c`)?null:t.terminal.hasSelection?.()?qk(t):`allow`},{id:`terminal.paste-clipboard`,handle:(e,t)=>!Vk(e)||!Wk(e)||!Hk(e,`v`)?null:Jk(t)},{id:`terminal.select-all`,handle:(e,t)=>!Vk(e)||!e.metaKey||e.ctrlKey||e.altKey||!Hk(e,`a`)?null:Yk(t)},{id:`terminal.zoom-in`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`=`&&e.key!==`+`?null:(t.zoomFont(1),`block`)},{id:`terminal.zoom-out`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`-`?null:(t.zoomFont(-1),`block`)},{id:`terminal.zoom-reset`,handle:(e,t)=>!Vk(e)||!Uk(e)||e.key!==`0`?null:(t.resetFontSize(),`block`)}];function qk(e){if(!e.terminal.hasSelection?.())return`allow`;let t=e.terminal.getSelection?.()??``;return t?(Kk(Jwe(e,t),e),`block`):`allow`}function Jk(e){return Gk(e)?.readText?(Kk(Ywe(e),e),`block`):`allow`}function Yk(e){return e.terminal.selectAll?(e.terminal.selectAll(),`block`):`allow`}var Zwe=[{id:`terminal.command.copy-selection`,command:`copy`,run:qk},{id:`terminal.command.paste-clipboard`,command:`paste`,run:Jk},{id:`terminal.command.select-all`,command:`select-all`,run:Yk}],Qwe=class{constructor(e=Xwe,t=Zwe){this.bindings=e,this.commandBindings=t}handleKeyEvent(e,t){for(let n of this.bindings){let r=n.handle(e,t);if(r)return r}return`allow`}runCommand(e,t){return this.commandBindings.find(t=>t.command===e)?.run(t)??`allow`}},Xk=[`app`,`light`,`dark`,`system`],$we=[`default-light`,`default-dark`,`monokai`,`nord`,`solarized-light`,`solarized-dark`],eTe=[{value:`default-light`,label:`Default Light`},{value:`default-dark`,label:`Default Dark`},{value:`monokai`,label:`Monokai`},{value:`nord`,label:`Nord`},{value:`solarized-light`,label:`Solarized Light`},{value:`solarized-dark`,label:`Solarized Dark`}],tTe={"default-light":{id:`default-light`,label:`Default Light`,modeHint:`light`,palette:{background:`#f6f5f2`,foreground:`#1b1b1b`,cursor:`#ea580c`,cursorAccent:`#f6f5f2`,selectionBackground:`rgba(234, 88, 12, 0.22)`,black:`#111111`,red:`#b91c1c`,green:`#15803d`,yellow:`#a16207`,blue:`#1d4ed8`,magenta:`#a21caf`,cyan:`#0f766e`,white:`#f6f5f2`,brightBlack:`#4b5563`,brightRed:`#dc2626`,brightGreen:`#16a34a`,brightYellow:`#ca8a04`,brightBlue:`#2563eb`,brightMagenta:`#c026d3`,brightCyan:`#0891b2`,brightWhite:`#ffffff`}},"default-dark":{id:`default-dark`,label:`Default Dark`,modeHint:`dark`,palette:{background:`#141414`,foreground:`#e5dfd2`,cursor:`#f97316`,cursorAccent:`#141414`,selectionBackground:`rgba(249, 115, 22, 0.28)`,black:`#151515`,red:`#f87171`,green:`#4ade80`,yellow:`#facc15`,blue:`#60a5fa`,magenta:`#e879f9`,cyan:`#67e8f9`,white:`#f4f1ea`,brightBlack:`#6b7280`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#f0abfc`,brightCyan:`#a5f3fc`,brightWhite:`#fffdf8`}},monokai:{id:`monokai`,label:`Monokai`,modeHint:`either`,palette:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`rgba(73, 72, 62, 0.9)`,black:`#272822`,red:`#f92672`,green:`#a6e22e`,yellow:`#f4bf75`,blue:`#66d9ef`,magenta:`#ae81ff`,cyan:`#a1efe4`,white:`#f8f8f2`,brightBlack:`#75715e`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#f4bf75`,brightBlue:`#66d9ef`,brightMagenta:`#ae81ff`,brightCyan:`#a1efe4`,brightWhite:`#f9f8f5`}},nord:{id:`nord`,label:`Nord`,modeHint:`either`,palette:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#88c0d0`,cursorAccent:`#2e3440`,selectionBackground:`rgba(94, 129, 172, 0.38)`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#d08770`,brightGreen:`#8fbcbb`,brightYellow:`#eceff4`,brightBlue:`#5e81ac`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},"solarized-light":{id:`solarized-light`,label:`Solarized Light`,modeHint:`light`,palette:{background:`#fdf6e3`,foreground:`#586e75`,cursor:`#cb4b16`,cursorAccent:`#fdf6e3`,selectionBackground:`rgba(147, 161, 161, 0.32)`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#657b83`,brightRed:`#cb4b16`,brightGreen:`#93a1a1`,brightYellow:`#839496`,brightBlue:`#6c71c4`,brightMagenta:`#d33682`,brightCyan:`#2aa198`,brightWhite:`#fdf6e3`}},"solarized-dark":{id:`solarized-dark`,label:`Solarized Dark`,modeHint:`dark`,palette:{background:`#002b36`,foreground:`#93a1a1`,cursor:`#cb4b16`,cursorAccent:`#002b36`,selectionBackground:`rgba(88, 110, 117, 0.5)`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#657b83`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}}};function nTe(e){return Xk.includes(e)}function Zk(e){return $we.includes(e)}function rTe(e){let t=e.useTheme??`app`;return t===`light`?`light`:t===`dark`?`dark`:t===`system`?e.systemDarkMode?`dark`:`light`:e.appDarkMode?`dark`:`light`}function Qk(e){let t=rTe(e),n=t===`dark`?e.darkTheme??`default-dark`:e.lightTheme??`default-light`;return{id:n,mode:t,definition:tTe[n]}}var $k=[`xterm`,`ghostty`];function eA(e){return $k.includes(e)}var tA=`"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,nA={fontSize:13,fontFamily:``,cursorBlink:!0,cursorStyle:`block`,scrollback:1e3,useTheme:`app`,lightTheme:`default-light`,darkTheme:`default-dark`,rendererEngine:`xterm`,bellSound:ld,bellVolume:1},rA=1500,iA=1e3,iTe=1e4,aA=`common`,aTe=512*1024,oTe=8,sTe=32,oA=13,cTe=800,lTe={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`},uTe={ArrowLeft:`\x1Bb`,ArrowRight:`\x1Bf`,ArrowUp:`\x1B[1;3A`,ArrowDown:`\x1B[1;3B`},dTe={ArrowLeft:``,ArrowUp:``,ArrowRight:``,ArrowDown:``},sA=[`JetBrains Mono`,`Fira Code`,`Source Code Pro`,`IBM Plex Mono`,`Inconsolata`,`Roboto Mono`,`Ubuntu Mono`,`Space Mono`],fTe={"JetBrains Mono":`"JetBrains Mono Variable"`,"Share Tech Mono":`"Share Tech Mono"`},cA=new Set;function lA(e){try{return(new URL(e).pathname.split(`/`).pop()??``).replace(/\.[^.]+$/,``).replace(/[-_]/g,` `)||`CustomFont`}catch{return`CustomFont`}}async function pTe(e){let t=e.trim();if(!t)return``;if(!/^https?:\/\//i.test(t))return t;if(cA.has(t))return lA(t);try{let e=(await fetch(t,{method:`HEAD`})).headers.get(`content-type`)??``;if(e.includes(`text/css`)){let e=document.createElement(`link`);return e.rel=`stylesheet`,e.href=t,e.dataset.fontSrc=t,document.head.appendChild(e),cA.add(t),``}if(e.startsWith(`font/`)){let e=lA(t),n=document.createElement(`style`);return n.dataset.fontSrc=t,n.textContent=`@font-face { font-family: '${e}'; src: url('${t}'); }`,document.head.appendChild(n),cA.add(t),e}}catch{}return t}function mTe(e){let t=`google:${e}`;if(cA.has(t))return;let n=Awe({families:[e]});n&&(n.dataset.fontSrc=t),cA.add(t)}var hTe=class{instances=new Map;listeners=new Set;activationListeners=new Set;idCounter=0;config={...nA};snapshotCache=null;inputHistoryStore=new qwe;bellSoundEngine=new Ok;keybindings=new Qwe;ghosttyModule=null;ghosttyInitPromise=null;appDarkMode=!1;systemDarkMode=!1;resolvedTheme=Qk({useTheme:nA.useTheme,lightTheme:nA.lightTheme,darkTheme:nA.darkTheme,appDarkMode:!1,systemDarkMode:!1});ws=null;wsConnected=!1;reconnectTimer=null;reconnectDelay=iA;pendingCreates=[];pendingCloseSessionIds=new Set;serverToLocalSessionId=new Map;hasDiscoveredSessions=!1;inputPanelDefaultLayout=`floating`;activeSessionId=null;constructor(){this.bellSoundEngine.init()}createSession(e){let t=`term-${++this.idCounter}`,n=e?.label??`Shell ${this.idCounter}`,r=this.createTerminalInstance(t,{label:n,command:e?.command,args:e?.args,isDedicated:e?.isDedicated??!1,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl,initialInput:e?.initialInput,customTitle:e?.customTitle??null,restored:!1,serverSessionId:null,platform:aA});return this.instances.set(t,r),this._applyFonts(),this.bindTerminalInput(r),this.wsConnected&&this.ws?this.wsSend({type:`create`,requestId:t,cols:r.terminal.cols||80,rows:r.terminal.rows||24,command:e?.command,args:e?.args,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl}):(this.pendingCreates.push({requestId:t,command:e?.command,args:e?.args,closeTip:e?.closeTip,closeCallbackUrl:e?.closeCallbackUrl,cols:r.terminal.cols||80,rows:r.terminal.rows||24}),this.ensureWsConnected()),e?.initialInput&&this.scheduleInitialInput(t,e.initialInput),this.notify(),t}scheduleInitialInput(e,t){let n=0,r=()=>{this.writeToSession(e,t)||(n+=1,!(n>75)&&globalThis.setTimeout(r,80))};globalThis.setTimeout(r,80)}createTerminalInstance(e,t){let{terminal:n,fitAddon:r,afterOpenHook:i,engine:a}=this.createRendererTerminal(),o=this.createInputPanelAddon(e,t.platform);return n.loadAddon(o),this.attachTerminalShortcuts(n,a,t=>this.writeToSession(e,t)),{id:e,serverSessionId:t.serverSessionId,terminal:n,fitAddon:r,inputPanelAddon:o,isConnected:!1,label:t.label,customTitle:t.customTitle,processTitle:null,oscTitle:null,cwd:null,progress:null,promptState:null,isDedicated:t.isDedicated,isExited:!1,exitCode:null,command:t.command,args:t.args,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,mountedContainer:null,resizeObserver:null,hasOpened:!1,afterOpenHook:i,pendingOutput:[],pendingOutputBytes:0,lastOutputTime:0,lastBellAt:null,outputIdleTimer:null,restored:t.restored,platform:t.platform,rendererEngine:a}}getTerminalOptions(){let e=Qk({useTheme:this.config.useTheme,lightTheme:this.config.lightTheme,darkTheme:this.config.darkTheme,appDarkMode:this.appDarkMode,systemDarkMode:this.systemDarkMode});return{cursorBlink:this.config.cursorBlink,cursorStyle:this.config.cursorStyle,fontSize:this.config.fontSize,fontFamily:tA,theme:e.definition.palette,allowTransparency:!1,convertEol:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,scrollback:this.config.scrollback}}createRendererTerminal(){let e=this.getTerminalOptions();if(this.config.rendererEngine===`xterm`){let t=new L_e(e),n=new ohe;return t.loadAddon(n),t.loadAddon(new fhe),{terminal:t,fitAddon:n,afterOpenHook:null,engine:`xterm`}}let t=this.ghosttyModule;if(!t)throw Error(`ghostty-web is not initialized. Open Settings and switch engine again.`);let n=new t.Terminal(e),r=new t.FitAddon;return n.loadAddon(r),{terminal:n,fitAddon:r,afterOpenHook:()=>{let e=n;e.registerLinkProvider&&e.registerLinkProvider(new t.UrlRegexProvider(n))},engine:`ghostty`}}createInputPanelAddon(e,t){return new hk({onInput:t=>this.writeToSession(e,t),onCommand:t=>this.runInputPanelCommand(e,t),getHistory:async()=>this.inputHistoryStore.list(),addHistory:async e=>this.inputHistoryStore.add(e),subscribeHistory:e=>this.inputHistoryStore.subscribe(e),platform:t,defaultLayout:this.inputPanelDefaultLayout,showFab:!1,stateKey:e,onSettingsChange:async e=>{await this.inputHistoryStore.setLimit(e.historyLimit)}})}runInputPanelCommand(e,t){let n=this.instances.get(e);return n?this.keybindings.runCommand(t,{terminal:n.terminal,writeInput:t=>this.writeToSession(e,t),zoomFont:e=>this.zoomFont(e),resetFontSize:()=>this.resetFontSize(),onAsyncError:e=>console.error(`[terminal] input panel command failed:`,e)})===`block`:!1}applyGhosttyBackground(e,t){if(e.rendererEngine!==`ghostty`)return;let n=e.terminal.options.theme??{},r=typeof n.background==`string`&&n.background.trim().length>0?n.background:this.resolveNearestOpaqueBackground(t);e.terminal.options.allowTransparency=!1,e.terminal.options.theme={...n,background:r}}isTransparentColor(e){let t=e.trim().toLowerCase();return t.length===0||t===`transparent`||t===`rgba(0, 0, 0, 0)`||t===`rgba(0,0,0,0)`}resolveNearestOpaqueBackground(e){let t=e;for(;t;){let e=window.getComputedStyle(t).backgroundColor;if(!this.isTransparentColor(e))return e;t=t.parentElement}return`rgb(26, 26, 26)`}resolveTerminalKeyInput(e){return e.type===`keydown`?e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey?uTe[e.key]??null:e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey?dTe[e.key]??null:!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey?lTe[e.key]??null:null:null}getKeyEventResult(e,t){return e===`xterm`?t===`allow`:t===`block`}attachTerminalShortcuts(e,t,n){e.attachCustomKeyEventHandler(r=>{let i=this.resolveTerminalKeyInput(r);if(i&&n(i))return r.preventDefault(),r.stopPropagation(),this.getKeyEventResult(t,`block`);let a=r.metaKey||r.ctrlKey;if(r.type!==`keydown`||!a)return this.getKeyEventResult(t,`allow`);let o=this.keybindings.handleKeyEvent(r,{terminal:e,writeInput:n,zoomFont:e=>this.zoomFont(e),resetFontSize:()=>this.resetFontSize(),onAsyncError:e=>console.error(`[terminal] keybinding failed:`,e)});return o===`block`&&(r.preventDefault(),r.stopPropagation()),this.getKeyEventResult(t,o)})}bindTerminalInput(e){e.terminal.onData(t=>{if(e.isExited){this.closeSession(e.id);return}let n=this.resolveServerSessionId(e.id);n&&this.wsSend({type:`input`,sessionId:n,data:t})})}isTerminalNotOpenedError(e){if(!(e instanceof Error))return!1;let t=e.message;return t.includes(`Terminal must be opened before use`)||t.includes(`Call terminal.open(parent) first`)}enqueuePendingOutput(e,t){if(t)for(e.pendingOutput.push(t),e.pendingOutputBytes+=t.length;e.pendingOutputBytes>aTe&&e.pendingOutput.length;){let t=e.pendingOutput.shift();if(!t)break;e.pendingOutputBytes-=t.length}}writeTerminalOutput(e,t){if(t){if(!e.hasOpened){this.enqueuePendingOutput(e,t);return}try{e.terminal.write(t)}catch(n){if(this.isTerminalNotOpenedError(n)){this.enqueuePendingOutput(e,t);return}console.error(`[terminal] failed to write output:`,n)}}}flushPendingOutput(e){if(!e.hasOpened||e.pendingOutput.length===0)return;let t=e.pendingOutput.join(``);e.pendingOutput=[],e.pendingOutputBytes=0,this.writeTerminalOutput(e,t)}replaceInstanceRenderer(e){let t=e.mountedContainer,n=e.serverSessionId;e.mountedContainer&&this.unmount(e.id),e.terminal.dispose();let{terminal:r,fitAddon:i,afterOpenHook:a,engine:o}=this.createRendererTerminal(),s=this.createInputPanelAddon(e.id,e.platform);r.loadAddon(s),this.attachTerminalShortcuts(r,o,t=>this.writeToSession(e.id,t)),e.terminal=r,e.fitAddon=i,e.inputPanelAddon=s,e.hasOpened=!1,e.afterOpenHook=a,e.mountedContainer=null,e.resizeObserver=null,e.rendererEngine=o,this.bindTerminalInput(e),t&&this.mount(e.id,t),n&&this.wsSend({type:`attach`,sessionId:n,cols:e.terminal.cols||80,rows:e.terminal.rows||24})}async ensureGhosttyModule(){return this.ghosttyModule?this.ghosttyModule:(this.ghosttyInitPromise||=l(()=>import(`./ghostty-web-CxzCiCWn.js`).then(async e=>(await e.init(),this.ghosttyModule=e,e)),__vite__mapDeps([10,11])).finally(()=>{this.ghosttyInitPromise=null}),this.ghosttyInitPromise)}async setRendererEngine(e){if(e!==this.config.rendererEngine){e===`ghostty`&&await this.ensureGhosttyModule(),this.config.rendererEngine=e;for(let e of this.instances.values())this.replaceInstanceRenderer(e);this._applyFonts(),this.notify()}}closeSession(e,t){let n=this.instances.get(e);if(!n)return;let r=t?.triggerCloseCallback!==!1;if(n.mountedContainer&&this.unmount(e),n.outputIdleTimer&&=(clearTimeout(n.outputIdleTimer),null),this.pendingCreates=this.pendingCreates.filter(t=>t.requestId!==e),n.serverSessionId){let e=n.serverSessionId;this.serverToLocalSessionId.delete(e),this.wsConnected&&this.ws?.readyState===WebSocket.OPEN?this.wsSend({type:`close`,sessionId:e}):this.pendingCloseSessionIds.add(e)}n.terminal.dispose(),r&&this.runCloseCallback(n),this.instances.delete(e),this.activeSessionId===e&&(this.activeSessionId=null),this.notify()}closeAll(){for(let e of this.instances.keys())this.closeSession(e,{triggerCloseCallback:!1});this.activeSessionId=null}mount(e,t){let n=this.instances.get(e);if(!n)return;if(n.mountedContainer===t){requestAnimationFrame(()=>{try{n.fitAddon.fit()}catch{}});return}if(n.mountedContainer&&this.unmount(e),!n.hasOpened)this.applyGhosttyBackground(n,t),n.terminal.open(t),n.hasOpened=!0,n.afterOpenHook?.(),n.afterOpenHook=null,this.flushPendingOutput(n),n.inputPanelAddon.attachListeners();else{let e=n.terminal.element;e&&!e.contains(t)&&e.parentNode!==t&&t.appendChild(e),this.flushPendingOutput(n),this.applyGhosttyBackground(n,t),n.inputPanelAddon.attachListeners()}n.mountedContainer=t,requestAnimationFrame(()=>{try{n.fitAddon.fit()}catch{}});let r=new ResizeObserver(()=>{try{if(n.fitAddon.fit(),n.terminal.cols&&n.terminal.rows){let t=this.resolveServerSessionId(e);if(!t)return;this.wsSend({type:`resize`,sessionId:t,cols:n.terminal.cols,rows:n.terminal.rows})}}catch{}});r.observe(t),n.resizeObserver=r,requestAnimationFrame(()=>{this.focusSession(e)})}unmount(e){let t=this.instances.get(e);!t||!t.mountedContainer||(t.resizeObserver&&=(t.resizeObserver.disconnect(),null),t.mountedContainer=null)}focusSession(e){let t=this.instances.get(e);if(!t||!t.hasOpened)return;let n=!1;try{t.terminal.focus?.(),n=!0}catch{}if(!n){let e=t.terminal.element;if(e instanceof HTMLElement)try{e.focus()}catch{}}t.inputPanelAddon.syncFocusLifecycle()}setActiveSessionId(e){e&&!this.instances.has(e)||(this.activeSessionId=e)}setCustomTitle(e,t){let n=this.instances.get(e);n&&(n.customTitle=t,this.notify())}getDisplayTitle(e){let t=this.instances.get(e);return t?t.customTitle??t.oscTitle??t.processTitle??t.label:``}getConfig(){return{...this.config}}getResolvedTheme(){return this.resolvedTheme}setThemeContext(e){(this.appDarkMode!==e.appDarkMode||this.systemDarkMode!==e.systemDarkMode)&&(this.appDarkMode=e.appDarkMode,this.systemDarkMode=e.systemDarkMode,this.refreshResolvedTheme())}applyConfig(e){let{rendererEngine:t,...n}=e;Object.assign(this.config,n);for(let e of this.instances.values()){let t=e.terminal;t.options.fontSize=this.config.fontSize,t.options.cursorBlink=this.config.cursorBlink,t.options.cursorStyle=this.config.cursorStyle,t.options.scrollback=this.config.scrollback}this.refreshResolvedTheme(),this._applyFonts(),t&&t!==this.config.rendererEngine&&this.setRendererEngine(t).catch(e=>{console.error(`[terminal] failed to switch renderer engine:`,e)}),this.notify()}refreshResolvedTheme(){let e=Qk({useTheme:this.config.useTheme,lightTheme:this.config.lightTheme,darkTheme:this.config.darkTheme,appDarkMode:this.appDarkMode,systemDarkMode:this.systemDarkMode});this.resolvedTheme=e;for(let t of this.instances.values())t.terminal.options.theme=e.definition.palette,t.terminal.options.allowTransparency=!1,t.mountedContainer&&this.applyGhosttyBackground(t,t.mountedContainer)}async _applyFonts(){let e=this.config.fontFamily;if(!e){this._setFontFamily(tA);return}let t=e.split(/[,]+/).map(e=>e.trim()).filter(Boolean),n=[];for(let e of t){let t=fTe[e];if(t)n.push(t);else if(sA.includes(e))mTe(e),n.push(e);else{let t=await pTe(e);t&&n.push(t)}}n.push(tA),this._setFontFamily(n.join(`, `))}_setFontFamily(e){for(let t of this.instances.values())if(t.terminal.options.fontFamily=e,t.mountedContainer)try{t.fitAddon.fit()}catch{}}configPersistTimer=null;persistFontSize(){this.configPersistTimer&&clearTimeout(this.configPersistTimer),this.configPersistTimer=setTimeout(()=>{this.configPersistTimer=null,l(async()=>{let{trpcClient:e}=await import(`./trpc-D1nFWwj3.js`);return{trpcClient:e}},__vite__mapDeps([0,1,2])).then(({trpcClient:e})=>{e.config.update.mutate({terminal:{fontSize:this.config.fontSize}})}).catch(()=>{})},cTe)}zoomFont(e){let t=Math.min(sTe,Math.max(oTe,this.config.fontSize+e));t!==this.config.fontSize&&(this.applyConfig({fontSize:t}),this.persistFontSize())}resetFontSize(){this.config.fontSize!==oA&&(this.applyConfig({fontSize:oA}),this.persistFontSize())}writeToSession(e,t){let n=this.resolveServerSessionId(e);return n?this.wsSend({type:`input`,sessionId:n,data:t}):!1}openInputPanel(e){let t=[e?this.instances.get(e):void 0,...this.instances.values()],n=t.find(e=>e&&e.mountedContainer)?.id??t.find(e=>e)?.id;if(!n)return!1;this.focusSession(n);let r=this.instances.get(n);return r?(r.inputPanelAddon.open(),!0):!1}hasServerSession(e){let t=this.getInstanceByServerSessionId(e);return!!t&&!t.isExited}focusServerSession(e){let t=this.getInstanceByServerSessionId(e);return!t||t.isExited?!1:(this.focusSession(t.id),!0)}subscribeActivation(e){return this.activationListeners.add(e),()=>{this.activationListeners.delete(e)}}requestActivateSession(e){let t=this.instances.get(e);return!t||t.isExited?!1:(this.emitActivationRequest(t.id),!0)}requestActivateServerSession(e){let t=this.getInstanceByServerSessionId(e);return!t||t.isExited?!1:(this.emitActivationRequest(t.id),!0)}getLocalSessionIdForServerSession(e){return this.getInstanceByServerSessionId(e)?.id??null}isSessionActive(e){return this.activeSessionId===e}async addInputHistory(e){await this.inputHistoryStore.add(e)}resolveServerSessionId(e){let t=this.instances.get(e);return t?t.serverSessionId:null}getInstanceByServerSessionId(e){let t=this.serverToLocalSessionId.get(e)??e;return this.instances.get(t)}getLocalSessionIdByServerSessionId(e){return this.serverToLocalSessionId.get(e)??e}handleCreatedResponse(e){let t=this.instances.get(e.requestId);if(!t){this.wsSend({type:`close`,sessionId:e.sessionId});return}t.serverSessionId=e.sessionId,t.platform=e.platform,t.inputPanelAddon.setPlatform(e.platform),t.isConnected=!0,this.serverToLocalSessionId.set(e.sessionId,e.requestId),this.notify()}handleOutputResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(this.writeTerminalOutput(t,e.data),t.lastOutputTime=Date.now(),this.notify(),t.outputIdleTimer&&clearTimeout(t.outputIdleTimer),t.outputIdleTimer=setTimeout(()=>{t.outputIdleTimer=null,this.notify()},rA))}handleExitResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);if(t){if(t.isExited=!0,t.exitCode=e.exitCode,t.closeTip||t.isDedicated){let n=t.closeTip??`Press any key to close (equivalent to close action).`;this.writeTerminalOutput(t,`\r\n\x1b[90m[Process exited with code ${e.exitCode}. ${n}]\x1b[0m`)}this.notify()}}handleTitleResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.oscTitle=e.title,this.notify())}handleProcessTitleResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.processTitle=e.title,this.notify())}handleCwdResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.cwd=e.cwd,this.notify())}handleProgressResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.progress=e.state===`clear`?null:{state:e.state,value:e.value},this.notify())}handlePromptStateResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);t&&(t.promptState=e.state,this.notify())}handleBellResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);!t||t.isExited||(t.lastBellAt=e.createdAt??Date.now(),this.bellSoundEngine.play(this.config.bellSound,this.config.bellVolume).catch(()=>{}),this.notify())}handleBufferResponse(e){let t=this.getInstanceByServerSessionId(e.sessionId);!t||!e.data||this.writeTerminalOutput(t,e.data)}handleErrorResponse(e){if(e.code===`PTY_CREATE_FAILED`&&e.sessionId){let t=this.instances.get(e.sessionId);t&&!t.serverSessionId&&(t.isExited=!0,t.exitCode=-1,this.writeTerminalOutput(t,`\r\n\x1b[31m[Failed to start PTY: ${e.message}]\x1b[0m`),this.notify())}console.warn(`[pty] ${e.code}: ${e.message}`,e)}setInputPanelMountTarget(e){hk.mountTarget=e}setInputPanelDefaultLayout(e){this.inputPanelDefaultLayout=e;for(let t of this.instances.values())t.inputPanelAddon.setDefaultLayout(e)}getTerminalDimensions(e){let t=this.instances.get(e);return t?{cols:t.terminal.cols||80,rows:t.terminal.rows||24}:null}subscribe(e){return this.listeners.add(e),this.ensureWsConnected(),()=>{this.listeners.delete(e)}}getSnapshot(){if(this.snapshotCache)return this.snapshotCache;let e=[];for(let t of this.instances.values())e.push({id:t.id,serverSessionId:t.serverSessionId,label:t.label,customTitle:t.customTitle,processTitle:t.processTitle,oscTitle:t.oscTitle,cwd:t.cwd,progress:t.progress,promptState:t.promptState,displayTitle:t.customTitle??t.oscTitle??t.processTitle??t.label,isDedicated:t.isDedicated,isExited:t.isExited,exitCode:t.exitCode,outputActive:t.lastOutputTime>0&&Date.now()-t.lastOutputTime<rA,lastBellAt:t.lastBellAt,command:t.command,args:t.args,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,platform:t.platform});return this.snapshotCache={sessions:e},this.snapshotCache}notify(){this.snapshotCache=null;for(let e of this.listeners)e()}emitActivationRequest(e){this.setActiveSessionId(e);for(let t of this.activationListeners)t(e);this.scheduleSessionFocus(e)}scheduleSessionFocus(e){(typeof globalThis.requestAnimationFrame==`function`?globalThis.requestAnimationFrame.bind(globalThis):e=>globalThis.setTimeout(()=>e(Date.now()),0))(()=>{this.focusSession(e)})}ensureWsConnected(){this.ws&&(this.ws.readyState===WebSocket.CONNECTING||this.ws.readyState===WebSocket.OPEN)||this.connectSharedWebSocket()}connectSharedWebSocket(){this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null);let e=new WebSocket(Fne());this.ws=e,e.onopen=()=>{this.wsConnected=!0,this.reconnectDelay=iA;for(let e of this.pendingCloseSessionIds)this.wsSend({type:`close`,sessionId:e});this.pendingCloseSessionIds.clear(),this.wsSend({type:`list`});for(let e of this.pendingCreates)this.wsSend({type:`create`,requestId:e.requestId,cols:e.cols,rows:e.rows,command:e.command,args:e.args,closeTip:e.closeTip,closeCallbackUrl:e.closeCallbackUrl});this.pendingCreates=[];for(let e of this.instances.values())if(!e.restored)continue;this.notify()},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}let n=nhe.safeParse(t);n.success&&this.handleServerMessage(n.data)},e.onclose=()=>{this.wsConnected=!1,this.ws=null,this.notify(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,(this.listeners.size>0||this.instances.size>0)&&this.connectSharedWebSocket()},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*1.5,iTe)},e.onerror=()=>{}}handleServerMessage(e){switch(e.type){case`list`:this.handleListResponse(e);break;case`created`:this.handleCreatedResponse(e);break;case`buffer`:this.handleBufferResponse(e);break;case`output`:this.handleOutputResponse(e);break;case`exit`:this.handleExitResponse(e);break;case`title`:this.handleTitleResponse(e);break;case`process-title`:this.handleProcessTitleResponse(e);break;case`cwd`:this.handleCwdResponse(e);break;case`progress`:this.handleProgressResponse(e);break;case`prompt-state`:this.handlePromptStateResponse(e);break;case`bell`:this.handleBellResponse(e);break;case`error`:this.handleErrorResponse(e);break}}handleListResponse(e){let t=new Set(e.sessions.map(e=>e.id));for(let t of e.sessions){let e=this.getLocalSessionIdByServerSessionId(t.id),n=this.instances.get(e);if(n)n.serverSessionId||=t.id;else{let e=t.title||`${t.command} ${t.args.join(` `)}`.trim();n=this.createTerminalInstance(t.id,{label:e.length>40?`${e.slice(0,37)}...`:e,command:t.command,args:t.args,isDedicated:!1,closeTip:t.closeTip,closeCallbackUrl:t.closeCallbackUrl,initialInput:void 0,customTitle:null,restored:!0,serverSessionId:t.id,platform:t.platform??aA}),t.isExited&&(n.isExited=!0,n.exitCode=t.exitCode),this.bindTerminalInput(n),this.instances.set(n.id,n),this._applyFonts()}n.closeTip=t.closeTip,n.closeCallbackUrl=t.closeCallbackUrl,n.platform=t.platform??aA,n.inputPanelAddon.setPlatform(n.platform),this.serverToLocalSessionId.set(t.id,n.id),this.wsSend({type:`attach`,sessionId:t.id,cols:n.terminal.cols||80,rows:n.terminal.rows||24})}for(let e of this.instances.values())e.restored&&e.serverSessionId&&!t.has(e.serverSessionId)&&!e.isExited&&(e.isExited=!0,e.exitCode=-1);this.hasDiscoveredSessions=!0,this.notify()}get discoveredSessions(){return this.hasDiscoveredSessions}runCloseCallback(e){if(!e.isExited)return;let t=gTe(e.closeCallbackUrl,e.exitCode);t&&_Te(t)}wsSend(e){return this.ws?.readyState===WebSocket.OPEN?(this.ws.send(JSON.stringify(e)),!0):!1}};function gTe(e,t){if(!e)return null;if(typeof e==`string`){let t=e.trim();return t.length>0?t:null}let n=e[t==null?`null`:String(t)];if(typeof n==`string`&&n.trim().length>0)return n.trim();let r=e[`*`];return typeof r==`string`&&r.trim().length>0?r.trim():null}function _Te(e){let t;try{t=new URL(e,window.location.origin)}catch{return}if(t.origin===window.location.origin){let e=`${t.pathname}${t.search}${t.hash}`,n=Oo.getAreaForPath(t.pathname);Oo.push(n,e,null);return}window.open(t.toString(),`_blank`,`noopener,noreferrer`)}var uA=new hTe,dA=md;Y({sound:dA.default(ud),volume:Eae,systemNotificationsEnabled:Vs().default(!1)});var vTe=Gs(`type`,[Y({type:qs(`terminal`),sessionId:J().min(1),title:J().optional()}),Y({type:qs(`openspec-change`),changeId:J().min(1),title:J().optional()}),Y({type:qs(`hooks-plugin`),pluginId:J().min(1),title:J().optional()}),Y({type:qs(`custom`),groupId:J().min(1),title:J().optional()})]),yTe=Gs(`type`,[Y({type:qs(`terminal.focus`),label:J().default(`Focus terminal`),target:Y({sessionId:J().min(1)})}),Y({type:qs(`href.open`),label:J().default(`Open`),target:Y({href:J().min(1)})})]),bTe=J().min(1);Y({title:J().min(1).max(160),body:J().max(2e3).default(``),source:vTe,actions:Us(yTe).default([]),level:Js([`info`,`success`,`warning`,`error`]).default(`info`),createdAt:Bs().int().positive().optional()}).extend({id:J().min(1),createdAt:Bs().int().positive(),groupKey:bTe});function xTe(e){return e.type===`terminal`?e.title?.trim()||`Terminal ${e.sessionId}`:e.type===`openspec-change`?e.title?.trim()||`Change ${e.changeId}`:e.type===`hooks-plugin`?e.title?.trim()||`Plugin ${e.pluginId}`:e.title?.trim()||e.groupId}function fA(e){return Array.isArray(e)?`[${e.map(e=>fA(e)).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${fA(t)}`).join(`,`)}}`:JSON.stringify(e)}function STe(e){return fA({groupKey:e.groupKey,title:e.title,body:e.body,source:e.source,actions:e.actions,level:e.level})}function CTe(e){let t=new Map;for(let n of e){let e=STe(n),r=t.get(e);r?r.push(n):t.set(e,[n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort((e,t)=>t.createdAt-e.createdAt);return{key:e,notifications:n,latest:n[0],count:n.length}}).sort((e,t)=>t.latest.createdAt-e.latest.createdAt)}function wTe(e){let t=new Map;for(let n of e){let e=t.get(n.groupKey);e?e.push(n):t.set(n.groupKey,[n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort((e,t)=>t.createdAt-e.createdAt),r=n[0];return{key:e,label:xTe(r.source),source:r.source,notifications:n,aggregates:CTe(n),latest:r,unreadCount:n.length}}).sort((e,t)=>t.latest.createdAt-e.latest.createdAt)}function pA(){if(typeof window>`u`)return;let e=Ya(),t=e.endsWith(`/`)?e:`${e}/`;return new URL(`${t}icon.rounded.svg`,window.location.href).href}var TTe=class extends Dk{constructor(){super(`notification`)}},mA=(0,G.createContext)(null);function ETe({value:e,children:t}){return(0,K.jsx)(mA,{value:e,children:t})}var DTe={notifications:[],latestNotification:null,groups:[],unreadCount:0,highlightedId:null,browserSupported:!1,browserPermission:`unsupported`,panelOpen:!1,openPanel:()=>void 0,requestBrowserPermission:async()=>`unsupported`,previewSound:async()=>void 0,resolveAction:(e,t)=>({action:t,disabled:!0,reason:`Notifications are not available in this render tree.`,run:async()=>void 0}),markRead:async()=>void 0,markManyRead:async()=>void 0,clearGroup:async()=>void 0,clearAll:async()=>void 0,clearTerminalSession:async()=>void 0};function hA(){return typeof window<`u`&&`Notification`in window}function OTe(){return hA()?Notification.permission:`unsupported`}function kTe(e){if(!e)return`/notifications`;let t=new URLSearchParams;return t.set(`highlight`,e),`/notifications?${t.toString()}`}function ATe(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function jTe(e){return e.body.trim()||e.title}function MTe(e){let t=e[0];if(!t)return``;let n=ATe(t.createdAt);return e.length<=1?`${n} - 1 unread`:`${n} - ${e.length} unread notifications`}async function NTe(){if(Oo.getAreaForPath(`/terminal`)===`bottom`){await Bp.activateBottom(`/terminal`);return}await Bp.push(`main`,`/terminal`,null)}function PTe({children:e}){let{data:t}=hce(),{data:n}=op(),r=ko(),i=t??[],a=(0,G.useMemo)(()=>wTe(i),[i]),o=i[0]??null,[s,c]=(0,G.useState)(()=>OTe()),[l,u]=(0,G.useState)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=r.popActive&&r.popLocation.pathname===`/notifications`,h=n?.notifications?.systemNotificationsEnabled??!1,g=n?.notifications?.sound??`builtin:Blow`,_=n?.notifications?.volume??1;(0,G.useEffect)(()=>{let e=new TTe;e.init(),d.current=e},[]);let v=(0,G.useCallback)(e=>{typeof window<`u`&&window.focus(),u(e??null),Bp.activatePop(kTe(e))},[]),y=(0,G.useCallback)(async e=>{await X.notifications.markRead.mutate({id:e})},[]),b=(0,G.useCallback)(async e=>{await X.notifications.markManyRead.mutate({ids:[...e]})},[]),x=(0,G.useCallback)(async e=>{await X.notifications.clearGroup.mutate({groupKey:e})},[]),S=(0,G.useCallback)(async()=>{await X.notifications.clearAll.mutate()},[]),C=(0,G.useCallback)(async e=>{await X.notifications.clearTerminalSession.mutate({sessionId:e})},[]),w=(0,G.useCallback)(async()=>{if(!hA())return c(`unsupported`),`unsupported`;let e=await Notification.requestPermission();return c(e),e===`granted`&&await X.config.update.mutate({notifications:{systemNotificationsEnabled:!0}}),e},[]),T=(0,G.useCallback)(async(e,t)=>{await d.current?.play(e??g,t??_)},[g,_]),E=(0,G.useCallback)((e,t,n)=>{let r=n?.markReadOnRun??!0;if(t.type===`terminal.focus`){let n=uA.hasServerSession(t.target.sessionId);return{action:t,disabled:!n,reason:n?void 0:`Target terminal is no longer available.`,run:async()=>{uA.hasServerSession(t.target.sessionId)&&(await Bp.deactivatePop(),await NTe(),uA.requestActivateServerSession(t.target.sessionId)&&r&&await y(e.id))}}}return{action:t,disabled:!1,run:async()=>{let n=Oo.getAreaForPath(t.target.href);m&&await Bp.deactivatePop(),await Bp.push(n,t.target.href,null),r&&await y(e.id)}}},[y,m]);return(0,G.useEffect)(()=>{let e=o?.id??null;if(!e||f.current===e){f.current=e;return}if(f.current=e,d.current?.play(g,_).catch(()=>{}),!h||m||!hA()||Notification.permission!==`granted`)return;p.current?.close();let t=new Notification(jTe(o),{body:MTe(i),icon:pA(),tag:`openspecui-notifications`});t.onclick=()=>{v(o.id),t.close()},p.current=t},[o,i,v,m,g,h,_]),(0,G.useEffect)(()=>{m&&(p.current?.close(),p.current=null)},[m]),(0,G.useEffect)(()=>{r.popLocation.pathname===`/notifications`&&u(new URLSearchParams(r.popLocation.search).get(`highlight`))},[r.popLocation.pathname,r.popLocation.search]),(0,K.jsx)(ETe,{value:(0,G.useMemo)(()=>({notifications:i,latestNotification:o,groups:a,unreadCount:i.length,highlightedId:l,browserSupported:hA(),browserPermission:s,panelOpen:m,openPanel:v,requestBrowserPermission:w,previewSound:T,resolveAction:E,markRead:y,markManyRead:b,clearGroup:x,clearAll:S,clearTerminalSession:C}),[s,S,x,C,a,l,o,b,y,i,v,m,T,w,E]),children:e})}function gA(){return(0,G.useContext)(mA)||DTe}function _A({className:e,badgeClassName:t,iconClassName:n,size:r=`mobile`}){let{unreadCount:i,openPanel:a}=gA();return(0,K.jsx)(nb,{label:i>0?`Open notifications, ${i} unread`:`Open notifications`,icon:(0,K.jsx)(Jp,{className:bh(`h-4 w-4`,n)}),badge:i>0?(0,K.jsx)(sb,{count:i,className:bh(`ring-background absolute -right-1.5 -top-1.5 ring-2`,t),"aria-hidden":`true`}):void 0,size:r,className:e,onClick:()=>a(),"data-notification-entry-button":`true`})}function vA({children:e,maxWidth:t=300,duration:n=10,gap:r=20,className:i=``}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=(0,G.useRef)(null),u=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=()=>{if(l.current&&u.current){let e=l.current.offsetWidth,t=u.current.scrollWidth;c(t>e)}};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[e]);let d=(0,G.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch(e){console.error(`Failed to copy path:`,e)}},[e]),f=typeof t==`number`?`${t}px`:t;return(0,K.jsxs)(`button`,{onClick:d,className:`hover:bg-muted/50 group flex cursor-pointer items-center gap-1.5 rounded transition-colors ${i}`,title:`${e}\n\nClick to copy`,children:[(0,K.jsx)(`div`,{ref:l,className:`relative overflow-hidden whitespace-nowrap`,style:{maxWidth:f},children:(0,K.jsx)(`div`,{ref:u,"data-content":e,className:`relative inline-block ${s?`animate-marquee group-hover:[animation-play-state:paused]!`:``}`,style:s?{"--marquee-duration":`${n}s`,"--marquee-gap":`${r}px`}:void 0,children:e})}),(0,K.jsx)(`span`,{className:`text-muted-foreground group-hover:text-foreground shrink-0 transition-colors`,children:a?(0,K.jsx)(Yp,{className:`h-3.5 w-3.5 text-green-500`}):(0,K.jsx)(tm,{className:`h-3.5 w-3.5`})})]})}function yA({compact:e=!1}){if(qa())return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,title:`Live features disabled (no file watching, task toggling, or AI integration)`,children:[(0,K.jsx)(rle,{className:`h-3.5 w-3.5 text-blue-500`}),!e&&(0,K.jsx)(`span`,{className:`status-text text-blue-600`,children:`Static`})]});let t=ab(),n=Rme();if(t.connected){let n=t.watcherEnabled?`Watching for changes`:`File watcher disabled`;return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,children:[(0,K.jsx)(Cm,{className:`h-3.5 w-3.5 text-green-500`}),!e&&(0,K.jsx)(Xy,{content:n,children:(0,K.jsx)(`span`,{className:`status-text cursor-default text-green-600`,children:`Live`})})]})}return(0,K.jsxs)(`div`,{className:`status-indicator flex items-center gap-1.5 text-xs`,children:[(0,K.jsx)(Um,{className:`h-3.5 w-3.5 text-red-500`}),!e&&(0,K.jsx)(`span`,{className:`status-text text-red-600`,children:`Offline`}),t.reconnectCountdown!==null&&(0,K.jsxs)(`button`,{onClick:n,className:`text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-1 transition-colors`,title:`Click to reconnect now`,children:[(0,K.jsxs)(`span`,{className:`text-xs`,children:[`(`,t.reconnectCountdown,`s)`]}),(0,K.jsx)(Am,{className:`h-3 w-3`})]})]})}function FTe(){let e=qa(),[t,n]=(0,G.useState)(`Unknown`),[r,i]=(0,G.useState)(null);if((0,G.useEffect)(()=>{e&&zd().then(e=>{e?.meta?.timestamp?n(new Date(e.meta.timestamp).toLocaleString()):n(`Unknown`),i(e?.git?.repositoryUrl??null)}).catch(()=>{n(`Unknown`),i(null)})},[e]),e)return(0,K.jsx)(`div`,{className:`desktop-status border-border bg-muted/30 text-muted-foreground flex h-8 items-center justify-between gap-4 border-t px-2 text-xs`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,K.jsx)(yA,{}),(0,K.jsxs)(`span`,{className:`truncate`,children:[`Generated: `,t]}),r&&(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(gle,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(vA,{children:r,maxWidth:280,duration:12,className:`text-xs`})]})]})});let a=ab();return(0,K.jsxs)(`div`,{className:`desktop-status border-border bg-muted/30 text-muted-foreground flex h-8 items-center justify-between gap-4 border-t px-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(yA,{}),a.projectDir&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(pm,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(vA,{children:a.projectDir,maxWidth:300,duration:12,className:`text-xs`})]})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsx)(_A,{})})]})}function ITe(){let[e,t]=(0,G.useState)(!1),n=Xa(),r=ab(),i=ko(),a=r.dirName??`OpenSpec`,o=Ya(),s=qa(),c=()=>t(!1);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`mobile-header border-border bg-background flex h-12 items-center justify-between border-b px-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`button`,{onClick:()=>t(!0),className:`hover:bg-muted -ml-1.5 rounded-md p-1.5`,"aria-label":`Open menu`,children:(0,K.jsx)(vle,{className:`h-5 w-5`})}),(0,K.jsx)(`span`,{className:`font-nav text-[12px] tracking-[0.04em]`,children:a})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(nb,{label:`Open search`,icon:(0,K.jsx)(Pm,{className:`h-4 w-4`}),onClick:()=>Bp.activatePop(`/search`)}),!s&&(0,K.jsx)(_A,{}),(0,K.jsx)(yA,{compact:!0})]})]}),e&&(0,K.jsxs)(`div`,{className:`fixed inset-0 z-50 flex`,children:[(0,K.jsx)(`div`,{className:`animate-in fade-in absolute inset-0 bg-black/50 duration-200`,onClick:c}),(0,K.jsxs)(`nav`,{className:`bg-background border-border animate-in slide-in-from-left relative flex h-full w-64 max-w-[80vw] flex-col border-r p-4 duration-200`,children:[(0,K.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,K.jsx)(`img`,{src:n?`${o}openspec_pixel_dark.svg`:`${o}openspec_pixel_light.svg`,alt:`OpenSpec`,className:`h-5`}),(0,K.jsx)(`button`,{onClick:c,className:`hover:bg-muted rounded-md p-1.5`,"aria-label":`Close menu`,children:(0,K.jsx)(Wm,{className:`h-5 w-5`})})]}),s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`flex-1 space-y-1`,children:Qy.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(Lp,{to:e.to,onClick:c,className:`hover:bg-muted [&.active]:bg-primary [&.active]:text-primary-foreground flex items-center gap-2 rounded-md px-3 py-2`,children:[(0,K.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-base tracking-[0.04em]`,children:e.label})]})},e.to))}),(0,K.jsx)(`div`,{className:`border-border space-y-1 border-t pt-4`,children:(0,K.jsxs)(Lp,{to:$y.to,onClick:c,className:`hover:bg-muted [&.active]:bg-primary [&.active]:text-primary-foreground flex items-center gap-2 rounded-md px-3 py-2`,children:[(0,K.jsx)($y.icon,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-base tracking-[0.04em]`,children:$y.label})]})})]}):(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,children:[(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(tb,{area:`main`,tabs:i.mainTabs,className:`scrollbar-thin scrollbar-track-transparent h-full overflow-auto`,useLinks:!0,onNavigate:c})}),(0,K.jsx)(`div`,{className:`text-muted-foreground text-[10px] font-medium uppercase tracking-wider`,children:`Bottom`}),(0,K.jsx)(`div`,{className:`border-border border-t pt-2`,children:(0,K.jsx)(tb,{area:`bottom`,tabs:i.bottomTabs,onNavigate:c})})]})]})]})]})}function LTe(){let e=ko();return(0,K.jsx)(`nav`,{className:`mobile-tabbar border-border bg-background flex h-14 items-stretch border-t`,children:(qa()?Pme:e.mainTabs.map(e=>Zy.find(t=>t.to===e)).filter(e=>e!=null)).map(e=>(0,K.jsxs)(Lp,{to:e.to,className:`text-muted-foreground hover:text-foreground [&.active]:text-primary flex flex-1 flex-col items-center justify-center gap-0.5`,children:[(0,K.jsx)(e.icon,{className:`h-5 w-5 shrink-0`}),(0,K.jsx)(`span`,{className:`font-nav text-[10px] tracking-[0.03em]`,children:e.label})]},e.to))})}function bA(e,t){(0,G.useInsertionEffect)(()=>{if(typeof document>`u`)return;let n=[...document.head.querySelectorAll(`style[data-head-style]`)].find(t=>t.dataset.headStyle===e);if(n){let e=Number(n.dataset.refCount??`1`);return n.dataset.refCount=String(e+1),n.textContent!==t&&(n.textContent=t),()=>{let e=Number(n.dataset.refCount??`1`)-1;if(e<=0){n.remove();return}n.dataset.refCount=String(e)}}let r=document.createElement(`style`);return r.setAttribute(`data-head-style`,e),r.dataset.refCount=`1`,r.textContent=t,document.head.appendChild(r),()=>{let e=Number(r.dataset.refCount??`1`)-1;if(e>0){r.dataset.refCount=String(e);return}r.remove()}},[t,e])}function xA({open:e,title:t,headerActions:n,onClose:r,onDismissRequest:i,onClosed:a,children:o,footer:s,dialogClassName:c=``,contentClassName:l=``,contentShellClassName:u=``,className:d=``,bodyClassName:f=``,maxHeight:p=`86vh`,borderVariant:m=`default`}){let h=(0,G.useRef)(null),g=(0,G.useRef)(null),_=(0,G.useId)(),v=i===void 0?r:i;(0,G.useEffect)(()=>{let e=h.current;if(!e||!a)return;let t=()=>{a()};return e.addEventListener(`close`,t),()=>{e.removeEventListener(`close`,t)}},[a]),(0,G.useLayoutEffect)(()=>{let t=h.current;t&&(e&&!t.open?typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``):!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e]),(0,G.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{e.preventDefault(),v?.()},n=e=>{let t=g.current;if(!t||e.target instanceof Node&&t.contains(e.target))return;let n=t.getBoundingClientRect();e.clientX>=n.left&&e.clientX<=n.right&&e.clientY>=n.top&&e.clientY<=n.bottom||v?.()};return e.addEventListener(`cancel`,t),e.addEventListener(`click`,n),()=>{e.removeEventListener(`cancel`,t),e.removeEventListener(`click`,n)}},[v]);let y=m===`error`?`border-red-500/60`:m===`success`?`border-green-500/50`:`border-border`;return bA(`dialog:openspec-dialog`,(0,G.useMemo)(()=>String.raw`
1174
1174
  dialog.openspec-dialog {
1175
1175
  opacity: 0;
1176
1176
  transform: translateY(8px);
@@ -1206,7 +1206,7 @@ fn mainFragment(
1206
1206
  .dark dialog.openspec-dialog::backdrop {
1207
1207
  background-color: rgba(255, 255, 255, 0.2);
1208
1208
  }
1209
- `,[])),(0,K.jsx)(`dialog`,{ref:h,"aria-labelledby":_,className:`openspec-dialog m-0 h-dvh w-screen max-w-none border-0 bg-transparent p-0 ${c}`,children:(0,K.jsx)(`div`,{className:`flex h-full w-full items-center justify-center px-4 py-4 ${l} ${u}`,children:(0,K.jsxs)(`div`,{ref:g,className:`@container/dialog bg-background text-foreground relative flex h-fit w-[calc(100%-0.5rem)] max-w-2xl flex-col overflow-hidden rounded-[var(--openspec-dialog-radius,0.75rem)] border shadow-xl ${y} ${d}`,style:{maxHeight:p},children:[(0,K.jsxs)(`div`,{className:`border-border flex flex-none shrink-0 items-center justify-between gap-3 border-b px-4 py-3`,children:[(0,K.jsx)(`div`,{id:_,className:`min-w-0 flex-1`,children:t}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n,(0,K.jsx)(`button`,{onClick:r,className:`hover:bg-muted rounded p-1`,"aria-label":`Close dialog`,children:(0,K.jsx)(Wm,{className:`h-4 w-4`})})]})]}),(0,K.jsx)(`div`,{className:`scrollbar-thin scrollbar-track-transparent min-h-0 flex-1 overflow-auto px-4 py-3 ${f}`,children:o}),s&&(0,K.jsx)(`div`,{className:`border-border flex flex-none shrink-0 items-center justify-end gap-2 border-t px-4 py-3`,children:s})]})})})}function RTe(){return(0,K.jsx)(Ra,{})}var SA={layout:{alignY:`center`,width:`wide`,topGap:`comfortable`},dialogClassName:``,panelClassName:``,bodyClassName:`p-0`,maxHeight:`90vh`,title:void 0,headerActions:void 0,onDismissRequest:void 0},CA=(0,G.createContext)(null),wA=(0,G.createContext)(null);function zTe({children:e}){let[t,n]=(0,G.useState)(SA),[r,i]=(0,G.useState)(0),a=(0,G.useCallback)(e=>{n({...SA,...e})},[]),o=(0,G.useCallback)(()=>{n(SA)},[]),s=(0,G.useCallback)(()=>{i(e=>e+1)},[]),c=(0,G.useMemo)(()=>({config:t,setConfig:a,resetConfig:o}),[t,o,a]),l=(0,G.useMemo)(()=>({requestClose:s,closeRequestVersion:r}),[r,s]);return(0,K.jsx)(CA.Provider,{value:c,children:(0,K.jsx)(wA.Provider,{value:l,children:e})})}function TA(){let e=(0,G.useContext)(CA);if(!e)throw Error(`usePopAreaConfigContext must be used within PopAreaConfigProvider`);return e}function EA(){let e=(0,G.useContext)(wA);if(!e)throw Error(`usePopAreaLifecycleContext must be used within PopAreaConfigProvider`);return e}var DA=null;function BTe(e){DA=e}function VTe(e){return e===`/search`?`Search`:e===`/notifications`?`Notifications`:e===`/opsx-new`?`OPSX New`:e===`/opsx-propose`?`OPSX Propose`:e===`/opsx-verify`?`OPSX Verify`:e===`/opsx-compose`?`OPSX Compose`:`Panel`}function HTe(){let e=ko(),{config:t,resetConfig:n}=TA(),{requestClose:r,closeRequestVersion:i}=EA(),a=(0,G.useRef)(0),o=(0,G.useMemo)(()=>t.dialogClassName,[t.dialogClassName]),s=(0,G.useMemo)(()=>[t.layout.alignY===`start`?`items-start`:t.layout.alignY===`end`?`items-end`:`items-center`,t.layout.alignY===`start`?t.layout.topGap===`none`?`pt-[env(safe-area-inset-top)]`:t.layout.topGap===`compact`?`pt-[max(0.5rem,env(safe-area-inset-top))] sm:pt-3`:`pt-[max(0.75rem,env(safe-area-inset-top))] sm:pt-5`:``,t.layout.alignY===`end`?`pb-[max(1rem,env(safe-area-inset-bottom))]`:``].filter(e=>e.length>0).join(` `),[t.layout.alignY,t.layout.topGap]),c=(0,G.useMemo)(()=>t.layout.width===`narrow`?`max-w-2xl`:t.layout.width===`normal`?`max-w-3xl`:t.layout.width===`full`?`max-w-[min(96vw,1280px)]`:`max-w-4xl`,[t.layout.width]);(0,G.useEffect)(()=>{i<=a.current||(a.current=i,e.popActive&&Bp.deactivatePop())},[i,e.popActive]);let l=(0,G.useCallback)(()=>{n()},[n]);return DA?(0,K.jsx)(xA,{open:e.popActive,onClose:r,onClosed:l,title:t.title??(0,K.jsx)(`span`,{className:`font-nav tracking-[0.04em]`,children:VTe(e.popLocation.pathname)}),headerActions:t.headerActions,dialogClassName:o,contentClassName:s,contentShellClassName:`pop-area-vt-shell`,className:[`pop-area-panel`,c,t.panelClassName].filter(e=>e.length>0).join(` `),bodyClassName:t.bodyClassName,maxHeight:t.maxHeight,onDismissRequest:t.onDismissRequest,children:(0,K.jsx)(Ba,{router:DA})}):null}function UTe(){return DA?(0,K.jsx)(zTe,{children:(0,K.jsx)(HTe,{})}):null}var OA=`>=1.2.0 <1.4.0`,kA=`>=1.3.0 <1.4.0`;function WTe(e){if(!e)return null;let t=e.match(/(\d+)\.(\d+)\.(\d+)/);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}:null}function AA(e){return`${e.major}.${e.minor}.${e.patch}`}function jA(e,t){let[n,r]=t.split(`.`).map(e=>Number(e));return e.major===n&&e.minor===r}function GTe(e){let t=WTe(e);return t?jA(t,`1.3`)?{rawVersion:e,version:t,status:`current`,supported:!0,recommended:!0,blocksCoreInteractions:!1,message:`OpenSpec CLI ${AA(t)} matches the OpenSpecUI 3.x target line.`}:jA(t,`1.2`)?{rawVersion:e,version:t,status:`legacy-compatible`,supported:!0,recommended:!1,blocksCoreInteractions:!1,message:`OpenSpec CLI ${AA(t)} is legacy-compatible with OpenSpecUI 3.x. Upgrade to ${kA} for the current line.`}:{rawVersion:e,version:t,status:`unsupported`,supported:!1,recommended:!1,blocksCoreInteractions:!0,message:`Detected OpenSpec CLI ${AA(t)}, but OpenSpecUI 3.x accepts ${OA}.`}:{rawVersion:e,version:null,status:`unknown`,supported:!1,recommended:!1,blocksCoreInteractions:!0,message:`Unable to parse OpenSpec CLI version.`}}function KTe(e,t=[]){let n=e=>e?/[\s"'\\]/.test(e)?JSON.stringify(e):e:`""`;return[e,...t].map(n).join(` `)}function qTe(){if(qa())return null;let{data:e}=op(),{data:t,isLoading:n,refetch:r,isFetching:i}=Br({...tp.cli.checkAvailability.queryOptions(),staleTime:0,gcTime:0}),[a,o]=(0,G.useState)(``),s=(0,G.useMemo)(()=>e?.cli?.command?KTe(e.cli.command,e.cli.args??[]):``,[e?.cli?.args,e?.cli?.command]);(0,G.useEffect)(()=>{o(s)},[s]),(0,G.useEffect)(()=>{r()},[e?.cli?.command,e?.cli?.args,r]);let c=Vr({mutationFn:e=>X.config.update.mutate({cli:{command:e}}),onSuccess:async()=>{await Promise.allSettled([r(),Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter()),Xf.invalidateQueries(tp.config.getEffectiveCliCommand.queryFilter())])}});if(n)return null;let l=GTe(t?.version);if(t?.available&&l.status===`current`)return null;if(t?.available&&l.status===`legacy-compatible`)return(0,K.jsx)(`div`,{className:`fixed bottom-4 right-4 z-40 mx-4 max-w-sm rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 text-sm shadow-lg backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(Qp,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-300`}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`font-medium`,children:[`OpenSpec CLI `,t.version,` is legacy-compatible`]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`OpenSpecUI `,3,`.x accepts `,OA,`. Upgrade to `,kA,` for the current line.`]})]})]})});let u=i||c.isPending,d=t?.available?l.message:t?.error||`OpenSpec CLI not found.`;return(0,K.jsx)(`div`,{className:`bg-background/80 fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`border-border bg-background mx-4 max-w-xl space-y-4 rounded-lg border p-6 shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Qp,{className:`h-5 w-5 text-amber-500`}),`OpenSpec CLI `,OA,` Required`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:d}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`Execute Path`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Set the exact command used to run OpenSpec. Save will immediately re-check availability.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. openspec or "C:\\\\Program Files\\\\PowerShell\\\\7\\\\pwsh.exe" -File "D:\\\\a b\\\\openspec.ps1"`,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2 font-mono text-sm`}),(0,K.jsx)(`button`,{onClick:()=>c.mutate(a),disabled:c.isPending||a.trim()===s,className:`bg-primary text-primary-foreground rounded-md px-4 py-2 text-sm hover:opacity-90 disabled:opacity-50`,children:c.isPending?`Saving...`:`Save`})]})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[`Install or upgrade the CLI:`,(0,K.jsx)(`code`,{className:`bg-muted ml-2 rounded px-1`,children:`npm install -g @fission-ai/openspec`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:(0,K.jsxs)(`button`,{onClick:()=>void r(),disabled:u,className:`border-border hover:bg-muted flex items-center gap-2 rounded-md border px-3 py-1.5 disabled:opacity-50`,children:[u?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Bm,{className:`h-4 w-4`}),u?`Checking...`:`Recheck`]})})]})})}var MA=(0,G.createContext)(null);function JTe({children:e}){let[t,n]=(0,G.useState)({open:!1,changeId:``,changeName:``}),r=(0,G.useCallback)((e,t)=>{n({open:!0,changeId:e,changeName:t})},[]),i=(0,G.useCallback)(()=>{n(e=>({...e,open:!1}))},[]);return(0,K.jsx)(MA.Provider,{value:{state:t,openArchiveModal:r,closeArchiveModal:i},children:e})}function YTe(){let e=(0,G.useContext)(MA);if(!e)throw Error(`useArchiveModal must be used within ArchiveModalProvider`);return e}function NA(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}function PA(e,t){return`${e}${t.length>0?` ${t.join(` `)}`:``}`}function XTe(e){return e.some(e=>e.status===`loading`||e.status===`running`)?`running`:e.some(e=>e.status===`error`)?`error`:e.length>0&&e.every(e=>e.status===`success`)?`success`:`idle`}function FA(e={}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)([]),u=(0,G.useRef)(e);(0,G.useEffect)(()=>{u.current=e},[e]);let d=(0,G.useCallback)(e=>{let t=e(l.current);l.current=t,n(t)},[]);(0,G.useEffect)(()=>{l.current=t},[t]);let f=(0,G.useCallback)(()=>{s.current?.unsubscribe?.(),s.current=null,c.current=null,l.current=[],n([]),i([]),o(null)},[]),p=(0,G.useCallback)(()=>{s.current?.unsubscribe?.(),s.current=null;let e=c.current;e&&(d(t=>t.map(t=>t.id===e?{...t,status:`error`,exitCode:null}:t)),i(t=>[...t,{id:NA(),commandId:e,kind:`meta`,text:`Process cancelled by user`,tone:`error`}])),c.current=null},[d]),m=(0,G.useCallback)((e,t=[],n=-1)=>{let r=NA();return d(i=>{let a=[...i],o={id:r,command:e,args:t,status:`idle`,exitCode:null};return n>=0&&n<a.length?a.splice(n,0,o):a.push(o),a}),r},[]),h=(0,G.useCallback)(e=>{d(t=>t.filter(t=>t.id!==e)),i(t=>t.filter(t=>t.commandId!==e)),c.current===e&&p()},[p,d]),g=(0,G.useCallback)(e=>{s.current?.unsubscribe?.(),s.current=null,c.current=null,i([]),o(null),d(()=>e.map(e=>({id:NA(),command:e.command,args:e.args??[],status:`idle`,exitCode:null})))},[d]),_=(0,G.useCallback)(()=>[...l.current],[]),v=(0,G.useCallback)(e=>{i(t=>[...t,e])},[]),y=(0,G.useCallback)(async e=>{if(qa())return console.warn(`CLI runner is disabled in static mode`),null;let t=e??l.current.find(e=>e.status===`idle`)?.id,n=l.current.find(e=>e.id===t);if(!n)return null;s.current?.unsubscribe?.(),c.current=n.id,d(e=>e.map(e=>e.id===n.id?{...e,status:`loading`,exitCode:null}:e));let r=()=>{},i=new Promise(e=>{r=e}),a={data:new Set,error:new Set,close:new Set,exit:new Set},f=(e,t)=>{a[e].forEach(e=>e(t))},m={id:n.id,command:n.command,args:n.args,status:`loading`,exitCode:null,done:i,on:(e,t)=>(a[e].add(t),()=>a[e].delete(t)),cancel:()=>{p()}};u.current.onCreateProcess?.(m);let h=X.cli.runCommandStream.subscribe({command:n.command,args:n.args},{onData:e=>{if(e.type===`command`){d(e=>e.map(e=>e.id===n.id?{...e,status:`running`}:e)),m.status=`running`,f(`data`,e.data??``);return}if(e.type===`stdout`&&e.data){v({id:NA(),commandId:n.id,kind:`stdout`,text:e.data}),f(`data`,e.data);return}if(e.type===`stderr`&&e.data){v({id:NA(),commandId:n.id,kind:`stderr`,text:e.data,tone:`error`}),f(`error`,e.data);return}if(e.type===`exit`){let t=e.exitCode??null;o(t);let i=t===0?`success`:`error`;d(e=>e.map(e=>e.id===n.id?{...e,status:i,exitCode:t}:e)),m.status=i,m.exitCode=t,v({id:NA(),commandId:n.id,kind:`meta`,text:`Process exited with code ${t??`unknown`}`,tone:t===0?`success`:`error`}),f(`close`,t),f(`exit`,t),r(t),s.current?.unsubscribe?.(),s.current=null,c.current=null}},onError:e=>{let t=e instanceof Error?e.message:String(e);d(e=>e.map(e=>e.id===n.id?{...e,status:`error`,exitCode:null}:e)),m.status=`error`,v({id:NA(),commandId:n.id,kind:`meta`,text:`Error: ${t}`,tone:`error`}),f(`error`,t),r(null),s.current?.unsubscribe?.(),s.current=null,c.current=null}});return m.status=`running`,s.current=h,m},[v,p,d]),b=(0,G.useCallback)(async()=>{let e=l.current.find(e=>e.status===`idle`);for(;e;){let t=await y(e.id);if(!t||await t.done!==0)break;e=l.current.find(e=>e.status===`idle`)}},[y]);return(0,G.useEffect)(()=>()=>{p()},[p]),{lines:(0,G.useMemo)(()=>t.flatMap(e=>{let t=e.status===`loading`?(0,K.jsx)(Em,{className:`h-3 w-3 animate-spin text-sky-300`}):e.status===`running`?(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-amber-200`,children:[(0,K.jsx)(Rm,{className:`h-3 w-3 animate-pulse`}),(0,K.jsx)(Em,{className:`h-3 w-3 animate-spin`})]}):e.status===`success`?(0,K.jsx)(Yp,{className:`h-3 w-3 text-green-400`}):e.status===`error`?(0,K.jsx)(em,{className:`h-3 w-3 text-red-400`}):null,n=e.status===`idle`?`# ${PA(e.command,e.args)}`:`$ ${PA(e.command,e.args)}`,i=[{id:`cmd-${e.id}`,kind:`html`,node:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:e.status===`running`?`terminal-shimmer`:e.status===`loading`?`animate-pulse text-blue-200`:e.status===`success`?`text-green-300`:e.status===`error`?`text-red-300`:`text-zinc-200`,children:n}),t]})}],a=r.filter(t=>t.commandId===e.id).map(e=>({id:e.id,kind:`ascii`,text:e.text,tone:e.tone}));return[...i,...a]}),[t,r]),status:(0,G.useMemo)(()=>XTe(t),[t]),exitCode:a,hasStarted:(0,G.useMemo)(()=>t.some(e=>e.status!==`idle`),[t]),commands:(0,G.useMemo)(()=>({add:m,remove:h,list:_,replaceAll:g,run:y,runAll:b}),[m,_,h,g,y,b]),reset:f,cancel:p}}var IA=(0,G.forwardRef)(function({lines:e,maxHeight:t=`60vh`,scrollRef:n},r){return(0,K.jsxs)(`div`,{ref:n??r,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-zinc-700 overflow-auto bg-zinc-900 p-4 font-mono text-sm text-zinc-100`,style:{maxHeight:t},children:[e.length===0&&(0,K.jsx)(`span`,{className:`text-zinc-500`,children:`Waiting to start…`}),e.map(e=>e.kind===`html`?(0,K.jsx)(`div`,{className:`whitespace-pre-wrap break-all`,children:e.node},e.id):(0,K.jsx)(`div`,{className:`whitespace-pre-wrap break-all`,children:(0,K.jsx)(`span`,{className:e.tone===`success`?`text-green-400`:e.tone===`error`?`text-red-400`:e.tone===`info`?`text-blue-300`:void 0,children:ZTe(e.text)})},e.id))]})});function ZTe(e){let t=[],n=0,r=null,i=/\x1b\[(\d+)m/g,a;for(;(a=i.exec(e))!==null;){if(a.index>n){let i=e.slice(n,a.index);t.push(r?(0,K.jsx)(`span`,{className:r,children:i},n):i)}let i=parseInt(a[1],10);i===0?r=null:i===31?r=`text-red-400`:i===32?r=`text-green-400`:i===33?r=`text-yellow-400`:i===34?r=`text-blue-400`:i===35?r=`text-fuchsia-300`:i===36?r=`text-cyan-300`:(i===37||i===90)&&(r=`text-zinc-400`),n=a.index+a[0].length}if(n<e.length){let i=e.slice(n);t.push(r?(0,K.jsx)(`span`,{className:r,children:i},n):i)}return t.length>0?t:e}function LA({checked:e,onCheckedChange:t,ariaLabel:n,id:r,name:i,required:a,disabled:o,readOnly:s,onBlur:c,onFocus:l,className:u,thumbClassName:d}){let f=()=>{o||s||t(!e)};return(0,K.jsxs)(K.Fragment,{children:[i?(0,K.jsx)(`input`,{type:`hidden`,name:i,value:e?`on`:``,required:a,disabled:o}):null,(0,K.jsx)(`button`,{id:r,type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:o,"aria-readonly":s||void 0,onClick:f,onBlur:c,onFocus:l,className:bh(`inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent p-0.5 outline-none transition-colors`,`focus-visible:ring-primary focus-visible:ring-1`,e?`border-primary bg-primary`:`bg-muted-foreground/30 hover:bg-muted-foreground/40`,o&&`cursor-not-allowed opacity-50`,s&&!o&&`cursor-default`,u),children:(0,K.jsx)(`span`,{"aria-hidden":`true`,className:bh(`pointer-events-none block h-5 w-5 rounded-full bg-white transition-transform`,e?`translate-x-5`:`translate-x-0`,d)})})]})}function QTe(){let e=Ip(),{state:t,closeArchiveModal:n}=YTe(),{open:r,changeId:i,changeName:a}=t,[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),{lines:f,status:p,hasStarted:m,commands:h,reset:g,cancel:_}=FA({onCreateProcess:e=>{e.on(`data`,e=>{let t=/Change ['"](.+?)['"] archived as ['"](.+?)['"]/.exec(String(e));t?.[2]&&d(t[2])})}});(0,G.useEffect)(()=>{r&&(s(!1),l(!1),d(null))},[r]);let v=()=>{_(),g(),s(!1),l(!1),d(null),n()},y=(0,G.useCallback)(()=>{if(!i)return[];let e=[];c||e.push({command:`openspec`,args:[`validate`,i]});let t=[`archive`,`-y`,i];return o&&t.push(`--skip-specs`),t.push(`--no-validate`),e.push({command:`openspec`,args:t}),e},[i,c,o]),b=p===`running`,x=p===`success`&&!!u,S=p===`success`&&!u,C=x?`success`:S?`error`:p,w=u??``,T=()=>{i&&h.runAll()},E=()=>{g(),s(!1),l(!1),d(null)};return(0,G.useEffect)(()=>{if(!r||!i||m)return;let e=y();h.replaceAll(e)},[y,i,h,m,r]),!r||!i?null:(0,K.jsx)(xA,{open:r,onClose:v,onDismissRequest:null,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C===`success`?(0,K.jsx)($p,{className:`h-5 w-5 text-green-500`}):(0,K.jsx)(Up,{className:`h-5 w-5 text-red-500`}),(0,K.jsxs)(`span`,{className:`font-semibold`,children:[`Archive: `,a]})]}),footer:C===`success`&&w?(0,K.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-sm text-green-600`,children:[`Archived as `,w]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:v,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2`,children:`Close`}),(0,K.jsx)(`button`,{onClick:()=>{v(),e({href:`/archive/${encodeURIComponent(w)}`})},className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!w,children:`View Archive`})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{onClick:E,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2`,children:C===`error`?`Reset & Retry`:`Reset`}),(0,K.jsx)(`button`,{onClick:v,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:b,children:`Close`}),(0,K.jsxs)(`button`,{onClick:C===`error`?E:T,disabled:b,className:`flex items-center gap-2 rounded-md bg-red-600 px-4 py-2 text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[b?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Up,{className:`h-4 w-4`}),C===`error`?`Reset before Archive`:`Archive`]})]}),borderVariant:C===`error`?`error`:C===`success`?`success`:`default`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`bg-muted/50 rounded-lg p-3`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Change to archive:`}),(0,K.jsx)(`p`,{className:`font-medium`,children:a}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`ID: `,i]})]}),(0,K.jsx)(IA,{lines:f,maxHeight:`50vh`}),S&&(0,K.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-100 px-3 py-2 text-sm text-amber-900`,children:`Archive output did not include the archived change name. Treating archive as failed.`}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Options`}),(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Skip specs update`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Don't update spec files with delta changes (--skip-specs)`})]}),(0,K.jsx)(LA,{checked:o,onCheckedChange:s,ariaLabel:`Skip specs update`,disabled:m})]}),(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Skip validation`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Don't validate the change before archiving (--no-validate)`})]}),(0,K.jsx)(LA,{checked:c,onCheckedChange:l,ariaLabel:`Skip validation`,disabled:m})]})]})]})})}function RA(e,t){let n=new URL(t,`http://openspecui.local`).pathname;return e.mainLocation.pathname===n||e.mainLocation.pathname.startsWith(`${n}/`)||e.bottomLocation.pathname===n||e.bottomLocation.pathname.startsWith(`${n}/`)}function $Te(e,t){if(t.source.type!==`terminal`)return!1;let n=uA.getLocalSessionIdForServerSession(t.source.sessionId);return n?RA(e,`/terminal`)&&uA.isSessionActive(n):!1}function eEe(e){let t=e.actions.find(e=>e.type===`href.open`);return t?new URL(t.target.href,`http://openspecui.local`).pathname:e.actions.some(e=>e.type===`terminal.focus`)?`/terminal`:null}function tEe(e,t){for(let n of t.actions)if(n.type===`terminal.focus`&&$Te(e,t)||n.type===`href.open`&&RA(e,n.target.href))return!0;return!1}function nEe(e){return e.popActive&&e.popLocation.pathname===`/notifications`}function rEe(e){let{notification:t,navLayout:n}=e;return!t||nEe(n)?!1:!tEe(n,t)}var iEe=5200,aEe=340,zA=`border-primary bg-primary text-primary-foreground hover:bg-primary/90 inline-flex h-8 w-8 items-center justify-center rounded-md border transition disabled:cursor-not-allowed disabled:border-border disabled:bg-muted disabled:text-muted-foreground disabled:opacity-50`;function oEe(e,t){return`${new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} - ${t} unread`}function sEe(e){return e.body.trim()||e.title}function cEe(e){return im}function lEe(){let e=ko(),{notifications:t,latestNotification:n,unreadCount:r,resolveAction:i,markRead:a}=gA(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(`hidden`),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=o?eEe(o):null,m=p?Oo.getAreaForPath(p):`main`,h=pA(),g=(0,G.useCallback)(()=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),l(e=>e===`hidden`?e:`exiting`)},[]);(0,G.useEffect)(()=>{let t=n?.id??null;if(!n||u.current===t)return;if(u.current=t,!rEe({notification:n,navLayout:e})){g();return}d.current!==null&&(window.clearTimeout(d.current),d.current=null),f.current!==null&&(window.clearTimeout(f.current),f.current=null),s(n),l(`entering`);let r=window.requestAnimationFrame(()=>{l(`visible`)});return d.current=window.setTimeout(()=>{g()},iEe),()=>{window.cancelAnimationFrame(r)}},[g,n,e]),(0,G.useEffect)(()=>{o&&(t.some(e=>e.id===o.id)||g())},[g,t,o]),(0,G.useEffect)(()=>{if(c===`exiting`)return f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{s(null),l(`hidden`),f.current=null},aEe),()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[c]),(0,G.useEffect)(()=>()=>{d.current!==null&&window.clearTimeout(d.current),f.current!==null&&window.clearTimeout(f.current)},[]);let _=(0,G.useMemo)(()=>{if(!o)return null;let e=o.actions.map(e=>i(o,e,{markReadOnRun:!0}));return e.find(e=>!e.disabled)??e[0]??null},[i,o]);return!o||c===`hidden`?null:(0,K.jsx)(`div`,{className:`notification-toast-viewport pointer-events-none fixed z-40`,"aria-live":`polite`,"aria-atomic":`true`,children:(0,K.jsxs)(`article`,{className:`notification-toast pointer-events-auto`,"data-state":c===`exiting`?`closed`:`open`,"data-target-area":m,children:[(0,K.jsx)(`div`,{className:`border-border/60 bg-background flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-md border`,children:h?(0,K.jsx)(`img`,{src:h,alt:``,className:`h-full w-full object-cover`,draggable:!1}):(0,K.jsx)(`span`,{className:`bg-primary block h-5 w-5`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium leading-5`,children:sEe(o)}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 truncate text-[11px] leading-none`,children:oEe(o,r)})]}),(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:_?(0,K.jsx)(uEe,{resolved:_,onDone:g}):(0,K.jsx)(Xy,{content:`Dismiss`,children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>{a(o.id).then(g)},className:zA,"aria-label":`Dismiss notification`,children:(0,K.jsx)(Yp,{className:`h-3.5 w-3.5`})})})})]})})}function uEe({resolved:e,onDone:t}){let n=cEe(e.action.type);return(0,K.jsx)(Xy,{content:e.disabled?e.reason:e.action.label,children:(0,K.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>{e.run().then(t)},className:zA,"aria-label":e.action.label,children:(0,K.jsx)(n,{className:`h-3.5 w-3.5`})})})}function dEe(e){let{handoff:t,location:n}=e,r=new URL(n.href),i=new URL(t.serverUrl);return Wa({search:n.search}).hosted?(i.pathname=r.pathname,i.search=r.search,i.hash=r.hash,i.searchParams.set(`api`,t.serverUrl),i.toString()):(i.pathname=r.pathname,i.search=r.search,i.hash=r.hash,i.toString())}function BA(e){window.location.assign(dEe(e))}function fEe(e,t){return`${e}:${t}`}function pEe(e){return`openspecui-project-recovery:${encodeURIComponent(e)}`}function mEe(e){switch(e.state){case`evicted`:return{title:`Current Worktree Evicted`,detail:`The current project directory disappeared. Resolving an automatic fallback worktree now.`,busy:!0};case`resolving`:return{title:`Resolving Recovery Target`,detail:`OpenSpecUI is locating an existing default-branch worktree to keep this session alive.`,busy:!0};case`ready`:return{title:`Switching To Fallback Worktree`,detail:`A surviving default-branch worktree was found. Redirecting this session now.`,busy:!0};case`unavailable`:return{title:`Automatic Recovery Unavailable`,detail:e.message,busy:!1};case`failed`:return{title:`Automatic Recovery Failed`,detail:e.message,busy:!1};case`idle`:return{title:``,detail:``,busy:!1}}}function hEe(){let e=ab(),t=(0,G.useRef)(new Set),n=e.projectRecovery;(0,G.useEffect)(()=>{if(n.state!==`ready`||!e.projectDir)return;let r=fEe(e.projectDir,n.detectedAt),i=pEe(r),a=t.current.has(r);if(!a)try{a=sessionStorage.getItem(i)!==null}catch{a=!1}if(a){t.current.add(r);return}t.current.add(r);try{sessionStorage.setItem(i,n.handoff.serverUrl)}catch{}BA({handoff:n.handoff,location:window.location})},[n,e.projectDir]);let r=(0,G.useMemo)(()=>mEe(n),[n]);return n.state===`idle`?null:(0,K.jsx)(`div`,{className:`bg-background/80 fixed inset-0 z-[60] flex items-center justify-center backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`border-border bg-background mx-4 max-w-xl space-y-4 rounded-lg border p-6 shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[r.busy?(0,K.jsx)(Em,{className:`h-5 w-5 animate-spin text-amber-500`}):(0,K.jsx)(Qp,{className:`h-5 w-5 text-amber-500`}),r.title]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r.detail}),e.projectDir?(0,K.jsxs)(`div`,{className:`bg-muted text-muted-foreground break-all rounded-md px-3 py-2 font-mono text-xs`,children:[`Source: `,e.projectDir]}):null,(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Gp,{className:`h-4 w-4`}),`Recovery preserves the current route and only swaps the backend/worktree target.`]}),r.busy?null:(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:(0,K.jsx)(`button`,{onClick:()=>{window.location.reload()},className:`border-border hover:bg-muted rounded-md border px-3 py-1.5`,children:`Reload`})})]})})}function gEe({onResize:e,minHeight:t=100,maxHeight:n}){let r=(0,G.useRef)(0),i=(0,G.useRef)(0),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!1),c=(0,G.useCallback)(a=>{let o=r.current-a,s=Math.max(t,i.current+o),c=n??window.innerHeight*.7;e(Math.min(s,c))},[t,n,e]),l=(0,G.useCallback)(e=>{r.current=e,i.current=a.current?.nextElementSibling?.offsetHeight??300,s(!0),document.body.style.userSelect=`none`},[]),u=(0,G.useCallback)(()=>{s(!1),document.body.style.userSelect=``},[]);return(0,G.useEffect)(()=>{if(!o)return;let e=e=>{c(e.clientY)},t=()=>{u()},n=e=>{let t=e.touches[0];t&&(e.preventDefault(),c(t.clientY))},r=()=>{u()};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),document.addEventListener(`touchmove`,n,{passive:!1}),document.addEventListener(`touchend`,r),document.addEventListener(`touchcancel`,r),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.removeEventListener(`touchmove`,n),document.removeEventListener(`touchend`,r),document.removeEventListener(`touchcancel`,r)}},[c,o,u]),(0,G.useEffect)(()=>()=>{document.body.style.userSelect=``},[]),(0,K.jsx)(`div`,{ref:a,className:`border-border/20 relative h-2 shrink-0 border-b border-t`,children:(0,K.jsx)(`div`,{onMouseDown:(0,G.useCallback)(e=>{e.preventDefault(),l(e.clientY)},[l]),onTouchStart:(0,G.useCallback)(e=>{let t=e.touches[0];t&&(e.preventDefault(),l(t.clientY))},[l]),className:`group absolute inset-x-0 -bottom-1 -top-1 z-10 flex cursor-row-resize touch-none items-center justify-center transition-colors ${o?`bg-muted/50`:`hover:bg-muted/50`}`,children:(0,K.jsx)(`div`,{className:`h-0.5 w-8 rounded-full transition-colors ${o?`bg-muted-foreground/80`:`bg-muted-foreground/30 group-hover:bg-muted-foreground/60`}`})})})}function _Ee(){return(0,K.jsx)(`div`,{className:`scrollbar-thin scrollbar-track-transparent flex h-full min-h-0 flex-col overflow-auto`,children:(0,K.jsx)(Ra,{})})}var VA=null;function vEe(e){VA=e}function yEe({height:e}){return VA?(0,K.jsx)(`div`,{className:`bottom-area scrollbar-thin scrollbar-track-transparent min-h-0 overflow-auto ${e==null?`flex-1`:`shrink-0`}`,style:e==null?void 0:{height:e,minHeight:100},children:(0,K.jsx)(Ba,{router:VA})}):null}function bEe(){let e=ko(),t=qa(),n=t||e.mainTabs.length>0,r=!t&&e.bottomActive,[i,a]=(0,G.useState)(300),o=(0,G.useCallback)(e=>{a(e)},[]);return(0,K.jsxs)(`div`,{className:`@container/app fixed inset-0`,style:{containerName:`app`},children:[(0,K.jsxs)(`div`,{className:`app-layout h-full`,children:[(0,K.jsx)(Lme,{}),(0,K.jsxs)(`div`,{className:`app-body flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(hEe,{}),(0,K.jsx)(qTe,{}),(0,K.jsx)(ITe,{}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[n&&(0,K.jsx)(`main`,{className:`main-content scrollbar-thin scrollbar-track-transparent view-transition-route flex min-h-0 flex-col flex-1`,children:(0,K.jsx)(Ra,{})}),n&&r&&(0,K.jsx)(gEe,{onResize:o}),r&&(0,K.jsx)(yEe,{height:n?i:void 0})]}),(0,K.jsx)(LTe,{}),(0,K.jsx)(FTe,{})]})]}),(0,K.jsx)(QTe,{}),(0,K.jsx)(UTe,{}),!t&&(0,K.jsx)(lEe,{})]})}var HA=`theme`;function UA(){if(typeof window>`u`)return`system`;let e=window.localStorage.getItem(HA);return e===`light`||e===`dark`||e===`system`?e:`system`}function WA(e){typeof window>`u`||window.localStorage.setItem(HA,e)}function GA(e){if(typeof window>`u`)return;let t=document.documentElement;if(e===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;t.classList.toggle(`dark`,e);return}t.classList.toggle(`dark`,e===`dark`)}function xEe(){let{data:e}=op(),t=e?.theme??UA();return(0,G.useEffect)(()=>{GA(t),WA(t)},[t]),(0,G.useEffect)(()=>{if(t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>GA(`system`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[t]),null}function KA(e,t){let n=ei({getLocation(){return t.getLocation(e)},getLength(){return window.history.length},pushState(n,r){t.push(e,n,r)},replaceState(n,r){t.replace(e,n,r)},go(e){window.history.go(e)},back(){window.history.back()},forward(){window.history.forward()},createHref(n){return t.createHref(e,n)}});return t.setHistoryRef(e,n),n}function qA(e){if(!e)return``;let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24),o=Math.floor(a/7),s=Math.floor(a/30),c=Math.floor(a/365);return n<60?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:a<7?`${a}d ago`:o<4?`${o}w ago`:s<12?`${s}mo ago`:`${c}y ago`}function SEe(e){return e?new Date(e).toLocaleString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}):``}function CEe(){let{data:e,isLoading:t}=dce(),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{let e=requestAnimationFrame(()=>r(!1));return()=>cancelAnimationFrame(e)},[]),n||t&&!e?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading archived changes...`}):(0,K.jsxs)(`div`,{className:`space-y-6 p-4`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(Up,{className:`h-6 w-6 shrink-0`}),`Archive`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Completed changes that have been archived after implementation.`}),(0,K.jsxs)(`div`,{className:`border-border divide-border divide-y rounded-lg border`,children:[e?.map(e=>{let t={family:`archive`,entityId:e.id};return(0,K.jsxs)(Lp,{to:`/archive/$changeId`,params:{changeId:e.id},state:t=>({...t,__vtHandoff:{family:`archive`,entityId:e.id,title:e.name,subtitle:e.id}}),vt:{sharedElements:t},...kp(t,`container`),className:`hover:bg-muted/50 flex items-center justify-between p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(Up,{...kp(t,`icon`),className:`text-muted-foreground h-5 w-5`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{...kp(t,`title`),className:`font-medium`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[e.id,e.updatedAt>0&&(0,K.jsxs)(K.Fragment,{children:[` · `,qA(e.updatedAt)]})]})]})]}),(0,K.jsx)(Zp,{className:`text-muted-foreground h-4 w-4`})]},e.id)}),e?.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground p-8 text-center`,children:[(0,K.jsx)(Up,{className:`mx-auto mb-4 h-12 w-12 opacity-50`}),(0,K.jsx)(`p`,{children:`No archived changes yet.`}),(0,K.jsxs)(`p`,{className:`mt-2 text-sm`,children:[`Changes are archived after implementation using`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec archive`})]})]})]})]})}function JA(e,t,n){let r=e.findIndex(e=>e.id===t),i=e.findIndex(e=>e.id===n);return r<0||i<0||r===i?null:i>r?`forward`:`backward`}var YA=`tabVisibleHeight`,XA=`tabTopInset`,ZA=`tabScrollOffset`,QA=`tabLayoutBridge`,$A=`tabLayoutBridgeBasePadding`,ej=`tabLayoutBridgeInlinePadding`,tj=`[data-tab-scroll-root="true"]`;function nj(e,t,n){return Math.min(Math.max(e,t),n)}function rj(e){return Math.max(e.scrollHeight-e.clientHeight,0)}function ij(e,t){return Math.max(e.scrollHeight-t,0)}function wEe(e){return Number(e.dataset[QA]??`0`)||0}function TEe(e){e.dataset[$A]||=window.getComputedStyle(e).paddingBottom,e.dataset[ej]||=e.style.paddingBottom}function aj(e,t){TEe(e);let n=Math.max(Math.ceil(t),0);if(e.dataset[QA]=String(n),n<=0){e.style.paddingBottom=e.dataset[ej]??``;return}let r=e.dataset[$A]??`0px`;e.style.paddingBottom=`calc(${r} + ${n}px)`}function oj(e,t,n){let r=()=>{if(!e.isConnected||!t.isConnected)return!0;let r=wEe(t),i=Math.max(rj(e)-r,0);aj(t,Math.max(n-i,0));let a=nj(n,0,rj(e));return e.scrollTop=a,e.scrollTop===a};if(r()||typeof requestAnimationFrame!=`function`)return;let i=10,a=()=>{r()||i<=0||(--i,requestAnimationFrame(a))};requestAnimationFrame(a)}function sj(e){return e===`auto`||e===`scroll`||e===`overlay`}function EEe(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=null;for(;t.nextNode();){let e=t.currentNode;if(e instanceof HTMLElement&&!(!sj(window.getComputedStyle(e).overflowY)||e.scrollHeight<=e.clientHeight)){if(e.scrollTop>0)return e;n??=e}}return n}function cj(e){return(e.matches(tj)?e:e.querySelector(tj))||EEe(e)}function DEe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return t.scrollTop+n.top-r.top}function OEe(e,t){e.dataset[YA]=String(t.visibleHeight),e.dataset[XA]=String(t.topInset),e.dataset[ZA]=String(t.innerScrollTop)}function kEe(e){delete e.dataset[YA],delete e.dataset[XA],delete e.dataset[ZA]}function lj(e,t){let n={height:e.style.height,maxHeight:e.style.maxHeight,minHeight:e.style.minHeight,overflowY:e.style.overflowY},r=`${t.visibleHeight}px`;return e.style.height=r,e.style.minHeight=r,e.style.maxHeight=r,e.style.overflowY=`hidden`,OEe(e,t),n}function uj(e,t){e.style.height=t.height,e.style.maxHeight=t.maxHeight,e.style.minHeight=t.minHeight,e.style.overflowY=t.overflowY,kEe(e)}function dj(e,t){if(!e)return;let n=()=>e.isConnected?(e.scrollTop=t,e.scrollTop===t):!0;if(n()||typeof requestAnimationFrame!=`function`)return;let r=10,i=()=>{n()||r<=0||(--r,requestAnimationFrame(i))};requestAnimationFrame(i)}function AEe(e){return typeof e==`string`?e.split(`,`).map(e=>e.trim()):[...e]}function jEe(e,t){let n=AEe(t);for(let t of n)if(t)try{let n=e.closest(t);if(n instanceof HTMLElement)return n}catch{return null}return null}function MEe(e,t){let n=e.parentElement;for(;n;){if(sj(window.getComputedStyle(n).overflowY)&&n.scrollHeight>n.clientHeight)return n;if(t&&n===t)break;n=n.parentElement}return t&&sj(window.getComputedStyle(t).overflowY)?t:null}function fj(e,t,n){if(!n)return null;let r=e?.getPanel(t);if(!(r instanceof HTMLElement))return null;let i=MEe(r,jEe(r,n));return i instanceof HTMLElement?{panel:r,contentScrollRoot:cj(r),viewport:i}:null}function NEe(e,t){if(!(e instanceof HTMLElement)||!t)return;let n=cj(e);n&&n!==e&&dj(n,t.contentScrollTop)}function PEe(e,t,n){if(!(!(e instanceof HTMLElement)||!(t instanceof HTMLElement))){if(!n){aj(e,0);return}oj(t,e,n.viewportScrollTop)}}function pj(e){let{panel:t,contentScrollRoot:n,viewport:r}=e,i=t.getBoundingClientRect(),a=r.getBoundingClientRect(),o=nj(Math.min(i.bottom,a.bottom)-Math.max(i.top,a.top),0,r.clientHeight);if(o<=0)return null;let s=Math.max(i.top-a.top,0),c=nj(Math.max(a.top-i.top,0),0,ij(t,o));return{contentScrollTop:n&&n!==t?n.scrollTop:0,innerScrollTop:c,topInset:s,visibleHeight:o,viewportScrollTop:r.scrollTop}}function FEe(e,t){let n=lj(e.panel,t);return e.contentScrollRoot&&e.contentScrollRoot!==e.panel&&dj(e.contentScrollRoot,t.contentScrollTop),e.panel.scrollTop=t.innerScrollTop,t.innerScrollTop>0&&(e.viewport.scrollTop=nj(e.viewport.scrollTop-t.innerScrollTop,0,rj(e.viewport))),{contentScrollRoot:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?e.contentScrollRoot:null,contentScrollTop:t.contentScrollTop,finalViewportScrollTop:t.viewportScrollTop,panel:e.panel,previousStyles:n,viewport:e.viewport}}function IEe(e,t){let n={contentScrollTop:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?t.contentScrollTop:0,topInset:nj(t.topInset,0,e.viewport.clientHeight),visibleHeight:nj(t.visibleHeight,1,e.viewport.clientHeight),innerScrollTop:0,viewportScrollTop:t.viewportScrollTop};n.innerScrollTop=nj(t.innerScrollTop,0,ij(e.panel,n.visibleHeight));let r=nj(DEe(e.panel,e.viewport)-n.topInset,0,rj(e.viewport)),i=lj(e.panel,n);return e.viewport.scrollTop=r,e.contentScrollRoot&&e.contentScrollRoot!==e.panel&&dj(e.contentScrollRoot,n.contentScrollTop),e.panel.scrollTop=n.innerScrollTop,{contentScrollRoot:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?e.contentScrollRoot:null,contentScrollTop:n.contentScrollTop,finalViewportScrollTop:t.viewportScrollTop,panel:e.panel,previousStyles:i,viewport:e.viewport}}function LEe(e){uj(e.panel,e.previousStyles),oj(e.viewport,e.panel,e.finalViewportScrollTop),e.panel.scrollTop=0,e.contentScrollRoot&&dj(e.contentScrollRoot,e.contentScrollTop)}function mj(e){uj(e.panel,e.previousStyles),e.panel.scrollTop=0}var hj={pathname:`/`,search:``,hash:``,state:void 0};function REe(e){let t=new Set(e.tabs.map(e=>e.id)),n=new URLSearchParams(e.search).get(e.queryKey);return n&&(t.has(n)||e.allowUnknownSelection)?n:e.initialTab&&t.has(e.initialTab)?e.initialTab:e.tabs[0]?.id??``}function zEe(e,t,n,r,i){let a=new URLSearchParams(t);a.set(r,i);let o=a.toString();return`${e}${o.length>0?`?${o}`:``}${n}`}function gj(e,t){return t||(qa()?`main`:Oo.getAreaForPath(e))}function BEe(e){if(!e)return;let t=(typeof e==`string`?e.split(`,`):[...e]).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}function VEe(){return typeof window>`u`?hj:{pathname:window.location.pathname||`/`,search:window.location.search,hash:window.location.hash,state:window.history.state}}function HEe(e){let t=e.__store.state.location;return{pathname:t.pathname,search:t.searchStr,hash:t.hash,state:t.state}}function UEe(e,t,n){if(typeof window>`u`)return;let r=new URL(e,window.location.origin),i=`${r.pathname}${r.search}${r.hash}`;t?window.history.replaceState(n,``,i):window.history.pushState(n,``,i),window.dispatchEvent(new PopStateEvent(`popstate`,{state:window.history.state}))}function WEe(){let e=(0,G.useContext)(da()),t=(0,G.useRef)(hj);return{location:(0,G.useSyncExternalStore)((0,G.useCallback)(t=>e?.__store?e.__store.subscribe(()=>{t()}):typeof window>`u`?()=>{}:(window.addEventListener(`popstate`,t),window.addEventListener(`hashchange`,t),()=>{window.removeEventListener(`popstate`,t),window.removeEventListener(`hashchange`,t)}),[e]),(0,G.useCallback)(()=>{let n=e?.__store?HEe(e):VEe(),r=t.current;return r.pathname===n.pathname&&r.search===n.search&&r.hash===n.hash&&r.state===n.state?r:(t.current=n,n)},[e]),()=>hj),router:e}}function _j(e,t){if(!e)return[];let n=[],r=e.getHeaderShell();r&&n.push([r,`vt-tab-header-shell`]);let i=e.getSelectionIndicator();i&&n.push([i,`vt-tab-edge`]);let a=e.getHeaderForeground();a&&n.push([a,`vt-tab-header-foreground`]);let o=e.getPanel(t);return o&&n.push([o,`vt-tab-panel`]),n}function vj({queryKey:e,tabs:t,initialTab:n,area:r,history:i=`replace`,allowUnknownSelection:a=!1,viewportSelector:o}){let{location:s,router:c}=WEe(),l=(0,G.useRef)(null),u=(0,G.useMemo)(()=>BEe(o),[typeof o==`string`?o:(o??[]).join(`\0`)]),d=(0,G.useRef)(new Map),f=(0,G.useRef)(new Map),p=(0,G.useRef)(0),m=(0,G.useRef)(null),h=(0,G.useMemo)(()=>REe({tabs:t,queryKey:e,search:s.search,initialTab:n,allowUnknownSelection:a}),[a,n,s.search,e,t]),[g,_]=(0,G.useState)(h),v=(0,G.useRef)({allowUnknownSelection:a,area:r,history:i,location:s,queryKey:e,router:c,selectedFromLocation:h,selectedTab:g,tabs:t,viewportSelector:u});v.current={allowUnknownSelection:a,area:r,history:i,location:s,queryKey:e,router:c,selectedFromLocation:h,selectedTab:g,tabs:t,viewportSelector:u};let y=(0,G.useCallback)((e,t)=>{let n=f.current.get(e);!n||t!=null&&n.token!==t||(mj(n.state),f.current.delete(e))},[]),b=(0,G.useCallback)(()=>{for(let e of f.current.values())mj(e.state);f.current.clear()},[]),x=(0,G.useCallback)((e,t)=>{let n=fj(l.current,e,t);return n?pj(n):null},[]),S=(0,G.useCallback)((e,t,n)=>{let r=fj(l.current,e,t);if(!r)return;let i=n??pj(r);if(!i)return;d.current.set(e,i),y(e);let a=++p.current;return f.current.set(e,{token:a,state:FEe(r,i)}),a},[y]),C=(0,G.useCallback)((e,t,n)=>{let r=fj(l.current,e,t);if(!r)return null;let i=d.current.get(e)??n??pj(r);if(!i)return null;d.current.has(e)||d.current.set(e,i),y(e);let a=++p.current;return f.current.set(e,{token:a,state:IEe(r,i)}),a},[y]),w=(0,G.useCallback)((e,t)=>{let n=f.current.get(e);!n||t!=null&&n.token!==t||(LEe(n.state),f.current.delete(e))},[]);(0,G.useEffect)(()=>{_(e=>e===h?e:h)},[h]),(0,G.useLayoutEffect)(()=>{if(m.current===g){m.current=null;return}let e=d.current.get(g),t=fj(l.current,g,u),n=t?.panel??l.current?.getPanel(g)??null;NEe(n,e),PEe(n,t?.viewport??null,e)},[g,u]),(0,G.useEffect)(()=>{let e=fj(l.current,g,u),t=e?.contentScrollRoot;if(!e||!t||t===e.panel)return;let n=()=>{let e=d.current.get(g);e&&d.current.set(g,{...e,contentScrollTop:t.scrollTop})};return n(),t.addEventListener(`scroll`,n,{passive:!0}),()=>{t.removeEventListener(`scroll`,n)}},[g,u]),(0,G.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let t of d.current.keys())e.has(t)||d.current.delete(t);for(let t of Array.from(f.current.keys()))e.has(t)||y(t)},[y,t]),(0,G.useEffect)(()=>{d.current.clear(),b()},[b,s.pathname]),(0,G.useEffect)(()=>()=>{b()},[b]);let T=(0,G.useCallback)((e,t)=>{let{allowUnknownSelection:n,area:r,history:i,location:a,queryKey:o,router:s,selectedFromLocation:c,selectedTab:u,tabs:f,viewportSelector:p}=v.current;if(!new Set(f.map(e=>e.id)).has(e)&&!n)return;let h=t?.history??i,g=t?.transferScroll??!0;if(u===e&&c===e)return;let b=()=>{_(e);let t=zEe(a.pathname,a.search,a.hash,o,e);if(qa()){if(s){s.navigate({href:t,replace:h===`replace`,state:a.state});return}UEe(t,h===`replace`,a.state);return}let n=gj(a.pathname,r);if(h===`replace`){Oo.replace(n,t,a.state);return}Oo.push(n,t,a.state)};if(!g){let n=x(u,p);if(n&&d.current.set(u,n),m.current=e,!t?.animate||u===e){b();return}let i=JA(f,u,e);if(!i){b();return}Ep({intent:{area:gj(a.pathname,r),kind:`tab-carousel`,direction:i},collectBeforeEntries:()=>_j(l.current,u),collectAfterEntries:()=>_j(l.current,e),update:b});return}let T=JA(f,u,e),E=(t,n)=>{let i=x(u,p),o=d.current.get(e)??i??x(e,p),s=S(u,p,i);if(!t){(0,Ca.flushSync)(()=>{b()});let t=C(e,p,o);t!=null&&w(e,t),s!=null&&y(u,s);return}let c=null;Ep({intent:{area:gj(a.pathname,r),kind:`tab-carousel`,direction:n},collectBeforeEntries:()=>_j(l.current,u),collectAfterEntries:()=>(c??=C(e,p,o),_j(l.current,e)),update:b}).finally(()=>{c??=C(e,p,o),c!=null&&w(e,c),s!=null&&y(u,s)})};if(!t?.animate||u===e){E(!1);return}if(!T){E(!1);return}E(!0,T)},[S,x,y,w,C]);return{tabsRef:l,selectedTab:g,setSelectedTab:T,onTabChange:(0,G.useCallback)(e=>{T(e,{animate:!0})},[T])}}var yj=null,GEe=e=>{let t=`--tabs-button-${e}`;return String.raw`
1209
+ `,[])),(0,K.jsx)(`dialog`,{ref:h,"aria-labelledby":_,className:`openspec-dialog m-0 h-dvh w-screen max-w-none border-0 bg-transparent p-0 ${c}`,children:(0,K.jsx)(`div`,{className:`flex h-full w-full items-center justify-center px-4 py-4 ${l} ${u}`,children:(0,K.jsxs)(`div`,{ref:g,className:`@container/dialog bg-background text-foreground relative flex h-fit w-[calc(100%-0.5rem)] max-w-2xl flex-col overflow-hidden rounded-[var(--openspec-dialog-radius,0.75rem)] border shadow-xl ${y} ${d}`,style:{maxHeight:p},children:[(0,K.jsxs)(`div`,{className:`border-border flex flex-none shrink-0 items-center justify-between gap-3 border-b px-4 py-3`,children:[(0,K.jsx)(`div`,{id:_,className:`min-w-0 flex-1`,children:t}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[n,(0,K.jsx)(`button`,{onClick:r,className:`hover:bg-muted rounded p-1`,"aria-label":`Close dialog`,children:(0,K.jsx)(Wm,{className:`h-4 w-4`})})]})]}),(0,K.jsx)(`div`,{className:`scrollbar-thin scrollbar-track-transparent min-h-0 flex-1 overflow-auto px-4 py-3 ${f}`,children:o}),s&&(0,K.jsx)(`div`,{className:`border-border flex flex-none shrink-0 items-center justify-end gap-2 border-t px-4 py-3`,children:s})]})})})}function RTe(){return(0,K.jsx)(Ra,{})}var SA={layout:{alignY:`center`,width:`wide`,topGap:`comfortable`},dialogClassName:``,panelClassName:``,bodyClassName:`p-0`,maxHeight:`90vh`,title:void 0,headerActions:void 0,onDismissRequest:void 0},CA=(0,G.createContext)(null),wA=(0,G.createContext)(null);function zTe({children:e}){let[t,n]=(0,G.useState)(SA),[r,i]=(0,G.useState)(0),a=(0,G.useCallback)(e=>{n({...SA,...e})},[]),o=(0,G.useCallback)(()=>{n(SA)},[]),s=(0,G.useCallback)(()=>{i(e=>e+1)},[]),c=(0,G.useMemo)(()=>({config:t,setConfig:a,resetConfig:o}),[t,o,a]),l=(0,G.useMemo)(()=>({requestClose:s,closeRequestVersion:r}),[r,s]);return(0,K.jsx)(CA.Provider,{value:c,children:(0,K.jsx)(wA.Provider,{value:l,children:e})})}function TA(){let e=(0,G.useContext)(CA);if(!e)throw Error(`usePopAreaConfigContext must be used within PopAreaConfigProvider`);return e}function EA(){let e=(0,G.useContext)(wA);if(!e)throw Error(`usePopAreaLifecycleContext must be used within PopAreaConfigProvider`);return e}var DA=null;function BTe(e){DA=e}function VTe(e){return e===`/search`?`Search`:e===`/notifications`?`Notifications`:e===`/opsx-new`?`OPSX New`:e===`/opsx-propose`?`OPSX Propose`:e===`/opsx-verify`?`OPSX Verify`:e===`/opsx-compose`?`OPSX Compose`:`Panel`}function HTe(){let e=ko(),{config:t,resetConfig:n}=TA(),{requestClose:r,closeRequestVersion:i}=EA(),a=(0,G.useRef)(0),o=(0,G.useMemo)(()=>t.dialogClassName,[t.dialogClassName]),s=(0,G.useMemo)(()=>[t.layout.alignY===`start`?`items-start`:t.layout.alignY===`end`?`items-end`:`items-center`,t.layout.alignY===`start`?t.layout.topGap===`none`?`pt-[env(safe-area-inset-top)]`:t.layout.topGap===`compact`?`pt-[max(0.5rem,env(safe-area-inset-top))] sm:pt-3`:`pt-[max(0.75rem,env(safe-area-inset-top))] sm:pt-5`:``,t.layout.alignY===`end`?`pb-[max(1rem,env(safe-area-inset-bottom))]`:``].filter(e=>e.length>0).join(` `),[t.layout.alignY,t.layout.topGap]),c=(0,G.useMemo)(()=>t.layout.width===`narrow`?`max-w-2xl`:t.layout.width===`normal`?`max-w-3xl`:t.layout.width===`full`?`max-w-[min(96vw,1280px)]`:`max-w-4xl`,[t.layout.width]);(0,G.useEffect)(()=>{i<=a.current||(a.current=i,e.popActive&&Bp.deactivatePop())},[i,e.popActive]);let l=(0,G.useCallback)(()=>{n()},[n]);return DA?(0,K.jsx)(xA,{open:e.popActive,onClose:r,onClosed:l,title:t.title??(0,K.jsx)(`span`,{className:`font-nav tracking-[0.04em]`,children:VTe(e.popLocation.pathname)}),headerActions:t.headerActions,dialogClassName:o,contentClassName:s,contentShellClassName:`pop-area-vt-shell`,className:[`pop-area-panel`,c,t.panelClassName].filter(e=>e.length>0).join(` `),bodyClassName:t.bodyClassName,maxHeight:t.maxHeight,onDismissRequest:t.onDismissRequest,children:(0,K.jsx)(Ba,{router:DA})}):null}function UTe(){return DA?(0,K.jsx)(zTe,{children:(0,K.jsx)(HTe,{})}):null}var OA=`>=1.3.0 <1.5.0`,kA=`>=1.4.0 <1.5.0`;function WTe(e){if(!e)return null;let t=e.match(/(\d+)\.(\d+)\.(\d+)/);return t?{major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}:null}function AA(e){return`${e.major}.${e.minor}.${e.patch}`}function jA(e,t){let[n,r]=t.split(`.`).map(e=>Number(e));return e.major===n&&e.minor===r}function GTe(e){let t=WTe(e);return t?jA(t,`1.4`)?{rawVersion:e,version:t,status:`current`,supported:!0,recommended:!0,blocksCoreInteractions:!1,message:`OpenSpec CLI ${AA(t)} matches the OpenSpecUI 4.x target line.`}:jA(t,`1.3`)?{rawVersion:e,version:t,status:`legacy-compatible`,supported:!0,recommended:!1,blocksCoreInteractions:!1,message:`OpenSpec CLI ${AA(t)} is legacy-compatible with OpenSpecUI 4.x. Upgrade to ${kA} for the current line.`}:{rawVersion:e,version:t,status:`unsupported`,supported:!1,recommended:!1,blocksCoreInteractions:!0,message:`Detected OpenSpec CLI ${AA(t)}, but OpenSpecUI 4.x accepts ${OA}.`}:{rawVersion:e,version:null,status:`unknown`,supported:!1,recommended:!1,blocksCoreInteractions:!0,message:`Unable to parse OpenSpec CLI version.`}}function KTe(e,t=[]){let n=e=>e?/[\s"'\\]/.test(e)?JSON.stringify(e):e:`""`;return[e,...t].map(n).join(` `)}function qTe(){if(qa())return null;let{data:e}=op(),{data:t,isLoading:n,refetch:r,isFetching:i}=Br({...tp.cli.checkAvailability.queryOptions(),staleTime:0,gcTime:0}),[a,o]=(0,G.useState)(``),s=(0,G.useMemo)(()=>e?.cli?.command?KTe(e.cli.command,e.cli.args??[]):``,[e?.cli?.args,e?.cli?.command]);(0,G.useEffect)(()=>{o(s)},[s]),(0,G.useEffect)(()=>{r()},[e?.cli?.command,e?.cli?.args,r]);let c=Vr({mutationFn:e=>X.config.update.mutate({cli:{command:e}}),onSuccess:async()=>{await Promise.allSettled([r(),Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter()),Xf.invalidateQueries(tp.config.getEffectiveCliCommand.queryFilter())])}});if(n)return null;let l=GTe(t?.version);if(t?.available&&l.status===`current`)return null;if(t?.available&&l.status===`legacy-compatible`)return(0,K.jsx)(`div`,{className:`fixed bottom-4 right-4 z-40 mx-4 max-w-sm rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 text-sm shadow-lg backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(Qp,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-300`}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`div`,{className:`font-medium`,children:[`OpenSpec CLI `,t.version,` is legacy-compatible`]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`OpenSpecUI `,4,`.x accepts `,OA,`. Upgrade to `,kA,` for the current line.`]})]})]})});let u=i||c.isPending,d=t?.available?l.message:t?.error||`OpenSpec CLI not found.`;return(0,K.jsx)(`div`,{className:`bg-background/80 fixed inset-0 z-50 flex items-center justify-center backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`border-border bg-background mx-4 max-w-xl space-y-4 rounded-lg border p-6 shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Qp,{className:`h-5 w-5 text-amber-500`}),`OpenSpec CLI `,OA,` Required`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:d}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`Execute Path`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Set the exact command used to run OpenSpec. Save will immediately re-check availability.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. openspec or "C:\\\\Program Files\\\\PowerShell\\\\7\\\\pwsh.exe" -File "D:\\\\a b\\\\openspec.ps1"`,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2 font-mono text-sm`}),(0,K.jsx)(`button`,{onClick:()=>c.mutate(a),disabled:c.isPending||a.trim()===s,className:`bg-primary text-primary-foreground rounded-md px-4 py-2 text-sm hover:opacity-90 disabled:opacity-50`,children:c.isPending?`Saving...`:`Save`})]})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[`Install or upgrade the CLI:`,(0,K.jsx)(`code`,{className:`bg-muted ml-2 rounded px-1`,children:`npm install -g @fission-ai/openspec`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:(0,K.jsxs)(`button`,{onClick:()=>void r(),disabled:u,className:`border-border hover:bg-muted flex items-center gap-2 rounded-md border px-3 py-1.5 disabled:opacity-50`,children:[u?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Bm,{className:`h-4 w-4`}),u?`Checking...`:`Recheck`]})})]})})}var MA=(0,G.createContext)(null);function JTe({children:e}){let[t,n]=(0,G.useState)({open:!1,changeId:``,changeName:``}),r=(0,G.useCallback)((e,t)=>{n({open:!0,changeId:e,changeName:t})},[]),i=(0,G.useCallback)(()=>{n(e=>({...e,open:!1}))},[]);return(0,K.jsx)(MA.Provider,{value:{state:t,openArchiveModal:r,closeArchiveModal:i},children:e})}function YTe(){let e=(0,G.useContext)(MA);if(!e)throw Error(`useArchiveModal must be used within ArchiveModalProvider`);return e}function NA(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}function PA(e,t){return`${e}${t.length>0?` ${t.join(` `)}`:``}`}function XTe(e){return e.some(e=>e.status===`loading`||e.status===`running`)?`running`:e.some(e=>e.status===`error`)?`error`:e.length>0&&e.every(e=>e.status===`success`)?`success`:`idle`}function FA(e={}){let[t,n]=(0,G.useState)([]),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)([]),u=(0,G.useRef)(e);(0,G.useEffect)(()=>{u.current=e},[e]);let d=(0,G.useCallback)(e=>{let t=e(l.current);l.current=t,n(t)},[]);(0,G.useEffect)(()=>{l.current=t},[t]);let f=(0,G.useCallback)(()=>{s.current?.unsubscribe?.(),s.current=null,c.current=null,l.current=[],n([]),i([]),o(null)},[]),p=(0,G.useCallback)(()=>{s.current?.unsubscribe?.(),s.current=null;let e=c.current;e&&(d(t=>t.map(t=>t.id===e?{...t,status:`error`,exitCode:null}:t)),i(t=>[...t,{id:NA(),commandId:e,kind:`meta`,text:`Process cancelled by user`,tone:`error`}])),c.current=null},[d]),m=(0,G.useCallback)((e,t=[],n=-1)=>{let r=NA();return d(i=>{let a=[...i],o={id:r,command:e,args:t,status:`idle`,exitCode:null};return n>=0&&n<a.length?a.splice(n,0,o):a.push(o),a}),r},[]),h=(0,G.useCallback)(e=>{d(t=>t.filter(t=>t.id!==e)),i(t=>t.filter(t=>t.commandId!==e)),c.current===e&&p()},[p,d]),g=(0,G.useCallback)(e=>{s.current?.unsubscribe?.(),s.current=null,c.current=null,i([]),o(null),d(()=>e.map(e=>({id:NA(),command:e.command,args:e.args??[],status:`idle`,exitCode:null})))},[d]),_=(0,G.useCallback)(()=>[...l.current],[]),v=(0,G.useCallback)(e=>{i(t=>[...t,e])},[]),y=(0,G.useCallback)(async e=>{if(qa())return console.warn(`CLI runner is disabled in static mode`),null;let t=e??l.current.find(e=>e.status===`idle`)?.id,n=l.current.find(e=>e.id===t);if(!n)return null;s.current?.unsubscribe?.(),c.current=n.id,d(e=>e.map(e=>e.id===n.id?{...e,status:`loading`,exitCode:null}:e));let r=()=>{},i=new Promise(e=>{r=e}),a={data:new Set,error:new Set,close:new Set,exit:new Set},f=(e,t)=>{a[e].forEach(e=>e(t))},m={id:n.id,command:n.command,args:n.args,status:`loading`,exitCode:null,done:i,on:(e,t)=>(a[e].add(t),()=>a[e].delete(t)),cancel:()=>{p()}};u.current.onCreateProcess?.(m);let h=X.cli.runCommandStream.subscribe({command:n.command,args:n.args},{onData:e=>{if(e.type===`command`){d(e=>e.map(e=>e.id===n.id?{...e,status:`running`}:e)),m.status=`running`,f(`data`,e.data??``);return}if(e.type===`stdout`&&e.data){v({id:NA(),commandId:n.id,kind:`stdout`,text:e.data}),f(`data`,e.data);return}if(e.type===`stderr`&&e.data){v({id:NA(),commandId:n.id,kind:`stderr`,text:e.data,tone:`error`}),f(`error`,e.data);return}if(e.type===`exit`){let t=e.exitCode??null;o(t);let i=t===0?`success`:`error`;d(e=>e.map(e=>e.id===n.id?{...e,status:i,exitCode:t}:e)),m.status=i,m.exitCode=t,v({id:NA(),commandId:n.id,kind:`meta`,text:`Process exited with code ${t??`unknown`}`,tone:t===0?`success`:`error`}),f(`close`,t),f(`exit`,t),r(t),s.current?.unsubscribe?.(),s.current=null,c.current=null}},onError:e=>{let t=e instanceof Error?e.message:String(e);d(e=>e.map(e=>e.id===n.id?{...e,status:`error`,exitCode:null}:e)),m.status=`error`,v({id:NA(),commandId:n.id,kind:`meta`,text:`Error: ${t}`,tone:`error`}),f(`error`,t),r(null),s.current?.unsubscribe?.(),s.current=null,c.current=null}});return m.status=`running`,s.current=h,m},[v,p,d]),b=(0,G.useCallback)(async()=>{let e=l.current.find(e=>e.status===`idle`);for(;e;){let t=await y(e.id);if(!t||await t.done!==0)break;e=l.current.find(e=>e.status===`idle`)}},[y]);return(0,G.useEffect)(()=>()=>{p()},[p]),{lines:(0,G.useMemo)(()=>t.flatMap(e=>{let t=e.status===`loading`?(0,K.jsx)(Em,{className:`h-3 w-3 animate-spin text-sky-300`}):e.status===`running`?(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-amber-200`,children:[(0,K.jsx)(Rm,{className:`h-3 w-3 animate-pulse`}),(0,K.jsx)(Em,{className:`h-3 w-3 animate-spin`})]}):e.status===`success`?(0,K.jsx)(Yp,{className:`h-3 w-3 text-green-400`}):e.status===`error`?(0,K.jsx)(em,{className:`h-3 w-3 text-red-400`}):null,n=e.status===`idle`?`# ${PA(e.command,e.args)}`:`$ ${PA(e.command,e.args)}`,i=[{id:`cmd-${e.id}`,kind:`html`,node:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:e.status===`running`?`terminal-shimmer`:e.status===`loading`?`animate-pulse text-blue-200`:e.status===`success`?`text-green-300`:e.status===`error`?`text-red-300`:`text-zinc-200`,children:n}),t]})}],a=r.filter(t=>t.commandId===e.id).map(e=>({id:e.id,kind:`ascii`,text:e.text,tone:e.tone}));return[...i,...a]}),[t,r]),status:(0,G.useMemo)(()=>XTe(t),[t]),exitCode:a,hasStarted:(0,G.useMemo)(()=>t.some(e=>e.status!==`idle`),[t]),commands:(0,G.useMemo)(()=>({add:m,remove:h,list:_,replaceAll:g,run:y,runAll:b}),[m,_,h,g,y,b]),reset:f,cancel:p}}var IA=(0,G.forwardRef)(function({lines:e,maxHeight:t=`60vh`,scrollRef:n},r){return(0,K.jsxs)(`div`,{ref:n??r,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-zinc-700 overflow-auto bg-zinc-900 p-4 font-mono text-sm text-zinc-100`,style:{maxHeight:t},children:[e.length===0&&(0,K.jsx)(`span`,{className:`text-zinc-500`,children:`Waiting to start…`}),e.map(e=>e.kind===`html`?(0,K.jsx)(`div`,{className:`whitespace-pre-wrap break-all`,children:e.node},e.id):(0,K.jsx)(`div`,{className:`whitespace-pre-wrap break-all`,children:(0,K.jsx)(`span`,{className:e.tone===`success`?`text-green-400`:e.tone===`error`?`text-red-400`:e.tone===`info`?`text-blue-300`:void 0,children:ZTe(e.text)})},e.id))]})});function ZTe(e){let t=[],n=0,r=null,i=/\x1b\[(\d+)m/g,a;for(;(a=i.exec(e))!==null;){if(a.index>n){let i=e.slice(n,a.index);t.push(r?(0,K.jsx)(`span`,{className:r,children:i},n):i)}let i=parseInt(a[1],10);i===0?r=null:i===31?r=`text-red-400`:i===32?r=`text-green-400`:i===33?r=`text-yellow-400`:i===34?r=`text-blue-400`:i===35?r=`text-fuchsia-300`:i===36?r=`text-cyan-300`:(i===37||i===90)&&(r=`text-zinc-400`),n=a.index+a[0].length}if(n<e.length){let i=e.slice(n);t.push(r?(0,K.jsx)(`span`,{className:r,children:i},n):i)}return t.length>0?t:e}function LA({checked:e,onCheckedChange:t,ariaLabel:n,id:r,name:i,required:a,disabled:o,readOnly:s,onBlur:c,onFocus:l,className:u,thumbClassName:d}){let f=()=>{o||s||t(!e)};return(0,K.jsxs)(K.Fragment,{children:[i?(0,K.jsx)(`input`,{type:`hidden`,name:i,value:e?`on`:``,required:a,disabled:o}):null,(0,K.jsx)(`button`,{id:r,type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,disabled:o,"aria-readonly":s||void 0,onClick:f,onBlur:c,onFocus:l,className:bh(`inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent p-0.5 outline-none transition-colors`,`focus-visible:ring-primary focus-visible:ring-1`,e?`border-primary bg-primary`:`bg-muted-foreground/30 hover:bg-muted-foreground/40`,o&&`cursor-not-allowed opacity-50`,s&&!o&&`cursor-default`,u),children:(0,K.jsx)(`span`,{"aria-hidden":`true`,className:bh(`pointer-events-none block h-5 w-5 rounded-full bg-white transition-transform`,e?`translate-x-5`:`translate-x-0`,d)})})]})}function QTe(){let e=Ip(),{state:t,closeArchiveModal:n}=YTe(),{open:r,changeId:i,changeName:a}=t,[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),{lines:f,status:p,hasStarted:m,commands:h,reset:g,cancel:_}=FA({onCreateProcess:e=>{e.on(`data`,e=>{let t=/Change ['"](.+?)['"] archived as ['"](.+?)['"]/.exec(String(e));t?.[2]&&d(t[2])})}});(0,G.useEffect)(()=>{r&&(s(!1),l(!1),d(null))},[r]);let v=()=>{_(),g(),s(!1),l(!1),d(null),n()},y=(0,G.useCallback)(()=>{if(!i)return[];let e=[];c||e.push({command:`openspec`,args:[`validate`,i]});let t=[`archive`,`-y`,i];return o&&t.push(`--skip-specs`),t.push(`--no-validate`),e.push({command:`openspec`,args:t}),e},[i,c,o]),b=p===`running`,x=p===`success`&&!!u,S=p===`success`&&!u,C=x?`success`:S?`error`:p,w=u??``,T=()=>{i&&h.runAll()},E=()=>{g(),s(!1),l(!1),d(null)};return(0,G.useEffect)(()=>{if(!r||!i||m)return;let e=y();h.replaceAll(e)},[y,i,h,m,r]),!r||!i?null:(0,K.jsx)(xA,{open:r,onClose:v,onDismissRequest:null,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C===`success`?(0,K.jsx)($p,{className:`h-5 w-5 text-green-500`}):(0,K.jsx)(Up,{className:`h-5 w-5 text-red-500`}),(0,K.jsxs)(`span`,{className:`font-semibold`,children:[`Archive: `,a]})]}),footer:C===`success`&&w?(0,K.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-sm text-green-600`,children:[`Archived as `,w]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:v,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2`,children:`Close`}),(0,K.jsx)(`button`,{onClick:()=>{v(),e({href:`/archive/${encodeURIComponent(w)}`})},className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!w,children:`View Archive`})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{onClick:E,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2`,children:C===`error`?`Reset & Retry`:`Reset`}),(0,K.jsx)(`button`,{onClick:v,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:b,children:`Close`}),(0,K.jsxs)(`button`,{onClick:C===`error`?E:T,disabled:b,className:`flex items-center gap-2 rounded-md bg-red-600 px-4 py-2 text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-50`,children:[b?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Up,{className:`h-4 w-4`}),C===`error`?`Reset before Archive`:`Archive`]})]}),borderVariant:C===`error`?`error`:C===`success`?`success`:`default`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`bg-muted/50 rounded-lg p-3`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Change to archive:`}),(0,K.jsx)(`p`,{className:`font-medium`,children:a}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`ID: `,i]})]}),(0,K.jsx)(IA,{lines:f,maxHeight:`50vh`}),S&&(0,K.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-100 px-3 py-2 text-sm text-amber-900`,children:`Archive output did not include the archived change name. Treating archive as failed.`}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Options`}),(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Skip specs update`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Don't update spec files with delta changes (--skip-specs)`})]}),(0,K.jsx)(LA,{checked:o,onCheckedChange:s,ariaLabel:`Skip specs update`,disabled:m})]}),(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Skip validation`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Don't validate the change before archiving (--no-validate)`})]}),(0,K.jsx)(LA,{checked:c,onCheckedChange:l,ariaLabel:`Skip validation`,disabled:m})]})]})]})})}function RA(e,t){let n=new URL(t,`http://openspecui.local`).pathname;return e.mainLocation.pathname===n||e.mainLocation.pathname.startsWith(`${n}/`)||e.bottomLocation.pathname===n||e.bottomLocation.pathname.startsWith(`${n}/`)}function $Te(e,t){if(t.source.type!==`terminal`)return!1;let n=uA.getLocalSessionIdForServerSession(t.source.sessionId);return n?RA(e,`/terminal`)&&uA.isSessionActive(n):!1}function eEe(e){let t=e.actions.find(e=>e.type===`href.open`);return t?new URL(t.target.href,`http://openspecui.local`).pathname:e.actions.some(e=>e.type===`terminal.focus`)?`/terminal`:null}function tEe(e,t){for(let n of t.actions)if(n.type===`terminal.focus`&&$Te(e,t)||n.type===`href.open`&&RA(e,n.target.href))return!0;return!1}function nEe(e){return e.popActive&&e.popLocation.pathname===`/notifications`}function rEe(e){let{notification:t,navLayout:n}=e;return!t||nEe(n)?!1:!tEe(n,t)}var iEe=5200,aEe=340,zA=`border-primary bg-primary text-primary-foreground hover:bg-primary/90 inline-flex h-8 w-8 items-center justify-center rounded-md border transition disabled:cursor-not-allowed disabled:border-border disabled:bg-muted disabled:text-muted-foreground disabled:opacity-50`;function oEe(e,t){return`${new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} - ${t} unread`}function sEe(e){return e.body.trim()||e.title}function cEe(e){return im}function lEe(){let e=ko(),{notifications:t,latestNotification:n,unreadCount:r,resolveAction:i,markRead:a}=gA(),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(`hidden`),u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=o?eEe(o):null,m=p?Oo.getAreaForPath(p):`main`,h=pA(),g=(0,G.useCallback)(()=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),l(e=>e===`hidden`?e:`exiting`)},[]);(0,G.useEffect)(()=>{let t=n?.id??null;if(!n||u.current===t)return;if(u.current=t,!rEe({notification:n,navLayout:e})){g();return}d.current!==null&&(window.clearTimeout(d.current),d.current=null),f.current!==null&&(window.clearTimeout(f.current),f.current=null),s(n),l(`entering`);let r=window.requestAnimationFrame(()=>{l(`visible`)});return d.current=window.setTimeout(()=>{g()},iEe),()=>{window.cancelAnimationFrame(r)}},[g,n,e]),(0,G.useEffect)(()=>{o&&(t.some(e=>e.id===o.id)||g())},[g,t,o]),(0,G.useEffect)(()=>{if(c===`exiting`)return f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{s(null),l(`hidden`),f.current=null},aEe),()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[c]),(0,G.useEffect)(()=>()=>{d.current!==null&&window.clearTimeout(d.current),f.current!==null&&window.clearTimeout(f.current)},[]);let _=(0,G.useMemo)(()=>{if(!o)return null;let e=o.actions.map(e=>i(o,e,{markReadOnRun:!0}));return e.find(e=>!e.disabled)??e[0]??null},[i,o]);return!o||c===`hidden`?null:(0,K.jsx)(`div`,{className:`notification-toast-viewport pointer-events-none fixed z-40`,"aria-live":`polite`,"aria-atomic":`true`,children:(0,K.jsxs)(`article`,{className:`notification-toast pointer-events-auto`,"data-state":c===`exiting`?`closed`:`open`,"data-target-area":m,children:[(0,K.jsx)(`div`,{className:`border-border/60 bg-background flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-md border`,children:h?(0,K.jsx)(`img`,{src:h,alt:``,className:`h-full w-full object-cover`,draggable:!1}):(0,K.jsx)(`span`,{className:`bg-primary block h-5 w-5`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium leading-5`,children:sEe(o)}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 truncate text-[11px] leading-none`,children:oEe(o,r)})]}),(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:_?(0,K.jsx)(uEe,{resolved:_,onDone:g}):(0,K.jsx)(Xy,{content:`Dismiss`,children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>{a(o.id).then(g)},className:zA,"aria-label":`Dismiss notification`,children:(0,K.jsx)(Yp,{className:`h-3.5 w-3.5`})})})})]})})}function uEe({resolved:e,onDone:t}){let n=cEe(e.action.type);return(0,K.jsx)(Xy,{content:e.disabled?e.reason:e.action.label,children:(0,K.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>{e.run().then(t)},className:zA,"aria-label":e.action.label,children:(0,K.jsx)(n,{className:`h-3.5 w-3.5`})})})}function dEe(e){let{handoff:t,location:n}=e,r=new URL(n.href),i=new URL(t.serverUrl);return Wa({search:n.search}).hosted?(i.pathname=r.pathname,i.search=r.search,i.hash=r.hash,i.searchParams.set(`api`,t.serverUrl),i.toString()):(i.pathname=r.pathname,i.search=r.search,i.hash=r.hash,i.toString())}function BA(e){window.location.assign(dEe(e))}function fEe(e,t){return`${e}:${t}`}function pEe(e){return`openspecui-project-recovery:${encodeURIComponent(e)}`}function mEe(e){switch(e.state){case`evicted`:return{title:`Current Worktree Evicted`,detail:`The current project directory disappeared. Resolving an automatic fallback worktree now.`,busy:!0};case`resolving`:return{title:`Resolving Recovery Target`,detail:`OpenSpecUI is locating an existing default-branch worktree to keep this session alive.`,busy:!0};case`ready`:return{title:`Switching To Fallback Worktree`,detail:`A surviving default-branch worktree was found. Redirecting this session now.`,busy:!0};case`unavailable`:return{title:`Automatic Recovery Unavailable`,detail:e.message,busy:!1};case`failed`:return{title:`Automatic Recovery Failed`,detail:e.message,busy:!1};case`idle`:return{title:``,detail:``,busy:!1}}}function hEe(){let e=ab(),t=(0,G.useRef)(new Set),n=e.projectRecovery;(0,G.useEffect)(()=>{if(n.state!==`ready`||!e.projectDir)return;let r=fEe(e.projectDir,n.detectedAt),i=pEe(r),a=t.current.has(r);if(!a)try{a=sessionStorage.getItem(i)!==null}catch{a=!1}if(a){t.current.add(r);return}t.current.add(r);try{sessionStorage.setItem(i,n.handoff.serverUrl)}catch{}BA({handoff:n.handoff,location:window.location})},[n,e.projectDir]);let r=(0,G.useMemo)(()=>mEe(n),[n]);return n.state===`idle`?null:(0,K.jsx)(`div`,{className:`bg-background/80 fixed inset-0 z-[60] flex items-center justify-center backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`border-border bg-background mx-4 max-w-xl space-y-4 rounded-lg border p-6 shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[r.busy?(0,K.jsx)(Em,{className:`h-5 w-5 animate-spin text-amber-500`}):(0,K.jsx)(Qp,{className:`h-5 w-5 text-amber-500`}),r.title]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r.detail}),e.projectDir?(0,K.jsxs)(`div`,{className:`bg-muted text-muted-foreground break-all rounded-md px-3 py-2 font-mono text-xs`,children:[`Source: `,e.projectDir]}):null,(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Gp,{className:`h-4 w-4`}),`Recovery preserves the current route and only swaps the backend/worktree target.`]}),r.busy?null:(0,K.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:(0,K.jsx)(`button`,{onClick:()=>{window.location.reload()},className:`border-border hover:bg-muted rounded-md border px-3 py-1.5`,children:`Reload`})})]})})}function gEe({onResize:e,minHeight:t=100,maxHeight:n}){let r=(0,G.useRef)(0),i=(0,G.useRef)(0),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!1),c=(0,G.useCallback)(a=>{let o=r.current-a,s=Math.max(t,i.current+o),c=n??window.innerHeight*.7;e(Math.min(s,c))},[t,n,e]),l=(0,G.useCallback)(e=>{r.current=e,i.current=a.current?.nextElementSibling?.offsetHeight??300,s(!0),document.body.style.userSelect=`none`},[]),u=(0,G.useCallback)(()=>{s(!1),document.body.style.userSelect=``},[]);return(0,G.useEffect)(()=>{if(!o)return;let e=e=>{c(e.clientY)},t=()=>{u()},n=e=>{let t=e.touches[0];t&&(e.preventDefault(),c(t.clientY))},r=()=>{u()};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),document.addEventListener(`touchmove`,n,{passive:!1}),document.addEventListener(`touchend`,r),document.addEventListener(`touchcancel`,r),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t),document.removeEventListener(`touchmove`,n),document.removeEventListener(`touchend`,r),document.removeEventListener(`touchcancel`,r)}},[c,o,u]),(0,G.useEffect)(()=>()=>{document.body.style.userSelect=``},[]),(0,K.jsx)(`div`,{ref:a,className:`border-border/20 relative h-2 shrink-0 border-b border-t`,children:(0,K.jsx)(`div`,{onMouseDown:(0,G.useCallback)(e=>{e.preventDefault(),l(e.clientY)},[l]),onTouchStart:(0,G.useCallback)(e=>{let t=e.touches[0];t&&(e.preventDefault(),l(t.clientY))},[l]),className:`group absolute inset-x-0 -bottom-1 -top-1 z-10 flex cursor-row-resize touch-none items-center justify-center transition-colors ${o?`bg-muted/50`:`hover:bg-muted/50`}`,children:(0,K.jsx)(`div`,{className:`h-0.5 w-8 rounded-full transition-colors ${o?`bg-muted-foreground/80`:`bg-muted-foreground/30 group-hover:bg-muted-foreground/60`}`})})})}function _Ee(){return(0,K.jsx)(`div`,{className:`scrollbar-thin scrollbar-track-transparent flex h-full min-h-0 flex-col overflow-auto`,children:(0,K.jsx)(Ra,{})})}var VA=null;function vEe(e){VA=e}function yEe({height:e}){return VA?(0,K.jsx)(`div`,{className:`bottom-area scrollbar-thin scrollbar-track-transparent min-h-0 overflow-auto ${e==null?`flex-1`:`shrink-0`}`,style:e==null?void 0:{height:e,minHeight:100},children:(0,K.jsx)(Ba,{router:VA})}):null}function bEe(){let e=ko(),t=qa(),n=t||e.mainTabs.length>0,r=!t&&e.bottomActive,[i,a]=(0,G.useState)(300),o=(0,G.useCallback)(e=>{a(e)},[]);return(0,K.jsxs)(`div`,{className:`@container/app fixed inset-0`,style:{containerName:`app`},children:[(0,K.jsxs)(`div`,{className:`app-layout h-full`,children:[(0,K.jsx)(Lme,{}),(0,K.jsxs)(`div`,{className:`app-body flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(hEe,{}),(0,K.jsx)(qTe,{}),(0,K.jsx)(ITe,{}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[n&&(0,K.jsx)(`main`,{className:`main-content scrollbar-thin scrollbar-track-transparent view-transition-route flex min-h-0 flex-col flex-1`,children:(0,K.jsx)(Ra,{})}),n&&r&&(0,K.jsx)(gEe,{onResize:o}),r&&(0,K.jsx)(yEe,{height:n?i:void 0})]}),(0,K.jsx)(LTe,{}),(0,K.jsx)(FTe,{})]})]}),(0,K.jsx)(QTe,{}),(0,K.jsx)(UTe,{}),!t&&(0,K.jsx)(lEe,{})]})}var HA=`theme`;function UA(){if(typeof window>`u`)return`system`;let e=window.localStorage.getItem(HA);return e===`light`||e===`dark`||e===`system`?e:`system`}function WA(e){typeof window>`u`||window.localStorage.setItem(HA,e)}function GA(e){if(typeof window>`u`)return;let t=document.documentElement;if(e===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches;t.classList.toggle(`dark`,e);return}t.classList.toggle(`dark`,e===`dark`)}function xEe(){let{data:e}=op(),t=e?.theme??UA();return(0,G.useEffect)(()=>{GA(t),WA(t)},[t]),(0,G.useEffect)(()=>{if(t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>GA(`system`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[t]),null}function KA(e,t){let n=ei({getLocation(){return t.getLocation(e)},getLength(){return window.history.length},pushState(n,r){t.push(e,n,r)},replaceState(n,r){t.replace(e,n,r)},go(e){window.history.go(e)},back(){window.history.back()},forward(){window.history.forward()},createHref(n){return t.createHref(e,n)}});return t.setHistoryRef(e,n),n}function qA(e){if(!e)return``;let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24),o=Math.floor(a/7),s=Math.floor(a/30),c=Math.floor(a/365);return n<60?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:a<7?`${a}d ago`:o<4?`${o}w ago`:s<12?`${s}mo ago`:`${c}y ago`}function SEe(e){return e?new Date(e).toLocaleString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}):``}function CEe(){let{data:e,isLoading:t}=dce(),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{let e=requestAnimationFrame(()=>r(!1));return()=>cancelAnimationFrame(e)},[]),n||t&&!e?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading archived changes...`}):(0,K.jsxs)(`div`,{className:`space-y-6 p-4`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(Up,{className:`h-6 w-6 shrink-0`}),`Archive`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Completed changes that have been archived after implementation.`}),(0,K.jsxs)(`div`,{className:`border-border divide-border divide-y rounded-lg border`,children:[e?.map(e=>{let t={family:`archive`,entityId:e.id};return(0,K.jsxs)(Lp,{to:`/archive/$changeId`,params:{changeId:e.id},state:t=>({...t,__vtHandoff:{family:`archive`,entityId:e.id,title:e.name,subtitle:e.id}}),vt:{sharedElements:t},...kp(t,`container`),className:`hover:bg-muted/50 flex items-center justify-between p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(Up,{...kp(t,`icon`),className:`text-muted-foreground h-5 w-5`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{...kp(t,`title`),className:`font-medium`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[e.id,e.updatedAt>0&&(0,K.jsxs)(K.Fragment,{children:[` · `,qA(e.updatedAt)]})]})]})]}),(0,K.jsx)(Zp,{className:`text-muted-foreground h-4 w-4`})]},e.id)}),e?.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground p-8 text-center`,children:[(0,K.jsx)(Up,{className:`mx-auto mb-4 h-12 w-12 opacity-50`}),(0,K.jsx)(`p`,{children:`No archived changes yet.`}),(0,K.jsxs)(`p`,{className:`mt-2 text-sm`,children:[`Changes are archived after implementation using`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec archive`})]})]})]})]})}function JA(e,t,n){let r=e.findIndex(e=>e.id===t),i=e.findIndex(e=>e.id===n);return r<0||i<0||r===i?null:i>r?`forward`:`backward`}var YA=`tabVisibleHeight`,XA=`tabTopInset`,ZA=`tabScrollOffset`,QA=`tabLayoutBridge`,$A=`tabLayoutBridgeBasePadding`,ej=`tabLayoutBridgeInlinePadding`,tj=`[data-tab-scroll-root="true"]`;function nj(e,t,n){return Math.min(Math.max(e,t),n)}function rj(e){return Math.max(e.scrollHeight-e.clientHeight,0)}function ij(e,t){return Math.max(e.scrollHeight-t,0)}function wEe(e){return Number(e.dataset[QA]??`0`)||0}function TEe(e){e.dataset[$A]||=window.getComputedStyle(e).paddingBottom,e.dataset[ej]||=e.style.paddingBottom}function aj(e,t){TEe(e);let n=Math.max(Math.ceil(t),0);if(e.dataset[QA]=String(n),n<=0){e.style.paddingBottom=e.dataset[ej]??``;return}let r=e.dataset[$A]??`0px`;e.style.paddingBottom=`calc(${r} + ${n}px)`}function oj(e,t,n){let r=()=>{if(!e.isConnected||!t.isConnected)return!0;let r=wEe(t),i=Math.max(rj(e)-r,0);aj(t,Math.max(n-i,0));let a=nj(n,0,rj(e));return e.scrollTop=a,e.scrollTop===a};if(r()||typeof requestAnimationFrame!=`function`)return;let i=10,a=()=>{r()||i<=0||(--i,requestAnimationFrame(a))};requestAnimationFrame(a)}function sj(e){return e===`auto`||e===`scroll`||e===`overlay`}function EEe(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n=null;for(;t.nextNode();){let e=t.currentNode;if(e instanceof HTMLElement&&!(!sj(window.getComputedStyle(e).overflowY)||e.scrollHeight<=e.clientHeight)){if(e.scrollTop>0)return e;n??=e}}return n}function cj(e){return(e.matches(tj)?e:e.querySelector(tj))||EEe(e)}function DEe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return t.scrollTop+n.top-r.top}function OEe(e,t){e.dataset[YA]=String(t.visibleHeight),e.dataset[XA]=String(t.topInset),e.dataset[ZA]=String(t.innerScrollTop)}function kEe(e){delete e.dataset[YA],delete e.dataset[XA],delete e.dataset[ZA]}function lj(e,t){let n={height:e.style.height,maxHeight:e.style.maxHeight,minHeight:e.style.minHeight,overflowY:e.style.overflowY},r=`${t.visibleHeight}px`;return e.style.height=r,e.style.minHeight=r,e.style.maxHeight=r,e.style.overflowY=`hidden`,OEe(e,t),n}function uj(e,t){e.style.height=t.height,e.style.maxHeight=t.maxHeight,e.style.minHeight=t.minHeight,e.style.overflowY=t.overflowY,kEe(e)}function dj(e,t){if(!e)return;let n=()=>e.isConnected?(e.scrollTop=t,e.scrollTop===t):!0;if(n()||typeof requestAnimationFrame!=`function`)return;let r=10,i=()=>{n()||r<=0||(--r,requestAnimationFrame(i))};requestAnimationFrame(i)}function AEe(e){return typeof e==`string`?e.split(`,`).map(e=>e.trim()):[...e]}function jEe(e,t){let n=AEe(t);for(let t of n)if(t)try{let n=e.closest(t);if(n instanceof HTMLElement)return n}catch{return null}return null}function MEe(e,t){let n=e.parentElement;for(;n;){if(sj(window.getComputedStyle(n).overflowY)&&n.scrollHeight>n.clientHeight)return n;if(t&&n===t)break;n=n.parentElement}return t&&sj(window.getComputedStyle(t).overflowY)?t:null}function fj(e,t,n){if(!n)return null;let r=e?.getPanel(t);if(!(r instanceof HTMLElement))return null;let i=MEe(r,jEe(r,n));return i instanceof HTMLElement?{panel:r,contentScrollRoot:cj(r),viewport:i}:null}function NEe(e,t){if(!(e instanceof HTMLElement)||!t)return;let n=cj(e);n&&n!==e&&dj(n,t.contentScrollTop)}function PEe(e,t,n){if(!(!(e instanceof HTMLElement)||!(t instanceof HTMLElement))){if(!n){aj(e,0);return}oj(t,e,n.viewportScrollTop)}}function pj(e){let{panel:t,contentScrollRoot:n,viewport:r}=e,i=t.getBoundingClientRect(),a=r.getBoundingClientRect(),o=nj(Math.min(i.bottom,a.bottom)-Math.max(i.top,a.top),0,r.clientHeight);if(o<=0)return null;let s=Math.max(i.top-a.top,0),c=nj(Math.max(a.top-i.top,0),0,ij(t,o));return{contentScrollTop:n&&n!==t?n.scrollTop:0,innerScrollTop:c,topInset:s,visibleHeight:o,viewportScrollTop:r.scrollTop}}function FEe(e,t){let n=lj(e.panel,t);return e.contentScrollRoot&&e.contentScrollRoot!==e.panel&&dj(e.contentScrollRoot,t.contentScrollTop),e.panel.scrollTop=t.innerScrollTop,t.innerScrollTop>0&&(e.viewport.scrollTop=nj(e.viewport.scrollTop-t.innerScrollTop,0,rj(e.viewport))),{contentScrollRoot:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?e.contentScrollRoot:null,contentScrollTop:t.contentScrollTop,finalViewportScrollTop:t.viewportScrollTop,panel:e.panel,previousStyles:n,viewport:e.viewport}}function IEe(e,t){let n={contentScrollTop:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?t.contentScrollTop:0,topInset:nj(t.topInset,0,e.viewport.clientHeight),visibleHeight:nj(t.visibleHeight,1,e.viewport.clientHeight),innerScrollTop:0,viewportScrollTop:t.viewportScrollTop};n.innerScrollTop=nj(t.innerScrollTop,0,ij(e.panel,n.visibleHeight));let r=nj(DEe(e.panel,e.viewport)-n.topInset,0,rj(e.viewport)),i=lj(e.panel,n);return e.viewport.scrollTop=r,e.contentScrollRoot&&e.contentScrollRoot!==e.panel&&dj(e.contentScrollRoot,n.contentScrollTop),e.panel.scrollTop=n.innerScrollTop,{contentScrollRoot:e.contentScrollRoot&&e.contentScrollRoot!==e.panel?e.contentScrollRoot:null,contentScrollTop:n.contentScrollTop,finalViewportScrollTop:t.viewportScrollTop,panel:e.panel,previousStyles:i,viewport:e.viewport}}function LEe(e){uj(e.panel,e.previousStyles),oj(e.viewport,e.panel,e.finalViewportScrollTop),e.panel.scrollTop=0,e.contentScrollRoot&&dj(e.contentScrollRoot,e.contentScrollTop)}function mj(e){uj(e.panel,e.previousStyles),e.panel.scrollTop=0}var hj={pathname:`/`,search:``,hash:``,state:void 0};function REe(e){let t=new Set(e.tabs.map(e=>e.id)),n=new URLSearchParams(e.search).get(e.queryKey);return n&&(t.has(n)||e.allowUnknownSelection)?n:e.initialTab&&t.has(e.initialTab)?e.initialTab:e.tabs[0]?.id??``}function zEe(e,t,n,r,i){let a=new URLSearchParams(t);a.set(r,i);let o=a.toString();return`${e}${o.length>0?`?${o}`:``}${n}`}function gj(e,t){return t||(qa()?`main`:Oo.getAreaForPath(e))}function BEe(e){if(!e)return;let t=(typeof e==`string`?e.split(`,`):[...e]).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}function VEe(){return typeof window>`u`?hj:{pathname:window.location.pathname||`/`,search:window.location.search,hash:window.location.hash,state:window.history.state}}function HEe(e){let t=e.__store.state.location;return{pathname:t.pathname,search:t.searchStr,hash:t.hash,state:t.state}}function UEe(e,t,n){if(typeof window>`u`)return;let r=new URL(e,window.location.origin),i=`${r.pathname}${r.search}${r.hash}`;t?window.history.replaceState(n,``,i):window.history.pushState(n,``,i),window.dispatchEvent(new PopStateEvent(`popstate`,{state:window.history.state}))}function WEe(){let e=(0,G.useContext)(da()),t=(0,G.useRef)(hj);return{location:(0,G.useSyncExternalStore)((0,G.useCallback)(t=>e?.__store?e.__store.subscribe(()=>{t()}):typeof window>`u`?()=>{}:(window.addEventListener(`popstate`,t),window.addEventListener(`hashchange`,t),()=>{window.removeEventListener(`popstate`,t),window.removeEventListener(`hashchange`,t)}),[e]),(0,G.useCallback)(()=>{let n=e?.__store?HEe(e):VEe(),r=t.current;return r.pathname===n.pathname&&r.search===n.search&&r.hash===n.hash&&r.state===n.state?r:(t.current=n,n)},[e]),()=>hj),router:e}}function _j(e,t){if(!e)return[];let n=[],r=e.getHeaderShell();r&&n.push([r,`vt-tab-header-shell`]);let i=e.getSelectionIndicator();i&&n.push([i,`vt-tab-edge`]);let a=e.getHeaderForeground();a&&n.push([a,`vt-tab-header-foreground`]);let o=e.getPanel(t);return o&&n.push([o,`vt-tab-panel`]),n}function vj({queryKey:e,tabs:t,initialTab:n,area:r,history:i=`replace`,allowUnknownSelection:a=!1,viewportSelector:o}){let{location:s,router:c}=WEe(),l=(0,G.useRef)(null),u=(0,G.useMemo)(()=>BEe(o),[typeof o==`string`?o:(o??[]).join(`\0`)]),d=(0,G.useRef)(new Map),f=(0,G.useRef)(new Map),p=(0,G.useRef)(0),m=(0,G.useRef)(null),h=(0,G.useMemo)(()=>REe({tabs:t,queryKey:e,search:s.search,initialTab:n,allowUnknownSelection:a}),[a,n,s.search,e,t]),[g,_]=(0,G.useState)(h),v=(0,G.useRef)({allowUnknownSelection:a,area:r,history:i,location:s,queryKey:e,router:c,selectedFromLocation:h,selectedTab:g,tabs:t,viewportSelector:u});v.current={allowUnknownSelection:a,area:r,history:i,location:s,queryKey:e,router:c,selectedFromLocation:h,selectedTab:g,tabs:t,viewportSelector:u};let y=(0,G.useCallback)((e,t)=>{let n=f.current.get(e);!n||t!=null&&n.token!==t||(mj(n.state),f.current.delete(e))},[]),b=(0,G.useCallback)(()=>{for(let e of f.current.values())mj(e.state);f.current.clear()},[]),x=(0,G.useCallback)((e,t)=>{let n=fj(l.current,e,t);return n?pj(n):null},[]),S=(0,G.useCallback)((e,t,n)=>{let r=fj(l.current,e,t);if(!r)return;let i=n??pj(r);if(!i)return;d.current.set(e,i),y(e);let a=++p.current;return f.current.set(e,{token:a,state:FEe(r,i)}),a},[y]),C=(0,G.useCallback)((e,t,n)=>{let r=fj(l.current,e,t);if(!r)return null;let i=d.current.get(e)??n??pj(r);if(!i)return null;d.current.has(e)||d.current.set(e,i),y(e);let a=++p.current;return f.current.set(e,{token:a,state:IEe(r,i)}),a},[y]),w=(0,G.useCallback)((e,t)=>{let n=f.current.get(e);!n||t!=null&&n.token!==t||(LEe(n.state),f.current.delete(e))},[]);(0,G.useEffect)(()=>{_(e=>e===h?e:h)},[h]),(0,G.useLayoutEffect)(()=>{if(m.current===g){m.current=null;return}let e=d.current.get(g),t=fj(l.current,g,u),n=t?.panel??l.current?.getPanel(g)??null;NEe(n,e),PEe(n,t?.viewport??null,e)},[g,u]),(0,G.useEffect)(()=>{let e=fj(l.current,g,u),t=e?.contentScrollRoot;if(!e||!t||t===e.panel)return;let n=()=>{let e=d.current.get(g);e&&d.current.set(g,{...e,contentScrollTop:t.scrollTop})};return n(),t.addEventListener(`scroll`,n,{passive:!0}),()=>{t.removeEventListener(`scroll`,n)}},[g,u]),(0,G.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let t of d.current.keys())e.has(t)||d.current.delete(t);for(let t of Array.from(f.current.keys()))e.has(t)||y(t)},[y,t]),(0,G.useEffect)(()=>{d.current.clear(),b()},[b,s.pathname]),(0,G.useEffect)(()=>()=>{b()},[b]);let T=(0,G.useCallback)((e,t)=>{let{allowUnknownSelection:n,area:r,history:i,location:a,queryKey:o,router:s,selectedFromLocation:c,selectedTab:u,tabs:f,viewportSelector:p}=v.current;if(!new Set(f.map(e=>e.id)).has(e)&&!n)return;let h=t?.history??i,g=t?.transferScroll??!0;if(u===e&&c===e)return;let b=()=>{_(e);let t=zEe(a.pathname,a.search,a.hash,o,e);if(qa()){if(s){s.navigate({href:t,replace:h===`replace`,state:a.state});return}UEe(t,h===`replace`,a.state);return}let n=gj(a.pathname,r);if(h===`replace`){Oo.replace(n,t,a.state);return}Oo.push(n,t,a.state)};if(!g){let n=x(u,p);if(n&&d.current.set(u,n),m.current=e,!t?.animate||u===e){b();return}let i=JA(f,u,e);if(!i){b();return}Ep({intent:{area:gj(a.pathname,r),kind:`tab-carousel`,direction:i},collectBeforeEntries:()=>_j(l.current,u),collectAfterEntries:()=>_j(l.current,e),update:b});return}let T=JA(f,u,e),E=(t,n)=>{let i=x(u,p),o=d.current.get(e)??i??x(e,p),s=S(u,p,i);if(!t){(0,Ca.flushSync)(()=>{b()});let t=C(e,p,o);t!=null&&w(e,t),s!=null&&y(u,s);return}let c=null;Ep({intent:{area:gj(a.pathname,r),kind:`tab-carousel`,direction:n},collectBeforeEntries:()=>_j(l.current,u),collectAfterEntries:()=>(c??=C(e,p,o),_j(l.current,e)),update:b}).finally(()=>{c??=C(e,p,o),c!=null&&w(e,c),s!=null&&y(u,s)})};if(!t?.animate||u===e){E(!1);return}if(!T){E(!1);return}E(!0,T)},[S,x,y,w,C]);return{tabsRef:l,selectedTab:g,setSelectedTab:T,onTabChange:(0,G.useCallback)(e=>{T(e,{animate:!0})},[T])}}var yj=null,GEe=e=>{let t=`--tabs-button-${e}`;return String.raw`
1210
1210
  #${e} .tabs-button {
1211
1211
  anchor-name: ${t};
1212
1212
  overflow-x: auto;
@@ -1253,7 +1253,7 @@ fn mainFragment(
1253
1253
  `+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=IN(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=WOe;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+UM[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to);break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
1254
1254
  `?``:t;else{let e=t.indexOf(`
1255
1255
  `);n=e<0?t:t.slice(0,e)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=HM.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e==`number`&&(e=new Tt(this.parser.nodeSet.types[e],yN,yN,(n??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(FN(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?pN(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let t of e.parsers)if(t.finish(this,e))return;let t=FN(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(UM.Paragraph,e.content.length),e.start)}elt(e,t,n,r){return typeof e==`string`?CN(this.parser.getNodeType(e),t,n,r):new SN(e,t)}get buffer(){return new bN(this.parser.nodeSet)}};function pN(e,t,n,r,i){let a=e[t].to,o=[],s=[],c=n.from+r;function l(n,i){for(;i?n>=a:n>a;){let i=e[t+1].from-a;r+=i,n+=i,t++,a=e[t].to}}for(let u=n.firstChild;u;u=u.nextSibling){l(u.from+r,!0);let n=u.from+r,d,f=i.get(u.tree);f?d=f:u.to+r>a?(d=pN(e,t,u,r,i),l(u.to+r,!1)):d=u.toTree(),o.push(d),s.push(n-c)}return l(n.to+r,!1),new Tt(n.type,o,s,n.to+r-c,n.tree?n.tree.propValues:void 0)}var mN=class e extends xt{constructor(e,t,n,r,i,a,o,s,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=i,this.skipContextMarkup=a,this.inlineParsers=o,this.inlineNames=s,this.wrappers=c,this.nodeTypes=Object.create(null);for(let t of e.types)this.nodeTypes[t.name]=t.id}createParse(e,t,n){let r=new GOe(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}configure(t){let n=gN(t);if(!n)return this;let{nodeSet:r,skipContextMarkup:i}=this,a=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),s=this.blockNames.slice(),c=this.inlineParsers.slice(),l=this.inlineNames.slice(),u=this.endLeafBlock.slice(),d=this.wrappers;if(hN(n.defineNodes)){i=Object.assign({},i);let e=r.types.slice(),t;for(let r of n.defineNodes){let{name:n,block:a,composite:o,style:s}=typeof r==`string`?{name:r}:r;if(e.some(e=>e.name==n))continue;o&&(i[e.length]=(e,t,n)=>o(t,n,e.value));let c=e.length,l=o?[`Block`,`BlockContext`]:a?c>=UM.ATXHeading1&&c<=UM.SetextHeading2?[`Block`,`LeafBlock`,`Heading`]:[`Block`,`LeafBlock`]:void 0;e.push(jt.define({id:c,name:n,props:l&&[[fn.group,l]]})),s&&(t||={},Array.isArray(s)||s instanceof wt?t[n]=s:Object.assign(t,s))}r=new At(e),t&&(r=r.extend(Dt(t)))}if(hN(n.props)&&(r=r.extend(...n.props)),hN(n.remove))for(let e of n.remove){let t=this.blockNames.indexOf(e),n=this.inlineNames.indexOf(e);t>-1&&(a[t]=o[t]=void 0),n>-1&&(c[n]=void 0)}if(hN(n.parseBlock))for(let e of n.parseBlock){let t=s.indexOf(e.name);if(t>-1)a[t]=e.parse,o[t]=e.leaf;else{let t=e.before?_N(s,e.before):e.after?_N(s,e.after)+1:s.length-1;a.splice(t,0,e.parse),o.splice(t,0,e.leaf),s.splice(t,0,e.name)}e.endLeaf&&u.push(e.endLeaf)}if(hN(n.parseInline))for(let e of n.parseInline){let t=l.indexOf(e.name);if(t>-1)c[t]=e.parse;else{let t=e.before?_N(l,e.before):e.after?_N(l,e.after)+1:l.length-1;c.splice(t,0,e.parse),l.splice(t,0,e.name)}}return n.wrap&&(d=d.concat(n.wrap)),new e(r,a,o,s,u,i,c,l,d)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new PN(this,e,t);outer:for(let e=t;e<n.end;){let t=n.char(e);for(let r of this.inlineParsers)if(r){let i=r(n,t,e);if(i>=0){e=i;continue outer}}e++}return n.resolveMarkers(0)}};function hN(e){return e!=null&&e.length>0}function gN(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=gN(e[0]);if(e.length==1)return t;let n=gN(e.slice(1));if(!n||!t)return t||n;let r=(e,t)=>(e||yN).concat(t||yN),i=t.wrap,a=n.wrap;return{props:r(t.props,n.props),defineNodes:r(t.defineNodes,n.defineNodes),parseBlock:r(t.parseBlock,n.parseBlock),parseInline:r(t.parseInline,n.parseInline),remove:r(t.remove,n.remove),wrap:i?a?(e,t,n,r)=>i(a(e,t,n,r),t,n,r):i:a}}function _N(e,t){let n=e.indexOf(t);if(n<0)throw RangeError(`Position specified relative to unknown parser ${t}`);return n}var vN=[jt.none];for(let e=1,t;t=UM[e];e++)vN[e]=jt.define({id:e,name:t,props:e>=UM.Escape?[]:[[fn.group,e in GM?[`Block`,`BlockContext`]:[`Block`,`LeafBlock`]]],top:t==`Document`});var yN=[],bN=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,n,r=0){return this.content.push(e,t,n,4+r*4),this}writeElements(e,t=0){for(let n of e)n.writeTo(this,t);return this}finish(e,t){return Tt.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:t})}},xN=class{constructor(e,t,n,r=yN){this.type=e,this.from=t,this.to=n,this.children=r}writeTo(e,t){let n=e.content.length;e.writeElements(this.children,t),e.content.push(this.type,this.from+t,this.to+t,e.content.length+4-n)}toTree(e){return new bN(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},SN=class{constructor(e,t){this.tree=e,this.from=t}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return yN}writeTo(e,t){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+t,this.to+t,-1)}toTree(){return this.tree}};function CN(e,t,n,r){return new xN(e,t,n,r)}var wN={resolve:`Emphasis`,mark:`EmphasisMark`},TN={resolve:`Emphasis`,mark:`EmphasisMark`},EN={},DN={},ON=class{constructor(e,t,n,r){this.type=e,this.from=t,this.to=n,this.side=r}},KOe=`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`,kN=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{kN=RegExp(`[\\p{S}|\\p{P}]`,`u`)}catch{}var AN={Escape(e,t,n){if(t!=92||n==e.end-1)return-1;let r=e.char(n+1);for(let t=0;t<32;t++)if(KOe.charCodeAt(t)==r)return e.append(CN(UM.Escape,n,n+2));return-1},Entity(e,t,n){if(t!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(e.slice(n+1,n+31));return r?e.append(CN(UM.Entity,n,n+1+r[0].length)):-1},InlineCode(e,t,n){if(t!=96||n&&e.char(n-1)==96)return-1;let r=n+1;for(;r<e.end&&e.char(r)==96;)r++;let i=r-n,a=0;for(;r<e.end;r++)if(e.char(r)==96){if(a++,a==i&&e.char(r+1)!=96)return e.append(CN(UM.InlineCode,n,r+1,[CN(UM.CodeMark,n,n+i),CN(UM.CodeMark,r+1-i,r+1)]))}else a=0;return-1},HTMLTag(e,t,n){if(t!=60||n==e.end-1)return-1;let r=e.slice(n+1,e.end),i=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(i)return e.append(CN(UM.Autolink,n,n+1+i[0].length,[CN(UM.LinkMark,n,n+1),CN(UM.URL,n+1,n+i[0].length),CN(UM.LinkMark,n+i[0].length,n+1+i[0].length)]));let a=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(a)return e.append(CN(UM.Comment,n,n+1+a[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return e.append(CN(UM.ProcessingInstruction,n,n+1+o[0].length));let s=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return s?e.append(CN(UM.HTMLTag,n,n+1+s[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let r=n+1;for(;e.char(r)==t;)r++;let i=e.slice(n-1,n),a=e.slice(r,r+1),o=kN.test(i),s=kN.test(a),c=/\s|^$/.test(i),l=/\s|^$/.test(a),u=!l&&(!s||c||o),d=!c&&(!o||l||s),f=u&&(t==42||!d||o),p=d&&(t==42||!u||s);return e.append(new ON(t==95?wN:TN,n,r,(f?1:0)|(p?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(CN(UM.HardBreak,n,n+2));if(t==32){let t=n+1;for(;e.char(t)==32;)t++;if(e.char(t)==10&&t>=n+2)return e.append(CN(UM.HardBreak,n,t+1))}return-1},Link(e,t,n){return t==91?e.append(new ON(EN,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new ON(DN,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let t=e.parts.length-1;t>=0;t--){let r=e.parts[t];if(r instanceof ON&&(r.type==EN||r.type==DN)){if(!r.side||e.skipSpace(r.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[t]=null,-1;let i=e.takeContent(t),a=e.parts[t]=qOe(e,i,r.type==EN?UM.Link:UM.Image,r.from,n+1);if(r.type==EN)for(let n=0;n<t;n++){let t=e.parts[n];t instanceof ON&&t.type==EN&&(t.side=0)}return a.to}}return-1}};function qOe(e,t,n,r,i){let{text:a}=e,o=e.char(i),s=i;if(t.unshift(CN(UM.LinkMark,r,r+(n==UM.Image?2:1))),t.push(CN(UM.LinkMark,i-1,i)),o==40){let n=e.skipSpace(i+1),r=jN(a,n-e.offset,e.offset),o;r&&(n=e.skipSpace(r.to),n!=r.to&&(o=MN(a,n-e.offset,e.offset),o&&(n=e.skipSpace(o.to)))),e.char(n)==41&&(t.push(CN(UM.LinkMark,i,i+1)),s=n+1,r&&t.push(r),o&&t.push(o),t.push(CN(UM.LinkMark,n,s)))}else if(o==91){let n=NN(a,i-e.offset,e.offset,!1);n&&(t.push(n),s=n.to)}return CN(n,r,s,t)}function jN(e,t,n){if(e.charCodeAt(t)==60){for(let r=t+1;r<e.length;r++){let i=e.charCodeAt(r);if(i==62)return CN(UM.URL,t+n,r+1+n);if(i==60||i==10)return!1}return null}else{let r=0,i=t;for(let t=!1;i<e.length;i++){let n=e.charCodeAt(i);if(KM(n))break;if(t)t=!1;else if(n==40)r++;else if(n==41){if(!r)break;r--}else n==92&&(t=!0)}return i>t?CN(UM.URL,t+n,i+n):i==e.length?null:!1}}function MN(e,t,n){let r=e.charCodeAt(t);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let r=t+1,a=!1;r<e.length;r++){let o=e.charCodeAt(r);if(a)a=!1;else if(o==i)return CN(UM.LinkTitle,t+n,r+1+n);else o==92&&(a=!0)}return null}function NN(e,t,n,r){for(let i=!1,a=t+1,o=Math.min(e.length,a+999);a<o;a++){let o=e.charCodeAt(a);if(i)i=!1;else if(o==93)return r?!1:CN(UM.LinkLabel,t+n,a+1+n);else{if(r&&!KM(o)&&(r=!1),o==91)return!1;o==92&&(i=!0)}}return null}var PN=class{constructor(e,t,n){this.parser=e,this.text=t,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,t){return this.text.slice(e-this.offset,t-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,t,n,r,i){return this.append(new ON(e,t,n,(r?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let t=this.parts[e];if(t instanceof ON&&(t.type==EN||t.type==DN))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let t=e;t<this.parts.length;t++){let n=this.parts[t];if(!(n instanceof ON&&n.type.resolve&&n.side&2))continue;let r=n.type==wN||n.type==TN,i=n.to-n.from,a,o=t-1;for(;o>=e;o--){let e=this.parts[o];if(e instanceof ON&&e.side&1&&e.type==n.type&&!(r&&(n.side&1||e.side&2)&&(e.to-e.from+i)%3==0&&((e.to-e.from)%3||i%3))){a=e;break}}if(!a)continue;let s=n.type.resolve,c=[],l=a.from,u=n.to;if(r){let e=Math.min(2,a.to-a.from,i);l=a.to-e,u=n.from+e,s=e==1?`Emphasis`:`StrongEmphasis`}a.type.mark&&c.push(this.elt(a.type.mark,l,a.to));for(let e=o+1;e<t;e++)this.parts[e]instanceof xN&&c.push(this.parts[e]),this.parts[e]=null;n.type.mark&&c.push(this.elt(n.type.mark,n.from,u));let d=this.elt(s,l,u,c);this.parts[o]=r&&a.from!=l?new ON(a.type,a.from,l,a.side):null,(this.parts[t]=r&&n.to!=u?new ON(n.type,u,n.to,n.side):null)?this.parts.splice(t,0,d):this.parts[t]=d}let t=[];for(let n=e;n<this.parts.length;n++){let e=this.parts[n];e instanceof xN&&t.push(e)}return t}findOpeningDelimiter(e){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof ON&&n.type==e&&n.side&1)return t}return null}takeContent(e){let t=this.resolveMarkers(e);return this.parts.length=e,t}getDelimiterAt(e){let t=this.parts[e];return t instanceof ON?t:null}skipSpace(e){return qM(this.text,e-this.offset)+this.offset}elt(e,t,n,r){return typeof e==`string`?CN(this.parser.getNodeType(e),t,n,r):new SN(e,t)}};PN.linkStart=EN,PN.imageStart=DN;function FN(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),r=0;for(let e of t){for(;r<n.length&&n[r].to<e.to;)r++;if(r<n.length&&n[r].from<e.from){let t=n[r];t instanceof xN&&(n[r]=new xN(t.type,t.from,t.to,FN(t.children,[e])))}else n.splice(r++,0,e)}return n}var JOe=[UM.CodeBlock,UM.ListItem,UM.OrderedList,UM.BulletList],YOe=class{constructor(e,t){this.fragments=e,this.input=t,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,t){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let e=this.fragment.to;for(;e>0&&this.input.read(e-1,e)!=`
1256
- `;)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(fn.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,a=i,o=e.block.children.length,s=a,c=o;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let i=IN(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,i);else{let n=new Tt(e.parser.nodeSet.types[UM.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,i)}if(t.type.is(`Block`)&&(JOe.indexOf(t.type.id)<0?(a=t.to-n,o=e.block.children.length):(a=s,o=c,s=t.to-n,c=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-i}};function IN(e,t){let n=e;for(let r=1;r<t.length;r++){let i=t[r-1].to,a=t[r].from;i<e&&(n-=a-i)}return n}var XOe=Dt({"Blockquote/...":U.quote,HorizontalRule:U.contentSeparator,"ATXHeading1/... SetextHeading1/...":U.heading1,"ATXHeading2/... SetextHeading2/...":U.heading2,"ATXHeading3/...":U.heading3,"ATXHeading4/...":U.heading4,"ATXHeading5/...":U.heading5,"ATXHeading6/...":U.heading6,"Comment CommentBlock":U.comment,Escape:U.escape,Entity:U.character,"Emphasis/...":U.emphasis,"StrongEmphasis/...":U.strong,"Link/... Image/...":U.link,"OrderedList/... BulletList/...":U.list,"BlockQuote/...":U.quote,"InlineCode CodeText":U.monospace,"URL Autolink":U.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":U.processingInstruction,"CodeInfo LinkLabel":U.labelName,LinkTitle:U.string,Paragraph:U.content}),ZOe=new mN(new At(vN).extend(XOe),Object.keys(uN).map(e=>uN[e]),Object.keys(uN).map(e=>fN[e]),Object.keys(uN),UOe,GM,Object.keys(AN).map(e=>AN[e]),Object.keys(AN),[]);function QOe(e,t,n){let r=[];for(let i=e.firstChild,a=t;;i=i.nextSibling){let e=i?i.from:n;if(e>a&&r.push({from:a,to:e}),!i)break;a=i.to}return r}function $Oe(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Ot((e,r)=>{let i=e.type.id;if(t&&(i==UM.CodeBlock||i==UM.FencedCode)){let n=``;if(i==UM.FencedCode){let t=e.node.getChild(UM.CodeInfo);t&&(n=r.read(t.from,t.to))}let a=t(n);if(a)return{parser:a,overlay:e=>e.type.id==UM.CodeText}}else if(n&&(i==UM.HTMLBlock||i==UM.HTMLTag||i==UM.CommentBlock))return{parser:n,overlay:QOe(e.node,e.from,e.to)};return null})}}var eke={resolve:`Strikethrough`,mark:`StrikethroughMark`},tke={defineNodes:[{name:`Strikethrough`,style:{"Strikethrough/...":U.strikethrough}},{name:`StrikethroughMark`,style:U.processingInstruction}],parseInline:[{name:`Strikethrough`,parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),a=/\s|^$/.test(r),o=/\s|^$/.test(i),s=kN.test(r),c=kN.test(i);return e.addDelimiter(eke,n,n+2,!o&&(!c||a||s),!a&&(!s||o||c))},after:`Emphasis`}]};function LN(e,t,n=0,r,i=0){let a=0,o=!0,s=-1,c=-1,l=!1,u=()=>{r.push(e.elt(`TableCell`,i+s,i+c,e.parser.parseInline(t.slice(s,c),i+s)))};for(let d=n;d<t.length;d++){let n=t.charCodeAt(d);n==124&&!l?((!o||s>-1)&&a++,o=!1,r&&(s>-1&&u(),r.push(e.elt(`TableDelimiter`,d+i,d+i+1))),s=c=-1):(l||n!=32&&n!=9)&&(s<0&&(s=d),c=d+1),l=!l&&n==92}return s>-1&&(a++,r&&u()),a}function RN(e,t){for(let n=t;n<e.length;n++){let t=e.charCodeAt(n);if(t==124)return!0;t==92&&n++}return!1}var zN=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,BN=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&zN.test(r=t.text.slice(t.pos))){let i=[];LN(e,n.content,0,i,n.start)==LN(e,r,t.pos)&&(this.rows=[e.elt(`TableHeader`,n.start,n.start+n.content.length,i),e.elt(`TableDelimiter`,e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];LN(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt(`TableRow`,e.lineStart+t.pos,e.lineStart+t.text.length,n))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt(`Table`,t.start,t.start+t.content.length,this.rows)),!0):!1}},nke={defineNodes:[{name:`Table`,block:!0},{name:`TableHeader`,style:{"TableHeader/...":U.heading}},`TableRow`,{name:`TableCell`,style:U.content},{name:`TableDelimiter`,style:U.processingInstruction}],parseBlock:[{name:`Table`,leaf(e,t){return RN(t.content,0)?new BN:null},endLeaf(e,t,n){if(n.parsers.some(e=>e instanceof BN)||!RN(t.text,t.basePos))return!1;let r=e.peekLine();return zN.test(r)&&LN(e,t.text,t.basePos)==LN(e,r,t.basePos)},before:`SetextHeading`}]},rke=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt(`Task`,t.start,t.start+t.content.length,[e.elt(`TaskMarker`,t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},ike={defineNodes:[{name:`Task`,block:!0,style:U.list},{name:`TaskMarker`,style:U.atom}],parseBlock:[{name:`TaskList`,leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name==`ListItem`?new rke:null},after:`SetextHeading`}]},VN=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,HN=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,ake=/[\w-]+\.[\w-]+($|\/)/,UN=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,WN=/\/[a-zA-Z\d@.]+/gy;function GN(e,t,n,r){let i=0;for(let a=t;a<n;a++)e[a]==r&&i++;return i}function oke(e,t){HN.lastIndex=t;let n=HN.exec(e);if(!n||ake.exec(n[0])[0].indexOf(`_`)>-1)return-1;let r=t+n[0].length;for(;;){let n=e[r-1],i;if(/[?!.,:*_~]/.test(n)||n==`)`&&GN(e,t,r,`)`)>GN(e,t,r,`(`))r--;else if(n==`;`&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+i.index;else break}return r}function KN(e,t){UN.lastIndex=t;let n=UN.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r==`_`||r==`-`?-1:t+n[0].length-(r==`.`?1:0)}var ske=[nke,ike,tke,{parseInline:[{name:`Autolink`,parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;VN.lastIndex=r;let i=VN.exec(e.text),a=-1;return!i||(i[1]||i[2]?(a=oke(e.text,r+i[0].length),a>-1&&e.hasOpenLink&&(a=r+/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,a))[0].length)):i[3]?a=KN(e.text,r):(a=KN(e.text,r+i[0].length),a>-1&&i[0]==`xmpp:`&&(WN.lastIndex=a,i=WN.exec(e.text),i&&(a=i.index+i[0].length))),a<0)?-1:(e.addElement(e.elt(`URL`,n,a+e.offset)),a+e.offset)}}]}];function qN(e,t,n){return(r,i,a)=>{if(i!=e||r.char(a+1)==e)return-1;let o=[r.elt(n,a,a+1)];for(let i=a+1;i<r.end;i++){let s=r.char(i);if(s==e)return r.addElement(r.elt(t,a,i+1,o.concat(r.elt(n,i,i+1))));if(s==92&&o.push(r.elt(`Escape`,i,i+++2)),KM(s))break}return-1}}var cke={defineNodes:[{name:`Superscript`,style:U.special(U.content)},{name:`SuperscriptMark`,style:U.processingInstruction}],parseInline:[{name:`Superscript`,parse:qN(94,`Superscript`,`SuperscriptMark`)}]},lke={defineNodes:[{name:`Subscript`,style:U.special(U.content)},{name:`SubscriptMark`,style:U.processingInstruction}],parseInline:[{name:`Subscript`,parse:qN(126,`Subscript`,`SubscriptMark`)}]},uke={defineNodes:[{name:`Emoji`,style:U.character}],parseInline:[{name:`Emoji`,parse(e,t,n){let r;return t!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(e.slice(n+1,e.end)))?-1:e.addElement(e.elt(`Emoji`,n,n+1+r[0].length))}}]},dke=55,fke=1,pke=56,mke=2,hke=57,gke=3,JN=4,_ke=5,YN=6,XN=7,ZN=8,QN=9,$N=10,vke=11,yke=12,bke=13,eP=58,xke=14,Ske=15,tP=59,nP=21,Cke=23,rP=24,wke=25,iP=27,aP=28,Tke=29,Eke=32,Dke=35,Oke=37,kke=38,Ake=0,jke=1,Mke={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Nke={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},oP={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Pke(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var sP=null,cP=null,lP=0;function uP(e,t){let n=e.pos+t;if(lP==n&&cP==e)return sP;let r=e.peek(t),i=``;for(;Pke(r);)i+=String.fromCharCode(r),r=e.peek(++t);return cP=e,lP=n,sP=i?i.toLowerCase():r==Fke||r==Ike?void 0:null}var dP=60,fP=62,pP=47,Fke=63,Ike=33,Lke=45;function mP(e,t){this.name=e,this.parent=t}var Rke=[YN,$N,XN,ZN,QN],zke=new On({start:null,shift(e,t,n,r){return Rke.indexOf(t)>-1?new mP(uP(r,1)||``,e):e},reduce(e,t){return t==nP&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==YN||i==Oke?new mP(uP(r,1)||``,e):e},strict:!1}),Bke=new vn((e,t)=>{if(e.next!=dP){e.next<0&&t.context&&e.acceptToken(eP);return}e.advance();let n=e.next==pP;n&&e.advance();let r=uP(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?Ske:xke);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(vke);if(i&&Nke[i])return e.acceptToken(eP,-2);if(t.dialectEnabled(Ake))return e.acceptToken(yke);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(bke)}else{if(r==`script`)return e.acceptToken(XN);if(r==`style`)return e.acceptToken(ZN);if(r==`textarea`)return e.acceptToken(QN);if(Mke.hasOwnProperty(r))return e.acceptToken($N);i&&oP[i]&&oP[i][r]?e.acceptToken(eP,-1):e.acceptToken(YN)}},{contextual:!0}),Vke=new vn(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(tP);break}if(e.next==Lke)t++;else if(e.next==fP&&t>=2){n>=3&&e.acceptToken(tP,-2);break}else t=0;e.advance()}});function Hke(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var Uke=new vn((e,t)=>{if(e.next==pP&&e.peek(1)==fP){let n=t.dialectEnabled(jke)||Hke(t.context);e.acceptToken(n?_ke:JN,2)}else e.next==fP&&e.acceptToken(JN,1)});function hP(e,t,n){let r=2+e.length;return new vn(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==dP||a==1&&i.next==pP||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==fP){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var Wke=hP(`script`,dke,fke),Gke=hP(`style`,pke,mke),Kke=hP(`textarea`,hke,gke),qke=Dt({"Text RawText IncompleteTag IncompleteCloseTag":U.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":U.angleBracket,TagName:U.tagName,"MismatchedCloseTag/TagName":[U.tagName,U.invalid],AttributeName:U.attributeName,"AttributeValue UnquotedAttributeValue":U.attributeValue,Is:U.definitionOperator,"EntityReference CharacterReference":U.character,Comment:U.blockComment,ProcessingInst:U.processingInstruction,DoctypeDecl:U.documentMeta}),Jke=wn.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:zke,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[qke],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[Wke,Gke,Kke,Uke,Bke,Vke,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function gP(e,t){let n=Object.create(null);for(let r of e.getChildren(rP)){let e=r.getChild(wke),i=r.getChild(iP)||r.getChild(aP);e&&(n[t.read(e.from,e.to)]=i?i.type.id==iP?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function _P(e,t){let n=e.getChild(Cke);return n?t.read(n.from,n.to):` `}function vP(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=gP(e.node.parent.firstChild,t)))return{parser:i.parser};return null}function yP(e=[],t=[]){let n=[],r=[],i=[],a=[];for(let t of e)(t.tag==`script`?n:t.tag==`style`?r:t.tag==`textarea`?i:a).push(t);let o=t.length?Object.create(null):null;for(let e of t)(o[e.name]||(o[e.name]=[])).push(e);return Ot((e,t)=>{let s=e.type.id;if(s==Tke)return vP(e,t,n);if(s==Eke)return vP(e,t,r);if(s==Dke)return vP(e,t,i);if(s==nP&&a.length){let n=e.node,r=n.firstChild,i=r&&_P(r,t),o;if(i){for(let e of a)if(e.tag==i&&(!e.attrs||e.attrs(o||=gP(r,t)))){let t=n.lastChild,i=t.type.id==kke?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(o&&s==rP){let n=e.node,r;if(r=n.firstChild){let e=o[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=_P(n.parent,t))continue;let e=n.lastChild;if(e.type.id==iP){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}]}}else if(e.type.id==aP)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var Yke=122,bP=1,Xke=123,Zke=124,xP=2,Qke=125,$ke=3,eAe=4,SP=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],tAe=58,nAe=40,CP=95,rAe=91,wP=45,iAe=46,aAe=35,oAe=37,sAe=38,cAe=92,lAe=10,uAe=42;function TP(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function EP(e){return e>=48&&e<=57}function DP(e){return EP(e)||e>=97&&e<=102||e>=65&&e<=70}var OP=(e,t,n)=>(r,i)=>{for(let a=!1,o=0,s=0;;s++){let{next:c}=r;if(TP(c)||c==wP||c==CP||a&&EP(c))!a&&(c!=wP||s>0)&&(a=!0),o===s&&c==wP&&o++,r.advance();else if(c==cAe&&r.peek(1)!=lAe){if(r.advance(),DP(r.next)){do r.advance();while(DP(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();a=!0}else{a&&r.acceptToken(o==2&&i.canShift(xP)?t:c==nAe?n:e);break}}},dAe=new vn(OP(Xke,xP,Zke)),fAe=new vn(OP(Qke,$ke,eAe)),pAe=new vn(e=>{if(SP.includes(e.peek(-1))){let{next:t}=e;(TP(t)||t==CP||t==aAe||t==iAe||t==uAe||t==rAe||t==tAe&&TP(e.peek(1))||t==wP||t==sAe)&&e.acceptToken(Yke)}}),mAe=new vn(e=>{if(!SP.includes(e.peek(-1))){let{next:t}=e;if(t==oAe&&(e.advance(),e.acceptToken(bP)),TP(t)){do e.advance();while(TP(e.next)||EP(e.next));e.acceptToken(bP)}}}),hAe=Dt({"AtKeyword import charset namespace keyframes media supports":U.definitionKeyword,"from to selector":U.keyword,NamespaceName:U.namespace,KeyframeName:U.labelName,KeyframeRangeName:U.operatorKeyword,TagName:U.tagName,ClassName:U.className,PseudoClassName:U.constant(U.className),IdName:U.labelName,"FeatureName PropertyName":U.propertyName,AttributeName:U.attributeName,NumberLiteral:U.number,KeywordQuery:U.keyword,UnaryQueryOp:U.operatorKeyword,"CallTag ValueName":U.atom,VariableName:U.variableName,Callee:U.operatorKeyword,Unit:U.unit,"UniversalSelector NestingSelector":U.definitionOperator,"MatchOp CompareOp":U.compareOperator,"ChildOp SiblingOp, LogicOp":U.logicOperator,BinOp:U.arithmeticOperator,Important:U.modifier,Comment:U.blockComment,ColorLiteral:U.color,"ParenthesizedContent StringLiteral":U.string,":":U.punctuation,"PseudoOp #":U.derefOperator,"; ,":U.separator,"( )":U.paren,"[ ]":U.squareBracket,"{ }":U.brace}),gAe={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},_Ae={__proto__:null,or:98,and:98,not:106,only:106,layer:170},vAe={__proto__:null,selector:112,layer:166},yAe={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},bAe={__proto__:null,to:207},xAe=wn.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO,5:}O%_QdO'#DgOOQS,5;P,5;PO-eQ`O,5;PO4^QdO,5;PO4fQdO,5:gO4vQdO'#EtO5TQ`O,5;zO5TQ`O,5;zPOOO'#Ej'#EjP5`O&jO,58{POOO,58{,58{OOQP1G.n1G.nOOQP1G.q1G.qO*hQ`O1G.qO*mQ`O1G.qOOQP1G/v1G/vO5kQpO1G/xO5sQaO1G/{O6ZQaO1G/}O6qQaO1G0OO7XQaO,5;^OOQO-E8p-E8pOOQS1G.i1G.iO7cQ`O,5:fO7hQdO'#DoO7oQdO'#CrOOQP1G/x1G/xO&lQdO1G/xO7vQ!jO'#DZO8UQ!bO,59vO8^QhO,5:OOOQO'#F]'#F]O8XQ!bO,59zO'tQhO,59xO8fQhO'#EvO8sQ`O,5;{O9OQhO,59|O9uQhO'#DiOOQW,5:S,5:SOOQS1G0n1G0nOOQW,5:P,5:PO9|Q!fO'#FYOOQS'#FY'#FYOOQS'#Em'#EmO;^QdO,59`OOQ[,59`,59`O;tQdO,59fOOQ[,59f,59fO<[QdO,59iOOQ[,59i,59iOOQ[,59k,59kO&lQdO,59mO<rQhO'#EQOOQW'#EQ'#EQO=WQ`O1G0UO1[QhO1G0UOOQ[,59o,59oO'tQhO'#DXOOQ[,59q,59qO=]Q#tO,5:VOOQS1G0[1G0[OOQS1G0^1G0^OOQS1G0`1G0`O=hQ`O1G0`O=mQdO'#E`OOQS1G0c1G0cOOQS1G0i1G0iO=xQaO,5:RO-`Q`O1G0kOOQS1G0k1G0kO-eQ`O1G0kO>PQ!fO1G0ROOQO1G0R1G0ROOQO,5;`,5;`O>gQdO,5;`OOQO-E8r-E8rO>tQ`O1G1fPOOO-E8h-E8hPOOO1G.g1G.gOOQP7+$]7+$]OOQP7+%d7+%dO&lQdO7+%dOOQS1G0Q1G0QO?PQaO'#F_O?ZQ`O,5:ZO?`Q!fO'#ElO@^QdO'#FWO@hQ`O,59^O@mQ!bO7+%dO&lQdO1G/bO@uQhO1G/fOOQW1G/j1G/jOOQW1G/d1G/dOAWQhO,5;bOOQO-E8t-E8tOAfQhO'#DZOAtQhO'#F^OBPQ`O'#F^OBUQ`O,5:TOOQS-E8k-E8kOOQ[1G.z1G.zOOQ[1G/Q1G/QOOQ[1G/T1G/TOOQ[1G/X1G/XOBZQdO,5:lOOQS7+%p7+%pOB`Q`O7+%pOBeQhO'#DYOBmQ`O,59sO'tQhO,59sOOQ[1G/q1G/qOBuQ`O1G/qOOQS7+%z7+%zOBzQbO'#DPOOQO'#Eb'#EbOCYQ`O'#EaOOQO'#Ea'#EaOCeQ`O'#EwOCmQdO,5:zOOQS,5:z,5:zOOQ[1G/m1G/mOOQS7+&V7+&VO-`Q`O7+&VOCxQ!fO'#EsO&lQdO'#EsOEPQdO7+%mOOQO7+%m7+%mOOQO1G0z1G0zOEdQ!bO<<IOOElQdO'#EqOEvQ`O,5;yOOQP1G/u1G/uOOQS-E8j-E8jOFOQdO'#EpOFYQ`O,5;rOOQ]1G.x1G.xOOQP<<IO<<IOOFbQdO7+$|OOQO'#D]'#D]OFiQ!bO7+%QOFqQhO'#EoOF{Q`O,5;xO&lQdO,5;xOOQW1G/o1G/oOOQO'#ES'#ESOGTQ`O1G0WOOQS<<I[<<I[O&lQdO,59tOGnQhO1G/_OOQ[1G/_1G/_OGuQ`O1G/_OOQW-E8l-E8lOOQ[7+%]7+%]OOQO,5:{,5:{O=pQdO'#ExOCeQ`O,5;cOOQS,5;c,5;cOOQS-E8u-E8uOOQS1G0f1G0fOOQS<<Iq<<IqOG}Q!fO,5;_OOQS-E8q-E8qOOQO<<IX<<IXOOQPAN>jAN>jOIUQaO,5;]OOQO-E8o-E8oOI`QdO,5;[OOQO-E8n-E8nOOQW<<Hh<<HhOOQW<<Hl<<HlOIjQhO<<HlOI{QhO,5;ZOJWQ`O,5;ZOOQO-E8m-E8mOJ]QdO1G1dOBZQdO'#EuOJgQ`O7+%rOOQW7+%r7+%rOJoQ!bO1G/`OOQ[7+$y7+$yOJzQhO7+$yPKRQ`O'#EnOOQO,5;d,5;dOOQO-E8v-E8vOOQS1G0}1G0}OKWQ`OAN>WO&lQdO1G0uOK]Q`O7+'OOOQO,5;a,5;aOOQO-E8s-E8sOOQW<<I^<<I^OOQ[<<He<<HePOQW,5;Y,5;YOOQWG23rG23rOKeQdO7+&a",stateData:"Kx~O#sOS#tQQ~OW[OZ[O]TO`VOaVOi]OjWOmXO!jYO!mZO!saO!ybO!{cO!}dO#QeO#WfO#YgO#oRO~OQiOW[OZ[O]TO`VOaVOi]OjWOmXO!jYO!mZO!saO!ybO!{cO!}dO#QeO#WfO#YgO#ohO~O#m$SP~P!dO#tmO~O#ooO~O]qO`rOarOjsOmtO!juO!mwO#nvO~OpzO!^xO~P$SOc!QO#o|O#p}O~O#o!RO~O#o!TO~OW[OZ[O]TO`VOaVOjWOmXO!jYO!mZO#oRO~OS!]Oe!YO!V![O!Y!`O#q!XOp$TP~Ok$TP~P&POQ!jOe!cOm!dOp!eOr!mOt!mOz!kO!`!lO#o!bO#p!hO#}!fO~Ot!qO!`!lO#o!pO~Ot!sO#o!sO~OS!]Oe!YO!V![O!Y!`O#q!XO~Oe!vOpzO#Z!xO~O]YX`YX`!pXaYXjYXmYXpYX!^YX!jYX!mYX#nYX~O`!zO~Ok!{O#m$SXo$SX~O#m$SXo$SX~P!dO#u#OO#v#OO#w#QO~Oc#UO#o|O#p}O~OpzO!^xO~Oo$SP~P!dOe#`O~Oe#aO~Ol#bO!h#cO~O]qO`rOarOjsOmtO~Op!ia!^!ia!j!ia!m!ia#n!iad!ia~P*zOp!la!^!la!j!la!m!la#n!lad!la~P*zOR#gOS!]Oe!YOr#gOt#gO!V![O!Y!`O#q#dO#}!fO~O!R#iO!^#jOk$TXp$TX~Oe#mO~Ok#oOpzO~Oe!vO~O]#rO`#rOd#uOi#rOj#rOk#rO~P&lO]#rO`#rOi#rOj#rOk#rOl#wO~P&lO]#rO`#rOi#rOj#rOk#rOo#yO~P&lOP#zOSsXesXksXvsX!VsX!YsX!usX!wsX#qsX!TsXQsX]sX`sXdsXisXjsXmsXpsXrsXtsXzsX!`sX#osX#psX#}sXlsXosX!^sX!qsX#msX~Ov#{O!u#|O!w#}Ok$TP~P'tOe#aOS#{Xk#{Xv#{X!V#{X!Y#{X!u#{X!w#{X#q#{XQ#{X]#{X`#{Xd#{Xi#{Xj#{Xm#{Xp#{Xr#{Xt#{Xz#{X!`#{X#o#{X#p#{X#}#{Xl#{Xo#{X!^#{X!q#{X#m#{X~Oe$RO~Oe$TO~Ok$VOv#{O~Ok$WO~Ot$XO!`!lO~Op$YO~OpzO!R#iO~OpzO#Z$`O~O!q$bOk!oa#m!oao!oa~P&lOk#hX#m#hXo#hX~P!dOk!{O#m$Sao$Sa~O#u#OO#v#OO#w$hO~Ol$jO!h$kO~Op!ii!^!ii!j!ii!m!ii#n!iid!ii~P*zOp!ki!^!ki!j!ki!m!ki#n!kid!ki~P*zOp!li!^!li!j!li!m!li#n!lid!li~P*zOp#fa!^#fa~P$SOo$lO~Od$RP~P%_Od#zP~P&lO`!PXd}X!R}X!T!PX~O`$sO!T$tO~Od$uO!R#iO~Ok#jXp#jX!^#jX~P'tO!^#jOk$Tap$Ta~O!R#iOk!Uap!Ua!^!Uad!Ua`!Ua~OS!]Oe!YO!V![O!Y!`O#q$yO~Od$QP~P9dOv#{OQ#|X]#|X`#|Xd#|Xe#|Xi#|Xj#|Xk#|Xm#|Xp#|Xr#|Xt#|Xz#|X!`#|X#o#|X#p#|X#}#|Xl#|Xo#|X~O]#rO`#rOd%OOi#rOj#rOk#rO~P&lO]#rO`#rOi#rOj#rOk#rOl%PO~P&lO]#rO`#rOi#rOj#rOk#rOo%QO~P&lOe%SOS!tXk!tX!V!tX!Y!tX#q!tX~Ok%TO~Od%YOt%ZO!a%ZO~Ok%[O~Oo%cO#o%^O#}%]O~Od%dO~P$SOv#{O!^%hO!q%jOk!oi#m!oio!oi~P&lOk#ha#m#hao#ha~P!dOk!{O#m$Sio$Si~O!^%mOd$RX~P$SOd%oO~Ov#{OQ#`Xd#`Xe#`Xm#`Xp#`Xr#`Xt#`Xz#`X!^#`X!`#`X#o#`X#p#`X#}#`X~O!^%qOd#zX~P&lOd%sO~Ol%tOv#{O~OR#gOr#gOt#gO#q%vO#}!fO~O!R#iOk#jap#ja!^#ja~O`!PXd}X!R}X!^}X~O!R#iO!^%xOd$QX~O`%zO~Od%{O~O#o%|O~Ok&OO~O`&PO!R#iO~Od&ROk&QO~Od&UO~OP#zOpsX!^sXdsX~O#}%]Op#TX!^#TX~OpzO!^&WO~Oo&[O#o%^O#}%]O~Ov#{OQ#gXe#gXk#gXm#gXp#gXr#gXt#gXz#gX!^#gX!`#gX!q#gX#m#gX#o#gX#p#gX#}#gXo#gX~O!^%hO!q&`Ok!oq#m!oqo!oq~P&lOl&aOv#{O~Od#eX!^#eX~P%_O!^%mOd$Ra~Od#dX!^#dX~P&lO!^%qOd#za~Od&fO~P&lOd&gO!T&hO~Od#cX!^#cX~P9dO!^%xOd$Qa~O]&mOd&oO~OS#bae#ba!V#ba!Y#ba#q#ba~Od&qO~PG]Od&qOk&rO~Ov#{OQ#gae#gak#gam#gap#gar#gat#gaz#ga!^#ga!`#ga!q#ga#m#ga#o#ga#p#ga#}#gao#ga~Od#ea!^#ea~P$SOd#da!^#da~P&lOR#gOr#gOt#gO#q%vO#}%]O~O!R#iOd#ca!^#ca~O`&xO~O!^%xOd$Qi~P&lO]&mOd&|O~Ov#{Od|ik|i~Od&}O~PG]Ok'OO~Od'PO~O!^%xOd$Qq~Od#cq!^#cq~P&lO#s!a#t#}]#}v!m~",goto:"2h$UPPPPP$VP$YP$c$uP$cP%X$cPP%_PPP%e%o%oPPPPP%oPP%oP&]P%oP%o'W%oP't'w'}'}(^'}P'}P'}P'}'}P(m'}(yP(|PP)p)v$c)|$c*SP$cP$c$cP*Y*{+YP$YP+aP+dP$YP$YP$YP+j$YP+m+p+s+z$YP$YPP$YP,P,V,f,|-[-b-l-r-x.O.U.`.f.l.rPPPPPPPPPPP.x/R/w/z0|P1U1u2O2R2U2[RnQ_^OP`kz!{$dq[OPYZ`kuvwxz!v!{#`$d%mqSOPYZ`kuvwxz!v!{#`$d%mQpTR#RqQ!OVR#SrQ#S!QS$Q!i!jR$i#U!V!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'Q!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QU#g!Y$t&hU%`$Y%b&WR&V%_!V!iac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QR$S!kQ%W$RR&S%Xk!^]bf!Y![!g#i#j#m$P$R%X%xQ#e!YQ${#mQ%w$tQ&j%xR&w&hQ!ygQ#p!`Q$^!xR%f$`R#n!]!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QQ!qdR$X!rQ!PVR#TrQ#S!PR$i#TQ!SWR#VsQ!UXR#WtQ{UQ!wgQ#^yQ#o!_Q$U!nQ$[!uQ$_!yQ%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",nodeNames:`⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles`,maxTerm:143,nodeProps:[[`isolate`,-2,5,36,``],[`openedBy`,20,`(`,28,`[`,31,`{`],[`closedBy`,21,`)`,29,`]`,32,`}`]],propSources:[hAe],skippedNodes:[0,5,106],repeatNodeCount:15,tokenData:"JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Qj)OUOy%Qz#]%Q#]#^)b#^;'S%Q;'S;=`%c<%lO%Qj)gU!a`Oy%Qz#a%Q#a#b)y#b;'S%Q;'S;=`%c<%lO%Qj*OU!a`Oy%Qz#d%Q#d#e*b#e;'S%Q;'S;=`%c<%lO%Qj*gU!a`Oy%Qz#c%Q#c#d*y#d;'S%Q;'S;=`%c<%lO%Qj+OU!a`Oy%Qz#f%Q#f#g+b#g;'S%Q;'S;=`%c<%lO%Qj+gU!a`Oy%Qz#h%Q#h#i+y#i;'S%Q;'S;=`%c<%lO%Qj,OU!a`Oy%Qz#T%Q#T#U,b#U;'S%Q;'S;=`%c<%lO%Qj,gU!a`Oy%Qz#b%Q#b#c,y#c;'S%Q;'S;=`%c<%lO%Qj-OU!a`Oy%Qz#h%Q#h#i-b#i;'S%Q;'S;=`%c<%lO%Qj-iS!qY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q~-xWOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c<%lO-u~.gOt~~.jRO;'S-u;'S;=`.s;=`O-u~.vXOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c;=`<%l-u<%lO-u~/fP;=`<%l-uj/nYjYOy%Qz!Q%Q!Q![0^![!c%Q!c!i0^!i#T%Q#T#Z0^#Z;'S%Q;'S;=`%c<%lO%Qj0cY!a`Oy%Qz!Q%Q!Q![1R![!c%Q!c!i1R!i#T%Q#T#Z1R#Z;'S%Q;'S;=`%c<%lO%Qj1WY!a`Oy%Qz!Q%Q!Q![1v![!c%Q!c!i1v!i#T%Q#T#Z1v#Z;'S%Q;'S;=`%c<%lO%Qj1}YrY!a`Oy%Qz!Q%Q!Q![2m![!c%Q!c!i2m!i#T%Q#T#Z2m#Z;'S%Q;'S;=`%c<%lO%Qj2tYrY!a`Oy%Qz!Q%Q!Q![3d![!c%Q!c!i3d!i#T%Q#T#Z3d#Z;'S%Q;'S;=`%c<%lO%Qj3iY!a`Oy%Qz!Q%Q!Q![4X![!c%Q!c!i4X!i#T%Q#T#Z4X#Z;'S%Q;'S;=`%c<%lO%Qj4`YrY!a`Oy%Qz!Q%Q!Q![5O![!c%Q!c!i5O!i#T%Q#T#Z5O#Z;'S%Q;'S;=`%c<%lO%Qj5TY!a`Oy%Qz!Q%Q!Q![5s![!c%Q!c!i5s!i#T%Q#T#Z5s#Z;'S%Q;'S;=`%c<%lO%Qj5zSrY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qd6ZUOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qd6tS!hS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qb7VSZQOy%Qz;'S%Q;'S;=`%c<%lO%Q~7fWOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z<%lO7c~8RRO;'S7c;'S;=`8[;=`O7c~8_XOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z;=`<%l7c<%lO7c~8}P;=`<%l7cj9VSeYOy%Qz;'S%Q;'S;=`%c<%lO%Q~9hOd~n9oUWQvWOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qj:YWvW!mQOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj:wU!a`Oy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Qj;bY!a`#}YOy%Qz!Q%Q!Q![;Z![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%Qj<VY!a`Oy%Qz{%Q{|<u|}%Q}!O<u!O!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj<zU!a`Oy%Qz!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj=eU!a`#}YOy%Qz!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj>O[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%Qj>yS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%QjBUU`YOy%Qz![%Q![!]Bh!];'S%Q;'S;=`%c<%lO%QbBoSaQ!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QjCQSkYOy%Qz;'S%Q;'S;=`%c<%lO%QhCcU!TWOy%Qz!_%Q!_!`Cu!`;'S%Q;'S;=`%c<%lO%QhC|S!TW!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QlDaS!TW!hSOy%Qz;'S%Q;'S;=`%c<%lO%QjDtV!jQ!TWOy%Qz!_%Q!_!`Cu!`!aEZ!a;'S%Q;'S;=`%c<%lO%QbEbS!jQ!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QjEqYOy%Qz}%Q}!OFa!O!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjFfW!a`Oy%Qz!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjGV[iY!a`Oy%Qz}%Q}!OGO!O!Q%Q!Q![GO![!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjHQSmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",tokenizers:[pAe,mAe,dAe,fAe,1,2,3,4,new ln(`m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~`,28,129)],topRules:{StyleSheet:[0,6],Styles:[1,105]},specialized:[{term:124,get:e=>gAe[e]||-1},{term:125,get:e=>_Ae[e]||-1},{term:4,get:e=>vAe[e]||-1},{term:25,get:e=>yAe[e]||-1},{term:123,get:e=>bAe[e]||-1}],tokenPrec:1963}),kP=null;function AP(){if(!kP&&typeof document==`object`&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!=`cssText`&&r!=`cssFloat`&&typeof e[r]==`string`&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,e=>`-`+e.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));kP=t.sort().map(e=>({type:`property`,label:e,apply:e+`: `}))}return kP||[]}var jP=`active.after.any-link.autofill.backdrop.before.checked.cue.default.defined.disabled.empty.enabled.file-selector-button.first.first-child.first-letter.first-line.first-of-type.focus.focus-visible.focus-within.fullscreen.has.host.host-context.hover.in-range.indeterminate.invalid.is.lang.last-child.last-of-type.left.link.marker.modal.not.nth-child.nth-last-child.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.part.placeholder.placeholder-shown.read-only.read-write.required.right.root.scope.selection.slotted.target.target-text.valid.visited.where`.split(`.`).map(e=>({type:`class`,label:e})),MP=`above.absolute.activeborder.additive.activecaption.after-white-space.ahead.alias.all.all-scroll.alphabetic.alternate.always.antialiased.appworkspace.asterisks.attr.auto.auto-flow.avoid.avoid-column.avoid-page.avoid-region.axis-pan.background.backwards.baseline.below.bidi-override.blink.block.block-axis.bold.bolder.border.border-box.both.bottom.break.break-all.break-word.bullets.button.button-bevel.buttonface.buttonhighlight.buttonshadow.buttontext.calc.capitalize.caps-lock-indicator.caption.captiontext.caret.cell.center.checkbox.circle.cjk-decimal.clear.clip.close-quote.col-resize.collapse.color.color-burn.color-dodge.column.column-reverse.compact.condensed.contain.content.contents.content-box.context-menu.continuous.copy.counter.counters.cover.crop.cross.crosshair.currentcolor.cursive.cyclic.darken.dashed.decimal.decimal-leading-zero.default.default-button.dense.destination-atop.destination-in.destination-out.destination-over.difference.disc.discard.disclosure-closed.disclosure-open.document.dot-dash.dot-dot-dash.dotted.double.down.e-resize.ease.ease-in.ease-in-out.ease-out.element.ellipse.ellipsis.embed.end.ethiopic-abegede-gez.ethiopic-halehame-aa-er.ethiopic-halehame-gez.ew-resize.exclusion.expanded.extends.extra-condensed.extra-expanded.fantasy.fast.fill.fill-box.fixed.flat.flex.flex-end.flex-start.footnotes.forwards.from.geometricPrecision.graytext.grid.groove.hand.hard-light.help.hidden.hide.higher.highlight.highlighttext.horizontal.hsl.hsla.hue.icon.ignore.inactiveborder.inactivecaption.inactivecaptiontext.infinite.infobackground.infotext.inherit.initial.inline.inline-axis.inline-block.inline-flex.inline-grid.inline-table.inset.inside.intrinsic.invert.italic.justify.keep-all.landscape.large.larger.left.level.lighter.lighten.line-through.linear.linear-gradient.lines.list-item.listbox.listitem.local.logical.loud.lower.lower-hexadecimal.lower-latin.lower-norwegian.lowercase.ltr.luminosity.manipulation.match.matrix.matrix3d.medium.menu.menutext.message-box.middle.min-intrinsic.mix.monospace.move.multiple.multiple_mask_images.multiply.n-resize.narrower.ne-resize.nesw-resize.no-close-quote.no-drop.no-open-quote.no-repeat.none.normal.not-allowed.nowrap.ns-resize.numbers.numeric.nw-resize.nwse-resize.oblique.opacity.open-quote.optimizeLegibility.optimizeSpeed.outset.outside.outside-shape.overlay.overline.padding.padding-box.painted.page.paused.perspective.pinch-zoom.plus-darker.plus-lighter.pointer.polygon.portrait.pre.pre-line.pre-wrap.preserve-3d.progress.push-button.radial-gradient.radio.read-only.read-write.read-write-plaintext-only.rectangle.region.relative.repeat.repeating-linear-gradient.repeating-radial-gradient.repeat-x.repeat-y.reset.reverse.rgb.rgba.ridge.right.rotate.rotate3d.rotateX.rotateY.rotateZ.round.row.row-resize.row-reverse.rtl.run-in.running.s-resize.sans-serif.saturation.scale.scale3d.scaleX.scaleY.scaleZ.screen.scroll.scrollbar.scroll-position.se-resize.self-start.self-end.semi-condensed.semi-expanded.separate.serif.show.single.skew.skewX.skewY.skip-white-space.slide.slider-horizontal.slider-vertical.sliderthumb-horizontal.sliderthumb-vertical.slow.small.small-caps.small-caption.smaller.soft-light.solid.source-atop.source-in.source-out.source-over.space.space-around.space-between.space-evenly.spell-out.square.start.static.status-bar.stretch.stroke.stroke-box.sub.subpixel-antialiased.svg_masks.super.sw-resize.symbolic.symbols.system-ui.table.table-caption.table-cell.table-column.table-column-group.table-footer-group.table-header-group.table-row.table-row-group.text.text-bottom.text-top.textarea.textfield.thick.thin.threeddarkshadow.threedface.threedhighlight.threedlightshadow.threedshadow.to.top.transform.translate.translate3d.translateX.translateY.translateZ.transparent.ultra-condensed.ultra-expanded.underline.unidirectional-pan.unset.up.upper-latin.uppercase.url.var.vertical.vertical-text.view-box.visible.visibleFill.visiblePainted.visibleStroke.visual.w-resize.wait.wave.wider.window.windowframe.windowtext.words.wrap.wrap-reverse.x-large.x-small.xor.xx-large.xx-small`.split(`.`).map(e=>({type:`keyword`,label:e})).concat(`aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.grey.green.greenyellow.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen`.split(`.`).map(e=>({type:`constant`,label:e}))),SAe=`a.abbr.address.article.aside.b.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.dd.del.details.dfn.dialog.div.dl.dt.em.figcaption.figure.footer.form.header.hgroup.h1.h2.h3.h4.h5.h6.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.main.meter.nav.ol.output.p.pre.ruby.section.select.small.source.span.strong.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.tr.u.ul`.split(`.`).map(e=>({type:`type`,label:e})),CAe=[`@charset`,`@color-profile`,`@container`,`@counter-style`,`@font-face`,`@font-feature-values`,`@font-palette-values`,`@import`,`@keyframes`,`@layer`,`@media`,`@namespace`,`@page`,`@position-try`,`@property`,`@scope`,`@starting-style`,`@supports`,`@view-transition`].map(e=>({type:`keyword`,label:e})),NP=/^(\w[\w-]*|-\w[\w-]*|)$/,wAe=/^-(-[\w-]*)?$/;function TAe(e,t){if((e.name==`(`||e.type.isError)&&(e=e.parent||e),e.name!=`ArgList`)return!1;let n=e.parent?.firstChild;return n?.name==`Callee`?t.sliceString(n.from,n.to)==`var`:!1}var PP=new Ft,EAe=[`Declaration`];function DAe(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function FP(e,t,n){if(t.to-t.from>4096){let r=PP.get(t);if(r)return r;let i=[],a=new Set,o=t.cursor(ft.IncludeAnonymous);if(o.firstChild())do for(let t of FP(e,o.node,n))a.has(t.label)||(a.add(t.label),i.push(t));while(o.nextSibling());return PP.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(t=>{if(n(t)&&t.matchContext(EAe)&&t.node.nextSibling?.name==`:`){let n=e.sliceString(t.from,t.to);i.has(n)||(i.add(n),r.push({label:n,type:`variable`}))}}),r}}var IP=e=>t=>{let{state:n,pos:r}=t,i=bt(n).resolveInner(r,-1),a=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)==`-`;if(i.name==`PropertyName`||(a||i.name==`TagName`)&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:AP(),validFor:NP};if(i.name==`ValueName`)return{from:i.from,options:MP,validFor:NP};if(i.name==`PseudoClassName`)return{from:i.from,options:jP,validFor:NP};if(e(i)||(t.explicit||a)&&TAe(i,n.doc))return{from:e(i)||a?i.from:r,options:FP(n.doc,DAe(i),e),validFor:wAe};if(i.name==`TagName`){for(let{parent:e}=i;e;e=e.parent)if(e.name==`Block`)return{from:i.from,options:AP(),validFor:NP};return{from:i.from,options:SAe,validFor:NP}}if(i.name==`AtKeyword`)return{from:i.from,options:CAe,validFor:NP};if(!t.explicit)return null;let o=i.resolve(r),s=o.childBefore(r);return s&&s.name==`:`&&o.name==`PseudoClassSelector`?{from:r,options:jP,validFor:NP}:s&&s.name==`:`&&o.name==`Declaration`||o.name==`ArgList`?{from:r,options:MP,validFor:NP}:o.name==`Block`||o.name==`Styles`?{from:r,options:AP(),validFor:NP}:null},LP=IP(e=>e.name==`VariableName`),RP=En.define({name:`css`,parser:xAe.configure({props:[gt.add({Declaration:cn()}),mt.add({"Block KeyframeList":Fn})]}),languageData:{commentTokens:{block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*\}$/,wordChars:`-`}});function zP(){return new kn(RP,RP.data.of({autocomplete:LP}))}var BP=[`_blank`,`_self`,`_top`,`_parent`],VP=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],HP=[`get`,`post`,`put`,`delete`],UP=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],WP=[`true`,`false`],GP={},OAe={a:{attrs:{href:null,ping:null,type:null,media:null,target:BP,hreflang:null}},abbr:GP,address:GP,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:GP,aside:GP,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:GP,base:{attrs:{href:null,target:BP}},bdi:GP,bdo:GP,blockquote:{attrs:{cite:null}},body:GP,br:GP,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:UP,formmethod:HP,formnovalidate:[`novalidate`],formtarget:BP,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:GP,center:GP,cite:GP,code:GP,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:GP,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:GP,div:GP,dl:GP,dt:GP,em:GP,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:GP,figure:GP,footer:GP,form:{attrs:{action:null,name:null,"accept-charset":VP,autocomplete:[`on`,`off`],enctype:UP,method:HP,novalidate:[`novalidate`],target:BP}},h1:GP,h2:GP,h3:GP,h4:GP,h5:GP,h6:GP,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:GP,hgroup:GP,hr:GP,html:{attrs:{manifest:null}},i:GP,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:UP,formmethod:HP,formnovalidate:[`novalidate`],formtarget:BP,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:GP,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:GP,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:GP,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:VP,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:GP,noscript:GP,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:GP,param:{attrs:{name:null,value:null}},pre:GP,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:GP,rt:GP,ruby:GP,samp:GP,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:VP}},section:GP,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:GP,source:{attrs:{src:null,type:null,media:null}},span:GP,strong:GP,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:GP,summary:GP,sup:GP,table:GP,tbody:GP,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:GP,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:GP,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:GP,time:{attrs:{datetime:null}},title:GP,tr:GP,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:GP,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:GP},KP={accesskey:null,class:null,contenteditable:WP,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:WP,autocorrect:WP,autocapitalize:WP,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":WP,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":WP,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":WP,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":WP,"aria-hidden":WP,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":WP,"aria-multiselectable":WP,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":WP,"aria-relevant":null,"aria-required":WP,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},qP=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of qP)KP[e]=null;var JP=class{constructor(e,t){this.tags={...OAe,...e},this.globalAttrs={...KP,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};JP.default=new JP;function YP(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function XP(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`)if(t)t=!1;else return e;return null}function ZP(e,t,n){return n.tags[YP(e,XP(t))]?.children||n.allTags}function QP(e,t){let n=[];for(let r=XP(t);r&&!r.type.isTop;r=XP(r.parent)){let i=YP(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var $P=/^[:\-\.\w\u00b7-\uffff]*$/;function eF(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=XP(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:ZP(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(QP(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function tF(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:QP(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:$P}}function kAe(e,t,n,r){let i=[],a=0;for(let r of ZP(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of QP(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function AAe(e,t,n,r,i){let a=XP(n),o=a?t.tags[YP(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:$P}}function jAe(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=XP(n),i=r?t.tags[YP(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function nF(e,t){let{state:n,pos:r}=t,i=bt(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?tF(n,i,i.from,r):eF(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?eF(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?tF(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?AAe(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?jAe(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?kAe(n,e,i,r):null}function rF(e){return nF(JP.default,e)}function iF(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new JP(t,n):JP.default;return e=>nF(r,e)}var MAe=Bn.parser.configure({top:`SingleExpression`}),aF=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:tee.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:eee.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:Rn.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:MAe},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Bn.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:RP.parser}],oF=[{name:`style`,parser:RP.parser.configure({top:`Styles`})}].concat(qP.map(e=>({name:e,parser:Bn.parser}))),sF=En.define({name:`html`,parser:Jke.configure({props:[gt.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),mt.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),gn.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),cF=sF.configure({wrap:yP(aF,oF)});function lF(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=yP((e.nestedLanguages||[]).concat(aF),(e.nestedAttributes||[]).concat(oF))),new kn(n?sF.configure({wrap:n,dialect:t}):t?cF.configure({dialect:t}):cF,[cF.data.of({autocomplete:iF(e)}),e.autoCloseTags===!1?[]:dF,zn().support,zP().support])}var uF=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `)),dF=Ht.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!cF.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=bt(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if(t.parent?.lastChild?.name!=`CloseTag`&&(a=YP(o.doc,t.parent,n))&&!uF.has(a))return{range:e,changes:{from:n,to:n+(o.doc.sliceString(n,n+1)===`>`?1:0),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=YP(o.doc,e,n))&&!uF.has(a)){let e=n+(o.doc.sliceString(n,n+1)===`>`?1:0),t=`${a}>`;return{range:an.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),fF=qt({commentTokens:{block:{open:`<!--`,close:`-->`}}}),pF=new fn,mF=ZOe.configure({props:[mt.add(e=>!e.is(`Block`)||e.is(`Document`)||hF(e)!=null||NAe(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),pF.add(hF),gt.add({Document:()=>null}),dn.add({Document:fF})]});function hF(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function NAe(e){return e.name==`OrderedList`||e.name==`BulletList`}function PAe(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=hF(e.type))!=null&&r<=t)break;n=e}return n.to}var FAe=Nn.of((e,t,n)=>{for(let r=bt(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(pF);if(e==null)continue;let t=PAe(r,e);if(t>n)return{from:n,to:t}}return null});function gF(e){return new Qt(fF,e,[],`markdown`)}var _F=gF(mF),vF=gF(mF.configure([ske,lke,cke,uke,{props:[mt.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function IAe(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):W.matchLanguageName(e,n,!0),t instanceof W)return t.support?t.support.language.parser:en.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var yF=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}else{for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}}marker(e,t){let n=this.node.name==`OrderedList`?String(+xF(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function bF(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new yF(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new yF(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new yF(i.parent,s,s+t,a[1],e,n,i))}}return r}function xF(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function SF(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=xF(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function CF(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(dt)!=` `)return e;let r=_t(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var wF=(e={})=>({state:t,dispatch:n})=>{let r=bt(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!vF.isActiveAt(t,n.from,-1)&&!vF.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=bF(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let u=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&u){let n=l.node.firstChild,r=l.node.getChild(`ListItem`,`ListItem`);if(n.to>=o||r&&r.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&SF(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&SF(e.item,i,r),{range:an.cursor(t+n.length),changes:r}}else{let e=DF(c,t,s);return{range:an.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&u&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let d=[];l.node.name==`OrderedList`&&SF(l.item,i,d);let f=l.item&&l.item.from<s.from,p=``;if(!f||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)p+=e==t&&!f?c[e].marker(i,1):c[e].blank(e<t?_t(s.text,4,c[e+1].from)-p.length:null);let m=o;for(;m>s.from&&/\s/.test(s.text.charAt(m-s.from-1));)m--;return p=CF(p,t),LAe(l.node,t.doc)&&(p=DF(c,t,s)+t.lineBreak+p),d.push({from:m,to:o,insert:t.lineBreak+p}),{range:an.cursor(m+p.length+1),changes:d}});return a?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)},TF=wF();function EF(e){return e.name==`QuoteMark`||e.name==`ListMark`}function LAe(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+(o?0:1)<a.number}function DF(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?_t(n.text,4,e[t+1].from)-r.length:null,t<i);return CF(r,t)}function RAe(e,t){let n=e.resolveInner(t,-1),r=t;EF(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(EF(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var OF=({state:e,dispatch:t})=>{let n=bt(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&vF.isActiveAt(e,t.from)){let t=a.lineAt(i),r=bF(RAe(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+(n.spaceAfter?1:0);if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:an.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(!n.item||t.from<=n.item.from||!/\S/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(_t(t.text,4,n.to)-_t(t.text,4,n.from));return r==t.from&&(i=CF(i,e)),{range:an.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:an.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return r?!1:(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)},kF=[{key:`Enter`,run:TF},{key:`Backspace`,run:OF}],AF=lF({matchClosingTags:!1});function jF(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=_F,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:s=AF}=e;if(!(i instanceof mN))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],l=[s.support,FAe],u;o&&l.push(NF),n instanceof kn?(l.push(n.support),u=n.language):n&&(u=n);let d=t||u?IAe(t,u):void 0;c.push($Oe({codeParser:d,htmlParser:s.language.parser})),r&&l.push(sn.high(ut.of(kF)));let f=gF(i.configure(c));return a&&l.push(f.data.of({autocomplete:zAe})),new kn(f,l)}function zAe(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=bt(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:BAe(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var MF=null;function BAe(){if(MF)return MF;let e=rF(new oee(Sn.create({extensions:AF}),0,!0));return MF=e?e.options:[]}var VAe=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,NF=Ht.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!vF.isActiveAt(t.state,n.from,1)))return!1;let i=bt(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||VAe.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),a?!1:(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}}),PF=63,FF=64,HAe=1,UAe=2,IF=3,WAe=4,LF=5,GAe=6,KAe=7,RF=65,qAe=66,JAe=8,YAe=9,XAe=10,ZAe=11,QAe=12,zF=13,$Ae=19,eje=20,tje=29,nje=33,rje=34,ije=47,aje=0,BF=1,VF=2,HF=3,UF=4,WF=class{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}};WF.top=new WF(null,-1,aje);function GF(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(qF(t)||t==-1)return n}}function KF(e){return e==32||e==9}function qF(e){return e==10||e==13}function JF(e){return KF(e)||qF(e)}function YF(e){return e<0||JF(e)}var oje=new On({start:WF.top,reduce(e,t){return e.type==HF&&(t==eje||t==rje)?e.parent:e},shift(e,t,n,r){if(t==IF)return new WF(e,GF(r,r.pos),BF);if(t==RF||t==LF)return new WF(e,GF(r,r.pos),VF);if(t==PF)return e.parent;if(t==$Ae||t==nje)return new WF(e,0,HF);if(t==zF&&e.type==UF)return e.parent;if(t==ije){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new WF(e,e.depth+ +t[0],UF)}return e},hash(e){return e.hash}});function XF(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&YF(e.peek(n+3))}var sje=new vn((e,t)=>{if(e.next==-1&&t.canShift(FF))return e.acceptToken(FF);let n=e.peek(-1);if((qF(n)||n<0)&&t.context.type!=HF){if(XF(e,45))if(t.canShift(PF))e.acceptToken(PF);else return e.acceptToken(HAe,3);if(XF(e,46))if(t.canShift(PF))e.acceptToken(PF);else return e.acceptToken(UAe,3);let n=0;for(;e.next==32;)n++,e.advance();(n<t.context.depth||n==t.context.depth&&t.context.type==BF&&(e.next!=45||!YF(e.peek(1))))&&e.next!=-1&&!qF(e.next)&&e.next!=35&&e.acceptToken(PF,-n)}},{contextual:!0}),cje=new vn((e,t)=>{if(t.context.type==HF){e.next==63&&(e.advance(),YF(e.next)&&e.acceptToken(KAe));return}if(e.next==45)e.advance(),YF(e.next)&&e.acceptToken(t.context.type==BF&&t.context.depth==GF(e,e.pos-1)?WAe:IF);else if(e.next==63)e.advance(),YF(e.next)&&e.acceptToken(t.context.type==VF&&t.context.depth==GF(e,e.pos-1)?GAe:LF);else{let n=e.pos;for(;;)if(KF(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)$F(e);else if(e.next==38)eI(e);else if(e.next==42){eI(e);break}else if(e.next==39||e.next==34){if(tI(e,!0))break;return}else if(e.next==91||e.next==123){if(!uje(e))return;break}else{fje(e,!0,!1,0);break}for(;KF(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(tje))return;YF(e.peek(1))&&e.acceptTokenTo(t.context.type==VF&&t.context.depth==GF(e,n)?qAe:RF,n)}}},{contextual:!0});function lje(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function ZF(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function QF(e,t){return e.next==37?(e.advance(),ZF(e.next)&&e.advance(),ZF(e.next)&&e.advance(),!0):lje(e.next)||t&&e.next==44?(e.advance(),!0):!1}function $F(e){if(e.advance(),e.next==60){for(e.advance();;)if(!QF(e,!0)){e.next==62&&e.advance();break}}else for(;QF(e,!1););}function eI(e){for(e.advance();!YF(e.next)&&nI(e.tag)!=`f`;)e.advance()}function tI(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==n)if(a==39)if(e.next==39)e.advance();else break;else break;else if(a==92&&n==34)e.next>=0&&e.advance();else if(qF(a)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function uje(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!tI(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else if(e.next<0||e.pos>n||qF(e.next))return!1;else e.advance()}var dje=`iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif`;function nI(e){return e<33?`u`:e>125?`s`:dje[e-33]}function rI(e,t){let n=nI(e);return n!=`u`&&!(t&&n==`f`)}function fje(e,t,n,r){if(nI(e.next)==`s`||(e.next==63||e.next==58||e.next==45)&&rI(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let a=e.next,o=0,s=r+1;for(;JF(a);){if(qF(a)){if(t)return!1;s=0}else s++;a=e.peek(++o)}if(!(a>=0&&(a==58?rI(e.peek(o+1),n):a==35?e.peek(o-1)!=32:rI(a,n)))||!n&&s<=r||s==0&&!n&&(XF(e,45,o)||XF(e,46,o)))break;if(t&&nI(a)==`f`)return!1;for(let t=o;t>=0;t--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}var pje=new vn((e,t)=>{if(e.next==33)$F(e),e.acceptToken(QAe);else if(e.next==38||e.next==42){let t=e.next==38?XAe:ZAe;eI(e),e.acceptToken(t)}else e.next==39||e.next==34?(tI(e,!1),e.acceptToken(YAe)):fje(e,!1,t.context.type==HF,t.context.depth)&&e.acceptToken(JAe)}),mje=new vn((e,t)=>{let n=t.context.type==UF?t.context.depth:-1,r=e.pos;scan:for(;;){let i=0,a=e.next;for(;a==32;)a=e.peek(++i);if(!i&&(XF(e,45,i)||XF(e,46,i))||!qF(a)&&(n<0&&(n=Math.max(t.context.depth+1,i)),i<n))break;for(;;){if(e.next<0)break scan;let t=qF(e.next);if(e.advance(),t)continue scan;r=e.pos}}e.acceptTokenTo(zF,r)}),hje=Dt({DirectiveName:U.keyword,DirectiveContent:U.attributeValue,"DirectiveEnd DocEnd":U.meta,QuotedLiteral:U.string,BlockLiteralHeader:U.special(U.string),BlockLiteralContent:U.content,Literal:U.content,"Key/Literal Key/QuotedLiteral":U.definition(U.propertyName),"Anchor Alias":U.labelName,Tag:U.typeName,Comment:U.lineComment,": , -":U.separator,"?":U.punctuation,"[ ]":U.squareBracket,"{ }":U.brace}),gje=wn.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:`⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document`,maxTerm:74,context:oje,nodeProps:[[`isolate`,-3,8,9,14,``],[`openedBy`,18,`[`,32,`{`],[`closedBy`,19,`]`,33,`}`]],propSources:[hje],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[sje,cje,pje,mje,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),_je=wn.deserialize({version:14,states:"!vOQOPOOO]OPO'#C_OhOPO'#C^OOOO'#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d",stateData:`!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~`,goto:`vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS`,nodeNames:`⚠ Document Frontmatter DashLine FrontmatterContent Body`,maxTerm:10,skippedNodes:[0],repeatNodeCount:2,tokenData:"$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),vje=En.define({name:`yaml`,parser:gje.configure({props:[gt.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name==`BlockLiteralContent`&&t.from<t.to)return e.baseIndentFor(t);if(t.name==`BlockLiteral`)return e.baseIndentFor(t)+e.unit;if(t.name==`BlockSequence`||t.name==`BlockMapping`)return e.column(t.from,1);if(t.name==`QuotedLiteral`)return null;if(t.name==`Literal`){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)return null}}return null},FlowMapping:jn({closing:`}`}),FlowSequence:jn({closing:`]`})}),mt.add({"FlowMapping FlowSequence":Fn,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:`#`},indentOnInput:/^\s*[\]\}]$/}});function yje(){return new kn(vje)}En.define({name:`yaml-frontmatter`,parser:_je.configure({props:[Dt({DashLine:U.meta})]})});function Z(e){return new kn(rn.define(e))}function iI(e){return l(()=>import(`./dist-DBzjiykV.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([12,13,14]))}var bje=[W.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return l(()=>import(`./dist-CaejG1dm.js`).then(e=>e.cpp()),__vite__mapDeps([15,14]))}}),W.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return l(()=>import(`./dist-CaejG1dm.js`).then(e=>e.cpp()),__vite__mapDeps([15,14]))}}),W.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return iI(`Cassandra`)}}),W.of({name:`CSS`,extensions:[`css`],load(){return l(()=>import(`./dist-CsTUN8si.js`).then(e=>e.css()),__vite__mapDeps([16,14]))}}),W.of({name:`Go`,extensions:[`go`],load(){return l(()=>import(`./dist-jDblB_T7.js`).then(e=>e.go()),__vite__mapDeps([17,13,14]))}}),W.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return l(()=>import(`./dist-QFwjfINk.js`).then(e=>e.html()),__vite__mapDeps([18,19,2,13,14]))}}),W.of({name:`Java`,extensions:[`java`],load(){return l(()=>import(`./dist-DtDYJdOe.js`).then(e=>e.java()),__vite__mapDeps([20,14]))}}),W.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return l(()=>import(`./dist-jKjLdT3J.js`).then(e=>e.jinja()),__vite__mapDeps([21,19,2,13,14]))}}),W.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return l(()=>import(`./dist-BQUZZEUE.js`).then(e=>e.json()),__vite__mapDeps([22,14]))}}),W.of({name:`JSX`,extensions:[`jsx`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`LESS`,extensions:[`less`],load(){return l(()=>import(`./dist-BxwBNcvc.js`).then(e=>e.less()),__vite__mapDeps([23,14]))}}),W.of({name:`Liquid`,extensions:[`liquid`],load(){return l(()=>import(`./dist-BK1hUUAT.js`).then(e=>e.liquid()),__vite__mapDeps([24,19,2,13,14]))}}),W.of({name:`MariaDB SQL`,load(){return iI(`MariaSQL`)}}),W.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return l(()=>import(`./dist-BXDJblZH.js`).then(e=>e.markdown()),__vite__mapDeps([25,19,2,13,14]))}}),W.of({name:`MS SQL`,load(){return iI(`MSSQL`)}}),W.of({name:`MySQL`,load(){return iI(`MySQL`)}}),W.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return l(()=>import(`./dist-QQTVUSFN.js`).then(e=>e.php()),__vite__mapDeps([26,19,2,13,14]))}}),W.of({name:`PLSQL`,extensions:[`pls`],load(){return iI(`PLSQL`)}}),W.of({name:`PostgreSQL`,load(){return iI(`PostgreSQL`)}}),W.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return l(()=>import(`./dist-YdUjCFVN.js`).then(e=>e.python()),__vite__mapDeps([27,13,14]))}}),W.of({name:`Rust`,extensions:[`rs`],load(){return l(()=>import(`./dist-D65w4-0d.js`).then(e=>e.rust()),__vite__mapDeps([28,14]))}}),W.of({name:`Sass`,extensions:[`sass`],load(){return l(()=>import(`./dist-BKjvVOkT.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([29,14]))}}),W.of({name:`SCSS`,extensions:[`scss`],load(){return l(()=>import(`./dist-BKjvVOkT.js`).then(e=>e.sass()),__vite__mapDeps([29,14]))}}),W.of({name:`SQL`,extensions:[`sql`],load(){return iI(`StandardSQL`)}}),W.of({name:`SQLite`,load(){return iI(`SQLite`)}}),W.of({name:`TSX`,extensions:[`tsx`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return l(()=>import(`./dist-CaORa3GR.js`).then(e=>e.wast()),__vite__mapDeps([30,14]))}}),W.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return l(()=>import(`./dist-lNuHRy_r.js`).then(e=>e.xml()),__vite__mapDeps([31,14]))}}),W.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return l(()=>import(`./dist-CJnrqTgc.js`).then(e=>e.yaml()),__vite__mapDeps([32,14]))}}),W.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return l(()=>import(`./apl-C5q1JUQ9.js`).then(e=>Z(e.apl)),[])}}),W.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return l(()=>import(`./asciiarmor-BILZohWd.js`).then(e=>Z(e.asciiArmor)),[])}}),W.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return l(()=>import(`./asn1-DI_FTWHM.js`).then(e=>Z(e.asn1({}))),[])}}),W.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return l(()=>import(`./asterisk-CoYCo1jb.js`).then(e=>Z(e.asterisk)),[])}}),W.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return l(()=>import(`./brainfuck-CYletLv0.js`).then(e=>Z(e.brainfuck)),[])}}),W.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return l(()=>import(`./cobol-Bp7hDZyh.js`).then(e=>Z(e.cobol)),[])}}),W.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.csharp)),[])}}),W.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`ClojureScript`,extensions:[`cljs`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return l(()=>import(`./css-DOOfdS_P.js`).then(e=>Z(e.gss)),[])}}),W.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return l(()=>import(`./cmake-Jt1LPs3Y.js`).then(e=>Z(e.cmake)),[])}}),W.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return l(()=>import(`./coffeescript-CAuf1hwk.js`).then(e=>Z(e.coffeeScript)),[])}}),W.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return l(()=>import(`./commonlisp-CTI5EoKD.js`).then(e=>Z(e.commonLisp)),[])}}),W.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return l(()=>import(`./cypher-D3PQ91Qx.js`).then(e=>Z(e.cypher)),[])}}),W.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return l(()=>import(`./python-DJuj1ZhC.js`).then(e=>Z(e.cython)),[])}}),W.of({name:`Crystal`,extensions:[`cr`],load(){return l(()=>import(`./crystal-C3-bEPdz.js`).then(e=>Z(e.crystal)),[])}}),W.of({name:`D`,extensions:[`d`],load(){return l(()=>import(`./d-Czsz-1nb.js`).then(e=>Z(e.d)),[])}}),W.of({name:`Dart`,extensions:[`dart`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.dart)),[])}}),W.of({name:`diff`,extensions:[`diff`,`patch`],load(){return l(()=>import(`./diff-DTEjW6Ec.js`).then(e=>Z(e.diff)),[])}}),W.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return l(()=>import(`./dockerfile-B9WyxmEu.js`).then(e=>Z(e.dockerFile)),__vite__mapDeps([33,34]))}}),W.of({name:`DTD`,extensions:[`dtd`],load(){return l(()=>import(`./dtd-DQ2nGp1I.js`).then(e=>Z(e.dtd)),[])}}),W.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return l(()=>import(`./dylan-Bje9X1q4.js`).then(e=>Z(e.dylan)),[])}}),W.of({name:`EBNF`,load(){return l(()=>import(`./ebnf-DEiu6Mj6.js`).then(e=>Z(e.ebnf)),[])}}),W.of({name:`ECL`,extensions:[`ecl`],load(){return l(()=>import(`./ecl-CcozsAMR.js`).then(e=>Z(e.ecl)),[])}}),W.of({name:`edn`,extensions:[`edn`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`Eiffel`,extensions:[`e`],load(){return l(()=>import(`./eiffel-CZRTum_1.js`).then(e=>Z(e.eiffel)),[])}}),W.of({name:`Elm`,extensions:[`elm`],load(){return l(()=>import(`./elm-Cgd7AVBx.js`).then(e=>Z(e.elm)),[])}}),W.of({name:`Erlang`,extensions:[`erl`],load(){return l(()=>import(`./erlang-BPW5ALQf.js`).then(e=>Z(e.erlang)),[])}}),W.of({name:`Esper`,load(){return l(()=>import(`./sql-C34SerfO.js`).then(e=>Z(e.esper)),[])}}),W.of({name:`Factor`,extensions:[`factor`],load(){return l(()=>import(`./factor-DRSLM7tp.js`).then(e=>Z(e.factor)),__vite__mapDeps([35,34]))}}),W.of({name:`FCL`,load(){return l(()=>import(`./fcl-Bv0H-MfR.js`).then(e=>Z(e.fcl)),[])}}),W.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return l(()=>import(`./forth-CFHh7lFN.js`).then(e=>Z(e.forth)),[])}}),W.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return l(()=>import(`./fortran-CAaqh7IE.js`).then(e=>Z(e.fortran)),[])}}),W.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.fSharp)),[])}}),W.of({name:`Gas`,extensions:[`s`],load(){return l(()=>import(`./gas-BXzla7cs.js`).then(e=>Z(e.gas)),[])}}),W.of({name:`Gherkin`,extensions:[`feature`],load(){return l(()=>import(`./gherkin-CjaNPZBr.js`).then(e=>Z(e.gherkin)),[])}}),W.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return l(()=>import(`./groovy-CQ51TE23.js`).then(e=>Z(e.groovy)),[])}}),W.of({name:`Haskell`,extensions:[`hs`],load(){return l(()=>import(`./haskell-BdLQbrXE.js`).then(e=>Z(e.haskell)),[])}}),W.of({name:`Haxe`,extensions:[`hx`],load(){return l(()=>import(`./haxe-BR_oGt5J.js`).then(e=>Z(e.haxe)),[])}}),W.of({name:`HXML`,extensions:[`hxml`],load(){return l(()=>import(`./haxe-BR_oGt5J.js`).then(e=>Z(e.hxml)),[])}}),W.of({name:`HTTP`,load(){return l(()=>import(`./http-D4AikK5M.js`).then(e=>Z(e.http)),[])}}),W.of({name:`IDL`,extensions:[`pro`],load(){return l(()=>import(`./idl-BhLYYWfC.js`).then(e=>Z(e.idl)),[])}}),W.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return l(()=>import(`./javascript-DoCiwYd8.js`).then(e=>Z(e.jsonld)),[])}}),W.of({name:`Julia`,extensions:[`jl`],load(){return l(()=>import(`./julia-TGuXb-4v.js`).then(e=>Z(e.julia)),[])}}),W.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.kotlin)),[])}}),W.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return l(()=>import(`./livescript-C-wu00Ej.js`).then(e=>Z(e.liveScript)),[])}}),W.of({name:`Lua`,extensions:[`lua`],load(){return l(()=>import(`./lua-CGv6iOiJ.js`).then(e=>Z(e.lua)),[])}}),W.of({name:`mIRC`,extensions:[`mrc`],load(){return l(()=>import(`./mirc-Dhg1_lkg.js`).then(e=>Z(e.mirc)),[])}}),W.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return l(()=>import(`./mathematica-C8bAvxin.js`).then(e=>Z(e.mathematica)),[])}}),W.of({name:`Modelica`,extensions:[`mo`],load(){return l(()=>import(`./modelica-CcMbWJDy.js`).then(e=>Z(e.modelica)),[])}}),W.of({name:`MUMPS`,extensions:[`mps`],load(){return l(()=>import(`./mumps-BJZx4oNt.js`).then(e=>Z(e.mumps)),[])}}),W.of({name:`Mbox`,extensions:[`mbox`],load(){return l(()=>import(`./mbox-BYumpJj6.js`).then(e=>Z(e.mbox)),[])}}),W.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return l(()=>import(`./nginx-PPx_WycM.js`).then(e=>Z(e.nginx)),[])}}),W.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return l(()=>import(`./nsis-BOISW3t0.js`).then(e=>Z(e.nsis)),__vite__mapDeps([36,34]))}}),W.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return l(()=>import(`./ntriples--kmqf5za.js`).then(e=>Z(e.ntriples)),[])}}),W.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.objectiveC)),[])}}),W.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.objectiveCpp)),[])}}),W.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.oCaml)),[])}}),W.of({name:`Octave`,extensions:[`m`],load(){return l(()=>import(`./octave-CAcJQTlE.js`).then(e=>Z(e.octave)),[])}}),W.of({name:`Oz`,extensions:[`oz`],load(){return l(()=>import(`./oz-ARD1A4_T.js`).then(e=>Z(e.oz)),[])}}),W.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return l(()=>import(`./pascal-DK7Ai13I.js`).then(e=>Z(e.pascal)),[])}}),W.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return l(()=>import(`./perl-C687o_bL.js`).then(e=>Z(e.perl)),[])}}),W.of({name:`Pig`,extensions:[`pig`],load(){return l(()=>import(`./pig-C8e4kEQV.js`).then(e=>Z(e.pig)),[])}}),W.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return l(()=>import(`./powershell-C2Y_oyRr.js`).then(e=>Z(e.powerShell)),[])}}),W.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return l(()=>import(`./properties-DmYRuvnA.js`).then(e=>Z(e.properties)),[])}}),W.of({name:`ProtoBuf`,extensions:[`proto`],load(){return l(()=>import(`./protobuf-CD6bEuFl.js`).then(e=>Z(e.protobuf)),[])}}),W.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return l(()=>import(`./pug-RUWq2f7J.js`).then(e=>Z(e.pug)),__vite__mapDeps([37,38]))}}),W.of({name:`Puppet`,extensions:[`pp`],load(){return l(()=>import(`./puppet-CsErpTW6.js`).then(e=>Z(e.puppet)),[])}}),W.of({name:`Q`,extensions:[`q`],load(){return l(()=>import(`./q-DKzQvbt-.js`).then(e=>Z(e.q)),[])}}),W.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return l(()=>import(`./r-DUDpJ6Ff.js`).then(e=>Z(e.r)),[])}}),W.of({name:`RPM Changes`,load(){return l(()=>import(`./rpm-qoLWOnFN.js`).then(e=>Z(e.rpmChanges)),[])}}),W.of({name:`RPM Spec`,extensions:[`spec`],load(){return l(()=>import(`./rpm-qoLWOnFN.js`).then(e=>Z(e.rpmSpec)),[])}}),W.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return l(()=>import(`./ruby-FGrV8nFX.js`).then(e=>Z(e.ruby)),[])}}),W.of({name:`SAS`,extensions:[`sas`],load(){return l(()=>import(`./sas-BWqJ1mab.js`).then(e=>Z(e.sas)),[])}}),W.of({name:`Scala`,extensions:[`scala`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.scala)),[])}}),W.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return l(()=>import(`./scheme-D9O3un-H.js`).then(e=>Z(e.scheme)),[])}}),W.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return l(()=>import(`./shell-B1pKmMgB.js`).then(e=>Z(e.shell)),[])}}),W.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return l(()=>import(`./sieve-D6RnHXa8.js`).then(e=>Z(e.sieve)),[])}}),W.of({name:`Smalltalk`,extensions:[`st`],load(){return l(()=>import(`./smalltalk-Bg8P7Hpz.js`).then(e=>Z(e.smalltalk)),[])}}),W.of({name:`Solr`,load(){return l(()=>import(`./solr-DCTMbxYh.js`).then(e=>Z(e.solr)),[])}}),W.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.sml)),[])}}),W.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return l(()=>import(`./sparql-D3342bJj.js`).then(e=>Z(e.sparql)),[])}}),W.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return l(()=>import(`./spreadsheet-D5vgGBWN.js`).then(e=>Z(e.spreadsheet)),[])}}),W.of({name:`Squirrel`,extensions:[`nut`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.squirrel)),[])}}),W.of({name:`Stylus`,extensions:[`styl`],load(){return l(()=>import(`./stylus-uKe9pX_z.js`).then(e=>Z(e.stylus)),[])}}),W.of({name:`Swift`,extensions:[`swift`],load(){return l(()=>import(`./swift-BwGtfoET.js`).then(e=>Z(e.swift)),[])}}),W.of({name:`sTeX`,load(){return l(()=>import(`./stex-CIr7vrJc.js`).then(e=>Z(e.stex)),[])}}),W.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return l(()=>import(`./stex-CIr7vrJc.js`).then(e=>Z(e.stex)),[])}}),W.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return l(()=>import(`./verilog-T4dM3A9w.js`).then(e=>Z(e.verilog)),[])}}),W.of({name:`Tcl`,extensions:[`tcl`],load(){return l(()=>import(`./tcl-CJ_CtVRZ.js`).then(e=>Z(e.tcl)),[])}}),W.of({name:`Textile`,extensions:[`textile`],load(){return l(()=>import(`./textile-BwILayi5.js`).then(e=>Z(e.textile)),[])}}),W.of({name:`TiddlyWiki`,load(){return l(()=>import(`./tiddlywiki-CBwaBkZo.js`).then(e=>Z(e.tiddlyWiki)),[])}}),W.of({name:`Tiki wiki`,load(){return l(()=>import(`./tiki-DrYLgX3z.js`).then(e=>Z(e.tiki)),[])}}),W.of({name:`TOML`,extensions:[`toml`],load(){return l(()=>import(`./toml-B15mRAoh.js`).then(e=>Z(e.toml)),[])}}),W.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return l(()=>import(`./troff-1GwZ4_kM.js`).then(e=>Z(e.troff)),[])}}),W.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return l(()=>import(`./ttcn-Rt4tcn5J.js`).then(e=>Z(e.ttcn)),[])}}),W.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return l(()=>import(`./ttcn-cfg-B2QycmWC.js`).then(e=>Z(e.ttcnCfg)),[])}}),W.of({name:`Turtle`,extensions:[`ttl`],load(){return l(()=>import(`./turtle-B99g2iYO.js`).then(e=>Z(e.turtle)),[])}}),W.of({name:`Web IDL`,extensions:[`webidl`],load(){return l(()=>import(`./webidl-BMlkVTYq.js`).then(e=>Z(e.webIDL)),[])}}),W.of({name:`VB.NET`,extensions:[`vb`],load(){return l(()=>import(`./vb-BNGsVLgX.js`).then(e=>Z(e.vb)),[])}}),W.of({name:`VBScript`,extensions:[`vbs`],load(){return l(()=>import(`./vbscript-C3L-Slq1.js`).then(e=>Z(e.vbScript)),[])}}),W.of({name:`Velocity`,extensions:[`vtl`],load(){return l(()=>import(`./velocity-B5fLEzdR.js`).then(e=>Z(e.velocity)),[])}}),W.of({name:`Verilog`,extensions:[`v`],load(){return l(()=>import(`./verilog-T4dM3A9w.js`).then(e=>Z(e.verilog)),[])}}),W.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return l(()=>import(`./vhdl-Bdbtaye2.js`).then(e=>Z(e.vhdl)),[])}}),W.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return l(()=>import(`./xquery-BHRymSKf.js`).then(e=>Z(e.xQuery)),[])}}),W.of({name:`Yacas`,extensions:[`ys`],load(){return l(()=>import(`./yacas-B2Ltfl3H.js`).then(e=>Z(e.yacas)),[])}}),W.of({name:`Z80`,extensions:[`z80`],load(){return l(()=>import(`./z80-DJxBw9IF.js`).then(e=>Z(e.z80)),[])}}),W.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.mscgen)),[])}}),W.of({name:`Xù`,extensions:[`xu`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.xu)),[])}}),W.of({name:`MsGenny`,extensions:[`msgenny`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.msgenny)),[])}}),W.of({name:`Vue`,extensions:[`vue`],load(){return l(()=>import(`./dist-B6xgXKhe.js`).then(e=>e.vue()),__vite__mapDeps([39,19,2,13,14]))}}),W.of({name:`Angular Template`,load(){return l(()=>import(`./dist-BqptbA-e.js`).then(e=>e.angular()),__vite__mapDeps([40,19,2,13,14]))}})],aI={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},xje={borderLeftWidth:`2px`},oI={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},sI={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},cI={border:`none`,borderRadius:`4px`,padding:`2px 10px`},Sje={borderRadius:`2px`},lI={borderRadius:`2px`},uI={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},dI={width:`12px`,height:`12px`,borderRadius:`6px`},fI={borderRadius:`4px`,padding:`2px 6px`},pI={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},mI=`#0d1117`,hI=`#c9d1d9`,Cje=`#264F78`,gI=`#8b949e`,_I=`#ffffff`,vI=`#7ee787`,yI=`#d2a8ff`,bI=`#79c0ff`,xI=`#ff7b72`,SI=`#a5d6ff`,wje=`#2c333a`,Tje=`#3c444d`,CI=`#ffab70`,wI=`#161b22`,TI=`#30363d`,Eje=`#21262d`,EI=`#f97583`,Dje=`#2d333b1a`,DI=`#21262d`,OI=_I,Oje=Cje,kje=`#3a587a75`,Aje=`#4d90fe`,jje=`#d29922`,Mje=`#3a587a55`,kI=`#58a6ff`,Nje=`#bc8cff`,Pje=`#2ea04350`,Fje=`#f8514940`,AI=`#7ee787`,jI=`#ff7b72`,Ije=[Ht.theme({"&":{color:hI,backgroundColor:mI,fontSize:aI.fontSize,fontFamily:aI.fontFamily},".cm-content":{caretColor:OI,lineHeight:aI.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:OI,borderLeftWidth:xje.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${OI}99`,color:mI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Oje},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#3a587a`,outline:`1px solid ${bI}`,color:hI,borderRadius:fI.borderRadius,"& span":{color:hI}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Aje,color:_I,padding:fI.padding,"& span":{color:_I}},".cm-search.cm-panel.cm-textfield":{color:hI,borderRadius:fI.borderRadius,padding:fI.padding},".cm-panels":{backgroundColor:DI,color:hI,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${TI}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${TI}`},".cm-panel button":{backgroundColor:DI,color:hI,border:cI.border,borderRadius:cI.borderRadius,padding:cI.padding},".cm-panel button:hover":{backgroundColor:wje},".cm-activeLine":{backgroundColor:Dje,borderRadius:Sje.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:wI,color:gI,border:sI.border,borderRight:`1px solid #30363d`,paddingRight:sI.paddingRight},".cm-activeLineGutter":{backgroundColor:Eje,color:hI,fontWeight:sI.fontWeight},".cm-lineNumbers":{fontSize:sI.fontSize,lineHeight:sI.lineHeight},".cm-foldGutter":{fontSize:sI.fontSize,lineHeight:sI.lineHeight},".cm-foldGutter .cm-gutterElement":{color:gI,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:hI},".cm-insertedLine":{textDecoration:oI.insertedTextDecoration,backgroundColor:Pje,color:AI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:oI.insertedTextDecoration,backgroundColor:`${Pje} !important`,color:AI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious,border:`1px solid ${AI}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:oI.deletedTextDecoration,backgroundColor:Fje,color:jI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:oI.deletedTextDecoration,backgroundColor:`${Fje} !important`,color:jI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious,border:`1px solid ${jI}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:DI,border:`1px solid ${TI}`,borderRadius:pI.borderRadius,padding:pI.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:DI,border:`none`},"& > ul > li":{padding:pI.padding,lineHeight:pI.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Oje,color:_I,borderRadius:pI.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:gI,paddingRight:pI.paddingRight},"& > ul > li > span.cm-completionDetail":{color:gI,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:DI,borderBottomColor:DI},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${EI}`},"&-warning":{borderLeft:`3px solid ${jje}`},"&-info":{borderLeft:`3px solid ${kI}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${EI}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${jje}`},".cm-matchingBracket":{backgroundColor:kje,outline:`1px solid ${Aje}`,borderRadius:lI.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#f9758340`,outline:`1px solid ${EI}`,borderRadius:lI.borderRadius},".cm-selectionMatch":{backgroundColor:Mje,outline:`1px solid ${Cje}50`,borderRadius:lI.borderRadius},".cm-foldPlaceholder":{backgroundColor:DI,color:gI,border:`1px dotted ${TI}70`,borderRadius:uI.borderRadius,padding:uI.padding,margin:uI.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${mI}, 0 0 0 3px ${kI}40`},"& .cm-scroller::-webkit-scrollbar":{width:dI.width,height:dI.height},"& .cm-scroller::-webkit-scrollbar-track":{background:wI},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:TI,borderRadius:dI.borderRadius,border:`3px solid ${wI}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:Tje},".cm-ghostText":{opacity:`0.5`,color:gI}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:xI,fontWeight:`bold`},{tag:U.controlKeyword,color:xI,fontWeight:`bold`},{tag:U.moduleKeyword,color:xI,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:bI},{tag:[U.variableName],color:bI},{tag:[U.propertyName],color:yI,fontStyle:`normal`},{tag:[U.typeName],color:xI},{tag:[U.className],color:yI,fontStyle:`italic`},{tag:[U.namespace],color:bI,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:hI},{tag:[U.bracket],color:gI},{tag:[U.brace],color:gI},{tag:[U.punctuation],color:gI},{tag:[U.function(U.variableName),U.labelName],color:vI},{tag:[U.definition(U.variableName)],color:bI},{tag:U.number,color:CI},{tag:U.changed,color:CI},{tag:U.annotation,color:EI,fontStyle:`italic`},{tag:U.modifier,color:CI,fontStyle:`italic`},{tag:U.self,color:CI},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:CI},{tag:[U.atom,U.bool,U.special(U.variableName)],color:CI},{tag:[U.processingInstruction,U.inserted],color:vI},{tag:[U.special(U.string),U.regexp],color:SI},{tag:U.string,color:SI},{tag:U.definition(U.typeName),color:xI,fontWeight:`bold`},{tag:U.meta,color:gI},{tag:U.comment,fontStyle:`italic`,color:gI},{tag:U.docComment,fontStyle:`italic`,color:gI},{tag:[U.tagName],color:vI},{tag:[U.attributeName],color:yI},{tag:[U.heading],fontWeight:`bold`,color:bI},{tag:[U.strong],fontWeight:`bold`,color:bI},{tag:[U.emphasis],fontStyle:`italic`,color:SI},{tag:[U.link],color:Nje,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:kI,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:hI,textDecoration:`underline wavy`,borderBottom:`1px wavy ${EI}`},{tag:[U.strikethrough],color:EI,textDecoration:`line-through`},{tag:U.constant(U.name),color:CI},{tag:U.deleted,color:EI},{tag:U.squareBracket,color:gI},{tag:U.angleBracket,color:gI},{tag:U.monospace,color:hI},{tag:[U.contentSeparator],color:bI},{tag:U.quote,color:gI}]))],MI={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},Lje={borderLeftWidth:`2px`},NI={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},PI={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},FI={border:`none`,borderRadius:`4px`,padding:`2px 10px`},Rje={borderRadius:`2px`},II={borderRadius:`2px`},LI={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},RI={width:`12px`,height:`12px`,borderRadius:`6px`},zI={borderRadius:`4px`,padding:`2px 6px`},BI={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},VI=`#ffffff`,HI=`#24292e`,zje=`#BBDFFF`,UI=`#6e7781`,Bje=`#f6f8fa`,Vje=`#116329`,WI=`#6a737d`,GI=`#6f42c1`,KI=`#005cc5`,qI=`#d73a49`,JI=`#032f62`,Hje=`#22863a`,YI=`#e36209`,Uje=`#f1f8ff`,XI=`#e1e4e8`,Wje=`#f8f9fa`,ZI=`#cb2431`,Gje=`#BBDFFF20`,QI=Wje,$I=HI,Kje=zje,qje=`#e8f0fe`,Jje=`#0366d6`,Yje=`#b08800`,Xje=`#79b8ff40`,eL=`#0969da`,Zje=`#8250df`,Qje=`#e6ffec80`,$je=`#ffebe980`,tL=`#0f6d31`,nL=`#cf222e`,rL=[Ht.theme({"&":{color:HI,backgroundColor:VI,fontSize:MI.fontSize,fontFamily:MI.fontFamily},".cm-content":{caretColor:$I,lineHeight:MI.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:$I,borderLeftWidth:Lje.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${$I}99`,color:VI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Kje,color:HI},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#daebff`,outline:`1px solid ${KI}`,color:HI,borderRadius:zI.borderRadius,"& span":{color:HI}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#79b8ff`,color:VI,padding:zI.padding,"& span":{color:VI}},".cm-search.cm-panel.cm-textfield":{color:HI,borderRadius:zI.borderRadius,padding:zI.padding},".cm-panels":{backgroundColor:Bje,color:UI,borderRadius:`0 0 4px 4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${XI}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${XI}`},".cm-panel button":{backgroundColor:VI,color:HI,border:FI.border,borderRadius:FI.borderRadius,padding:FI.padding},".cm-panel button:hover":{backgroundColor:`#f5f5f5`},".cm-activeLine":{backgroundColor:Gje,borderRadius:Rje.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:Bje,color:UI,border:PI.border,borderRight:`1px solid ${XI}`,paddingRight:PI.paddingRight},".cm-activeLineGutter":{backgroundColor:Uje,color:HI,fontWeight:PI.fontWeight},".cm-lineNumbers":{fontSize:PI.fontSize,lineHeight:PI.lineHeight},".cm-foldGutter":{fontSize:PI.fontSize,lineHeight:PI.lineHeight},".cm-foldGutter .cm-gutterElement":{color:UI,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:HI},".cm-insertedLine":{textDecoration:NI.insertedTextDecoration,backgroundColor:Qje,color:tL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:NI.insertedTextDecoration,backgroundColor:`${Qje} !important`,color:tL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious,border:`1px solid ${tL}30`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:NI.deletedTextDecoration,backgroundColor:$je,color:nL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:NI.deletedTextDecoration,backgroundColor:`${$je} !important`,color:nL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious,border:`1px solid ${nL}30`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:QI,border:`1px solid ${XI}`,borderRadius:BI.borderRadius,padding:BI.padding,boxShadow:`0 1px 5px rgba(0, 0, 0, 0.1)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:QI,border:`none`},"& > ul > li":{padding:BI.padding,lineHeight:BI.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#0366d630`,color:HI,borderRadius:BI.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:`#0366d615`},"& > ul > li > span.cm-completionIcon":{color:UI,paddingRight:BI.paddingRight},"& > ul > li > span.cm-completionDetail":{color:UI,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:QI,borderBottomColor:QI},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${ZI}`},"&-warning":{borderLeft:`3px solid ${Yje}`},"&-info":{borderLeft:`3px solid ${eL}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${ZI}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${Yje}`},".cm-matchingBracket":{backgroundColor:qje,outline:`1px solid ${Jje}80`,borderRadius:II.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#ffeef080`,outline:`1px solid ${ZI}`,borderRadius:II.borderRadius},".cm-selectionMatch":{backgroundColor:Xje,outline:`1px solid ${zje}50`,borderRadius:II.borderRadius},".cm-foldPlaceholder":{backgroundColor:Xje,color:UI,border:`1px dotted ${XI}70`,borderRadius:LI.borderRadius,padding:LI.padding,margin:LI.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${VI}, 0 0 0 3px ${eL}40`},"& .cm-scroller::-webkit-scrollbar":{width:RI.width,height:RI.height},"& .cm-scroller::-webkit-scrollbar-track":{background:XI},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:HI,borderRadius:RI.borderRadius,border:`3px solid ${XI}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:WI},".cm-ghostText":{opacity:`0.5`,color:`#959da5`}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:qI,fontWeight:`bold`},{tag:U.controlKeyword,color:qI,fontWeight:`bold`},{tag:U.moduleKeyword,color:qI,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:KI},{tag:[U.variableName],color:KI},{tag:[U.propertyName],color:GI,fontStyle:`normal`},{tag:[U.typeName],color:qI},{tag:[U.className],color:GI,fontStyle:`italic`},{tag:[U.namespace],color:KI,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:HI},{tag:[U.bracket],color:WI},{tag:[U.brace],color:WI},{tag:[U.punctuation],color:WI},{tag:[U.function(U.variableName),U.labelName],color:Hje},{tag:[U.definition(U.variableName)],color:KI},{tag:U.number,color:YI},{tag:U.changed,color:YI},{tag:U.annotation,color:ZI,fontStyle:`italic`},{tag:U.modifier,color:YI,fontStyle:`italic`},{tag:U.self,color:YI},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:YI},{tag:[U.atom,U.bool,U.special(U.variableName)],color:YI},{tag:[U.processingInstruction,U.inserted],color:Hje},{tag:[U.special(U.string),U.regexp],color:JI},{tag:U.string,color:JI},{tag:U.definition(U.typeName),color:qI,fontWeight:`bold`},{tag:U.meta,color:WI},{tag:U.comment,fontStyle:`italic`,color:WI},{tag:U.docComment,fontStyle:`italic`,color:WI},{tag:[U.tagName],color:Vje},{tag:[U.attributeName],color:GI},{tag:[U.heading],fontWeight:`bold`,color:KI},{tag:[U.strong],fontWeight:`bold`,color:KI},{tag:[U.emphasis],fontStyle:`italic`,color:JI},{tag:[U.link],color:Zje,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:eL,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:HI,textDecoration:`underline wavy`,borderBottom:`1px wavy ${ZI}`},{tag:[U.strikethrough],color:ZI,textDecoration:`line-through`},{tag:U.constant(U.name),color:YI},{tag:U.deleted,color:ZI},{tag:U.squareBracket,color:WI},{tag:U.angleBracket,color:WI},{tag:U.monospace,color:HI},{tag:[U.contentSeparator],color:KI},{tag:U.quote,color:WI}]))],iL={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},eMe={borderLeftWidth:`2px`},aL={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},oL={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},sL={border:`none`,borderRadius:`4px`,padding:`2px 10px`},tMe={borderRadius:`2px`},cL={borderRadius:`2px`},lL={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},uL={width:`12px`,height:`12px`,borderRadius:`6px`},dL={borderRadius:`4px`,padding:`2px 6px`},fL={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},pL=`#282828`,mL=`#3c3836`,hL=`#504945`,gL=`#665c54`,nMe=`#7c6f64`,_L=`#928374`,vL=`#fbf1c7`,yL=`#ebdbb2`,bL=`#fb4934`,xL=`#b8bb26`,SL=`#fabd2f`,CL=`#83a598`,wL=`#d3869b`,TL=`#8ec07c`,EL=`#fe8019`,DL=bL,rMe=mL,iMe=`#3c383660`,aMe=pL,OL=mL,kL=hL,oMe=`#665c5480`,AL=EL,sMe=`#504945cc`,cMe=SL,jL=SL,ML=CL,lMe=wL,NL=`#32361a80`,PL=`#3c1f1e80`,FL=`#b8bb26`,IL=`#fb4934`,uMe=[Ht.theme({"&":{color:yL,backgroundColor:aMe,fontSize:iL.fontSize,fontFamily:iL.fontFamily},".cm-content":{caretColor:AL,lineHeight:iL.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:AL,borderLeftWidth:eMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${AL}99`,color:pL},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:kL},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#b57614cc`,outline:`1px solid ${SL}`,color:vL,borderRadius:dL.borderRadius,"& span":{color:vL}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:EL,color:pL,padding:dL.padding,"& span":{color:pL}},".cm-search.cm-panel.cm-textfield":{color:yL,borderRadius:dL.borderRadius,padding:dL.padding},".cm-panels":{backgroundColor:OL,color:yL,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${gL}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${gL}`},".cm-panel button":{backgroundColor:OL,color:yL,border:sL.border,borderRadius:sL.borderRadius,padding:sL.padding},".cm-panel button:hover":{backgroundColor:hL},".cm-activeLine":{backgroundColor:iMe,borderRadius:tMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:mL,color:_L,border:oL.border,borderRight:`1px solid ${hL}`,paddingRight:oL.paddingRight},".cm-activeLineGutter":{backgroundColor:rMe,color:yL,fontWeight:oL.fontWeight},".cm-lineNumbers":{fontSize:oL.fontSize,lineHeight:oL.lineHeight},".cm-foldGutter":{fontSize:oL.fontSize,lineHeight:oL.lineHeight},".cm-foldGutter .cm-gutterElement":{color:_L,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:yL},".cm-insertedLine":{textDecoration:aL.insertedTextDecoration,backgroundColor:NL,color:FL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:aL.insertedTextDecoration,backgroundColor:`${NL} !important`,color:FL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious,border:`1px solid ${FL}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:aL.deletedTextDecoration,backgroundColor:PL,color:IL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:aL.deletedTextDecoration,backgroundColor:`${PL} !important`,color:IL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious,border:`1px solid ${IL}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:OL,border:`1px solid ${gL}`,borderRadius:fL.borderRadius,padding:fL.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:OL,border:`none`},"& > ul > li":{padding:fL.padding,lineHeight:fL.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:kL,color:vL,borderRadius:fL.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:_L,paddingRight:fL.paddingRight},"& > ul > li > span.cm-completionDetail":{color:_L,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:OL,borderBottomColor:OL},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${DL}`},"&-warning":{borderLeft:`3px solid ${jL}`},"&-info":{borderLeft:`3px solid ${ML}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${DL}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${jL}`},".cm-matchingBracket":{backgroundColor:sMe,outline:`1px solid ${cMe}`,borderRadius:cL.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#cc241d55`,outline:`1px solid ${DL}`,borderRadius:cL.borderRadius},".cm-selectionMatch":{backgroundColor:oMe,outline:`1px solid ${gL}`,borderRadius:cL.borderRadius},".cm-foldPlaceholder":{backgroundColor:OL,color:_L,border:`1px dotted ${gL}`,borderRadius:lL.borderRadius,padding:lL.padding,margin:lL.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${pL}, 0 0 0 3px ${EL}40`},"& .cm-scroller::-webkit-scrollbar":{width:uL.width,height:uL.height},"& .cm-scroller::-webkit-scrollbar-track":{background:mL},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:gL,borderRadius:uL.borderRadius,border:`3px solid ${mL}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:nMe},".cm-ghostText":{opacity:`0.5`,color:_L}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:bL,fontWeight:`bold`},{tag:U.controlKeyword,color:bL,fontWeight:`bold`},{tag:U.moduleKeyword,color:bL,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:CL},{tag:[U.variableName],color:CL},{tag:[U.propertyName],color:TL,fontStyle:`normal`},{tag:[U.typeName],color:TL},{tag:[U.className],color:SL,fontStyle:`italic`},{tag:[U.namespace],color:CL,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:yL},{tag:[U.bracket],color:_L},{tag:[U.brace],color:_L},{tag:[U.punctuation],color:_L},{tag:[U.function(U.variableName),U.labelName],color:SL},{tag:[U.definition(U.variableName)],color:CL},{tag:U.number,color:wL},{tag:U.changed,color:wL},{tag:U.annotation,color:DL,fontStyle:`italic`},{tag:U.modifier,color:wL,fontStyle:`italic`},{tag:U.self,color:wL},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:EL},{tag:[U.atom,U.bool,U.special(U.variableName)],color:EL},{tag:[U.processingInstruction,U.inserted],color:xL},{tag:[U.special(U.string),U.regexp],color:xL},{tag:U.string,color:xL},{tag:U.definition(U.typeName),color:TL,fontWeight:`bold`},{tag:U.meta,color:_L},{tag:U.comment,fontStyle:`italic`,color:_L},{tag:U.docComment,fontStyle:`italic`,color:_L},{tag:[U.tagName],color:bL},{tag:[U.attributeName],color:SL},{tag:[U.heading],fontWeight:`bold`,color:SL},{tag:[U.strong],fontWeight:`bold`,color:SL},{tag:[U.emphasis],fontStyle:`italic`,color:xL},{tag:[U.link],color:lMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:ML,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:yL,textDecoration:`underline wavy`,borderBottom:`1px wavy ${DL}`},{tag:[U.strikethrough],color:DL,textDecoration:`line-through`},{tag:U.constant(U.name),color:EL},{tag:U.deleted,color:DL},{tag:U.squareBracket,color:_L},{tag:U.angleBracket,color:_L},{tag:U.monospace,color:yL},{tag:[U.contentSeparator],color:CL},{tag:U.quote,color:_L}]))],LL={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},dMe={borderLeftWidth:`2px`},RL={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},zL={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},BL={border:`none`,borderRadius:`4px`,padding:`2px 10px`},fMe={borderRadius:`2px`},VL={borderRadius:`2px`},HL={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},UL={width:`12px`,height:`12px`,borderRadius:`6px`},WL={borderRadius:`4px`,padding:`2px 6px`},GL={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},KL=`#3c3836`,pMe=`#504945`,mMe=`#665c54`,qL=`#7c6f64`,JL=`#928374`,YL=`#fbf1c7`,XL=`#ebdbb2`,ZL=`#d5c4a1`,QL=`#bdae93`,hMe=`#a89984`,$L=`#9d0006`,eR=`#79740e`,tR=`#b57614`,nR=`#076678`,rR=`#8f3f71`,iR=`#427b58`,aR=`#af3a03`,oR=$L,gMe=XL,_Me=`#ffc42e25`,vMe=YL,sR=XL,yMe=gMe,bMe=`#ffc42e40`,cR=aR,xMe=`#d5c4a180`,SMe=aR,lR=tR,uR=nR,CMe=rR,dR=`#d8e5bc80`,fR=`#f7cfcf80`,pR=`#79740e`,mR=`#9d0006`,wMe=[Ht.theme({"&":{color:KL,backgroundColor:vMe,fontSize:LL.fontSize,fontFamily:LL.fontFamily},".cm-content":{caretColor:cR,lineHeight:LL.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:cR,borderLeftWidth:dMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${cR}99`,color:YL},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:yMe,color:KL},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#ffc42e80`,outline:`1px solid ${aR}`,color:KL,borderRadius:WL.borderRadius,"& span":{color:KL}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:aR,color:YL,padding:WL.padding,"& span":{color:YL}},".cm-search.cm-panel.cm-textfield":{color:KL,borderRadius:WL.borderRadius,padding:WL.padding},".cm-panels":{backgroundColor:XL,color:pMe,borderRadius:`0 0 4px 4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${QL}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${QL}`},".cm-panel button":{backgroundColor:YL,color:KL,border:BL.border,borderRadius:BL.borderRadius,padding:BL.padding},".cm-panel button:hover":{backgroundColor:ZL},".cm-activeLine":{backgroundColor:_Me,borderRadius:fMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:XL,color:qL,border:zL.border,borderRight:`1px solid ${QL}`,paddingRight:zL.paddingRight},".cm-activeLineGutter":{backgroundColor:ZL,color:KL,fontWeight:zL.fontWeight},".cm-lineNumbers":{fontSize:zL.fontSize,lineHeight:zL.lineHeight},".cm-foldGutter":{fontSize:zL.fontSize,lineHeight:zL.lineHeight},".cm-foldGutter .cm-gutterElement":{color:qL,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:KL},".cm-insertedLine":{textDecoration:RL.insertedTextDecoration,backgroundColor:dR,color:pR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:RL.insertedTextDecoration,backgroundColor:`${dR} !important`,color:pR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious,border:`1px solid ${pR}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:RL.deletedTextDecoration,backgroundColor:fR,color:mR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:RL.deletedTextDecoration,backgroundColor:`${fR} !important`,color:mR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious,border:`1px solid ${mR}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:sR,border:`1px solid ${QL}`,borderRadius:GL.borderRadius,padding:GL.padding,boxShadow:`0 1px 5px rgba(0, 0, 0, 0.1)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:sR,border:`none`},"& > ul > li":{padding:GL.padding,lineHeight:GL.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:aR+`30`,color:KL,borderRadius:GL.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:aR+`15`},"& > ul > li > span.cm-completionIcon":{color:qL,paddingRight:GL.paddingRight},"& > ul > li > span.cm-completionDetail":{color:qL,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:sR,borderBottomColor:sR},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${oR}`},"&-warning":{borderLeft:`3px solid ${lR}`},"&-info":{borderLeft:`3px solid ${uR}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${oR}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${lR}`},".cm-matchingBracket":{backgroundColor:xMe,outline:`1px solid ${SMe}`,borderRadius:VL.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#fb492740`,outline:`1px solid ${oR}`,borderRadius:VL.borderRadius},".cm-selectionMatch":{backgroundColor:bMe,outline:`1px solid ${QL}`,borderRadius:VL.borderRadius},".cm-foldPlaceholder":{backgroundColor:`transparent`,color:mMe,border:`1px dotted ${QL}`,borderRadius:HL.borderRadius,padding:HL.padding,margin:HL.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${YL}, 0 0 0 3px ${aR}40`},"& .cm-scroller::-webkit-scrollbar":{width:UL.width,height:UL.height},"& .cm-scroller::-webkit-scrollbar-track":{background:YL},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:QL,borderRadius:UL.borderRadius,border:`3px solid ${YL}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:hMe},".cm-ghostText":{opacity:`0.5`,color:JL}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:$L,fontWeight:`bold`},{tag:U.controlKeyword,color:$L,fontWeight:`bold`},{tag:U.moduleKeyword,color:$L,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:nR},{tag:[U.variableName],color:nR},{tag:[U.propertyName],color:iR,fontStyle:`normal`},{tag:[U.typeName],color:iR},{tag:[U.className],color:tR,fontStyle:`italic`},{tag:[U.namespace],color:nR,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:KL},{tag:[U.bracket],color:JL},{tag:[U.brace],color:JL},{tag:[U.punctuation],color:JL},{tag:[U.function(U.variableName),U.labelName],color:tR},{tag:[U.definition(U.variableName)],color:nR},{tag:U.number,color:rR},{tag:U.changed,color:rR},{tag:U.annotation,color:oR,fontStyle:`italic`},{tag:U.modifier,color:rR,fontStyle:`italic`},{tag:U.self,color:rR},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:aR},{tag:[U.atom,U.bool,U.special(U.variableName)],color:aR},{tag:[U.processingInstruction,U.inserted],color:eR},{tag:[U.special(U.string),U.regexp],color:eR},{tag:U.string,color:eR},{tag:U.definition(U.typeName),color:iR,fontWeight:`bold`},{tag:U.meta,color:JL},{tag:U.comment,fontStyle:`italic`,color:JL},{tag:U.docComment,fontStyle:`italic`,color:JL},{tag:[U.tagName],color:$L},{tag:[U.attributeName],color:tR},{tag:[U.heading],fontWeight:`bold`,color:tR},{tag:[U.strong],fontWeight:`bold`,color:tR},{tag:[U.emphasis],fontStyle:`italic`,color:eR},{tag:[U.link],color:CMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:uR,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:KL,textDecoration:`underline wavy`,borderBottom:`1px wavy ${oR}`},{tag:[U.strikethrough],color:oR,textDecoration:`line-through`},{tag:U.constant(U.name),color:aR},{tag:U.deleted,color:oR},{tag:U.squareBracket,color:JL},{tag:U.angleBracket,color:JL},{tag:U.monospace,color:KL},{tag:[U.contentSeparator],color:nR},{tag:U.quote,color:JL}]))],hR={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},TMe={borderLeftWidth:`2px`},gR={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},_R={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},vR={border:`none`,borderRadius:`4px`,padding:`2px 10px`},EMe={borderRadius:`2px`},yR={borderRadius:`2px`},bR={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},xR={width:`12px`,height:`12px`,borderRadius:`6px`},SR={borderRadius:`4px`,padding:`2px 6px`},CR={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},wR=`#212121`,TR=`#505d64`,ER=`#606f7a`,DR=`#707d8b`,DMe=`#a0a4ae`,OR=`#bdbdbd`,kR=`#e0e0e0`,OMe=`#202325`,AR=`#ff5f52`,jR=`#ff6e40`,kMe=`#fa5788`,MR=`#facf4e`,NR=`#ffad42`,PR=`#56c8d8`,FR=`#7186f0`,IR=`#cf6edf`,AMe=`#6abf69`,jMe=`#99d066`,MMe=`#4ebaaa`,LR=AR,RR=OMe,NMe=`#2d333b30`,zR=wR,BR=TR,VR=`#ffffff1f`,PMe=`#4A707A80`,HR=DMe,FMe=`#39496650`,IMe=PR,UR=NR,WR=PR,LMe=IR,GR=`#1e3d2780`,KR=`#4e282880`,qR=`#6abf69`,JR=`#ff5f52`,RMe=[Ht.theme({"&":{color:OR,backgroundColor:zR,fontSize:hR.fontSize,fontFamily:hR.fontFamily},".cm-content":{caretColor:HR,lineHeight:hR.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:HR,borderLeftWidth:TMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${HR}99`,color:zR},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:VR},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#394966cc`,outline:`1px solid ${PR}`,color:kR,borderRadius:SR.borderRadius,"& span":{color:kR}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:PR,color:zR,padding:SR.padding,"& span":{color:zR}},".cm-search.cm-panel.cm-textfield":{color:OR,borderRadius:SR.borderRadius,padding:SR.padding},".cm-panels":{backgroundColor:wR,color:OR,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${DR}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${DR}`},".cm-panel button":{backgroundColor:BR,color:OR,border:vR.border,borderRadius:vR.borderRadius,padding:vR.padding},".cm-panel button:hover":{backgroundColor:ER},".cm-activeLine":{backgroundColor:NMe,borderRadius:EMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:RR,color:DR,border:_R.border,borderRight:`1px solid ${TR}`,paddingRight:_R.paddingRight},".cm-activeLineGutter":{backgroundColor:`#252a2c`,color:OR,fontWeight:_R.fontWeight},".cm-lineNumbers":{fontSize:_R.fontSize,lineHeight:_R.lineHeight},".cm-foldGutter":{fontSize:_R.fontSize,lineHeight:_R.lineHeight},".cm-foldGutter .cm-gutterElement":{color:DR,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:OR},".cm-insertedLine":{textDecoration:gR.insertedTextDecoration,backgroundColor:GR,color:qR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:gR.insertedTextDecoration,backgroundColor:`${GR} !important`,color:qR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious,border:`1px solid ${qR}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:gR.deletedTextDecoration,backgroundColor:KR,color:JR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:gR.deletedTextDecoration,backgroundColor:`${KR} !important`,color:JR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious,border:`1px solid ${JR}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:BR,border:`1px solid ${DR}`,borderRadius:CR.borderRadius,padding:CR.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:BR,border:`none`},"& > ul > li":{padding:CR.padding,lineHeight:CR.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:VR,color:kR,borderRadius:CR.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:DR,paddingRight:CR.paddingRight},"& > ul > li > span.cm-completionDetail":{color:DR,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:BR,borderBottomColor:BR},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${LR}`},"&-warning":{borderLeft:`3px solid ${UR}`},"&-info":{borderLeft:`3px solid ${WR}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${LR}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${UR}`},".cm-matchingBracket":{backgroundColor:FMe,outline:`1px solid ${IMe}`,borderRadius:yR.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#ff5f5240`,outline:`1px solid ${LR}`,borderRadius:yR.borderRadius},".cm-selectionMatch":{backgroundColor:PMe,outline:`1px solid ${ER}50`,borderRadius:yR.borderRadius},".cm-foldPlaceholder":{backgroundColor:BR,color:DR,border:`1px dotted ${DR}70`,borderRadius:bR.borderRadius,padding:bR.padding,margin:bR.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${zR}, 0 0 0 3px ${PR}40`},"& .cm-scroller::-webkit-scrollbar":{width:xR.width,height:xR.height},"& .cm-scroller::-webkit-scrollbar-track":{background:RR},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:ER,borderRadius:xR.borderRadius,border:`3px solid ${RR}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:DR},".cm-ghostText":{opacity:`0.5`,color:DR}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:AR,fontWeight:`bold`},{tag:U.controlKeyword,color:AR,fontWeight:`bold`},{tag:U.moduleKeyword,color:AR,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:FR},{tag:[U.variableName],color:jMe},{tag:[U.propertyName],color:IR,fontStyle:`normal`},{tag:[U.typeName],color:AR},{tag:[U.className],color:MR,fontStyle:`italic`},{tag:[U.namespace],color:FR,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:OR},{tag:[U.bracket],color:DR},{tag:[U.brace],color:DR},{tag:[U.punctuation],color:DR},{tag:[U.function(U.variableName)],color:PR},{tag:[U.labelName],color:PR,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:PR},{tag:[U.definition(U.variableName)],color:FR},{tag:U.number,color:MR},{tag:U.changed,color:MR},{tag:U.annotation,color:LR,fontStyle:`italic`},{tag:U.modifier,color:jR,fontStyle:`italic`},{tag:U.self,color:jR},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:jR},{tag:[U.atom,U.bool,U.special(U.variableName)],color:jR},{tag:[U.processingInstruction,U.inserted],color:AMe},{tag:[U.special(U.string),U.regexp],color:kMe},{tag:U.string,color:NR},{tag:U.definition(U.typeName),color:AR,fontWeight:`bold`},{tag:U.meta,color:DR},{tag:U.comment,fontStyle:`italic`,color:DR},{tag:U.docComment,fontStyle:`italic`,color:DR},{tag:[U.tagName],color:IR},{tag:[U.attributeName],color:MR},{tag:[U.heading],fontWeight:`bold`,color:MMe},{tag:U.heading1,color:MR},{tag:U.heading2,color:NR},{tag:U.heading3,color:PR},{tag:U.heading4,color:FR},{tag:U.heading5,color:IR},{tag:U.heading6,color:AR},{tag:[U.strong],fontWeight:`bold`,color:FR},{tag:[U.emphasis],fontStyle:`italic`,color:NR},{tag:[U.link],color:LMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:WR,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:OR,textDecoration:`underline wavy`,borderBottom:`1px wavy ${LR}`},{tag:[U.strikethrough],color:LR,textDecoration:`line-through`},{tag:U.constant(U.name),color:jR},{tag:U.deleted,color:LR},{tag:U.squareBracket,color:DR},{tag:U.angleBracket,color:DR},{tag:U.monospace,color:OR},{tag:[U.contentSeparator],color:FR},{tag:U.quote,color:DR}]))],YR={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},zMe={borderLeftWidth:`2px`},XR={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},ZR={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},QR={border:`none`,borderRadius:`4px`,padding:`2px 10px`},BMe={borderRadius:`2px`},$R={borderRadius:`2px`},ez={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},tz={width:`12px`,height:`12px`,borderRadius:`6px`},nz={borderRadius:`4px`,padding:`2px 6px`},rz={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},VMe=`#ffffff`,iz=`#f5f5f5`,az=`#212121`,oz=`#757575`,sz=`#9e9e9e`,cz=`#424242`,HMe=`#eeeeee`,lz=`#fafafa`,uz=`#f44336`,dz=`#ff3e00`,fz=`#FF00E9FF`,UMe=`#ffc107`,pz=`#ff9800`,mz=`#00acc1`,hz=`#3949ab`,gz=`#8e24aa`,_z=`#43a047`,vz=`#00897b`,yz=`#1e88e5`,bz=uz,WMe=`#00000008`,xz=VMe,Sz=iz,GMe=`#DDEEFF`,KMe=`#90a4ae26`,Cz=sz,qMe=`#DDEEFF80`,JMe=mz,wz=pz,Tz=mz,YMe=gz,Ez=`#ECEFF180`,Dz=`#e6ffed80`,Oz=`#ffebe980`,kz=`#28a745`,Az=`#d73a49`,XMe=[Ht.theme({"&":{color:az,backgroundColor:xz,fontSize:YR.fontSize,fontFamily:YR.fontFamily},".cm-content":{caretColor:Cz,lineHeight:YR.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:Cz,borderLeftWidth:zMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${az}99`,color:xz},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:GMe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#FFA72680`,outline:`1px solid ${UMe}`,color:az,borderRadius:nz.borderRadius,"& span":{color:az}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:mz,color:xz,padding:nz.padding,"& span":{color:xz}},".cm-search.cm-panel.cm-textfield":{color:az,borderRadius:nz.borderRadius,padding:nz.padding},".cm-panels":{backgroundColor:HMe,color:az,borderRadius:`4px`,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${sz}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${sz}`},".cm-panel button":{backgroundColor:Sz,color:az,border:QR.border,borderRadius:QR.borderRadius,padding:QR.padding},".cm-panel button:hover":{backgroundColor:`#CFD8DC`},".cm-activeLine":{backgroundColor:WMe,borderRadius:BMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:lz,color:oz,border:ZR.border,borderRight:`1px solid ${sz}`,paddingRight:ZR.paddingRight},".cm-activeLineGutter":{backgroundColor:`#E0E0E0`,color:az,fontWeight:ZR.fontWeight},".cm-lineNumbers":{fontSize:ZR.fontSize,lineHeight:ZR.lineHeight},".cm-foldGutter":{fontSize:ZR.fontSize,lineHeight:ZR.lineHeight},".cm-foldGutter .cm-gutterElement":{color:oz,cursor:`pointer`,transition:`color 0.15s ease`},".cm-foldGutter .cm-gutterElement:hover":{color:az},".cm-insertedLine":{textDecoration:XR.insertedTextDecoration,backgroundColor:Dz,color:kz,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:XR.insertedTextDecoration,backgroundColor:`${Dz} !important`,color:kz,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious,border:`1px solid ${kz}30`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:XR.deletedTextDecoration,backgroundColor:Oz,color:Az,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:XR.deletedTextDecoration,backgroundColor:`${Oz} !important`,color:Az,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious,border:`1px solid ${Az}30`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:Sz,border:`1px solid ${sz}`,borderRadius:rz.borderRadius,padding:rz.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:Sz,border:`none`},"& > ul > li":{padding:rz.padding,lineHeight:rz.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Ez,color:az,borderRadius:rz.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:Ez},"& > ul > li > span.cm-completionIcon":{color:oz,paddingRight:rz.paddingRight},"& > ul > li > span.cm-completionDetail":{color:oz,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Sz,borderBottomColor:Sz},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${bz}`},"&-warning":{borderLeft:`3px solid ${wz}`},"&-info":{borderLeft:`3px solid ${Tz}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${bz}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${wz}`},".cm-matchingBracket":{backgroundColor:qMe,outline:`1px solid ${JMe}`,borderRadius:$R.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${bz}20`,outline:`1px solid ${bz}`,borderRadius:$R.borderRadius},".cm-selectionMatch":{backgroundColor:KMe,outline:`1px solid ${oz}30`,borderRadius:$R.borderRadius},".cm-foldPlaceholder":{backgroundColor:iz,color:oz,border:`1px dotted ${oz}70`,borderRadius:ez.borderRadius,padding:ez.padding,margin:ez.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${xz}, 0 0 0 3px ${mz}40`},"& .cm-scroller::-webkit-scrollbar":{width:tz.width,height:tz.height},"& .cm-scroller::-webkit-scrollbar-track":{background:lz},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:oz,borderRadius:tz.borderRadius,border:`3px solid ${lz}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:az},".cm-ghostText":{opacity:`0.5`,color:oz}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:mz,fontWeight:`bold`},{tag:U.controlKeyword,color:mz,fontWeight:`bold`},{tag:U.moduleKeyword,color:mz,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:cz},{tag:[U.variableName],color:cz},{tag:[U.propertyName],color:vz,fontStyle:`normal`},{tag:[U.typeName],color:pz},{tag:[U.className],color:pz,fontStyle:`italic`},{tag:[U.namespace],color:hz,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:hz},{tag:[U.bracket],color:gz},{tag:[U.brace],color:gz},{tag:[U.punctuation],color:oz},{tag:[U.function(U.variableName)],color:dz},{tag:[U.labelName],color:yz,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:dz},{tag:[U.definition(U.variableName)],color:fz},{tag:U.number,color:pz},{tag:U.changed,color:pz},{tag:U.annotation,color:bz,fontStyle:`italic`},{tag:U.modifier,color:pz,fontStyle:`italic`},{tag:U.self,color:pz},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:pz},{tag:[U.atom,U.bool],color:gz},{tag:[U.processingInstruction,U.inserted],color:_z},{tag:U.string,color:_z},{tag:[U.special(U.string),U.regexp],color:fz},{tag:U.definition(U.typeName),color:fz,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:fz},{tag:U.meta,color:oz},{tag:U.comment,fontStyle:`italic`,color:oz},{tag:U.docComment,fontStyle:`italic`,color:oz},{tag:[U.tagName],color:dz},{tag:[U.attributeName],color:cz},{tag:[U.heading],fontWeight:`bold`,color:vz},{tag:U.heading1,color:yz},{tag:U.heading2,color:pz},{tag:U.heading3,color:mz},{tag:U.heading4,color:hz},{tag:U.heading5,color:gz},{tag:U.heading6,color:_z},{tag:[U.strong],fontWeight:`bold`,color:hz},{tag:[U.emphasis],fontStyle:`italic`,color:pz},{tag:[U.link],color:YMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:Tz,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:az,textDecoration:`underline wavy`,borderBottom:`1px dotted ${uz}`},{tag:[U.strikethrough],color:bz,textDecoration:`line-through`},{tag:U.constant(U.name),color:dz},{tag:U.deleted,color:bz},{tag:U.squareBracket,color:uz},{tag:U.angleBracket,color:az},{tag:U.monospace,color:az},{tag:[U.contentSeparator],color:mz},{tag:U.quote,color:_z}]))],jz={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ZMe={borderLeftWidth:`2px`},Mz={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},Nz={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},Pz={border:`none`,borderRadius:`4px`,padding:`2px 10px`},QMe={borderRadius:`2px`},Fz={borderRadius:`2px`},Iz={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},Lz={width:`12px`,height:`12px`,borderRadius:`6px`},Rz={borderRadius:`4px`,padding:`2px 6px`},zz={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},Bz=`#272822`,Vz=`#f8f8f2`,Hz=`#88846f`,$Me=`#f8f8f0`,Uz=`#F92672`,Wz=`#FD971F`,Gz=`#66D9EF`,Kz=`#E6DB74`,qz=`#AE81FF`,Jz=`#A6E22E`,Yz=`#F44747`,Xz=`#414339`,eNe=`#3e3d3257`,Zz=`#34352f`,Qz=`#49483E`,tNe=`#75715e70`,$z=$Me,nNe=`#75715E55`,rNe=Gz,eB=Wz,tB=Gz,iNe=qz,nB=`#3d4d3880`,rB=`#4d393980`,iB=`#A6E22E`,aB=`#F92672`,aNe=[Ht.theme({"&":{color:Vz,backgroundColor:Bz,fontSize:jz.fontSize,fontFamily:jz.fontFamily},".cm-content":{caretColor:$z,lineHeight:jz.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:$z,borderLeftWidth:ZMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${$z}99`,color:Bz},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qz},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#49483E99`,outline:`1px solid ${Kz}`,color:Vz,borderRadius:Rz.borderRadius,"& span":{color:Vz}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Uz,color:Bz,padding:Rz.padding,"& span":{color:Bz}},".cm-search.cm-panel.cm-textfield":{color:Vz,borderRadius:Rz.borderRadius,padding:Rz.padding},".cm-panels":{backgroundColor:Xz,color:Vz,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${Hz}80`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${Hz}80`},".cm-panel button":{backgroundColor:Zz,color:Vz,border:Pz.border,borderRadius:Pz.borderRadius,padding:Pz.padding},".cm-panel button:hover":{backgroundColor:`#49483E`},".cm-activeLine":{backgroundColor:eNe,borderRadius:QMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:Xz,color:Hz,border:Nz.border,borderRight:`1px solid #3e3d32`,paddingRight:Nz.paddingRight},".cm-activeLineGutter":{backgroundColor:`#35352c`,color:Vz,fontWeight:Nz.fontWeight},".cm-lineNumbers":{fontSize:Nz.fontSize,lineHeight:Nz.lineHeight},".cm-foldGutter":{fontSize:Nz.fontSize,lineHeight:Nz.lineHeight},".cm-foldGutter .cm-gutterElement":{color:Hz,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:Vz},".cm-insertedLine":{textDecoration:Mz.insertedTextDecoration,backgroundColor:nB,color:iB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:Mz.insertedTextDecoration,backgroundColor:`${nB} !important`,color:iB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious,border:`1px solid ${iB}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:Mz.deletedTextDecoration,backgroundColor:rB,color:aB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:Mz.deletedTextDecoration,backgroundColor:`${rB} !important`,color:aB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious,border:`1px solid ${aB}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:Zz,border:`1px solid #49483E`,borderRadius:zz.borderRadius,padding:zz.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.4)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:Zz,border:`none`},"& > ul > li":{padding:zz.padding,lineHeight:zz.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Qz,color:Vz,borderRadius:zz.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:Hz,paddingRight:zz.paddingRight},"& > ul > li > span.cm-completionDetail":{color:Hz,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Zz,borderBottomColor:Zz},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${Yz}`},"&-warning":{borderLeft:`3px solid ${eB}`},"&-info":{borderLeft:`3px solid ${tB}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${Yz}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${eB}`},".cm-matchingBracket":{backgroundColor:nNe,outline:`1px solid ${rNe}`,borderRadius:Fz.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#f9267240`,outline:`1px solid ${Yz}`,borderRadius:Fz.borderRadius},".cm-selectionMatch":{backgroundColor:tNe,outline:`1px solid ${Hz}50`,borderRadius:Fz.borderRadius},".cm-foldPlaceholder":{backgroundColor:Zz,color:Hz,border:`1px dotted ${Hz}70`,borderRadius:Iz.borderRadius,padding:Iz.padding,margin:Iz.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${Bz}, 0 0 0 3px ${Gz}40`},"& .cm-scroller::-webkit-scrollbar":{width:Lz.width,height:Lz.height},"& .cm-scroller::-webkit-scrollbar-track":{background:Xz},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#49483E`,borderRadius:Lz.borderRadius,border:`3px solid ${Xz}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#5a594d`},".cm-ghostText":{opacity:`0.5`,color:Hz}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:Uz,fontWeight:`bold`},{tag:U.controlKeyword,color:Uz,fontWeight:`bold`},{tag:U.moduleKeyword,color:Uz,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:Wz},{tag:[U.variableName],color:Wz},{tag:[U.propertyName],color:Jz,fontStyle:`normal`},{tag:[U.typeName],color:Gz,fontStyle:`italic`},{tag:[U.className],color:Jz,fontStyle:`italic`},{tag:[U.namespace],color:Wz,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:Uz},{tag:[U.bracket],color:Vz},{tag:[U.brace],color:Vz},{tag:[U.punctuation],color:Vz},{tag:[U.function(U.variableName),U.labelName],color:Gz},{tag:[U.definition(U.function(U.variableName))],color:Gz},{tag:[U.definition(U.variableName)],color:Wz},{tag:U.number,color:qz},{tag:U.changed,color:qz},{tag:U.annotation,color:Yz,fontStyle:`italic`},{tag:U.modifier,color:qz,fontStyle:`italic`},{tag:U.self,color:qz},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:qz},{tag:[U.atom,U.bool,U.special(U.variableName)],color:qz},{tag:[U.processingInstruction,U.inserted],color:Jz},{tag:[U.special(U.string),U.regexp],color:Kz},{tag:U.string,color:Kz},{tag:U.definition(U.typeName),color:Gz,fontWeight:`bold`},{tag:U.meta,color:Hz},{tag:U.comment,fontStyle:`italic`,color:Hz},{tag:U.docComment,fontStyle:`italic`,color:Hz},{tag:[U.tagName],color:Uz},{tag:[U.attributeName],color:Jz},{tag:[U.heading],fontWeight:`bold`,color:Jz},{tag:[U.strong],fontWeight:`bold`,color:Wz},{tag:[U.emphasis],fontStyle:`italic`,color:Wz},{tag:[U.link],color:iNe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:tB,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:Vz,textDecoration:`underline wavy`,borderBottom:`1px wavy ${Yz}`},{tag:[U.strikethrough],color:Yz,textDecoration:`line-through`},{tag:U.constant(U.name),color:qz},{tag:U.deleted,color:Yz},{tag:U.squareBracket,color:Vz},{tag:U.angleBracket,color:Vz},{tag:U.monospace,color:Vz},{tag:[U.contentSeparator],color:Wz},{tag:U.quote,color:Hz}]))],oB={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},oNe={borderLeftWidth:`2px`},sB={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},cB={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},lB={border:`none`,borderRadius:`4px`,padding:`2px 10px`},sNe={borderRadius:`2px`},uB={borderRadius:`2px`},dB={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},fB={width:`12px`,height:`12px`,borderRadius:`6px`},pB={borderRadius:`4px`,padding:`2px 6px`},mB={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},cNe=`#2e3440`,hB=`#3b4252`,gB=`#434c5e`,_B=`#4c566a`,vB=`#d8dee9`,yB=`#eceff4`,bB=`#8fbcbb`,xB=`#88c0d0`,SB=`#81a1c1`,CB=`#5e81ac`,wB=`#bf616a`,TB=`#d08770`,EB=`#ebcb8b`,DB=`#a3be8c`,OB=`#b48ead`,lNe=`#d30102`,kB=`#252a33`,uNe=`#3b425277`,AB=cNe,jB=hB,dNe=gB,fNe=`#4c566a80`,MB=vB,pNe=`#4c566a55`,mNe=xB,NB=EB,PB=SB,hNe=OB,FB=`#3b4a3880`,IB=`#4a393a80`,LB=`#a3be8c`,RB=`#bf616a`,gNe=[Ht.theme({"&":{color:vB,backgroundColor:AB,fontSize:oB.fontSize,fontFamily:oB.fontFamily},".cm-content":{caretColor:MB,lineHeight:oB.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:MB,borderLeftWidth:oNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${MB}99`,color:AB},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:dNe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#5e81ac80`,outline:`1px solid ${bB}`,color:vB,borderRadius:pB.borderRadius,"& span":{color:vB}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:SB,color:yB,padding:pB.padding,"& span":{color:yB}},".cm-search.cm-panel.cm-textfield":{color:vB,borderRadius:pB.borderRadius,padding:pB.padding},".cm-panels":{backgroundColor:kB,color:vB,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${_B}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${_B}`},".cm-panel button":{backgroundColor:jB,color:vB,border:lB.border,borderRadius:lB.borderRadius,padding:lB.padding},".cm-panel button:hover":{backgroundColor:gB},".cm-activeLine":{backgroundColor:uNe,borderRadius:sNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:kB,color:_B,border:cB.border,borderRight:`1px solid ${gB}`,paddingRight:cB.paddingRight},".cm-activeLineGutter":{backgroundColor:hB,color:vB,fontWeight:cB.fontWeight},".cm-lineNumbers":{fontSize:cB.fontSize,lineHeight:cB.lineHeight},".cm-foldGutter":{fontSize:cB.fontSize,lineHeight:cB.lineHeight},".cm-foldGutter .cm-gutterElement":{color:_B,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:vB},".cm-insertedLine":{textDecoration:sB.insertedTextDecoration,backgroundColor:FB,color:LB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:sB.insertedTextDecoration,backgroundColor:`${FB} !important`,color:LB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious,border:`1px solid ${LB}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:sB.deletedTextDecoration,backgroundColor:IB,color:RB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:sB.deletedTextDecoration,backgroundColor:`${IB} !important`,color:RB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious,border:`1px solid ${RB}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:jB,border:`1px solid ${_B}`,borderRadius:mB.borderRadius,padding:mB.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:jB,border:`none`},"& > ul > li":{padding:mB.padding,lineHeight:mB.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:gB,color:yB,borderRadius:mB.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:_B,paddingRight:mB.paddingRight},"& > ul > li > span.cm-completionDetail":{color:_B,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:jB,borderBottomColor:jB},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${wB}`},"&-warning":{borderLeft:`3px solid ${NB}`},"&-info":{borderLeft:`3px solid ${PB}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${wB}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${NB}`},".cm-matchingBracket":{backgroundColor:pNe,outline:`1px solid ${mNe}`,borderRadius:uB.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${wB}40`,outline:`1px solid ${lNe}`,borderRadius:uB.borderRadius},".cm-selectionMatch":{backgroundColor:fNe,outline:`1px solid ${gB}50`,borderRadius:uB.borderRadius},".cm-foldPlaceholder":{backgroundColor:jB,color:_B,border:`1px dotted ${_B}70`,borderRadius:dB.borderRadius,padding:dB.padding,margin:dB.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${AB}, 0 0 0 3px ${xB}40`},"& .cm-scroller::-webkit-scrollbar":{width:fB.width,height:fB.height},"& .cm-scroller::-webkit-scrollbar-track":{background:kB},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:gB,borderRadius:fB.borderRadius,border:`3px solid ${kB}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:_B},".cm-ghostText":{opacity:`0.5`,color:_B}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:CB,fontWeight:`bold`},{tag:U.controlKeyword,color:CB,fontWeight:`bold`},{tag:U.moduleKeyword,color:CB,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:xB},{tag:[U.variableName],color:vB},{tag:[U.propertyName],color:xB,fontStyle:`normal`},{tag:[U.typeName],color:EB},{tag:[U.className],color:EB,fontStyle:`italic`},{tag:[U.namespace],color:SB,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:OB},{tag:[U.bracket],color:vB},{tag:[U.brace],color:bB},{tag:[U.punctuation],color:vB},{tag:[U.function(U.variableName),U.labelName],color:bB},{tag:[U.definition(U.function(U.variableName))],color:bB},{tag:[U.definition(U.variableName)],color:TB},{tag:U.number,color:TB},{tag:U.changed,color:OB},{tag:U.annotation,color:wB,fontStyle:`italic`},{tag:U.modifier,color:OB,fontStyle:`italic`},{tag:U.self,color:OB},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:TB},{tag:[U.atom,U.bool,U.special(U.variableName)],color:OB},{tag:[U.processingInstruction,U.inserted],color:bB},{tag:[U.special(U.string),U.regexp],color:OB},{tag:U.string,color:DB},{tag:U.definition(U.typeName),color:EB,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:DB},{tag:U.meta,color:_B},{tag:U.comment,fontStyle:`italic`,color:_B},{tag:U.docComment,fontStyle:`italic`,color:_B},{tag:[U.tagName],color:wB},{tag:[U.attributeName],color:EB},{tag:[U.heading],fontWeight:`bold`,color:SB},{tag:[U.strong],fontWeight:`bold`,color:xB},{tag:[U.emphasis],fontStyle:`italic`,color:EB},{tag:[U.link],color:hNe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:PB,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:vB,textDecoration:`underline wavy`,borderBottom:`1px wavy ${wB}`},{tag:[U.strikethrough],color:wB,textDecoration:`line-through`},{tag:U.constant(U.name),color:TB},{tag:U.deleted,color:wB},{tag:U.squareBracket,color:wB},{tag:U.angleBracket,color:TB},{tag:U.monospace,color:vB,fontStyle:`italic`},{tag:[U.contentSeparator],color:SB},{tag:U.quote,color:OB}]))],zB={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},_Ne={borderLeftWidth:`2px`},BB={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},VB={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},HB={border:`none`,borderRadius:`4px`,padding:`2px 10px`},vNe={borderRadius:`2px`},UB={borderRadius:`2px`},WB={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},GB={width:`12px`,height:`12px`,borderRadius:`6px`},KB={borderRadius:`4px`,padding:`2px 6px`},qB={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},yNe=`#e1e2e7`,JB=`#3760bf`,YB=`#99a7df`,XB=`#848cb5`,bNe=`#8c91a8`,ZB=`#3760bf`,QB=`#e9e9ec`,$B=`#d5d6db`,eV=`#f52a65`,tV=`#b15c00`,nV=`#8c6c3e`,rV=`#587539`,iV=`#007197`,aV=`#2e7de9`,oV=`#7847bd`,xNe=`#9854f1`,sV=eV,cV=$B,SNe=`#5F5FAF5A`,lV=yNe,uV=QB,dV=`#99a7df40`,CNe=`#99a7df60`,fV=JB,wNe=`#0e639c20`,TNe=iV,pV=tV,mV=iV,ENe=oV,hV=`#58753920`,gV=`#f52a6520`,_V=`#587539`,vV=`#f52a65`,DNe=[Ht.theme({"&":{color:ZB,backgroundColor:lV,fontSize:zB.fontSize,fontFamily:zB.fontFamily},".cm-content":{caretColor:fV,lineHeight:zB.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:fV,borderLeftWidth:_Ne.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${fV}99`,color:lV},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:dV},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#0e639c40`,outline:`1px solid ${iV}`,color:ZB,borderRadius:KB.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:iV,color:lV,padding:KB.padding,"& span":{color:lV}},".cm-search.cm-panel.cm-textfield":{color:ZB,borderRadius:KB.borderRadius,padding:KB.padding},".cm-panels":{backgroundColor:QB,color:ZB,borderRadius:`4px`,boxShadow:`0 1px 3px rgba(0, 0, 0, 0.1)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${XB}30`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${XB}30`},".cm-panel button":{backgroundColor:uV,color:ZB,border:HB.border,borderRadius:HB.borderRadius,padding:HB.padding},".cm-panel button:hover":{backgroundColor:$B,border:`1px solid ${YB}`},".cm-activeLine":{backgroundColor:SNe,borderRadius:vNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:cV,color:XB,border:VB.border,borderRight:`1px solid ${$B}`,paddingRight:VB.paddingRight},".cm-activeLineGutter":{color:JB,fontWeight:VB.fontWeight},".cm-lineNumbers":{fontSize:VB.fontSize,lineHeight:VB.lineHeight},".cm-foldGutter":{fontSize:VB.fontSize,lineHeight:VB.lineHeight},".cm-foldGutter .cm-gutterElement":{color:XB,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:JB},".cm-insertedLine":{textDecoration:BB.insertedTextDecoration,backgroundColor:hV,color:_V,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:BB.insertedTextDecoration,backgroundColor:`${hV} !important`,color:_V,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious,border:`1px solid ${_V}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:BB.deletedTextDecoration,backgroundColor:gV,color:vV,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:BB.deletedTextDecoration,backgroundColor:`${gV} !important`,color:vV,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious,border:`1px solid ${vV}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:uV,border:`1px solid ${bNe}40`,borderRadius:qB.borderRadius,padding:qB.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:uV,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:qB.padding,lineHeight:qB.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:dV,color:JB,borderRadius:qB.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:XB,paddingRight:qB.paddingRight},"& > ul > li > span.cm-completionDetail":{color:XB,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:uV,borderBottomColor:uV},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${sV}`},"&-warning":{borderLeft:`3px solid ${pV}`},"&-info":{borderLeft:`3px solid ${mV}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${sV}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${pV}`},".cm-matchingBracket":{backgroundColor:wNe,outline:`1px solid ${TNe}`,borderRadius:UB.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${eV}20`,outline:`1px solid ${sV}`,borderRadius:UB.borderRadius},".cm-selectionMatch":{backgroundColor:CNe,outline:`1px solid ${YB}50`,borderRadius:UB.borderRadius},".cm-foldPlaceholder":{backgroundColor:uV,color:XB,border:`1px dotted ${XB}70`,borderRadius:WB.borderRadius,padding:WB.padding,margin:WB.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${lV}, 0 0 0 3px ${iV}40`},"& .cm-scroller::-webkit-scrollbar":{width:GB.width,height:GB.height},"& .cm-scroller::-webkit-scrollbar-track":{background:cV},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:XB,borderRadius:GB.borderRadius,border:`3px solid ${cV}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:YB},".cm-ghostText":{opacity:`0.5`,color:XB}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:iV,fontWeight:`bold`},{tag:U.controlKeyword,color:iV,fontWeight:`bold`},{tag:U.moduleKeyword,color:iV,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:aV},{tag:[U.variableName],color:JB},{tag:[U.propertyName],color:aV,fontStyle:`normal`},{tag:[U.typeName],color:iV},{tag:[U.className],color:nV,fontStyle:`italic`},{tag:[U.namespace],color:oV,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:oV},{tag:[U.bracket],color:XB},{tag:[U.brace],color:XB},{tag:[U.punctuation],color:XB},{tag:[U.function(U.variableName)],color:iV},{tag:[U.labelName],color:oV,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:iV},{tag:[U.definition(U.variableName)],color:aV},{tag:U.number,color:tV},{tag:U.changed,color:tV},{tag:U.annotation,color:sV,fontStyle:`italic`},{tag:U.modifier,color:tV,fontStyle:`italic`},{tag:U.self,color:tV},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:tV},{tag:[U.atom,U.bool,U.special(U.variableName)],color:tV},{tag:[U.processingInstruction,U.inserted],color:rV},{tag:[U.special(U.string),U.regexp],color:xNe},{tag:U.string,color:rV},{tag:U.definition(U.typeName),color:iV,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:aV},{tag:U.meta,color:XB},{tag:U.comment,fontStyle:`italic`,color:XB},{tag:U.docComment,fontStyle:`italic`,color:XB},{tag:[U.tagName],color:oV},{tag:[U.attributeName],color:nV},{tag:[U.heading],fontWeight:`bold`,color:tV},{tag:U.heading1,color:tV,fontWeight:`bold`},{tag:U.heading2,color:tV},{tag:U.heading3,color:tV},{tag:U.heading4,color:iV},{tag:U.heading5,color:iV},{tag:U.heading6,color:iV},{tag:[U.strong],fontWeight:`bold`,color:JB},{tag:[U.emphasis],fontStyle:`italic`,color:rV},{tag:[U.link],color:ENe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:mV,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:JB,textDecoration:`underline wavy`,borderBottom:`1px wavy ${sV}`},{tag:[U.strikethrough],color:sV,textDecoration:`line-through`},{tag:U.constant(U.name),color:tV},{tag:U.deleted,color:sV},{tag:U.squareBracket,color:XB},{tag:U.angleBracket,color:XB},{tag:U.monospace,color:JB},{tag:[U.contentSeparator],color:aV},{tag:U.quote,color:XB}]))],yV={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ONe={borderLeftWidth:`2px`},bV={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},xV={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},SV={border:`none`,borderRadius:`4px`,padding:`2px 10px`},kNe={borderRadius:`2px`},CV={borderRadius:`2px`},wV={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},TV={width:`12px`,height:`12px`,borderRadius:`6px`},EV={borderRadius:`4px`,padding:`2px 6px`},DV={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},ANe=`#24283b`,OV=`#414868`,kV=`#565f89`,AV=`#c0caf5`,jV=`#282e44`,MV=`#1f2335`,jNe=`#f7768e`,NV=`#ff9e64`,PV=`#e0af68`,FV=`#9ece6a`,IV=`#2ac3de`,LV=`#7aa2f7`,RV=`#bb9af7`,zV=`#f7768e`,BV=MV,MNe=`#292e427a`,VV=ANe,HV=jV,UV=`#6f7bb630`,NNe=`#6f7bb650`,WV=AV,PNe=`#3d59a150`,FNe=LV,GV=NV,KV=IV,INe=RV,qV=`#3b4a3880`,JV=`#4a393a80`,YV=`#9ece6a`,XV=`#f7768e`,LNe=[Ht.theme({"&":{color:AV,backgroundColor:VV,fontSize:yV.fontSize,fontFamily:yV.fontFamily},".cm-content":{caretColor:WV,lineHeight:yV.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:WV,borderLeftWidth:ONe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${WV}99`,color:VV},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:UV},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#7aa2f740`,outline:`1px solid ${LV}`,color:AV,borderRadius:EV.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:LV,color:VV,padding:EV.padding,"& span":{color:VV}},".cm-search.cm-panel.cm-textfield":{color:AV,borderRadius:EV.borderRadius,padding:EV.padding},".cm-panels":{backgroundColor:jV,color:AV,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${kV}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${kV}`},".cm-panel button":{backgroundColor:HV,color:AV,border:SV.border,borderRadius:SV.borderRadius,padding:SV.padding},".cm-panel button:hover":{backgroundColor:MV},".cm-activeLine":{backgroundColor:MNe,borderRadius:kNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:BV,color:kV,border:xV.border,borderRight:`1px solid ${MV}`,paddingRight:xV.paddingRight},".cm-activeLineGutter":{backgroundColor:MV,color:AV,fontWeight:xV.fontWeight},".cm-lineNumbers":{fontSize:xV.fontSize,lineHeight:xV.lineHeight},".cm-foldGutter":{fontSize:xV.fontSize,lineHeight:xV.lineHeight},".cm-foldGutter .cm-gutterElement":{color:kV,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:AV},".cm-insertedLine":{textDecoration:bV.insertedTextDecoration,backgroundColor:qV,color:YV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:bV.insertedTextDecoration,backgroundColor:`${qV} !important`,color:YV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious,border:`1px solid ${YV}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:bV.deletedTextDecoration,backgroundColor:JV,color:XV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:bV.deletedTextDecoration,backgroundColor:`${JV} !important`,color:XV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious,border:`1px solid ${XV}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:HV,border:`1px solid ${kV}`,borderRadius:DV.borderRadius,padding:DV.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:HV,border:`none`},"& > ul > li":{padding:DV.padding,lineHeight:DV.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:UV,color:AV,borderRadius:DV.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:kV,paddingRight:DV.paddingRight},"& > ul > li > span.cm-completionDetail":{color:kV,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:HV,borderBottomColor:HV},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${zV}`},"&-warning":{borderLeft:`3px solid ${GV}`},"&-info":{borderLeft:`3px solid ${KV}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${zV}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${GV}`},".cm-matchingBracket":{backgroundColor:PNe,outline:`1px solid ${FNe}`,borderRadius:CV.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${jNe}20`,outline:`1px solid ${zV}`,borderRadius:CV.borderRadius},".cm-selectionMatch":{backgroundColor:NNe,outline:`1px solid ${OV}50`,borderRadius:CV.borderRadius},".cm-foldPlaceholder":{backgroundColor:HV,color:kV,border:`1px dotted ${kV}70`,borderRadius:wV.borderRadius,padding:wV.padding,margin:wV.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${VV}, 0 0 0 3px ${LV}40`},"& .cm-scroller::-webkit-scrollbar":{width:TV.width,height:TV.height},"& .cm-scroller::-webkit-scrollbar-track":{background:BV},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:OV,borderRadius:TV.borderRadius,border:`3px solid ${BV}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:kV},".cm-ghostText":{opacity:`0.5`,color:kV}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:RV,fontWeight:`bold`},{tag:U.controlKeyword,color:RV,fontWeight:`bold`},{tag:U.moduleKeyword,color:RV,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:AV},{tag:[U.variableName],color:AV},{tag:[U.propertyName],color:LV,fontStyle:`normal`},{tag:[U.typeName],color:IV},{tag:[U.className],color:PV,fontStyle:`italic`},{tag:[U.namespace],color:LV,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:RV},{tag:[U.bracket],color:kV},{tag:[U.brace],color:kV},{tag:[U.punctuation],color:kV},{tag:[U.function(U.variableName)],color:LV},{tag:[U.labelName],color:LV,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:LV},{tag:[U.definition(U.variableName)],color:AV},{tag:U.number,color:NV},{tag:U.changed,color:NV},{tag:U.annotation,color:zV,fontStyle:`italic`},{tag:U.modifier,color:NV,fontStyle:`italic`},{tag:U.self,color:NV},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:RV},{tag:[U.atom,U.bool,U.special(U.variableName)],color:NV},{tag:[U.processingInstruction,U.inserted],color:FV},{tag:[U.special(U.string),U.regexp],color:`#b4f9f8`},{tag:U.string,color:FV},{tag:U.definition(U.typeName),color:IV,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:AV},{tag:U.meta,color:kV},{tag:U.comment,fontStyle:`italic`,color:kV},{tag:U.docComment,fontStyle:`italic`,color:kV},{tag:[U.tagName],color:RV},{tag:[U.attributeName],color:PV},{tag:[U.heading],fontWeight:`bold`,color:`#89ddff`},{tag:U.heading1,color:`#89ddff`,fontWeight:`bold`},{tag:U.heading2,color:`#89ddff`},{tag:U.heading3,color:`#89ddff`},{tag:U.heading4,color:`#89ddff`},{tag:U.heading5,color:`#89ddff`},{tag:U.heading6,color:`#89ddff`},{tag:[U.strong],fontWeight:`bold`,color:AV},{tag:[U.emphasis],fontStyle:`italic`,color:IV},{tag:[U.link],color:INe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:KV,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:AV,textDecoration:`underline wavy`,borderBottom:`1px wavy ${zV}`},{tag:[U.strikethrough],color:zV,textDecoration:`line-through`},{tag:U.constant(U.name),color:NV},{tag:U.deleted,color:zV},{tag:U.squareBracket,color:kV},{tag:U.angleBracket,color:kV},{tag:U.monospace,color:AV},{tag:[U.contentSeparator],color:LV},{tag:U.quote,color:kV}]))],ZV={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},RNe={borderLeftWidth:`2px`},QV={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},$V={paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},eH={borderRadius:`4px`,padding:`2px 10px`},zNe={borderRadius:`2px`},tH={borderRadius:`2px`},nH={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},rH={width:`12px`,height:`12px`,borderRadius:`6px`},iH={borderRadius:`4px`,padding:`2px 6px`},aH={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},BNe=`#1e1e1e`,oH=`#252526`,sH=`#2d2d30`,cH=`#838383`,VNe=`#c6c6c6`,lH=`#d4d4d4`,uH=`#e9e9e9`,HNe=`#1c1c1c`,dH=`#569cd6`,UNe=`#c586c0`,fH=`#9cdcfe`,pH=`#4ec9b0`,mH=`#dcdcaa`,WNe=`#b5cea8`,hH=`#ce9178`,gH=`#f44747`,_H=`#d7ba7d`,vH=`#6a9955`,yH=gH,bH=`#FFFFFF08`,xH=BNe,SH=oH,GNe=`#264F7899`,KNe=`#72a1ff59`,CH=VNe,qNe=`#ffffff15`,JNe=dH,wH=_H,TH=`#3794ff`,YNe=`#c586c0`,EH=`#1e3f1e80`,DH=`#4b1c1c80`,OH=`#6cc26f`,kH=`#f14c4c`,XNe=[Ht.theme({"&":{color:lH,backgroundColor:xH,fontSize:ZV.fontSize,fontFamily:ZV.fontFamily},".cm-content":{caretColor:CH,lineHeight:ZV.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:CH,borderLeftWidth:RNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${CH}99`,color:xH},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:GNe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#72a1ff40`,outline:`1px solid ${dH}90`,color:uH,borderRadius:iH.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#3794ff90`,color:uH,padding:iH.padding,"& span":{color:uH}},".cm-search.cm-panel.cm-textfield":{color:lH,borderRadius:iH.borderRadius,padding:iH.padding},".cm-panels":{backgroundColor:oH,color:lH,borderRadius:`3px`,boxShadow:`0 2px 6px rgba(0, 0, 0, 0.45)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${sH}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${sH}`},".cm-panel button":{backgroundColor:sH,color:lH,border:`1px solid ${sH}`,borderRadius:eH.borderRadius,padding:eH.padding},".cm-panel button:hover":{backgroundColor:`#3a3a3a`,border:`1px solid ${cH}80`},".cm-activeLine":{backgroundColor:bH,borderRadius:zNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:HNe,color:cH,border:`none`,borderRight:`1px solid ${sH}`,paddingRight:$V.paddingRight},".cm-activeLineGutter":{backgroundColor:bH,color:uH,fontWeight:$V.fontWeight},".cm-lineNumbers":{fontSize:$V.fontSize,lineHeight:$V.lineHeight},".cm-foldGutter":{fontSize:$V.fontSize,lineHeight:$V.lineHeight},".cm-foldGutter .cm-gutterElement":{color:cH,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:uH},".cm-insertedLine":{textDecoration:QV.insertedTextDecoration,backgroundColor:EH,color:OH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:QV.insertedTextDecoration,backgroundColor:`${EH} !important`,color:OH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious,border:`1px solid ${OH}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:QV.deletedTextDecoration,backgroundColor:DH,color:kH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:QV.deletedTextDecoration,backgroundColor:`${DH} !important`,color:kH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious,border:`1px solid ${kH}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:SH,border:`1px solid ${sH}`,borderRadius:aH.borderRadius,padding:aH.padding,boxShadow:`0 3px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:SH,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:aH.padding,lineHeight:aH.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#04395e`,color:uH,borderRadius:aH.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:cH,paddingRight:aH.paddingRight},"& > ul > li > span.cm-completionDetail":{color:cH,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:SH,borderBottomColor:SH},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${yH}`},"&-warning":{borderLeft:`3px solid ${wH}`},"&-info":{borderLeft:`3px solid ${TH}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${yH}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${wH}`},".cm-matchingBracket":{backgroundColor:qNe,outline:`1px solid ${JNe}80`,borderRadius:tH.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${gH}40`,outline:`1px solid ${yH}`,borderRadius:tH.borderRadius},".cm-selectionMatch":{backgroundColor:KNe,outline:`1px solid ${sH}70`,borderRadius:tH.borderRadius},".cm-foldPlaceholder":{backgroundColor:SH,color:cH,border:`1px dotted ${cH}70`,borderRadius:nH.borderRadius,padding:nH.padding,margin:nH.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 1px ${sH}`},"& .cm-scroller::-webkit-scrollbar":{width:rH.width,height:rH.height},"& .cm-scroller::-webkit-scrollbar-track":{background:xH},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#424242`,borderRadius:rH.borderRadius,border:`3px solid ${xH}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#525252`},".cm-ghostText":{opacity:`0.5`,color:cH}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:dH,fontWeight:`bold`},{tag:U.controlKeyword,color:UNe,fontWeight:`bold`},{tag:U.moduleKeyword,color:dH,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:lH},{tag:[U.variableName],color:fH},{tag:[U.propertyName],color:fH,fontStyle:`normal`},{tag:[U.typeName],color:pH},{tag:[U.className],color:pH,fontStyle:`normal`},{tag:[U.namespace],color:lH,fontStyle:`normal`},{tag:[U.operator,U.operatorKeyword],color:lH},{tag:[U.bracket],color:lH},{tag:[U.brace],color:lH},{tag:[U.punctuation],color:lH},{tag:[U.function(U.variableName)],color:mH},{tag:[U.labelName],color:mH,fontStyle:`normal`},{tag:[U.definition(U.function(U.variableName))],color:mH},{tag:[U.definition(U.variableName)],color:fH},{tag:U.number,color:WNe},{tag:U.changed,color:_H},{tag:U.annotation,color:_H,fontStyle:`italic`},{tag:U.modifier,color:dH,fontStyle:`normal`},{tag:U.self,color:dH},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:fH},{tag:[U.atom,U.bool,U.special(U.variableName)],color:dH},{tag:[U.processingInstruction,U.inserted],color:hH},{tag:[U.special(U.string),U.regexp],color:`#d16969`},{tag:U.string,color:hH},{tag:U.definition(U.typeName),color:pH,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:lH},{tag:U.meta,color:cH},{tag:U.comment,fontStyle:`italic`,color:vH},{tag:U.docComment,fontStyle:`italic`,color:vH},{tag:[U.tagName],color:dH},{tag:[U.attributeName],color:fH},{tag:[U.heading],fontWeight:`bold`,color:dH},{tag:U.heading1,color:dH,fontWeight:`bold`},{tag:U.heading2,color:dH},{tag:U.heading3,color:dH},{tag:U.heading4,color:dH},{tag:U.heading5,color:dH},{tag:U.heading6,color:dH},{tag:[U.strong],fontWeight:`bold`,color:dH},{tag:[U.emphasis],fontStyle:`italic`,color:pH},{tag:[U.link],color:YNe,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:TH,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:lH,textDecoration:`underline wavy`,borderBottom:`1px wavy ${yH}`},{tag:[U.strikethrough],color:yH,textDecoration:`line-through`},{tag:U.constant(U.name),color:fH},{tag:U.deleted,color:yH},{tag:U.squareBracket,color:lH},{tag:U.angleBracket,color:lH},{tag:U.monospace,color:lH},{tag:[U.contentSeparator],color:lH},{tag:U.quote,color:vH}]))],AH={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ZNe={borderLeftWidth:`2px`},jH={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},MH={paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},NH={borderRadius:`4px`,padding:`2px 10px`},QNe={borderRadius:`2px`},PH={borderRadius:`2px`},FH={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},IH={width:`12px`,height:`12px`,borderRadius:`6px`},LH={borderRadius:`4px`,padding:`2px 6px`},RH={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},$Ne=`#ffffff`,zH=`#f3f3f3`,BH=`#d6d6d6`,VH=`#6b6b6b`,ePe=`#000000`,HH=`#383a42`,UH=`#1f1f1f`,tPe=`#f5f5f5`,WH=`#0064ff`,GH=`#af00db`,KH=`#0070c1`,qH=`#267f99`,JH=`#795e26`,nPe=`#098658`,YH=`#a31515`,XH=`#e51400`,ZH=`#795e26`,QH=`#008000`,$H=XH,eU=`#99999926`,tU=$Ne,nU=zH,rPe=`#add6ff`,iPe=`#a8ac9480`,rU=ePe,aPe=`#007acc20`,oPe=`#007acc`,iU=`#bf8803`,aU=`#006ab1`,sPe=`#9e46d0`,oU=`#ddfbe0`,sU=`#ffebec`,cU=`#22863a`,lU=`#e51400`,cPe=[Ht.theme({"&":{color:HH,backgroundColor:tU,fontSize:AH.fontSize,fontFamily:AH.fontFamily},".cm-content":{caretColor:rU,lineHeight:AH.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:rU,borderLeftWidth:ZNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${rU}99`,color:tU},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:rPe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#bbdefb`,outline:`1px solid ${KH}90`,color:UH,borderRadius:LH.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#90caf9`,color:UH,padding:LH.padding,"& span":{color:UH}},".cm-search.cm-panel.cm-textfield":{color:HH,borderRadius:LH.borderRadius,padding:LH.padding},".cm-panels":{backgroundColor:zH,color:HH,borderRadius:`3px`,boxShadow:`0 2px 6px rgba(0, 0, 0, 0.15)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${BH}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${BH}`},".cm-panel button":{backgroundColor:tU,color:HH,border:`1px solid ${BH}`,borderRadius:NH.borderRadius,padding:NH.padding},".cm-panel button:hover":{backgroundColor:`#e8e8e8`,border:`1px solid ${VH}80`},".cm-activeLine":{backgroundColor:eU,borderRadius:QNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:tPe,color:`#237893`,border:`none`,borderRight:`1px solid ${BH}`,paddingRight:MH.paddingRight},".cm-activeLineGutter":{backgroundColor:eU,color:`#0b216f`,fontWeight:MH.fontWeight},".cm-lineNumbers":{fontSize:MH.fontSize,lineHeight:MH.lineHeight},".cm-foldGutter":{fontSize:MH.fontSize,lineHeight:MH.lineHeight},".cm-foldGutter .cm-gutterElement":{color:`#237893`,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:`#0b216f`},".cm-insertedLine":{textDecoration:jH.insertedTextDecoration,backgroundColor:oU,color:cU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:jH.insertedTextDecoration,backgroundColor:`${oU} !important`,color:cU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious,border:`1px solid ${cU}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:jH.deletedTextDecoration,backgroundColor:sU,color:lU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:jH.deletedTextDecoration,backgroundColor:`${sU} !important`,color:lU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious,border:`1px solid ${lU}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:nU,border:`1px solid ${BH}`,borderRadius:RH.borderRadius,padding:RH.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:nU,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:RH.padding,lineHeight:RH.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#dcebfc`,color:UH,borderRadius:RH.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:VH,paddingRight:RH.paddingRight},"& > ul > li > span.cm-completionDetail":{color:VH,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:nU,borderBottomColor:nU},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${$H}`},"&-warning":{borderLeft:`3px solid ${iU}`},"&-info":{borderLeft:`3px solid ${aU}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${$H}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${iU}`},".cm-matchingBracket":{backgroundColor:aPe,outline:`1px solid ${oPe}80`,borderRadius:PH.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${XH}20`,outline:`1px solid ${$H}`,borderRadius:PH.borderRadius},".cm-selectionMatch":{backgroundColor:iPe,outline:`1px solid ${BH}70`,borderRadius:PH.borderRadius},".cm-foldPlaceholder":{backgroundColor:nU,color:VH,border:`1px dotted ${VH}70`,borderRadius:FH.borderRadius,padding:FH.padding,margin:FH.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 1px ${BH}`},"& .cm-scroller::-webkit-scrollbar":{width:IH.width,height:IH.height},"& .cm-scroller::-webkit-scrollbar-track":{background:tU},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#dadada`,borderRadius:IH.borderRadius,border:`3px solid ${tU}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#cccccc`},".cm-ghostText":{opacity:`0.5`,color:VH}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:WH,fontWeight:`bold`},{tag:U.controlKeyword,color:GH,fontWeight:`bold`},{tag:U.moduleKeyword,color:WH,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:HH},{tag:[U.variableName],color:KH},{tag:[U.propertyName],color:KH,fontStyle:`normal`},{tag:[U.typeName],color:qH},{tag:[U.className],color:qH,fontStyle:`normal`},{tag:[U.namespace],color:HH,fontStyle:`normal`},{tag:[U.operator,U.operatorKeyword],color:HH},{tag:[U.bracket],color:HH},{tag:[U.brace],color:HH},{tag:[U.punctuation],color:HH},{tag:[U.function(U.variableName)],color:JH},{tag:[U.labelName],color:JH,fontStyle:`normal`},{tag:[U.definition(U.function(U.variableName))],color:JH},{tag:[U.definition(U.variableName)],color:KH},{tag:U.number,color:nPe},{tag:U.changed,color:ZH},{tag:U.annotation,color:ZH,fontStyle:`italic`},{tag:U.modifier,color:WH,fontStyle:`normal`},{tag:U.self,color:WH},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:KH},{tag:[U.atom,U.bool,U.special(U.variableName)],color:WH},{tag:[U.processingInstruction,U.inserted],color:YH},{tag:[U.special(U.string),U.regexp],color:GH},{tag:U.string,color:YH},{tag:U.definition(U.typeName),color:qH,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:HH},{tag:U.meta,color:VH},{tag:U.comment,fontStyle:`italic`,color:QH},{tag:U.docComment,fontStyle:`italic`,color:QH},{tag:[U.tagName],color:WH},{tag:[U.attributeName],color:KH},{tag:[U.heading],fontWeight:`bold`,color:WH},{tag:U.heading1,color:WH,fontWeight:`bold`},{tag:U.heading2,color:WH},{tag:U.heading3,color:WH},{tag:U.heading4,color:WH},{tag:U.heading5,color:WH},{tag:U.heading6,color:WH},{tag:[U.strong],fontWeight:`bold`,color:WH},{tag:[U.emphasis],fontStyle:`italic`,color:KH},{tag:[U.link],color:sPe,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:aU,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:HH,textDecoration:`underline wavy`,borderBottom:`1px wavy ${$H}`},{tag:[U.strikethrough],color:$H,textDecoration:`line-through`},{tag:U.constant(U.name),color:KH},{tag:U.deleted,color:$H},{tag:U.squareBracket,color:HH},{tag:U.angleBracket,color:HH},{tag:U.monospace,color:HH},{tag:[U.contentSeparator],color:HH},{tag:U.quote,color:QH}]))];function uU(){return uU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uU.apply(null,arguments)}function lPe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var dU=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,fU=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(dU(e)):dU,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Pn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=mn(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Bt(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(fU.prototype[Symbol.iterator]=function(){return this});var pU={from:-1,to:-1,match:/.*/.exec(``)},mU=`gm`+(/x/.unicode==null?``:`u`),hU=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=pU,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new vU(e,t,n,r,i);this.re=new RegExp(t,mU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=yU(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=yU(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},gU=new WeakMap,_U=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=gU.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return gU.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),gU.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},vU=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=pU,this.matchPos=yU(e,r),this.re=new RegExp(t,mU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=_U.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=yU(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=_U.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(hU.prototype[Symbol.iterator]=vU.prototype[Symbol.iterator]=function(){return this});function uPe(e){try{return new RegExp(e,mU),!0}catch{return!1}}function yU(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function bU(e){let t=Dn(`input`,{class:`cm-textfield`,name:`line`,value:String(e.state.doc.lineAt(e.state.selection.main.head).number)}),n=Dn(`form`,{class:`cm-gotoLine`,onkeydown:t=>{t.keyCode==27?(t.preventDefault(),e.dispatch({effects:xU.of(!1)}),e.focus()):t.keyCode==13&&(t.preventDefault(),r())},onsubmit:e=>{e.preventDefault(),r()}},Dn(`label`,e.state.phrase(`Go to line`),`: `,t),` `,Dn(`button`,{class:`cm-button`,type:`submit`},e.state.phrase(`go`)),Dn(`button`,{name:`close`,onclick:()=>{e.dispatch({effects:xU.of(!1)}),e.focus()},"aria-label":e.state.phrase(`close`),type:`button`},[`×`]));function r(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,a,o,s,c]=n,l=s?+s.slice(1):0,u=o?+o:i.number;if(o&&c){let e=u/100;a&&(e=e*(a==`-`?-1:1)+i.number/r.doc.lines),u=Math.round(r.doc.lines*e)}else o&&a&&(u=u*(a==`-`?-1:1)+i.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u))),f=an.cursor(d.from+Math.max(0,Math.min(l,d.length)));e.dispatch({effects:[xU.of(!1),Ht.scrollIntoView(f.from,{y:`center`})],selection:f}),e.focus()}return{dom:n}}var xU=Zt.define(),SU=In.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(xU)&&(e=n.value);return e},provide:e=>Yt.from(e,e=>e?bU:null)}),dPe=e=>{let t=Cn(e,bU);if(!t){let n=[xU.of(!0)];e.state.field(SU,!1)??n.push(Zt.appendConfig.of([SU,fPe])),e.dispatch({effects:n}),t=Cn(e,bU)}return t&&t.dom.querySelector(`input`).select(),!0},fPe=Ht.baseTheme({".cm-panel.cm-gotoLine":{padding:`2px 6px 4px`,position:`relative`,"& label":{fontSize:`80%`},"& [name=close]":{position:`absolute`,top:`0`,bottom:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:`0`}}}),pPe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},CU=_n.define({combine(e){return yt(e,pPe,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function mPe(e){let t=[yPe,vPe];return e&&t.push(CU.of(e)),t}var hPe=Ln.mark({class:`cm-selectionMatch`}),gPe=Ln.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function wU(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=tn.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=tn.Word)}function _Pe(e,t,n,r){return e(t.sliceDoc(n,n+1))==tn.Word&&e(t.sliceDoc(r-1,r))==tn.Word}var vPe=Ct.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(CU),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Ln.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return Ln.none;let e=n.wordAt(i.head);if(!e)return Ln.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return Ln.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(wU(o,n,i.from,i.to)&&_Pe(o,n,i.from,i.to)))return Ln.none}else if(a=n.sliceDoc(i.from,i.to),!a)return Ln.none}let s=[];for(let r of e.visibleRanges){let e=new fU(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||wU(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(gPe.range(r,a)):(r>=i.to||a<=i.from)&&s.push(hPe.range(r,a)),s.length>t.maxMatches))return Ln.none}}return Ln.set(s)}},{decorations:e=>e.decorations}),yPe=Ht.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),bPe=({state:e,dispatch:t})=>{let{selection:n}=e,r=an.create(n.ranges.map(t=>e.wordAt(t.head)||an.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function xPe(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new fU(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new fU(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var SPe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return bPe({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=xPe(e,r);return i?(t(e.update({selection:e.selection.addRange(an.range(i.from,i.to),!1),effects:Ht.scrollIntoView(i.to)})),!0):!1},TU=_n.define({combine(e){return yt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new PPe(e),scrollToMatch:e=>Ht.scrollIntoView(e)})}}),EU=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||uPe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
1256
+ `;)e--;this.fragmentEnd=e?e-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=t;if(!n.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(fn.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,a=i,o=e.block.children.length,s=a,c=o;for(;;){if(t.to-n>r){if(t.type.isAnonymous&&t.firstChild())continue;break}let i=IN(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,i);else{let n=new Tt(e.parser.nodeSet.types[UM.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(n,t.tree),e.addNode(n,i)}if(t.type.is(`Block`)&&(JOe.indexOf(t.type.id)<0?(a=t.to-n,o=e.block.children.length):(a=s,o=c,s=t.to-n,c=e.block.children.length)),!t.nextSibling())break}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-i}};function IN(e,t){let n=e;for(let r=1;r<t.length;r++){let i=t[r-1].to,a=t[r].from;i<e&&(n-=a-i)}return n}var XOe=Dt({"Blockquote/...":U.quote,HorizontalRule:U.contentSeparator,"ATXHeading1/... SetextHeading1/...":U.heading1,"ATXHeading2/... SetextHeading2/...":U.heading2,"ATXHeading3/...":U.heading3,"ATXHeading4/...":U.heading4,"ATXHeading5/...":U.heading5,"ATXHeading6/...":U.heading6,"Comment CommentBlock":U.comment,Escape:U.escape,Entity:U.character,"Emphasis/...":U.emphasis,"StrongEmphasis/...":U.strong,"Link/... Image/...":U.link,"OrderedList/... BulletList/...":U.list,"BlockQuote/...":U.quote,"InlineCode CodeText":U.monospace,"URL Autolink":U.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":U.processingInstruction,"CodeInfo LinkLabel":U.labelName,LinkTitle:U.string,Paragraph:U.content}),ZOe=new mN(new At(vN).extend(XOe),Object.keys(uN).map(e=>uN[e]),Object.keys(uN).map(e=>fN[e]),Object.keys(uN),UOe,GM,Object.keys(AN).map(e=>AN[e]),Object.keys(AN),[]);function QOe(e,t,n){let r=[];for(let i=e.firstChild,a=t;;i=i.nextSibling){let e=i?i.from:n;if(e>a&&r.push({from:a,to:e}),!i)break;a=i.to}return r}function $Oe(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Ot((e,r)=>{let i=e.type.id;if(t&&(i==UM.CodeBlock||i==UM.FencedCode)){let n=``;if(i==UM.FencedCode){let t=e.node.getChild(UM.CodeInfo);t&&(n=r.read(t.from,t.to))}let a=t(n);if(a)return{parser:a,overlay:e=>e.type.id==UM.CodeText}}else if(n&&(i==UM.HTMLBlock||i==UM.HTMLTag||i==UM.CommentBlock))return{parser:n,overlay:QOe(e.node,e.from,e.to)};return null})}}var eke={resolve:`Strikethrough`,mark:`StrikethroughMark`},tke={defineNodes:[{name:`Strikethrough`,style:{"Strikethrough/...":U.strikethrough}},{name:`StrikethroughMark`,style:U.processingInstruction}],parseInline:[{name:`Strikethrough`,parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),a=/\s|^$/.test(r),o=/\s|^$/.test(i),s=kN.test(r),c=kN.test(i);return e.addDelimiter(eke,n,n+2,!o&&(!c||a||s),!a&&(!s||o||c))},after:`Emphasis`}]};function LN(e,t,n=0,r,i=0){let a=0,o=!0,s=-1,c=-1,l=!1,u=()=>{r.push(e.elt(`TableCell`,i+s,i+c,e.parser.parseInline(t.slice(s,c),i+s)))};for(let d=n;d<t.length;d++){let n=t.charCodeAt(d);n==124&&!l?((!o||s>-1)&&a++,o=!1,r&&(s>-1&&u(),r.push(e.elt(`TableDelimiter`,d+i,d+i+1))),s=c=-1):(l||n!=32&&n!=9)&&(s<0&&(s=d),c=d+1),l=!l&&n==92}return s>-1&&(a++,r&&u()),a}function RN(e,t){for(let n=t;n<e.length;n++){let t=e.charCodeAt(n);if(t==124)return!0;t==92&&n++}return!1}var zN=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,BN=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&zN.test(r=t.text.slice(t.pos))){let i=[];LN(e,n.content,0,i,n.start)==LN(e,r,t.pos)&&(this.rows=[e.elt(`TableHeader`,n.start,n.start+n.content.length,i),e.elt(`TableDelimiter`,e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];LN(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt(`TableRow`,e.lineStart+t.pos,e.lineStart+t.text.length,n))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt(`Table`,t.start,t.start+t.content.length,this.rows)),!0):!1}},nke={defineNodes:[{name:`Table`,block:!0},{name:`TableHeader`,style:{"TableHeader/...":U.heading}},`TableRow`,{name:`TableCell`,style:U.content},{name:`TableDelimiter`,style:U.processingInstruction}],parseBlock:[{name:`Table`,leaf(e,t){return RN(t.content,0)?new BN:null},endLeaf(e,t,n){if(n.parsers.some(e=>e instanceof BN)||!RN(t.text,t.basePos))return!1;let r=e.peekLine();return zN.test(r)&&LN(e,t.text,t.basePos)==LN(e,r,t.basePos)},before:`SetextHeading`}]},rke=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt(`Task`,t.start,t.start+t.content.length,[e.elt(`TaskMarker`,t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},ike={defineNodes:[{name:`Task`,block:!0,style:U.list},{name:`TaskMarker`,style:U.atom}],parseBlock:[{name:`TaskList`,leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name==`ListItem`?new rke:null},after:`SetextHeading`}]},VN=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,HN=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,ake=/[\w-]+\.[\w-]+($|\/)/,UN=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,WN=/\/[a-zA-Z\d@.]+/gy;function GN(e,t,n,r){let i=0;for(let a=t;a<n;a++)e[a]==r&&i++;return i}function oke(e,t){HN.lastIndex=t;let n=HN.exec(e);if(!n||ake.exec(n[0])[0].indexOf(`_`)>-1)return-1;let r=t+n[0].length;for(;;){let n=e[r-1],i;if(/[?!.,:*_~]/.test(n)||n==`)`&&GN(e,t,r,`)`)>GN(e,t,r,`(`))r--;else if(n==`;`&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+i.index;else break}return r}function KN(e,t){UN.lastIndex=t;let n=UN.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r==`_`||r==`-`?-1:t+n[0].length-(r==`.`?1:0)}var ske=[nke,ike,tke,{parseInline:[{name:`Autolink`,parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;VN.lastIndex=r;let i=VN.exec(e.text),a=-1;return!i||(i[1]||i[2]?(a=oke(e.text,r+i[0].length),a>-1&&e.hasOpenLink&&(a=r+/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,a))[0].length)):i[3]?a=KN(e.text,r):(a=KN(e.text,r+i[0].length),a>-1&&i[0]==`xmpp:`&&(WN.lastIndex=a,i=WN.exec(e.text),i&&(a=i.index+i[0].length))),a<0)?-1:(e.addElement(e.elt(`URL`,n,a+e.offset)),a+e.offset)}}]}];function qN(e,t,n){return(r,i,a)=>{if(i!=e||r.char(a+1)==e)return-1;let o=[r.elt(n,a,a+1)];for(let i=a+1;i<r.end;i++){let s=r.char(i);if(s==e)return r.addElement(r.elt(t,a,i+1,o.concat(r.elt(n,i,i+1))));if(s==92&&o.push(r.elt(`Escape`,i,i+++2)),KM(s))break}return-1}}var cke={defineNodes:[{name:`Superscript`,style:U.special(U.content)},{name:`SuperscriptMark`,style:U.processingInstruction}],parseInline:[{name:`Superscript`,parse:qN(94,`Superscript`,`SuperscriptMark`)}]},lke={defineNodes:[{name:`Subscript`,style:U.special(U.content)},{name:`SubscriptMark`,style:U.processingInstruction}],parseInline:[{name:`Subscript`,parse:qN(126,`Subscript`,`SubscriptMark`)}]},uke={defineNodes:[{name:`Emoji`,style:U.character}],parseInline:[{name:`Emoji`,parse(e,t,n){let r;return t!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(e.slice(n+1,e.end)))?-1:e.addElement(e.elt(`Emoji`,n,n+1+r[0].length))}}]},dke=55,fke=1,pke=56,mke=2,hke=57,gke=3,JN=4,_ke=5,YN=6,XN=7,ZN=8,QN=9,$N=10,vke=11,yke=12,bke=13,eP=58,xke=14,Ske=15,tP=59,nP=21,Cke=23,rP=24,wke=25,iP=27,aP=28,Tke=29,Eke=32,Dke=35,Oke=37,kke=38,Ake=0,jke=1,Mke={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Nke={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},oP={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Pke(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var sP=null,cP=null,lP=0;function uP(e,t){let n=e.pos+t;if(lP==n&&cP==e)return sP;let r=e.peek(t),i=``;for(;Pke(r);)i+=String.fromCharCode(r),r=e.peek(++t);return cP=e,lP=n,sP=i?i.toLowerCase():r==Fke||r==Ike?void 0:null}var dP=60,fP=62,pP=47,Fke=63,Ike=33,Lke=45;function mP(e,t){this.name=e,this.parent=t}var Rke=[YN,$N,XN,ZN,QN],zke=new On({start:null,shift(e,t,n,r){return Rke.indexOf(t)>-1?new mP(uP(r,1)||``,e):e},reduce(e,t){return t==nP&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==YN||i==Oke?new mP(uP(r,1)||``,e):e},strict:!1}),Bke=new vn((e,t)=>{if(e.next!=dP){e.next<0&&t.context&&e.acceptToken(eP);return}e.advance();let n=e.next==pP;n&&e.advance();let r=uP(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?Ske:xke);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(vke);if(i&&Nke[i])return e.acceptToken(eP,-2);if(t.dialectEnabled(Ake))return e.acceptToken(yke);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(bke)}else{if(r==`script`)return e.acceptToken(XN);if(r==`style`)return e.acceptToken(ZN);if(r==`textarea`)return e.acceptToken(QN);if(Mke.hasOwnProperty(r))return e.acceptToken($N);i&&oP[i]&&oP[i][r]?e.acceptToken(eP,-1):e.acceptToken(YN)}},{contextual:!0}),Vke=new vn(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(tP);break}if(e.next==Lke)t++;else if(e.next==fP&&t>=2){n>=3&&e.acceptToken(tP,-2);break}else t=0;e.advance()}});function Hke(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var Uke=new vn((e,t)=>{if(e.next==pP&&e.peek(1)==fP){let n=t.dialectEnabled(jke)||Hke(t.context);e.acceptToken(n?_ke:JN,2)}else e.next==fP&&e.acceptToken(JN,1)});function hP(e,t,n){let r=2+e.length;return new vn(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==dP||a==1&&i.next==pP||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==fP){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var Wke=hP(`script`,dke,fke),Gke=hP(`style`,pke,mke),Kke=hP(`textarea`,hke,gke),qke=Dt({"Text RawText IncompleteTag IncompleteCloseTag":U.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":U.angleBracket,TagName:U.tagName,"MismatchedCloseTag/TagName":[U.tagName,U.invalid],AttributeName:U.attributeName,"AttributeValue UnquotedAttributeValue":U.attributeValue,Is:U.definitionOperator,"EntityReference CharacterReference":U.character,Comment:U.blockComment,ProcessingInst:U.processingInstruction,DoctypeDecl:U.documentMeta}),Jke=wn.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:zke,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[qke],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[Wke,Gke,Kke,Uke,Bke,Vke,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function gP(e,t){let n=Object.create(null);for(let r of e.getChildren(rP)){let e=r.getChild(wke),i=r.getChild(iP)||r.getChild(aP);e&&(n[t.read(e.from,e.to)]=i?i.type.id==iP?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function _P(e,t){let n=e.getChild(Cke);return n?t.read(n.from,n.to):` `}function vP(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=gP(e.node.parent.firstChild,t)))return{parser:i.parser};return null}function yP(e=[],t=[]){let n=[],r=[],i=[],a=[];for(let t of e)(t.tag==`script`?n:t.tag==`style`?r:t.tag==`textarea`?i:a).push(t);let o=t.length?Object.create(null):null;for(let e of t)(o[e.name]||(o[e.name]=[])).push(e);return Ot((e,t)=>{let s=e.type.id;if(s==Tke)return vP(e,t,n);if(s==Eke)return vP(e,t,r);if(s==Dke)return vP(e,t,i);if(s==nP&&a.length){let n=e.node,r=n.firstChild,i=r&&_P(r,t),o;if(i){for(let e of a)if(e.tag==i&&(!e.attrs||e.attrs(o||=gP(r,t)))){let t=n.lastChild,i=t.type.id==kke?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(o&&s==rP){let n=e.node,r;if(r=n.firstChild){let e=o[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=_P(n.parent,t))continue;let e=n.lastChild;if(e.type.id==iP){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}]}}else if(e.type.id==aP)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var Yke=122,bP=1,Xke=123,Zke=124,xP=2,Qke=125,$ke=3,eAe=4,SP=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],tAe=58,nAe=40,CP=95,rAe=91,wP=45,iAe=46,aAe=35,oAe=37,sAe=38,cAe=92,lAe=10,uAe=42;function TP(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function EP(e){return e>=48&&e<=57}function DP(e){return EP(e)||e>=97&&e<=102||e>=65&&e<=70}var OP=(e,t,n)=>(r,i)=>{for(let a=!1,o=0,s=0;;s++){let{next:c}=r;if(TP(c)||c==wP||c==CP||a&&EP(c))!a&&(c!=wP||s>0)&&(a=!0),o===s&&c==wP&&o++,r.advance();else if(c==cAe&&r.peek(1)!=lAe){if(r.advance(),DP(r.next)){do r.advance();while(DP(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();a=!0}else{a&&r.acceptToken(o==2&&i.canShift(xP)?t:c==nAe?n:e);break}}},dAe=new vn(OP(Xke,xP,Zke)),fAe=new vn(OP(Qke,$ke,eAe)),pAe=new vn(e=>{if(SP.includes(e.peek(-1))){let{next:t}=e;(TP(t)||t==CP||t==aAe||t==iAe||t==uAe||t==rAe||t==tAe&&TP(e.peek(1))||t==wP||t==sAe)&&e.acceptToken(Yke)}}),mAe=new vn(e=>{if(!SP.includes(e.peek(-1))){let{next:t}=e;if(t==oAe&&(e.advance(),e.acceptToken(bP)),TP(t)){do e.advance();while(TP(e.next)||EP(e.next));e.acceptToken(bP)}}}),hAe=Dt({"AtKeyword import charset namespace keyframes media supports":U.definitionKeyword,"from to selector":U.keyword,NamespaceName:U.namespace,KeyframeName:U.labelName,KeyframeRangeName:U.operatorKeyword,TagName:U.tagName,ClassName:U.className,PseudoClassName:U.constant(U.className),IdName:U.labelName,"FeatureName PropertyName":U.propertyName,AttributeName:U.attributeName,NumberLiteral:U.number,KeywordQuery:U.keyword,UnaryQueryOp:U.operatorKeyword,"CallTag ValueName":U.atom,VariableName:U.variableName,Callee:U.operatorKeyword,Unit:U.unit,"UniversalSelector NestingSelector":U.definitionOperator,"MatchOp CompareOp":U.compareOperator,"ChildOp SiblingOp, LogicOp":U.logicOperator,BinOp:U.arithmeticOperator,Important:U.modifier,Comment:U.blockComment,ColorLiteral:U.color,"ParenthesizedContent StringLiteral":U.string,":":U.punctuation,"PseudoOp #":U.derefOperator,"; ,":U.separator,"( )":U.paren,"[ ]":U.squareBracket,"{ }":U.brace}),gAe={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},_Ae={__proto__:null,or:98,and:98,not:106,only:106,layer:170},vAe={__proto__:null,selector:112,layer:166},yAe={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},bAe={__proto__:null,to:207},xAe=wn.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO,5:}O%_QdO'#DgOOQS,5;P,5;PO-eQ`O,5;PO4^QdO,5;PO4fQdO,5:gO4vQdO'#EtO5TQ`O,5;zO5TQ`O,5;zPOOO'#Ej'#EjP5`O&jO,58{POOO,58{,58{OOQP1G.n1G.nOOQP1G.q1G.qO*hQ`O1G.qO*mQ`O1G.qOOQP1G/v1G/vO5kQpO1G/xO5sQaO1G/{O6ZQaO1G/}O6qQaO1G0OO7XQaO,5;^OOQO-E8p-E8pOOQS1G.i1G.iO7cQ`O,5:fO7hQdO'#DoO7oQdO'#CrOOQP1G/x1G/xO&lQdO1G/xO7vQ!jO'#DZO8UQ!bO,59vO8^QhO,5:OOOQO'#F]'#F]O8XQ!bO,59zO'tQhO,59xO8fQhO'#EvO8sQ`O,5;{O9OQhO,59|O9uQhO'#DiOOQW,5:S,5:SOOQS1G0n1G0nOOQW,5:P,5:PO9|Q!fO'#FYOOQS'#FY'#FYOOQS'#Em'#EmO;^QdO,59`OOQ[,59`,59`O;tQdO,59fOOQ[,59f,59fO<[QdO,59iOOQ[,59i,59iOOQ[,59k,59kO&lQdO,59mO<rQhO'#EQOOQW'#EQ'#EQO=WQ`O1G0UO1[QhO1G0UOOQ[,59o,59oO'tQhO'#DXOOQ[,59q,59qO=]Q#tO,5:VOOQS1G0[1G0[OOQS1G0^1G0^OOQS1G0`1G0`O=hQ`O1G0`O=mQdO'#E`OOQS1G0c1G0cOOQS1G0i1G0iO=xQaO,5:RO-`Q`O1G0kOOQS1G0k1G0kO-eQ`O1G0kO>PQ!fO1G0ROOQO1G0R1G0ROOQO,5;`,5;`O>gQdO,5;`OOQO-E8r-E8rO>tQ`O1G1fPOOO-E8h-E8hPOOO1G.g1G.gOOQP7+$]7+$]OOQP7+%d7+%dO&lQdO7+%dOOQS1G0Q1G0QO?PQaO'#F_O?ZQ`O,5:ZO?`Q!fO'#ElO@^QdO'#FWO@hQ`O,59^O@mQ!bO7+%dO&lQdO1G/bO@uQhO1G/fOOQW1G/j1G/jOOQW1G/d1G/dOAWQhO,5;bOOQO-E8t-E8tOAfQhO'#DZOAtQhO'#F^OBPQ`O'#F^OBUQ`O,5:TOOQS-E8k-E8kOOQ[1G.z1G.zOOQ[1G/Q1G/QOOQ[1G/T1G/TOOQ[1G/X1G/XOBZQdO,5:lOOQS7+%p7+%pOB`Q`O7+%pOBeQhO'#DYOBmQ`O,59sO'tQhO,59sOOQ[1G/q1G/qOBuQ`O1G/qOOQS7+%z7+%zOBzQbO'#DPOOQO'#Eb'#EbOCYQ`O'#EaOOQO'#Ea'#EaOCeQ`O'#EwOCmQdO,5:zOOQS,5:z,5:zOOQ[1G/m1G/mOOQS7+&V7+&VO-`Q`O7+&VOCxQ!fO'#EsO&lQdO'#EsOEPQdO7+%mOOQO7+%m7+%mOOQO1G0z1G0zOEdQ!bO<<IOOElQdO'#EqOEvQ`O,5;yOOQP1G/u1G/uOOQS-E8j-E8jOFOQdO'#EpOFYQ`O,5;rOOQ]1G.x1G.xOOQP<<IO<<IOOFbQdO7+$|OOQO'#D]'#D]OFiQ!bO7+%QOFqQhO'#EoOF{Q`O,5;xO&lQdO,5;xOOQW1G/o1G/oOOQO'#ES'#ESOGTQ`O1G0WOOQS<<I[<<I[O&lQdO,59tOGnQhO1G/_OOQ[1G/_1G/_OGuQ`O1G/_OOQW-E8l-E8lOOQ[7+%]7+%]OOQO,5:{,5:{O=pQdO'#ExOCeQ`O,5;cOOQS,5;c,5;cOOQS-E8u-E8uOOQS1G0f1G0fOOQS<<Iq<<IqOG}Q!fO,5;_OOQS-E8q-E8qOOQO<<IX<<IXOOQPAN>jAN>jOIUQaO,5;]OOQO-E8o-E8oOI`QdO,5;[OOQO-E8n-E8nOOQW<<Hh<<HhOOQW<<Hl<<HlOIjQhO<<HlOI{QhO,5;ZOJWQ`O,5;ZOOQO-E8m-E8mOJ]QdO1G1dOBZQdO'#EuOJgQ`O7+%rOOQW7+%r7+%rOJoQ!bO1G/`OOQ[7+$y7+$yOJzQhO7+$yPKRQ`O'#EnOOQO,5;d,5;dOOQO-E8v-E8vOOQS1G0}1G0}OKWQ`OAN>WO&lQdO1G0uOK]Q`O7+'OOOQO,5;a,5;aOOQO-E8s-E8sOOQW<<I^<<I^OOQ[<<He<<HePOQW,5;Y,5;YOOQWG23rG23rOKeQdO7+&a",stateData:"Kx~O#sOS#tQQ~OW[OZ[O]TO`VOaVOi]OjWOmXO!jYO!mZO!saO!ybO!{cO!}dO#QeO#WfO#YgO#oRO~OQiOW[OZ[O]TO`VOaVOi]OjWOmXO!jYO!mZO!saO!ybO!{cO!}dO#QeO#WfO#YgO#ohO~O#m$SP~P!dO#tmO~O#ooO~O]qO`rOarOjsOmtO!juO!mwO#nvO~OpzO!^xO~P$SOc!QO#o|O#p}O~O#o!RO~O#o!TO~OW[OZ[O]TO`VOaVOjWOmXO!jYO!mZO#oRO~OS!]Oe!YO!V![O!Y!`O#q!XOp$TP~Ok$TP~P&POQ!jOe!cOm!dOp!eOr!mOt!mOz!kO!`!lO#o!bO#p!hO#}!fO~Ot!qO!`!lO#o!pO~Ot!sO#o!sO~OS!]Oe!YO!V![O!Y!`O#q!XO~Oe!vOpzO#Z!xO~O]YX`YX`!pXaYXjYXmYXpYX!^YX!jYX!mYX#nYX~O`!zO~Ok!{O#m$SXo$SX~O#m$SXo$SX~P!dO#u#OO#v#OO#w#QO~Oc#UO#o|O#p}O~OpzO!^xO~Oo$SP~P!dOe#`O~Oe#aO~Ol#bO!h#cO~O]qO`rOarOjsOmtO~Op!ia!^!ia!j!ia!m!ia#n!iad!ia~P*zOp!la!^!la!j!la!m!la#n!lad!la~P*zOR#gOS!]Oe!YOr#gOt#gO!V![O!Y!`O#q#dO#}!fO~O!R#iO!^#jOk$TXp$TX~Oe#mO~Ok#oOpzO~Oe!vO~O]#rO`#rOd#uOi#rOj#rOk#rO~P&lO]#rO`#rOi#rOj#rOk#rOl#wO~P&lO]#rO`#rOi#rOj#rOk#rOo#yO~P&lOP#zOSsXesXksXvsX!VsX!YsX!usX!wsX#qsX!TsXQsX]sX`sXdsXisXjsXmsXpsXrsXtsXzsX!`sX#osX#psX#}sXlsXosX!^sX!qsX#msX~Ov#{O!u#|O!w#}Ok$TP~P'tOe#aOS#{Xk#{Xv#{X!V#{X!Y#{X!u#{X!w#{X#q#{XQ#{X]#{X`#{Xd#{Xi#{Xj#{Xm#{Xp#{Xr#{Xt#{Xz#{X!`#{X#o#{X#p#{X#}#{Xl#{Xo#{X!^#{X!q#{X#m#{X~Oe$RO~Oe$TO~Ok$VOv#{O~Ok$WO~Ot$XO!`!lO~Op$YO~OpzO!R#iO~OpzO#Z$`O~O!q$bOk!oa#m!oao!oa~P&lOk#hX#m#hXo#hX~P!dOk!{O#m$Sao$Sa~O#u#OO#v#OO#w$hO~Ol$jO!h$kO~Op!ii!^!ii!j!ii!m!ii#n!iid!ii~P*zOp!ki!^!ki!j!ki!m!ki#n!kid!ki~P*zOp!li!^!li!j!li!m!li#n!lid!li~P*zOp#fa!^#fa~P$SOo$lO~Od$RP~P%_Od#zP~P&lO`!PXd}X!R}X!T!PX~O`$sO!T$tO~Od$uO!R#iO~Ok#jXp#jX!^#jX~P'tO!^#jOk$Tap$Ta~O!R#iOk!Uap!Ua!^!Uad!Ua`!Ua~OS!]Oe!YO!V![O!Y!`O#q$yO~Od$QP~P9dOv#{OQ#|X]#|X`#|Xd#|Xe#|Xi#|Xj#|Xk#|Xm#|Xp#|Xr#|Xt#|Xz#|X!`#|X#o#|X#p#|X#}#|Xl#|Xo#|X~O]#rO`#rOd%OOi#rOj#rOk#rO~P&lO]#rO`#rOi#rOj#rOk#rOl%PO~P&lO]#rO`#rOi#rOj#rOk#rOo%QO~P&lOe%SOS!tXk!tX!V!tX!Y!tX#q!tX~Ok%TO~Od%YOt%ZO!a%ZO~Ok%[O~Oo%cO#o%^O#}%]O~Od%dO~P$SOv#{O!^%hO!q%jOk!oi#m!oio!oi~P&lOk#ha#m#hao#ha~P!dOk!{O#m$Sio$Si~O!^%mOd$RX~P$SOd%oO~Ov#{OQ#`Xd#`Xe#`Xm#`Xp#`Xr#`Xt#`Xz#`X!^#`X!`#`X#o#`X#p#`X#}#`X~O!^%qOd#zX~P&lOd%sO~Ol%tOv#{O~OR#gOr#gOt#gO#q%vO#}!fO~O!R#iOk#jap#ja!^#ja~O`!PXd}X!R}X!^}X~O!R#iO!^%xOd$QX~O`%zO~Od%{O~O#o%|O~Ok&OO~O`&PO!R#iO~Od&ROk&QO~Od&UO~OP#zOpsX!^sXdsX~O#}%]Op#TX!^#TX~OpzO!^&WO~Oo&[O#o%^O#}%]O~Ov#{OQ#gXe#gXk#gXm#gXp#gXr#gXt#gXz#gX!^#gX!`#gX!q#gX#m#gX#o#gX#p#gX#}#gXo#gX~O!^%hO!q&`Ok!oq#m!oqo!oq~P&lOl&aOv#{O~Od#eX!^#eX~P%_O!^%mOd$Ra~Od#dX!^#dX~P&lO!^%qOd#za~Od&fO~P&lOd&gO!T&hO~Od#cX!^#cX~P9dO!^%xOd$Qa~O]&mOd&oO~OS#bae#ba!V#ba!Y#ba#q#ba~Od&qO~PG]Od&qOk&rO~Ov#{OQ#gae#gak#gam#gap#gar#gat#gaz#ga!^#ga!`#ga!q#ga#m#ga#o#ga#p#ga#}#gao#ga~Od#ea!^#ea~P$SOd#da!^#da~P&lOR#gOr#gOt#gO#q%vO#}%]O~O!R#iOd#ca!^#ca~O`&xO~O!^%xOd$Qi~P&lO]&mOd&|O~Ov#{Od|ik|i~Od&}O~PG]Ok'OO~Od'PO~O!^%xOd$Qq~Od#cq!^#cq~P&lO#s!a#t#}]#}v!m~",goto:"2h$UPPPPP$VP$YP$c$uP$cP%X$cPP%_PPP%e%o%oPPPPP%oPP%oP&]P%oP%o'W%oP't'w'}'}(^'}P'}P'}P'}'}P(m'}(yP(|PP)p)v$c)|$c*SP$cP$c$cP*Y*{+YP$YP+aP+dP$YP$YP$YP+j$YP+m+p+s+z$YP$YPP$YP,P,V,f,|-[-b-l-r-x.O.U.`.f.l.rPPPPPPPPPPP.x/R/w/z0|P1U1u2O2R2U2[RnQ_^OP`kz!{$dq[OPYZ`kuvwxz!v!{#`$d%mqSOPYZ`kuvwxz!v!{#`$d%mQpTR#RqQ!OVR#SrQ#S!QS$Q!i!jR$i#U!V!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'Q!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QU#g!Y$t&hU%`$Y%b&WR&V%_!V!iac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QR$S!kQ%W$RR&S%Xk!^]bf!Y![!g#i#j#m$P$R%X%xQ#e!YQ${#mQ%w$tQ&j%xR&w&hQ!ygQ#p!`Q$^!xR%f$`R#n!]!U!mac!c!d!e!z#a#c#t#v#x#{$a$k$p$s%h%i%q%u%z&P&d&l&x'QQ!qdR$X!rQ!PVR#TrQ#S!PR$i#TQ!SWR#VsQ!UXR#WtQ{UQ!wgQ#^yQ#o!_Q$U!nQ$[!uQ$_!yQ%e$^Q&Y%aQ&]%fR&v&XSjPzQ!}kQ$c!{R%k$dZiPkz!{$dR$P!gQ%}%SR&z&mR!rdR!teR$Z!tS%a$Y%bR&t&WV%_$Y%b&WQ#PmR$g#PQ`OSkPzU!a`k$dR$d!{Q$p#aY%p$p%u&d&l'QQ%u$sQ&d%qQ&l%zR'Q&xQ#t!cQ#v!dQ#x!eV$}#t#v#xQ%X$RR&T%XQ%y$zS&k%y&yR&y&lQ%r$pR&e%rQ%n$mR&c%nQyUR#]yQ%i$aR&_%iQ!|jS$e!|$fR$f!}Q&n%}R&{&nQ#k!ZR$x#kQ%b$YR&Z%bQ&X%aR&u&X__OP`kz!{$d^UOP`kz!{$dQ!VYQ!WZQ#XuQ#YvQ#ZwQ#[xQ$]!vQ$m#`R&b%mR$q#aQ!gaQ!oc[#q!c!d!e#t#v#xQ$a!zd$o#a$p$s%q%u%z&d&l&x'QQ$r#cQ%R#{S%g$a%iQ%l$kQ&^%hR&p&P]#s!c!d!e#t#v#xW!Z]b!g$PQ!ufQ#f!YQ#l![Q$v#iQ$w#jQ$z#mS%V$R%XR&i%xQ#h!YQ%w$tR&w&hR$|#mR$n#`QlPR#_zQ!_]Q!nbQ$O!gR%U$P",nodeNames:`⚠ Unit VariableName VariableName QueryCallee Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector . ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue AtKeyword # ; ] [ BracketedValue } { BracedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee IfExpression if ArgList IfBranch KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp ComparisonQuery CompareOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector ParenthesizedSelector CallQuery ArgList , CallLiteral CallTag ParenthesizedContent PseudoClassName ArgList IdSelector IdName AttributeSelector AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp Block Declaration PropertyName Important ImportStatement import Layer layer LayerName layer MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports ScopeStatement scope to AtRule Styles`,maxTerm:143,nodeProps:[[`isolate`,-2,5,36,``],[`openedBy`,20,`(`,28,`[`,31,`{`],[`closedBy`,21,`)`,29,`]`,32,`}`]],propSources:[hAe],skippedNodes:[0,5,106],repeatNodeCount:15,tokenData:"JQ~R!YOX$qX^%i^p$qpq%iqr({rs-ust/itu6Wuv$qvw7Qwx7cxy9Qyz9cz{9h{|:R|}>t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Qj)OUOy%Qz#]%Q#]#^)b#^;'S%Q;'S;=`%c<%lO%Qj)gU!a`Oy%Qz#a%Q#a#b)y#b;'S%Q;'S;=`%c<%lO%Qj*OU!a`Oy%Qz#d%Q#d#e*b#e;'S%Q;'S;=`%c<%lO%Qj*gU!a`Oy%Qz#c%Q#c#d*y#d;'S%Q;'S;=`%c<%lO%Qj+OU!a`Oy%Qz#f%Q#f#g+b#g;'S%Q;'S;=`%c<%lO%Qj+gU!a`Oy%Qz#h%Q#h#i+y#i;'S%Q;'S;=`%c<%lO%Qj,OU!a`Oy%Qz#T%Q#T#U,b#U;'S%Q;'S;=`%c<%lO%Qj,gU!a`Oy%Qz#b%Q#b#c,y#c;'S%Q;'S;=`%c<%lO%Qj-OU!a`Oy%Qz#h%Q#h#i-b#i;'S%Q;'S;=`%c<%lO%Qj-iS!qY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q~-xWOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c<%lO-u~.gOt~~.jRO;'S-u;'S;=`.s;=`O-u~.vXOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c;=`<%l-u<%lO-u~/fP;=`<%l-uj/nYjYOy%Qz!Q%Q!Q![0^![!c%Q!c!i0^!i#T%Q#T#Z0^#Z;'S%Q;'S;=`%c<%lO%Qj0cY!a`Oy%Qz!Q%Q!Q![1R![!c%Q!c!i1R!i#T%Q#T#Z1R#Z;'S%Q;'S;=`%c<%lO%Qj1WY!a`Oy%Qz!Q%Q!Q![1v![!c%Q!c!i1v!i#T%Q#T#Z1v#Z;'S%Q;'S;=`%c<%lO%Qj1}YrY!a`Oy%Qz!Q%Q!Q![2m![!c%Q!c!i2m!i#T%Q#T#Z2m#Z;'S%Q;'S;=`%c<%lO%Qj2tYrY!a`Oy%Qz!Q%Q!Q![3d![!c%Q!c!i3d!i#T%Q#T#Z3d#Z;'S%Q;'S;=`%c<%lO%Qj3iY!a`Oy%Qz!Q%Q!Q![4X![!c%Q!c!i4X!i#T%Q#T#Z4X#Z;'S%Q;'S;=`%c<%lO%Qj4`YrY!a`Oy%Qz!Q%Q!Q![5O![!c%Q!c!i5O!i#T%Q#T#Z5O#Z;'S%Q;'S;=`%c<%lO%Qj5TY!a`Oy%Qz!Q%Q!Q![5s![!c%Q!c!i5s!i#T%Q#T#Z5s#Z;'S%Q;'S;=`%c<%lO%Qj5zSrY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qd6ZUOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qd6tS!hS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qb7VSZQOy%Qz;'S%Q;'S;=`%c<%lO%Q~7fWOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z<%lO7c~8RRO;'S7c;'S;=`8[;=`O7c~8_XOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z;=`<%l7c<%lO7c~8}P;=`<%l7cj9VSeYOy%Qz;'S%Q;'S;=`%c<%lO%Q~9hOd~n9oUWQvWOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qj:YWvW!mQOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj:wU!a`Oy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Qj;bY!a`#}YOy%Qz!Q%Q!Q![;Z![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%Qj<VY!a`Oy%Qz{%Q{|<u|}%Q}!O<u!O!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj<zU!a`Oy%Qz!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj=eU!a`#}YOy%Qz!Q%Q!Q![=^![;'S%Q;'S;=`%c<%lO%Qj>O[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%Qj>yS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!h<Q!h#X%Q#X#Y<Q#Y;'S%Q;'S;=`%c<%lO%QjBUU`YOy%Qz![%Q![!]Bh!];'S%Q;'S;=`%c<%lO%QbBoSaQ!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QjCQSkYOy%Qz;'S%Q;'S;=`%c<%lO%QhCcU!TWOy%Qz!_%Q!_!`Cu!`;'S%Q;'S;=`%c<%lO%QhC|S!TW!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QlDaS!TW!hSOy%Qz;'S%Q;'S;=`%c<%lO%QjDtV!jQ!TWOy%Qz!_%Q!_!`Cu!`!aEZ!a;'S%Q;'S;=`%c<%lO%QbEbS!jQ!a`Oy%Qz;'S%Q;'S;=`%c<%lO%QjEqYOy%Qz}%Q}!OFa!O!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjFfW!a`Oy%Qz!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjGV[iY!a`Oy%Qz}%Q}!OGO!O!Q%Q!Q![GO![!c%Q!c!}GO!}#T%Q#T#oGO#o;'S%Q;'S;=`%c<%lO%QjHQSmYOy%Qz;'S%Q;'S;=`%c<%lO%QnHcSl^Oy%Qz;'S%Q;'S;=`%c<%lO%QjHtSpYOy%Qz;'S%Q;'S;=`%c<%lO%QjIVSoYOy%Qz;'S%Q;'S;=`%c<%lO%QfIhU!mQOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Q`I}P;=`<%l$q",tokenizers:[pAe,mAe,dAe,fAe,1,2,3,4,new ln(`m~RRYZ[z{a~~g~aO#v~~dP!P!Qg~lO#w~~`,28,129)],topRules:{StyleSheet:[0,6],Styles:[1,105]},specialized:[{term:124,get:e=>gAe[e]||-1},{term:125,get:e=>_Ae[e]||-1},{term:4,get:e=>vAe[e]||-1},{term:25,get:e=>yAe[e]||-1},{term:123,get:e=>bAe[e]||-1}],tokenPrec:1963}),kP=null;function AP(){if(!kP&&typeof document==`object`&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!=`cssText`&&r!=`cssFloat`&&typeof e[r]==`string`&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,e=>`-`+e.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));kP=t.sort().map(e=>({type:`property`,label:e,apply:e+`: `}))}return kP||[]}var jP=`active.after.any-link.autofill.backdrop.before.checked.cue.default.defined.disabled.empty.enabled.file-selector-button.first.first-child.first-letter.first-line.first-of-type.focus.focus-visible.focus-within.fullscreen.has.host.host-context.hover.in-range.indeterminate.invalid.is.lang.last-child.last-of-type.left.link.marker.modal.not.nth-child.nth-last-child.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.part.placeholder.placeholder-shown.read-only.read-write.required.right.root.scope.selection.slotted.target.target-text.valid.visited.where`.split(`.`).map(e=>({type:`class`,label:e})),MP=`above.absolute.activeborder.additive.activecaption.after-white-space.ahead.alias.all.all-scroll.alphabetic.alternate.always.antialiased.appworkspace.asterisks.attr.auto.auto-flow.avoid.avoid-column.avoid-page.avoid-region.axis-pan.background.backwards.baseline.below.bidi-override.blink.block.block-axis.bold.bolder.border.border-box.both.bottom.break.break-all.break-word.bullets.button.button-bevel.buttonface.buttonhighlight.buttonshadow.buttontext.calc.capitalize.caps-lock-indicator.caption.captiontext.caret.cell.center.checkbox.circle.cjk-decimal.clear.clip.close-quote.col-resize.collapse.color.color-burn.color-dodge.column.column-reverse.compact.condensed.contain.content.contents.content-box.context-menu.continuous.copy.counter.counters.cover.crop.cross.crosshair.currentcolor.cursive.cyclic.darken.dashed.decimal.decimal-leading-zero.default.default-button.dense.destination-atop.destination-in.destination-out.destination-over.difference.disc.discard.disclosure-closed.disclosure-open.document.dot-dash.dot-dot-dash.dotted.double.down.e-resize.ease.ease-in.ease-in-out.ease-out.element.ellipse.ellipsis.embed.end.ethiopic-abegede-gez.ethiopic-halehame-aa-er.ethiopic-halehame-gez.ew-resize.exclusion.expanded.extends.extra-condensed.extra-expanded.fantasy.fast.fill.fill-box.fixed.flat.flex.flex-end.flex-start.footnotes.forwards.from.geometricPrecision.graytext.grid.groove.hand.hard-light.help.hidden.hide.higher.highlight.highlighttext.horizontal.hsl.hsla.hue.icon.ignore.inactiveborder.inactivecaption.inactivecaptiontext.infinite.infobackground.infotext.inherit.initial.inline.inline-axis.inline-block.inline-flex.inline-grid.inline-table.inset.inside.intrinsic.invert.italic.justify.keep-all.landscape.large.larger.left.level.lighter.lighten.line-through.linear.linear-gradient.lines.list-item.listbox.listitem.local.logical.loud.lower.lower-hexadecimal.lower-latin.lower-norwegian.lowercase.ltr.luminosity.manipulation.match.matrix.matrix3d.medium.menu.menutext.message-box.middle.min-intrinsic.mix.monospace.move.multiple.multiple_mask_images.multiply.n-resize.narrower.ne-resize.nesw-resize.no-close-quote.no-drop.no-open-quote.no-repeat.none.normal.not-allowed.nowrap.ns-resize.numbers.numeric.nw-resize.nwse-resize.oblique.opacity.open-quote.optimizeLegibility.optimizeSpeed.outset.outside.outside-shape.overlay.overline.padding.padding-box.painted.page.paused.perspective.pinch-zoom.plus-darker.plus-lighter.pointer.polygon.portrait.pre.pre-line.pre-wrap.preserve-3d.progress.push-button.radial-gradient.radio.read-only.read-write.read-write-plaintext-only.rectangle.region.relative.repeat.repeating-linear-gradient.repeating-radial-gradient.repeat-x.repeat-y.reset.reverse.rgb.rgba.ridge.right.rotate.rotate3d.rotateX.rotateY.rotateZ.round.row.row-resize.row-reverse.rtl.run-in.running.s-resize.sans-serif.saturation.scale.scale3d.scaleX.scaleY.scaleZ.screen.scroll.scrollbar.scroll-position.se-resize.self-start.self-end.semi-condensed.semi-expanded.separate.serif.show.single.skew.skewX.skewY.skip-white-space.slide.slider-horizontal.slider-vertical.sliderthumb-horizontal.sliderthumb-vertical.slow.small.small-caps.small-caption.smaller.soft-light.solid.source-atop.source-in.source-out.source-over.space.space-around.space-between.space-evenly.spell-out.square.start.static.status-bar.stretch.stroke.stroke-box.sub.subpixel-antialiased.svg_masks.super.sw-resize.symbolic.symbols.system-ui.table.table-caption.table-cell.table-column.table-column-group.table-footer-group.table-header-group.table-row.table-row-group.text.text-bottom.text-top.textarea.textfield.thick.thin.threeddarkshadow.threedface.threedhighlight.threedlightshadow.threedshadow.to.top.transform.translate.translate3d.translateX.translateY.translateZ.transparent.ultra-condensed.ultra-expanded.underline.unidirectional-pan.unset.up.upper-latin.uppercase.url.var.vertical.vertical-text.view-box.visible.visibleFill.visiblePainted.visibleStroke.visual.w-resize.wait.wave.wider.window.windowframe.windowtext.words.wrap.wrap-reverse.x-large.x-small.xor.xx-large.xx-small`.split(`.`).map(e=>({type:`keyword`,label:e})).concat(`aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.grey.green.greenyellow.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen`.split(`.`).map(e=>({type:`constant`,label:e}))),SAe=`a.abbr.address.article.aside.b.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.dd.del.details.dfn.dialog.div.dl.dt.em.figcaption.figure.footer.form.header.hgroup.h1.h2.h3.h4.h5.h6.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.main.meter.nav.ol.output.p.pre.ruby.section.select.small.source.span.strong.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.tr.u.ul`.split(`.`).map(e=>({type:`type`,label:e})),CAe=[`@charset`,`@color-profile`,`@container`,`@counter-style`,`@font-face`,`@font-feature-values`,`@font-palette-values`,`@import`,`@keyframes`,`@layer`,`@media`,`@namespace`,`@page`,`@position-try`,`@property`,`@scope`,`@starting-style`,`@supports`,`@view-transition`].map(e=>({type:`keyword`,label:e})),NP=/^(\w[\w-]*|-\w[\w-]*|)$/,wAe=/^-(-[\w-]*)?$/;function TAe(e,t){if((e.name==`(`||e.type.isError)&&(e=e.parent||e),e.name!=`ArgList`)return!1;let n=e.parent?.firstChild;return n?.name==`Callee`?t.sliceString(n.from,n.to)==`var`:!1}var PP=new Ft,EAe=[`Declaration`];function DAe(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function FP(e,t,n){if(t.to-t.from>4096){let r=PP.get(t);if(r)return r;let i=[],a=new Set,o=t.cursor(ft.IncludeAnonymous);if(o.firstChild())do for(let t of FP(e,o.node,n))a.has(t.label)||(a.add(t.label),i.push(t));while(o.nextSibling());return PP.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(t=>{if(n(t)&&t.matchContext(EAe)&&t.node.nextSibling?.name==`:`){let n=e.sliceString(t.from,t.to);i.has(n)||(i.add(n),r.push({label:n,type:`variable`}))}}),r}}var IP=e=>t=>{let{state:n,pos:r}=t,i=bt(n).resolveInner(r,-1),a=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)==`-`;if(i.name==`PropertyName`||(a||i.name==`TagName`)&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:AP(),validFor:NP};if(i.name==`ValueName`)return{from:i.from,options:MP,validFor:NP};if(i.name==`PseudoClassName`)return{from:i.from,options:jP,validFor:NP};if(e(i)||(t.explicit||a)&&TAe(i,n.doc))return{from:e(i)||a?i.from:r,options:FP(n.doc,DAe(i),e),validFor:wAe};if(i.name==`TagName`){for(let{parent:e}=i;e;e=e.parent)if(e.name==`Block`)return{from:i.from,options:AP(),validFor:NP};return{from:i.from,options:SAe,validFor:NP}}if(i.name==`AtKeyword`)return{from:i.from,options:CAe,validFor:NP};if(!t.explicit)return null;let o=i.resolve(r),s=o.childBefore(r);return s&&s.name==`:`&&o.name==`PseudoClassSelector`?{from:r,options:jP,validFor:NP}:s&&s.name==`:`&&o.name==`Declaration`||o.name==`ArgList`?{from:r,options:MP,validFor:NP}:o.name==`Block`||o.name==`Styles`?{from:r,options:AP(),validFor:NP}:null},LP=IP(e=>e.name==`VariableName`),RP=En.define({name:`css`,parser:xAe.configure({props:[gt.add({Declaration:cn()}),mt.add({"Block KeyframeList":Fn})]}),languageData:{commentTokens:{block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*\}$/,wordChars:`-`}});function zP(){return new kn(RP,RP.data.of({autocomplete:LP}))}var BP=[`_blank`,`_self`,`_top`,`_parent`],VP=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],HP=[`get`,`post`,`put`,`delete`],UP=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],WP=[`true`,`false`],GP={},OAe={a:{attrs:{href:null,ping:null,type:null,media:null,target:BP,hreflang:null}},abbr:GP,address:GP,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:GP,aside:GP,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:GP,base:{attrs:{href:null,target:BP}},bdi:GP,bdo:GP,blockquote:{attrs:{cite:null}},body:GP,br:GP,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:UP,formmethod:HP,formnovalidate:[`novalidate`],formtarget:BP,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:GP,center:GP,cite:GP,code:GP,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:GP,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:GP,div:GP,dl:GP,dt:GP,em:GP,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:GP,figure:GP,footer:GP,form:{attrs:{action:null,name:null,"accept-charset":VP,autocomplete:[`on`,`off`],enctype:UP,method:HP,novalidate:[`novalidate`],target:BP}},h1:GP,h2:GP,h3:GP,h4:GP,h5:GP,h6:GP,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:GP,hgroup:GP,hr:GP,html:{attrs:{manifest:null}},i:GP,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:UP,formmethod:HP,formnovalidate:[`novalidate`],formtarget:BP,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:GP,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:GP,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:GP,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:VP,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:GP,noscript:GP,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:GP,param:{attrs:{name:null,value:null}},pre:GP,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:GP,rt:GP,ruby:GP,samp:GP,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:VP}},section:GP,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:GP,source:{attrs:{src:null,type:null,media:null}},span:GP,strong:GP,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:GP,summary:GP,sup:GP,table:GP,tbody:GP,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:GP,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:GP,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:GP,time:{attrs:{datetime:null}},title:GP,tr:GP,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:GP,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:GP},KP={accesskey:null,class:null,contenteditable:WP,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:WP,autocorrect:WP,autocapitalize:WP,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":WP,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":WP,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":WP,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":WP,"aria-hidden":WP,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":WP,"aria-multiselectable":WP,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":WP,"aria-relevant":null,"aria-required":WP,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},qP=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of qP)KP[e]=null;var JP=class{constructor(e,t){this.tags={...OAe,...e},this.globalAttrs={...KP,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};JP.default=new JP;function YP(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function XP(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`)if(t)t=!1;else return e;return null}function ZP(e,t,n){return n.tags[YP(e,XP(t))]?.children||n.allTags}function QP(e,t){let n=[];for(let r=XP(t);r&&!r.type.isTop;r=XP(r.parent)){let i=YP(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var $P=/^[:\-\.\w\u00b7-\uffff]*$/;function eF(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=XP(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:ZP(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(QP(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function tF(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:QP(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:$P}}function kAe(e,t,n,r){let i=[],a=0;for(let r of ZP(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of QP(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function AAe(e,t,n,r,i){let a=XP(n),o=a?t.tags[YP(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:$P}}function jAe(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=XP(n),i=r?t.tags[YP(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function nF(e,t){let{state:n,pos:r}=t,i=bt(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?tF(n,i,i.from,r):eF(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?eF(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?tF(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?AAe(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?jAe(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?kAe(n,e,i,r):null}function rF(e){return nF(JP.default,e)}function iF(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new JP(t,n):JP.default;return e=>nF(r,e)}var MAe=Bn.parser.configure({top:`SingleExpression`}),aF=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:tee.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:eee.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:Rn.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:MAe},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Bn.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:RP.parser}],oF=[{name:`style`,parser:RP.parser.configure({top:`Styles`})}].concat(qP.map(e=>({name:e,parser:Bn.parser}))),sF=En.define({name:`html`,parser:Jke.configure({props:[gt.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),mt.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),gn.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),cF=sF.configure({wrap:yP(aF,oF)});function lF(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=yP((e.nestedLanguages||[]).concat(aF),(e.nestedAttributes||[]).concat(oF))),new kn(n?sF.configure({wrap:n,dialect:t}):t?cF.configure({dialect:t}):cF,[cF.data.of({autocomplete:iF(e)}),e.autoCloseTags===!1?[]:dF,zn().support,zP().support])}var uF=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `)),dF=Ht.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!cF.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=bt(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if(t.parent?.lastChild?.name!=`CloseTag`&&(a=YP(o.doc,t.parent,n))&&!uF.has(a))return{range:e,changes:{from:n,to:n+(o.doc.sliceString(n,n+1)===`>`?1:0),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=YP(o.doc,e,n))&&!uF.has(a)){let e=n+(o.doc.sliceString(n,n+1)===`>`?1:0),t=`${a}>`;return{range:an.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),fF=qt({commentTokens:{block:{open:`<!--`,close:`-->`}}}),pF=new fn,mF=ZOe.configure({props:[mt.add(e=>!e.is(`Block`)||e.is(`Document`)||hF(e)!=null||NAe(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),pF.add(hF),gt.add({Document:()=>null}),dn.add({Document:fF})]});function hF(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function NAe(e){return e.name==`OrderedList`||e.name==`BulletList`}function PAe(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=hF(e.type))!=null&&r<=t)break;n=e}return n.to}var FAe=Nn.of((e,t,n)=>{for(let r=bt(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(pF);if(e==null)continue;let t=PAe(r,e);if(t>n)return{from:n,to:t}}return null});function gF(e){return new Qt(fF,e,[],`markdown`)}var _F=gF(mF),vF=gF(mF.configure([ske,lke,cke,uke,{props:[mt.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function IAe(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):W.matchLanguageName(e,n,!0),t instanceof W)return t.support?t.support.language.parser:en.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var yF=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}else{for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}}marker(e,t){let n=this.node.name==`OrderedList`?String(+xF(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function bF(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new yF(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new yF(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new yF(i.parent,s,s+t,a[1],e,n,i))}}return r}function xF(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function SF(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=xF(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function CF(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(dt)!=` `)return e;let r=_t(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var wF=(e={})=>({state:t,dispatch:n})=>{let r=bt(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!vF.isActiveAt(t,n.from,-1)&&!vF.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=bF(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let u=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&u){let n=l.node.firstChild,r=l.node.getChild(`ListItem`,`ListItem`);if(n.to>=o||r&&r.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&SF(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&SF(e.item,i,r),{range:an.cursor(t+n.length),changes:r}}else{let e=DF(c,t,s);return{range:an.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&u&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let d=[];l.node.name==`OrderedList`&&SF(l.item,i,d);let f=l.item&&l.item.from<s.from,p=``;if(!f||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)p+=e==t&&!f?c[e].marker(i,1):c[e].blank(e<t?_t(s.text,4,c[e+1].from)-p.length:null);let m=o;for(;m>s.from&&/\s/.test(s.text.charAt(m-s.from-1));)m--;return p=CF(p,t),LAe(l.node,t.doc)&&(p=DF(c,t,s)+t.lineBreak+p),d.push({from:m,to:o,insert:t.lineBreak+p}),{range:an.cursor(m+p.length+1),changes:d}});return a?!1:(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)},TF=wF();function EF(e){return e.name==`QuoteMark`||e.name==`ListMark`}function LAe(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+(o?0:1)<a.number}function DF(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?_t(n.text,4,e[t+1].from)-r.length:null,t<i);return CF(r,t)}function RAe(e,t){let n=e.resolveInner(t,-1),r=t;EF(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(EF(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var OF=({state:e,dispatch:t})=>{let n=bt(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&vF.isActiveAt(e,t.from)){let t=a.lineAt(i),r=bF(RAe(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+(n.spaceAfter?1:0);if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:an.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(!n.item||t.from<=n.item.from||!/\S/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(_t(t.text,4,n.to)-_t(t.text,4,n.from));return r==t.from&&(i=CF(i,e)),{range:an.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:an.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return r?!1:(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)},kF=[{key:`Enter`,run:TF},{key:`Backspace`,run:OF}],AF=lF({matchClosingTags:!1});function jF(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=_F,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:s=AF}=e;if(!(i instanceof mN))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],l=[s.support,FAe],u;o&&l.push(NF),n instanceof kn?(l.push(n.support),u=n.language):n&&(u=n);let d=t||u?IAe(t,u):void 0;c.push($Oe({codeParser:d,htmlParser:s.language.parser})),r&&l.push(sn.high(ut.of(kF)));let f=gF(i.configure(c));return a&&l.push(f.data.of({autocomplete:zAe})),new kn(f,l)}function zAe(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=bt(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:BAe(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var MF=null;function BAe(){if(MF)return MF;let e=rF(new oee(Sn.create({extensions:AF}),0,!0));return MF=e?e.options:[]}var VAe=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,NF=Ht.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!vF.isActiveAt(t.state,n.from,1)))return!1;let i=bt(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||VAe.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),a?!1:(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}}),PF=63,FF=64,HAe=1,UAe=2,IF=3,WAe=4,LF=5,GAe=6,KAe=7,RF=65,qAe=66,JAe=8,YAe=9,XAe=10,ZAe=11,QAe=12,zF=13,$Ae=19,eje=20,tje=29,nje=33,rje=34,ije=47,aje=0,BF=1,VF=2,HF=3,UF=4,WF=class{constructor(e,t,n){this.parent=e,this.depth=t,this.type=n,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+n}};WF.top=new WF(null,-1,aje);function GF(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let t=e.peek(r);if(qF(t)||t==-1)return n}}function KF(e){return e==32||e==9}function qF(e){return e==10||e==13}function JF(e){return KF(e)||qF(e)}function YF(e){return e<0||JF(e)}var oje=new On({start:WF.top,reduce(e,t){return e.type==HF&&(t==eje||t==rje)?e.parent:e},shift(e,t,n,r){if(t==IF)return new WF(e,GF(r,r.pos),BF);if(t==RF||t==LF)return new WF(e,GF(r,r.pos),VF);if(t==PF)return e.parent;if(t==$Ae||t==nje)return new WF(e,0,HF);if(t==zF&&e.type==UF)return e.parent;if(t==ije){let t=/[1-9]/.exec(r.read(r.pos,n.pos));if(t)return new WF(e,e.depth+ +t[0],UF)}return e},hash(e){return e.hash}});function XF(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&YF(e.peek(n+3))}var sje=new vn((e,t)=>{if(e.next==-1&&t.canShift(FF))return e.acceptToken(FF);let n=e.peek(-1);if((qF(n)||n<0)&&t.context.type!=HF){if(XF(e,45))if(t.canShift(PF))e.acceptToken(PF);else return e.acceptToken(HAe,3);if(XF(e,46))if(t.canShift(PF))e.acceptToken(PF);else return e.acceptToken(UAe,3);let n=0;for(;e.next==32;)n++,e.advance();(n<t.context.depth||n==t.context.depth&&t.context.type==BF&&(e.next!=45||!YF(e.peek(1))))&&e.next!=-1&&!qF(e.next)&&e.next!=35&&e.acceptToken(PF,-n)}},{contextual:!0}),cje=new vn((e,t)=>{if(t.context.type==HF){e.next==63&&(e.advance(),YF(e.next)&&e.acceptToken(KAe));return}if(e.next==45)e.advance(),YF(e.next)&&e.acceptToken(t.context.type==BF&&t.context.depth==GF(e,e.pos-1)?WAe:IF);else if(e.next==63)e.advance(),YF(e.next)&&e.acceptToken(t.context.type==VF&&t.context.depth==GF(e,e.pos-1)?GAe:LF);else{let n=e.pos;for(;;)if(KF(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)$F(e);else if(e.next==38)eI(e);else if(e.next==42){eI(e);break}else if(e.next==39||e.next==34){if(tI(e,!0))break;return}else if(e.next==91||e.next==123){if(!uje(e))return;break}else{fje(e,!0,!1,0);break}for(;KF(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(tje))return;YF(e.peek(1))&&e.acceptTokenTo(t.context.type==VF&&t.context.depth==GF(e,n)?qAe:RF,n)}}},{contextual:!0});function lje(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function ZF(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function QF(e,t){return e.next==37?(e.advance(),ZF(e.next)&&e.advance(),ZF(e.next)&&e.advance(),!0):lje(e.next)||t&&e.next==44?(e.advance(),!0):!1}function $F(e){if(e.advance(),e.next==60){for(e.advance();;)if(!QF(e,!0)){e.next==62&&e.advance();break}}else for(;QF(e,!1););}function eI(e){for(e.advance();!YF(e.next)&&nI(e.tag)!=`f`;)e.advance()}function tI(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==n)if(a==39)if(e.next==39)e.advance();else break;else break;else if(a==92&&n==34)e.next>=0&&e.advance();else if(qF(a)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function uje(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!tI(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else if(e.next<0||e.pos>n||qF(e.next))return!1;else e.advance()}var dje=`iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif`;function nI(e){return e<33?`u`:e>125?`s`:dje[e-33]}function rI(e,t){let n=nI(e);return n!=`u`&&!(t&&n==`f`)}function fje(e,t,n,r){if(nI(e.next)==`s`||(e.next==63||e.next==58||e.next==45)&&rI(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let a=e.next,o=0,s=r+1;for(;JF(a);){if(qF(a)){if(t)return!1;s=0}else s++;a=e.peek(++o)}if(!(a>=0&&(a==58?rI(e.peek(o+1),n):a==35?e.peek(o-1)!=32:rI(a,n)))||!n&&s<=r||s==0&&!n&&(XF(e,45,o)||XF(e,46,o)))break;if(t&&nI(a)==`f`)return!1;for(let t=o;t>=0;t--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}var pje=new vn((e,t)=>{if(e.next==33)$F(e),e.acceptToken(QAe);else if(e.next==38||e.next==42){let t=e.next==38?XAe:ZAe;eI(e),e.acceptToken(t)}else e.next==39||e.next==34?(tI(e,!1),e.acceptToken(YAe)):fje(e,!1,t.context.type==HF,t.context.depth)&&e.acceptToken(JAe)}),mje=new vn((e,t)=>{let n=t.context.type==UF?t.context.depth:-1,r=e.pos;scan:for(;;){let i=0,a=e.next;for(;a==32;)a=e.peek(++i);if(!i&&(XF(e,45,i)||XF(e,46,i))||!qF(a)&&(n<0&&(n=Math.max(t.context.depth+1,i)),i<n))break;for(;;){if(e.next<0)break scan;let t=qF(e.next);if(e.advance(),t)continue scan;r=e.pos}}e.acceptTokenTo(zF,r)}),hje=Dt({DirectiveName:U.keyword,DirectiveContent:U.attributeValue,"DirectiveEnd DocEnd":U.meta,QuotedLiteral:U.string,BlockLiteralHeader:U.special(U.string),BlockLiteralContent:U.content,Literal:U.content,"Key/Literal Key/QuotedLiteral":U.definition(U.propertyName),"Anchor Alias":U.labelName,Tag:U.typeName,Comment:U.lineComment,": , -":U.separator,"?":U.punctuation,"[ ]":U.squareBracket,"{ }":U.brace}),gje=wn.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:`⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document`,maxTerm:74,context:oje,nodeProps:[[`isolate`,-3,8,9,14,``],[`openedBy`,18,`[`,32,`{`],[`closedBy`,19,`]`,33,`}`]],propSources:[hje],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[sje,cje,pje,mje,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),_je=wn.deserialize({version:14,states:"!vOQOPOOO]OPO'#C_OhOPO'#C^OOOO'#Cc'#CcOpOPO'#CaQOOOOOO{OPOOOOOO'#Cb'#CbO!WOPO'#C`O!`OPO,58xOOOO-E6a-E6aOOOO-E6`-E6`OOOO'#C_'#C_OOOO1G.d1G.d",stateData:`!h~OXPOYROWTP~OWVXXRXYRX~OYVOXSP~OXROYROWTX~OXROYROWTP~OYVOXSX~OX[O~OXY~`,goto:`vWPPX[beioRUOQQOR]XRXQTTOUQWQRZWSSOURYS`,nodeNames:`⚠ Document Frontmatter DashLine FrontmatterContent Body`,maxTerm:10,skippedNodes:[0],repeatNodeCount:2,tokenData:"$z~RXOYnYZ!^Z]n]^!^^}n}!O!i!O;'Sn;'S;=`!c<%lOn~qXOYnYZ!^Z]n]^!^^;'Sn;'S;=`!c<%l~n~On~~!^~!cOY~~!fP;=`<%ln~!lZOYnYZ!^Z]n]^!^^}n}!O#_!O;'Sn;'S;=`!c<%l~n~On~~!^~#bZOYnYZ!^Z]n]^!^^}n}!O$T!O;'Sn;'S;=`!c<%l~n~On~~!^~$WXOYnYZ$sZ]n]^$s^;'Sn;'S;=`!c<%l~n~On~~$s~$zOX~Y~",tokenizers:[0],topRules:{Document:[0,1]},tokenPrec:67}),vje=En.define({name:`yaml`,parser:gje.configure({props:[gt.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name==`BlockLiteralContent`&&t.from<t.to)return e.baseIndentFor(t);if(t.name==`BlockLiteral`)return e.baseIndentFor(t)+e.unit;if(t.name==`BlockSequence`||t.name==`BlockMapping`)return e.column(t.from,1);if(t.name==`QuotedLiteral`)return null;if(t.name==`Literal`){let n=e.column(t.from,1);if(n==e.lineIndent(t.from,1))return n;if(t.to>e.pos)return null}}return null},FlowMapping:jn({closing:`}`}),FlowSequence:jn({closing:`]`})}),mt.add({"FlowMapping FlowSequence":Fn,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:`#`},indentOnInput:/^\s*[\]\}]$/}});function yje(){return new kn(vje)}En.define({name:`yaml-frontmatter`,parser:_je.configure({props:[Dt({DashLine:U.meta})]})});function Z(e){return new kn(rn.define(e))}function iI(e){return l(()=>import(`./dist-DBzjiykV.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([12,13,14]))}var bje=[W.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return l(()=>import(`./dist-CaejG1dm.js`).then(e=>e.cpp()),__vite__mapDeps([15,14]))}}),W.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return l(()=>import(`./dist-CaejG1dm.js`).then(e=>e.cpp()),__vite__mapDeps([15,14]))}}),W.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return iI(`Cassandra`)}}),W.of({name:`CSS`,extensions:[`css`],load(){return l(()=>import(`./dist-DT99Gaya.js`).then(e=>e.css()),__vite__mapDeps([16,14]))}}),W.of({name:`Go`,extensions:[`go`],load(){return l(()=>import(`./dist-jDblB_T7.js`).then(e=>e.go()),__vite__mapDeps([17,13,14]))}}),W.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return l(()=>import(`./dist-DKpbXO9V.js`).then(e=>e.html()),__vite__mapDeps([18,19,2,13,14]))}}),W.of({name:`Java`,extensions:[`java`],load(){return l(()=>import(`./dist-DtDYJdOe.js`).then(e=>e.java()),__vite__mapDeps([20,14]))}}),W.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return l(()=>import(`./dist-v0p4Oxur.js`).then(e=>e.jinja()),__vite__mapDeps([21,19,2,13,14]))}}),W.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return l(()=>import(`./dist-DroIyWBO.js`).then(e=>e.json()),__vite__mapDeps([22,14]))}}),W.of({name:`JSX`,extensions:[`jsx`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`LESS`,extensions:[`less`],load(){return l(()=>import(`./dist-BhkpGj11.js`).then(e=>e.less()),__vite__mapDeps([23,14]))}}),W.of({name:`Liquid`,extensions:[`liquid`],load(){return l(()=>import(`./dist-CKjYpdph.js`).then(e=>e.liquid()),__vite__mapDeps([24,19,2,13,14]))}}),W.of({name:`MariaDB SQL`,load(){return iI(`MariaSQL`)}}),W.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return l(()=>import(`./dist-DSyaj1iO.js`).then(e=>e.markdown()),__vite__mapDeps([25,19,2,13,14]))}}),W.of({name:`MS SQL`,load(){return iI(`MSSQL`)}}),W.of({name:`MySQL`,load(){return iI(`MySQL`)}}),W.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return l(()=>import(`./dist-BzodlTBW.js`).then(e=>e.php()),__vite__mapDeps([26,19,2,13,14]))}}),W.of({name:`PLSQL`,extensions:[`pls`],load(){return iI(`PLSQL`)}}),W.of({name:`PostgreSQL`,load(){return iI(`PostgreSQL`)}}),W.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return l(()=>import(`./dist-YdUjCFVN.js`).then(e=>e.python()),__vite__mapDeps([27,13,14]))}}),W.of({name:`Rust`,extensions:[`rs`],load(){return l(()=>import(`./dist-D65w4-0d.js`).then(e=>e.rust()),__vite__mapDeps([28,14]))}}),W.of({name:`Sass`,extensions:[`sass`],load(){return l(()=>import(`./dist--fdiDhsa.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([29,14]))}}),W.of({name:`SCSS`,extensions:[`scss`],load(){return l(()=>import(`./dist--fdiDhsa.js`).then(e=>e.sass()),__vite__mapDeps([29,14]))}}),W.of({name:`SQL`,extensions:[`sql`],load(){return iI(`StandardSQL`)}}),W.of({name:`SQLite`,load(){return iI(`SQLite`)}}),W.of({name:`TSX`,extensions:[`tsx`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return l(()=>import(`./dist-Ct1D1r3D.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([19,2,13,14]))}}),W.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return l(()=>import(`./dist-CaORa3GR.js`).then(e=>e.wast()),__vite__mapDeps([30,14]))}}),W.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return l(()=>import(`./dist-lNuHRy_r.js`).then(e=>e.xml()),__vite__mapDeps([31,14]))}}),W.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return l(()=>import(`./dist-D_hpFHgB.js`).then(e=>e.yaml()),__vite__mapDeps([32,14]))}}),W.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return l(()=>import(`./apl-C5q1JUQ9.js`).then(e=>Z(e.apl)),[])}}),W.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return l(()=>import(`./asciiarmor-BILZohWd.js`).then(e=>Z(e.asciiArmor)),[])}}),W.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return l(()=>import(`./asn1-DI_FTWHM.js`).then(e=>Z(e.asn1({}))),[])}}),W.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return l(()=>import(`./asterisk-CoYCo1jb.js`).then(e=>Z(e.asterisk)),[])}}),W.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return l(()=>import(`./brainfuck-CYletLv0.js`).then(e=>Z(e.brainfuck)),[])}}),W.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return l(()=>import(`./cobol-Bp7hDZyh.js`).then(e=>Z(e.cobol)),[])}}),W.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.csharp)),[])}}),W.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`ClojureScript`,extensions:[`cljs`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return l(()=>import(`./css-DOOfdS_P.js`).then(e=>Z(e.gss)),[])}}),W.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return l(()=>import(`./cmake-Jt1LPs3Y.js`).then(e=>Z(e.cmake)),[])}}),W.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return l(()=>import(`./coffeescript-CAuf1hwk.js`).then(e=>Z(e.coffeeScript)),[])}}),W.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return l(()=>import(`./commonlisp-CTI5EoKD.js`).then(e=>Z(e.commonLisp)),[])}}),W.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return l(()=>import(`./cypher-D3PQ91Qx.js`).then(e=>Z(e.cypher)),[])}}),W.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return l(()=>import(`./python-DJuj1ZhC.js`).then(e=>Z(e.cython)),[])}}),W.of({name:`Crystal`,extensions:[`cr`],load(){return l(()=>import(`./crystal-C3-bEPdz.js`).then(e=>Z(e.crystal)),[])}}),W.of({name:`D`,extensions:[`d`],load(){return l(()=>import(`./d-Czsz-1nb.js`).then(e=>Z(e.d)),[])}}),W.of({name:`Dart`,extensions:[`dart`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.dart)),[])}}),W.of({name:`diff`,extensions:[`diff`,`patch`],load(){return l(()=>import(`./diff-DTEjW6Ec.js`).then(e=>Z(e.diff)),[])}}),W.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return l(()=>import(`./dockerfile-B9WyxmEu.js`).then(e=>Z(e.dockerFile)),__vite__mapDeps([33,34]))}}),W.of({name:`DTD`,extensions:[`dtd`],load(){return l(()=>import(`./dtd-DQ2nGp1I.js`).then(e=>Z(e.dtd)),[])}}),W.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return l(()=>import(`./dylan-Bje9X1q4.js`).then(e=>Z(e.dylan)),[])}}),W.of({name:`EBNF`,load(){return l(()=>import(`./ebnf-DEiu6Mj6.js`).then(e=>Z(e.ebnf)),[])}}),W.of({name:`ECL`,extensions:[`ecl`],load(){return l(()=>import(`./ecl-CcozsAMR.js`).then(e=>Z(e.ecl)),[])}}),W.of({name:`edn`,extensions:[`edn`],load(){return l(()=>import(`./clojure-BTMF0bWr.js`).then(e=>Z(e.clojure)),[])}}),W.of({name:`Eiffel`,extensions:[`e`],load(){return l(()=>import(`./eiffel-CZRTum_1.js`).then(e=>Z(e.eiffel)),[])}}),W.of({name:`Elm`,extensions:[`elm`],load(){return l(()=>import(`./elm-Cgd7AVBx.js`).then(e=>Z(e.elm)),[])}}),W.of({name:`Erlang`,extensions:[`erl`],load(){return l(()=>import(`./erlang-BPW5ALQf.js`).then(e=>Z(e.erlang)),[])}}),W.of({name:`Esper`,load(){return l(()=>import(`./sql-C34SerfO.js`).then(e=>Z(e.esper)),[])}}),W.of({name:`Factor`,extensions:[`factor`],load(){return l(()=>import(`./factor-DRSLM7tp.js`).then(e=>Z(e.factor)),__vite__mapDeps([35,34]))}}),W.of({name:`FCL`,load(){return l(()=>import(`./fcl-Bv0H-MfR.js`).then(e=>Z(e.fcl)),[])}}),W.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return l(()=>import(`./forth-CFHh7lFN.js`).then(e=>Z(e.forth)),[])}}),W.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return l(()=>import(`./fortran-CAaqh7IE.js`).then(e=>Z(e.fortran)),[])}}),W.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.fSharp)),[])}}),W.of({name:`Gas`,extensions:[`s`],load(){return l(()=>import(`./gas-BXzla7cs.js`).then(e=>Z(e.gas)),[])}}),W.of({name:`Gherkin`,extensions:[`feature`],load(){return l(()=>import(`./gherkin-CjaNPZBr.js`).then(e=>Z(e.gherkin)),[])}}),W.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return l(()=>import(`./groovy-CQ51TE23.js`).then(e=>Z(e.groovy)),[])}}),W.of({name:`Haskell`,extensions:[`hs`],load(){return l(()=>import(`./haskell-BdLQbrXE.js`).then(e=>Z(e.haskell)),[])}}),W.of({name:`Haxe`,extensions:[`hx`],load(){return l(()=>import(`./haxe-BR_oGt5J.js`).then(e=>Z(e.haxe)),[])}}),W.of({name:`HXML`,extensions:[`hxml`],load(){return l(()=>import(`./haxe-BR_oGt5J.js`).then(e=>Z(e.hxml)),[])}}),W.of({name:`HTTP`,load(){return l(()=>import(`./http-D4AikK5M.js`).then(e=>Z(e.http)),[])}}),W.of({name:`IDL`,extensions:[`pro`],load(){return l(()=>import(`./idl-BhLYYWfC.js`).then(e=>Z(e.idl)),[])}}),W.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return l(()=>import(`./javascript-DoCiwYd8.js`).then(e=>Z(e.jsonld)),[])}}),W.of({name:`Julia`,extensions:[`jl`],load(){return l(()=>import(`./julia-TGuXb-4v.js`).then(e=>Z(e.julia)),[])}}),W.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.kotlin)),[])}}),W.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return l(()=>import(`./livescript-C-wu00Ej.js`).then(e=>Z(e.liveScript)),[])}}),W.of({name:`Lua`,extensions:[`lua`],load(){return l(()=>import(`./lua-CGv6iOiJ.js`).then(e=>Z(e.lua)),[])}}),W.of({name:`mIRC`,extensions:[`mrc`],load(){return l(()=>import(`./mirc-Dhg1_lkg.js`).then(e=>Z(e.mirc)),[])}}),W.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return l(()=>import(`./mathematica-C8bAvxin.js`).then(e=>Z(e.mathematica)),[])}}),W.of({name:`Modelica`,extensions:[`mo`],load(){return l(()=>import(`./modelica-CcMbWJDy.js`).then(e=>Z(e.modelica)),[])}}),W.of({name:`MUMPS`,extensions:[`mps`],load(){return l(()=>import(`./mumps-BJZx4oNt.js`).then(e=>Z(e.mumps)),[])}}),W.of({name:`Mbox`,extensions:[`mbox`],load(){return l(()=>import(`./mbox-BYumpJj6.js`).then(e=>Z(e.mbox)),[])}}),W.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return l(()=>import(`./nginx-PPx_WycM.js`).then(e=>Z(e.nginx)),[])}}),W.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return l(()=>import(`./nsis-BOISW3t0.js`).then(e=>Z(e.nsis)),__vite__mapDeps([36,34]))}}),W.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return l(()=>import(`./ntriples--kmqf5za.js`).then(e=>Z(e.ntriples)),[])}}),W.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.objectiveC)),[])}}),W.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.objectiveCpp)),[])}}),W.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.oCaml)),[])}}),W.of({name:`Octave`,extensions:[`m`],load(){return l(()=>import(`./octave-CAcJQTlE.js`).then(e=>Z(e.octave)),[])}}),W.of({name:`Oz`,extensions:[`oz`],load(){return l(()=>import(`./oz-ARD1A4_T.js`).then(e=>Z(e.oz)),[])}}),W.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return l(()=>import(`./pascal-DK7Ai13I.js`).then(e=>Z(e.pascal)),[])}}),W.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return l(()=>import(`./perl-C687o_bL.js`).then(e=>Z(e.perl)),[])}}),W.of({name:`Pig`,extensions:[`pig`],load(){return l(()=>import(`./pig-C8e4kEQV.js`).then(e=>Z(e.pig)),[])}}),W.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return l(()=>import(`./powershell-C2Y_oyRr.js`).then(e=>Z(e.powerShell)),[])}}),W.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return l(()=>import(`./properties-DmYRuvnA.js`).then(e=>Z(e.properties)),[])}}),W.of({name:`ProtoBuf`,extensions:[`proto`],load(){return l(()=>import(`./protobuf-CD6bEuFl.js`).then(e=>Z(e.protobuf)),[])}}),W.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return l(()=>import(`./pug-RUWq2f7J.js`).then(e=>Z(e.pug)),__vite__mapDeps([37,38]))}}),W.of({name:`Puppet`,extensions:[`pp`],load(){return l(()=>import(`./puppet-CsErpTW6.js`).then(e=>Z(e.puppet)),[])}}),W.of({name:`Q`,extensions:[`q`],load(){return l(()=>import(`./q-DKzQvbt-.js`).then(e=>Z(e.q)),[])}}),W.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return l(()=>import(`./r-DUDpJ6Ff.js`).then(e=>Z(e.r)),[])}}),W.of({name:`RPM Changes`,load(){return l(()=>import(`./rpm-qoLWOnFN.js`).then(e=>Z(e.rpmChanges)),[])}}),W.of({name:`RPM Spec`,extensions:[`spec`],load(){return l(()=>import(`./rpm-qoLWOnFN.js`).then(e=>Z(e.rpmSpec)),[])}}),W.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return l(()=>import(`./ruby-FGrV8nFX.js`).then(e=>Z(e.ruby)),[])}}),W.of({name:`SAS`,extensions:[`sas`],load(){return l(()=>import(`./sas-BWqJ1mab.js`).then(e=>Z(e.sas)),[])}}),W.of({name:`Scala`,extensions:[`scala`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.scala)),[])}}),W.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return l(()=>import(`./scheme-D9O3un-H.js`).then(e=>Z(e.scheme)),[])}}),W.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return l(()=>import(`./shell-B1pKmMgB.js`).then(e=>Z(e.shell)),[])}}),W.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return l(()=>import(`./sieve-D6RnHXa8.js`).then(e=>Z(e.sieve)),[])}}),W.of({name:`Smalltalk`,extensions:[`st`],load(){return l(()=>import(`./smalltalk-Bg8P7Hpz.js`).then(e=>Z(e.smalltalk)),[])}}),W.of({name:`Solr`,load(){return l(()=>import(`./solr-DCTMbxYh.js`).then(e=>Z(e.solr)),[])}}),W.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return l(()=>import(`./mllike-DekHTKRS.js`).then(e=>Z(e.sml)),[])}}),W.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return l(()=>import(`./sparql-D3342bJj.js`).then(e=>Z(e.sparql)),[])}}),W.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return l(()=>import(`./spreadsheet-D5vgGBWN.js`).then(e=>Z(e.spreadsheet)),[])}}),W.of({name:`Squirrel`,extensions:[`nut`],load(){return l(()=>import(`./clike-BJQXzji6.js`).then(e=>Z(e.squirrel)),[])}}),W.of({name:`Stylus`,extensions:[`styl`],load(){return l(()=>import(`./stylus-uKe9pX_z.js`).then(e=>Z(e.stylus)),[])}}),W.of({name:`Swift`,extensions:[`swift`],load(){return l(()=>import(`./swift-BwGtfoET.js`).then(e=>Z(e.swift)),[])}}),W.of({name:`sTeX`,load(){return l(()=>import(`./stex-CIr7vrJc.js`).then(e=>Z(e.stex)),[])}}),W.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return l(()=>import(`./stex-CIr7vrJc.js`).then(e=>Z(e.stex)),[])}}),W.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return l(()=>import(`./verilog-T4dM3A9w.js`).then(e=>Z(e.verilog)),[])}}),W.of({name:`Tcl`,extensions:[`tcl`],load(){return l(()=>import(`./tcl-CJ_CtVRZ.js`).then(e=>Z(e.tcl)),[])}}),W.of({name:`Textile`,extensions:[`textile`],load(){return l(()=>import(`./textile-BwILayi5.js`).then(e=>Z(e.textile)),[])}}),W.of({name:`TiddlyWiki`,load(){return l(()=>import(`./tiddlywiki-CBwaBkZo.js`).then(e=>Z(e.tiddlyWiki)),[])}}),W.of({name:`Tiki wiki`,load(){return l(()=>import(`./tiki-DrYLgX3z.js`).then(e=>Z(e.tiki)),[])}}),W.of({name:`TOML`,extensions:[`toml`],load(){return l(()=>import(`./toml-B15mRAoh.js`).then(e=>Z(e.toml)),[])}}),W.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return l(()=>import(`./troff-1GwZ4_kM.js`).then(e=>Z(e.troff)),[])}}),W.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return l(()=>import(`./ttcn-Rt4tcn5J.js`).then(e=>Z(e.ttcn)),[])}}),W.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return l(()=>import(`./ttcn-cfg-B2QycmWC.js`).then(e=>Z(e.ttcnCfg)),[])}}),W.of({name:`Turtle`,extensions:[`ttl`],load(){return l(()=>import(`./turtle-B99g2iYO.js`).then(e=>Z(e.turtle)),[])}}),W.of({name:`Web IDL`,extensions:[`webidl`],load(){return l(()=>import(`./webidl-BMlkVTYq.js`).then(e=>Z(e.webIDL)),[])}}),W.of({name:`VB.NET`,extensions:[`vb`],load(){return l(()=>import(`./vb-BNGsVLgX.js`).then(e=>Z(e.vb)),[])}}),W.of({name:`VBScript`,extensions:[`vbs`],load(){return l(()=>import(`./vbscript-C3L-Slq1.js`).then(e=>Z(e.vbScript)),[])}}),W.of({name:`Velocity`,extensions:[`vtl`],load(){return l(()=>import(`./velocity-B5fLEzdR.js`).then(e=>Z(e.velocity)),[])}}),W.of({name:`Verilog`,extensions:[`v`],load(){return l(()=>import(`./verilog-T4dM3A9w.js`).then(e=>Z(e.verilog)),[])}}),W.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return l(()=>import(`./vhdl-Bdbtaye2.js`).then(e=>Z(e.vhdl)),[])}}),W.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return l(()=>import(`./xquery-BHRymSKf.js`).then(e=>Z(e.xQuery)),[])}}),W.of({name:`Yacas`,extensions:[`ys`],load(){return l(()=>import(`./yacas-B2Ltfl3H.js`).then(e=>Z(e.yacas)),[])}}),W.of({name:`Z80`,extensions:[`z80`],load(){return l(()=>import(`./z80-DJxBw9IF.js`).then(e=>Z(e.z80)),[])}}),W.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.mscgen)),[])}}),W.of({name:`Xù`,extensions:[`xu`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.xu)),[])}}),W.of({name:`MsGenny`,extensions:[`msgenny`],load(){return l(()=>import(`./mscgen-D26dCiP0.js`).then(e=>Z(e.msgenny)),[])}}),W.of({name:`Vue`,extensions:[`vue`],load(){return l(()=>import(`./dist-56Ibj2m1.js`).then(e=>e.vue()),__vite__mapDeps([39,19,2,13,14]))}}),W.of({name:`Angular Template`,load(){return l(()=>import(`./dist-KjL9POKA.js`).then(e=>e.angular()),__vite__mapDeps([40,19,2,13,14]))}})],aI={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},xje={borderLeftWidth:`2px`},oI={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},sI={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},cI={border:`none`,borderRadius:`4px`,padding:`2px 10px`},Sje={borderRadius:`2px`},lI={borderRadius:`2px`},uI={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},dI={width:`12px`,height:`12px`,borderRadius:`6px`},fI={borderRadius:`4px`,padding:`2px 6px`},pI={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},mI=`#0d1117`,hI=`#c9d1d9`,Cje=`#264F78`,gI=`#8b949e`,_I=`#ffffff`,vI=`#7ee787`,yI=`#d2a8ff`,bI=`#79c0ff`,xI=`#ff7b72`,SI=`#a5d6ff`,wje=`#2c333a`,Tje=`#3c444d`,CI=`#ffab70`,wI=`#161b22`,TI=`#30363d`,Eje=`#21262d`,EI=`#f97583`,Dje=`#2d333b1a`,DI=`#21262d`,OI=_I,Oje=Cje,kje=`#3a587a75`,Aje=`#4d90fe`,jje=`#d29922`,Mje=`#3a587a55`,kI=`#58a6ff`,Nje=`#bc8cff`,Pje=`#2ea04350`,Fje=`#f8514940`,AI=`#7ee787`,jI=`#ff7b72`,Ije=[Ht.theme({"&":{color:hI,backgroundColor:mI,fontSize:aI.fontSize,fontFamily:aI.fontFamily},".cm-content":{caretColor:OI,lineHeight:aI.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:OI,borderLeftWidth:xje.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${OI}99`,color:mI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Oje},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#3a587a`,outline:`1px solid ${bI}`,color:hI,borderRadius:fI.borderRadius,"& span":{color:hI}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Aje,color:_I,padding:fI.padding,"& span":{color:_I}},".cm-search.cm-panel.cm-textfield":{color:hI,borderRadius:fI.borderRadius,padding:fI.padding},".cm-panels":{backgroundColor:DI,color:hI,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${TI}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${TI}`},".cm-panel button":{backgroundColor:DI,color:hI,border:cI.border,borderRadius:cI.borderRadius,padding:cI.padding},".cm-panel button:hover":{backgroundColor:wje},".cm-activeLine":{backgroundColor:Dje,borderRadius:Sje.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:wI,color:gI,border:sI.border,borderRight:`1px solid #30363d`,paddingRight:sI.paddingRight},".cm-activeLineGutter":{backgroundColor:Eje,color:hI,fontWeight:sI.fontWeight},".cm-lineNumbers":{fontSize:sI.fontSize,lineHeight:sI.lineHeight},".cm-foldGutter":{fontSize:sI.fontSize,lineHeight:sI.lineHeight},".cm-foldGutter .cm-gutterElement":{color:gI,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:hI},".cm-insertedLine":{textDecoration:oI.insertedTextDecoration,backgroundColor:Pje,color:AI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:oI.insertedTextDecoration,backgroundColor:`${Pje} !important`,color:AI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious,border:`1px solid ${AI}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:oI.deletedTextDecoration,backgroundColor:Fje,color:jI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:oI.deletedTextDecoration,backgroundColor:`${Fje} !important`,color:jI,padding:oI.insertedLinePadding,borderRadius:oI.borderRadious,border:`1px solid ${jI}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:DI,border:`1px solid ${TI}`,borderRadius:pI.borderRadius,padding:pI.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:DI,border:`none`},"& > ul > li":{padding:pI.padding,lineHeight:pI.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Oje,color:_I,borderRadius:pI.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:gI,paddingRight:pI.paddingRight},"& > ul > li > span.cm-completionDetail":{color:gI,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:DI,borderBottomColor:DI},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${EI}`},"&-warning":{borderLeft:`3px solid ${jje}`},"&-info":{borderLeft:`3px solid ${kI}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${EI}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${jje}`},".cm-matchingBracket":{backgroundColor:kje,outline:`1px solid ${Aje}`,borderRadius:lI.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#f9758340`,outline:`1px solid ${EI}`,borderRadius:lI.borderRadius},".cm-selectionMatch":{backgroundColor:Mje,outline:`1px solid ${Cje}50`,borderRadius:lI.borderRadius},".cm-foldPlaceholder":{backgroundColor:DI,color:gI,border:`1px dotted ${TI}70`,borderRadius:uI.borderRadius,padding:uI.padding,margin:uI.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${mI}, 0 0 0 3px ${kI}40`},"& .cm-scroller::-webkit-scrollbar":{width:dI.width,height:dI.height},"& .cm-scroller::-webkit-scrollbar-track":{background:wI},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:TI,borderRadius:dI.borderRadius,border:`3px solid ${wI}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:Tje},".cm-ghostText":{opacity:`0.5`,color:gI}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:xI,fontWeight:`bold`},{tag:U.controlKeyword,color:xI,fontWeight:`bold`},{tag:U.moduleKeyword,color:xI,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:bI},{tag:[U.variableName],color:bI},{tag:[U.propertyName],color:yI,fontStyle:`normal`},{tag:[U.typeName],color:xI},{tag:[U.className],color:yI,fontStyle:`italic`},{tag:[U.namespace],color:bI,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:hI},{tag:[U.bracket],color:gI},{tag:[U.brace],color:gI},{tag:[U.punctuation],color:gI},{tag:[U.function(U.variableName),U.labelName],color:vI},{tag:[U.definition(U.variableName)],color:bI},{tag:U.number,color:CI},{tag:U.changed,color:CI},{tag:U.annotation,color:EI,fontStyle:`italic`},{tag:U.modifier,color:CI,fontStyle:`italic`},{tag:U.self,color:CI},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:CI},{tag:[U.atom,U.bool,U.special(U.variableName)],color:CI},{tag:[U.processingInstruction,U.inserted],color:vI},{tag:[U.special(U.string),U.regexp],color:SI},{tag:U.string,color:SI},{tag:U.definition(U.typeName),color:xI,fontWeight:`bold`},{tag:U.meta,color:gI},{tag:U.comment,fontStyle:`italic`,color:gI},{tag:U.docComment,fontStyle:`italic`,color:gI},{tag:[U.tagName],color:vI},{tag:[U.attributeName],color:yI},{tag:[U.heading],fontWeight:`bold`,color:bI},{tag:[U.strong],fontWeight:`bold`,color:bI},{tag:[U.emphasis],fontStyle:`italic`,color:SI},{tag:[U.link],color:Nje,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:kI,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:hI,textDecoration:`underline wavy`,borderBottom:`1px wavy ${EI}`},{tag:[U.strikethrough],color:EI,textDecoration:`line-through`},{tag:U.constant(U.name),color:CI},{tag:U.deleted,color:EI},{tag:U.squareBracket,color:gI},{tag:U.angleBracket,color:gI},{tag:U.monospace,color:hI},{tag:[U.contentSeparator],color:bI},{tag:U.quote,color:gI}]))],MI={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},Lje={borderLeftWidth:`2px`},NI={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},PI={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},FI={border:`none`,borderRadius:`4px`,padding:`2px 10px`},Rje={borderRadius:`2px`},II={borderRadius:`2px`},LI={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},RI={width:`12px`,height:`12px`,borderRadius:`6px`},zI={borderRadius:`4px`,padding:`2px 6px`},BI={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},VI=`#ffffff`,HI=`#24292e`,zje=`#BBDFFF`,UI=`#6e7781`,Bje=`#f6f8fa`,Vje=`#116329`,WI=`#6a737d`,GI=`#6f42c1`,KI=`#005cc5`,qI=`#d73a49`,JI=`#032f62`,Hje=`#22863a`,YI=`#e36209`,Uje=`#f1f8ff`,XI=`#e1e4e8`,Wje=`#f8f9fa`,ZI=`#cb2431`,Gje=`#BBDFFF20`,QI=Wje,$I=HI,Kje=zje,qje=`#e8f0fe`,Jje=`#0366d6`,Yje=`#b08800`,Xje=`#79b8ff40`,eL=`#0969da`,Zje=`#8250df`,Qje=`#e6ffec80`,$je=`#ffebe980`,tL=`#0f6d31`,nL=`#cf222e`,rL=[Ht.theme({"&":{color:HI,backgroundColor:VI,fontSize:MI.fontSize,fontFamily:MI.fontFamily},".cm-content":{caretColor:$I,lineHeight:MI.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:$I,borderLeftWidth:Lje.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${$I}99`,color:VI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Kje,color:HI},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#daebff`,outline:`1px solid ${KI}`,color:HI,borderRadius:zI.borderRadius,"& span":{color:HI}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#79b8ff`,color:VI,padding:zI.padding,"& span":{color:VI}},".cm-search.cm-panel.cm-textfield":{color:HI,borderRadius:zI.borderRadius,padding:zI.padding},".cm-panels":{backgroundColor:Bje,color:UI,borderRadius:`0 0 4px 4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${XI}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${XI}`},".cm-panel button":{backgroundColor:VI,color:HI,border:FI.border,borderRadius:FI.borderRadius,padding:FI.padding},".cm-panel button:hover":{backgroundColor:`#f5f5f5`},".cm-activeLine":{backgroundColor:Gje,borderRadius:Rje.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:Bje,color:UI,border:PI.border,borderRight:`1px solid ${XI}`,paddingRight:PI.paddingRight},".cm-activeLineGutter":{backgroundColor:Uje,color:HI,fontWeight:PI.fontWeight},".cm-lineNumbers":{fontSize:PI.fontSize,lineHeight:PI.lineHeight},".cm-foldGutter":{fontSize:PI.fontSize,lineHeight:PI.lineHeight},".cm-foldGutter .cm-gutterElement":{color:UI,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:HI},".cm-insertedLine":{textDecoration:NI.insertedTextDecoration,backgroundColor:Qje,color:tL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:NI.insertedTextDecoration,backgroundColor:`${Qje} !important`,color:tL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious,border:`1px solid ${tL}30`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:NI.deletedTextDecoration,backgroundColor:$je,color:nL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:NI.deletedTextDecoration,backgroundColor:`${$je} !important`,color:nL,padding:NI.insertedLinePadding,borderRadius:NI.borderRadious,border:`1px solid ${nL}30`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:QI,border:`1px solid ${XI}`,borderRadius:BI.borderRadius,padding:BI.padding,boxShadow:`0 1px 5px rgba(0, 0, 0, 0.1)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:QI,border:`none`},"& > ul > li":{padding:BI.padding,lineHeight:BI.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#0366d630`,color:HI,borderRadius:BI.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:`#0366d615`},"& > ul > li > span.cm-completionIcon":{color:UI,paddingRight:BI.paddingRight},"& > ul > li > span.cm-completionDetail":{color:UI,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:QI,borderBottomColor:QI},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${ZI}`},"&-warning":{borderLeft:`3px solid ${Yje}`},"&-info":{borderLeft:`3px solid ${eL}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${ZI}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${Yje}`},".cm-matchingBracket":{backgroundColor:qje,outline:`1px solid ${Jje}80`,borderRadius:II.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#ffeef080`,outline:`1px solid ${ZI}`,borderRadius:II.borderRadius},".cm-selectionMatch":{backgroundColor:Xje,outline:`1px solid ${zje}50`,borderRadius:II.borderRadius},".cm-foldPlaceholder":{backgroundColor:Xje,color:UI,border:`1px dotted ${XI}70`,borderRadius:LI.borderRadius,padding:LI.padding,margin:LI.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${VI}, 0 0 0 3px ${eL}40`},"& .cm-scroller::-webkit-scrollbar":{width:RI.width,height:RI.height},"& .cm-scroller::-webkit-scrollbar-track":{background:XI},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:HI,borderRadius:RI.borderRadius,border:`3px solid ${XI}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:WI},".cm-ghostText":{opacity:`0.5`,color:`#959da5`}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:qI,fontWeight:`bold`},{tag:U.controlKeyword,color:qI,fontWeight:`bold`},{tag:U.moduleKeyword,color:qI,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:KI},{tag:[U.variableName],color:KI},{tag:[U.propertyName],color:GI,fontStyle:`normal`},{tag:[U.typeName],color:qI},{tag:[U.className],color:GI,fontStyle:`italic`},{tag:[U.namespace],color:KI,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:HI},{tag:[U.bracket],color:WI},{tag:[U.brace],color:WI},{tag:[U.punctuation],color:WI},{tag:[U.function(U.variableName),U.labelName],color:Hje},{tag:[U.definition(U.variableName)],color:KI},{tag:U.number,color:YI},{tag:U.changed,color:YI},{tag:U.annotation,color:ZI,fontStyle:`italic`},{tag:U.modifier,color:YI,fontStyle:`italic`},{tag:U.self,color:YI},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:YI},{tag:[U.atom,U.bool,U.special(U.variableName)],color:YI},{tag:[U.processingInstruction,U.inserted],color:Hje},{tag:[U.special(U.string),U.regexp],color:JI},{tag:U.string,color:JI},{tag:U.definition(U.typeName),color:qI,fontWeight:`bold`},{tag:U.meta,color:WI},{tag:U.comment,fontStyle:`italic`,color:WI},{tag:U.docComment,fontStyle:`italic`,color:WI},{tag:[U.tagName],color:Vje},{tag:[U.attributeName],color:GI},{tag:[U.heading],fontWeight:`bold`,color:KI},{tag:[U.strong],fontWeight:`bold`,color:KI},{tag:[U.emphasis],fontStyle:`italic`,color:JI},{tag:[U.link],color:Zje,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:eL,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:HI,textDecoration:`underline wavy`,borderBottom:`1px wavy ${ZI}`},{tag:[U.strikethrough],color:ZI,textDecoration:`line-through`},{tag:U.constant(U.name),color:YI},{tag:U.deleted,color:ZI},{tag:U.squareBracket,color:WI},{tag:U.angleBracket,color:WI},{tag:U.monospace,color:HI},{tag:[U.contentSeparator],color:KI},{tag:U.quote,color:WI}]))],iL={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},eMe={borderLeftWidth:`2px`},aL={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},oL={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},sL={border:`none`,borderRadius:`4px`,padding:`2px 10px`},tMe={borderRadius:`2px`},cL={borderRadius:`2px`},lL={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},uL={width:`12px`,height:`12px`,borderRadius:`6px`},dL={borderRadius:`4px`,padding:`2px 6px`},fL={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},pL=`#282828`,mL=`#3c3836`,hL=`#504945`,gL=`#665c54`,nMe=`#7c6f64`,_L=`#928374`,vL=`#fbf1c7`,yL=`#ebdbb2`,bL=`#fb4934`,xL=`#b8bb26`,SL=`#fabd2f`,CL=`#83a598`,wL=`#d3869b`,TL=`#8ec07c`,EL=`#fe8019`,DL=bL,rMe=mL,iMe=`#3c383660`,aMe=pL,OL=mL,kL=hL,oMe=`#665c5480`,AL=EL,sMe=`#504945cc`,cMe=SL,jL=SL,ML=CL,lMe=wL,NL=`#32361a80`,PL=`#3c1f1e80`,FL=`#b8bb26`,IL=`#fb4934`,uMe=[Ht.theme({"&":{color:yL,backgroundColor:aMe,fontSize:iL.fontSize,fontFamily:iL.fontFamily},".cm-content":{caretColor:AL,lineHeight:iL.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:AL,borderLeftWidth:eMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${AL}99`,color:pL},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:kL},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#b57614cc`,outline:`1px solid ${SL}`,color:vL,borderRadius:dL.borderRadius,"& span":{color:vL}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:EL,color:pL,padding:dL.padding,"& span":{color:pL}},".cm-search.cm-panel.cm-textfield":{color:yL,borderRadius:dL.borderRadius,padding:dL.padding},".cm-panels":{backgroundColor:OL,color:yL,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${gL}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${gL}`},".cm-panel button":{backgroundColor:OL,color:yL,border:sL.border,borderRadius:sL.borderRadius,padding:sL.padding},".cm-panel button:hover":{backgroundColor:hL},".cm-activeLine":{backgroundColor:iMe,borderRadius:tMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:mL,color:_L,border:oL.border,borderRight:`1px solid ${hL}`,paddingRight:oL.paddingRight},".cm-activeLineGutter":{backgroundColor:rMe,color:yL,fontWeight:oL.fontWeight},".cm-lineNumbers":{fontSize:oL.fontSize,lineHeight:oL.lineHeight},".cm-foldGutter":{fontSize:oL.fontSize,lineHeight:oL.lineHeight},".cm-foldGutter .cm-gutterElement":{color:_L,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:yL},".cm-insertedLine":{textDecoration:aL.insertedTextDecoration,backgroundColor:NL,color:FL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:aL.insertedTextDecoration,backgroundColor:`${NL} !important`,color:FL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious,border:`1px solid ${FL}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:aL.deletedTextDecoration,backgroundColor:PL,color:IL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:aL.deletedTextDecoration,backgroundColor:`${PL} !important`,color:IL,padding:aL.insertedLinePadding,borderRadius:aL.borderRadious,border:`1px solid ${IL}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:OL,border:`1px solid ${gL}`,borderRadius:fL.borderRadius,padding:fL.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:OL,border:`none`},"& > ul > li":{padding:fL.padding,lineHeight:fL.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:kL,color:vL,borderRadius:fL.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:_L,paddingRight:fL.paddingRight},"& > ul > li > span.cm-completionDetail":{color:_L,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:OL,borderBottomColor:OL},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${DL}`},"&-warning":{borderLeft:`3px solid ${jL}`},"&-info":{borderLeft:`3px solid ${ML}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${DL}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${jL}`},".cm-matchingBracket":{backgroundColor:sMe,outline:`1px solid ${cMe}`,borderRadius:cL.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#cc241d55`,outline:`1px solid ${DL}`,borderRadius:cL.borderRadius},".cm-selectionMatch":{backgroundColor:oMe,outline:`1px solid ${gL}`,borderRadius:cL.borderRadius},".cm-foldPlaceholder":{backgroundColor:OL,color:_L,border:`1px dotted ${gL}`,borderRadius:lL.borderRadius,padding:lL.padding,margin:lL.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${pL}, 0 0 0 3px ${EL}40`},"& .cm-scroller::-webkit-scrollbar":{width:uL.width,height:uL.height},"& .cm-scroller::-webkit-scrollbar-track":{background:mL},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:gL,borderRadius:uL.borderRadius,border:`3px solid ${mL}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:nMe},".cm-ghostText":{opacity:`0.5`,color:_L}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:bL,fontWeight:`bold`},{tag:U.controlKeyword,color:bL,fontWeight:`bold`},{tag:U.moduleKeyword,color:bL,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:CL},{tag:[U.variableName],color:CL},{tag:[U.propertyName],color:TL,fontStyle:`normal`},{tag:[U.typeName],color:TL},{tag:[U.className],color:SL,fontStyle:`italic`},{tag:[U.namespace],color:CL,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:yL},{tag:[U.bracket],color:_L},{tag:[U.brace],color:_L},{tag:[U.punctuation],color:_L},{tag:[U.function(U.variableName),U.labelName],color:SL},{tag:[U.definition(U.variableName)],color:CL},{tag:U.number,color:wL},{tag:U.changed,color:wL},{tag:U.annotation,color:DL,fontStyle:`italic`},{tag:U.modifier,color:wL,fontStyle:`italic`},{tag:U.self,color:wL},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:EL},{tag:[U.atom,U.bool,U.special(U.variableName)],color:EL},{tag:[U.processingInstruction,U.inserted],color:xL},{tag:[U.special(U.string),U.regexp],color:xL},{tag:U.string,color:xL},{tag:U.definition(U.typeName),color:TL,fontWeight:`bold`},{tag:U.meta,color:_L},{tag:U.comment,fontStyle:`italic`,color:_L},{tag:U.docComment,fontStyle:`italic`,color:_L},{tag:[U.tagName],color:bL},{tag:[U.attributeName],color:SL},{tag:[U.heading],fontWeight:`bold`,color:SL},{tag:[U.strong],fontWeight:`bold`,color:SL},{tag:[U.emphasis],fontStyle:`italic`,color:xL},{tag:[U.link],color:lMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:ML,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:yL,textDecoration:`underline wavy`,borderBottom:`1px wavy ${DL}`},{tag:[U.strikethrough],color:DL,textDecoration:`line-through`},{tag:U.constant(U.name),color:EL},{tag:U.deleted,color:DL},{tag:U.squareBracket,color:_L},{tag:U.angleBracket,color:_L},{tag:U.monospace,color:yL},{tag:[U.contentSeparator],color:CL},{tag:U.quote,color:_L}]))],LL={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},dMe={borderLeftWidth:`2px`},RL={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},zL={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},BL={border:`none`,borderRadius:`4px`,padding:`2px 10px`},fMe={borderRadius:`2px`},VL={borderRadius:`2px`},HL={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},UL={width:`12px`,height:`12px`,borderRadius:`6px`},WL={borderRadius:`4px`,padding:`2px 6px`},GL={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},KL=`#3c3836`,pMe=`#504945`,mMe=`#665c54`,qL=`#7c6f64`,JL=`#928374`,YL=`#fbf1c7`,XL=`#ebdbb2`,ZL=`#d5c4a1`,QL=`#bdae93`,hMe=`#a89984`,$L=`#9d0006`,eR=`#79740e`,tR=`#b57614`,nR=`#076678`,rR=`#8f3f71`,iR=`#427b58`,aR=`#af3a03`,oR=$L,gMe=XL,_Me=`#ffc42e25`,vMe=YL,sR=XL,yMe=gMe,bMe=`#ffc42e40`,cR=aR,xMe=`#d5c4a180`,SMe=aR,lR=tR,uR=nR,CMe=rR,dR=`#d8e5bc80`,fR=`#f7cfcf80`,pR=`#79740e`,mR=`#9d0006`,wMe=[Ht.theme({"&":{color:KL,backgroundColor:vMe,fontSize:LL.fontSize,fontFamily:LL.fontFamily},".cm-content":{caretColor:cR,lineHeight:LL.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:cR,borderLeftWidth:dMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${cR}99`,color:YL},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:yMe,color:KL},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#ffc42e80`,outline:`1px solid ${aR}`,color:KL,borderRadius:WL.borderRadius,"& span":{color:KL}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:aR,color:YL,padding:WL.padding,"& span":{color:YL}},".cm-search.cm-panel.cm-textfield":{color:KL,borderRadius:WL.borderRadius,padding:WL.padding},".cm-panels":{backgroundColor:XL,color:pMe,borderRadius:`0 0 4px 4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${QL}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${QL}`},".cm-panel button":{backgroundColor:YL,color:KL,border:BL.border,borderRadius:BL.borderRadius,padding:BL.padding},".cm-panel button:hover":{backgroundColor:ZL},".cm-activeLine":{backgroundColor:_Me,borderRadius:fMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:XL,color:qL,border:zL.border,borderRight:`1px solid ${QL}`,paddingRight:zL.paddingRight},".cm-activeLineGutter":{backgroundColor:ZL,color:KL,fontWeight:zL.fontWeight},".cm-lineNumbers":{fontSize:zL.fontSize,lineHeight:zL.lineHeight},".cm-foldGutter":{fontSize:zL.fontSize,lineHeight:zL.lineHeight},".cm-foldGutter .cm-gutterElement":{color:qL,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:KL},".cm-insertedLine":{textDecoration:RL.insertedTextDecoration,backgroundColor:dR,color:pR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:RL.insertedTextDecoration,backgroundColor:`${dR} !important`,color:pR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious,border:`1px solid ${pR}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:RL.deletedTextDecoration,backgroundColor:fR,color:mR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:RL.deletedTextDecoration,backgroundColor:`${fR} !important`,color:mR,padding:RL.insertedLinePadding,borderRadius:RL.borderRadious,border:`1px solid ${mR}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:sR,border:`1px solid ${QL}`,borderRadius:GL.borderRadius,padding:GL.padding,boxShadow:`0 1px 5px rgba(0, 0, 0, 0.1)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:sR,border:`none`},"& > ul > li":{padding:GL.padding,lineHeight:GL.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:aR+`30`,color:KL,borderRadius:GL.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:aR+`15`},"& > ul > li > span.cm-completionIcon":{color:qL,paddingRight:GL.paddingRight},"& > ul > li > span.cm-completionDetail":{color:qL,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:sR,borderBottomColor:sR},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${oR}`},"&-warning":{borderLeft:`3px solid ${lR}`},"&-info":{borderLeft:`3px solid ${uR}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${oR}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${lR}`},".cm-matchingBracket":{backgroundColor:xMe,outline:`1px solid ${SMe}`,borderRadius:VL.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#fb492740`,outline:`1px solid ${oR}`,borderRadius:VL.borderRadius},".cm-selectionMatch":{backgroundColor:bMe,outline:`1px solid ${QL}`,borderRadius:VL.borderRadius},".cm-foldPlaceholder":{backgroundColor:`transparent`,color:mMe,border:`1px dotted ${QL}`,borderRadius:HL.borderRadius,padding:HL.padding,margin:HL.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${YL}, 0 0 0 3px ${aR}40`},"& .cm-scroller::-webkit-scrollbar":{width:UL.width,height:UL.height},"& .cm-scroller::-webkit-scrollbar-track":{background:YL},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:QL,borderRadius:UL.borderRadius,border:`3px solid ${YL}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:hMe},".cm-ghostText":{opacity:`0.5`,color:JL}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:$L,fontWeight:`bold`},{tag:U.controlKeyword,color:$L,fontWeight:`bold`},{tag:U.moduleKeyword,color:$L,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:nR},{tag:[U.variableName],color:nR},{tag:[U.propertyName],color:iR,fontStyle:`normal`},{tag:[U.typeName],color:iR},{tag:[U.className],color:tR,fontStyle:`italic`},{tag:[U.namespace],color:nR,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:KL},{tag:[U.bracket],color:JL},{tag:[U.brace],color:JL},{tag:[U.punctuation],color:JL},{tag:[U.function(U.variableName),U.labelName],color:tR},{tag:[U.definition(U.variableName)],color:nR},{tag:U.number,color:rR},{tag:U.changed,color:rR},{tag:U.annotation,color:oR,fontStyle:`italic`},{tag:U.modifier,color:rR,fontStyle:`italic`},{tag:U.self,color:rR},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:aR},{tag:[U.atom,U.bool,U.special(U.variableName)],color:aR},{tag:[U.processingInstruction,U.inserted],color:eR},{tag:[U.special(U.string),U.regexp],color:eR},{tag:U.string,color:eR},{tag:U.definition(U.typeName),color:iR,fontWeight:`bold`},{tag:U.meta,color:JL},{tag:U.comment,fontStyle:`italic`,color:JL},{tag:U.docComment,fontStyle:`italic`,color:JL},{tag:[U.tagName],color:$L},{tag:[U.attributeName],color:tR},{tag:[U.heading],fontWeight:`bold`,color:tR},{tag:[U.strong],fontWeight:`bold`,color:tR},{tag:[U.emphasis],fontStyle:`italic`,color:eR},{tag:[U.link],color:CMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:uR,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:KL,textDecoration:`underline wavy`,borderBottom:`1px wavy ${oR}`},{tag:[U.strikethrough],color:oR,textDecoration:`line-through`},{tag:U.constant(U.name),color:aR},{tag:U.deleted,color:oR},{tag:U.squareBracket,color:JL},{tag:U.angleBracket,color:JL},{tag:U.monospace,color:KL},{tag:[U.contentSeparator],color:nR},{tag:U.quote,color:JL}]))],hR={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},TMe={borderLeftWidth:`2px`},gR={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},_R={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},vR={border:`none`,borderRadius:`4px`,padding:`2px 10px`},EMe={borderRadius:`2px`},yR={borderRadius:`2px`},bR={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},xR={width:`12px`,height:`12px`,borderRadius:`6px`},SR={borderRadius:`4px`,padding:`2px 6px`},CR={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},wR=`#212121`,TR=`#505d64`,ER=`#606f7a`,DR=`#707d8b`,DMe=`#a0a4ae`,OR=`#bdbdbd`,kR=`#e0e0e0`,OMe=`#202325`,AR=`#ff5f52`,jR=`#ff6e40`,kMe=`#fa5788`,MR=`#facf4e`,NR=`#ffad42`,PR=`#56c8d8`,FR=`#7186f0`,IR=`#cf6edf`,AMe=`#6abf69`,jMe=`#99d066`,MMe=`#4ebaaa`,LR=AR,RR=OMe,NMe=`#2d333b30`,zR=wR,BR=TR,VR=`#ffffff1f`,PMe=`#4A707A80`,HR=DMe,FMe=`#39496650`,IMe=PR,UR=NR,WR=PR,LMe=IR,GR=`#1e3d2780`,KR=`#4e282880`,qR=`#6abf69`,JR=`#ff5f52`,RMe=[Ht.theme({"&":{color:OR,backgroundColor:zR,fontSize:hR.fontSize,fontFamily:hR.fontFamily},".cm-content":{caretColor:HR,lineHeight:hR.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:HR,borderLeftWidth:TMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${HR}99`,color:zR},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:VR},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#394966cc`,outline:`1px solid ${PR}`,color:kR,borderRadius:SR.borderRadius,"& span":{color:kR}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:PR,color:zR,padding:SR.padding,"& span":{color:zR}},".cm-search.cm-panel.cm-textfield":{color:OR,borderRadius:SR.borderRadius,padding:SR.padding},".cm-panels":{backgroundColor:wR,color:OR,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${DR}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${DR}`},".cm-panel button":{backgroundColor:BR,color:OR,border:vR.border,borderRadius:vR.borderRadius,padding:vR.padding},".cm-panel button:hover":{backgroundColor:ER},".cm-activeLine":{backgroundColor:NMe,borderRadius:EMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:RR,color:DR,border:_R.border,borderRight:`1px solid ${TR}`,paddingRight:_R.paddingRight},".cm-activeLineGutter":{backgroundColor:`#252a2c`,color:OR,fontWeight:_R.fontWeight},".cm-lineNumbers":{fontSize:_R.fontSize,lineHeight:_R.lineHeight},".cm-foldGutter":{fontSize:_R.fontSize,lineHeight:_R.lineHeight},".cm-foldGutter .cm-gutterElement":{color:DR,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:OR},".cm-insertedLine":{textDecoration:gR.insertedTextDecoration,backgroundColor:GR,color:qR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:gR.insertedTextDecoration,backgroundColor:`${GR} !important`,color:qR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious,border:`1px solid ${qR}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:gR.deletedTextDecoration,backgroundColor:KR,color:JR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:gR.deletedTextDecoration,backgroundColor:`${KR} !important`,color:JR,padding:gR.insertedLinePadding,borderRadius:gR.borderRadious,border:`1px solid ${JR}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:BR,border:`1px solid ${DR}`,borderRadius:CR.borderRadius,padding:CR.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:BR,border:`none`},"& > ul > li":{padding:CR.padding,lineHeight:CR.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:VR,color:kR,borderRadius:CR.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:DR,paddingRight:CR.paddingRight},"& > ul > li > span.cm-completionDetail":{color:DR,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:BR,borderBottomColor:BR},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${LR}`},"&-warning":{borderLeft:`3px solid ${UR}`},"&-info":{borderLeft:`3px solid ${WR}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${LR}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${UR}`},".cm-matchingBracket":{backgroundColor:FMe,outline:`1px solid ${IMe}`,borderRadius:yR.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#ff5f5240`,outline:`1px solid ${LR}`,borderRadius:yR.borderRadius},".cm-selectionMatch":{backgroundColor:PMe,outline:`1px solid ${ER}50`,borderRadius:yR.borderRadius},".cm-foldPlaceholder":{backgroundColor:BR,color:DR,border:`1px dotted ${DR}70`,borderRadius:bR.borderRadius,padding:bR.padding,margin:bR.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${zR}, 0 0 0 3px ${PR}40`},"& .cm-scroller::-webkit-scrollbar":{width:xR.width,height:xR.height},"& .cm-scroller::-webkit-scrollbar-track":{background:RR},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:ER,borderRadius:xR.borderRadius,border:`3px solid ${RR}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:DR},".cm-ghostText":{opacity:`0.5`,color:DR}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:AR,fontWeight:`bold`},{tag:U.controlKeyword,color:AR,fontWeight:`bold`},{tag:U.moduleKeyword,color:AR,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:FR},{tag:[U.variableName],color:jMe},{tag:[U.propertyName],color:IR,fontStyle:`normal`},{tag:[U.typeName],color:AR},{tag:[U.className],color:MR,fontStyle:`italic`},{tag:[U.namespace],color:FR,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:OR},{tag:[U.bracket],color:DR},{tag:[U.brace],color:DR},{tag:[U.punctuation],color:DR},{tag:[U.function(U.variableName)],color:PR},{tag:[U.labelName],color:PR,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:PR},{tag:[U.definition(U.variableName)],color:FR},{tag:U.number,color:MR},{tag:U.changed,color:MR},{tag:U.annotation,color:LR,fontStyle:`italic`},{tag:U.modifier,color:jR,fontStyle:`italic`},{tag:U.self,color:jR},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:jR},{tag:[U.atom,U.bool,U.special(U.variableName)],color:jR},{tag:[U.processingInstruction,U.inserted],color:AMe},{tag:[U.special(U.string),U.regexp],color:kMe},{tag:U.string,color:NR},{tag:U.definition(U.typeName),color:AR,fontWeight:`bold`},{tag:U.meta,color:DR},{tag:U.comment,fontStyle:`italic`,color:DR},{tag:U.docComment,fontStyle:`italic`,color:DR},{tag:[U.tagName],color:IR},{tag:[U.attributeName],color:MR},{tag:[U.heading],fontWeight:`bold`,color:MMe},{tag:U.heading1,color:MR},{tag:U.heading2,color:NR},{tag:U.heading3,color:PR},{tag:U.heading4,color:FR},{tag:U.heading5,color:IR},{tag:U.heading6,color:AR},{tag:[U.strong],fontWeight:`bold`,color:FR},{tag:[U.emphasis],fontStyle:`italic`,color:NR},{tag:[U.link],color:LMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:WR,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:OR,textDecoration:`underline wavy`,borderBottom:`1px wavy ${LR}`},{tag:[U.strikethrough],color:LR,textDecoration:`line-through`},{tag:U.constant(U.name),color:jR},{tag:U.deleted,color:LR},{tag:U.squareBracket,color:DR},{tag:U.angleBracket,color:DR},{tag:U.monospace,color:OR},{tag:[U.contentSeparator],color:FR},{tag:U.quote,color:DR}]))],YR={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},zMe={borderLeftWidth:`2px`},XR={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},ZR={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},QR={border:`none`,borderRadius:`4px`,padding:`2px 10px`},BMe={borderRadius:`2px`},$R={borderRadius:`2px`},ez={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},tz={width:`12px`,height:`12px`,borderRadius:`6px`},nz={borderRadius:`4px`,padding:`2px 6px`},rz={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},VMe=`#ffffff`,iz=`#f5f5f5`,az=`#212121`,oz=`#757575`,sz=`#9e9e9e`,cz=`#424242`,HMe=`#eeeeee`,lz=`#fafafa`,uz=`#f44336`,dz=`#ff3e00`,fz=`#FF00E9FF`,UMe=`#ffc107`,pz=`#ff9800`,mz=`#00acc1`,hz=`#3949ab`,gz=`#8e24aa`,_z=`#43a047`,vz=`#00897b`,yz=`#1e88e5`,bz=uz,WMe=`#00000008`,xz=VMe,Sz=iz,GMe=`#DDEEFF`,KMe=`#90a4ae26`,Cz=sz,qMe=`#DDEEFF80`,JMe=mz,wz=pz,Tz=mz,YMe=gz,Ez=`#ECEFF180`,Dz=`#e6ffed80`,Oz=`#ffebe980`,kz=`#28a745`,Az=`#d73a49`,XMe=[Ht.theme({"&":{color:az,backgroundColor:xz,fontSize:YR.fontSize,fontFamily:YR.fontFamily},".cm-content":{caretColor:Cz,lineHeight:YR.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:Cz,borderLeftWidth:zMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${az}99`,color:xz},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:GMe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#FFA72680`,outline:`1px solid ${UMe}`,color:az,borderRadius:nz.borderRadius,"& span":{color:az}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:mz,color:xz,padding:nz.padding,"& span":{color:xz}},".cm-search.cm-panel.cm-textfield":{color:az,borderRadius:nz.borderRadius,padding:nz.padding},".cm-panels":{backgroundColor:HMe,color:az,borderRadius:`4px`,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${sz}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${sz}`},".cm-panel button":{backgroundColor:Sz,color:az,border:QR.border,borderRadius:QR.borderRadius,padding:QR.padding},".cm-panel button:hover":{backgroundColor:`#CFD8DC`},".cm-activeLine":{backgroundColor:WMe,borderRadius:BMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:lz,color:oz,border:ZR.border,borderRight:`1px solid ${sz}`,paddingRight:ZR.paddingRight},".cm-activeLineGutter":{backgroundColor:`#E0E0E0`,color:az,fontWeight:ZR.fontWeight},".cm-lineNumbers":{fontSize:ZR.fontSize,lineHeight:ZR.lineHeight},".cm-foldGutter":{fontSize:ZR.fontSize,lineHeight:ZR.lineHeight},".cm-foldGutter .cm-gutterElement":{color:oz,cursor:`pointer`,transition:`color 0.15s ease`},".cm-foldGutter .cm-gutterElement:hover":{color:az},".cm-insertedLine":{textDecoration:XR.insertedTextDecoration,backgroundColor:Dz,color:kz,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:XR.insertedTextDecoration,backgroundColor:`${Dz} !important`,color:kz,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious,border:`1px solid ${kz}30`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:XR.deletedTextDecoration,backgroundColor:Oz,color:Az,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:XR.deletedTextDecoration,backgroundColor:`${Oz} !important`,color:Az,padding:XR.insertedLinePadding,borderRadius:XR.borderRadious,border:`1px solid ${Az}30`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:Sz,border:`1px solid ${sz}`,borderRadius:rz.borderRadius,padding:rz.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:Sz,border:`none`},"& > ul > li":{padding:rz.padding,lineHeight:rz.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Ez,color:az,borderRadius:rz.borderRadiusSelected},"& > ul > li:hover":{backgroundColor:Ez},"& > ul > li > span.cm-completionIcon":{color:oz,paddingRight:rz.paddingRight},"& > ul > li > span.cm-completionDetail":{color:oz,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Sz,borderBottomColor:Sz},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${bz}`},"&-warning":{borderLeft:`3px solid ${wz}`},"&-info":{borderLeft:`3px solid ${Tz}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${bz}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${wz}`},".cm-matchingBracket":{backgroundColor:qMe,outline:`1px solid ${JMe}`,borderRadius:$R.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${bz}20`,outline:`1px solid ${bz}`,borderRadius:$R.borderRadius},".cm-selectionMatch":{backgroundColor:KMe,outline:`1px solid ${oz}30`,borderRadius:$R.borderRadius},".cm-foldPlaceholder":{backgroundColor:iz,color:oz,border:`1px dotted ${oz}70`,borderRadius:ez.borderRadius,padding:ez.padding,margin:ez.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${xz}, 0 0 0 3px ${mz}40`},"& .cm-scroller::-webkit-scrollbar":{width:tz.width,height:tz.height},"& .cm-scroller::-webkit-scrollbar-track":{background:lz},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:oz,borderRadius:tz.borderRadius,border:`3px solid ${lz}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:az},".cm-ghostText":{opacity:`0.5`,color:oz}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:mz,fontWeight:`bold`},{tag:U.controlKeyword,color:mz,fontWeight:`bold`},{tag:U.moduleKeyword,color:mz,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:cz},{tag:[U.variableName],color:cz},{tag:[U.propertyName],color:vz,fontStyle:`normal`},{tag:[U.typeName],color:pz},{tag:[U.className],color:pz,fontStyle:`italic`},{tag:[U.namespace],color:hz,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:hz},{tag:[U.bracket],color:gz},{tag:[U.brace],color:gz},{tag:[U.punctuation],color:oz},{tag:[U.function(U.variableName)],color:dz},{tag:[U.labelName],color:yz,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:dz},{tag:[U.definition(U.variableName)],color:fz},{tag:U.number,color:pz},{tag:U.changed,color:pz},{tag:U.annotation,color:bz,fontStyle:`italic`},{tag:U.modifier,color:pz,fontStyle:`italic`},{tag:U.self,color:pz},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:pz},{tag:[U.atom,U.bool],color:gz},{tag:[U.processingInstruction,U.inserted],color:_z},{tag:U.string,color:_z},{tag:[U.special(U.string),U.regexp],color:fz},{tag:U.definition(U.typeName),color:fz,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:fz},{tag:U.meta,color:oz},{tag:U.comment,fontStyle:`italic`,color:oz},{tag:U.docComment,fontStyle:`italic`,color:oz},{tag:[U.tagName],color:dz},{tag:[U.attributeName],color:cz},{tag:[U.heading],fontWeight:`bold`,color:vz},{tag:U.heading1,color:yz},{tag:U.heading2,color:pz},{tag:U.heading3,color:mz},{tag:U.heading4,color:hz},{tag:U.heading5,color:gz},{tag:U.heading6,color:_z},{tag:[U.strong],fontWeight:`bold`,color:hz},{tag:[U.emphasis],fontStyle:`italic`,color:pz},{tag:[U.link],color:YMe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:Tz,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:az,textDecoration:`underline wavy`,borderBottom:`1px dotted ${uz}`},{tag:[U.strikethrough],color:bz,textDecoration:`line-through`},{tag:U.constant(U.name),color:dz},{tag:U.deleted,color:bz},{tag:U.squareBracket,color:uz},{tag:U.angleBracket,color:az},{tag:U.monospace,color:az},{tag:[U.contentSeparator],color:mz},{tag:U.quote,color:_z}]))],jz={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ZMe={borderLeftWidth:`2px`},Mz={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},Nz={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},Pz={border:`none`,borderRadius:`4px`,padding:`2px 10px`},QMe={borderRadius:`2px`},Fz={borderRadius:`2px`},Iz={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},Lz={width:`12px`,height:`12px`,borderRadius:`6px`},Rz={borderRadius:`4px`,padding:`2px 6px`},zz={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},Bz=`#272822`,Vz=`#f8f8f2`,Hz=`#88846f`,$Me=`#f8f8f0`,Uz=`#F92672`,Wz=`#FD971F`,Gz=`#66D9EF`,Kz=`#E6DB74`,qz=`#AE81FF`,Jz=`#A6E22E`,Yz=`#F44747`,Xz=`#414339`,eNe=`#3e3d3257`,Zz=`#34352f`,Qz=`#49483E`,tNe=`#75715e70`,$z=$Me,nNe=`#75715E55`,rNe=Gz,eB=Wz,tB=Gz,iNe=qz,nB=`#3d4d3880`,rB=`#4d393980`,iB=`#A6E22E`,aB=`#F92672`,aNe=[Ht.theme({"&":{color:Vz,backgroundColor:Bz,fontSize:jz.fontSize,fontFamily:jz.fontFamily},".cm-content":{caretColor:$z,lineHeight:jz.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:$z,borderLeftWidth:ZMe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${$z}99`,color:Bz},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qz},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#49483E99`,outline:`1px solid ${Kz}`,color:Vz,borderRadius:Rz.borderRadius,"& span":{color:Vz}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Uz,color:Bz,padding:Rz.padding,"& span":{color:Bz}},".cm-search.cm-panel.cm-textfield":{color:Vz,borderRadius:Rz.borderRadius,padding:Rz.padding},".cm-panels":{backgroundColor:Xz,color:Vz,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${Hz}80`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${Hz}80`},".cm-panel button":{backgroundColor:Zz,color:Vz,border:Pz.border,borderRadius:Pz.borderRadius,padding:Pz.padding},".cm-panel button:hover":{backgroundColor:`#49483E`},".cm-activeLine":{backgroundColor:eNe,borderRadius:QMe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:Xz,color:Hz,border:Nz.border,borderRight:`1px solid #3e3d32`,paddingRight:Nz.paddingRight},".cm-activeLineGutter":{backgroundColor:`#35352c`,color:Vz,fontWeight:Nz.fontWeight},".cm-lineNumbers":{fontSize:Nz.fontSize,lineHeight:Nz.lineHeight},".cm-foldGutter":{fontSize:Nz.fontSize,lineHeight:Nz.lineHeight},".cm-foldGutter .cm-gutterElement":{color:Hz,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:Vz},".cm-insertedLine":{textDecoration:Mz.insertedTextDecoration,backgroundColor:nB,color:iB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:Mz.insertedTextDecoration,backgroundColor:`${nB} !important`,color:iB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious,border:`1px solid ${iB}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:Mz.deletedTextDecoration,backgroundColor:rB,color:aB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:Mz.deletedTextDecoration,backgroundColor:`${rB} !important`,color:aB,padding:Mz.insertedLinePadding,borderRadius:Mz.borderRadious,border:`1px solid ${aB}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:Zz,border:`1px solid #49483E`,borderRadius:zz.borderRadius,padding:zz.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.4)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:Zz,border:`none`},"& > ul > li":{padding:zz.padding,lineHeight:zz.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:Qz,color:Vz,borderRadius:zz.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:Hz,paddingRight:zz.paddingRight},"& > ul > li > span.cm-completionDetail":{color:Hz,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Zz,borderBottomColor:Zz},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${Yz}`},"&-warning":{borderLeft:`3px solid ${eB}`},"&-info":{borderLeft:`3px solid ${tB}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${Yz}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${eB}`},".cm-matchingBracket":{backgroundColor:nNe,outline:`1px solid ${rNe}`,borderRadius:Fz.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`#f9267240`,outline:`1px solid ${Yz}`,borderRadius:Fz.borderRadius},".cm-selectionMatch":{backgroundColor:tNe,outline:`1px solid ${Hz}50`,borderRadius:Fz.borderRadius},".cm-foldPlaceholder":{backgroundColor:Zz,color:Hz,border:`1px dotted ${Hz}70`,borderRadius:Iz.borderRadius,padding:Iz.padding,margin:Iz.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${Bz}, 0 0 0 3px ${Gz}40`},"& .cm-scroller::-webkit-scrollbar":{width:Lz.width,height:Lz.height},"& .cm-scroller::-webkit-scrollbar-track":{background:Xz},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#49483E`,borderRadius:Lz.borderRadius,border:`3px solid ${Xz}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#5a594d`},".cm-ghostText":{opacity:`0.5`,color:Hz}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:Uz,fontWeight:`bold`},{tag:U.controlKeyword,color:Uz,fontWeight:`bold`},{tag:U.moduleKeyword,color:Uz,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:Wz},{tag:[U.variableName],color:Wz},{tag:[U.propertyName],color:Jz,fontStyle:`normal`},{tag:[U.typeName],color:Gz,fontStyle:`italic`},{tag:[U.className],color:Jz,fontStyle:`italic`},{tag:[U.namespace],color:Wz,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:Uz},{tag:[U.bracket],color:Vz},{tag:[U.brace],color:Vz},{tag:[U.punctuation],color:Vz},{tag:[U.function(U.variableName),U.labelName],color:Gz},{tag:[U.definition(U.function(U.variableName))],color:Gz},{tag:[U.definition(U.variableName)],color:Wz},{tag:U.number,color:qz},{tag:U.changed,color:qz},{tag:U.annotation,color:Yz,fontStyle:`italic`},{tag:U.modifier,color:qz,fontStyle:`italic`},{tag:U.self,color:qz},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:qz},{tag:[U.atom,U.bool,U.special(U.variableName)],color:qz},{tag:[U.processingInstruction,U.inserted],color:Jz},{tag:[U.special(U.string),U.regexp],color:Kz},{tag:U.string,color:Kz},{tag:U.definition(U.typeName),color:Gz,fontWeight:`bold`},{tag:U.meta,color:Hz},{tag:U.comment,fontStyle:`italic`,color:Hz},{tag:U.docComment,fontStyle:`italic`,color:Hz},{tag:[U.tagName],color:Uz},{tag:[U.attributeName],color:Jz},{tag:[U.heading],fontWeight:`bold`,color:Jz},{tag:[U.strong],fontWeight:`bold`,color:Wz},{tag:[U.emphasis],fontStyle:`italic`,color:Wz},{tag:[U.link],color:iNe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:tB,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:Vz,textDecoration:`underline wavy`,borderBottom:`1px wavy ${Yz}`},{tag:[U.strikethrough],color:Yz,textDecoration:`line-through`},{tag:U.constant(U.name),color:qz},{tag:U.deleted,color:Yz},{tag:U.squareBracket,color:Vz},{tag:U.angleBracket,color:Vz},{tag:U.monospace,color:Vz},{tag:[U.contentSeparator],color:Wz},{tag:U.quote,color:Hz}]))],oB={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},oNe={borderLeftWidth:`2px`},sB={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},cB={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},lB={border:`none`,borderRadius:`4px`,padding:`2px 10px`},sNe={borderRadius:`2px`},uB={borderRadius:`2px`},dB={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},fB={width:`12px`,height:`12px`,borderRadius:`6px`},pB={borderRadius:`4px`,padding:`2px 6px`},mB={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},cNe=`#2e3440`,hB=`#3b4252`,gB=`#434c5e`,_B=`#4c566a`,vB=`#d8dee9`,yB=`#eceff4`,bB=`#8fbcbb`,xB=`#88c0d0`,SB=`#81a1c1`,CB=`#5e81ac`,wB=`#bf616a`,TB=`#d08770`,EB=`#ebcb8b`,DB=`#a3be8c`,OB=`#b48ead`,lNe=`#d30102`,kB=`#252a33`,uNe=`#3b425277`,AB=cNe,jB=hB,dNe=gB,fNe=`#4c566a80`,MB=vB,pNe=`#4c566a55`,mNe=xB,NB=EB,PB=SB,hNe=OB,FB=`#3b4a3880`,IB=`#4a393a80`,LB=`#a3be8c`,RB=`#bf616a`,gNe=[Ht.theme({"&":{color:vB,backgroundColor:AB,fontSize:oB.fontSize,fontFamily:oB.fontFamily},".cm-content":{caretColor:MB,lineHeight:oB.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:MB,borderLeftWidth:oNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${MB}99`,color:AB},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:dNe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#5e81ac80`,outline:`1px solid ${bB}`,color:vB,borderRadius:pB.borderRadius,"& span":{color:vB}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:SB,color:yB,padding:pB.padding,"& span":{color:yB}},".cm-search.cm-panel.cm-textfield":{color:vB,borderRadius:pB.borderRadius,padding:pB.padding},".cm-panels":{backgroundColor:kB,color:vB,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${_B}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${_B}`},".cm-panel button":{backgroundColor:jB,color:vB,border:lB.border,borderRadius:lB.borderRadius,padding:lB.padding},".cm-panel button:hover":{backgroundColor:gB},".cm-activeLine":{backgroundColor:uNe,borderRadius:sNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:kB,color:_B,border:cB.border,borderRight:`1px solid ${gB}`,paddingRight:cB.paddingRight},".cm-activeLineGutter":{backgroundColor:hB,color:vB,fontWeight:cB.fontWeight},".cm-lineNumbers":{fontSize:cB.fontSize,lineHeight:cB.lineHeight},".cm-foldGutter":{fontSize:cB.fontSize,lineHeight:cB.lineHeight},".cm-foldGutter .cm-gutterElement":{color:_B,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:vB},".cm-insertedLine":{textDecoration:sB.insertedTextDecoration,backgroundColor:FB,color:LB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:sB.insertedTextDecoration,backgroundColor:`${FB} !important`,color:LB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious,border:`1px solid ${LB}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:sB.deletedTextDecoration,backgroundColor:IB,color:RB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:sB.deletedTextDecoration,backgroundColor:`${IB} !important`,color:RB,padding:sB.insertedLinePadding,borderRadius:sB.borderRadious,border:`1px solid ${RB}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:jB,border:`1px solid ${_B}`,borderRadius:mB.borderRadius,padding:mB.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:jB,border:`none`},"& > ul > li":{padding:mB.padding,lineHeight:mB.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:gB,color:yB,borderRadius:mB.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:_B,paddingRight:mB.paddingRight},"& > ul > li > span.cm-completionDetail":{color:_B,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:jB,borderBottomColor:jB},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${wB}`},"&-warning":{borderLeft:`3px solid ${NB}`},"&-info":{borderLeft:`3px solid ${PB}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${wB}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${NB}`},".cm-matchingBracket":{backgroundColor:pNe,outline:`1px solid ${mNe}`,borderRadius:uB.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${wB}40`,outline:`1px solid ${lNe}`,borderRadius:uB.borderRadius},".cm-selectionMatch":{backgroundColor:fNe,outline:`1px solid ${gB}50`,borderRadius:uB.borderRadius},".cm-foldPlaceholder":{backgroundColor:jB,color:_B,border:`1px dotted ${_B}70`,borderRadius:dB.borderRadius,padding:dB.padding,margin:dB.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${AB}, 0 0 0 3px ${xB}40`},"& .cm-scroller::-webkit-scrollbar":{width:fB.width,height:fB.height},"& .cm-scroller::-webkit-scrollbar-track":{background:kB},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:gB,borderRadius:fB.borderRadius,border:`3px solid ${kB}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:_B},".cm-ghostText":{opacity:`0.5`,color:_B}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:CB,fontWeight:`bold`},{tag:U.controlKeyword,color:CB,fontWeight:`bold`},{tag:U.moduleKeyword,color:CB,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:xB},{tag:[U.variableName],color:vB},{tag:[U.propertyName],color:xB,fontStyle:`normal`},{tag:[U.typeName],color:EB},{tag:[U.className],color:EB,fontStyle:`italic`},{tag:[U.namespace],color:SB,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:OB},{tag:[U.bracket],color:vB},{tag:[U.brace],color:bB},{tag:[U.punctuation],color:vB},{tag:[U.function(U.variableName),U.labelName],color:bB},{tag:[U.definition(U.function(U.variableName))],color:bB},{tag:[U.definition(U.variableName)],color:TB},{tag:U.number,color:TB},{tag:U.changed,color:OB},{tag:U.annotation,color:wB,fontStyle:`italic`},{tag:U.modifier,color:OB,fontStyle:`italic`},{tag:U.self,color:OB},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:TB},{tag:[U.atom,U.bool,U.special(U.variableName)],color:OB},{tag:[U.processingInstruction,U.inserted],color:bB},{tag:[U.special(U.string),U.regexp],color:OB},{tag:U.string,color:DB},{tag:U.definition(U.typeName),color:EB,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:DB},{tag:U.meta,color:_B},{tag:U.comment,fontStyle:`italic`,color:_B},{tag:U.docComment,fontStyle:`italic`,color:_B},{tag:[U.tagName],color:wB},{tag:[U.attributeName],color:EB},{tag:[U.heading],fontWeight:`bold`,color:SB},{tag:[U.strong],fontWeight:`bold`,color:xB},{tag:[U.emphasis],fontStyle:`italic`,color:EB},{tag:[U.link],color:hNe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:PB,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:vB,textDecoration:`underline wavy`,borderBottom:`1px wavy ${wB}`},{tag:[U.strikethrough],color:wB,textDecoration:`line-through`},{tag:U.constant(U.name),color:TB},{tag:U.deleted,color:wB},{tag:U.squareBracket,color:wB},{tag:U.angleBracket,color:TB},{tag:U.monospace,color:vB,fontStyle:`italic`},{tag:[U.contentSeparator],color:SB},{tag:U.quote,color:OB}]))],zB={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},_Ne={borderLeftWidth:`2px`},BB={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},VB={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},HB={border:`none`,borderRadius:`4px`,padding:`2px 10px`},vNe={borderRadius:`2px`},UB={borderRadius:`2px`},WB={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},GB={width:`12px`,height:`12px`,borderRadius:`6px`},KB={borderRadius:`4px`,padding:`2px 6px`},qB={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},yNe=`#e1e2e7`,JB=`#3760bf`,YB=`#99a7df`,XB=`#848cb5`,bNe=`#8c91a8`,ZB=`#3760bf`,QB=`#e9e9ec`,$B=`#d5d6db`,eV=`#f52a65`,tV=`#b15c00`,nV=`#8c6c3e`,rV=`#587539`,iV=`#007197`,aV=`#2e7de9`,oV=`#7847bd`,xNe=`#9854f1`,sV=eV,cV=$B,SNe=`#5F5FAF5A`,lV=yNe,uV=QB,dV=`#99a7df40`,CNe=`#99a7df60`,fV=JB,wNe=`#0e639c20`,TNe=iV,pV=tV,mV=iV,ENe=oV,hV=`#58753920`,gV=`#f52a6520`,_V=`#587539`,vV=`#f52a65`,DNe=[Ht.theme({"&":{color:ZB,backgroundColor:lV,fontSize:zB.fontSize,fontFamily:zB.fontFamily},".cm-content":{caretColor:fV,lineHeight:zB.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:fV,borderLeftWidth:_Ne.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${fV}99`,color:lV},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:dV},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#0e639c40`,outline:`1px solid ${iV}`,color:ZB,borderRadius:KB.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:iV,color:lV,padding:KB.padding,"& span":{color:lV}},".cm-search.cm-panel.cm-textfield":{color:ZB,borderRadius:KB.borderRadius,padding:KB.padding},".cm-panels":{backgroundColor:QB,color:ZB,borderRadius:`4px`,boxShadow:`0 1px 3px rgba(0, 0, 0, 0.1)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${XB}30`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${XB}30`},".cm-panel button":{backgroundColor:uV,color:ZB,border:HB.border,borderRadius:HB.borderRadius,padding:HB.padding},".cm-panel button:hover":{backgroundColor:$B,border:`1px solid ${YB}`},".cm-activeLine":{backgroundColor:SNe,borderRadius:vNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:cV,color:XB,border:VB.border,borderRight:`1px solid ${$B}`,paddingRight:VB.paddingRight},".cm-activeLineGutter":{color:JB,fontWeight:VB.fontWeight},".cm-lineNumbers":{fontSize:VB.fontSize,lineHeight:VB.lineHeight},".cm-foldGutter":{fontSize:VB.fontSize,lineHeight:VB.lineHeight},".cm-foldGutter .cm-gutterElement":{color:XB,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:JB},".cm-insertedLine":{textDecoration:BB.insertedTextDecoration,backgroundColor:hV,color:_V,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:BB.insertedTextDecoration,backgroundColor:`${hV} !important`,color:_V,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious,border:`1px solid ${_V}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:BB.deletedTextDecoration,backgroundColor:gV,color:vV,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:BB.deletedTextDecoration,backgroundColor:`${gV} !important`,color:vV,padding:BB.insertedLinePadding,borderRadius:BB.borderRadious,border:`1px solid ${vV}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:uV,border:`1px solid ${bNe}40`,borderRadius:qB.borderRadius,padding:qB.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:uV,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:qB.padding,lineHeight:qB.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:dV,color:JB,borderRadius:qB.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:XB,paddingRight:qB.paddingRight},"& > ul > li > span.cm-completionDetail":{color:XB,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:uV,borderBottomColor:uV},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${sV}`},"&-warning":{borderLeft:`3px solid ${pV}`},"&-info":{borderLeft:`3px solid ${mV}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${sV}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${pV}`},".cm-matchingBracket":{backgroundColor:wNe,outline:`1px solid ${TNe}`,borderRadius:UB.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${eV}20`,outline:`1px solid ${sV}`,borderRadius:UB.borderRadius},".cm-selectionMatch":{backgroundColor:CNe,outline:`1px solid ${YB}50`,borderRadius:UB.borderRadius},".cm-foldPlaceholder":{backgroundColor:uV,color:XB,border:`1px dotted ${XB}70`,borderRadius:WB.borderRadius,padding:WB.padding,margin:WB.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${lV}, 0 0 0 3px ${iV}40`},"& .cm-scroller::-webkit-scrollbar":{width:GB.width,height:GB.height},"& .cm-scroller::-webkit-scrollbar-track":{background:cV},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:XB,borderRadius:GB.borderRadius,border:`3px solid ${cV}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:YB},".cm-ghostText":{opacity:`0.5`,color:XB}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:iV,fontWeight:`bold`},{tag:U.controlKeyword,color:iV,fontWeight:`bold`},{tag:U.moduleKeyword,color:iV,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:aV},{tag:[U.variableName],color:JB},{tag:[U.propertyName],color:aV,fontStyle:`normal`},{tag:[U.typeName],color:iV},{tag:[U.className],color:nV,fontStyle:`italic`},{tag:[U.namespace],color:oV,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:oV},{tag:[U.bracket],color:XB},{tag:[U.brace],color:XB},{tag:[U.punctuation],color:XB},{tag:[U.function(U.variableName)],color:iV},{tag:[U.labelName],color:oV,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:iV},{tag:[U.definition(U.variableName)],color:aV},{tag:U.number,color:tV},{tag:U.changed,color:tV},{tag:U.annotation,color:sV,fontStyle:`italic`},{tag:U.modifier,color:tV,fontStyle:`italic`},{tag:U.self,color:tV},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:tV},{tag:[U.atom,U.bool,U.special(U.variableName)],color:tV},{tag:[U.processingInstruction,U.inserted],color:rV},{tag:[U.special(U.string),U.regexp],color:xNe},{tag:U.string,color:rV},{tag:U.definition(U.typeName),color:iV,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:aV},{tag:U.meta,color:XB},{tag:U.comment,fontStyle:`italic`,color:XB},{tag:U.docComment,fontStyle:`italic`,color:XB},{tag:[U.tagName],color:oV},{tag:[U.attributeName],color:nV},{tag:[U.heading],fontWeight:`bold`,color:tV},{tag:U.heading1,color:tV,fontWeight:`bold`},{tag:U.heading2,color:tV},{tag:U.heading3,color:tV},{tag:U.heading4,color:iV},{tag:U.heading5,color:iV},{tag:U.heading6,color:iV},{tag:[U.strong],fontWeight:`bold`,color:JB},{tag:[U.emphasis],fontStyle:`italic`,color:rV},{tag:[U.link],color:ENe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:mV,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:JB,textDecoration:`underline wavy`,borderBottom:`1px wavy ${sV}`},{tag:[U.strikethrough],color:sV,textDecoration:`line-through`},{tag:U.constant(U.name),color:tV},{tag:U.deleted,color:sV},{tag:U.squareBracket,color:XB},{tag:U.angleBracket,color:XB},{tag:U.monospace,color:JB},{tag:[U.contentSeparator],color:aV},{tag:U.quote,color:XB}]))],yV={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ONe={borderLeftWidth:`2px`},bV={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},xV={border:`none`,paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},SV={border:`none`,borderRadius:`4px`,padding:`2px 10px`},kNe={borderRadius:`2px`},CV={borderRadius:`2px`},wV={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},TV={width:`12px`,height:`12px`,borderRadius:`6px`},EV={borderRadius:`4px`,padding:`2px 6px`},DV={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},ANe=`#24283b`,OV=`#414868`,kV=`#565f89`,AV=`#c0caf5`,jV=`#282e44`,MV=`#1f2335`,jNe=`#f7768e`,NV=`#ff9e64`,PV=`#e0af68`,FV=`#9ece6a`,IV=`#2ac3de`,LV=`#7aa2f7`,RV=`#bb9af7`,zV=`#f7768e`,BV=MV,MNe=`#292e427a`,VV=ANe,HV=jV,UV=`#6f7bb630`,NNe=`#6f7bb650`,WV=AV,PNe=`#3d59a150`,FNe=LV,GV=NV,KV=IV,INe=RV,qV=`#3b4a3880`,JV=`#4a393a80`,YV=`#9ece6a`,XV=`#f7768e`,LNe=[Ht.theme({"&":{color:AV,backgroundColor:VV,fontSize:yV.fontSize,fontFamily:yV.fontFamily},".cm-content":{caretColor:WV,lineHeight:yV.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:WV,borderLeftWidth:ONe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${WV}99`,color:VV},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:UV},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#7aa2f740`,outline:`1px solid ${LV}`,color:AV,borderRadius:EV.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:LV,color:VV,padding:EV.padding,"& span":{color:VV}},".cm-search.cm-panel.cm-textfield":{color:AV,borderRadius:EV.borderRadius,padding:EV.padding},".cm-panels":{backgroundColor:jV,color:AV,borderRadius:`4px`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${kV}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${kV}`},".cm-panel button":{backgroundColor:HV,color:AV,border:SV.border,borderRadius:SV.borderRadius,padding:SV.padding},".cm-panel button:hover":{backgroundColor:MV},".cm-activeLine":{backgroundColor:MNe,borderRadius:kNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:BV,color:kV,border:xV.border,borderRight:`1px solid ${MV}`,paddingRight:xV.paddingRight},".cm-activeLineGutter":{backgroundColor:MV,color:AV,fontWeight:xV.fontWeight},".cm-lineNumbers":{fontSize:xV.fontSize,lineHeight:xV.lineHeight},".cm-foldGutter":{fontSize:xV.fontSize,lineHeight:xV.lineHeight},".cm-foldGutter .cm-gutterElement":{color:kV,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:AV},".cm-insertedLine":{textDecoration:bV.insertedTextDecoration,backgroundColor:qV,color:YV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:bV.insertedTextDecoration,backgroundColor:`${qV} !important`,color:YV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious,border:`1px solid ${YV}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:bV.deletedTextDecoration,backgroundColor:JV,color:XV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:bV.deletedTextDecoration,backgroundColor:`${JV} !important`,color:XV,padding:bV.insertedLinePadding,borderRadius:bV.borderRadious,border:`1px solid ${XV}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:HV,border:`1px solid ${kV}`,borderRadius:DV.borderRadius,padding:DV.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:HV,border:`none`},"& > ul > li":{padding:DV.padding,lineHeight:DV.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:UV,color:AV,borderRadius:DV.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:kV,paddingRight:DV.paddingRight},"& > ul > li > span.cm-completionDetail":{color:kV,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:HV,borderBottomColor:HV},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${zV}`},"&-warning":{borderLeft:`3px solid ${GV}`},"&-info":{borderLeft:`3px solid ${KV}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${zV}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${GV}`},".cm-matchingBracket":{backgroundColor:PNe,outline:`1px solid ${FNe}`,borderRadius:CV.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${jNe}20`,outline:`1px solid ${zV}`,borderRadius:CV.borderRadius},".cm-selectionMatch":{backgroundColor:NNe,outline:`1px solid ${OV}50`,borderRadius:CV.borderRadius},".cm-foldPlaceholder":{backgroundColor:HV,color:kV,border:`1px dotted ${kV}70`,borderRadius:wV.borderRadius,padding:wV.padding,margin:wV.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 2px ${VV}, 0 0 0 3px ${LV}40`},"& .cm-scroller::-webkit-scrollbar":{width:TV.width,height:TV.height},"& .cm-scroller::-webkit-scrollbar-track":{background:BV},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:OV,borderRadius:TV.borderRadius,border:`3px solid ${BV}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:kV},".cm-ghostText":{opacity:`0.5`,color:kV}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:RV,fontWeight:`bold`},{tag:U.controlKeyword,color:RV,fontWeight:`bold`},{tag:U.moduleKeyword,color:RV,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:AV},{tag:[U.variableName],color:AV},{tag:[U.propertyName],color:LV,fontStyle:`normal`},{tag:[U.typeName],color:IV},{tag:[U.className],color:PV,fontStyle:`italic`},{tag:[U.namespace],color:LV,fontStyle:`italic`},{tag:[U.operator,U.operatorKeyword],color:RV},{tag:[U.bracket],color:kV},{tag:[U.brace],color:kV},{tag:[U.punctuation],color:kV},{tag:[U.function(U.variableName)],color:LV},{tag:[U.labelName],color:LV,fontStyle:`italic`},{tag:[U.definition(U.function(U.variableName))],color:LV},{tag:[U.definition(U.variableName)],color:AV},{tag:U.number,color:NV},{tag:U.changed,color:NV},{tag:U.annotation,color:zV,fontStyle:`italic`},{tag:U.modifier,color:NV,fontStyle:`italic`},{tag:U.self,color:NV},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:RV},{tag:[U.atom,U.bool,U.special(U.variableName)],color:NV},{tag:[U.processingInstruction,U.inserted],color:FV},{tag:[U.special(U.string),U.regexp],color:`#b4f9f8`},{tag:U.string,color:FV},{tag:U.definition(U.typeName),color:IV,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:AV},{tag:U.meta,color:kV},{tag:U.comment,fontStyle:`italic`,color:kV},{tag:U.docComment,fontStyle:`italic`,color:kV},{tag:[U.tagName],color:RV},{tag:[U.attributeName],color:PV},{tag:[U.heading],fontWeight:`bold`,color:`#89ddff`},{tag:U.heading1,color:`#89ddff`,fontWeight:`bold`},{tag:U.heading2,color:`#89ddff`},{tag:U.heading3,color:`#89ddff`},{tag:U.heading4,color:`#89ddff`},{tag:U.heading5,color:`#89ddff`},{tag:U.heading6,color:`#89ddff`},{tag:[U.strong],fontWeight:`bold`,color:AV},{tag:[U.emphasis],fontStyle:`italic`,color:IV},{tag:[U.link],color:INe,fontWeight:`500`,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:KV,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:AV,textDecoration:`underline wavy`,borderBottom:`1px wavy ${zV}`},{tag:[U.strikethrough],color:zV,textDecoration:`line-through`},{tag:U.constant(U.name),color:NV},{tag:U.deleted,color:zV},{tag:U.squareBracket,color:kV},{tag:U.angleBracket,color:kV},{tag:U.monospace,color:AV},{tag:[U.contentSeparator],color:LV},{tag:U.quote,color:kV}]))],ZV={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},RNe={borderLeftWidth:`2px`},QV={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},$V={paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},eH={borderRadius:`4px`,padding:`2px 10px`},zNe={borderRadius:`2px`},tH={borderRadius:`2px`},nH={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},rH={width:`12px`,height:`12px`,borderRadius:`6px`},iH={borderRadius:`4px`,padding:`2px 6px`},aH={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},BNe=`#1e1e1e`,oH=`#252526`,sH=`#2d2d30`,cH=`#838383`,VNe=`#c6c6c6`,lH=`#d4d4d4`,uH=`#e9e9e9`,HNe=`#1c1c1c`,dH=`#569cd6`,UNe=`#c586c0`,fH=`#9cdcfe`,pH=`#4ec9b0`,mH=`#dcdcaa`,WNe=`#b5cea8`,hH=`#ce9178`,gH=`#f44747`,_H=`#d7ba7d`,vH=`#6a9955`,yH=gH,bH=`#FFFFFF08`,xH=BNe,SH=oH,GNe=`#264F7899`,KNe=`#72a1ff59`,CH=VNe,qNe=`#ffffff15`,JNe=dH,wH=_H,TH=`#3794ff`,YNe=`#c586c0`,EH=`#1e3f1e80`,DH=`#4b1c1c80`,OH=`#6cc26f`,kH=`#f14c4c`,XNe=[Ht.theme({"&":{color:lH,backgroundColor:xH,fontSize:ZV.fontSize,fontFamily:ZV.fontFamily},".cm-content":{caretColor:CH,lineHeight:ZV.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:CH,borderLeftWidth:RNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${CH}99`,color:xH},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:GNe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#72a1ff40`,outline:`1px solid ${dH}90`,color:uH,borderRadius:iH.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#3794ff90`,color:uH,padding:iH.padding,"& span":{color:uH}},".cm-search.cm-panel.cm-textfield":{color:lH,borderRadius:iH.borderRadius,padding:iH.padding},".cm-panels":{backgroundColor:oH,color:lH,borderRadius:`3px`,boxShadow:`0 2px 6px rgba(0, 0, 0, 0.45)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${sH}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${sH}`},".cm-panel button":{backgroundColor:sH,color:lH,border:`1px solid ${sH}`,borderRadius:eH.borderRadius,padding:eH.padding},".cm-panel button:hover":{backgroundColor:`#3a3a3a`,border:`1px solid ${cH}80`},".cm-activeLine":{backgroundColor:bH,borderRadius:zNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:HNe,color:cH,border:`none`,borderRight:`1px solid ${sH}`,paddingRight:$V.paddingRight},".cm-activeLineGutter":{backgroundColor:bH,color:uH,fontWeight:$V.fontWeight},".cm-lineNumbers":{fontSize:$V.fontSize,lineHeight:$V.lineHeight},".cm-foldGutter":{fontSize:$V.fontSize,lineHeight:$V.lineHeight},".cm-foldGutter .cm-gutterElement":{color:cH,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:uH},".cm-insertedLine":{textDecoration:QV.insertedTextDecoration,backgroundColor:EH,color:OH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:QV.insertedTextDecoration,backgroundColor:`${EH} !important`,color:OH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious,border:`1px solid ${OH}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:QV.deletedTextDecoration,backgroundColor:DH,color:kH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:QV.deletedTextDecoration,backgroundColor:`${DH} !important`,color:kH,padding:QV.insertedLinePadding,borderRadius:QV.borderRadious,border:`1px solid ${kH}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:SH,border:`1px solid ${sH}`,borderRadius:aH.borderRadius,padding:aH.padding,boxShadow:`0 3px 8px rgba(0, 0, 0, 0.3)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:SH,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:aH.padding,lineHeight:aH.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#04395e`,color:uH,borderRadius:aH.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:cH,paddingRight:aH.paddingRight},"& > ul > li > span.cm-completionDetail":{color:cH,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:SH,borderBottomColor:SH},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${yH}`},"&-warning":{borderLeft:`3px solid ${wH}`},"&-info":{borderLeft:`3px solid ${TH}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${yH}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${wH}`},".cm-matchingBracket":{backgroundColor:qNe,outline:`1px solid ${JNe}80`,borderRadius:tH.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${gH}40`,outline:`1px solid ${yH}`,borderRadius:tH.borderRadius},".cm-selectionMatch":{backgroundColor:KNe,outline:`1px solid ${sH}70`,borderRadius:tH.borderRadius},".cm-foldPlaceholder":{backgroundColor:SH,color:cH,border:`1px dotted ${cH}70`,borderRadius:nH.borderRadius,padding:nH.padding,margin:nH.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 1px ${sH}`},"& .cm-scroller::-webkit-scrollbar":{width:rH.width,height:rH.height},"& .cm-scroller::-webkit-scrollbar-track":{background:xH},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#424242`,borderRadius:rH.borderRadius,border:`3px solid ${xH}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#525252`},".cm-ghostText":{opacity:`0.5`,color:cH}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:dH,fontWeight:`bold`},{tag:U.controlKeyword,color:UNe,fontWeight:`bold`},{tag:U.moduleKeyword,color:dH,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:lH},{tag:[U.variableName],color:fH},{tag:[U.propertyName],color:fH,fontStyle:`normal`},{tag:[U.typeName],color:pH},{tag:[U.className],color:pH,fontStyle:`normal`},{tag:[U.namespace],color:lH,fontStyle:`normal`},{tag:[U.operator,U.operatorKeyword],color:lH},{tag:[U.bracket],color:lH},{tag:[U.brace],color:lH},{tag:[U.punctuation],color:lH},{tag:[U.function(U.variableName)],color:mH},{tag:[U.labelName],color:mH,fontStyle:`normal`},{tag:[U.definition(U.function(U.variableName))],color:mH},{tag:[U.definition(U.variableName)],color:fH},{tag:U.number,color:WNe},{tag:U.changed,color:_H},{tag:U.annotation,color:_H,fontStyle:`italic`},{tag:U.modifier,color:dH,fontStyle:`normal`},{tag:U.self,color:dH},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:fH},{tag:[U.atom,U.bool,U.special(U.variableName)],color:dH},{tag:[U.processingInstruction,U.inserted],color:hH},{tag:[U.special(U.string),U.regexp],color:`#d16969`},{tag:U.string,color:hH},{tag:U.definition(U.typeName),color:pH,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:lH},{tag:U.meta,color:cH},{tag:U.comment,fontStyle:`italic`,color:vH},{tag:U.docComment,fontStyle:`italic`,color:vH},{tag:[U.tagName],color:dH},{tag:[U.attributeName],color:fH},{tag:[U.heading],fontWeight:`bold`,color:dH},{tag:U.heading1,color:dH,fontWeight:`bold`},{tag:U.heading2,color:dH},{tag:U.heading3,color:dH},{tag:U.heading4,color:dH},{tag:U.heading5,color:dH},{tag:U.heading6,color:dH},{tag:[U.strong],fontWeight:`bold`,color:dH},{tag:[U.emphasis],fontStyle:`italic`,color:pH},{tag:[U.link],color:YNe,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:TH,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:lH,textDecoration:`underline wavy`,borderBottom:`1px wavy ${yH}`},{tag:[U.strikethrough],color:yH,textDecoration:`line-through`},{tag:U.constant(U.name),color:fH},{tag:U.deleted,color:yH},{tag:U.squareBracket,color:lH},{tag:U.angleBracket,color:lH},{tag:U.monospace,color:lH},{tag:[U.contentSeparator],color:lH},{tag:U.quote,color:vH}]))],AH={fontSize:`14px`,fontFamily:`JetBrains Mono, Consolas, monospace`,lineHeight:`1.6`},ZNe={borderLeftWidth:`2px`},jH={insertedTextDecoration:`none`,deletedTextDecoration:`line-through`,insertedLinePadding:`1px 3px`,borderRadious:`3px`},MH={paddingRight:`8px`,fontSize:`0.9em`,fontWeight:`500`,lineHeight:`1.78`},NH={borderRadius:`4px`,padding:`2px 10px`},QNe={borderRadius:`2px`},PH={borderRadius:`2px`},FH={borderRadius:`4px`,padding:`0 5px`,margin:`0 2px`},IH={width:`12px`,height:`12px`,borderRadius:`6px`},LH={borderRadius:`4px`,padding:`2px 6px`},RH={borderRadius:`4px`,borderRadiusSelected:`3px`,lineHeight:`1.3`,padding:`4px 8px`,paddingRight:`8px`},$Ne=`#ffffff`,zH=`#f3f3f3`,BH=`#d6d6d6`,VH=`#6b6b6b`,ePe=`#000000`,HH=`#383a42`,UH=`#1f1f1f`,tPe=`#f5f5f5`,WH=`#0064ff`,GH=`#af00db`,KH=`#0070c1`,qH=`#267f99`,JH=`#795e26`,nPe=`#098658`,YH=`#a31515`,XH=`#e51400`,ZH=`#795e26`,QH=`#008000`,$H=XH,eU=`#99999926`,tU=$Ne,nU=zH,rPe=`#add6ff`,iPe=`#a8ac9480`,rU=ePe,aPe=`#007acc20`,oPe=`#007acc`,iU=`#bf8803`,aU=`#006ab1`,sPe=`#9e46d0`,oU=`#ddfbe0`,sU=`#ffebec`,cU=`#22863a`,lU=`#e51400`,cPe=[Ht.theme({"&":{color:HH,backgroundColor:tU,fontSize:AH.fontSize,fontFamily:AH.fontFamily},".cm-content":{caretColor:rU,lineHeight:AH.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:rU,borderLeftWidth:ZNe.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${rU}99`,color:tU},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:rPe},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:`#bbdefb`,outline:`1px solid ${KH}90`,color:UH,borderRadius:LH.borderRadius},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#90caf9`,color:UH,padding:LH.padding,"& span":{color:UH}},".cm-search.cm-panel.cm-textfield":{color:HH,borderRadius:LH.borderRadius,padding:LH.padding},".cm-panels":{backgroundColor:zH,color:HH,borderRadius:`3px`,boxShadow:`0 2px 6px rgba(0, 0, 0, 0.15)`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${BH}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${BH}`},".cm-panel button":{backgroundColor:tU,color:HH,border:`1px solid ${BH}`,borderRadius:NH.borderRadius,padding:NH.padding},".cm-panel button:hover":{backgroundColor:`#e8e8e8`,border:`1px solid ${VH}80`},".cm-activeLine":{backgroundColor:eU,borderRadius:QNe.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:tPe,color:`#237893`,border:`none`,borderRight:`1px solid ${BH}`,paddingRight:MH.paddingRight},".cm-activeLineGutter":{backgroundColor:eU,color:`#0b216f`,fontWeight:MH.fontWeight},".cm-lineNumbers":{fontSize:MH.fontSize,lineHeight:MH.lineHeight},".cm-foldGutter":{fontSize:MH.fontSize,lineHeight:MH.lineHeight},".cm-foldGutter .cm-gutterElement":{color:`#237893`,cursor:`pointer`},".cm-foldGutter .cm-gutterElement:hover":{color:`#0b216f`},".cm-insertedLine":{textDecoration:jH.insertedTextDecoration,backgroundColor:oU,color:cU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:jH.insertedTextDecoration,backgroundColor:`${oU} !important`,color:cU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious,border:`1px solid ${cU}40`},"ins.cm-insertedLine .cm-changedText":{background:`transparent !important`},".cm-deletedLine":{textDecoration:jH.deletedTextDecoration,backgroundColor:sU,color:lU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:jH.deletedTextDecoration,backgroundColor:`${sU} !important`,color:lU,padding:jH.insertedLinePadding,borderRadius:jH.borderRadious,border:`1px solid ${lU}40`},"del .cm-deletedText, del .cm-changedText":{background:`transparent !important`},".cm-tooltip":{backgroundColor:nU,border:`1px solid ${BH}`,borderRadius:RH.borderRadius,padding:RH.padding,boxShadow:`0 2px 8px rgba(0, 0, 0, 0.15)`},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:nU,border:`none`,maxHeight:`300px`},"& > ul > li":{padding:RH.padding,lineHeight:RH.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:`#dcebfc`,color:UH,borderRadius:RH.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:VH,paddingRight:RH.paddingRight},"& > ul > li > span.cm-completionDetail":{color:VH,fontStyle:`italic`}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:nU,borderBottomColor:nU},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${$H}`},"&-warning":{borderLeft:`3px solid ${iU}`},"&-info":{borderLeft:`3px solid ${aU}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${$H}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${iU}`},".cm-matchingBracket":{backgroundColor:aPe,outline:`1px solid ${oPe}80`,borderRadius:PH.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${XH}20`,outline:`1px solid ${$H}`,borderRadius:PH.borderRadius},".cm-selectionMatch":{backgroundColor:iPe,outline:`1px solid ${BH}70`,borderRadius:PH.borderRadius},".cm-foldPlaceholder":{backgroundColor:nU,color:VH,border:`1px dotted ${VH}70`,borderRadius:FH.borderRadius,padding:FH.padding,margin:FH.margin},"&.cm-focused":{outline:`none`,boxShadow:`0 0 0 1px ${BH}`},"& .cm-scroller::-webkit-scrollbar":{width:IH.width,height:IH.height},"& .cm-scroller::-webkit-scrollbar-track":{background:tU},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:`#dadada`,borderRadius:IH.borderRadius,border:`3px solid ${tU}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:`#cccccc`},".cm-ghostText":{opacity:`0.5`,color:VH}},{dark:!1}),Pt(Jt.define([{tag:U.keyword,color:WH,fontWeight:`bold`},{tag:U.controlKeyword,color:GH,fontWeight:`bold`},{tag:U.moduleKeyword,color:WH,fontWeight:`bold`},{tag:[U.name,U.deleted,U.character,U.macroName],color:HH},{tag:[U.variableName],color:KH},{tag:[U.propertyName],color:KH,fontStyle:`normal`},{tag:[U.typeName],color:qH},{tag:[U.className],color:qH,fontStyle:`normal`},{tag:[U.namespace],color:HH,fontStyle:`normal`},{tag:[U.operator,U.operatorKeyword],color:HH},{tag:[U.bracket],color:HH},{tag:[U.brace],color:HH},{tag:[U.punctuation],color:HH},{tag:[U.function(U.variableName)],color:JH},{tag:[U.labelName],color:JH,fontStyle:`normal`},{tag:[U.definition(U.function(U.variableName))],color:JH},{tag:[U.definition(U.variableName)],color:KH},{tag:U.number,color:nPe},{tag:U.changed,color:ZH},{tag:U.annotation,color:ZH,fontStyle:`italic`},{tag:U.modifier,color:WH,fontStyle:`normal`},{tag:U.self,color:WH},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:KH},{tag:[U.atom,U.bool,U.special(U.variableName)],color:WH},{tag:[U.processingInstruction,U.inserted],color:YH},{tag:[U.special(U.string),U.regexp],color:GH},{tag:U.string,color:YH},{tag:U.definition(U.typeName),color:qH,fontWeight:`bold`},{tag:[U.definition(U.name),U.separator],color:HH},{tag:U.meta,color:VH},{tag:U.comment,fontStyle:`italic`,color:QH},{tag:U.docComment,fontStyle:`italic`,color:QH},{tag:[U.tagName],color:WH},{tag:[U.attributeName],color:KH},{tag:[U.heading],fontWeight:`bold`,color:WH},{tag:U.heading1,color:WH,fontWeight:`bold`},{tag:U.heading2,color:WH},{tag:U.heading3,color:WH},{tag:U.heading4,color:WH},{tag:U.heading5,color:WH},{tag:U.heading6,color:WH},{tag:[U.strong],fontWeight:`bold`,color:WH},{tag:[U.emphasis],fontStyle:`italic`,color:KH},{tag:[U.link],color:sPe,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[U.url],color:aU,textDecoration:`underline`,textUnderlineOffset:`2px`},{tag:[U.invalid],color:HH,textDecoration:`underline wavy`,borderBottom:`1px wavy ${$H}`},{tag:[U.strikethrough],color:$H,textDecoration:`line-through`},{tag:U.constant(U.name),color:KH},{tag:U.deleted,color:$H},{tag:U.squareBracket,color:HH},{tag:U.angleBracket,color:HH},{tag:U.monospace,color:HH},{tag:[U.contentSeparator],color:HH},{tag:U.quote,color:QH}]))];function uU(){return uU=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},uU.apply(null,arguments)}function lPe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var dU=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,fU=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(dU(e)):dU,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Pn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=mn(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Bt(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(fU.prototype[Symbol.iterator]=function(){return this});var pU={from:-1,to:-1,match:/.*/.exec(``)},mU=`gm`+(/x/.unicode==null?``:`u`),hU=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=pU,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new vU(e,t,n,r,i);this.re=new RegExp(t,mU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=yU(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=yU(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},gU=new WeakMap,_U=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=gU.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return gU.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),gU.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},vU=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=pU,this.matchPos=yU(e,r),this.re=new RegExp(t,mU+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=_U.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=yU(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=_U.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(hU.prototype[Symbol.iterator]=vU.prototype[Symbol.iterator]=function(){return this});function uPe(e){try{return new RegExp(e,mU),!0}catch{return!1}}function yU(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function bU(e){let t=Dn(`input`,{class:`cm-textfield`,name:`line`,value:String(e.state.doc.lineAt(e.state.selection.main.head).number)}),n=Dn(`form`,{class:`cm-gotoLine`,onkeydown:t=>{t.keyCode==27?(t.preventDefault(),e.dispatch({effects:xU.of(!1)}),e.focus()):t.keyCode==13&&(t.preventDefault(),r())},onsubmit:e=>{e.preventDefault(),r()}},Dn(`label`,e.state.phrase(`Go to line`),`: `,t),` `,Dn(`button`,{class:`cm-button`,type:`submit`},e.state.phrase(`go`)),Dn(`button`,{name:`close`,onclick:()=>{e.dispatch({effects:xU.of(!1)}),e.focus()},"aria-label":e.state.phrase(`close`),type:`button`},[`×`]));function r(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:r}=e,i=r.doc.lineAt(r.selection.main.head),[,a,o,s,c]=n,l=s?+s.slice(1):0,u=o?+o:i.number;if(o&&c){let e=u/100;a&&(e=e*(a==`-`?-1:1)+i.number/r.doc.lines),u=Math.round(r.doc.lines*e)}else o&&a&&(u=u*(a==`-`?-1:1)+i.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u))),f=an.cursor(d.from+Math.max(0,Math.min(l,d.length)));e.dispatch({effects:[xU.of(!1),Ht.scrollIntoView(f.from,{y:`center`})],selection:f}),e.focus()}return{dom:n}}var xU=Zt.define(),SU=In.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(xU)&&(e=n.value);return e},provide:e=>Yt.from(e,e=>e?bU:null)}),dPe=e=>{let t=Cn(e,bU);if(!t){let n=[xU.of(!0)];e.state.field(SU,!1)??n.push(Zt.appendConfig.of([SU,fPe])),e.dispatch({effects:n}),t=Cn(e,bU)}return t&&t.dom.querySelector(`input`).select(),!0},fPe=Ht.baseTheme({".cm-panel.cm-gotoLine":{padding:`2px 6px 4px`,position:`relative`,"& label":{fontSize:`80%`},"& [name=close]":{position:`absolute`,top:`0`,bottom:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:`0`}}}),pPe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},CU=_n.define({combine(e){return yt(e,pPe,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function mPe(e){let t=[yPe,vPe];return e&&t.push(CU.of(e)),t}var hPe=Ln.mark({class:`cm-selectionMatch`}),gPe=Ln.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function wU(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=tn.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=tn.Word)}function _Pe(e,t,n,r){return e(t.sliceDoc(n,n+1))==tn.Word&&e(t.sliceDoc(r-1,r))==tn.Word}var vPe=Ct.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(CU),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Ln.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return Ln.none;let e=n.wordAt(i.head);if(!e)return Ln.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return Ln.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(wU(o,n,i.from,i.to)&&_Pe(o,n,i.from,i.to)))return Ln.none}else if(a=n.sliceDoc(i.from,i.to),!a)return Ln.none}let s=[];for(let r of e.visibleRanges){let e=new fU(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||wU(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(gPe.range(r,a)):(r>=i.to||a<=i.from)&&s.push(hPe.range(r,a)),s.length>t.maxMatches))return Ln.none}}return Ln.set(s)}},{decorations:e=>e.decorations}),yPe=Ht.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),bPe=({state:e,dispatch:t})=>{let{selection:n}=e,r=an.create(n.ranges.map(t=>e.wordAt(t.head)||an.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function xPe(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new fU(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new fU(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var SPe=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return bPe({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=xPe(e,r);return i?(t(e.update({selection:e.selection.addRange(an.range(i.from,i.to),!1),effects:Ht.scrollIntoView(i.to)})),!0):!1},TU=_n.define({combine(e){return yt(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new PPe(e),scrollToMatch:e=>Ht.scrollIntoView(e)})}}),EU=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||uPe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
1257
1257
  `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new EPe(this):new wPe(this)}getCursor(e,t=0,n){let r=e.doc?e:Sn.create({doc:e});return n??=r.doc.length,this.regexp?kU(this,r,t,n):OU(this,r,t,n)}},DU=class{constructor(e){this.spec=e}};function OU(e,t,n,r){return new fU(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?CPe(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CPe(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(AU(i,n-a))!=tn.Word||t(jU(i,n-a))!=tn.Word)&&(t(jU(i,r-a))!=tn.Word||t(AU(i,r-a))!=tn.Word))}var wPe=class extends DU{constructor(e){super(e)}nextMatch(e,t,n){let r=OU(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=OU(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=OU(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=OU(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=OU(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function kU(e,t,n,r){return new hU(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?TPe(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function AU(e,t){return e.slice(Nt(e,t,!1),t)}function jU(e,t){return e.slice(t,Nt(e,t))}function TPe(e){return(t,n,r)=>!r[0].length||(e(AU(r.input,r.index))!=tn.Word||e(jU(r.input,r.index))!=tn.Word)&&(e(jU(r.input,r.index+r[0].length))!=tn.Word||e(AU(r.input,r.index+r[0].length))!=tn.Word)}var EPe=class extends DU{nextMatch(e,t,n){let r=kU(this.spec,e,n,e.doc.length).next();return r.done&&(r=kU(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=kU(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=kU(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=kU(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},MU=Zt.define(),NU=Zt.define(),PU=In.define({create(e){return new FU(VU(e).create(),null)},update(e,t){for(let n of t.effects)n.is(MU)?e=new FU(n.value.create(),e.panel):n.is(NU)&&(e=new FU(e.query,n.value?BU:null));return e},provide:e=>Yt.from(e,e=>e.panel)}),FU=class{constructor(e,t){this.query=e,this.panel=t}},DPe=Ln.mark({class:`cm-searchMatch`}),OPe=Ln.mark({class:`cm-searchMatch cm-searchMatch-selected`}),kPe=Ct.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(PU))}update(e){let t=e.state.field(PU);(t!=e.startState.field(PU)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Ln.none;let{view:n}=this,r=new Mn;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?OPe:DPe)})}return r.finish()}},{decorations:e=>e.decorations});function IU(e){return t=>{let n=t.state.field(PU,!1);return n&&n.query.spec.valid?e(t,n):WU(t)}}var LU=IU((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=an.single(r.from,r.to),a=e.state.facet(TU);return e.dispatch({selection:i,effects:[YU(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),UU(e),!0}),RU=IU((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=an.single(i.from,i.to),o=e.state.facet(TU);return e.dispatch({selection:a,effects:[YU(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),UU(e),!0}),APe=IU((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:an.create(n.map(e=>an.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),jPe=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new fU(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(an.range(t.value.from,t.value.to))}return t(e.update({selection:an.create(a,o),userEvent:`select.search.matches`})),!0},zU=IU((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(Ht.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=an.single(o.from,o.to).map(d),u.push(YU(e,o)),u.push(n.facet(TU).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),MPe=IU((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:Ht.announce.of(r),userEvent:`input.replace.all`}),!0});function BU(e){return e.state.facet(TU).createPanel(e)}function VU(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(TU);return new EU({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function HU(e){let t=Cn(e,BU);return t&&t.dom.querySelector(`[main-field]`)}function UU(e){let t=HU(e);t&&t==e.root.activeElement&&t.select()}var WU=e=>{let t=e.state.field(PU,!1);if(t&&t.panel){let n=HU(e);if(n&&n!=e.root.activeElement){let r=VU(e.state,t.query.spec);r.valid&&e.dispatch({effects:MU.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[NU.of(!0),t?MU.of(VU(e.state,t.query.spec)):Zt.appendConfig.of(IPe)]});return!0},GU=e=>{let t=e.state.field(PU,!1);if(!t||!t.panel)return!1;let n=Cn(e,BU);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:NU.of(!1)}),!0},NPe=[{key:`Mod-f`,run:WU,scope:`editor search-panel`},{key:`F3`,run:LU,shift:RU,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:LU,shift:RU,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:GU,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:jPe},{key:`Mod-Alt-g`,run:dPe},{key:`Mod-d`,run:SPe,preventDefault:!0}],PPe=class{constructor(e){this.view=e;let t=this.query=e.state.field(PU).query.spec;this.commit=this.commit.bind(this),this.searchField=Dn(`input`,{value:t.search,placeholder:KU(e,`Find`),"aria-label":KU(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=Dn(`input`,{value:t.replace,placeholder:KU(e,`Replace`),"aria-label":KU(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=Dn(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=Dn(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=Dn(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return Dn(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=Dn(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>LU(e),[KU(e,`next`)]),n(`prev`,()=>RU(e),[KU(e,`previous`)]),n(`select`,()=>APe(e),[KU(e,`all`)]),Dn(`label`,null,[this.caseField,KU(e,`match case`)]),Dn(`label`,null,[this.reField,KU(e,`regexp`)]),Dn(`label`,null,[this.wordField,KU(e,`by word`)]),...e.state.readOnly?[]:[Dn(`br`),this.replaceField,n(`replace`,()=>zU(e),[KU(e,`replace`)]),n(`replaceAll`,()=>MPe(e),[KU(e,`replace all`)])],Dn(`button`,{name:`close`,onclick:()=>GU(e),"aria-label":KU(e,`close`),type:`button`},[`×`])])}commit(){let e=new EU({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:MU.of(e)}))}keydown(e){un(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?RU:LU)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),zU(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(MU)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(TU).top}};function KU(e,t){return e.state.phrase(t)}var qU=30,JU=/[\s\.,:;?!]/;function YU(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-qU),o=Math.min(i,n+qU),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<qU;e++)if(!JU.test(s[e+1])&&JU.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-qU;e--)if(!JU.test(s[e-1])&&JU.test(s[e])){s=s.slice(0,e);break}}return Ht.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var FPe=Ht.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),IPe=[PU,sn.low(kPe),FPe],XU=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},ZU=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(iW).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new Mn,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=JPe(s);if(i)o.add(n,n,Ln.widget({widget:new WPe(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,Ln.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,QU(f))}};function QU(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new XU(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new XU(r.from,n,r.diagnostic)}),r}function LPe(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(iW).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is($U))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function RPe(e,t){return e.field(nW,!1)?t:t.concat(Zt.appendConfig.of(YPe))}var $U=Zt.define(),eW=Zt.define(),tW=Zt.define(),nW=In.define({create(){return new ZU(Ln.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=QU(n,e.selected.diagnostic,i)||QU(n,null,i)}!n.size&&i&&t.state.facet(iW).autoPanel&&(i=null),e=new ZU(n,i,r)}for(let n of t.effects)if(n.is($U)){let r=t.state.facet(iW).autoPanel?n.value.length?lW.open:null:e.panel;e=ZU.init(n.value,r,t.state)}else n.is(eW)?e=new ZU(e.diagnostics,n.value?lW.open:null,e.selected):n.is(tW)&&(e=new ZU(e.diagnostics,e.panel,n.value));return e},provide:e=>[Yt.from(e,e=>e.panel),Ht.decorations.from(e,e=>e.diagnostics)]}),zPe=Ln.mark({class:`cm-lintRange cm-lintRange-active`});function BPe(e,t,n){let{diagnostics:r}=e.state.field(nW),i,a=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(iW).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:VPe(e,i)}}}:null}function VPe(e,t){return Dn(`ul`,{class:`cm-tooltip-lint`},t.map(t=>sW(e,t,!1)))}var HPe=e=>{let t=e.state.field(nW,!1);(!t||!t.panel)&&e.dispatch({effects:RPe(e.state,[eW.of(!0)])});let n=Cn(e,lW.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},rW=e=>{let t=e.state.field(nW,!1);return!t||!t.panel?!1:(e.dispatch({effects:eW.of(!1)}),!0)},UPe=[{key:`Mod-Shift-m`,run:HPe,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(nW,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],iW=_n.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...yt(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:aW,tooltipFilter:aW,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function aW(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function oW(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function sW(e,t,n){let r=n?oW(t.actions):[];return Dn(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},Dn(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=QU(e.state.field(nW).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),Dn(`u`,s.slice(c,c+1)),s.slice(c+1)];return Dn(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&Dn(`div`,{class:`cm-diagnosticSource`},t.source))}var WPe=class extends Vt{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Dn(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},cW=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=sW(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},lW=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(t.keyCode==27)rW(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=oW(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=QU(this.view.state.field(nW).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=Dn(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=Dn(`div`,{class:`cm-panel-lint`},this.list,Dn(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>rW(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(nW).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(nW),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new cW(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new cW(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=QU(this.view.state.field(nW).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:tW.of(t)})}static open(t){return new e(t)}};function GPe(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function uW(e){return GPe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var KPe=Ht.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:uW(`#d11`)},".cm-lintRange-warning":{backgroundImage:uW(`orange`)},".cm-lintRange-info":{backgroundImage:uW(`#999`)},".cm-lintRange-hint":{backgroundImage:uW(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}}});function qPe(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function JPe(e){let t=`hint`,n=1;for(let r of e){let e=qPe(r.severity);e>n&&(n=e,t=r.severity)}return t}var YPe=[nW,Ht.decorations.compute([nW],e=>{let{selected:t,panel:n}=e.field(nW);return!t||!n||t.from==t.to?Ln.none:Ln.set([zPe.range(t.from,t.to)])}),It(BPe,{hideOn:LPe}),KPe],dW=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(nee)),e.defaultKeymap!==!1&&(n=n.concat(FOe)),e.searchKeymap!==!1&&(n=n.concat(NPe)),e.historyKeymap!==!1&&(n=n.concat(UDe)),e.foldKeymap!==!1&&(n=n.concat(Lt)),e.completionKeymap!==!1&&(n=n.concat(iee)),e.lintKeymap!==!1&&(n=n.concat(UPe));var r=[];return e.lineNumbers!==!1&&r.push(nn()),e.highlightActiveLineGutter!==!1&&r.push(Wt()),e.highlightSpecialChars!==!1&&r.push(Kt()),e.history!==!1&&r.push(PDe()),e.foldGutter!==!1&&r.push(Xt()),e.drawSelection!==!1&&r.push(St()),e.dropCursor!==!1&&r.push(Et()),e.allowMultipleSelections!==!1&&r.push(Sn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&r.push(Mt()),e.syntaxHighlighting!==!1&&r.push(Pt(on,{fallback:!0})),e.bracketMatching!==!1&&r.push(xn()),e.closeBrackets!==!1&&r.push(aee()),e.autocompletion!==!1&&r.push(ree()),e.rectangularSelection!==!1&&r.push(Tn()),t!==!1&&r.push(Ut()),e.highlightActiveLine!==!1&&r.push(Gt()),e.highlightSelectionMatches!==!1&&r.push(mPe()),e.tabSize&&typeof e.tabSize==`number`&&r.push(dt.of(` `.repeat(e.tabSize))),r.concat([ut.of(n.flat())]).filter(Boolean)},XPe=`#e5c07b`,fW=`#e06c75`,ZPe=`#56b6c2`,QPe=`#ffffff`,pW=`#abb2bf`,mW=`#7d8799`,$Pe=`#61afef`,eFe=`#98c379`,hW=`#d19a66`,tFe=`#c678dd`,nFe=`#21252b`,gW=`#2c313a`,_W=`#282c34`,vW=`#353a42`,rFe=`#3E4451`,yW=`#528bff`,iFe=[Ht.theme({"&":{color:pW,backgroundColor:_W},".cm-content":{caretColor:yW},".cm-cursor, .cm-dropCursor":{borderLeftColor:yW},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:rFe},".cm-panels":{backgroundColor:nFe,color:pW},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:_W,color:mW,border:`none`},".cm-activeLineGutter":{backgroundColor:gW},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:vW},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:vW,borderBottomColor:vW},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gW,color:pW}}},{dark:!0}),Pt(Jt.define([{tag:U.keyword,color:tFe},{tag:[U.name,U.deleted,U.character,U.propertyName,U.macroName],color:fW},{tag:[U.function(U.variableName),U.labelName],color:$Pe},{tag:[U.color,U.constant(U.name),U.standard(U.name)],color:hW},{tag:[U.definition(U.name),U.separator],color:pW},{tag:[U.typeName,U.className,U.number,U.changed,U.annotation,U.modifier,U.self,U.namespace],color:XPe},{tag:[U.operator,U.operatorKeyword,U.url,U.escape,U.regexp,U.link,U.special(U.string)],color:ZPe},{tag:[U.meta,U.comment],color:mW},{tag:U.strong,fontWeight:`bold`},{tag:U.emphasis,fontStyle:`italic`},{tag:U.strikethrough,textDecoration:`line-through`},{tag:U.link,color:mW,textDecoration:`underline`},{tag:U.heading,fontWeight:`bold`,color:fW},{tag:[U.atom,U.bool,U.special(U.variableName)],color:hW},{tag:[U.processingInstruction,U.string,U.inserted],color:eFe},{tag:U.invalid,color:QPe}]))],aFe=Ht.theme({"&":{backgroundColor:`#fff`}},{dark:!1}),oFe=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:r=!1,theme:i=`light`,placeholder:a=``,basicSetup:o=!0}=e,s=[];switch(t&&s.unshift(ut.of([IOe])),o&&(typeof o==`boolean`?s.unshift(dW()):s.unshift(dW(o))),a&&s.unshift(yn(a)),i){case`light`:s.push(aFe);break;case`dark`:s.push(iFe);break;case`none`:break;default:s.push(i);break}return n===!1&&s.push(Ht.editable.of(!1)),r&&s.push(Sn.readOnly.of(!0)),[...s]},sFe=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)}),cFe=class{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`TimeoutLatch callback error:`,e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}},bW=class{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}},xW=null,lFe=()=>typeof window>`u`?new bW:(xW||=new bW,xW),SW=$t.define(),uFe=200,dFe=[];function fFe(e){var{value:t,selection:n,onChange:r,onStatistics:i,onCreateEditor:a,onUpdate:o,extensions:s=dFe,autoFocus:c,theme:l=`light`,height:u=null,minHeight:d=null,maxHeight:f=null,width:p=null,minWidth:m=null,maxWidth:h=null,placeholder:g=``,editable:_=!0,readOnly:v=!1,indentWithTab:y=!0,basicSetup:b=!0,root:x,initialState:S}=e,[C,w]=(0,G.useState)(),[T,E]=(0,G.useState)(),[D,O]=(0,G.useState)(),k=(0,G.useState)(()=>({current:null}))[0],A=(0,G.useState)(()=>({current:null}))[0],j=Ht.theme({"&":{height:u,minHeight:d,maxHeight:f,width:p,minWidth:m,maxWidth:h},"& .cm-scroller":{height:`100% !important`}}),M=[Ht.updateListener.of(e=>{e.docChanged&&typeof r==`function`&&!e.transactions.some(e=>e.annotation(SW))&&(k.current?k.current.reset():(k.current=new cFe(()=>{if(A.current){var e=A.current;A.current=null,e()}k.current=null},uFe),lFe().add(k.current)),r(e.state.doc.toString(),e)),i&&i(sFe(e))}),j,...oFe({theme:l,editable:_,readOnly:v,placeholder:g,indentWithTab:y,basicSetup:b})];return o&&typeof o==`function`&&M.push(Ht.updateListener.of(o)),M=M.concat(s),(0,G.useLayoutEffect)(()=>{if(C&&!D){var e={doc:t,selection:n,extensions:M},r=S?Sn.fromJSON(S.json,e,S.fields):Sn.create(e);if(O(r),!T){var i=new Ht({state:r,parent:C,root:x});E(i),a&&a(i,r)}}return()=>{T&&(O(void 0),E(void 0))}},[C,D]),(0,G.useEffect)(()=>{e.container&&w(e.container)},[e.container]),(0,G.useEffect)(()=>()=>{T&&(T.destroy(),E(void 0)),k.current&&=(k.current.cancel(),null)},[T]),(0,G.useEffect)(()=>{c&&T&&T.focus()},[c,T]),(0,G.useEffect)(()=>{T&&T.dispatch({effects:Zt.reconfigure.of(M)})},[l,s,u,d,f,p,m,h,g,_,v,y,b,r,o]),(0,G.useEffect)(()=>{if(t!==void 0){var e=T?T.state.doc.toString():``;if(T&&t!==e){var n=k.current&&!k.current.isDone,r=()=>{T&&t!==T.state.doc.toString()&&T.dispatch({changes:{from:0,to:T.state.doc.toString().length,insert:t||``},annotations:[SW.of(!0)]})};n?A.current=r:r()}}},[t,T]),{state:D,setState:O,view:T,setView:E,container:C,setContainer:w}}var pFe=[`className`,`value`,`selection`,`extensions`,`onChange`,`onStatistics`,`onCreateEditor`,`onUpdate`,`autoFocus`,`theme`,`height`,`minHeight`,`maxHeight`,`width`,`minWidth`,`maxWidth`,`basicSetup`,`placeholder`,`indentWithTab`,`editable`,`readOnly`,`root`,`initialState`],CW=(0,G.forwardRef)((e,t)=>{var{className:n,value:r=``,selection:i,extensions:a=[],onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,autoFocus:u,theme:d=`light`,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:v,placeholder:y,indentWithTab:b,editable:x,readOnly:S,root:C,initialState:w}=e,T=lPe(e,pFe),E=(0,G.useRef)(null),{state:D,view:O,container:k,setContainer:A}=fFe({root:C,value:r,autoFocus:u,theme:d,height:f,minHeight:p,maxHeight:m,width:h,minWidth:g,maxWidth:_,basicSetup:v,placeholder:y,indentWithTab:b,editable:x,readOnly:S,selection:i,onChange:o,onStatistics:s,onCreateEditor:c,onUpdate:l,extensions:a,initialState:w});(0,G.useImperativeHandle)(t,()=>({editor:E.current,state:D,view:O}),[E,k,D,O]);var j=(0,G.useCallback)(e=>{E.current=e,A(e)},[A]);if(typeof r!=`string`)throw Error(`value must be typeof string but got `+typeof r);return(0,K.jsx)(`div`,uU({ref:j,className:(typeof d==`string`?`cm-theme-`+d:`cm-theme`)+(n?` `+n:``)},T))});CW.displayName=`CodeMirror`;function mFe(e){if(!e)return!1;let t=e.toLowerCase();return t.endsWith(`.md`)||t.endsWith(`.markdown`)||t.endsWith(`.mdown`)||t.endsWith(`.mkd`)}function hFe(e){if(!e)return`plain`;let t=e.toLowerCase();return mFe(t)?`markdown`:t.endsWith(`.ts`)||t.endsWith(`.tsx`)?`typescript`:t.endsWith(`.js`)||t.endsWith(`.jsx`)?`javascript`:t.endsWith(`.json`)?`json`:t.endsWith(`.yml`)||t.endsWith(`.yaml`)?`yaml`:`plain`}function wW(e,t){switch(e){case`markdown`:return[jF({base:vF,codeLanguages:bje}),wDe()];case`typescript`:return[zn({typescript:!0,jsx:t?.endsWith(`.tsx`)})];case`javascript`:return[zn({jsx:t?.endsWith(`.jsx`)})];case`json`:return[VM()];case`yaml`:return[yje()];default:return[]}}function gFe(e){return e?W.matchFilename(bje,e):null}function _Fe(e,t){switch(e){case`github`:return t?Ije:rL;case`material`:return t?RMe:XMe;case`vscode`:return t?XNe:cPe;case`tokyo`:return t?LNe:DNe;case`gruvbox`:return t?uMe:wMe;case`monokai`:return aNe;case`nord`:return gNe;default:return t?Ije:rL}}function TW({value:e,onChange:t,onSaveShortcut:n,readOnly:r=!1,language:i,filename:a,lineNumbers:o=!0,lineWrapping:s=!0,fontSize:c=13,className:l=``,style:u,placeholder:d,editorMinHeight:f=`240px`}){let p=Xa(),{data:m}=op(),h=m?.codeEditor?.theme??`github`,[g,_]=(0,G.useState)([]);(0,G.useEffect)(()=>{let e=!1;if(i){_([]);return}let t=hFe(a);if(t!==`plain`){_(wW(t,a));return}let n=gFe(a);if(!n){_([]);return}if(n.support){_([n.support.extension]);return}return _([]),n.load().then(t=>{e||_([t.extension])}).catch(()=>{e||_([])}),()=>{e=!0}},[i,a]);let v=(0,G.useMemo)(()=>i?wW(i,a):g,[i,a,g]),y=(0,G.useMemo)(()=>{let e=[Sn.readOnly.of(r),...v];return e.push(_Fe(h,p)),e.push(Ht.theme({".cm-line":{lineHeight:`21px`},"&":{borderRadius:`6px`,border:`1px solid var(--code-editor-border)`,height:`100%`,minHeight:`var(--code-editor-min-height, 240px)`},".cm-content":{fontFamily:`var(--font-mono)`},".cm-gutters":{fontFamily:`var(--font-mono)`},".cm-scroller":{fontFamily:`var(--font-mono)`,overflow:`auto`,scrollbarWidth:`thin`},".cm-md-codeblock":{padding:`0`,borderRadius:0}})),e.push(ut.of([{key:`Mod-a`,run:CM},{key:`Mod-s`,preventDefault:!0,run:()=>r||!n?!1:(n(),!0)}])),s&&e.push(Ht.lineWrapping),e},[v,r,s,h,p,n]);return(0,K.jsx)(CW,{value:e,onChange:t,placeholder:d,theme:`none`,basicSetup:{lineNumbers:o,foldGutter:!r,highlightActiveLine:!r,highlightActiveLineGutter:!r,autocompletion:!r,closeBrackets:!r,bracketMatching:!r},extensions:y,className:`min-h-0 overflow-hidden ${l}`,style:{fontSize:c,"--code-editor-min-height":f,...u}})}function vFe(e){if(!e)return null;if(e.type===`point`)return{x:e.x,y:e.y};let t=e.element;if(!t)return null;let n=t.getBoundingClientRect();switch(e.placement??`bottom-start`){case`bottom-end`:return{x:n.right,y:n.bottom};case`top-start`:return{x:n.left,y:n.top};case`top-end`:return{x:n.right,y:n.top};default:return{x:n.left,y:n.bottom}}}function yFe(e,t,n){let r=n?.left??0,i=n?.top??0,a=n?.right??window.innerWidth,o=n?.bottom??window.innerHeight,s=r+12,c=i+12,l=Math.max(s,a-t.width-12),u=Math.max(c,o-t.height-12);return{x:Math.max(s,Math.min(e.x,l)),y:Math.max(c,Math.min(e.y,u))}}function bFe(e,t,n){if(e?.type!==`target`)return t;switch(e.placement??`bottom-start`){case`bottom-end`:return{x:t.x-n.width,y:t.y};case`top-start`:return{x:t.x,y:t.y-n.height};case`top-end`:return{x:t.x-n.width,y:t.y-n.height};default:return t}}function EW(e){try{return e.matches(`:popover-open`)}catch{return!1}}function DW({open:e,items:t,anchor:n,wrapperElement:r,boundaryElement:i,position:a,onClose:o}){let s=(0,G.useRef)(null),c=(0,G.useMemo)(()=>a?{type:`point`,x:a.x,y:a.y}:null,[a]),l=n??c,u=r??i??null,d=(0,G.useMemo)(()=>vFe(l),[l]),[f,p]=(0,G.useState)(null),m=`context-menu-${(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``)}`,h=(0,G.useMemo)(()=>t.filter(e=>e.label.length>0),[t]),g=e&&!!d&&h.length>0;(0,G.useLayoutEffect)(()=>{let e=s.current;e&&(g?EW(e)||e.showPopover?.():EW(e)&&e.hidePopover?.())},[g]),(0,G.useLayoutEffect)(()=>{if(!e||!d){p(null);return}let t=s.current;if(!t){p(d);return}let n=u?.getBoundingClientRect()??null,r=t.getBoundingClientRect();p(yFe(bFe(l,d,r),r,n))},[l,d,u,e]),(0,G.useEffect)(()=>{let e=()=>o();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[e,o]),(0,G.useEffect)(()=>{if(!g)return;let e=e=>{if(e.button===2)return;let t=e.target;t instanceof Node&&(s.current?.contains(t)||l?.type===`target`&&l.element?.contains(t)||o())},t=e=>{e.key===`Escape`&&o()};return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t)}},[l,o,g]),(0,G.useEffect)(()=>{if(!e||l?.type!==`target`||!l.element)return;let t=l.element,n=t.getAttribute(`data-context-menu-active`);return t.setAttribute(`data-context-menu-active`,`true`),()=>{n===null?t.removeAttribute(`data-context-menu-active`):t.setAttribute(`data-context-menu-active`,n)}},[l,e]);let _=f??d,v=_===null?{left:0,top:0}:{left:_.x,top:_.y};if(!g)return null;let y=String.raw;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`style`,{children:y`
1258
1258
  .context-menu-popover[data-context-menu-id='${m}'] {
1259
1259
  position: absolute;
@@ -1667,4 +1667,4 @@ rules:
1667
1667
  deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),ptt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=q7(),n=J7();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),mtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q7(),n=q7(),r=Y7(),i=J7();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),htt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=e9(),n=Q7(),r=J7(),i=mtt();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),gtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q7(),n=q7(),r=J7(),i=J7();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),_tt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=J7();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),vtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:Q7().validateUnion,error:{message:`must match a schema in anyOf`}}})),ytt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=q7(),n=J7();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),btt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=J7();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),xtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=q7(),n=J7(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),Stt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=J7();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),Ctt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=stt(),n=ltt(),r=ctt(),i=utt(),a=dtt(),o=ftt(),s=ptt(),c=mtt(),l=htt(),u=gtt(),d=_tt(),f=vtt(),p=ytt(),m=btt(),h=xtt(),g=Stt();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),wtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=q7();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),Ttt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[wtt().default]})),Ett=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),Dtt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Jet(),n=ott(),r=Ctt(),i=Ttt(),a=Ett();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),Ott=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),ktt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=q7(),n=Ott(),r=r9(),i=n9(),a=J7();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),Att=r({$id:()=>d9,$schema:()=>u9,default:()=>jtt,definitions:()=>p9,properties:()=>h9,title:()=>f9,type:()=>m9}),u9,d9,f9,p9,m9,h9,jtt,Mtt=n((()=>{u9=`http://json-schema.org/draft-07/schema#`,d9=`http://json-schema.org/draft-07/schema#`,f9=`Core schema meta-schema`,p9={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},m9=[`object`,`boolean`],h9={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},jtt={$schema:u9,$id:d9,title:f9,definitions:p9,type:m9,properties:h9,default:!0}})),Ntt=i(((e,n)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=Get(),i=Dtt(),a=ktt(),o=(Mtt(),t(Att).default),s=[`/properties`],c=`http://json-schema.org/draft-07/schema`,l=class extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(e,c,!1),this.refs[`http://json-schema.org/schema`]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=l,n.exports=e=l,n.exports.Ajv=l,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=l;var u=e9();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return u.KeywordCxt}});var d=q7();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return d.CodeGen}});var f=t9();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=n9();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})})),Ptt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c,l),"date-time":t(d,f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:w,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:_,int32:{type:`number`,validate:b},int64:{type:`number`,validate:x},float:{type:`number`,validate:S},double:{type:`number`,validate:S},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function c(e,t){let n=s.exec(e);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[5];return(r<=23&&i<=59&&a<=59||r===23&&i===59&&a===60)&&(!t||o!==``)}function l(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3]+(n[4]||``),t=r[1]+r[2]+r[3]+(r[4]||``),e>t?1:e<t?-1:0}var u=/t|\s/i;function d(e){let t=e.split(u);return t.length===2&&a(t[0])&&c(t[1],!0)}function f(e,t){if(!(e&&t))return;let[n,r]=e.split(u),[i,a]=t.split(u),s=o(n,i);if(s!==void 0)return s||l(r,a)}var p=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(e){return p.test(e)&&m.test(e)}var g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _(e){return g.lastIndex=0,g.test(e)}var v=-(2**31),y=2**31-1;function b(e){return Number.isInteger(e)&&e<=y&&e>=v}function x(e){return Number.isInteger(e)}function S(){return!0}var C=/[^\\]\\Z/;function w(e){if(C.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),Ftt=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;var t=Ntt(),n=q7(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>n.str`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,n._`${t}[${d.schemaCode}]`);e.fail$data(n.or(n._`typeof ${i} != "object"`,n._`${i} instanceof RegExp`,n._`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?n._`${l.code.formats}${n.getProperty(t)}`:void 0});e.fail$data(m(a))}function m(e){return n._`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),Itt=i(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=Ptt(),r=Ftt(),i=q7(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&r.default(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=i._`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),Ltt=e(Ntt(),1),Rtt=e(Itt(),1),ztt={allErrors:!0,multipleOfPrecision:8,strict:!1,verbose:!0,discriminator:!1},Btt=/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,Vtt=/^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;function Htt(e,t,n={},r,i=Ltt.default,a){let o=new i({...ztt,...n});return r?(0,Rtt.default)(o,r):r!==!1&&(0,Rtt.default)(o),o.addFormat(`data-url`,Vtt),o.addFormat(`color`,Btt),o.addKeyword(w2),o.addKeyword(z2),Array.isArray(e)&&o.addMetaSchema(e),y4(t)&&Object.keys(t).forEach(e=>{o.addFormat(e,t[e])}),a&&(o=a(o)),o}function Utt(e,t=`none`){return t===`all`?e:e.reduce((e,n)=>{let{message:r,schemaPath:i}=n,a=t===`anyOf`?void 0:i?.indexOf(`/${E2}/`),o=t===`oneOf`?void 0:i?.indexOf(`/${M2}/`),s;return a&&a>=0?s=i?.substring(0,a):o&&o>=0&&(s=i?.substring(0,o)),s&&e.find(e=>e.message===r&&e.schemaPath?.startsWith(s))||e.push(n),e},[])}function Wtt(e=[],t,n){return Utt(e.map(e=>{let{instancePath:n,keyword:r,params:i,schemaPath:a,parentSchema:o,...s}=e,{message:c=``}=s,l=n.replace(/\//g,`.`),u=`${l} ${c}`.trim(),d=``,f=[...i.deps?.split(`, `)||[],i.missingProperty,i.property].filter(e=>e);if(f.length>0)f.forEach(e=>{let n=U2($(t,`${(l?`${l}.${e}`:e).replace(/^\./,``)}`)).title;if(n===void 0&&(n=U2($(t,a.replace(/\/properties\//g,`/`).split(`/`).slice(1,-1).concat([e]))).title),n)c=c.replace(`'${e}'`,`'${n}'`),d=n;else{let t=$(o,[N2,e,`title`]);t&&(c=c.replace(`'${e}'`,`'${t}'`),d=t)}}),u=c;else{let e=U2($(t,`${l.replace(/^\./,``)}`)).title;if(e)u=`'${e}' ${c}`.trim(),d=e;else{let e=o?.title;e&&(u=`'${e}' ${c}`.trim(),d=e)}}return`missingProperty`in i&&(l=l?`${l}.${i.missingProperty}`:i.missingProperty),{name:r,property:l,message:c,params:i,stack:u,schemaPath:a,title:d}}),n)}function Gtt(e,t,n,r,i,a,o,s){let{validationError:c}=t,l=Wtt(t.errors,o,s);c&&(l=[...l,{stack:c.message}]),typeof a==`function`&&(l=a(l,o));let u=b8e(l);if(c&&(u={...u,$schema:{__errors:[c.message]}}),typeof i!=`function`)return{errors:l,errorSchema:u};let d=C5(e,r,n,r,!0),f=x8e(i(d,n4(d),o,u));return f7({errors:l,errorSchema:u},f)}var Ktt=class{constructor(e,t){this.hasRegisteredRootSchema=!1;let{additionalMetaSchemas:n,customFormats:r,ajvOptionsOverrides:i,ajvFormatOptions:a,AjvClass:o,extenderFn:s,suppressDuplicateFiltering:c}=e;this.ajv=Htt(n,r,i,a,o,s),this.localizer=t,this.suppressDuplicateFiltering=c}reset(){this.ajv.removeSchema(),this.lastSeenRootSchema=void 0,this.hasRegisteredRootSchema=!1}rawValidation(e,t){let n,r;try{e.$id&&(r=this.ajv.getSchema(e.$id)),r===void 0&&(r=this.ajv.compile(e)),r(t)}catch(e){n=e}let i;return r&&(typeof this.localizer==`function`&&((r.errors??[]).forEach(e=>{[`missingProperty`,`property`].forEach(t=>{e.params?.[t]&&(e.params[t]=`'${e.params[t]}'`)}),e.params?.deps&&(e.params.deps=e.params.deps.split(`, `).map(e=>`'${e}'`).join(`, `))}),this.localizer(r.errors),(r.errors??[]).forEach(e=>{[`missingProperty`,`property`].forEach(t=>{e.params?.[t]&&(e.params[t]=e.params[t].slice(1,-1))}),e.params?.deps&&(e.params.deps=e.params.deps.split(`, `).map(e=>e.slice(1,-1)).join(`, `))})),i=r.errors||void 0,r.errors=null),{errors:i,validationError:n}}validateFormData(e,t,n,r,i){let a=this.rawValidation(t,e);return Gtt(this,a,e,t,n,r,i,this.suppressDuplicateFiltering)}handleSchemaUpdate(e){if(this.lastSeenRootSchema===e&&this.hasRegisteredRootSchema)return;let t=e.$id??B2;this.ajv.getSchema(t)===void 0?this.ajv.addSchema(e,t):h4(e,this.ajv.getSchema(t)?.schema)||(this.ajv.removeSchema(t),this.ajv.addSchema(e,t)),this.lastSeenRootSchema=e,this.hasRegisteredRootSchema=!0}isValid(e,t,n){try{this.handleSchemaUpdate(n);let r=p7(e),i=r.$id??o8e(r),a;return a=this.ajv.getSchema(i),a===void 0&&(a=this.ajv.addSchema(r,i).getSchema(i)||this.ajv.compile(r)),a(t)}catch(e){return console.warn(`Error encountered compiling schema:`,e),!1}}};function qtt(e={},t){return new Ktt(e,t)}var Jtt=qtt(),Ytt=jet,g9=`bg-background border-border text-foreground focus:ring-primary w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`;function Xtt(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))(typeof r==`string`||typeof r==`boolean`)&&(t[n]=r);return t}function Ztt(e){return(0,K.jsx)(`input`,{id:e.id,type:`text`,value:typeof e.value==`string`?e.value:``,required:e.required,disabled:e.disabled||e.readonly,placeholder:e.placeholder,onChange:t=>e.onChange(t.target.value),onBlur:()=>e.onBlur(e.id,e.value),onFocus:()=>e.onFocus(e.id,e.value),className:g9})}function Qtt(e){return(0,K.jsx)(`textarea`,{id:e.id,value:typeof e.value==`string`?e.value:``,required:e.required,disabled:e.disabled||e.readonly,placeholder:e.placeholder,rows:5,onChange:t=>e.onChange(t.target.value),onBlur:()=>e.onBlur(e.id,e.value),onFocus:()=>e.onFocus(e.id,e.value),className:g9})}function $tt(e){return(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[(0,K.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium`,children:e.label}),(0,K.jsx)(LA,{id:e.id,checked:e.value===!0,required:e.required,disabled:e.disabled||e.readonly,onCheckedChange:t=>e.onChange(t),onBlur:()=>e.onBlur(e.id,e.value),onFocus:()=>e.onFocus(e.id,e.value)})]})}function ent(e){let t=e.options.enumOptions?.map(e=>({value:String(e.value),label:e.label}))??[];return(0,K.jsx)(W1,{id:e.id,value:typeof e.value==`string`?e.value:``,options:t,required:e.required,disabled:e.disabled||e.readonly,onValueChange:t=>e.onChange(t),onBlur:()=>e.onBlur(e.id,e.value),onFocus:()=>e.onFocus(e.id,e.value),ariaLabel:e.label,className:g9})}function tnt(e){return e.hidden?(0,K.jsx)(`div`,{className:`hidden`,children:e.children}):e.schema.type===`boolean`?(0,K.jsxs)(`div`,{className:`space-y-1`,children:[e.children,e.rawDescription&&(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.rawDescription}),e.errors]}):(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[(0,K.jsxs)(`label`,{htmlFor:e.id,children:[e.label,e.required&&(0,K.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.children,e.rawDescription&&(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.rawDescription}),e.errors]})}function nnt(e){return(0,K.jsx)(`div`,{className:`space-y-3`,children:e.properties.map(e=>(0,K.jsx)(`div`,{children:e.content},e.name))})}function rnt(){return null}function int({schema:e,uiSchema:t,values:n,onChange:r}){return(0,K.jsx)(Ytt,{schema:e,uiSchema:t,formData:n,validator:Jtt,liveValidate:!1,omitExtraData:!0,templates:(0,G.useMemo)(()=>({FieldTemplate:tnt,ObjectFieldTemplate:nnt,ErrorListTemplate:rnt,ButtonTemplates:{SubmitButton:()=>null}}),[]),widgets:(0,G.useMemo)(()=>({TextWidget:Ztt,TextareaWidget:Qtt,CheckboxWidget:$tt,SelectWidget:ent}),[]),onChange:e=>r(Xtt(e.formData))})}function ant(e,t,n){return e.find(e=>e.id===n)??t}function ont(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _9(e){return ont(e)&&e[`ui:advanced`]===!0}function snt(e,t){let n={},r={};for(let[i,a]of Object.entries(e.schema.properties)){if(!t(i))continue;n[i]=a;let o=e.uiSchema[i];ont(o)&&(r[i]=o)}return{schema:{...e.schema,properties:n,required:e.schema.required.filter(e=>e in n)},uiSchema:r}}function cnt(e){return Object.values(e.uiSchema).some(_9)}function lnt({open:e,command:t,presetValues:n,onClose:r,onCreated:i}){let a=(0,G.useId)(),{createShellSession:o}=K1(),{shellProfiles:s,defaultShellProfile:c}=x2(),[l,u]=(0,G.useState)({}),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(!1);(0,G.useEffect)(()=>{t&&(u(f2(t,n)),f(t.shellProfileId??``),m(!1))},[t,n]);let h=(0,G.useMemo)(()=>ant(s,c,d||t?.shellProfileId),[t?.shellProfileId,c,d,s]),g=(0,G.useMemo)(()=>t?h2({command:t,values:l,quoteStyle:h.quoteStyle}):``,[t,h.quoteStyle,l]),_=(0,G.useMemo)(()=>t?d2(t):null,[t]),v=(0,G.useMemo)(()=>_?cnt(_):!1,[_]),y=(0,G.useMemo)(()=>_?snt(_,e=>!_9(_.uiSchema[e])):null,[_]),b=(0,G.useMemo)(()=>_?snt(_,e=>_9(_.uiSchema[e])):null,[_]),x=(0,G.useMemo)(()=>[{value:``,label:`Default (${c.label})`},...s.map(e=>({value:e.id,label:e.label}))],[c.label,s]);return t?(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jm,{className:`text-primary h-4 w-4`}),(0,K.jsxs)(`span`,{children:[`Create `,t.label]})]}),onClose:r,onDismissRequest:null,className:`max-w-xl`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{if(!t)return;let e=o(h,{label:t.label,initialInput:`${g}\n`});e&&(i?.(e),r())},className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs`,children:[(0,K.jsx)(jm,{className:`h-3.5 w-3.5`}),`Create`]})]}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Shell`,(0,K.jsx)(W1,{value:d,options:x,onValueChange:f,ariaLabel:`Shell`})]}),y&&(0,K.jsx)(int,{schema:y.schema,uiSchema:y.uiSchema,values:l,onChange:e=>u(t=>({...t,...e}))}),v&&b&&(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":p,"aria-controls":a,onClick:()=>m(e=>!e),className:`border-border hover:bg-muted/40 flex w-full items-center justify-between gap-3 rounded-md border px-3 py-2 text-left text-xs transition-colors`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`Advanced options`}),(0,K.jsx)(Xp,{className:`h-4 w-4 shrink-0 transition-transform ${p?`rotate-180`:``}`})]}),(0,K.jsx)(`div`,{id:a,"aria-hidden":!p,inert:!p,className:`grid transition-[grid-template-rows,opacity] duration-200 ease-out ${p?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`}`,children:(0,K.jsx)(`div`,{className:`min-h-0 overflow-hidden`,children:(0,K.jsx)(`div`,{className:`border-primary/35 rounded-md border bg-[color-mix(in_srgb,var(--primary)_7%,transparent)] p-3`,children:(0,K.jsx)(int,{schema:b.schema,uiSchema:b.uiSchema,values:l,onChange:e=>u(t=>({...t,...e}))})})})})]}),(0,K.jsxs)(`div`,{className:`bg-muted/30 border-border rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground mr-1`,children:`Command:`}),(0,K.jsx)(`code`,{className:`whitespace-pre-wrap break-words`,children:g})]})]})}):(0,K.jsx)(xA,{open:e,title:`Create terminal`,onClose:r,children:(0,K.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:`Select a command first.`})})}function unt(e,t,n){return e&&t.some(t=>t.id===e)?n2(e):t[0]?n2(t[0].id):n}function dnt(e,t,n){let r=t2(e);return r?t.find(e=>e.id===r)??n:n}function fnt(e,t){let n=e2(e);return n?t.find(e=>e.id===n)??null:null}function pnt(e=1200){let[t,n]=(0,G.useState)(!1),r=(0,G.useRef)(null);return(0,G.useEffect)(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]),[t,()=>{n(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n(!1)},e)}]}function mnt(e,t){return[`inline-flex items-center justify-center gap-2 rounded-md border font-medium transition disabled:cursor-not-allowed disabled:opacity-50`,e===`sm`?`h-8 px-2.5 text-xs`:`h-10 px-4 text-sm`,t?`border-emerald-500/50 bg-emerald-500/10 text-emerald-700`:`border-border hover:bg-muted`].join(` `)}function hnt(e){return[`bg-primary text-primary-foreground inline-flex items-center justify-center gap-2 self-end rounded-md font-medium transition disabled:cursor-not-allowed disabled:opacity-50`,e===`sm`?`h-8 px-3 text-xs`:`h-10 px-4 text-sm`].join(` `)}function gnt(e){return e===`sm`?`h-8 w-full py-1.5 text-xs`:`w-full`}function _nt({preparePayload:e,onDispatched:t,onError:n,sendLabel:r=`Send`,createLabel:i=`Create`,size:a=`md`,className:o,targetSelectTestId:s=`terminal-dispatch-target-select`}){let{sessions:c,activeSessionId:l}=K1(),{spawnCommands:u}=x2(),d=(0,G.useMemo)(()=>c.filter(e=>!e.isExited),[c]),f=u[0]??null,p=(0,G.useMemo)(()=>f?r2(f.id):null,[f]),m=(0,G.useMemo)(()=>unt(l,d,p),[l,p,d]),h=(0,G.useMemo)(()=>[{label:`Shell Instances`,options:d.length>0?d.map(e=>({value:n2(e.id),label:e.displayTitle})):[{value:``,label:`No shell instances available`,disabled:!0}]},{label:`Create Shell Instance`,options:u.length>0?u.map(e=>({value:r2(e.id),label:`Create ${e.label}`})):[{value:``,label:`No spawn commands configured`,disabled:!0}]}],[d,u]),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(!1),[w,T]=pnt(),[E,D]=pnt(),[O,k]=(0,G.useState)(!1),[A,j]=(0,G.useState)({});(0,G.useEffect)(()=>{_(e=>{if(!e)return m;if(t2(e)&&u.some(t=>r2(t.id)===e))return e;let t=e2(e);return t&&d.some(e=>e.id===t)?e:m})},[d,m,u]);let M=(0,G.useMemo)(()=>dnt(g,u,f),[f,u,g]),N=async()=>{let t=i2(await e());if(t.text.trim().length===0)throw Error(`Prompt is empty.`);return t.modified&&n?.(`ANSI/control characters were stripped from generated prompt for safety.`),t.text},P=e=>{n?.($0(e))},F=async()=>{y(!0),n?.(null);try{await navigator.clipboard.writeText(await N()),T()}catch(e){P(e)}finally{y(!1)}},ee=async()=>{x(!0),n?.(null);try{await uA.addInputHistory(await N()),D()}catch(e){P(e)}finally{x(!1)}},I=async()=>{if(!g){n?.(`No live terminal session is available.`);return}C(!0),n?.(null);try{let e=await N();if(t2(g)){j({prompt:e}),k(!0);return}let n=fnt(g,d);if(!n)throw Error(`Selected terminal session is no longer available.`);if(!uA.writeToSession(n.id,jQe(e,OQe(n.processTitle))))throw Error(`Terminal session is not ready. Wait a moment and retry.`);t?.()}catch(e){P(e)}finally{C(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:[`flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between`,o??``].join(` `),children:[(0,K.jsxs)(`div`,{className:`order-2 flex items-center gap-2 sm:order-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:v,onClick:()=>void F(),className:mnt(a,w),children:[v?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):w?(0,K.jsx)(Yp,{className:`h-4 w-4`}):(0,K.jsx)(tm,{className:`h-4 w-4`}),w?`Copied`:`Copy`]}),(0,K.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void ee(),className:mnt(a,E),children:[b?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):E?(0,K.jsx)(Yp,{className:`h-4 w-4`}):(0,K.jsx)(Nm,{className:`h-4 w-4`}),E?`Saved`:`Save`]})]}),(0,K.jsxs)(`div`,{className:`order-1 flex min-w-0 items-end gap-2 sm:order-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1 sm:w-56 sm:flex-none`,children:[(0,K.jsx)(`span`,{className:a===`sm`?`text-xs font-medium`:`text-sm font-medium`,children:`Target`}),(0,K.jsx)(W1,{value:g??``,groups:h,onValueChange:e=>_(e||null),ariaLabel:`Target`,"data-testid":s,className:gnt(a)})]}),(0,K.jsxs)(`button`,{type:`button`,disabled:S||g===null,onClick:()=>void I(),className:hnt(a),children:[S?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Ale,{className:`h-4 w-4`}),S?`Sending...`:t2(g)?i:r]})]})]}),(0,K.jsx)(lnt,{open:O,command:M,presetValues:A,onClose:()=>k(!1),onCreated:t})]})}var vnt=[{value:`compose`,label:`Compose`},{value:`command`,label:`Command`}],ynt=new Set([`propose`,`apply`,`archive`]),bnt={continue:`Continue uses the selected artifact context, so compose mode is required.`,ff:`Fast-forward from a change page uses the selected ready artifact, so compose mode is required.`};function xnt(e,t){return t===`compose`||ynt.has(e)?{requestedMode:t,actualMode:t,fallbackReason:null}:{requestedMode:t,actualMode:`compose`,fallbackReason:bnt[e]??`This action requires compose mode.`}}function Snt(e){let t=e.trim();return t.length===0?[`Propose a new OpenSpec change.`,`Ask me what to build before creating files if the request is unclear.`].join(`
1668
1668
  `):[`Propose a new OpenSpec change for: ${t}`,``,'Use the OpenSpec propose workflow. If an openspec-propose skill is available, follow it. Otherwise derive a kebab-case change name, run `openspec new change "<name>"`, inspect `openspec status --change "<name>" --json`, and create every apply-required artifact using `openspec instructions <artifact-id> --change "<name>" --json`.'].join(`
1669
1669
  `)}function Cnt(e){switch(e.action){case`propose`:{let t=e.text?.trim()??``;return t.length===0?`/opsx:propose`:t.startsWith(`/opsx:`)?t:`/opsx:propose ${t}`}case`apply`:case`archive`:{let t=e.changeId?.trim();return t?`/opsx:${e.action} ${t}`:null}case`continue`:case`ff`:return null}}var wnt=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Tnt(e){let t=[`new`,`change`,e.changeName.trim()],n=e.schema.trim();n.length>0&&t.push(`--schema`,n);let r=e.description.trim();r.length>0&&t.push(`--description`,r);for(let n of e.extraArgs){let e=n.trim();e.length>0&&t.push(e)}return t}function Ent(e){return/\s/.test(e)?JSON.stringify(e):e}function Dnt(e){switch(e.kind){case`agent-prompt`:case`agent-command`:return e.text;case`cli-command`:return[e.command,...e.args].map(Ent).join(` `)}}function v9(e){let t=e.diagnostics?.filter(e=>e.level!==`info`)??[];return t.length===0?null:t.map(e=>e.message).join(`
1670
- `)}async function y9(e){return qa()?e.staticFallback():X.opsx.runWorkflow.mutate({requestedMode:e.requestedMode,input:e.workflowInput})}var Ont={continue:`Continue`,ff:`Fast-forward`,apply:`Apply`,archive:`Archive`};function knt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),{data:r}=op(),i=(0,G.useMemo)(()=>kYe(e.search),[e.search]),a=r?.opsx?.agentInvocationMode??`compose`,o=(0,G.useMemo)(()=>i?xnt(i.action,a):null,[i,a]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null);(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},dialogClassName:`overflow-hidden`,panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,920px)`,onDismissRequest:null})},[t]),(0,G.useEffect)(()=>{let e=!1;return(async()=>{if(!i){c(``),f(`Invalid compose parameters.`),u(!1);return}m(null),u(!0),f(null);try{let t=await y9({requestedMode:a,workflowInput:i.action===`continue`||i.action===`ff`?{action:i.action,changeId:i.changeId,artifactId:i.artifactId??``}:{action:i.action,changeId:i.changeId},staticFallback:()=>({kind:`agent-prompt`,text:H$(i),format:`markdown`,mode:o??{requestedMode:a,actualMode:a,fallbackReason:null}})});if(e)return;let n=i2(Dnt(t));c(n.text);let r=v9(t);r?f(r):n.modified&&f(`ANSI/control characters were stripped from generated prompt for safety.`)}catch(t){if(e)return;c(H$(i)),f($0(t))}finally{e||u(!1)}})(),()=>{e=!0}},[i,o,a]);let h=i?Ont[i.action]:`Compose`;return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsx)(`div`,{className:`border-border flex items-center justify-between gap-3 border-b px-4 py-3`,children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`font-nav truncate text-base tracking-[0.04em]`,children:[h,` Prompt`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:i?`change: ${i.changeId}`:`missing change context`})]})}),(0,K.jsxs)(`div`,{className:`flex max-h-full min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden p-4`,children:[o&&(0,K.jsxs)(`div`,{className:`bg-muted/40 border-border rounded-md border p-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Invocation:`}),` `,(0,K.jsx)(`span`,{className:`font-medium capitalize`,children:o.actualMode}),o.fallbackReason&&(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,o.fallbackReason]})]}),l&&(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Generating prompt...`]}),d&&(0,K.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm text-amber-700`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,K.jsx)(Qp,{className:`h-4 w-4`}),`Prompt source warning`]}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:d})]}),(0,K.jsxs)(`label`,{className:`flex max-h-full min-h-0 min-w-0 flex-1 flex-col gap-1.5 overflow-hidden`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Prompt`}),(0,K.jsx)(TW,{value:s,onChange:c,language:`markdown`,lineNumbers:!1,lineWrapping:!0,className:`scrollbar-thin scrollbar-track-transparent min-h-0 flex-1 overflow-auto border`,editorMinHeight:`0px`,placeholder:`Compose prompt...`})]})]}),(0,K.jsx)(`div`,{className:`border-border mt-1 border-t p-4`,children:(0,K.jsx)(_nt,{preparePayload:async()=>s,onDispatched:n,onError:m})}),p&&(0,K.jsx)(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-600`,children:p})]})}function Ant(){let{setConfig:e}=TA(),{requestClose:t}=EA(),{createDedicatedSession:n}=K1(),{data:r}=lp(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e({layout:{alignY:`start`,width:`normal`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,900px)`,onDismissRequest:null})},[e]);let v=i.trim(),y=wnt.test(v),b=v.length>0&&y,x=(0,G.useMemo)(()=>Tnt({changeName:i,schema:o,description:c,extraArgs:u}),[i,o,c,u]),S=(0,G.useMemo)(()=>b?[`openspec`,...x].map(Ent).join(` `):`openspec new change <change-name>`,[x,b]),C=r?.schemas.map(e=>e.name)??[],w=()=>{let e=f.trim();e.length!==0&&(d(t=>[...t,e]),p(``))};return(0,K.jsxs)(`form`,{className:`flex h-full min-h-0 min-w-0 flex-col`,onSubmit:e=>{e.preventDefault(),b&&(async()=>{h(null),_(!0);try{let e=await y9({requestedMode:`direct`,workflowInput:{action:`new`,changeId:v,schema:o,description:c,extraArgs:u},staticFallback:()=>({kind:`cli-command`,command:`openspec`,args:x,mode:{requestedMode:`direct`,actualMode:`direct`,fallbackReason:null}})});if(e.kind!==`cli-command`)throw Error(`Create change workflow must return a CLI command.`);let r=v,i={0:`/changes/${encodeURIComponent(r)}`};n(e.command,e.args,{closeTip:`Press any key or close action to finish this session.`,closeCallbackUrl:i});let a=Oo.getAreaForPath(`/terminal`);Bp.push(a,`/terminal`,null),t()}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}})()},children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center gap-2 border-b px-4 py-3`,children:[(0,K.jsx)(Rm,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Create OPSX Change`})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto p-4`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Change Name`}),(0,K.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`add-search-poparea`,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),v.length>0&&!y&&(0,K.jsx)(`span`,{className:`text-destructive text-xs`,children:`Use kebab-case: lowercase letters, numbers, and single hyphens.`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Schema`}),(0,K.jsx)(`input`,{list:`opsx-new-schema-options`,value:o,onChange:e=>s(e.target.value),placeholder:`(optional)`,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),(0,K.jsx)(`datalist`,{id:`opsx-new-schema-options`,children:C.map(e=>(0,K.jsx)(`option`,{value:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Description`}),(0,K.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:`(optional)`,rows:3,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`})]}),(0,K.jsxs)(`details`,{className:`group rounded-md border border-dashed`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2 text-sm font-medium`,children:`Advanced Arguments`}),(0,K.jsxs)(`div`,{className:`border-border flex flex-col gap-3 border-t px-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w())},placeholder:`--my-flag`,className:`border-input bg-background focus:ring-ring flex-1 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`border-border hover:bg-muted rounded-md border px-3 py-2 text-sm`,children:`Add`})]}),u.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.map((e,t)=>(0,K.jsxs)(`span`,{className:`bg-muted inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs`,children:[e,(0,K.jsx)(`button`,{type:`button`,onClick:()=>{d(e=>e.filter((e,n)=>n!==t))},className:`text-muted-foreground hover:text-foreground`,"aria-label":`Remove argument ${e}`,children:(0,K.jsx)(Wm,{className:`h-3 w-3`})})]},`${e}-${t}`))}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Extra args are appended at the end of the command and can override earlier flags.`})]})]}),(0,K.jsxs)(`div`,{className:`bg-muted/40 border-border rounded-md border p-3`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground mb-1 text-xs uppercase tracking-wider`,children:`Command`}),(0,K.jsx)(`code`,{className:`break-all text-xs`,children:S})]}),m&&(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:m})]}),(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-end gap-2 border-t px-4 py-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-sm`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!b||g,className:`bg-primary text-primary-foreground rounded-md px-3 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50`,children:g?`Creating...`:`Create`})]})]})}function jnt(){let{setConfig:e}=TA(),{requestClose:t}=EA(),{data:n}=op(),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(`compose`),[s,c]=(0,G.useState)(null),l=Vr({mutationFn:e=>X.config.update.mutate({opsx:{agentInvocationMode:e}})});(0,G.useEffect)(()=>{e({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},dialogClassName:`overflow-hidden`,panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,900px)`,onDismissRequest:null})},[e]),(0,G.useEffect)(()=>{let e=n?.opsx?.agentInvocationMode;e&&o(e)},[n?.opsx?.agentInvocationMode]);let u=(0,G.useMemo)(()=>a===`command`?Cnt({action:`propose`,text:r})??`/opsx:propose`:Snt(r),[r,a]);return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Rm,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Quick Propose`})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Oo.activatePop(`/opsx-new`),className:`border-border hover:bg-muted inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs`,title:`Open advanced /opsx:new form`,children:[`Advanced`,(0,K.jsx)(Kp,{className:`h-3.5 w-3.5`})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 p-4`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Enter your idea, then send it to the selected terminal.`}),(0,K.jsx)(wj,{value:a,onChange:e=>{o(e),l.mutate(e)},options:vnt}),(0,K.jsx)(TW,{value:r,onChange:i,filename:`opsx-propose.md`,placeholder:`e.g. add workspace kanban support for active changes`,editorMinHeight:`180px`}),(0,K.jsxs)(`div`,{className:`bg-muted/30 border-border rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground mr-1`,children:`Invocation:`}),(0,K.jsx)(`code`,{className:`whitespace-pre-wrap break-words`,children:u})]}),s&&(0,K.jsx)(`div`,{className:`text-destructive text-xs`,children:s})]}),(0,K.jsx)(`div`,{className:`border-border flex flex-col gap-3 border-t px-4 py-3`,children:(0,K.jsx)(_nt,{preparePayload:async()=>{let e=await y9({requestedMode:a,workflowInput:{action:`propose`,text:r},staticFallback:()=>a===`command`?{kind:`agent-command`,text:Cnt({action:`propose`,text:r})??`/opsx:propose`,mode:{requestedMode:a,actualMode:a,fallbackReason:null}}:{kind:`agent-prompt`,text:Snt(r),format:`markdown`,mode:{requestedMode:a,actualMode:a,fallbackReason:null}}}),t=v9(e);return t&&c(t),Dnt(e)},onDispatched:t,onError:c,size:`sm`,targetSelectTestId:`opsx-propose-target-select`})})]})}function Mnt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),{lines:r,status:i,commands:a,hasStarted:o,reset:s,cancel:c}=FA(),[l,u]=(0,G.useState)(!0),[d,f]=(0,G.useState)(null),p=(0,G.useMemo)(()=>new URLSearchParams(e.search).get(`change`)?.trim()??``,[e.search]);return(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`normal`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(82dvh,760px)`,onDismissRequest:null})},[t]),(0,G.useEffect)(()=>{!p||o||(async()=>{f(null);try{let e=[`validate`,p,`--type`,`change`];l&&e.push(`--strict`);let t=await y9({requestedMode:`direct`,workflowInput:{action:`verify`,changeId:p,strict:l},staticFallback:()=>({kind:`cli-command`,command:`openspec`,args:e,mode:{requestedMode:`direct`,actualMode:`direct`,fallbackReason:null}})});if(t.kind!==`cli-command`)throw Error(`Verify workflow must return a CLI command.`);let n=v9(t);n&&f(n),a.replaceAll([{command:t.command,args:t.args}]),a.runAll()}catch(e){f(e instanceof Error?e.message:String(e))}})()},[p,a,o,l]),(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Im,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Verify Change`})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(LA,{checked:l,onCheckedChange:u,ariaLabel:`Strict`,disabled:i===`running`}),`Strict`]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 p-4`,children:[p?(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Running validation for `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:p}),`.`]}):(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:`Missing change id. Open Verify from a change page.`}),d&&(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:d}),(0,K.jsx)(IA,{lines:r,maxHeight:`56vh`})]}),(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-t px-4 py-3`,children:[(0,K.jsx)(`div`,{className:`text-xs`,children:i===`success`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-600`,children:[(0,K.jsx)($p,{className:`h-3.5 w-3.5`}),`Verification completed`]}):i===`running`?(0,K.jsxs)(`span`,{className:`text-muted-foreground inline-flex items-center gap-1`,children:[(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}),`Running...`]}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Ready`})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{c(),s(),n()},className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Close`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{p&&s()},disabled:!p||i===`running`,className:`bg-primary text-primary-foreground rounded-md px-3 py-1.5 text-xs disabled:opacity-50`,children:`Re-run`})]})]})]})}var Nnt=null,b9=null,x9=null;function Pnt(e){return(e instanceof Error?e.message:String(e)).includes(`No "subscription"-procedure on path "search.subscribe"`)}async function Fnt(){return Nnt||b9||(b9=(async()=>{let e=new YVe;try{let t=await doe();return await e.init(t),Nnt=e,e}catch(t){throw await e.dispose().catch(()=>{}),t}finally{b9=null}})(),b9)}function Int(e,t=50){let[n,r]=(0,G.useState)({data:[],isLoading:!1,error:null}),i=(0,G.useMemo)(()=>e.trim(),[e]);return(0,G.useEffect)(()=>{let e=!0;if(i.length===0)return r({data:[],isLoading:!1,error:null}),()=>{e=!1};if(r(e=>({...e,isLoading:!0,error:null})),qa())return Fnt().then(e=>e.search({query:i,limit:t})).then(t=>{e&&r({data:t,isLoading:!1,error:null})}).catch(t=>{e&&r({data:[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})}),()=>{e=!1};let n=null,a=()=>{n?.unsubscribe(),n=null},o=()=>{let a=()=>{X.search.query.query({query:i,limit:t}).then(t=>{e&&r({data:t,isLoading:!1,error:null})}).catch(t=>{e&&r({data:[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})})};a(),n=X.realtime.onFileChange.subscribe(void 0,{onData:()=>{e&&a()},onError:t=>{e&&r({data:[],isLoading:!1,error:t})}})};if(x9===!1)return o(),()=>{e=!1,a()};let s=X.search.subscribe.subscribe({query:i,limit:t},{onData:t=>{x9=!0,e&&r({data:t,isLoading:!1,error:null})},onError:t=>{if(Pnt(t)){if(x9=!1,!e)return;o();return}e&&r({data:[],isLoading:!1,error:t})}});return()=>{e=!1,s.unsubscribe(),a()}},[t,i]),n}var Lnt=150;function Rnt(e){return e===`spec`?sm:e===`change`?gm:Up}function znt(e){let t=e.trim();if(t.length===0)return`/search`;let n=new URLSearchParams;return n.set(`query`,t),`/search?${n.toString()}`}function Bnt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function S9(e,t){if(!e||t.length===0)return e;let n=t.map(e=>Bnt(e)).join(`|`);if(!n)return e;let r=RegExp(`(${n})`,`gi`);return e.split(r).map((e,n)=>t.some(t=>t.toLowerCase()===e.toLowerCase())?(0,K.jsx)(`mark`,{className:`text-foreground rounded bg-amber-400/35 px-[1px]`,children:e},n):(0,K.jsx)(`span`,{children:e},n))}function Vnt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),r=(0,G.useMemo)(()=>new URLSearchParams(e.search).get(`query`)??``,[e.search]),[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(r);(0,G.useEffect)(()=>{a(r),s(r)},[r]),(0,G.useEffect)(()=>{let e=setTimeout(()=>s(i),Lnt);return()=>clearTimeout(e)},[i]);let{data:c,isLoading:l,error:u}=Int(o),d=(0,G.useMemo)(()=>i.trim().split(/\s+/).filter(e=>e.length>0).map(e=>e.toLowerCase()).sort((e,t)=>t.length-e.length),[i]);return(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(88dvh,920px)`,onDismissRequest:void 0})},[t]),(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col gap-4 p-3 sm:p-4`,children:[(0,K.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2`}),(0,K.jsx)(`input`,{autoFocus:!0,value:i,onChange:t=>{let n=t.target.value;a(n),Oo.replace(`pop`,znt(n),e.state)},placeholder:`Search specs, changes, archive...`,className:`border-input bg-background focus:ring-ring w-full rounded-md border py-2 pl-9 pr-3 text-sm focus:outline-none focus:ring-2`})]}),l&&(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Searching...`]}),u&&(0,K.jsx)(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/5 p-3 text-sm text-red-600`,children:u.message}),!l&&!u&&i.trim().length>0&&c.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground rounded-md border p-6 text-center text-sm`,children:[`No results for “`,i.trim(),`”.`]}),c.length>0&&(0,K.jsx)(`ul`,{className:`border-border divide-border min-h-0 w-full min-w-0 flex-1 divide-y overflow-y-auto rounded-md border`,children:c.map(e=>(0,K.jsx)(`li`,{className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,className:`hover:bg-muted/50 flex w-full min-w-0 flex-col items-start gap-2 p-3 text-left`,onClick:()=>{let t=Oo.getAreaForPath(e.href);Bp.push(t,e.href,null),n()},children:[(0,K.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Rnt(e.kind),{className:`text-muted-foreground h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium`,children:S9(e.title,d)})]}),(0,K.jsx)(`span`,{className:`text-muted-foreground shrink-0 text-[11px] uppercase`,children:e.kind})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground w-full break-all text-xs`,children:S9(e.path,d)}),(0,K.jsx)(`div`,{className:`text-muted-foreground line-clamp-3 w-full break-words text-xs`,children:S9(e.snippet,d)})]})},e.documentId))})]})}function Hnt({path:e,className:t=``}){let[n,r]=(0,G.useState)(!1);return(0,K.jsxs)(`button`,{onClick:(0,G.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error(`Failed to copy path:`,e)}},[e]),className:`hover:bg-muted/50 group -m-2 flex cursor-pointer items-start gap-2 rounded p-2 text-left transition-colors ${t}`,title:`Click to copy`,children:[(0,K.jsx)(`code`,{className:`bg-muted h-7 flex-1 break-all rounded px-2 py-1 font-mono text-sm`,children:e}),(0,K.jsx)(`span`,{className:`text-muted-foreground group-hover:text-foreground mt-1 shrink-0 transition-colors`,children:n?(0,K.jsx)(Yp,{className:`h-4 w-4 text-green-500`}):(0,K.jsx)(tm,{className:`h-4 w-4`})})]})}var C9=.01,Unt=160;function w9(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}function Wnt(e){return Number((Math.round(w9(e)/C9)*C9).toFixed(2))}function Gnt(e){try{return e.matches(`:popover-open`)}catch{return!1}}function Knt({label:e,value:t,onChange:n,disabled:r}){let i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),f=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),p=Math.round(w9(t)*100),m=(0,G.useCallback)(e=>{n(w9(Wnt(e)))},[n]),h=(0,G.useCallback)(e=>{m(t+(e>0?-1:1)*C9)},[m,t]),g=(0,G.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect();d({left:Math.min(window.innerWidth-52-8,Math.max(8,t.right-52)),top:Math.min(window.innerHeight-156,Math.max(8,t.bottom+6))})},[]),_=(0,G.useCallback)(()=>{r||(l(!0),g())},[r,g]),v=(0,G.useCallback)(()=>{s.current||l(!1)},[]);(0,G.useLayoutEffect)(()=>{let e=a.current;e&&(c?(g(),Gnt(e)||e.showPopover?.()):Gnt(e)&&e.hidePopover?.())},[c,g]),(0,G.useEffect)(()=>{if(!c)return;let e=e=>{let t=e.target;t instanceof Node&&(i.current?.contains(t)||a.current?.contains(t)||l(!1))},t=e=>{e.key===`Escape`&&l(!1)};return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t),window.addEventListener(`resize`,g),window.addEventListener(`scroll`,g,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,g,!0)}},[c,g]),(0,G.useEffect)(()=>{r&&l(!1)},[r]),(0,G.useEffect)(()=>{let e=e=>{e.preventDefault(),h(e.deltaY)},t={passive:!1},n=i.current,r=a.current;return n?.addEventListener(`wheel`,e,t),r?.addEventListener(`wheel`,e,t),()=>{n?.removeEventListener(`wheel`,e),r?.removeEventListener(`wheel`,e)}},[h,c]);let y=e=>{let t=o.current;if(!t)return null;let n=t.getBoundingClientRect();return n.height<=0?null:1-(e-n.top)/n.height},b=e=>{r||(e.preventDefault(),_(),s.current={startY:e.clientY,startValue:w9(t)},e.currentTarget.setPointerCapture?.(e.pointerId))},x=e=>{if(r)return;e.preventDefault(),_();let n=y(e.clientY),i=n===null?w9(t):Wnt(n);m(i),s.current={startY:e.clientY,startValue:i},e.currentTarget.setPointerCapture?.(e.pointerId)},S=e=>{let t=s.current;if(!t)return;let n=(t.startY-e.clientY)/Unt;m(t.startValue+n)},C=e=>{s.current&&(s.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId))},w=u?{left:u.left,top:u.top}:{left:0,top:0};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:i,type:`button`,onClick:_,onPointerDown:b,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onMouseEnter:_,disabled:r,className:bh(`bg-primary text-primary-foreground hover:bg-primary/90 border-l-primary-foreground/30 inline-flex h-9 w-[1.125rem] shrink-0 touch-none select-none items-center justify-center border-l transition`,`disabled:cursor-not-allowed disabled:opacity-50`),"aria-controls":`sound-volume-popover-${f}`,"aria-expanded":c,"aria-label":`Adjust ${e} volume`,title:`${e} volume: ${p}%`,children:(0,K.jsx)(ile,{className:`h-3 w-3`,"aria-hidden":`true`})}),c&&(0,K.jsxs)(`div`,{id:`sound-volume-popover-${f}`,ref:a,popover:`manual`,role:`slider`,"aria-label":`${e} volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":p,tabIndex:-1,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onMouseLeave:v,className:`border-border bg-popover text-popover-foreground z-50 flex h-36 w-[52px] touch-none select-none flex-col items-center gap-2 rounded-md border p-2 shadow-lg`,style:{position:`fixed`,inset:`auto`,...w},children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[10px] leading-none`,children:[p,`%`]}),(0,K.jsx)(`div`,{ref:o,"data-sound-volume-track":`true`,className:`bg-muted relative min-h-0 w-2 flex-1 overflow-hidden rounded-full`,children:(0,K.jsx)(`div`,{className:`bg-primary absolute inset-x-0 bottom-0 rounded-full`,style:{height:`${p}%`}})}),(0,K.jsx)(`div`,{className:`text-muted-foreground text-[10px] leading-none`,children:`Vol`})]})]})}var qnt={label:`System Sounds`,options:[...hd.map(e=>({value:e.id,label:e.label})),{value:cd,label:`Silent`}]};function Jnt(e){let t=`/api/sounds/custom/${e.id}`,n=$a();return n?`${n}${t}`:t}function Ynt(e){return{value:gd(e.id),label:e.name}}function Xnt({value:e,defaultValue:t=ud,onValueChange:n,onPreview:r,ariaLabel:i,disabled:a,previewDisabled:o,volume:s,onVolumeChange:c,className:l=``}){let u=(0,G.useRef)(null),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(``),_=Br(tp.sounds.listCustom.queryOptions(void 0)),v=_.data??[],y=_d(e),b=y?v.find(e=>e.id===y):void 0,x=!!(y&&!b),S=p||x?dd:e,C=(0,G.useMemo)(()=>({label:`Custom Sounds`,options:[{value:dd,label:`Add sound...`},...v.map(Ynt)]}),[v]),w=(0,G.useMemo)(()=>[qnt,C],[C]),T=Vr({mutationFn:e=>X.sounds.renameCustom.mutate(e),onSuccess:async()=>{await _.refetch()}}),E=Vr({mutationFn:e=>X.sounds.deleteCustom.mutate({id:e}),onSuccess:async()=>{n(t),await _.refetch()}});(0,G.useEffect)(()=>{p||g(b?.name??``)},[p,b?.name]),(0,G.useEffect)(()=>{x&&n(t)},[t,n,x]);async function D(e){let t=new FormData;t.set(`file`,e),t.set(`name`,h.trim()||e.name.replace(/\.[^.]*$/,``)),f(!0);try{let e=$a(),r=e?`${e}/api/sounds/custom`:`/api/sounds/custom`,i=await fetch(r,{method:`POST`,body:t});if(!i.ok)throw Error(`Failed to upload sound: ${i.status}`);let a=await i.json();await _.refetch(),n(gd(a.id)),m(!1),g(a.name)}finally{f(!1)}}let O=e=>{if(e===`custom:add`){m(!0),g(``);return}m(!1),n(e)},k=()=>{if(!b)return;let e=h.trim();!e||e===b.name||T.mutate({id:gd(b.id),name:e})},A=p||d,j=A||!!b,M=b?Jnt(b):null,N=s!==void 0&&c!==void 0;return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${l}`,children:[(0,K.jsxs)(`div`,{className:`border-border bg-background inline-flex min-w-0 items-stretch overflow-hidden rounded-md border`,children:[(0,K.jsx)(W1,{value:S,groups:w,onValueChange:O,ariaLabel:i,disabled:a,className:`h-9 w-56 rounded-none border-0`,popupClassName:`min-w-56`}),A&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>u.current?.click(),disabled:a||d,className:`border-border text-foreground hover:bg-muted/30 inline-flex h-9 w-9 shrink-0 items-center justify-center border-l transition disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Upload ${i}`,title:`Upload ${i}`,children:(0,K.jsx)(ple,{className:`h-4 w-4`})}),j&&(0,K.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),onBlur:k,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:a||d||!b&&!p,placeholder:`Sound name`,className:`border-border text-foreground focus-visible:ring-primary h-9 w-40 min-w-0 border-l px-2 text-sm outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`${i} name`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(),disabled:a||o||d||e===`silent`,className:bh(`bg-primary text-primary-foreground hover:bg-primary/90 border-border inline-flex h-9 w-9 shrink-0 items-center justify-center border-l transition disabled:cursor-not-allowed disabled:opacity-50`),"aria-label":`Preview ${i}`,title:`Preview ${i}`,"data-sound-url":M??void 0,children:(0,K.jsx)(Om,{className:`h-4 w-4`})}),N&&(0,K.jsx)(Knt,{label:i,value:s,onChange:c,disabled:a||d}),(0,K.jsx)(`input`,{ref:u,type:`file`,accept:`audio/*`,className:`hidden`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&D(t)}})]}),b&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>E.mutate(gd(b.id)),disabled:a||E.isPending,className:`border-border text-muted-foreground hover:text-foreground hover:bg-muted/30 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border transition disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Remove ${i}`,title:`Remove ${i}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]})}function Znt({sound:e,volume:t,systemNotificationsEnabled:n}){let{browserSupported:r,browserPermission:i,requestBrowserPermission:a,previewSound:o}=gA(),[s,c]=(0,G.useState)(t),l=Vr({mutationFn:e=>X.config.update.mutate({notifications:e})});(0,G.useEffect)(()=>{c(t)},[t]);let u=i===`unsupported`?`Unsupported`:i===`granted`?`Granted`:i===`denied`?`Denied`:`Not requested`;return(0,K.jsxs)(`section`,{className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Jp,{className:`h-5 w-5`}),`Notifications`]}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Notification Sound`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Xnt,{value:e,defaultValue:ud,onValueChange:e=>l.mutate({sound:e}),onPreview:e=>void o(e,s),ariaLabel:`Notification Sound`,previewDisabled:e===`silent`||s===0,volume:s,onVolumeChange:e=>{c(e),l.mutate({volume:e})}}),l.isPending&&(0,K.jsx)(Em,{className:`text-muted-foreground h-4 w-4 animate-spin`})]})]}),(0,K.jsx)(`div`,{className:`border-border border-t pt-4`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enable System Notifications`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Browser support: `,r?`available`:`unavailable`,` · Permission:`,` `,u]})]}),(0,K.jsx)(Cj,{onClick:()=>void a(),disabled:!r||i===`denied`,activity:i===`granted`&&n,children:i===`granted`&&n?`Enabled`:`Request permission`})]})})]})]})}var Qnt=0;function $nt(e,t){return Qnt+=1,`custom:${e}:${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`item`}:${Date.now()}:${Qnt}`}function ert(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function trt(e){return e.join(`, `)}function T9(e){return e.trim().replace(/^-+/,``).replace(/[^a-zA-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`value`}function nrt(e){return e.builder?.kind===`shellLine`?e.builder.template||e.command:e.builder?.kind===`argv`?e.builder.parts.map(e=>e.kind===`literal`?e.value:e.kind===`booleanFlag`?`${e.flag} when {{${e.fieldId}}}`:`${e.prefix}{{${e.fieldId}}}`).join(` `):[e.command,...e.args.map(e=>e.kind===`literal`?e.value:`{{${e.fieldId}}}`)].join(` `).trim()}var rrt=a2.map(e=>({value:e,label:e}));function irt({open:e,shell:t,shellDefaults:n,onClose:r,onSave:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`posix`);return(0,G.useEffect)(()=>{e&&(o(t?.label??``),c(t?.command??``),u(trt(t?.args??[])),f(t?.quoteStyle??`posix`))},[e,t]),e?(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(K.Fragment,{children:[t?(0,K.jsx)(Nm,{className:`text-primary h-4 w-4`}):(0,K.jsx)(km,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`span`,{children:t?`Edit Shell`:`Add Shell`})]}),onClose:r,className:`max-w-2xl`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{let e=s.trim();if(!e)return;let n=a.trim()||e;i({id:t?.id??$nt(`shell`,n),label:n,command:e,args:ert(l),source:`custom`,quoteStyle:d}),r()},disabled:!s.trim(),className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs disabled:cursor-not-allowed disabled:opacity-50`,children:[t?(0,K.jsx)(Nm,{className:`h-3.5 w-3.5`}):(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),t?`Save`:`Add`]})]}),children:(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Label`,(0,K.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Shell label`,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Command`,(0,K.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:n.effectiveDefaultShell.command,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_180px]`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Args`,(0,K.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Shell args`,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Quote Style`,(0,K.jsx)(W1,{value:d,options:rrt,onValueChange:f,ariaLabel:`Quote Style`})]})]})]})}):null}function art({shellDefaults:e,shellProfiles:t,defaultShellProfile:n}){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),s=()=>{i(null),o(!0)},c=e=>{i(e),o(!0)};return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Shells`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Effective platform default: `,(0,K.jsx)(`code`,{children:e.effectiveDefaultShell.command})]})]}),(0,K.jsxs)(Cj,{size:`sm`,onClick:s,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Shell`]})]}),(0,K.jsx)(`div`,{className:`border-border divide-border overflow-hidden rounded-md border`,children:t.map(e=>{let t=e.id===n.id;return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.label}),(0,K.jsx)(`span`,{className:`text-muted-foreground rounded border px-1.5 py-0.5 text-[10px] uppercase`,children:e.source})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground truncate text-xs`,children:[e.command,e.args.length>0?` ${e.args.join(` `)}`:``]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(Cj,{variant:t?`primary`:`secondary`,activity:t,size:`sm`,className:`px-2 py-1 text-[11px]`,onClick:()=>b2.setDefaultShellProfileId(e.id),children:`Default`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`hover:bg-muted rounded p-1`,"aria-label":`Edit ${e.label}`,title:`Edit ${e.label}`,children:(0,K.jsx)(Dm,{className:`h-3.5 w-3.5`})}),e.source===`custom`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>b2.removeCustomShellProfile(e.id),className:`inline-flex items-center justify-center rounded bg-red-600 p-1 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,K.jsx)(irt,{open:a,shell:r,shellDefaults:e,onClose:()=>o(!1),onSave:e=>{b2.upsertCustomShellProfile(e)}})]})}var E9=`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`,D9=`flex min-w-0 flex-col gap-1 text-xs font-medium`,O9=`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,ort=`inline-flex h-8 w-8 items-center justify-center rounded-md bg-red-600 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500 disabled:cursor-not-allowed disabled:opacity-50`,srt=[{value:`text`,label:`Text`},{value:`textarea`,label:`Textarea`},{value:`boolean`,label:`Boolean`},{value:`select`,label:`Select`}],crt=[{value:`literal`,label:`Literal`},{value:`field`,label:`Field`},{value:`booleanFlag`,label:`Boolean Flag`}],lrt=[{value:`argv`,label:`argv`},{value:`shellLine`,label:`shellLine`}],urt=0;function k9(e){return urt+=1,`${e}:${urt}`}function drt(e){return{key:k9(`field`),id:e.id,label:e.label,type:e.type,description:e.description??e.placeholder??``,defaultValue:typeof e.defaultValue==`boolean`||typeof e.defaultValue==`string`?e.defaultValue:e.type===`boolean`?!1:``,options:e.options.join(`, `),required:e.required,advanced:e.advanced}}function frt(e){let t=e.options.split(`,`).map(e=>e.trim()).filter(Boolean);return{id:T9(e.id||e.label),label:e.label.trim()||e.id,type:e.type,description:e.description.trim()||void 0,defaultValue:e.type===`boolean`?e.defaultValue===!0:typeof e.defaultValue==`string`?e.defaultValue:``,options:t,required:e.required,advanced:e.advanced}}function A9(e){return e.kind===`literal`?{key:k9(`part`),kind:`literal`,value:e.value,fieldId:``,flag:``,prefix:``,omitWhenEmpty:!0}:e.kind===`booleanFlag`?{key:k9(`part`),kind:`booleanFlag`,value:``,fieldId:e.fieldId,flag:e.flag,prefix:``,omitWhenEmpty:!0}:{key:k9(`part`),kind:`field`,value:``,fieldId:e.fieldId,flag:``,prefix:e.prefix,omitWhenEmpty:e.omitWhenEmpty}}function prt(e){if(e.kind===`literal`){let t=e.value.trim();return t?{kind:`literal`,value:t}:null}if(e.kind===`booleanFlag`){let t=e.fieldId.trim(),n=e.flag.trim();return t&&n?{kind:`booleanFlag`,fieldId:t,flag:n}:null}let t=e.fieldId.trim();return t?{kind:`field`,fieldId:t,prefix:e.prefix,omitWhenEmpty:e.omitWhenEmpty}:null}function mrt(e){return e?.fields.length?e.fields.map(drt):[{key:k9(`field`),id:`prompt`,label:`Prompt`,type:`textarea`,description:`Prompt`,defaultValue:``,options:``,required:!1,advanced:!1}]}function hrt(e){return e?.builder?.kind===`argv`?e.builder.parts.map(A9):e?.builder?.kind===`shellLine`?[]:e?[A9({kind:`literal`,value:e.command}),...e.args.map(e=>A9(e))]:[A9({kind:`literal`,value:`claude`}),A9({kind:`field`,fieldId:`prompt`,prefix:``,omitWhenEmpty:!0})]}function grt(e){let t={};for(let n of e)n.type===`boolean`?t[n.id]=n.defaultValue===!0:typeof n.defaultValue==`string`&&n.defaultValue.length>0?t[n.id]=n.defaultValue:n.type===`select`?t[n.id]=n.options[0]??``:t[n.id]=n.id===`prompt`?`Example prompt`:`example-${n.id}`;return t}function _rt({open:e,command:t,shellProfiles:n,onClose:r,onSave:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`argv`),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(mrt(null)),[_,v]=(0,G.useState)(hrt(null));(0,G.useEffect)(()=>{e&&(o(t?.label??``),c(t?.description??``),u(t?.shellProfileId??``),f(t?.builder?.kind??`argv`),m(t?.builder?.kind===`shellLine`?t.builder.template:``),g(mrt(t)),v(hrt(t)))},[t,e]);let y=(0,G.useMemo)(()=>h.map(frt),[h]),b=(0,G.useMemo)(()=>u2(y),[y]),x=(0,G.useMemo)(()=>d===`shellLine`?{kind:`shellLine`,template:p}:{kind:`argv`,parts:_.map(prt).filter(e=>e!==null)},[d,_,p]),S=(0,G.useMemo)(()=>{if(x.kind===`argv`){let e=x.parts.find(e=>e.kind===`literal`);return e?.kind===`literal`?e.value:`command`}return p.trim().split(/\s+/)[0]||`command`},[x,p]),C=(0,G.useMemo)(()=>n.find(e=>e.id===l),[l,n]),w=(0,G.useMemo)(()=>[{value:``,label:`Default shell`},...n.map(e=>({value:e.id,label:e.label}))],[n]),T=(0,G.useMemo)(()=>y.map(e=>({value:e.id,label:e.label})),[y]),E=x.kind===`argv`?x.parts.length>0:x.template.trim().length>0,D=(0,G.useMemo)(()=>({id:t?.id??`preview`,label:a.trim()||S,description:s.trim()||void 0,command:S,args:[],fields:y,parameters:b,builder:x,shellProfileId:l||void 0,source:`custom`}),[x,t?.id,s,S,a,y,b,l]),O=(0,G.useMemo)(()=>h2({command:D,values:{...f2(D),...grt(y)},quoteStyle:C?.quoteStyle??`posix`}),[y,D,C?.quoteStyle]),k=()=>{let e=h.length+1;g(t=>[...t,{key:k9(`field`),id:`arg${e}`,label:`Arg ${e}`,type:`text`,description:``,defaultValue:``,options:``,required:!1,advanced:!1}])},A=e=>{if(e===`booleanFlag`){let t=y.find(e=>e.type===`boolean`),n=t?.id??`flag${h.length+1}`;t||g(e=>[...e,{key:k9(`field`),id:n,label:`Flag Enabled`,type:`boolean`,description:``,defaultValue:!1,options:``,required:!1,advanced:!1}]),v(t=>[...t,{key:k9(`part`),kind:e,value:``,fieldId:n,flag:`--flag`,prefix:``,omitWhenEmpty:!0}]);return}v(t=>[...t,{key:k9(`part`),kind:e,value:e===`literal`?`literal`:``,fieldId:y[0]?.id??``,flag:``,prefix:``,omitWhenEmpty:!0}])};return e?(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(K.Fragment,{children:[t?(0,K.jsx)(Nm,{className:`text-primary h-4 w-4`}):(0,K.jsx)(km,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`span`,{children:t?`Edit Command`:`Add Command`})]}),onClose:r,className:`max-w-4xl`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{let e=a.trim()||S;!e||!E||(i({id:t?.id??$nt(`command`,e),label:e,description:s.trim()||void 0,command:S,args:[],fields:y,parameters:b,builder:x,shellProfileId:l||void 0,source:`custom`}),r())},disabled:!E,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs disabled:cursor-not-allowed disabled:opacity-50`,children:[t?(0,K.jsx)(Nm,{className:`h-3.5 w-3.5`}):(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),t?`Save`:`Add`]})]}),children:(0,K.jsxs)(`div`,{className:`grid gap-5`,children:[(0,K.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_220px]`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Label`,(0,K.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Command label`,className:E9})]}),(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Shell`,(0,K.jsx)(W1,{value:l,options:w,onValueChange:u,ariaLabel:`Shell`,className:E9})]}),(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium md:col-span-2`,children:[`Description`,(0,K.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Optional description`,className:E9})]})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Parameters`}),(0,K.jsxs)(`button`,{type:`button`,onClick:k,className:O9,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Parameter`]})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:h.map((e,t)=>(0,K.jsxs)(`div`,{className:`border-border rounded-md border p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[11px] font-medium uppercase`,children:[`Parameter `,t+1]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(LA,{checked:e.advanced,onCheckedChange:e=>g(n=>n.map((n,r)=>r===t?{...n,advanced:e}:n))}),`Advanced`]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>g(e=>e.filter((e,n)=>n!==t)),className:ort,"aria-label":`Remove ${e.label||e.id}`,title:`Remove ${e.label||e.id}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[150px_minmax(0,1fr)]`,children:[(0,K.jsxs)(`label`,{className:D9,children:[`Field`,(0,K.jsx)(`input`,{value:e.id,onChange:n=>{let r=T9(e.id||e.label),i=n.target.value,a=T9(i||e.label);g(e=>e.map((e,n)=>n===t?{...e,id:i}:e)),r!==a&&v(e=>e.map(e=>e.fieldId===r?{...e,fieldId:a}:e))},placeholder:`fieldId`,className:E9})]}),(0,K.jsxs)(`label`,{className:D9,children:[`Title`,(0,K.jsx)(`input`,{value:e.label,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),placeholder:`Label`,className:E9})]}),(0,K.jsxs)(`label`,{className:`${D9} md:col-span-2`,children:[`Description`,(0,K.jsx)(`input`,{value:e.description,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,description:e.target.value}:n)),placeholder:`Shown below the rendered field`,className:E9})]})]}),(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-[180px_minmax(0,1fr)_160px]`,children:[(0,K.jsxs)(`label`,{className:D9,children:[`Control Type`,(0,K.jsx)(W1,{value:e.type,options:srt,onValueChange:e=>g(n=>n.map((n,r)=>r===t?{...n,type:e,defaultValue:e===`boolean`?!1:String(n.defaultValue)}:n)),ariaLabel:`Control Type for ${e.label||e.id}`,className:E9})]}),e.type===`textarea`?(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(`textarea`,{value:typeof e.defaultValue==`string`?e.defaultValue:``,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e.target.value}:n)),placeholder:`Default text`,rows:3,className:E9})]}):e.type===`boolean`?(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(W1,{value:e.defaultValue===!0?`true`:`false`,options:[{value:`false`,label:`false`},{value:`true`,label:`true`}],onValueChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e===`true`}:n)),ariaLabel:`Default Value for ${e.label||e.id}`,className:E9})]}):(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(`input`,{value:typeof e.defaultValue==`string`?e.defaultValue:``,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e.target.value}:n)),placeholder:e.type===`select`?`Default option`:`Default value`,className:E9})]}),(0,K.jsxs)(`label`,{className:D9,children:[`Required`,(0,K.jsxs)(`span`,{className:`border-border flex min-h-9 items-center justify-between gap-3 rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{children:`Required`}),(0,K.jsx)(LA,{checked:e.required,onCheckedChange:e=>g(n=>n.map((n,r)=>r===t?{...n,required:e}:n))})]})]})]}),e.type===`select`&&(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsxs)(`label`,{className:D9,children:[`Select Options`,(0,K.jsx)(`input`,{value:e.options,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,options:e.target.value}:n)),placeholder:`Option A, Option B`,className:E9})]})})]},e.key))})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Builder`}),(0,K.jsx)(wj,{value:d,onChange:f,options:lrt})]}),d===`shellLine`?(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Template`,(0,K.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude {{prompt}}`,rows:4,className:E9})]}):(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`literal`),className:O9,children:`Add Literal`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`field`),className:O9,children:`Add Field`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`booleanFlag`),className:O9,children:`Add Boolean Flag`})]}),_.map((e,t)=>(0,K.jsxs)(`div`,{className:`border-border grid items-end gap-3 rounded-md border p-3 md:grid-cols-[150px_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[11px] font-medium uppercase md:col-span-4`,children:[`Builder Part `,t+1]}),(0,K.jsxs)(`label`,{className:D9,children:[`Part Type`,(0,K.jsx)(W1,{value:e.kind,options:crt,onValueChange:e=>v(n=>n.map((n,r)=>r===t?{...n,kind:e}:n)),ariaLabel:`Part Type for builder part ${t+1}`,className:E9})]}),e.kind===`literal`?(0,K.jsxs)(`label`,{className:D9,children:[`Literal Value`,(0,K.jsx)(`input`,{value:e.value,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,value:e.target.value}:n)),placeholder:`claude`,className:E9})]}):(0,K.jsxs)(`label`,{className:D9,children:[`Source Field`,(0,K.jsx)(W1,{value:e.fieldId,options:T,onValueChange:e=>v(n=>n.map((n,r)=>r===t?{...n,fieldId:e}:n)),ariaLabel:`Source Field for builder part ${t+1}`,className:E9})]}),e.kind===`booleanFlag`?(0,K.jsxs)(`label`,{className:D9,children:[`Flag Token`,(0,K.jsx)(`input`,{value:e.flag,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,flag:e.target.value}:n)),placeholder:`--flag`,className:E9})]}):e.kind===`field`?(0,K.jsxs)(`label`,{className:D9,children:[`Prefix`,(0,K.jsx)(`input`,{value:e.prefix,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,prefix:e.target.value}:n)),placeholder:`Prefix`,className:E9})]}):(0,K.jsx)(`div`,{}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),className:ort,"aria-label":`Remove builder part ${t+1}`,title:`Remove builder part ${t+1}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]},e.key))]})]}),(0,K.jsxs)(`div`,{className:`bg-muted/30 border-border rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground mr-1`,children:`Preview:`}),(0,K.jsx)(`code`,{className:`whitespace-pre-wrap break-words`,children:O}),(0,K.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:nrt(D)})]})]})}):null}function vrt({spawnCommands:e,shellProfiles:t}){let[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(!1),o=()=>{r(null),a(!0)},s=e=>{r(e),a(!0)};return(0,K.jsxs)(`div`,{className:`border-border/60 space-y-2 border-t pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Spawn Commands`}),(0,K.jsxs)(`button`,{type:`button`,onClick:o,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium hover:opacity-90`,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Command`]})]}),(0,K.jsx)(`div`,{className:`border-border divide-border overflow-hidden rounded-md border`,children:e.map(e=>{let n=t.find(t=>t.id===e.shellProfileId);return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.label}),(0,K.jsx)(`span`,{className:`text-muted-foreground rounded border px-1.5 py-0.5 text-[10px] uppercase`,children:e.source})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground truncate text-xs`,children:[nrt(e),n?` · ${n.label}`:` · Default shell`]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`hover:bg-muted rounded p-1`,"aria-label":`Edit ${e.label}`,title:`Edit ${e.label}`,children:(0,K.jsx)(Dm,{className:`h-3.5 w-3.5`})}),e.source===`custom`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>b2.removeCustomSpawnCommand(e.id),className:`inline-flex items-center justify-center rounded bg-red-600 p-1 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,K.jsx)(_rt,{open:i,command:n,shellProfiles:t,onClose:()=>a(!1),onSave:e=>{b2.upsertCustomSpawnCommand(e)}})]})}function yrt(){let e=x2();return(0,K.jsxs)(`div`,{className:`border-border/70 space-y-4 rounded-md border p-3`,children:[(0,K.jsx)(art,{shellDefaults:e.shellDefaults,shellProfiles:e.shellProfiles,defaultShellProfile:e.defaultShellProfile}),(0,K.jsx)(vrt,{spawnCommands:e.spawnCommands,shellProfiles:e.shellProfiles})]})}var brt=md;function xrt(e){let t=[`init`];if(e.mode===`selected`){let n=e.selectedToolIds.filter(t=>e.cliSupportedToolIds.has(t));t.push(`--tools`,n.length>0?n.join(`,`):`none`)}else e.mode===`all`&&t.push(`--tools`,`all`);return e.profileOverride!==`default`&&t.push(`--profile`,e.profileOverride),e.force&&t.push(`--force`),t}function j9(e,t){return e.get(t)?.status??`uninitialized`}function Srt(e,t){let n=0,r=0;for(let i of t){let t=j9(e,i);t===`partial`?r+=1:t===`uninitialized`&&(n+=1)}return{newCount:n,repairCount:r}}function Crt(e){return e.newCount>0&&e.repairCount>0?`Initialize selected (${e.newCount} new, ${e.repairCount} repair)`:e.newCount>0?`Initialize selected (${e.newCount} new)`:e.repairCount>0?`Initialize selected (${e.repairCount} repair)`:`Initialize selected`}function wrt(e){return e.length>0}function Trt(e){return e.mode===`auto`?e.autoInitDisabled?{label:`Initialize (auto-detect)`,disabled:!0,title:`No project tool directories detected yet. Use selected or all instead.`,helperText:`Auto-detect only works when this project already contains tool directories such as .claude or .cursor. No project tool directories are currently detected.`}:{label:`Initialize (auto-detect)`,disabled:!1,helperText:`Auto-detect uses the tool directories already present in this project, such as .claude or .cursor.`}:e.mode===`selected`?{label:e.selectedLabel,disabled:!e.hasSelectedToolActions,title:e.hasSelectedToolActions?void 0:`Select at least one uninitialized or repairable tool first.`,helperText:`Selected mode only includes the tools marked above. Exact-match tools are not reselected because they already match the current OpenSpec profile state.`}:{label:`Initialize with all tools`,disabled:!1,helperText:`All mode initializes every OpenSpec-supported provider and repairs stale artifacts for the current profile when possible.`}}var Ert={ar:`هذه جملة قصيرة لاختبار الترجمة.`,bg:`Това е кратко изречение за тестване на превода.`,bn:`এটি অনুবাদ পরীক্ষা করার জন্য একটি ছোট বাক্য।`,cs:`Toto je krátká věta pro otestování překladu.`,da:`Dette er en kort sætning til at teste oversættelsen.`,de:`Dies ist ein kurzer Satz zum Testen der Übersetzung.`,el:`Αυτή είναι μια σύντομη πρόταση για τη δοκιμή της μετάφρασης.`,en:`My name is Sarah and I live in London.`,es:`Esta es una frase corta para probar la traducción.`,fi:`Tämä on lyhyt lause käännöksen testaamiseen.`,fr:`Ceci est une courte phrase pour tester la traduction.`,hi:`यह अनुवाद का परीक्षण करने के लिए एक छोटा वाक्य है।`,hr:`Ovo je kratka rečenica za testiranje prijevoda.`,hu:`Ez egy rövid mondat a fordítás teszteléséhez.`,id:`Ini adalah kalimat singkat untuk menguji terjemahan.`,it:`Questa è una breve frase per testare la traduzione.`,iw:`זהו משפט קצר לבדיקת התרגום.`,ja:`これは翻訳エンジンを確認するための短い文です。`,kn:`ಇದು ಅನುವಾದವನ್ನು ಪರೀಕ್ಷಿಸಲು ಒಂದು ಚಿಕ್ಕ ವಾಕ್ಯವಾಗಿದೆ.`,ko:`이 문장은 번역 엔진을 확인하기 위한 짧은 문장입니다.`,lt:`Tai trumpas sakinys vertimui patikrinti.`,mr:`हे भाषांतर तपासण्यासाठी एक छोटे वाक्य आहे.`,nl:`Dit is een korte zin om de vertaling te testen.`,no:`Dette er en liten oversettelsestest fra norsk til tysk.`,pl:`To jest krótkie zdanie do przetestowania tłumaczenia.`,pt:`Esta é uma frase curta para testar a tradução.`,ro:`Aceasta este o propoziție scurtă pentru a testa traducerea.`,ru:`Это короткое предложение для проверки перевода.`,sk:`Toto je krátka veta na otestovanie prekladu.`,sl:`To je kratek stavek za preizkus prevoda.`,sv:`Det här är en kort mening för att testa översättningen.`,ta:`இது மொழிபெயர்ப்பைச் சோதிக்க ஒரு குறுகிய வாக்கியம்.`,te:`ఇది అనువాదాన్ని పరీక్షించడానికి ఒక చిన్న వాక్యం.`,th:`นี่คือประโยคสั้น ๆ สำหรับทดสอบการแปล.`,tr:`Bu, çeviriyi test etmek için kısa bir cümledir.`,uk:`Це коротке речення для перевірки перекладу.`,vi:`Đây là một câu ngắn để kiểm tra bản dịch.`,zh:`这是一句用于验证翻译引擎的短句。`,"zh-Hant":`這是一句用來驗證翻譯引擎的短句。`},Drt=new Map(Object.entries(Ert).map(([e,t])=>[e.toLowerCase(),t]));function Ort(e){let t=e.trim().toLowerCase(),n=t.split(/[-_]/,1)[0]??t;return Drt.get(t)??Drt.get(n)??Ert.en}var M9=`zh`,N9=`direct`,P9=!1,krt=Math.round(rc/1e3),F9=`Xenova/opus-mt-no-de`,Art=`ooeoeo/opus-mt-en-zh-ct2-float16`,jrt=`bartowski/Qwen2.5-0.5B-Instruct-GGUF`,I9=`en`,Mrt=[{value:`direct`,label:`Direct`},{value:`bilingual`,label:`Bilingual`}],Nrt=new Set([`available`,`downloading`,`downloadable`]);function L9(e){return e?.table?.rows??[]}function R9(e,t=null){if(t&&e.some(e=>z9(e)===t))return t;let n=e.find(e=>e.availability===`available`);return n?z9(n):e[0]?z9(e[0]):null}function z9(e){return`${e.sourceLanguage}->${e.targetLanguage}`}function Prt(e){let t=uJ(e.sourceLanguage),n=uJ(e.targetLanguage);return`${t?.code??e.sourceLanguage} -> ${n?.code??e.targetLanguage}`}function Frt(e){let t=uJ(e.sourceLanguage),n=uJ(e.targetLanguage);return`${t?.label??e.sourceLanguage} to ${n?.label??e.targetLanguage}`}function Irt(e){return e?e.message??`Browser translation support is unavailable.`:`Browser translation support has not been checked yet.`}function B9(e){let t=e.interactive??!0;return`${e.selected?`border-solid`:`border-dashed`} ${e.tone===`downloaded`?`border-emerald-500 text-emerald-700 dark:text-emerald-400`:e.tone===`partial`?`border-sky-500 text-sky-700 dark:text-sky-400`:`border-border text-foreground`} ${t?`hover:border-current`:``}`.trim()}function Lrt(e){return e===`available`?`downloaded`:e===`downloading`?`partial`:`not-started`}function Rrt(e){return e?e.state===`checking`?`Checking browser translation support.`:e.state===`ready`?`Browser translation support is available.`:e.message??`Browser translation support is unavailable.`:`Browser translation support has not been checked yet.`}function zrt(e){return e.row?e.row.availability===`available`?`downloaded`:e.row.availability===`downloading`&&e.activeSourceLanguage===e.row.sourceLanguage?`cancel`:e.row.availability===`downloadable`?`download`:`progress`:`progress`}function Brt(e){if(!e||e.state===`idle`||e.state===`checking`)return`checking`;if(e.state!==`ready`)return`unavailable`;let t=L9(e);return t.some(e=>e.availability===`available`)?`available`:t.some(e=>Nrt.has(e.availability))?`downloadable`:`unavailable`}function Vrt(){return{sourceLanguage:I9,sourceText:``}}function Hrt(e){return Ort(e)}function Urt(e){if(!nc(e.engineId))return I9;let t=QK(e.model);return t&&$K({model:e.model,sourceLanguage:t.sourceLanguage,targetLanguage:e.targetLanguage}).supported?t.sourceLanguage:I9}function Wrt(e,t){return e&&typeof e==`object`&&`data`in e&&`isLoading`in e?{...e,data:t,isLoading:!1,isFetching:!1}:t}function Grt(e,t){let n=e=>e?.map(e=>e.id===t.engineId?{...e,lifecycle:t.lifecycle}:e);return Array.isArray(e)?n(e):e&&typeof e==`object`&&`data`in e?{...e,data:n(e.data)}:e}function Krt(...e){let t=new Map;for(let n of e)if(n)for(let e of n){let n=t.get(e.id);t.set(e.id,n?qrt(n,e):e)}return[...t.values()]}function qrt(e,t){let n=[...new Set([...e.sources,...t.sources])],r=n.includes(`recommended`)?`recommended`:n.includes(`local`)?`local`:e.primarySource===`recommended`||t.primarySource===`recommended`?`recommended`:e.primarySource===`local`||t.primarySource===`local`?`local`:`network`,i=(t.downloadGroups?.length??0)>(e.downloadGroups?.length??0)?t.downloadGroups:e.downloadGroups,a=t.local||(t.asset.progress??0)>(e.asset.progress??0)?t.asset:e.asset;return{...e,...t,summary:t.primarySource===`recommended`&&e.primarySource!==`recommended`?t.summary:e.summary,downloads:Math.max(e.downloads,t.downloads),likes:Math.max(e.likes,t.likes),trendingScore:Math.max(e.trendingScore??0,t.trendingScore??0)||void 0,downloadGroups:i,asset:a,selectable:e.selectable||t.selectable,local:e.local||t.local,primarySource:r,sources:n}}function Jrt(e){return e===`local-ct2`?Art:e===`local-llama`?jrt:F9}function Yrt(e){let t=e.engineId===`local-ct2`?e.resolvedTranslationConfig?.engines?.localCt2:e.engineId===`local-llama`?e.resolvedTranslationConfig?.engines?.localLlama:e.resolvedTranslationConfig?.engines?.local,n=e.engineId===`local-ct2`?e.globalSettings?.translationEngines?.localCt2:e.engineId===`local-llama`?e.globalSettings?.translationEngines?.localLlama:e.globalSettings?.translationEngines?.local;return{model:t?.model??n?.model??Jrt(e.engineId),selectedGroupId:t?.selectedGroupId??n?.selectedGroupId,hfEndpoint:n?.hfEndpoint??``,memoryBudgetPercent:n?.memoryBudgetPercent??25}}function Xrt(e,t){return e===`local-ct2`?{localCt2:t}:e===`local-llama`?{localLlama:t}:{local:t}}function Zrt(e,t){return e===`local-ct2`?{localCt2:t}:e===`local-llama`?{localLlama:t}:{local:t}}function Qrt(e){return e.enabled!==void 0||e.targetLanguage!==void 0||e.displayMode!==void 0||e.cacheEnabled!==void 0}function $rt(e,t){let n={},r={};return t.enabled!==void 0&&(e?.translation.enabled?n.enabled=t.enabled:r.enabled=t.enabled),t.targetLanguage!==void 0&&(e?.translation.targetLanguage?n.targetLanguage=t.targetLanguage:r.targetLanguage=t.targetLanguage),t.displayMode!==void 0&&(e?.translation.displayMode?n.displayMode=t.displayMode:r.displayMode=t.displayMode),t.cacheEnabled!==void 0&&(e?.translation.cacheEnabled?n.cacheEnabled=t.cacheEnabled:r.cacheEnabled=t.cacheEnabled),{project:n,global:r}}function eit(e,t){return t===`local-ct2`?e?.translation.engines.localCt2===!0:t===`local-llama`?e?.translation.engines.localLlama===!0:e?.translation.engines.local===!0}function tit(e){return[`translation`,`managed-local`,e.engineId,`panel-state`,e.modelId,e.selectedGroupId??``]}function nit(e){return e===`local`?X.localModels.listLocal.query():e===`local-ct2`?X.localCt2Models.listLocal.query():X.localLlamaModels.listLocal.query()}function rit(e,t,n){return e===`local`?X.localModels.searchRemoteStream.subscribe(t,n):e===`local-ct2`?X.localCt2Models.searchRemoteStream.subscribe(t,n):X.localLlamaModels.searchRemoteStream.subscribe(t,n)}function iit(e,t){return e===`local`?X.localModels.subscribeLogs.subscribe(void 0,t):e===`local-ct2`?X.localCt2Models.subscribeLogs.subscribe(void 0,t):X.localLlamaModels.subscribeLogs.subscribe(void 0,t)}function V9(e){let t={modelId:e.modelId,selectedGroupId:e.selectedGroupId};return e.engineId===`local`?X.localModels.panelState.query(t):e.engineId===`local-ct2`?X.localCt2Models.panelState.query(t):X.localLlamaModels.panelState.query(t)}function ait(e,t){return e===`local`?X.localModels.markSelected.mutate({modelId:t}):e===`local-ct2`?X.localCt2Models.markSelected.mutate({modelId:t}):X.localLlamaModels.markSelected.mutate({modelId:t})}function oit(e,t){return e===`local`?X.localModels.refreshArtifacts.mutate(t):e===`local-ct2`?X.localCt2Models.refreshArtifacts.mutate(t):X.localLlamaModels.refreshArtifacts.mutate(t)}function H9(e){let t=new Set([e.panelState.selectedGroupId,e.requestedSelectedGroupId,void 0]);for(let n of t)e.queryClient.setQueryData(tit({engineId:e.engineId,modelId:e.panelState.modelId,selectedGroupId:n}),t=>Wrt(t,e.panelState))}function sit(e){let t=e?.asset.status;return t===`queued`||t===`downloading`||t===`deleting`}async function U9(e){let t=await V9({engineId:e.engineId,modelId:e.modelId,selectedGroupId:e.requestedSelectedGroupId});return H9({engineId:e.engineId,panelState:t,queryClient:e.queryClient,requestedSelectedGroupId:e.requestedSelectedGroupId}),t}async function cit(e){let t=await oit(e.engineId,{modelId:e.modelId});return H9({engineId:e.engineId,panelState:t,queryClient:e.queryClient,requestedSelectedGroupId:e.requestedSelectedGroupId}),t}function lit({index:e}){let t=qa(),{data:n,isLoading:r}=op(),{data:i,isLoading:a}=mce(),{data:o,isLoading:s}=sp(),{data:c,refetch:l,isLoading:u,isFetching:d,error:f}=Br({...tp.translationEngines.list.queryOptions(),enabled:!t}),p=(0,G.useMemo)(()=>eY(n?.translation,o,i),[n?.translation,i,o]),{data:m,refetch:h}=Br({...tp.translationCache.stats.queryOptions(),enabled:!t&&(p?.cacheEnabled??!1)}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(M9),[b,x]=(0,G.useState)(N9),[S,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(P9),[E,D]=(0,G.useState)(gc),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(``),[ee,I]=(0,G.useState)(``),[L,R]=(0,G.useState)(`gpt-4.1-mini`),[z,te]=(0,G.useState)(F9),[B,V]=(0,G.useState)(F9),[ne,re]=(0,G.useState)(F9),[ie,ae]=(0,G.useState)(``),[oe,se]=(0,G.useState)(25),[ce,le]=(0,G.useState)(void 0),[ue,H]=(0,G.useState)([]),[de,fe]=(0,G.useState)([]),[pe,me]=(0,G.useState)(!1),[he,ge]=(0,G.useState)(!1),[_e,ve]=(0,G.useState)(!1),[ye,be]=(0,G.useState)(I9),[xe,Se]=(0,G.useState)(``),[Ce,we]=(0,G.useState)(``),[Te,Ee]=(0,G.useState)(null),[De,Oe]=(0,G.useState)(null),[ke,Ae]=(0,G.useState)(!1),[je,Me]=(0,G.useState)(krt),[Ne,Pe]=(0,G.useState)(null),[Fe,Ie]=(0,G.useState)(``),Le=Or(),Re=(0,G.useRef)(Le),ze=(0,G.useRef)(null),Be=(0,G.useRef)(null),Ve=(0,G.useRef)(null),He=(0,G.useRef)(z),Ue=(0,G.useRef)(ce),We=(0,G.useRef)(null),Ge=(0,G.useRef)(null),Ke=S??p?.engineId??null,qe=tc(Ke)?Ke:null;(0,G.useEffect)(()=>{Re.current=Le},[Le]),(0,G.useEffect)(()=>{n&&(_(p?.enabled??!1),y(p?.targetLanguage??M9),x(p?.displayMode??N9),C(p?.engineId??`browser`),T(p?.cacheEnabled??P9))},[n,p?.cacheEnabled,p?.displayMode,p?.enabled,p?.engineId,p?.targetLanguage]),(0,G.useEffect)(()=>{if(D(o?.translationCache?.entryLimit??1e4),F(o?.translationEngines?.openai?.baseUrl??``),I(o?.translationEngines?.openai?.token??``),R(p?.engines?.openai?.model??o?.translationEngines?.openai?.model??`gpt-4.1-mini`),!qe)return;let e=Yrt({engineId:qe,resolvedTranslationConfig:p,globalSettings:o});te(e.model),V(e.model),re(e.model),ae(e.hfEndpoint),se(e.memoryBudgetPercent),le(e.selectedGroupId)},[qe,n?.translation?.engines?.local?.model,n?.translation?.engines?.local?.selectedGroupId,n?.translation?.engines?.localCt2?.model,n?.translation?.engines?.localCt2?.selectedGroupId,n?.translation?.engines?.localLlama?.model,n?.translation?.engines?.localLlama?.selectedGroupId,o?.translationCache?.entryLimit,o?.translationEngines?.openai?.baseUrl,o?.translationEngines?.openai?.model,o?.translationEngines?.openai?.token,o?.translationEngines?.local?.hfEndpoint,o?.translationEngines?.local?.memoryBudgetPercent,o?.translationEngines?.local?.model,o?.translationEngines?.local?.selectedGroupId,o?.translationEngines?.localCt2?.hfEndpoint,o?.translationEngines?.localCt2?.memoryBudgetPercent,o?.translationEngines?.localCt2?.model,o?.translationEngines?.localCt2?.selectedGroupId,o?.translationEngines?.localLlama?.hfEndpoint,o?.translationEngines?.localLlama?.memoryBudgetPercent,o?.translationEngines?.localLlama?.model,o?.translationEngines?.localLlama?.selectedGroupId,p?.engines?.local?.model,p?.engines?.local?.selectedGroupId,p?.engines?.localCt2?.model,p?.engines?.localCt2?.selectedGroupId,p?.engines?.localLlama?.model,p?.engines?.localLlama?.selectedGroupId,p?.engines?.openai?.model]),(0,G.useEffect)(()=>{He.current=z},[z]),(0,G.useEffect)(()=>{Ue.current=ce},[ce]),(0,G.useEffect)(()=>{if(!qe)return;let e=window.setTimeout(()=>{re(B.trim())},300);return()=>window.clearTimeout(e)},[qe,B]),(0,G.useEffect)(()=>{if(!qe)return;let e=!1;return nit(qe).then(t=>{e||H(t.items)}).catch(()=>{e||H([])}),()=>{e=!0}},[qe]),(0,G.useEffect)(()=>{if(!qe)return;let e=`local-search-${Date.now()}-${Math.random().toString(36).slice(2)}`;if(!he){me(!1);return}me(!0);let t=rit(qe,{requestId:e,targetLanguage:v,query:ne||void 0,limit:6},{onData:t=>{t.requestId===e&&(t.items&&fe(t.items),(t.phase===`complete`||t.phase===`error`)&&me(!1))},onError:()=>{me(!1),fe([])}});return()=>{t.unsubscribe()}},[qe,ne,ie,he,v]),(0,G.useEffect)(()=>{if(t||!qe)return;let e=iit(qe,{onData:e=>{let t=Ue.current,n=He.current.trim(),r=e.modelId===n?t:e.selectedGroupId;V9({engineId:qe,modelId:e.modelId,selectedGroupId:r}).then(t=>{H9({engineId:qe,panelState:t,queryClient:Re.current,requestedSelectedGroupId:r}),e.modelId===n&&(We.current=t,le(t.selectedGroupId))}).catch(()=>void 0),nit(qe).then(e=>H(e.items)).catch(()=>void 0)},onError:()=>void 0});return()=>{e.unsubscribe()}},[qe,t]),(0,G.useEffect)(()=>{qe||(H([]),fe([]),me(!1))},[qe]);let Je=Vr({mutationFn:e=>X.config.update.mutate({translation:e}),onSuccess:async()=>{await l()}}),Ye=Vr({mutationFn:e=>X.globalSettings.update.mutate(e),onSuccess:async()=>{await l()}}),Xe=Vr({mutationFn:e=>X.translationEngines.select.mutate({engineId:e}),onSuccess:async()=>{await l()}}),Ze=(0,G.useCallback)(e=>{let t=$rt(i,e);Qrt(t.project)&&Je.mutate(t.project),Qrt(t.global)&&Ye.mutate({translation:t.global})},[i,Ye,Je]),Qe=(0,G.useCallback)((e,t)=>{if(eit(i,e)){Je.mutate({engines:Xrt(e,t)});return}Ye.mutate({translationEngines:Zrt(e,t)})},[i,Ye,Je]),$e=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.download.mutate(e):qe===`local-ct2`?X.localCt2Models.download.mutate(e):X.localLlamaModels.download.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),et=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.pause.mutate(e):qe===`local-ct2`?X.localCt2Models.pause.mutate(e):X.localLlamaModels.pause.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),tt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.resume.mutate(e):qe===`local-ct2`?X.localCt2Models.resume.mutate(e):X.localLlamaModels.resume.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),nt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.delete.mutate(e):qe===`local-ct2`?X.localCt2Models.delete.mutate(e):X.localLlamaModels.delete.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),rt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return oit(qe,e)},onSuccess:(e,t)=>{qe&&(H9({engineId:qe,panelState:e,queryClient:Le,requestedSelectedGroupId:t.modelId?Ue.current:void 0}),We.current=e)}}),it=Vr({mutationFn:()=>X.translationCache.clean.mutate()}),at=Vr({mutationFn:()=>X.translationCache.clear.mutate()}),ot=Vr({mutationFn:async e=>(Be.current?.unsubscribe(),Ie(``),await new Promise((t,n)=>{Be.current=X.translationEngines.installStream.subscribe({engineId:e},{onData:e=>{if(e.type===`status`){Pe(e.lifecycle);return}if(e.type===`log`){Ie(t=>`${t}${e.text}`);return}if(Pe(e.lifecycle),!sc(e.lifecycle)){t(e.lifecycle);return}n(Error(cc(e.lifecycle)??`Install failed.`))},onError:e=>{n(e instanceof Error?e:Error(String(e)))}})})),onSuccess:async(e,t)=>{if(Pe(e),Re.current.setQueryData(tp.translationEngines.list.queryOptions().queryKey,n=>Grt(n,{engineId:t,lifecycle:e})),tc(t)){let e=He.current.trim();if(e)try{let n=await cit({engineId:t,modelId:e,requestedSelectedGroupId:Ue.current,queryClient:Le});qe===t&&(We.current=n,le(n.selectedGroupId))}catch{}}await l()},onError:e=>{let t=e instanceof Error?e.message:String(e);Pe(oc({dependency:{state:`error`,message:`Translation engine installation failed.`,error:t},runtime:{state:`error`,error:t},summary:`Translation engine installation failed.`}))}}),st=i?.translation.engineId===!0,ct=t||n!==void 0&&i!==void 0&&(st||o!==void 0),lt=ct?S??p?.engineId??`browser`:null,ut=tc(lt)?lt:null,dt=n?n.translation?.engineId??`browser`:null,ft=(0,G.useMemo)(()=>Urt({engineId:lt,model:z,targetLanguage:v}),[lt,z,v]);(0,G.useEffect)(()=>{be(ft)},[ft]);let pt=(0,G.useCallback)(async e=>{if(t)return;let n=new AbortController;try{let t=await bJ(e,{signal:n.signal,onProgress:e=>{k(e)}});k(t);let r=L9(t);j(e=>R9(r,e))}finally{n.abort()}},[t]);(0,G.useEffect)(()=>{if(t||dt!==`browser`||lt!==`browser`)return;let e=_J(v);if(e){k(e);let t=L9(e);j(e=>R9(t,e));return}pt(v)},[t,dt,lt,pt,v]),(0,G.useEffect)(()=>{lt!==`browser`&&(ze.current?.abort(),ze.current=null,N(null))},[lt]);let mt=(0,G.useMemo)(()=>Qs.map(e=>{let n=c?.find(t=>t.id===e),r=lc(e);return{value:e,label:n?.label??r.label,disabled:t&&e!==`browser`}}),[c,t]),ht=c?.find(e=>e.id===lt),gt=lt?lc(lt):null,_t=!ht&&lt!==null&&lt!==`browser`&&(u||d),vt=(0,G.useMemo)(()=>ht?.lifecycle?ht.lifecycle:!lt||lt===`browser`||ht?null:f instanceof Error?oc({dependency:{state:`error`,message:`Failed to load translation engine status.`,error:f.message},runtime:{state:`error`,error:f.message},summary:`Failed to load translation engine status.`}):null,[lt,f,ht]),yt=ut?Zre(ut):null,bt=(0,G.useMemo)(()=>L9(O),[O]),xt=(0,G.useMemo)(()=>R9(bt,A),[bt,A]),St=(0,G.useMemo)(()=>bt.find(e=>z9(e)===xt)??null,[bt,xt]),Ct=Brt(O),wt=Irt(O),Tt=Ne&&lt===ht?.id?Ne:vt,Et=lt===`browser`?Rrt(O):_t?`Loading translation engine metadata.`:cc(Tt)??ht?.message??ht?.description??gt?.description,Dt=zrt({row:St,activeSourceLanguage:M}),Ot=St?.availability===`available`?100:Math.round((St?.progress??0)*100),kt=O?.state===`checking`,At=ut?Yrt({engineId:ut,resolvedTranslationConfig:p,globalSettings:o}):null,jt=yt?.modelLabel??`Local model`,Mt=yt?.downloadGroupsLabel??`Local download profiles`,Nt=yt?.refreshTooltip??`Refresh local model profiles`,Pt=z.trim(),Ft=ut&&Pt.length>0?`${ut}:${Pt}`:null,It=At?.selectedGroupId,U=ce??It,Lt=Br({queryKey:ut&&Pt.length>0?tit({engineId:ut,modelId:Pt,selectedGroupId:U}):[`translation`,`managed-local`,`idle`],queryFn:()=>{if(!ut)throw Error(`A managed local translation engine is required.`);return V9({engineId:ut,modelId:Pt,selectedGroupId:U})},enabled:ut!==null&&Pt.length>0}),Rt=Lt.data?.modelId===Pt?Lt.data:null;(0,G.useEffect)(()=>{if(Rt){We.current=Rt;return}(!ut||Pt.length===0)&&(We.current=null)},[ut,Pt,Rt]);let zt=We.current?.modelId===Pt?We.current:null,Bt=Rt??zt,Vt=Lt.error instanceof Error?Lt.error.message:null,Ht=(0,G.useMemo)(()=>Krt(ue,de),[ue,de]),Ut=Bt?.asset??null,Wt=Bt?.downloadPlan??Ut?.plan??null,Gt=Wt?.groups??[],Kt=Gt.find(e=>e.selected)??null,qt=Kt?.id??Bt?.selectedGroupId??Ut?.plan?.selectedGroupId??U,Jt=(Kt?.estimatedTotalBytes??Wt?.estimatedTotalBytes??0)>0,Yt=Ut,Xt=Yt?.progress===void 0?void 0:Math.round(Yt.progress*100),Zt=Yt?.status===`deleting`,Qt=ie.trim()||`https://huggingface.co`,$t=Ut?.profileLoad?.status===`loading`,en=Ft!==null&&Ge.current!==Ft&&Yt!==null&&Yt.status!==`downloaded`&&Yt.profileLoad?.status!==`error`&&!Wt&&(Yt.files.length??0)===0,tn=rt.isPending||(Lt.isLoading||Lt.isFetching)&&!Ut||$t||en;(0,G.useEffect)(()=>{!ut||!Pt||t||_t||sc(Tt)||Lt.isLoading||Lt.isFetching||Ut?.plan?.groups?.length||(Ut?.files.length??0)>0||Ut?.profileLoad?.status!==`loading`&&Ut?.profileLoad?.status!==`error`&&Ft!==null&&Ge.current!==Ft&&(Ge.current=Ft,rt.mutate({modelId:Pt}))},[ut,_t,t,Pt,rt,Tt,Lt.isFetching,Lt.isLoading,Ut?.plan?.groups?.length,Ut?.files.length,Ut?.profileLoad?.status,Ft]),(0,G.useEffect)(()=>{if(!qe||!Pt||t||!sit(Bt))return;let e=window.setTimeout(()=>{Lt.refetch()},750);return()=>window.clearTimeout(e)},[qe,t,Bt,Lt,Pt]);let nn=lt!==null&&sc(Tt)||_t,rn=Fe.length>0&&(Tt?.dependency.state===`installing`||Tt?.dependency.state===`error`||Tt?.runtime.state===`error`),an=(0,G.useCallback)(async e=>{ze.current?.abort();let t=new AbortController;ze.current=t,N(e.sourceLanguage),k(yJ(e.targetLanguage,{...e,availability:`downloading`,progress:e.progress??0,message:`Downloading browser translation support.`},{state:`ready`}));try{let n=await gJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,signal:t.signal,onStatus:t=>{k(yJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage,availability:t.availability,progress:t.progress,message:t.message},{state:t.availability===`error`?`error`:`ready`}))}});k(yJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage,availability:n.availability,progress:n.progress,message:n.message},{state:n.availability===`error`?`error`:`ready`}))}finally{ze.current===t&&(ze.current=null),N(t=>t===e.sourceLanguage?null:t)}},[]),on=(0,G.useCallback)(()=>{ze.current?.abort(),ze.current=null,N(null)},[]),sn=(0,G.useCallback)(async()=>{if(!lt)return;let e=xe.trim()||Hrt(ye),t=ye.trim()||I9,n=v.trim()||M9,r=Math.max(1,Math.round(je*1e3||15e3));Ae(!0),Ee(null),we(``),Oe(null);try{let i=performance.now(),a=await JHe({engineId:lt,sourceLanguage:t,targetLanguage:n,model:tc(lt)?z.trim()||void 0:lt===`openai`&&L.trim()||void 0,selectedGroupId:tc(lt)?qt:void 0,text:e,timeoutMs:r});Oe(Math.max(1,Math.round(performance.now()-i))),we(a)}catch(e){Oe(null),Ee(e instanceof Error?e.message:`Translation test failed.`)}finally{Ae(!1)}},[L,qt,z,ye,xe,je,lt,v]),cn={enabled:p?.enabled??!1,targetLanguage:p?.targetLanguage??M9,displayMode:p?.displayMode??N9,cacheEnabled:p?.cacheEnabled??P9,engineId:p?.engineId??`browser`},ln=o?.translationCache?.entryLimit??1e4,un=ct&&(cn.enabled!==g||cn.targetLanguage!==v||cn.displayMode!==b||cn.cacheEnabled!==w||cn.engineId!==lt||ln!==E);return(0,G.useEffect)(()=>{if(!lt||lt===`browser`){Pe(null),Ie(``),Be.current?.unsubscribe(),Be.current=null;return}Pe(vt),Ie(``)},[lt]),(0,G.useEffect)(()=>{!lt||lt===`browser`||Pe(e=>e?.dependency.state===`installing`&&sc(vt)?e:vt)},[lt,vt]),(0,G.useEffect)(()=>{if(!Fe)return;let e=Ve.current;e&&(e.scrollTop=e.scrollHeight)},[Fe]),(0,G.useEffect)(()=>()=>{Be.current?.unsubscribe()},[]),(0,K.jsxs)(m$,{id:`settings-translation`,index:e,className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(bm,{className:`h-5 w-5`}),`Translation`]}),(0,K.jsxs)(`div`,{className:`border-border @container space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enable document translation`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:`Select a translator engine for Markdown document views.`})]}),(0,K.jsx)(LA,{checked:g,onCheckedChange:e=>{_(e),Ze({enabled:e}),e&&lt===`browser`&&pt(v)},ariaLabel:`Enable document translation`,disabled:Je.isPending||Ye.isPending||t})]}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-2 grid gap-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Target Language`}),(0,K.jsx)(Sit,{value:v,onChange:e=>{y(e),Ze({targetLanguage:e}),lt===`browser`&&(k(null),j(null),pt(e))},disabled:Je.isPending||Ye.isPending||t})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Display Mode`}),(0,K.jsx)(wj,{value:b,onChange:e=>{x(e),Ze({displayMode:e})},options:Mrt})]})]}),(0,K.jsx)(`div`,{className:`border-border/60 space-y-3 border-t pt-3`,children:(0,K.jsx)(`div`,{className:`space-y-3`,children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Engine`}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(15rem,17rem)_minmax(0,1fr)_auto] grid gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[lt?(0,K.jsx)(W1,{value:lt,onValueChange:e=>{if(C(e),Xe.mutate(e),e===`browser`&&!t){let e=_J(v);if(e){k(e);let t=L9(e);j(e=>R9(t,e))}else pt(v)}},options:mt,ariaLabel:`Engine`,className:`min-w-[12rem]`,disabled:!ct||Xe.isPending||t}):(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Engine`,className:`border-border bg-background text-muted-foreground inline-flex h-9 min-w-[12rem] items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm`,disabled:!0,children:[(0,K.jsx)(`span`,{children:r||a||s?`Loading engine...`:`Select engine`}),(0,K.jsx)(Xp,{className:`h-4 w-4 shrink-0`})]}),(0,K.jsx)(Xy,{content:`Open translation test`,delay:0,children:(0,K.jsx)(Cj,{variant:`primary`,size:`icon-md`,"aria-label":`Open translation test`,onClick:()=>ve(!0),className:`bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(dm,{className:`h-4 w-4`})})})]}),(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1.5 text-sm`,children:[ht?.technicalSummary?(0,K.jsx)(`div`,{className:`text-muted-foreground whitespace-normal text-xs leading-5 [overflow-wrap:anywhere]`,children:ht.technicalSummary}):null,(0,K.jsx)(`div`,{className:`text-muted-foreground whitespace-normal text-xs leading-5 [overflow-wrap:anywhere]`,children:`Switching engines only checks installation state. Run Test Translate manually to validate runtime errors and latency.`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex min-w-0 items-center gap-2 leading-5`,children:[lt===`browser`?Ct===`checking`?(0,K.jsx)(Em,{className:`h-4 w-4 shrink-0 animate-spin`}):Ct===`available`?(0,K.jsx)(Xy,{content:`Installed`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Installed`,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):Ct===`downloadable`?(0,K.jsx)(nm,{className:`h-4 w-4 shrink-0 text-sky-500`}):(0,K.jsx)(Hm,{className:`h-4 w-4 shrink-0 text-amber-500`}):_t?(0,K.jsx)(Xy,{content:`Loading translation engine metadata`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Loading translation engine metadata`,className:`text-muted-foreground inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`})})}):sc(Tt)?Tt?.dependency.state===`installing`?(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Installing translation engine`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):Tt?.runtime.state===`probing`?(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Checking translation engine status`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Install translation engine`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,onClick:()=>{if(!lt)return;let e=ht?.label??gt?.label??lt;Pe(oc({dependency:{state:`installing`,message:`Installing ${e}.`},summary:`Installing ${e}.`})),ot.mutate(lt)},disabled:!lt||ot.isPending,children:ot.isPending?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})}):(0,K.jsx)(Xy,{content:`Installed`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Installed`,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}),(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:rn?(0,K.jsx)(`pre`,{ref:Ve,className:`bg-muted/40 border-border scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md border px-3 py-2 font-mono text-[11px] leading-5`,children:(0,K.jsx)(`code`,{children:Fe})}):Et})]})]})]})]})})}),nn?null:lt===`openai`?(0,K.jsxs)(`div`,{className:`border-border/60 @[56rem]:grid-cols-3 grid gap-3 border-t pt-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`API Base URL`,(0,K.jsx)(`input`,{value:P,onChange:e=>F(e.currentTarget.value),onBlur:()=>Ye.mutate({translationEngines:{openai:{baseUrl:P.trim()}}}),className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`,placeholder:`https://api.openai.com/v1`})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Token`,(0,K.jsx)(`input`,{value:ee,type:`password`,onChange:e=>I(e.currentTarget.value),onBlur:()=>Ye.mutate({translationEngines:{openai:{token:ee}}}),className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`,placeholder:`sk-...`})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Model`,(0,K.jsx)(`input`,{value:L,onChange:e=>R(e.currentTarget.value),onBlur:()=>{let e=L.trim();if(i?.translation.engines.openai){Je.mutate({engines:{openai:{model:e}}});return}Ye.mutate({translationEngines:{openai:{model:e}}})},className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`})]})]}):null,nn?null:lt===`browser`?(0,K.jsx)(`div`,{className:`border-border/60 border-t pt-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Browser language pairs`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex min-w-0 items-center gap-2 text-[11px] leading-5`,children:[O?.state===`checking`?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 shrink-0 animate-spin`}):null,(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:wt})]})]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>void pt(v),disabled:kt,children:[(0,K.jsx)(Am,{className:`h-3.5 w-3.5`}),`Check`]})]}),bt.length>0?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,"aria-label":`Browser translation language pairs`,children:bt.map(e=>{let t=z9(e)===xt;return(0,K.jsx)(`button`,{type:`button`,onClick:()=>j(z9(e)),className:`inline-flex items-center gap-1.5 rounded border px-2.5 py-1 text-[11px] leading-none transition-colors ${B9({tone:Lrt(e.availability),selected:t})}`,title:Frt(e),children:(0,K.jsx)(`span`,{className:`font-medium`,children:Prt(e)})},z9(e))})}):null]}),St?(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`text-foreground flex min-w-0 items-center gap-2 font-medium`,children:(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:Frt(St)})}),(0,K.jsxs)(`div`,{className:`relative inline-flex h-10 w-10 items-center justify-center`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 40 40`,className:`h-10 w-10 -rotate-90`,children:[(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`stroke-border fill-none`,strokeWidth:`3`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`fill-none transition-all ${Dt===`downloaded`?`stroke-emerald-500`:`stroke-primary`}`,strokeWidth:`3`,strokeDasharray:100.531,strokeDashoffset:100.531*(1-Ot/100),strokeLinecap:`round`})]}),Dt===`download`?(0,K.jsx)(Xy,{content:`Download language pair`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Download browser language pair`,onClick:()=>void an(St),className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):Dt===`cancel`?(0,K.jsx)(Xy,{content:`Cancel download`,delay:0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Cancel browser language pair download`,onClick:on,className:`text-foreground focus-visible:ring-primary group absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium group-hover:hidden`,children:`${Ot}%`}),(0,K.jsx)(Wm,{className:`hidden h-3.5 w-3.5 group-hover:block`})]})}):Dt===`downloaded`?(0,K.jsx)(Xy,{content:`Downloaded`,delay:0,children:(0,K.jsx)(`span`,{"aria-label":`Downloaded`,className:`absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):(0,K.jsx)(`span`,{className:`text-foreground absolute text-[10px] font-medium`,children:kt?`...`:`${Ot}%`})]})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground mt-2 leading-5`,children:St.message??(St.availability===`available`?`This language pair is ready in the browser.`:St.availability===`downloading`?`Chrome is downloading this language pair.`:`This language pair can be downloaded by Chrome.`)})]}):null]})}):null,nn?null:ut?(0,K.jsx)(`div`,{className:`border-border/60 border-t pt-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:jt}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Xy,{content:Nt,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":Nt,onClick:()=>{Pt&&rt.mutate({modelId:Pt})},disabled:!Pt||rt.isPending,className:`text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-primary inline-flex h-8 w-8 items-center justify-center rounded-md outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(Am,{className:`h-4 w-4 ${rt.isPending?`animate-spin`:``}`})})}),(0,K.jsx)(pit,{value:ie,memoryBudgetPercent:oe,resolvedEndpoint:Qt,onValueChange:ae,onMemoryBudgetPercentChange:se,onCommit:e=>{Ye.mutate({translationEngines:Zrt(ut,{hfEndpoint:e,memoryBudgetPercent:oe})}),fe([])}})]})]}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(0,1fr)_auto] grid gap-2`,children:[(0,K.jsx)(uit,{value:z,query:B,options:Ht,remoteLoading:pe,onQueryChange:V,onOpenChange:e=>{ge(e),e&&(fe([]),V(``),re(``))},onChange:e=>{te(e),V(e)},onCommit:async e=>{let t=await ait(ut,e);H9({engineId:ut,panelState:t,queryClient:Le,requestedSelectedGroupId:U}),We.current=t,Qe(ut,{model:e,selectedGroupId:null}),le(t.selectedGroupId)},ariaLabel:jt}),(0,K.jsxs)(`div`,{className:`text-muted-foreground inline-flex min-w-0 items-center text-[11px] leading-5 [overflow-wrap:anywhere]`,children:[`HF: `,Qt]})]}),(0,K.jsx)(hit,{ariaLabel:Mt,groups:Gt,loading:tn,disabled:Zt,onSelectGroup:e=>{le(e),Qe(ut,{selectedGroupId:e})}})]}),(0,K.jsx)(yit,{plan:Yt?.plan??Wt,groups:Gt,state:Yt,progressPercent:Xt,loading:tn,error:Vt??(Ut?.status===`error`?Ut.error??null:null),onDownload:()=>{$e.mutate({modelId:Pt,groupId:qt})},onPause:()=>{et.mutate({modelId:Pt,groupId:qt})},onResume:()=>{tt.mutate({modelId:Pt,groupId:qt})},onDelete:()=>{nt.mutate({modelId:Pt,groupId:qt})},knownSize:Jt,modelId:Pt})]})}):null,(0,K.jsxs)(`div`,{className:`border-border/60 space-y-3 border-t pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Translation cache`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:`Stores validated translation projections in the shared user cache.`})]}),(0,K.jsx)(LA,{checked:w,onCheckedChange:e=>{T(e),Ze({cacheEnabled:e}),e&&h()},ariaLabel:`Enable translation cache`,disabled:Je.isPending||Ye.isPending||t})]}),w?(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(12rem,1fr)_auto] grid gap-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Entry limit`,(0,K.jsx)(`input`,{type:`number`,min:100,max:2e5,step:100,value:E,onChange:e=>D(Number(e.currentTarget.value)),onBlur:()=>{let e=Math.round(E);D(e),Ye.mutate({translationCache:{entryLimit:e}})},className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>it.mutate(void 0,{onSuccess:()=>void h()}),disabled:it.isPending,children:[(0,K.jsx)(Mm,{className:`h-3.5 w-3.5`}),`Clean`]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>at.mutate(void 0,{onSuccess:()=>void h()}),disabled:at.isPending,children:[(0,K.jsx)(em,{className:`h-3.5 w-3.5`}),`Clear`]})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground @[42rem]:col-span-2 text-xs`,children:m?`${m.entries} / ${m.entryLimit} entries`:`Cache stats unavailable.`})]}):null]}),un?(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Saving translation settings...`}):null,(0,K.jsx)(dit,{open:_e,onClose:()=>ve(!1),engineId:lt,sourceLanguage:ye,sourceText:xe,timeoutSeconds:je,result:Ce,error:Te,running:ke,onSample:()=>{let e=Vrt();be(e.sourceLanguage),Se(e.sourceText),we(``),Ee(null),Oe(null)},onRun:()=>void sn(),targetLanguage:v,onSourceLanguageChange:e=>{be(e),we(``),Ee(null),Oe(null)},onSourceTextChange:Se,onTimeoutSecondsChange:Me,elapsedMs:De})]})]})}function uit({ariaLabel:e,value:t,query:n,options:r,remoteLoading:i,onQueryChange:a,onOpenChange:o,onChange:s,onCommit:c}){let l=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),u=`translation-local-model-popover-${l}`,d=`translation-local-model-options-${l}`,f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=(0,G.useRef)(null),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=(0,G.useCallback)(()=>{let e=f.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,420),window.innerWidth-16);v({left:Math.min(window.innerWidth-n-8,Math.max(8,t.left)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]);(0,G.useEffect)(()=>{h&&(y(),m.current?.focus(),m.current?.select())},[h,y]),(0,G.useEffect)(()=>{if(h)return window.addEventListener(`resize`,y),window.addEventListener(`scroll`,y,!0),()=>{window.removeEventListener(`resize`,y),window.removeEventListener(`scroll`,y,!0)}},[h,y]);let b=(0,G.useCallback)(()=>{let e=p.current;if(!e){g(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}g(!1)},[]),x=(0,G.useCallback)(e=>{let t=e.newState===`open`;g(t),o(t)},[o]);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{ref:f,type:`button`,"aria-label":e??`Local model`,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":u,popoverTarget:u,popoverTargetAction:`toggle`,onClick:y,className:`border-border bg-background text-foreground hover:bg-muted/30 focus:ring-primary inline-flex h-9 w-full min-w-[12rem] items-center gap-2 rounded-md border px-3 py-2 text-left text-sm outline-none focus:ring-1`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t||`Select model`}),(0,K.jsx)(Xp,{className:`text-muted-foreground h-4 w-4 shrink-0`})]}),(0,K.jsxs)(`div`,{id:u,ref:p,role:`dialog`,"aria-label":`Select local model`,popover:`auto`,onToggle:x,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 rounded-md border p-2 shadow-lg backdrop:bg-black/20`,style:_?{position:`fixed`,inset:`auto`,left:_.left,top:_.top,width:_.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`border-border bg-popover sticky top-0 z-10 mb-2 grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md border px-2 py-1.5`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground h-4 w-4`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:m,role:`textbox`,"aria-label":`Search local models`,"aria-autocomplete":`list`,"aria-controls":d,value:n,onChange:e=>a(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&b(),e.key===`Enter`){let e=n.trim()||t;s(e),c(e),b()}},className:`text-foreground placeholder:text-muted-foreground min-w-0 bg-transparent text-sm outline-none`,placeholder:`Search Hugging Face translation models`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`Clear model search`,title:`Clear`,onClick:()=>{a(``),m.current?.focus()},className:`text-muted-foreground hover:bg-muted hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded transition-colors`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{id:d,role:`listbox`,"aria-label":`Local model options`,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-72 overflow-y-auto`,children:[r.length>0?r.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.id===t,className:`grid w-full gap-1 rounded-sm px-2 py-2 text-left text-sm ${e.id===t?`bg-primary/10 text-primary`:`text-popover-foreground hover:bg-muted/70`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>{e.selectable&&(s(e.id),c(e.id),b())},disabled:!e.selectable,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-medium`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.id}),e.local?(0,K.jsx)(`span`,{className:`text-emerald-600`,children:xit(e.asset.status)}):null]}),(0,K.jsx)(`span`,{className:`text-muted-foreground whitespace-normal text-xs [overflow-wrap:anywhere]`,children:e.summary}),(0,K.jsxs)(`span`,{className:`text-muted-foreground flex flex-wrap items-center gap-2 text-[11px]`,children:[e.downloads>0?`${bit(e.downloads)} downloads · `:``,W9(e.size.estimatedTotalBytes),e.asset.progress!==void 0&&e.asset.status!==`downloaded`?(0,K.jsxs)(`span`,{children:[`· `,Math.round(e.asset.progress*100),`%`]}):null,e.selectable?null:(0,K.jsx)(`span`,{children:`· Size required`})]}),(0,K.jsx)(mit,{groups:e.downloadGroups??e.asset.plan?.groups??[]})]},e.id)):(0,K.jsx)(`div`,{className:`text-muted-foreground px-2 py-2 text-sm`,children:`No matching models`}),i?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 px-2 py-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Loading remote models…`]}):null]})]})]})}function dit({open:e,onClose:t,engineId:n,sourceLanguage:r,sourceText:i,targetLanguage:a,timeoutSeconds:o,result:s,error:c,elapsedMs:l,running:u,onSample:d,onRun:f,onSourceLanguageChange:p,onSourceTextChange:m,onTimeoutSecondsChange:h}){if(!e)return null;let g=uJ(a)?.label??a,_=c?`border-destructive/30 bg-destructive/5 text-destructive`:`border-input bg-background text-foreground`;return(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(dm,{className:`text-muted-foreground h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:`Translation Test`})]}),onClose:t,headerActions:(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:d,children:[(0,K.jsx)(Mm,{className:`h-3.5 w-3.5`}),`Sample`]}),className:`max-w-5xl`,footer:(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(0,1fr)_auto] grid w-full gap-3`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground max-w-2xl text-xs`,children:n===`local`?`Uses the configured local model and server runtime.`:n===`local-ct2`?`Uses the configured CT2 model artifacts and server runtime.`:n===`local-llama`?`Uses the configured local GGUF model and llama.cpp server runtime.`:n===`openai`?`Uses the configured OpenAI-compatible provider and model.`:`Uses the current browser Translator API capability.`}),(0,K.jsxs)(`div`,{className:`@[42rem]:justify-end flex flex-wrap items-end justify-start gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,K.jsx)(`span`,{children:`Timeout (seconds)`}),(0,K.jsx)(`input`,{type:`number`,min:1,step:1,value:o,onChange:e=>h(Math.max(1,Number(e.currentTarget.value)||krt)),className:`border-input bg-background h-9 w-24 rounded-md border px-3 text-sm`})]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:f,disabled:u,children:[u?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(Om,{className:`h-3.5 w-3.5`}),`Run Test`]})]})]}),children:(0,K.jsxs)(`div`,{className:`@[64rem]:grid-cols-2 grid gap-4`,children:[(0,K.jsxs)(`section`,{className:`bg-muted/20 border-border flex min-h-[23rem] flex-col rounded-xl border`,children:[(0,K.jsxs)(`div`,{className:`border-border space-y-2 border-b px-4 py-4`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Source Language`}),(0,K.jsx)(`div`,{children:(0,K.jsx)(Sit,{value:r,onChange:p,ariaLabel:`Translation test source language`,dialogLabel:`Select translation test source language`,searchInputLabel:`Search translation test source languages`,optionsListLabel:`Translation test source language options`,clearButtonLabel:`Clear translation test source language search`,placeholder:`Select source language`,disabled:u})})]}),(0,K.jsxs)(`label`,{className:`flex min-h-0 flex-1 flex-col px-4 py-4 text-sm font-medium`,children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Source Text`}),(0,K.jsx)(`textarea`,{"aria-label":`Translation test source text`,value:i,onChange:e=>m(e.currentTarget.value),rows:10,className:`border-input bg-background focus:ring-ring mt-2 min-h-[15rem] flex-1 resize-none rounded-md border px-3 py-3 text-sm focus:outline-none focus:ring-2`,placeholder:Hrt(r)})]})]}),(0,K.jsxs)(`section`,{className:`bg-muted/20 border-border flex min-h-[23rem] flex-col rounded-xl border`,children:[(0,K.jsxs)(`div`,{className:`border-border space-y-2 border-b px-4 py-4`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Target Language`}),(0,K.jsx)(`div`,{"aria-label":`Translation test target language`,className:`border-input bg-background text-foreground flex h-10 items-center rounded-md border px-3 text-sm`,children:g})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col px-4 py-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Translated Output`}),l===null?null:(0,K.jsx)(`div`,{"aria-label":`Translation test elapsed time`,className:`text-muted-foreground shrink-0 text-xs`,children:fit(l)})]}),(0,K.jsx)(`div`,{className:`mt-2 min-h-[15rem] flex-1 rounded-md border px-3 py-3 text-sm ${_}`,children:u?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Running translation test…`]}):s?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:s}):c?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:c}):(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Run a test to inspect translated output for the current engine.`})})]})]})]})})}function fit(e){return e>=1e3?`Elapsed ${Math.max(.01,e/1e3).toFixed(2)}s`:`Elapsed ${Math.max(1,Math.round(e))}ms`}function pit({value:e,memoryBudgetPercent:t,resolvedEndpoint:n,onValueChange:r,onMemoryBudgetPercentChange:i,onCommit:a}){let o=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),s=`translation-local-provider-popover-${o}`,c=`translation-local-provider-endpoint-${o}`,l=`translation-local-provider-endpoint-hint-${o}`,u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=(0,G.useCallback)(()=>{let e=u.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,320),window.innerWidth-16);g({left:Math.min(window.innerWidth-n-8,Math.max(8,t.right-n)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]),v=(0,G.useCallback)(()=>{a(e.trim())},[a,e]),y=(0,G.useCallback)(()=>{let e=d.current;if(!e){m(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}m(!1)},[]);(0,G.useEffect)(()=>{p&&(_(),f.current?.focus(),f.current?.select())},[p,_]),(0,G.useEffect)(()=>{if(p)return window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),()=>{window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0)}},[p,_]);let b=(0,G.useCallback)(e=>{let t=e.newState===`open`;m(t),t?_():v()},[v,_]);return(0,K.jsxs)(`div`,{className:`shrink-0`,children:[(0,K.jsx)(Xy,{content:`Hugging Face endpoint`,delay:0,children:(0,K.jsx)(`button`,{ref:u,type:`button`,"aria-label":`Local provider settings`,"aria-haspopup":`dialog`,"aria-expanded":p,"aria-controls":s,popoverTarget:s,popoverTargetAction:`toggle`,onClick:_,className:`text-muted-foreground hover:bg-muted hover:text-foreground focus:ring-primary inline-flex h-7 w-7 items-center justify-center rounded-md outline-none transition-colors focus:ring-1`,children:(0,K.jsx)(Lm,{className:`h-3.5 w-3.5`})})}),(0,K.jsxs)(`div`,{id:s,ref:d,role:`dialog`,"aria-label":`Local provider settings`,popover:`auto`,onToggle:b,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 space-y-3 rounded-md border p-3 shadow-lg backdrop:bg-black/20`,style:h?{position:`fixed`,inset:`auto`,left:h.left,top:h.top,width:h.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium`,children:`HF Endpoint`}),(0,K.jsx)(`input`,{id:c,ref:f,value:e,"aria-describedby":l,onChange:e=>r(e.currentTarget.value),onBlur:v,onKeyDown:e=>{e.key===`Enter`&&(v(),y()),e.key===`Escape`&&y()},className:`border-input bg-background h-9 w-full rounded-md border px-3 text-sm`,placeholder:`https://huggingface.co`}),(0,K.jsxs)(`div`,{id:l,className:`text-muted-foreground text-xs leading-5 [overflow-wrap:anywhere]`,children:[(0,K.jsxs)(`div`,{children:[`Current endpoint: `,n]}),(0,K.jsx)(`div`,{children:`Mirror example: https://hf-mirror.com`})]})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Max memory budget`,(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,K.jsx)(`input`,{type:`range`,min:0,max:100,step:5,value:t,onChange:e=>i(Math.max(0,Math.min(100,Number(e.currentTarget.value)||0))),className:`flex-1`}),(0,K.jsxs)(`span`,{className:`text-muted-foreground min-w-12 text-right text-xs`,children:[t,`%`]})]})]})]})]})}function mit({groups:e}){return e.length===0?null:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1 pt-1`,children:e.slice(0,5).map(e=>{let t=git(e.status);return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${e.selectable?B9({tone:t,selected:e.selected,interactive:!1}):`text-muted-foreground/60 border-dashed`}`,children:[(0,K.jsx)(`span`,{children:e.label}),(0,K.jsx)(`span`,{children:W9(e.estimatedTotalBytes)})]},e.id)})})}function hit({ariaLabel:e,groups:t,loading:n,disabled:r,onSelectGroup:i}){return t.length===0?null:(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,"aria-label":e??`Local download profiles`,"aria-busy":n,children:t.map(e=>{let t=git(e.status);return(0,K.jsxs)(`button`,{type:`button`,disabled:!e.selectable||r,onClick:()=>i(e.id),className:`inline-flex items-center gap-1.5 rounded border px-2.5 py-1 text-[11px] leading-none transition-colors ${B9({tone:t,selected:e.selected})} disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,K.jsx)(`span`,{children:W9(e.estimatedTotalBytes)})]},e.id)})})})}function git(e){return e===`downloaded`?`downloaded`:e===`queued`||e===`downloading`||e===`paused`||e===`error`||e===`deleting`?`partial`:`not-started`}function _it(e){if(e.loading)return`progress`;switch(e.state?.status){case`deleting`:return`deleting`;case`downloading`:return`pause`;case`paused`:return`resume`;case`downloaded`:return`downloaded`;case`error`:case`not-downloaded`:case void 0:return e.knownSize?`download`:`progress`;case`queued`:return`progress`}}function vit(e,t,n){let r=t?.commitHash??n.find(e=>e.revision)?.revision;return r?{commitHash:r,href:`https://huggingface.co/${e}/tree/${encodeURIComponent(r)}`}:null}function yit({plan:e,groups:t,state:n,progressPercent:r,loading:i,error:a,onDownload:o,onPause:s,onResume:c,onDelete:l,knownSize:u,modelId:d}){let f=n?.status===`deleting`,p=n?.status===`paused`,m=n?.status===`downloaded`,h=n?.status===`error`,g=_it({state:n,loading:i,knownSize:u}),_=!i&&!f&&(m||p||h),v=r??0,y=t.find(e=>e.selected)??null,b=y?.files??e?.files??n?.plan?.files??[],x=vit(d,y,b),S=new Map(n?.files.map(e=>[e.path,e])??[]),C=b.length>0?b.map(e=>({...e,downloadedBytes:S.get(e.path)?.downloadedBytes})):n?.files??[],w=n?.profileLoad?.status===`loading`?n.profileLoad.message??`Loading model files…`:null,T=C.length===0&&(i||w!==null);return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[!i&&e&&!u?(0,K.jsx)(`div`,{className:`text-amber-600`,children:`This model is not downloadable here until concrete artifact sizes are known.`}):null,(0,K.jsxs)(`div`,{className:`border-border rounded-md border px-3 py-2 text-xs ${m?`bg-emerald-500/5`:`bg-muted/30`}`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-foreground flex min-w-0 items-center gap-2 font-medium`,children:[(0,K.jsx)(`span`,{children:`Download files`}),e?(0,K.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-normal`,children:W9(y?.estimatedTotalBytes??e.estimatedTotalBytes)}):n?.totalBytes===void 0?null:(0,K.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-normal`,children:W9(n.totalBytes)})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[_?(0,K.jsx)(`button`,{type:`button`,"aria-label":`Delete model`,title:`Delete local model`,onClick:l,disabled:!d,className:`text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:ring-destructive/40 inline-flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})}):null,(0,K.jsxs)(`div`,{className:`relative inline-flex h-10 w-10 items-center justify-center`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 40 40`,className:`h-10 w-10 -rotate-90`,children:[(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`stroke-border fill-none`,strokeWidth:`3`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`fill-none transition-all ${m?`stroke-emerald-500`:`stroke-primary`}`,strokeWidth:`3`,strokeDasharray:100.531,strokeDashoffset:100.531*(1-v/100),strokeLinecap:`round`})]}),g===`download`?(0,K.jsx)(Xy,{content:`Download model`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Download model`,"data-local-plan-action":`download`,onClick:o,disabled:!d,className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):g===`pause`?(0,K.jsx)(Xy,{content:`Pause`,delay:0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Pause download`,"data-local-plan-action":`pause`,onClick:s,disabled:!d,className:`text-foreground focus-visible:ring-primary group absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium group-hover:hidden`,children:`${v}%`}),(0,K.jsx)(Dle,{className:`hidden h-3.5 w-3.5 group-hover:block`})]})}):g===`resume`?(0,K.jsx)(Xy,{content:`Resume download`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Resume download`,"data-local-plan-action":`resume`,onClick:c,disabled:!d,className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):g===`downloaded`?(0,K.jsx)(Xy,{content:`Downloaded`,delay:0,children:(0,K.jsx)(`span`,{"aria-label":`Downloaded`,"data-local-plan-action":`downloaded`,className:`absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):g===`deleting`?(0,K.jsx)(`span`,{"data-local-plan-action":`deleting`,className:`text-foreground absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent`,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):(0,K.jsx)(`span`,{"data-local-plan-action":`progress`,className:`text-foreground absolute text-[10px] font-medium`,children:i?`...`:`${v}%`})]})]})]}),f?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex items-center gap-2`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Removing local model files…`]}):a?(0,K.jsxs)(`div`,{className:`text-destructive mt-2 flex items-center gap-2 leading-5`,children:[(0,K.jsx)(em,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:a})]}):(0,K.jsxs)(K.Fragment,{children:[x?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 leading-5`,children:[(0,K.jsx)(`span`,{children:`Revision`}),(0,K.jsxs)(`a`,{href:x.href,target:`_blank`,rel:`noreferrer`,className:`text-primary bg-muted inline-flex min-w-0 items-center gap-1 rounded px-1 py-0.5 font-mono text-[11px] hover:underline`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:x.commitHash}),(0,K.jsx)(im,{className:`h-3 w-3 shrink-0`})]})]}):null,T?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex items-center gap-2 leading-5`,children:[(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}),w??`Loading model files…`]}):C.length>0?(0,K.jsx)(`ul`,{className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] text-muted-foreground mt-2 max-h-48 space-y-1 overflow-y-auto pr-1`,children:C.map(e=>{let t=e.sizeBytes,n=`downloadedBytes`in e?e.downloadedBytes??(m&&t!==void 0?t:t===void 0?void 0:0):void 0;return(0,K.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3`,children:[(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:e.path}),(0,K.jsx)(`span`,{className:`shrink-0`,children:n!==void 0||t!==void 0?`${W9(n)} / ${W9(t)}`:`Pending`})]},e.path)})}):(0,K.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`No runtime download plan available.`})]})]})]})}function W9(e){if(e===void 0||e<0)return`Unknown size`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=100||r===0?0:1;return`${n.toFixed(i)} ${t[r]}`}function bit(e){return new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e)}function xit(e){switch(e){case`not-downloaded`:return`Not downloaded`;case`queued`:return`Queued`;case`downloading`:return`Downloading`;case`paused`:return`Paused`;case`downloaded`:return`Downloaded`;case`error`:return`Error`;case`deleting`:return`Deleting`}}function Sit({value:e,onChange:t,ariaLabel:n=`Translation target language`,dialogLabel:r=`Select translation target language`,searchInputLabel:i=`Search translation languages`,optionsListLabel:a=`Translation target language options`,clearButtonLabel:o=`Clear search`,placeholder:s=`Select language`,disabled:c}){let l=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),u=`translation-target-language-popover-${l}`,d=`translation-target-language-options-${l}`,f=uJ(e),p=f?.label??e,m=(0,G.useRef)(null),h=(0,G.useRef)(null),g=(0,G.useRef)(null),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(null),C=(0,G.useMemo)(()=>QVe(y),[y]),w=(0,G.useCallback)(()=>{let e=m.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,320),window.innerWidth-16);S({left:Math.min(window.innerWidth-n-8,Math.max(8,t.left)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]),T=(0,G.useCallback)(()=>{let e=h.current;if(!e){v(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}v(!1)},[]);(0,G.useEffect)(()=>{_&&w()},[_,w]),(0,G.useEffect)(()=>{_&&(g.current?.focus(),g.current?.select())},[_]),(0,G.useEffect)(()=>{if(_)return window.addEventListener(`resize`,w),window.addEventListener(`scroll`,w,!0),()=>{window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0)}},[_,w]),(0,G.useEffect)(()=>{c&&(T(),b(``))},[c,T]);let E=(0,G.useCallback)(e=>{b(``),t(e),T()},[T,t]),D=(0,G.useCallback)(e=>{let t=e.newState===`open`;v(t),t?w():b(``)},[w]);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{ref:m,type:`button`,"aria-label":n,"aria-haspopup":`dialog`,"aria-expanded":_,"aria-controls":u,popoverTarget:u,popoverTargetAction:`toggle`,disabled:c,onClick:w,className:`border-border bg-background text-foreground hover:bg-muted/30 focus:ring-primary inline-flex h-9 w-full min-w-0 items-center gap-2 rounded-md border px-3 py-2 text-left text-sm outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(bm,{className:`text-muted-foreground h-4 w-4 shrink-0`}),f?(0,K.jsx)(`span`,{className:`text-muted-foreground shrink-0 font-mono text-xs`,children:f.code}):null,(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p||s}),(0,K.jsx)(Xp,{className:`text-muted-foreground h-4 w-4 shrink-0`})]}),(0,K.jsxs)(`div`,{id:u,ref:h,role:`dialog`,"aria-label":r,popover:`auto`,onToggle:D,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 rounded-md border p-2 shadow-lg backdrop:bg-black/20`,style:x?{position:`fixed`,inset:`auto`,left:x.left,top:x.top,width:x.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`border-border bg-popover sticky top-0 z-10 mb-2 grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md border px-2 py-1.5`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground h-4 w-4`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:g,role:`textbox`,"aria-label":i,"aria-autocomplete":`list`,"aria-controls":d,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T()},className:`text-foreground placeholder:text-muted-foreground min-w-0 bg-transparent text-sm outline-none`,placeholder:`Search code, English, or native name`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o,title:`Clear`,onClick:()=>{b(``),g.current?.focus()},disabled:c||y.length===0,className:`text-muted-foreground hover:bg-muted hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded transition-colors disabled:pointer-events-none disabled:opacity-40`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),(0,K.jsx)(`div`,{id:d,role:`listbox`,"aria-label":a,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-60 overflow-y-auto`,children:C.length>0?C.map(t=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t.code===e,className:`grid w-full grid-cols-[4.5rem_minmax(0,1fr)] items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm ${t.code===e?`bg-primary/10 text-primary`:`text-popover-foreground hover:bg-muted/70`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>E(t.code),children:[(0,K.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t.code}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]},t.code)):(0,K.jsx)(`div`,{className:`text-muted-foreground px-2 py-2 text-sm`,children:`No matching languages`})})]})]})}function G9(e,t=[]){let n=e=>e?/[\s"'\\]/.test(e)?JSON.stringify(e):e:`""`;return[e,...t].map(n).join(` `)}var Cit=[{value:`auto`,label:`Auto-detect tools (recommended)`},{value:`selected`,label:`Use selected tools`},{value:`all`,label:`Use all tools`}],wit=[{value:`default`,label:`Use global default`},{value:`core`,label:`core`},{value:`custom`,label:`custom`}],Tit=13,Eit=``,Dit=!0,Oit=`block`,kit=1e3,Ait=`xterm`,jit=1,Mit=100,Nit=1e3,Pit=[{value:`light`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mle,{className:`h-3.5 w-3.5`}),`Light`]})},{value:`dark`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Sle,{className:`h-3.5 w-3.5`}),`Dark`]})},{value:`system`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(xle,{className:`h-3.5 w-3.5`}),`System`]})}],Fit=[{value:`block`,label:`Block`},{value:`underline`,label:`Underline`},{value:`bar`,label:`Bar`}],K9=[{id:`settings-appearance`,label:`Appearance`},{id:`settings-opsx-invocation`,label:`OPSX Invocation`},{id:`settings-terminal`,label:`Terminal`},{id:`settings-notifications`,label:`Notifications`},{id:`settings-translation`,label:`Translation`},{id:`settings-dashboard`,label:`Dashboard`},{id:`settings-git-detail`,label:`Git Detail`},{id:`settings-project-directory`,label:`Project Directory`},{id:`settings-cli-configuration`,label:`CLI Configuration`},{id:`settings-openspec-profile`,label:`OpenSpec Profile`},{id:`settings-api-configuration`,label:`API Configuration`},{id:`settings-hosted-app`,label:`Hosted App`},{id:`settings-file-watcher`,label:`File Watcher`},{id:`settings-init-openspec`,label:`Initialize OpenSpec`}];function q9(e){let t=K9.findIndex(t=>t.id===e);return t===-1?0:t}function Iit({value:e,onChange:t,onBlur:n}){let r=(0,G.useRef)(null),[i,a]=(0,G.useState)(``),o=n=>{let r=e.trim();t(r?`${r}, ${n}`:n)};return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Font Family`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),onBlur:n,placeholder:`e.g. JetBrains Mono, monospace`,className:`bg-background border-border text-foreground focus:ring-primary flex-1 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(`button`,{type:`button`,popoverTarget:`font-family-popover`,className:`border-border hover:bg-muted rounded-md border px-2 py-2 transition-colors`,"aria-label":`Add font`,children:(0,K.jsx)(km,{className:`h-4 w-4`})})]}),(0,K.jsx)(`div`,{id:`font-family-popover`,ref:r,popover:`auto`,className:`bg-popover text-popover-foreground border-border m-auto rounded-lg border p-4 shadow-lg backdrop:bg-black/20`,children:(0,K.jsxs)(`div`,{className:`w-64 space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Google Fonts`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:sA.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o(e),r.current?.hidePopover()},className:`border-border hover:bg-muted rounded-md border px-2 py-1 text-xs transition-colors`,children:e},e))}),(0,K.jsx)(`hr`,{className:`border-border`}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Custom Font URL`}),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`https://...`,className:`bg-background border-border text-foreground focus:ring-primary min-w-0 flex-1 rounded-md border px-2 py-1 text-xs focus:outline-none focus:ring-1`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let e=i.trim();e&&(o(e),a(``),r.current?.hidePopover())},className:`bg-primary text-primary-foreground hover:bg-primary/90 rounded-md px-2 py-1 text-xs font-medium transition-colors`,children:`Add`})]})]})})]})}function Lit(){let[e,t]=(0,G.useState)(UA),[n,r]=(0,G.useState)(rDe),[i,a]=(0,G.useState)($a()||``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(`auto`),[v,y]=(0,G.useState)(`default`),[b,x]=(0,G.useState)(!0),S=FA(),C=FA(),{lines:w,status:T,commands:E,cancel:D,reset:O}=S,k=T===`error`?`error`:T===`success`?`success`:`default`,{lines:A,status:j,commands:M,cancel:N,reset:P}=C,F=j===`error`?`error`:j===`success`?`success`:`default`,ee=ab(),I=qa(),{data:L}=op(),{data:R,isLoading:z,refetch:te}=Br({...tp.cli.sniffGlobalCli.queryOptions(),staleTime:0,gcTime:0,enabled:!I}),{data:B,isLoading:V,refetch:ne}=Br({...tp.cli.checkAvailability.queryOptions(),enabled:!I}),{data:re,refetch:ie}=Br({...tp.config.getEffectiveCliCommand.queryOptions(),enabled:!I}),{data:ae}=Br({...tp.cli.getAllTools.queryOptions(),enabled:!I}),{data:oe,isLoading:se,refetch:ce}=Br({...tp.cli.getDetectedProjectTools.queryOptions(),enabled:!I}),{data:le,isLoading:ue,refetch:H}=Br({...tp.cli.getProfileState.queryOptions(),enabled:!I}),de=(0,G.useMemo)(()=>!le?.available||!le.delivery?null:{delivery:le.delivery,workflows:le.workflows},[le?.available,le?.delivery,le?.workflows]),{data:fe,refetch:pe}=Br({...tp.cli.getToolInitStates.queryOptions(de??{delivery:`both`,workflows:[]}),enabled:!I&&de!==null}),me=(0,G.useMemo)(()=>ae?.filter(e=>e.available)??[],[ae]),he=(0,G.useMemo)(()=>me.map(e=>e.value),[me]),ge=(0,G.useMemo)(()=>new Set(he),[he]),_e=(0,G.useMemo)(()=>he.join(`|`),[he]),ve=(0,G.useMemo)(()=>oe?.map(e=>e.value)??[],[oe]),ye=(0,G.useMemo)(()=>new Map((fe??[]).map(e=>[e.toolId,e])),[fe]),be=(0,G.useMemo)(()=>he.filter(e=>j9(ye,e)===`initialized`),[he,ye]),xe=(0,G.useMemo)(()=>new Set(be),[be]),Se=(0,G.useMemo)(()=>be.join(`|`),[be]),Ce=(0,G.useMemo)(()=>he.filter(e=>j9(ye,e)!==`initialized`),[he,ye]),we=(0,G.useMemo)(()=>u.filter(e=>ge.has(e)&&!xe.has(e)),[ge,xe,u]);(0,G.useEffect)(()=>{L?.cli?.command?l(G9(L.cli.command,L.cli.args??[])):l(``)},[L?.cli?.args,L?.cli?.command]);let Te=(0,G.useMemo)(()=>L?.cli?.command?G9(L.cli.command,L.cli.args??[]):``,[L?.cli?.args,L?.cli?.command]);(0,G.useEffect)(()=>{L?.theme&&t(L.theme)},[L?.theme]),(0,G.useEffect)(()=>{let e=L?.codeEditor?.theme;!e||!aDe(e)||r(e)},[L?.codeEditor?.theme]),(0,G.useEffect)(()=>{s(L?.appBaseUrl??``)},[L?.appBaseUrl]);let Ee=(0,G.useCallback)(()=>{te(),ne(),h(!1)},[te,ne]),De=R?.hasGlobal?`openspec (v`+(R.version||`detected`)+`)`:`npx @fission-ai/openspec`;(0,G.useEffect)(()=>{d(e=>{let t=e.filter(e=>ge.has(e)&&!xe.has(e));return e.length===t.length&&e.every((e,n)=>e===t[n])?e:t})},[ge,_e,xe,Se]);let Oe=(0,G.useMemo)(()=>Srt(ye,we),[we,ye]),ke=(0,G.useMemo)(()=>(fe??[]).filter(e=>e.status===`initialized`).length,[fe]),Ae=(0,G.useMemo)(()=>(fe??[]).filter(e=>e.status===`partial`).length,[fe]),je=e=>{_(e),p(!0)};(0,G.useEffect)(()=>{f||(D(),O())},[f,D,O]);let Me=(0,G.useMemo)(()=>xrt({mode:g,selectedToolIds:we,cliSupportedToolIds:ge,profileOverride:v,force:b}),[ge,b,v,g,we]);(0,G.useEffect)(()=>{f&&E.replaceAll([{command:`openspec`,args:Me}])},[Me,E,f]),(0,G.useEffect)(()=>{m?(M.replaceAll([{command:`npm`,args:[`install`,`-g`,`@fission-ai/openspec`]}]),M.runAll()):(N(),P())},[m,M,N,P]),(0,G.useEffect)(()=>{T===`success`&&Promise.allSettled([H(),ce(),pe(),ne(),te()])},[T,ce,H,pe,ne,te]);let Ne=e=>j9(ye,e)===`initialized`,Pe=e=>{!ge.has(e)||Ne(e)||d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},Fe=()=>{if(Ce.length>0&&Ce.every(e=>u.includes(e))){d([]);return}d([...Ce])},Ie=Oe.newCount,Le=Oe.repairCount,Re=Crt(Oe),ze=Ie+Le>0,Be=g===`selected`,Ve=se||!wrt(ve),He=(0,G.useMemo)(()=>Trt({mode:g,selectedLabel:Re,autoInitDisabled:Ve,hasSelectedToolActions:ze}),[Ve,ze,g,Re]),Ue=()=>{p(!1),D(),O()},We=()=>{h(!1),N(),P()},Ge=Vr({mutationFn:e=>X.config.update.mutate({cli:{command:e}}),onSuccess:async()=>{await Promise.allSettled([ne(),ie(),te()]),await Promise.allSettled([Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter()),Xf.invalidateQueries(tp.config.getEffectiveCliCommand.queryFilter())])}}),Ke=Vr({mutationFn:()=>X.cli.execute.mutate({args:[`update`]}),onSuccess:async()=>{await Promise.allSettled([H(),ne(),te(),Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter())])}}),qe=Vr({mutationFn:()=>X.cli.execute.mutate({args:[`config`,`profile`,`core`]}),onSuccess:async()=>{await Promise.allSettled([H()])}}),Je=Vr({mutationFn:e=>X.config.update.mutate({theme:e})}),Ye=Vr({mutationFn:e=>X.config.update.mutate({codeEditor:{theme:e}})}),Xe=Vr({mutationFn:e=>X.config.update.mutate({appBaseUrl:e.trim()})}),Ze=Vr({mutationFn:e=>X.config.update.mutate({opsx:{agentInvocationMode:e}})}),Qe=(0,G.useMemo)(()=>uA.getConfig(),[]),[$e,et]=(0,G.useState)(Qe.fontSize),[tt,nt]=(0,G.useState)(Qe.fontFamily),[rt,it]=(0,G.useState)(Qe.cursorBlink),[at,ot]=(0,G.useState)(Qe.cursorStyle),[st,ct]=(0,G.useState)(Qe.scrollback),[lt,ut]=(0,G.useState)(Qe.useTheme),[dt,ft]=(0,G.useState)(Qe.lightTheme),[pt,mt]=(0,G.useState)(Qe.darkTheme),[ht,gt]=(0,G.useState)(Qe.rendererEngine),[_t,vt]=(0,G.useState)(Qe.bellSound),[yt,bt]=(0,G.useState)(Qe.bellVolume),[xt,St]=(0,G.useState)(100),[Ct,wt]=(0,G.useState)(1e3),[Tt,Et]=(0,G.useState)(null),Dt=iDe,Ot=eTe,kt=(0,G.useMemo)(()=>[...$k.map(e=>({value:e,label:e===`ghostty`?`ghostty-web`:e})),...eA(ht)?[]:[{value:ht,label:`Invalid value: ${ht}`}]],[ht]),At=eA(ht),jt=(0,G.useMemo)(()=>{let e=new Ok;return e.init(),e},[]);(0,G.useEffect)(()=>{let e=uA.getConfig();et(e.fontSize),nt(e.fontFamily),it(e.cursorBlink),ot(e.cursorStyle),ct(e.scrollback),ut(e.useTheme),ft(e.lightTheme),mt(e.darkTheme),gt(e.rendererEngine),vt(e.bellSound),bt(e.bellVolume)},[]),(0,G.useEffect)(()=>{let e=L?.terminal?.useTheme;e&&nTe(e)&&ut(e)},[L?.terminal?.useTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.lightTheme;e&&Zk(e)&&ft(e)},[L?.terminal?.lightTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.darkTheme;e&&Zk(e)&&mt(e)},[L?.terminal?.darkTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.rendererEngine;typeof e==`string`&&e.length>0&&gt(e)},[L?.terminal?.rendererEngine]),(0,G.useEffect)(()=>{let e=brt.safeParse(L?.terminal?.bellSound);e.success&&vt(e.data)},[L?.terminal?.bellSound]),(0,G.useEffect)(()=>{let e=L?.terminal?.bellVolume;typeof e==`number`&&Number.isFinite(e)&&bt(e)},[L?.terminal?.bellVolume]);let Mt=(0,G.useCallback)(e=>{uA.applyConfig({fontSize:e.fontSize??$e,fontFamily:e.fontFamily??tt,cursorBlink:e.cursorBlink??rt,cursorStyle:e.cursorStyle??at,scrollback:e.scrollback??st,useTheme:e.useTheme??lt,lightTheme:e.lightTheme??dt,darkTheme:e.darkTheme??pt,bellSound:e.bellSound??_t,bellVolume:e.bellVolume??yt})},[$e,tt,rt,at,st,lt,dt,pt,_t,yt]),Nt=(0,G.useCallback)(async e=>{Et(null);try{await uA.setRendererEngine(e),gt(e)}catch(e){gt(uA.getConfig().rendererEngine),Et(e instanceof Error?e.message:String(e))}},[]),Pt=Vr({mutationFn:e=>X.config.update.mutate({terminal:e})}),Ft=Vr({mutationFn:e=>X.config.update.mutate({dashboard:{trendPointLimit:e}})}),It=Vr({mutationFn:e=>X.config.update.mutate({git:{diffEagerLineBudget:e}}),onSuccess:async()=>{await Xf.invalidateQueries({queryKey:[`git`]})}});(0,G.useEffect)(()=>{let e=L?.dashboard?.trendPointLimit;typeof e==`number`&&Number.isFinite(e)&&St(e)},[L?.dashboard?.trendPointLimit]),(0,G.useEffect)(()=>{let e=L?.git?.diffEagerLineBudget;typeof e==`number`&&Number.isFinite(e)&&wt(e)},[L?.git?.diffEagerLineBudget]);let U=L?.dashboard?.trendPointLimit??Mit,Lt=L?.git?.diffEagerLineBudget??Nit,Rt=L?.appBaseUrl??``,zt=L?.terminal?.fontFamily??Eit,Bt={fontSize:L?.terminal?.fontSize??Tit,fontFamily:zt,cursorBlink:L?.terminal?.cursorBlink??Dit,cursorStyle:L?.terminal?.cursorStyle??Oit,scrollback:L?.terminal?.scrollback??kit,useTheme:L?.terminal?.useTheme??`app`,lightTheme:L?.terminal?.lightTheme??`default-light`,darkTheme:L?.terminal?.darkTheme??`default-dark`,rendererEngine:L?.terminal?.rendererEngine??Ait,bellSound:L?.terminal?.bellSound??`builtin:Tink`,bellVolume:L?.terminal?.bellVolume??jit},Vt=tt.split(/[,]+/).map(e=>e.trim()).filter(Boolean).join(`, `),Ht=$e===Bt.fontSize&&Vt===Bt.fontFamily&&rt===Bt.cursorBlink&&at===Bt.cursorStyle&&st===Bt.scrollback&&lt===Bt.useTheme&&dt===Bt.lightTheme&&pt===Bt.darkTheme&&ht===Bt.rendererEngine&&_t===Bt.bellSound&&yt===Bt.bellVolume,Ut=xt===U,Wt=Ct===Lt,Gt=c.trim()===Te,Kt=i===($a()||``),qt=o.trim()===Rt,Jt=L?.opsx?.agentInvocationMode??`compose`,Yt=dA.parse(L?.notifications?.sound??`builtin:Blow`),Xt=L?.notifications?.volume??1,Zt=L?.notifications?.systemNotificationsEnabled??!1,Qt=(0,G.useMemo)(()=>vnt.map(e=>({...e,disabled:Ze.isPending})),[Ze.isPending]);(0,G.useEffect)(()=>{GA(e),WA(e)},[e]),(0,G.useEffect)(()=>{if(e!==`system`)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>GA(`system`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]);let $t=()=>{let e=new URL(window.location.href);i?e.searchParams.set(`api`,i):e.searchParams.delete(`api`),window.location.href=e.toString()},[en,tn]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{tn(!1)},[]),en?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading settings...`}):(0,K.jsx)(`div`,{className:`@container-[size] scrollbar-thin scrollbar-track-transparent h-full min-h-0 overflow-y-auto scroll-smooth`,style:{timelineScope:p$(K9)},children:(0,K.jsxs)(`div`,{className:`toc-page-layout min-h-full gap-6 p-4 [--toc-page-sidebar-min:14rem]`,children:[(0,K.jsx)(d$,{items:K9,className:`toc-page-sidebar [--toc-sticky-top:16px]`}),(0,K.jsxs)(`div`,{className:`toc-page-content min-w-0 space-y-8`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(Fm,{className:`h-6 w-6 shrink-0`}),`Settings`]}),(0,K.jsxs)(m$,{id:`settings-appearance`,index:q9(`settings-appearance`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Appearance`}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`label`,{className:`mb-3 block text-sm font-medium`,children:`Theme`}),(0,K.jsx)(wj,{value:e,onChange:e=>{t(e),Je.mutate(e)},options:Pit}),(0,K.jsxs)(`div`,{className:`border-border/60 mt-4 border-t pt-4`,children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Code Editor Theme`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(W1,{value:n,options:Dt,onValueChange:e=>{r(e),I||Ye.mutate(e)},ariaLabel:`Code Editor Theme`,className:`w-full`,disabled:I||Ye.isPending}),Ye.isPending?(0,K.jsx)(Em,{className:`text-muted-foreground h-4 w-4 animate-spin`}):Ye.isSuccess?(0,K.jsx)(Yp,{className:`h-4 w-4 text-emerald-500`}):null]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Changes apply immediately to all CodeMirror editors.`})]})]})]}),!I&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(m$,{id:`settings-opsx-invocation`,index:q9(`settings-opsx-invocation`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Rm,{className:`h-5 w-5`}),`OPSX Invocation`]}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`label`,{className:`mb-3 block text-sm font-medium`,children:`Agent invocation mode`}),(0,K.jsx)(wj,{value:Jt,onChange:e=>Ze.mutate(e),options:Qt}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Unsupported command actions automatically keep compose mode.`})]})]}),(0,K.jsxs)(m$,{id:`settings-terminal`,index:q9(`settings-terminal`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Bm,{className:`h-5 w-5`}),`Terminal`]}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsx)(yrt,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Use Theme`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(wj,{value:lt,onChange:e=>{ut(e),Mt({useTheme:e})},options:Xk.map(e=>({value:e,disabled:Pt.isPending,label:e===`app`?`App`:e===`system`?`System`:e===`light`?`Light`:`Dark`}))})}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:[(0,K.jsx)(`code`,{children:`app`}),` follows the current openspecui theme. `,(0,K.jsx)(`code`,{children:`system`}),` `,`follows the OS color scheme.`]})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Light Theme`}),(0,K.jsx)(W1,{value:dt,options:Ot,onValueChange:e=>{ft(e),Mt({lightTheme:e})},ariaLabel:`Light Theme`,className:`w-full`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Dark Theme`}),(0,K.jsx)(W1,{value:pt,options:Ot,onValueChange:e=>{mt(e),Mt({darkTheme:e})},ariaLabel:`Dark Theme`,className:`w-full`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Renderer Engine`}),(0,K.jsx)(W1,{value:ht,options:kt,onValueChange:e=>{gt(e),eA(e)?Nt(e):Et(`Invalid renderer engine: ${e}`)},ariaLabel:`Renderer Engine`,className:`w-full`}),Tt?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-red-500`,children:Tt}):(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Switches immediately and remounts current terminal sessions.`}),!At&&(0,K.jsx)(`p`,{className:`mt-2 text-xs text-amber-500`,children:`Current config contains an unsupported renderer value. Select a valid one to fix it.`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Bell Sound`}),(0,K.jsx)(Xnt,{value:_t,defaultValue:`builtin:Tink`,onValueChange:e=>{vt(e),Mt({bellSound:e})},onPreview:e=>void jt.play(e??_t,yt),ariaLabel:`Bell Sound`,previewDisabled:_t===`silent`||yt===0,volume:yt,onVolumeChange:e=>{bt(e),Mt({bellVolume:e})}})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`mb-2 block text-sm font-medium`,children:[`Font Size: `,$e,`px`]}),(0,K.jsx)(`input`,{type:`range`,min:8,max:32,value:$e,onChange:e=>{let t=Number(e.target.value);et(t),Mt({fontSize:t})},className:`accent-primary w-full`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex justify-between text-xs`,children:[(0,K.jsx)(`span`,{children:`8`}),(0,K.jsx)(`span`,{children:`32`})]})]}),(0,K.jsx)(Iit,{value:tt,onChange:e=>{nt(e),Mt({fontFamily:e})},onBlur:()=>Mt({fontFamily:tt})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Cursor Style`}),(0,K.jsx)(wj,{value:at,onChange:e=>{ot(e),Mt({cursorStyle:e})},options:Fit})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`Cursor Blink`}),(0,K.jsx)(LA,{checked:rt,onCheckedChange:e=>{it(e),Mt({cursorBlink:e})},ariaLabel:`Cursor Blink`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`mb-2 block text-sm font-medium`,children:[`Scrollback Lines: `,st.toLocaleString()]}),(0,K.jsx)(`input`,{type:`range`,min:0,max:1e5,step:1e3,value:st,onChange:e=>{let t=Number(e.target.value);ct(t),Mt({scrollback:t})},className:`accent-primary w-full`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex justify-between text-xs`,children:[(0,K.jsx)(`span`,{children:`0`}),(0,K.jsx)(`span`,{children:`100,000`})]})]}),(0,K.jsx)(`div`,{className:`flex justify-end`,children:(0,K.jsxs)(Cj,{onClick:()=>{Pt.mutate({fontSize:$e,fontFamily:Vt,cursorBlink:rt,cursorStyle:at,scrollback:st,useTheme:lt,lightTheme:dt,darkTheme:pt,rendererEngine:At?ht:void 0,bellSound:_t,bellVolume:yt})},disabled:Pt.isPending||!At,activity:Ht&&At,children:[Pt.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):Ht?(0,K.jsx)(Yp,{className:`h-4 w-4`}):null,Pt.isPending?`Saving...`:Ht?`Saved`:`Save`]})})]})]}),(0,K.jsx)(m$,{id:`settings-notifications`,index:q9(`settings-notifications`),className:`space-y-4`,children:(0,K.jsx)(Znt,{sound:Yt,volume:Xt,systemNotificationsEnabled:Zt})}),(0,K.jsx)(lit,{index:q9(`settings-translation`)}),(0,K.jsxs)(m$,{id:`settings-dashboard`,index:q9(`settings-dashboard`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Sm,{className:`h-5 w-5`}),`Dashboard`]}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Trend Point Limit`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Max data points kept per top metric card trend (server-shared in-memory history).`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`number`,min:20,max:500,step:10,value:xt,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&St(t)},className:`bg-background border-border text-foreground focus:ring-primary w-36 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(Cj,{onClick:()=>{let e=Math.max(20,Math.min(500,Math.trunc(xt||100)));St(e),Ft.mutate(e)},disabled:Ft.isPending,activity:Ut,children:Ft.isPending?`Saving...`:Ut?`Saved`:`Save`})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Allowed range: 20-500. Lower values reduce memory and increase visual smoothing.`})]})})]}),(0,K.jsxs)(m$,{id:`settings-git-detail`,index:q9(`settings-git-detail`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(_m,{className:`h-5 w-5`}),`Git Detail`]}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Eager Patch Line Budget`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Server-side line budget for the initial Git detail payload. Files are included as a prefix, and the file that crosses the budget still ships eagerly.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`number`,min:0,max:2e5,step:100,value:Ct,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&wt(t)},className:`bg-background border-border text-foreground focus:ring-primary w-40 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(Cj,{onClick:()=>{let e=Math.max(0,Math.min(2e5,Math.trunc(Ct||0)));wt(e),It.mutate(e)},disabled:It.isPending,activity:Wt,children:It.isPending?`Saving...`:Wt?`Saved`:`Save`})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:"Set to `0` to force fully lazy patch loading. Default is `1000`."})]})})]}),(0,K.jsxs)(m$,{id:`settings-project-directory`,index:q9(`settings-project-directory`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Project Directory`}),(0,K.jsx)(`div`,{className:`border-border rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(pm,{className:`text-muted-foreground mt-1 h-4 w-4 shrink-0`}),ee.projectDir?(0,K.jsx)(Hnt,{path:ee.projectDir,className:`flex-1`}):(0,K.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Loading...`})]})})]}),(0,K.jsxs)(m$,{id:`settings-cli-configuration`,index:q9(`settings-cli-configuration`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`CLI Configuration`}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Global CLI Detection`}),(0,K.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:z?(0,K.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Detecting global openspec command...`]}):R?.hasGlobal?(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Global CLI installed:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`openspec `,R.version]})]}),R.hasUpdate&&R.latestVersion&&(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-amber-600`,children:[(0,K.jsx)(qp,{className:`h-4 w-4`}),`Update available:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`v`,R.latestVersion]})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-yellow-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Global CLI not found`]}),R?.latestVersion&&(0,K.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Latest version:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`v`,R.latestVersion]})]})]})}),!z&&(!R?.hasGlobal||R?.hasUpdate)&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:()=>h(!0),className:`bg-primary text-primary-foreground flex items-center gap-2 rounded-md px-3 py-1.5 text-sm hover:opacity-90`,children:R?.hasUpdate?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qp,{className:`h-4 w-4`}),`Update to v`,R.latestVersion]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nm,{className:`h-4 w-4`}),`Install Globally`]})}),(0,K.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Run:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`npm install -g @fission-ai/openspec`})]})]}),R?.error&&(0,K.jsxs)(`p`,{className:`mt-1 text-sm text-red-500`,children:[`Detection error: `,R.error]})]}),(0,K.jsxs)(`div`,{className:`border-border border-t pt-3`,children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Execute Path`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Override the runner command used to execute OpenSpec. Leave empty to auto-resolve.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:De,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2 font-mono text-sm`}),(0,K.jsx)(Cj,{onClick:()=>Ge.mutate(c),disabled:Ge.isPending,activity:Gt,children:Ge.isPending?`Saving...`:Gt?`Saved`:`Save`})]}),L?.cli?.command&&(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:[`Saved execute path:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:G9(L.cli.command,L.cli.args??[])})]})]}),(0,K.jsxs)(`div`,{className:`border-border border-t pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Bm,{className:`text-muted-foreground h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`CLI Status:`}),V?(0,K.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Checking...`]}):B?.available?(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Available `,B.version&&`(${B.version})`]}):(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-red-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Not available`]})]}),re&&(0,K.jsxs)(`p`,{className:`text-muted-foreground ml-6 mt-1 text-sm`,children:[`Effective execute path:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:re})]}),B&&!B.available&&B.error&&(0,K.jsxs)(`p`,{className:`text-muted-foreground ml-6 mt-1 text-sm`,children:[B.error,(0,K.jsx)(`br`,{}),`Set an explicit execute path above to recover quickly.`]})]})]})]}),(0,K.jsxs)(m$,{id:`settings-openspec-profile`,index:q9(`settings-openspec-profile`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`OpenSpec Profile & Sync`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:ue?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Loading profile state...`]}):le?.available?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Profile`}),(0,K.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:le.profile})]}),(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Delivery`}),(0,K.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:le.delivery})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-muted-foreground mb-1 text-xs`,children:`Workflows`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:le.workflows.length>0?le.workflows.map(e=>(0,K.jsx)(`span`,{className:`border-border bg-muted rounded border px-1.5 py-0.5 text-xs`,children:e},e)):(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`(none)`})})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-wrap items-center gap-2 border-t pt-3`,children:[le.driftStatus===`drift`?(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm text-amber-600`,children:[(0,K.jsx)(Hm,{className:`h-4 w-4`}),`Global profile is not fully applied to this project.`]}):le.driftStatus===`in-sync`?(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Project files are in sync with global profile.`]}):(0,K.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Drift status unavailable.`}),le.warningText&&(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:le.warningText})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-wrap items-center gap-2 border-t pt-3`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ke.mutate(),disabled:Ke.isPending,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm disabled:opacity-50`,children:[Ke.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Am,{className:`h-4 w-4`}),`Run openspec update`]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>qe.mutate(),disabled:qe.isPending,className:`border-border hover:bg-muted inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm disabled:opacity-50`,children:[qe.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Yp,{className:`h-4 w-4`}),`Set profile to core`]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void H(),className:`border-border hover:bg-muted inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm`,children:[(0,K.jsx)(Am,{className:`h-4 w-4`}),`Refresh state`]})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Note: `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec update`}),` follows OpenSpec CLI profile behavior and prunes deselected workflow command/skill files.`]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`For interactive custom profile editing, run`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec config profile`}),` in a local terminal.`]})]}):(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Unable to read profile state from OpenSpec CLI.`]}),le?.error&&(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:le.error})]})})]}),(0,K.jsxs)(m$,{id:`settings-api-configuration`,index:q9(`settings-api-configuration`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`API Configuration`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`API Server URL`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Leave empty for same-origin requests. Set a custom URL to connect to a different server.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:window.location.origin,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2`}),(0,K.jsx)(Cj,{onClick:$t,activity:Kt,children:Kt?`Applied`:`Apply`})]}),$a()&&(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:[`Current: `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:$a()})]})]})})]}),(0,K.jsxs)(m$,{id:`settings-hosted-app`,index:q9(`settings-hosted-app`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Hosted App`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Base URL`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:[`Used by `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspecui --app`}),` when no explicit base URL is passed. Leave empty to use the official app shell. Reusing an installed PWA only works when that PWA was installed from this same shell origin.`]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`https://app.openspecui.com`,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2`}),(0,K.jsx)(Cj,{onClick:()=>Xe.mutate(o),disabled:Xe.isPending,activity:qt,children:Xe.isPending?`Saving...`:qt?`Saved`:`Save`})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:[`Effective default:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:Rt||`https://app.openspecui.com`})]})]})})]}),(0,K.jsxs)(m$,{id:`settings-file-watcher`,index:q9(`settings-file-watcher`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`File Watcher`}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`File watcher is configured on the server side. Check the status bar at the bottom of the page to see if file watching is enabled.`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Cm,{className:`h-4 w-4 text-green-500`}),(0,K.jsx)(`span`,{children:`Enabled: Real-time updates when files change`})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Um,{className:`h-4 w-4 text-yellow-500`}),(0,K.jsx)(`span`,{children:`Disabled: Manual refresh required`})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-3 text-sm`,children:[`To disable file watching, restart the server with`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`--no-watch`}),` flag.`]})]})]}),(0,K.jsxs)(m$,{id:`settings-init-openspec`,index:q9(`settings-init-openspec`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Initialize OpenSpec`}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Create the OpenSpec directory structure in the current project. This will create`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec/`}),` with specs, changes, and archive directories.`]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Init Mode`}),(0,K.jsx)(W1,{value:g,options:Cit,onValueChange:_,ariaLabel:`Init Mode`,className:`w-full`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`OpenSpec CLI can auto-detect existing tool directories. OpenSpecUI 3.x uses OpenSpec CLI 1.3.x as the current tool line.`})]}),(0,K.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Profile Override`}),(0,K.jsx)(W1,{value:v,options:wit,onValueChange:y,ariaLabel:`Profile Override`,className:`w-full`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Adds `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`--profile`}),` when set.`]})]})]}),(0,K.jsxs)(`div`,{className:`space-y-4 ${Be?``:`opacity-60`}`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`AI Tools Configuration`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Color encodes current init state. Hover a tool for the exact status.`})]}),(0,K.jsx)(`button`,{onClick:Fe,disabled:!Be,className:`text-primary shrink-0 text-xs hover:underline disabled:cursor-not-allowed disabled:opacity-50`,children:we.length>0&&we.length===Ce.length?`Deselect All`:`Select All`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-muted-foreground mb-2 text-xs font-medium`,children:`Natively supported providers (OpenSpec custom commands + skills)`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,children:me.map(e=>{let t=j9(ye,e.value),n=t===`initialized`,r=t===`partial`,i=we.includes(e.value),a=ye.get(e.value)?.legacyCommandWorkflows??[],o=n?a.length>0?`Initialized: legacy-compatible command paths detected for ${a.join(`, `)}`:`Initialized: exact match for current delivery/workflows`:r?`Partial: detected artifacts need repair for current delivery/workflows`:`Uninitialized: no generated artifacts detected`;return(0,K.jsxs)(`button`,{onClick:()=>Pe(e.value),disabled:n||!Be,title:o,className:`flex min-w-0 items-center gap-1.5 rounded border px-2.5 py-1.5 text-left text-xs font-medium transition-colors ${n?`cursor-not-allowed border-emerald-500/50 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:r?`text-foreground border-amber-500/50 bg-amber-500/10 hover:bg-amber-500/15`:i?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,K.jsx)($p,{className:`h-3 w-3 shrink-0 text-emerald-600 dark:text-emerald-300`}):r?(0,K.jsx)(Hm,{className:`h-3 w-3 shrink-0 text-amber-600 dark:text-amber-300`}):i?(0,K.jsx)(Yp,{className:`h-3 w-3 shrink-0`}):null]},e.value)})})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex flex-wrap gap-4 text-xs`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-500/50`}),ke,` initialized`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-500/50`}),Ae,` repair needed`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`bg-primary/50 h-2 w-2 rounded-full`}),we.length,` selected`]})]})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-row flex-wrap gap-2.5 border-t pt-3 md:flex-nowrap`,children:[(0,K.jsxs)(`button`,{onClick:()=>je(g),disabled:He.disabled,title:He.title,className:`bg-primary text-primary-foreground inline-flex grow-0 items-start justify-start gap-2 self-start rounded-md px-3.5 py-2 text-[13px] font-medium leading-5 hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50 md:min-w-0 md:max-w-none md:text-balance`,children:[(0,K.jsx)(mm,{className:`mt-1 h-4 w-4 shrink-0`}),He.label]}),(0,K.jsxs)(`label`,{className:`border-border bg-background/50 flex min-w-0 flex-col gap-1 rounded-md border px-3 py-2`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`break-word text-xs font-medium leading-4`,children:`Force non-interactive init`}),(0,K.jsx)(LA,{checked:b,onCheckedChange:x,ariaLabel:`Force non-interactive init`})]}),(0,K.jsxs)(`span`,{className:`text-muted-foreground text-[11px] leading-4`,children:[`Enabled by default so`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec init --tools ...`}),` `,`also writes`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec/config.yaml`}),`.`]})]})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:He.helperText})]})]})]}),!I&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(xA,{open:f,onClose:Ue,bodyClassName:`max-h-[70vh]`,borderVariant:k,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Bm,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:`Initialize OpenSpec`})]}),footer:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:Ue,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:T===`running`,children:`Close`}),T!==`success`&&(0,K.jsx)(`button`,{onClick:()=>E.runAll(),className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:T===`running`||g===`selected`&&!ze,children:T===`running`?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):`Run init`})]}),children:(0,K.jsx)(IA,{lines:w})}),(0,K.jsxs)(xA,{open:m,onClose:We,bodyClassName:`max-h-[70vh]`,borderVariant:F,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(nm,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:R?.hasUpdate?`Update OpenSpec CLI`:`Install OpenSpec CLI Globally`})]}),footer:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:We,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:j===`running`,children:`Close`}),(0,K.jsx)(`button`,{onClick:()=>{We(),Ee()},className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:j!==`success`,children:`Re-detect CLI`})]}),children:[(0,K.jsx)(IA,{lines:A}),j===`success`&&(0,K.jsxs)(`div`,{className:`border-border bg-muted/40 mt-3 rounded border px-3 py-2 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),R?.hasUpdate?`OpenSpec CLI updated to v${R?.latestVersion??``}`:`OpenSpec CLI installed globally`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`You can now run the "openspec" command directly. Click "Re-detect CLI" to refresh status.`})]})]})]})]})]})})}function Rit(){let{data:e,isLoading:t}=sce();return t&&!e?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading specs...`}):(0,K.jsxs)(`div`,{className:`space-y-6 p-4`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{className:`h-6 w-6 shrink-0`}),`Specifications`]}),(0,K.jsxs)(`div`,{className:`border-border divide-border divide-y rounded-lg border`,children:[e?.map(e=>{let t={family:`specs`,entityId:e.id};return(0,K.jsxs)(Lp,{to:`/specs/$specId`,params:{specId:e.id},state:t=>({...t,__vtHandoff:{family:`specs`,entityId:e.id,title:e.name,subtitle:e.id}}),vt:{sharedElements:t},...kp(t,`container`),className:`hover:bg-muted/50 flex items-center justify-between p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(sm,{...kp(t,`icon`),className:`text-muted-foreground h-5 w-5`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{...kp(t,`title`),className:`font-medium`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[e.id,e.updatedAt>0&&(0,K.jsxs)(K.Fragment,{children:[` · `,qA(e.updatedAt)]})]})]})]}),(0,K.jsx)(Zp,{className:`text-muted-foreground h-4 w-4`})]},e.id)}),e?.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground p-4 text-center`,children:[`No specs found. Create a spec in `,(0,K.jsx)(`code`,{children:`openspec/specs/`})]})]})]})}function zit(){let{specId:e}=va({from:`/specs/$specId`}),t=Mp(Va().state),n=(0,G.useMemo)(()=>({family:`specs`,entityId:e}),[e]),{data:r,isLoading:i}=cce(e),{data:a,isLoading:o}=lce(e),{data:s}=op(),{data:c}=sp(),l=(0,G.useMemo)(()=>eY(s?.translation,c),[s?.translation,c]);return i&&!r||o&&!a?t?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(Lp,{to:`/specs`,vt:{sharedElements:n},className:`hover:bg-muted rounded-md p-2`,children:(0,K.jsx)(Wp,{className:`h-5 w-5`})}),(0,K.jsxs)(`div`,{...kp(n,`container`),children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{...kp(n,`icon`),className:`h-6 w-6 shrink-0`}),(0,K.jsx)(`span`,{...kp(n,`title`),children:t.title??e})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`ID: `,t.subtitle??e]})]})]}),(0,K.jsx)(`div`,{className:`vt-detail-content route-loading animate-pulse rounded-lg border p-4`,children:`Loading spec...`})]}):(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading spec...`}):r?(0,K.jsx)(Bit,{spec:r,rawMarkdown:a??``,validation:null,translationConfig:l}):(0,K.jsx)(`div`,{className:`text-red-600`,children:`Spec not found`})}function Bit({spec:e,rawMarkdown:t,validation:n,translationConfig:r}){let i=(0,G.useRef)(null),a=(0,G.useMemo)(()=>({family:`specs`,entityId:e.id}),[e.id]);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(Lp,{to:`/specs`,vt:{source:i,sharedElements:a},className:`hover:bg-muted rounded-md p-2`,children:(0,K.jsx)(Wp,{className:`h-5 w-5`})}),(0,K.jsxs)(`div`,{ref:i,...kp(a,`container`),children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{...kp(a,`icon`),className:`h-6 w-6 shrink-0`}),(0,K.jsx)(`span`,{...kp(a,`title`),children:e.name})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`ID: `,e.id]})]})]}),n&&(0,K.jsx)(Vit,{validation:n}),(0,K.jsx)(v$,{markdown:t,path:`specs/${e.id}/spec.md`,className:`vt-detail-content min-h-0 flex-1`,translationConfig:r})]})}function Vit({validation:e}){let t=e.issues.filter(e=>e.severity===`ERROR`),n=e.issues.filter(e=>e.severity===`WARNING`),r=e.issues.filter(e=>e.severity===`INFO`);return(0,K.jsxs)(`div`,{className:`flex rounded-lg border p-4 ${e.valid?`border-green-500 bg-green-500/10`:`border-red-500 bg-red-500/10`}`,children:[(0,K.jsxs)(`div`,{className:`align-content flex gap-2`,children:[e.valid?(0,K.jsx)($p,{className:`h-5 w-5 text-green-500`}):(0,K.jsx)(Qp,{className:`h-5 w-5 text-red-500`}),(0,K.jsx)(`span`,{className:`font-medium ${e.valid?`text-green-600`:`text-red-600`}`,children:e.valid?`Validation Passed`:`Validation Failed`})]}),e.issues.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[t.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-red-600`,children:[(0,K.jsx)(Qp,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t)),n.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-yellow-600`,children:[(0,K.jsx)(Hm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t)),r.map((e,t)=>(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-start gap-2`,children:[(0,K.jsx)(ym,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t))]})]})}var J9=`border-terminal-foreground/20`,Y9=`ease-[cubic-bezier(0.22,0.61,0.36,1)]`;function Hit({tabs:e,selectedTab:t,onTabChange:n,onTabClose:r,onTabOrderChange:i,actions:a,onTabBarDoubleClick:o,className:s}){return(0,K.jsx)(bj,{tabs:e,selectedTab:t,onTabChange:n,onTabClose:r,onTabOrderChange:i,onTabBarDoubleClick:o,actions:a,className:s,showHeaderShell:!1,showSelectionIndicator:!0,decorateStrip:!1,selectionIndicatorLayout:`overlay`,classNames:{header:`bg-terminal text-terminal-foreground`,headerForeground:`z-auto flex-1`,headerFrame:`items-end`,strip:`min-w-0 flex-1 items-end border-b ${J9} px-4 rounded-none`,list:`flex-1 items-end overflow-y-hidden pt-2 [&::scroll-button(*)]:mt-3`,buttonBase:`z-20 w-[clamp(8.5rem,18vw,13rem)] rounded-t-[8px] border border-b-0 border-transparent px-0 py-0 transition-[color,background-color,border-color] duration-180 ${Y9}`,buttonInner:`grid h-full min-w-0 w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded-t-[8px] px-3 py-1.5 transition-[color,background-color,transform,filter] duration-180 ${Y9} will-change-transform`,activeButton:`bg-transparent text-terminal-foreground`,activeButtonInner:`bg-transparent text-terminal-foreground [transform:translateY(0)]`,inactiveButton:`bg-transparent text-terminal-foreground/72 hover:border-[color-mix(in_oklab,var(--background)_10%,transparent)] hover:text-terminal-foreground`,inactiveButtonInner:`bg-terminal [filter:brightness(0.9)] [transform:translateY(0.25em)] hover:text-terminal-foreground hover:[filter:brightness(0.96)] hover:[transform:translateY(0.125em)]`,actions:`${J9} bg-terminal text-terminal-foreground border-b rounded-none px-1`,selectionIndicatorViewport:`inset-x-0 top-0 bottom-[-1px] overflow-visible overflow-x-hidden`,closeButtonActive:`text-terminal-foreground/70 hover:text-terminal-foreground`,closeButtonInactive:`text-terminal-foreground/50 hover:text-terminal-foreground`,selectionIndicator:`${J9} border-x border-t border-b-0 bg-terminal rounded-t-[8px] shadow-[0_1px_0_var(--terminal)] duration-180 ${Y9}`}})}var Uit=8;function Wit(e,t){for(let n=0;n<e.length;n+=1){let r=e.item?.(n)??e[n];if(r?.identifier===t)return r}return null}function Git(e){return e.item?.(0)??e[0]??null}function Kit(e,t){let n=t.clientX-e.startX,r=t.clientY-e.startY;return Math.sqrt(n*n+r*r)>Uit}function qit(e,t){if(!(t instanceof Node)||!e.contains(t)||t instanceof Element&&t.closest(`input-panel`))return!1;let n=e.querySelector(`.xterm`)??e.querySelector(`.xterm-screen`);return n?t===e||n.contains(t):!0}function X9(e,t,n){let r=document.elementFromPoint(t,n);return r&&e.contains(r)&&!r.classList.contains(`terminal-touch-mouse-overlay`)?r:e.querySelector(`.xterm-screen`)??e}function Z9(e,t,n,r){let i=e.ownerDocument.defaultView??window;e.dispatchEvent(new i.MouseEvent(t,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,button:0,buttons:r.buttons,detail:r.detail??1}))}function Jit({sessionId:e}){let t=(0,G.useRef)(null),n=(0,G.useRef)(null),r=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{let e=t.current?.parentElement;if(!e)return;let i=e=>{e.preventDefault(),e.stopPropagation()},a=t=>{if(t.touches.length!==1||!qit(e,t.target))return;i(t);let a=Git(t.touches);a&&(n.current={identifier:a.identifier,startX:a.clientX,startY:a.clientY},r.current=!1,Z9(X9(e,a.clientX,a.clientY),`mousedown`,a,{buttons:1}))},o=t=>{let a=n.current;if(!a)return;i(t);let o=Wit(t.touches,a.identifier);o&&(Kit(a,o)&&(r.current=!0),Z9(X9(e,o.clientX,o.clientY),`mousemove`,o,{buttons:1}))},s=(t,a)=>{let o=n.current;if(!o)return;i(t);let s=Wit(t.changedTouches,o.identifier);if(!s)return;let c=X9(e,s.clientX,s.clientY);Z9(c,`mouseup`,s,{buttons:0}),a&&!r.current&&Z9(c,`click`,s,{buttons:0}),n.current=null,r.current=!1},c=e=>s(e,!0),l=e=>s(e,!1);return e.addEventListener(`touchstart`,a,{capture:!0,passive:!1}),e.addEventListener(`touchmove`,o,{capture:!0,passive:!1}),e.addEventListener(`touchend`,c,{capture:!0,passive:!1}),e.addEventListener(`touchcancel`,l,{capture:!0,passive:!1}),()=>{e.removeEventListener(`touchstart`,a,{capture:!0}),e.removeEventListener(`touchmove`,o,{capture:!0}),e.removeEventListener(`touchend`,c,{capture:!0}),e.removeEventListener(`touchcancel`,l,{capture:!0})}},[]),(0,K.jsx)(`div`,{ref:t,"data-testid":`terminal-touch-mouse-overlay-${e}`,className:`terminal-touch-mouse-overlay absolute inset-0 z-20 bg-transparent`,"aria-hidden":`true`})}function Yit({sessionId:e}){let t=(0,G.useRef)(null);return(0,G.useEffect)(()=>{let n=t.current;if(n)return uA.mount(e,n),()=>{uA.unmount(e)}},[e]),(0,K.jsx)(`div`,{ref:t,className:`relative h-full w-full`,style:{minHeight:0},onPointerDown:()=>uA.focusSession(e),children:(0,K.jsx)(Jit,{sessionId:e})})}function Xit({session:e,onRename:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(``),o=(0,G.useRef)(null),s=(0,G.useCallback)(()=>{a(``),r(!0),requestAnimationFrame(()=>o.current?.focus())},[]),c=(0,G.useCallback)(()=>{r(!1);let n=i.trim();n&&t(e.id,n)},[i,e.id,t]),l=(0,G.useCallback)(()=>{r(!1)},[]),u=(0,K.jsxs)(`span`,{className:`relative inline-flex h-3 w-3 shrink-0 items-center justify-center`,children:[e.lastBellAt!==null&&(0,K.jsx)(`span`,{"data-testid":`terminal-bell-ripple-${e.id}`,className:`animate-terminal-bell-ripple bg-primary/45 absolute h-2 w-2 rounded-full`},e.lastBellAt),(0,K.jsx)(`span`,{className:[`relative inline-block h-2 w-2 rounded-full`,e.isExited?e.exitCode===0?`bg-emerald-500`:`bg-red-500`:e.outputActive?`animate-terminal-breathing`:`bg-zinc-400`].join(` `)})]});return n?(0,K.jsxs)(`span`,{className:`grid min-w-0 grid-cols-[0.75rem_minmax(0,1fr)] items-center gap-1.5`,children:[u,(0,K.jsx)(`input`,{ref:o,value:i,placeholder:e.displayTitle,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c(),e.key===`Escape`&&l(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:`placeholder:text-muted-foreground min-w-0 border-b border-current bg-transparent text-sm text-inherit outline-none`})]}):(0,K.jsxs)(`span`,{className:`grid min-w-0 grid-cols-[0.75rem_minmax(0,1fr)] items-center gap-1.5`,onDoubleClick:s,children:[u,(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.displayTitle})]})}function Zit({unreadCount:e}){if(e<=0)return null;let t=`${e} unread notification${e===1?``:`s`}`;return e===1?(0,K.jsx)(ob,{size:`dot`,className:`-mr-0.5 -mt-0.5 ring-1 ring-[var(--terminal)]`,title:t,"aria-label":t}):(0,K.jsx)(sb,{count:e,className:`ring-1 ring-[var(--terminal)]`,title:t,"aria-label":t})}var Qit=2e3;function $it({className:e}){let{sessions:t,activeSessionId:n,setActiveSession:r,createShellSession:i,closeSession:a,setCustomTitle:o}=K1(),{notifications:s,clearTerminalSession:c}=gA(),{shellProfiles:l,spawnCommands:u,defaultShellProfile:d}=x2(),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),g=(0,G.useRef)(null),_=ko(),v=_.bottomTabs.includes(`/terminal`),y=_.mainLocation.pathname===`/terminal`||_.mainLocation.pathname.startsWith(`/terminal/`)||_.bottomLocation.pathname===`/terminal`||_.bottomLocation.pathname.startsWith(`/terminal/`),b=(0,G.useMemo)(()=>{let e=uA.getResolvedTheme();return{"--terminal":e.definition.palette.background,"--terminal-foreground":e.definition.palette.foreground}},[(0,G.useSyncExternalStore)(e=>uA.subscribe(e),()=>uA.getSnapshot(),()=>uA.getSnapshot())]);(0,G.useEffect)(()=>(g.current&&uA.setInputPanelMountTarget(g.current),()=>{uA.setInputPanelMountTarget(null)}),[]);let x=(0,G.useCallback)((e,t)=>{o(e,t)},[o]),S=(0,G.useMemo)(()=>{let e=new Map;for(let t of s)t.source.type===`terminal`&&e.set(t.source.sessionId,(e.get(t.source.sessionId)??0)+1);return e},[s]);(0,G.useEffect)(()=>{if(!y)return;let e=t.find(e=>e.id===n)?.serverSessionId;if(!e||!s.some(t=>t.source.type===`terminal`&&t.source.sessionId===e))return;let r=window.setTimeout(()=>{c(e)},Qit);return()=>window.clearTimeout(r)},[n,c,y,s,t]);let C=(0,G.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,(0,K.jsx)(`div`,{className:`bg-terminal h-full`,children:(0,K.jsx)(Yit,{sessionId:n.id})}));return e},[t]),w=(0,G.useMemo)(()=>t.map(e=>{let t=e.serverSessionId?S.get(e.serverSessionId)??0:0;return{id:e.id,title:e.displayTitle,label:(0,K.jsx)(Xit,{session:e,onRename:x}),badge:t>0?(0,K.jsx)(Zit,{unreadCount:t}):void 0,unmountOnHide:!0,closable:!0,closeButtonVisibility:`always`,content:C.get(e.id)}}),[t,x,C,S]);(0,G.useLayoutEffect)(()=>{uA.setInputPanelDefaultLayout(v?`floating`:`fixed`)},[v]);let T=(0,G.useCallback)(()=>{Oo.moveTab(`/terminal`,v?`main`:`bottom`)},[v]),E=(0,G.useCallback)(()=>{v&&Oo.closeTab(`/terminal`)},[v]),D=(0,G.useCallback)(()=>{uA.openInputPanel(n??void 0)},[n]),O=(0,G.useCallback)(e=>{r(e);let n=t.find(t=>t.id===e);n?.serverSessionId&&c(n.serverSessionId)},[c,t,r]),k=(0,G.useCallback)(()=>{i(d)},[i,d]),A=(0,G.useCallback)(e=>{e.preventDefault();let t=e.currentTarget;p(e=>e?.type===`target`&&e.element===t?null:{type:`target`,element:t,placement:`bottom-end`})},[]),j=(0,G.useMemo)(()=>{let e=l.map(e=>({id:`shell:${e.id}`,label:e.label,icon:(0,K.jsx)(Bm,{className:`h-3.5 w-3.5`}),onSelect:()=>{i(e),p(null)}})),t=u.map(e=>({id:`command:${e.id}`,label:e.label,icon:(0,K.jsx)(jm,{className:`h-3.5 w-3.5`}),onSelect:()=>{h(e),p(null)}}));return[...e,...e.length>0&&t.length>0?[{id:`separator`,label:``,disabled:!0,onSelect:()=>{}}]:[],...t]},[i,l,u]),M=(0,K.jsx)(`button`,{type:`button`,onClick:k,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,"aria-label":`New terminal`,title:`New terminal`,children:(0,K.jsx)(km,{className:`h-3.5 w-3.5`})}),N=(0,K.jsx)(`button`,{type:`button`,onClick:A,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,"aria-label":`New terminal options`,title:`New terminal options`,children:(0,K.jsx)(Xp,{className:`h-3.5 w-3.5`})}),P=(0,K.jsxs)(`div`,{className:`ml-auto flex items-center`,children:[M,N,(0,K.jsx)(`button`,{type:`button`,onClick:D,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:`Open InputPanel`,children:(0,K.jsx)(_le,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(`button`,{type:`button`,onClick:T,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:v?`Move to main area`:`Move to bottom area`,children:v?(0,K.jsx)(Ele,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Cle,{className:`h-3.5 w-3.5`})}),v&&(0,K.jsx)(`button`,{type:`button`,onClick:E,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:`Close panel`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`})})]});return(0,K.jsxs)(`div`,{ref:g,style:b,className:`bg-background flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden ${e}`,children:[t.length===0?(0,K.jsxs)(`div`,{className:`text-terminal-foreground bg-terminal flex h-full flex-wrap content-center items-center justify-center whitespace-pre p-4 text-sm`,children:[(0,K.jsx)(`span`,{children:`No terminal sessions. Click`}),(0,K.jsxs)(`span`,{className:`mx-2 flex gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:k,className:`bg-primary text-primary-foreground px-2 text-lg font-bold`,"aria-label":`New terminal`,children:`+`}),N]}),(0,K.jsx)(`span`,{children:`to create one.`})]}):(0,K.jsx)(Hit,{tabs:w,selectedTab:n??void 0,onTabChange:O,onTabClose:a,onTabBarDoubleClick:k,actions:P}),(0,K.jsx)(DW,{open:f!==null,anchor:f,items:j,wrapperElement:g.current,onClose:()=>p(null)}),(0,K.jsx)(lnt,{open:m!==null,command:m,onClose:()=>h(null)})]})}function eat(){return(0,K.jsx)($it,{className:`h-full min-w-0 overflow-hidden`})}function Q9(e,t){let n=[Oa({getParentRoute:()=>e,path:`/`,component:()=>null}),Oa({getParentRoute:()=>e,path:`/dashboard`,component:FZe}),Oa({getParentRoute:()=>e,path:`/config`,component:cZe}),Oa({getParentRoute:()=>e,path:`/git`,component:zZe}),Oa({getParentRoute:()=>e,path:`/git/uncommitted`,component:yQe}),Oa({getParentRoute:()=>e,path:`/git/commit/$hash`,component:bQe}),Oa({getParentRoute:()=>e,path:`/specs`,component:Rit}),Oa({getParentRoute:()=>e,path:`/specs/$specId`,component:zit}),Oa({getParentRoute:()=>e,path:`/changes`,component:wYe}),Oa({getParentRoute:()=>e,path:`/changes/$changeId`,component:AYe}),Oa({getParentRoute:()=>e,path:`/archive`,component:CEe}),Oa({getParentRoute:()=>e,path:`/archive/$changeId`,component:SYe}),Oa({getParentRoute:()=>e,path:`/settings`,component:Lit})];return t?.includeTerminal!==!1&&n.push(Oa({getParentRoute:()=>e,path:`/terminal`,component:eat})),e.addChildren(n)}function tat(e){return e.addChildren([Oa({getParentRoute:()=>e,path:`/`,component:()=>null}),Oa({getParentRoute:()=>e,path:`/search`,component:Vnt}),Oa({getParentRoute:()=>e,path:`/notifications`,component:TQe}),Oa({getParentRoute:()=>e,path:`/opsx-new`,component:Ant}),Oa({getParentRoute:()=>e,path:`/opsx-propose`,component:jnt}),Oa({getParentRoute:()=>e,path:`/opsx-verify`,component:Mnt}),Oa({getParentRoute:()=>e,path:`/opsx-compose`,component:knt})])}function nat(){return(0,G.useEffect)(()=>{Tp()},[]),null}var rat=qa(),iat=ka({component:bEe,pendingComponent:()=>(0,K.jsx)(`div`,{className:`route-loading text-muted-foreground animate-pulse p-6 text-center text-sm`,children:`Loading...`})}),$9=Ya(),aat=za(rat?{routeTree:Q9(iat),basepath:$9}:{routeTree:Q9(iat),history:KA(`main`,Oo),basepath:$9});rat||vEe(za({routeTree:Q9(ka({component:_Ee})),history:KA(`bottom`,Oo),basepath:$9})),BTe(za({routeTree:tat(ka({component:RTe})),history:KA(`pop`,Oo),basepath:$9}));function oat(){return(0,K.jsx)(Pee,{client:Xf,children:(0,K.jsx)(JTe,{children:(0,K.jsx)(QXe,{children:(0,K.jsxs)(PTe,{children:[(0,K.jsx)(nat,{}),(0,K.jsx)(xEe,{}),(0,K.jsx)(Ba,{router:aat})]})})})})}function sat(){return(0,K.jsx)(`main`,{className:`bg-background text-foreground flex min-h-screen items-center justify-center p-6`,children:(0,K.jsxs)(`section`,{className:`bg-card flex w-full max-w-lg flex-col gap-3 border p-6`,children:[(0,K.jsx)(`h1`,{className:`font-nav text-sm uppercase tracking-[0.14em]`,children:`Hosted Session Not Connected`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm leading-6`,children:[`This embedded UI session needs explicit `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`api`}),` `,`and `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`session`}),` query parameters from the app shell. Open it through `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspecui --app`}),` `,`instead of loading the backend page directly.`]})]})})}var cat=()=>{let e=document.getElementById(`root`);return e&&e.innerHTML.trim().length>0},lat=()=>typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0;async function uat(){let e=document.getElementById(`root`),t=Qa();if(t.hosted&&!t.apiBaseUrl){(0,Ha.createRoot)(e).render((0,K.jsx)(sat,{}));return}let n=lat()||await One();kne(n),n&&console.log(`[OpenSpec UI] Running in static mode`),cat()&&n?(console.log(`[OpenSpec UI] Hydrating pre-rendered content`),(0,Ha.hydrateRoot)(e,(0,K.jsx)(oat,{}))):(console.log(`[OpenSpec UI] Fresh render`),(0,Ha.createRoot)(e).render((0,K.jsx)(oat,{})))}uat();export{jye as A,pCe as C,Jbe as D,FE as E,X as F,ep as M,Xf as N,NE as O,tp as P,PCe as S,LE as T,LP as _,TF as a,VM as b,kF as c,dF as d,lF as f,zP as g,cF as h,OF as i,Zf as j,Mye as k,vF as l,iF as m,vje as n,wF as o,rF as p,_F as r,jF as s,yje as t,NF as u,RP as v,tSe as w,BM as x,IP as y};
1670
+ `)}async function y9(e){return qa()?e.staticFallback():X.opsx.runWorkflow.mutate({requestedMode:e.requestedMode,input:e.workflowInput})}var Ont={continue:`Continue`,ff:`Fast-forward`,apply:`Apply`,archive:`Archive`};function knt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),{data:r}=op(),i=(0,G.useMemo)(()=>kYe(e.search),[e.search]),a=r?.opsx?.agentInvocationMode??`compose`,o=(0,G.useMemo)(()=>i?xnt(i.action,a):null,[i,a]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null);(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},dialogClassName:`overflow-hidden`,panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,920px)`,onDismissRequest:null})},[t]),(0,G.useEffect)(()=>{let e=!1;return(async()=>{if(!i){c(``),f(`Invalid compose parameters.`),u(!1);return}m(null),u(!0),f(null);try{let t=await y9({requestedMode:a,workflowInput:i.action===`continue`||i.action===`ff`?{action:i.action,changeId:i.changeId,artifactId:i.artifactId??``}:{action:i.action,changeId:i.changeId},staticFallback:()=>({kind:`agent-prompt`,text:H$(i),format:`markdown`,mode:o??{requestedMode:a,actualMode:a,fallbackReason:null}})});if(e)return;let n=i2(Dnt(t));c(n.text);let r=v9(t);r?f(r):n.modified&&f(`ANSI/control characters were stripped from generated prompt for safety.`)}catch(t){if(e)return;c(H$(i)),f($0(t))}finally{e||u(!1)}})(),()=>{e=!0}},[i,o,a]);let h=i?Ont[i.action]:`Compose`;return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsx)(`div`,{className:`border-border flex items-center justify-between gap-3 border-b px-4 py-3`,children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`font-nav truncate text-base tracking-[0.04em]`,children:[h,` Prompt`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground truncate text-xs`,children:i?`change: ${i.changeId}`:`missing change context`})]})}),(0,K.jsxs)(`div`,{className:`flex max-h-full min-h-0 min-w-0 flex-1 flex-col gap-3 overflow-hidden p-4`,children:[o&&(0,K.jsxs)(`div`,{className:`bg-muted/40 border-border rounded-md border p-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Invocation:`}),` `,(0,K.jsx)(`span`,{className:`font-medium capitalize`,children:o.actualMode}),o.fallbackReason&&(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,o.fallbackReason]})]}),l&&(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Generating prompt...`]}),d&&(0,K.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-sm text-amber-700`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,K.jsx)(Qp,{className:`h-4 w-4`}),`Prompt source warning`]}),(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:d})]}),(0,K.jsxs)(`label`,{className:`flex max-h-full min-h-0 min-w-0 flex-1 flex-col gap-1.5 overflow-hidden`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Prompt`}),(0,K.jsx)(TW,{value:s,onChange:c,language:`markdown`,lineNumbers:!1,lineWrapping:!0,className:`scrollbar-thin scrollbar-track-transparent min-h-0 flex-1 overflow-auto border`,editorMinHeight:`0px`,placeholder:`Compose prompt...`})]})]}),(0,K.jsx)(`div`,{className:`border-border mt-1 border-t p-4`,children:(0,K.jsx)(_nt,{preparePayload:async()=>s,onDispatched:n,onError:m})}),p&&(0,K.jsx)(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 p-3 text-sm text-red-600`,children:p})]})}function Ant(){let{setConfig:e}=TA(),{requestClose:t}=EA(),{createDedicatedSession:n}=K1(),{data:r}=lp(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{e({layout:{alignY:`start`,width:`normal`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,900px)`,onDismissRequest:null})},[e]);let v=i.trim(),y=wnt.test(v),b=v.length>0&&y,x=(0,G.useMemo)(()=>Tnt({changeName:i,schema:o,description:c,extraArgs:u}),[i,o,c,u]),S=(0,G.useMemo)(()=>b?[`openspec`,...x].map(Ent).join(` `):`openspec new change <change-name>`,[x,b]),C=r?.schemas.map(e=>e.name)??[],w=()=>{let e=f.trim();e.length!==0&&(d(t=>[...t,e]),p(``))};return(0,K.jsxs)(`form`,{className:`flex h-full min-h-0 min-w-0 flex-col`,onSubmit:e=>{e.preventDefault(),b&&(async()=>{h(null),_(!0);try{let e=await y9({requestedMode:`direct`,workflowInput:{action:`new`,changeId:v,schema:o,description:c,extraArgs:u},staticFallback:()=>({kind:`cli-command`,command:`openspec`,args:x,mode:{requestedMode:`direct`,actualMode:`direct`,fallbackReason:null}})});if(e.kind!==`cli-command`)throw Error(`Create change workflow must return a CLI command.`);let r=v,i={0:`/changes/${encodeURIComponent(r)}`};n(e.command,e.args,{closeTip:`Press any key or close action to finish this session.`,closeCallbackUrl:i});let a=Oo.getAreaForPath(`/terminal`);Bp.push(a,`/terminal`,null),t()}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}})()},children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center gap-2 border-b px-4 py-3`,children:[(0,K.jsx)(Rm,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Create OPSX Change`})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 overflow-y-auto p-4`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Change Name`}),(0,K.jsx)(`input`,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`add-search-poparea`,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),v.length>0&&!y&&(0,K.jsx)(`span`,{className:`text-destructive text-xs`,children:`Use kebab-case: lowercase letters, numbers, and single hyphens.`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Schema`}),(0,K.jsx)(`input`,{list:`opsx-new-schema-options`,value:o,onChange:e=>s(e.target.value),placeholder:`(optional)`,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),(0,K.jsx)(`datalist`,{id:`opsx-new-schema-options`,children:C.map(e=>(0,K.jsx)(`option`,{value:e},e))})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Description`}),(0,K.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:`(optional)`,rows:3,className:`border-input bg-background focus:ring-ring rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`})]}),(0,K.jsxs)(`details`,{className:`group rounded-md border border-dashed`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2 text-sm font-medium`,children:`Advanced Arguments`}),(0,K.jsxs)(`div`,{className:`border-border flex flex-col gap-3 border-t px-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w())},placeholder:`--my-flag`,className:`border-input bg-background focus:ring-ring flex-1 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2`}),(0,K.jsx)(`button`,{type:`button`,onClick:w,className:`border-border hover:bg-muted rounded-md border px-3 py-2 text-sm`,children:`Add`})]}),u.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:u.map((e,t)=>(0,K.jsxs)(`span`,{className:`bg-muted inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs`,children:[e,(0,K.jsx)(`button`,{type:`button`,onClick:()=>{d(e=>e.filter((e,n)=>n!==t))},className:`text-muted-foreground hover:text-foreground`,"aria-label":`Remove argument ${e}`,children:(0,K.jsx)(Wm,{className:`h-3 w-3`})})]},`${e}-${t}`))}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Extra args are appended at the end of the command and can override earlier flags.`})]})]}),(0,K.jsxs)(`div`,{className:`bg-muted/40 border-border rounded-md border p-3`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground mb-1 text-xs uppercase tracking-wider`,children:`Command`}),(0,K.jsx)(`code`,{className:`break-all text-xs`,children:S})]}),m&&(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:m})]}),(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-end gap-2 border-t px-4 py-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:t,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-sm`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!b||g,className:`bg-primary text-primary-foreground rounded-md px-3 py-1.5 text-sm disabled:cursor-not-allowed disabled:opacity-50`,children:g?`Creating...`:`Create`})]})]})}function jnt(){let{setConfig:e}=TA(),{requestClose:t}=EA(),{data:n}=op(),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(`compose`),[s,c]=(0,G.useState)(null),l=Vr({mutationFn:e=>X.config.update.mutate({opsx:{agentInvocationMode:e}})});(0,G.useEffect)(()=>{e({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},dialogClassName:`overflow-hidden`,panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(86dvh,900px)`,onDismissRequest:null})},[e]),(0,G.useEffect)(()=>{let e=n?.opsx?.agentInvocationMode;e&&o(e)},[n?.opsx?.agentInvocationMode]);let u=(0,G.useMemo)(()=>a===`command`?Cnt({action:`propose`,text:r})??`/opsx:propose`:Snt(r),[r,a]);return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Rm,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Quick Propose`})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Oo.activatePop(`/opsx-new`),className:`border-border hover:bg-muted inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs`,title:`Open advanced /opsx:new form`,children:[`Advanced`,(0,K.jsx)(Kp,{className:`h-3.5 w-3.5`})]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 p-4`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Enter your idea, then send it to the selected terminal.`}),(0,K.jsx)(wj,{value:a,onChange:e=>{o(e),l.mutate(e)},options:vnt}),(0,K.jsx)(TW,{value:r,onChange:i,filename:`opsx-propose.md`,placeholder:`e.g. add workspace kanban support for active changes`,editorMinHeight:`180px`}),(0,K.jsxs)(`div`,{className:`bg-muted/30 border-border rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground mr-1`,children:`Invocation:`}),(0,K.jsx)(`code`,{className:`whitespace-pre-wrap break-words`,children:u})]}),s&&(0,K.jsx)(`div`,{className:`text-destructive text-xs`,children:s})]}),(0,K.jsx)(`div`,{className:`border-border flex flex-col gap-3 border-t px-4 py-3`,children:(0,K.jsx)(_nt,{preparePayload:async()=>{let e=await y9({requestedMode:a,workflowInput:{action:`propose`,text:r},staticFallback:()=>a===`command`?{kind:`agent-command`,text:Cnt({action:`propose`,text:r})??`/opsx:propose`,mode:{requestedMode:a,actualMode:a,fallbackReason:null}}:{kind:`agent-prompt`,text:Snt(r),format:`markdown`,mode:{requestedMode:a,actualMode:a,fallbackReason:null}}}),t=v9(e);return t&&c(t),Dnt(e)},onDispatched:t,onError:c,size:`sm`,targetSelectTestId:`opsx-propose-target-select`})})]})}function Mnt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),{lines:r,status:i,commands:a,hasStarted:o,reset:s,cancel:c}=FA(),[l,u]=(0,G.useState)(!0),[d,f]=(0,G.useState)(null),p=(0,G.useMemo)(()=>new URLSearchParams(e.search).get(`change`)?.trim()??``,[e.search]);return(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`normal`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(82dvh,760px)`,onDismissRequest:null})},[t]),(0,G.useEffect)(()=>{!p||o||(async()=>{f(null);try{let e=[`validate`,p,`--type`,`change`];l&&e.push(`--strict`);let t=await y9({requestedMode:`direct`,workflowInput:{action:`verify`,changeId:p,strict:l},staticFallback:()=>({kind:`cli-command`,command:`openspec`,args:e,mode:{requestedMode:`direct`,actualMode:`direct`,fallbackReason:null}})});if(t.kind!==`cli-command`)throw Error(`Verify workflow must return a CLI command.`);let n=v9(t);n&&f(n),a.replaceAll([{command:t.command,args:t.args}]),a.runAll()}catch(e){f(e instanceof Error?e.message:String(e))}})()},[p,a,o,l]),(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-b px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Im,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`h2`,{className:`font-nav text-base tracking-[0.04em]`,children:`Verify Change`})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(LA,{checked:l,onCheckedChange:u,ariaLabel:`Strict`,disabled:i===`running`}),`Strict`]})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 p-4`,children:[p?(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Running validation for `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:p}),`.`]}):(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:`Missing change id. Open Verify from a change page.`}),d&&(0,K.jsx)(`p`,{className:`text-destructive text-sm`,children:d}),(0,K.jsx)(IA,{lines:r,maxHeight:`56vh`})]}),(0,K.jsxs)(`div`,{className:`border-border flex items-center justify-between gap-2 border-t px-4 py-3`,children:[(0,K.jsx)(`div`,{className:`text-xs`,children:i===`success`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-emerald-600`,children:[(0,K.jsx)($p,{className:`h-3.5 w-3.5`}),`Verification completed`]}):i===`running`?(0,K.jsxs)(`span`,{className:`text-muted-foreground inline-flex items-center gap-1`,children:[(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}),`Running...`]}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Ready`})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{c(),s(),n()},className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Close`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{p&&s()},disabled:!p||i===`running`,className:`bg-primary text-primary-foreground rounded-md px-3 py-1.5 text-xs disabled:opacity-50`,children:`Re-run`})]})]})]})}var Nnt=null,b9=null,x9=null;function Pnt(e){return(e instanceof Error?e.message:String(e)).includes(`No "subscription"-procedure on path "search.subscribe"`)}async function Fnt(){return Nnt||b9||(b9=(async()=>{let e=new YVe;try{let t=await doe();return await e.init(t),Nnt=e,e}catch(t){throw await e.dispose().catch(()=>{}),t}finally{b9=null}})(),b9)}function Int(e,t=50){let[n,r]=(0,G.useState)({data:[],isLoading:!1,error:null}),i=(0,G.useMemo)(()=>e.trim(),[e]);return(0,G.useEffect)(()=>{let e=!0;if(i.length===0)return r({data:[],isLoading:!1,error:null}),()=>{e=!1};if(r(e=>({...e,isLoading:!0,error:null})),qa())return Fnt().then(e=>e.search({query:i,limit:t})).then(t=>{e&&r({data:t,isLoading:!1,error:null})}).catch(t=>{e&&r({data:[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})}),()=>{e=!1};let n=null,a=()=>{n?.unsubscribe(),n=null},o=()=>{let a=()=>{X.search.query.query({query:i,limit:t}).then(t=>{e&&r({data:t,isLoading:!1,error:null})}).catch(t=>{e&&r({data:[],isLoading:!1,error:t instanceof Error?t:Error(String(t))})})};a(),n=X.realtime.onFileChange.subscribe(void 0,{onData:()=>{e&&a()},onError:t=>{e&&r({data:[],isLoading:!1,error:t})}})};if(x9===!1)return o(),()=>{e=!1,a()};let s=X.search.subscribe.subscribe({query:i,limit:t},{onData:t=>{x9=!0,e&&r({data:t,isLoading:!1,error:null})},onError:t=>{if(Pnt(t)){if(x9=!1,!e)return;o();return}e&&r({data:[],isLoading:!1,error:t})}});return()=>{e=!1,s.unsubscribe(),a()}},[t,i]),n}var Lnt=150;function Rnt(e){return e===`spec`?sm:e===`change`?gm:Up}function znt(e){let t=e.trim();if(t.length===0)return`/search`;let n=new URLSearchParams;return n.set(`query`,t),`/search?${n.toString()}`}function Bnt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function S9(e,t){if(!e||t.length===0)return e;let n=t.map(e=>Bnt(e)).join(`|`);if(!n)return e;let r=RegExp(`(${n})`,`gi`);return e.split(r).map((e,n)=>t.some(t=>t.toLowerCase()===e.toLowerCase())?(0,K.jsx)(`mark`,{className:`text-foreground rounded bg-amber-400/35 px-[1px]`,children:e},n):(0,K.jsx)(`span`,{children:e},n))}function Vnt(){let e=Va(),{setConfig:t}=TA(),{requestClose:n}=EA(),r=(0,G.useMemo)(()=>new URLSearchParams(e.search).get(`query`)??``,[e.search]),[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(r);(0,G.useEffect)(()=>{a(r),s(r)},[r]),(0,G.useEffect)(()=>{let e=setTimeout(()=>s(i),Lnt);return()=>clearTimeout(e)},[i]);let{data:c,isLoading:l,error:u}=Int(o),d=(0,G.useMemo)(()=>i.trim().split(/\s+/).filter(e=>e.length>0).map(e=>e.toLowerCase()).sort((e,t)=>t.length-e.length),[i]);return(0,G.useEffect)(()=>{t({layout:{alignY:`start`,width:`wide`,topGap:`comfortable`},panelClassName:`w-full`,bodyClassName:`p-0`,maxHeight:`min(88dvh,920px)`,onDismissRequest:void 0})},[t]),(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col gap-4 p-3 sm:p-4`,children:[(0,K.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2`}),(0,K.jsx)(`input`,{autoFocus:!0,value:i,onChange:t=>{let n=t.target.value;a(n),Oo.replace(`pop`,znt(n),e.state)},placeholder:`Search specs, changes, archive...`,className:`border-input bg-background focus:ring-ring w-full rounded-md border py-2 pl-9 pr-3 text-sm focus:outline-none focus:ring-2`})]}),l&&(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Searching...`]}),u&&(0,K.jsx)(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/5 p-3 text-sm text-red-600`,children:u.message}),!l&&!u&&i.trim().length>0&&c.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground rounded-md border p-6 text-center text-sm`,children:[`No results for “`,i.trim(),`”.`]}),c.length>0&&(0,K.jsx)(`ul`,{className:`border-border divide-border min-h-0 w-full min-w-0 flex-1 divide-y overflow-y-auto rounded-md border`,children:c.map(e=>(0,K.jsx)(`li`,{className:`min-w-0`,children:(0,K.jsxs)(`button`,{type:`button`,className:`hover:bg-muted/50 flex w-full min-w-0 flex-col items-start gap-2 p-3 text-left`,onClick:()=>{let t=Oo.getAreaForPath(e.href);Bp.push(t,e.href,null),n()},children:[(0,K.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(Rnt(e.kind),{className:`text-muted-foreground h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium`,children:S9(e.title,d)})]}),(0,K.jsx)(`span`,{className:`text-muted-foreground shrink-0 text-[11px] uppercase`,children:e.kind})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground w-full break-all text-xs`,children:S9(e.path,d)}),(0,K.jsx)(`div`,{className:`text-muted-foreground line-clamp-3 w-full break-words text-xs`,children:S9(e.snippet,d)})]})},e.documentId))})]})}function Hnt({path:e,className:t=``}){let[n,r]=(0,G.useState)(!1);return(0,K.jsxs)(`button`,{onClick:(0,G.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){console.error(`Failed to copy path:`,e)}},[e]),className:`hover:bg-muted/50 group -m-2 flex cursor-pointer items-start gap-2 rounded p-2 text-left transition-colors ${t}`,title:`Click to copy`,children:[(0,K.jsx)(`code`,{className:`bg-muted h-7 flex-1 break-all rounded px-2 py-1 font-mono text-sm`,children:e}),(0,K.jsx)(`span`,{className:`text-muted-foreground group-hover:text-foreground mt-1 shrink-0 transition-colors`,children:n?(0,K.jsx)(Yp,{className:`h-4 w-4 text-green-500`}):(0,K.jsx)(tm,{className:`h-4 w-4`})})]})}var C9=.01,Unt=160;function w9(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}function Wnt(e){return Number((Math.round(w9(e)/C9)*C9).toFixed(2))}function Gnt(e){try{return e.matches(`:popover-open`)}catch{return!1}}function Knt({label:e,value:t,onChange:n,disabled:r}){let i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(null),s=(0,G.useRef)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),f=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),p=Math.round(w9(t)*100),m=(0,G.useCallback)(e=>{n(w9(Wnt(e)))},[n]),h=(0,G.useCallback)(e=>{m(t+(e>0?-1:1)*C9)},[m,t]),g=(0,G.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect();d({left:Math.min(window.innerWidth-52-8,Math.max(8,t.right-52)),top:Math.min(window.innerHeight-156,Math.max(8,t.bottom+6))})},[]),_=(0,G.useCallback)(()=>{r||(l(!0),g())},[r,g]),v=(0,G.useCallback)(()=>{s.current||l(!1)},[]);(0,G.useLayoutEffect)(()=>{let e=a.current;e&&(c?(g(),Gnt(e)||e.showPopover?.()):Gnt(e)&&e.hidePopover?.())},[c,g]),(0,G.useEffect)(()=>{if(!c)return;let e=e=>{let t=e.target;t instanceof Node&&(i.current?.contains(t)||a.current?.contains(t)||l(!1))},t=e=>{e.key===`Escape`&&l(!1)};return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t),window.addEventListener(`resize`,g),window.addEventListener(`scroll`,g,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,g,!0)}},[c,g]),(0,G.useEffect)(()=>{r&&l(!1)},[r]),(0,G.useEffect)(()=>{let e=e=>{e.preventDefault(),h(e.deltaY)},t={passive:!1},n=i.current,r=a.current;return n?.addEventListener(`wheel`,e,t),r?.addEventListener(`wheel`,e,t),()=>{n?.removeEventListener(`wheel`,e),r?.removeEventListener(`wheel`,e)}},[h,c]);let y=e=>{let t=o.current;if(!t)return null;let n=t.getBoundingClientRect();return n.height<=0?null:1-(e-n.top)/n.height},b=e=>{r||(e.preventDefault(),_(),s.current={startY:e.clientY,startValue:w9(t)},e.currentTarget.setPointerCapture?.(e.pointerId))},x=e=>{if(r)return;e.preventDefault(),_();let n=y(e.clientY),i=n===null?w9(t):Wnt(n);m(i),s.current={startY:e.clientY,startValue:i},e.currentTarget.setPointerCapture?.(e.pointerId)},S=e=>{let t=s.current;if(!t)return;let n=(t.startY-e.clientY)/Unt;m(t.startValue+n)},C=e=>{s.current&&(s.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId))},w=u?{left:u.left,top:u.top}:{left:0,top:0};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:i,type:`button`,onClick:_,onPointerDown:b,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onMouseEnter:_,disabled:r,className:bh(`bg-primary text-primary-foreground hover:bg-primary/90 border-l-primary-foreground/30 inline-flex h-9 w-[1.125rem] shrink-0 touch-none select-none items-center justify-center border-l transition`,`disabled:cursor-not-allowed disabled:opacity-50`),"aria-controls":`sound-volume-popover-${f}`,"aria-expanded":c,"aria-label":`Adjust ${e} volume`,title:`${e} volume: ${p}%`,children:(0,K.jsx)(ile,{className:`h-3 w-3`,"aria-hidden":`true`})}),c&&(0,K.jsxs)(`div`,{id:`sound-volume-popover-${f}`,ref:a,popover:`manual`,role:`slider`,"aria-label":`${e} volume`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":p,tabIndex:-1,onPointerDown:x,onPointerMove:S,onPointerUp:C,onPointerCancel:C,onMouseLeave:v,className:`border-border bg-popover text-popover-foreground z-50 flex h-36 w-[52px] touch-none select-none flex-col items-center gap-2 rounded-md border p-2 shadow-lg`,style:{position:`fixed`,inset:`auto`,...w},children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[10px] leading-none`,children:[p,`%`]}),(0,K.jsx)(`div`,{ref:o,"data-sound-volume-track":`true`,className:`bg-muted relative min-h-0 w-2 flex-1 overflow-hidden rounded-full`,children:(0,K.jsx)(`div`,{className:`bg-primary absolute inset-x-0 bottom-0 rounded-full`,style:{height:`${p}%`}})}),(0,K.jsx)(`div`,{className:`text-muted-foreground text-[10px] leading-none`,children:`Vol`})]})]})}var qnt={label:`System Sounds`,options:[...hd.map(e=>({value:e.id,label:e.label})),{value:cd,label:`Silent`}]};function Jnt(e){let t=`/api/sounds/custom/${e.id}`,n=$a();return n?`${n}${t}`:t}function Ynt(e){return{value:gd(e.id),label:e.name}}function Xnt({value:e,defaultValue:t=ud,onValueChange:n,onPreview:r,ariaLabel:i,disabled:a,previewDisabled:o,volume:s,onVolumeChange:c,className:l=``}){let u=(0,G.useRef)(null),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(``),_=Br(tp.sounds.listCustom.queryOptions(void 0)),v=_.data??[],y=_d(e),b=y?v.find(e=>e.id===y):void 0,x=!!(y&&!b),S=p||x?dd:e,C=(0,G.useMemo)(()=>({label:`Custom Sounds`,options:[{value:dd,label:`Add sound...`},...v.map(Ynt)]}),[v]),w=(0,G.useMemo)(()=>[qnt,C],[C]),T=Vr({mutationFn:e=>X.sounds.renameCustom.mutate(e),onSuccess:async()=>{await _.refetch()}}),E=Vr({mutationFn:e=>X.sounds.deleteCustom.mutate({id:e}),onSuccess:async()=>{n(t),await _.refetch()}});(0,G.useEffect)(()=>{p||g(b?.name??``)},[p,b?.name]),(0,G.useEffect)(()=>{x&&n(t)},[t,n,x]);async function D(e){let t=new FormData;t.set(`file`,e),t.set(`name`,h.trim()||e.name.replace(/\.[^.]*$/,``)),f(!0);try{let e=$a(),r=e?`${e}/api/sounds/custom`:`/api/sounds/custom`,i=await fetch(r,{method:`POST`,body:t});if(!i.ok)throw Error(`Failed to upload sound: ${i.status}`);let a=await i.json();await _.refetch(),n(gd(a.id)),m(!1),g(a.name)}finally{f(!1)}}let O=e=>{if(e===`custom:add`){m(!0),g(``);return}m(!1),n(e)},k=()=>{if(!b)return;let e=h.trim();!e||e===b.name||T.mutate({id:gd(b.id),name:e})},A=p||d,j=A||!!b,M=b?Jnt(b):null,N=s!==void 0&&c!==void 0;return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${l}`,children:[(0,K.jsxs)(`div`,{className:`border-border bg-background inline-flex min-w-0 items-stretch overflow-hidden rounded-md border`,children:[(0,K.jsx)(W1,{value:S,groups:w,onValueChange:O,ariaLabel:i,disabled:a,className:`h-9 w-56 rounded-none border-0`,popupClassName:`min-w-56`}),A&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>u.current?.click(),disabled:a||d,className:`border-border text-foreground hover:bg-muted/30 inline-flex h-9 w-9 shrink-0 items-center justify-center border-l transition disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Upload ${i}`,title:`Upload ${i}`,children:(0,K.jsx)(ple,{className:`h-4 w-4`})}),j&&(0,K.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),onBlur:k,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:a||d||!b&&!p,placeholder:`Sound name`,className:`border-border text-foreground focus-visible:ring-primary h-9 w-40 min-w-0 border-l px-2 text-sm outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`${i} name`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(),disabled:a||o||d||e===`silent`,className:bh(`bg-primary text-primary-foreground hover:bg-primary/90 border-border inline-flex h-9 w-9 shrink-0 items-center justify-center border-l transition disabled:cursor-not-allowed disabled:opacity-50`),"aria-label":`Preview ${i}`,title:`Preview ${i}`,"data-sound-url":M??void 0,children:(0,K.jsx)(Om,{className:`h-4 w-4`})}),N&&(0,K.jsx)(Knt,{label:i,value:s,onChange:c,disabled:a||d}),(0,K.jsx)(`input`,{ref:u,type:`file`,accept:`audio/*`,className:`hidden`,onChange:e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t&&D(t)}})]}),b&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>E.mutate(gd(b.id)),disabled:a||E.isPending,className:`border-border text-muted-foreground hover:text-foreground hover:bg-muted/30 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border transition disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":`Remove ${i}`,title:`Remove ${i}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]})}function Znt({sound:e,volume:t,systemNotificationsEnabled:n}){let{browserSupported:r,browserPermission:i,requestBrowserPermission:a,previewSound:o}=gA(),[s,c]=(0,G.useState)(t),l=Vr({mutationFn:e=>X.config.update.mutate({notifications:e})});(0,G.useEffect)(()=>{c(t)},[t]);let u=i===`unsupported`?`Unsupported`:i===`granted`?`Granted`:i===`denied`?`Denied`:`Not requested`;return(0,K.jsxs)(`section`,{className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Jp,{className:`h-5 w-5`}),`Notifications`]}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Notification Sound`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(Xnt,{value:e,defaultValue:ud,onValueChange:e=>l.mutate({sound:e}),onPreview:e=>void o(e,s),ariaLabel:`Notification Sound`,previewDisabled:e===`silent`||s===0,volume:s,onVolumeChange:e=>{c(e),l.mutate({volume:e})}}),l.isPending&&(0,K.jsx)(Em,{className:`text-muted-foreground h-4 w-4 animate-spin`})]})]}),(0,K.jsx)(`div`,{className:`border-border border-t pt-4`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enable System Notifications`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Browser support: `,r?`available`:`unavailable`,` · Permission:`,` `,u]})]}),(0,K.jsx)(Cj,{onClick:()=>void a(),disabled:!r||i===`denied`,activity:i===`granted`&&n,children:i===`granted`&&n?`Enabled`:`Request permission`})]})})]})]})}var Qnt=0;function $nt(e,t){return Qnt+=1,`custom:${e}:${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`item`}:${Date.now()}:${Qnt}`}function ert(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function trt(e){return e.join(`, `)}function T9(e){return e.trim().replace(/^-+/,``).replace(/[^a-zA-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`value`}function nrt(e){return e.builder?.kind===`shellLine`?e.builder.template||e.command:e.builder?.kind===`argv`?e.builder.parts.map(e=>e.kind===`literal`?e.value:e.kind===`booleanFlag`?`${e.flag} when {{${e.fieldId}}}`:`${e.prefix}{{${e.fieldId}}}`).join(` `):[e.command,...e.args.map(e=>e.kind===`literal`?e.value:`{{${e.fieldId}}}`)].join(` `).trim()}var rrt=a2.map(e=>({value:e,label:e}));function irt({open:e,shell:t,shellDefaults:n,onClose:r,onSave:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`posix`);return(0,G.useEffect)(()=>{e&&(o(t?.label??``),c(t?.command??``),u(trt(t?.args??[])),f(t?.quoteStyle??`posix`))},[e,t]),e?(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(K.Fragment,{children:[t?(0,K.jsx)(Nm,{className:`text-primary h-4 w-4`}):(0,K.jsx)(km,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`span`,{children:t?`Edit Shell`:`Add Shell`})]}),onClose:r,className:`max-w-2xl`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{let e=s.trim();if(!e)return;let n=a.trim()||e;i({id:t?.id??$nt(`shell`,n),label:n,command:e,args:ert(l),source:`custom`,quoteStyle:d}),r()},disabled:!s.trim(),className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs disabled:cursor-not-allowed disabled:opacity-50`,children:[t?(0,K.jsx)(Nm,{className:`h-3.5 w-3.5`}):(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),t?`Save`:`Add`]})]}),children:(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Label`,(0,K.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Shell label`,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Command`,(0,K.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:n.effectiveDefaultShell.command,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_180px]`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Args`,(0,K.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Shell args`,className:`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`})]}),(0,K.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium`,children:[`Quote Style`,(0,K.jsx)(W1,{value:d,options:rrt,onValueChange:f,ariaLabel:`Quote Style`})]})]})]})}):null}function art({shellDefaults:e,shellProfiles:t,defaultShellProfile:n}){let[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),s=()=>{i(null),o(!0)},c=e=>{i(e),o(!0)};return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Shells`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs`,children:[`Effective platform default: `,(0,K.jsx)(`code`,{children:e.effectiveDefaultShell.command})]})]}),(0,K.jsxs)(Cj,{size:`sm`,onClick:s,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Shell`]})]}),(0,K.jsx)(`div`,{className:`border-border divide-border overflow-hidden rounded-md border`,children:t.map(e=>{let t=e.id===n.id;return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.label}),(0,K.jsx)(`span`,{className:`text-muted-foreground rounded border px-1.5 py-0.5 text-[10px] uppercase`,children:e.source})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground truncate text-xs`,children:[e.command,e.args.length>0?` ${e.args.join(` `)}`:``]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(Cj,{variant:t?`primary`:`secondary`,activity:t,size:`sm`,className:`px-2 py-1 text-[11px]`,onClick:()=>b2.setDefaultShellProfileId(e.id),children:`Default`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`hover:bg-muted rounded p-1`,"aria-label":`Edit ${e.label}`,title:`Edit ${e.label}`,children:(0,K.jsx)(Dm,{className:`h-3.5 w-3.5`})}),e.source===`custom`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>b2.removeCustomShellProfile(e.id),className:`inline-flex items-center justify-center rounded bg-red-600 p-1 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,K.jsx)(irt,{open:a,shell:r,shellDefaults:e,onClose:()=>o(!1),onSave:e=>{b2.upsertCustomShellProfile(e)}})]})}var E9=`bg-background border-border text-foreground focus:ring-primary rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`,D9=`flex min-w-0 flex-col gap-1 text-xs font-medium`,O9=`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,ort=`inline-flex h-8 w-8 items-center justify-center rounded-md bg-red-600 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500 disabled:cursor-not-allowed disabled:opacity-50`,srt=[{value:`text`,label:`Text`},{value:`textarea`,label:`Textarea`},{value:`boolean`,label:`Boolean`},{value:`select`,label:`Select`}],crt=[{value:`literal`,label:`Literal`},{value:`field`,label:`Field`},{value:`booleanFlag`,label:`Boolean Flag`}],lrt=[{value:`argv`,label:`argv`},{value:`shellLine`,label:`shellLine`}],urt=0;function k9(e){return urt+=1,`${e}:${urt}`}function drt(e){return{key:k9(`field`),id:e.id,label:e.label,type:e.type,description:e.description??e.placeholder??``,defaultValue:typeof e.defaultValue==`boolean`||typeof e.defaultValue==`string`?e.defaultValue:e.type===`boolean`?!1:``,options:e.options.join(`, `),required:e.required,advanced:e.advanced}}function frt(e){let t=e.options.split(`,`).map(e=>e.trim()).filter(Boolean);return{id:T9(e.id||e.label),label:e.label.trim()||e.id,type:e.type,description:e.description.trim()||void 0,defaultValue:e.type===`boolean`?e.defaultValue===!0:typeof e.defaultValue==`string`?e.defaultValue:``,options:t,required:e.required,advanced:e.advanced}}function A9(e){return e.kind===`literal`?{key:k9(`part`),kind:`literal`,value:e.value,fieldId:``,flag:``,prefix:``,omitWhenEmpty:!0}:e.kind===`booleanFlag`?{key:k9(`part`),kind:`booleanFlag`,value:``,fieldId:e.fieldId,flag:e.flag,prefix:``,omitWhenEmpty:!0}:{key:k9(`part`),kind:`field`,value:``,fieldId:e.fieldId,flag:``,prefix:e.prefix,omitWhenEmpty:e.omitWhenEmpty}}function prt(e){if(e.kind===`literal`){let t=e.value.trim();return t?{kind:`literal`,value:t}:null}if(e.kind===`booleanFlag`){let t=e.fieldId.trim(),n=e.flag.trim();return t&&n?{kind:`booleanFlag`,fieldId:t,flag:n}:null}let t=e.fieldId.trim();return t?{kind:`field`,fieldId:t,prefix:e.prefix,omitWhenEmpty:e.omitWhenEmpty}:null}function mrt(e){return e?.fields.length?e.fields.map(drt):[{key:k9(`field`),id:`prompt`,label:`Prompt`,type:`textarea`,description:`Prompt`,defaultValue:``,options:``,required:!1,advanced:!1}]}function hrt(e){return e?.builder?.kind===`argv`?e.builder.parts.map(A9):e?.builder?.kind===`shellLine`?[]:e?[A9({kind:`literal`,value:e.command}),...e.args.map(e=>A9(e))]:[A9({kind:`literal`,value:`claude`}),A9({kind:`field`,fieldId:`prompt`,prefix:``,omitWhenEmpty:!0})]}function grt(e){let t={};for(let n of e)n.type===`boolean`?t[n.id]=n.defaultValue===!0:typeof n.defaultValue==`string`&&n.defaultValue.length>0?t[n.id]=n.defaultValue:n.type===`select`?t[n.id]=n.options[0]??``:t[n.id]=n.id===`prompt`?`Example prompt`:`example-${n.id}`;return t}function _rt({open:e,command:t,shellProfiles:n,onClose:r,onSave:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`argv`),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(mrt(null)),[_,v]=(0,G.useState)(hrt(null));(0,G.useEffect)(()=>{e&&(o(t?.label??``),c(t?.description??``),u(t?.shellProfileId??``),f(t?.builder?.kind??`argv`),m(t?.builder?.kind===`shellLine`?t.builder.template:``),g(mrt(t)),v(hrt(t)))},[t,e]);let y=(0,G.useMemo)(()=>h.map(frt),[h]),b=(0,G.useMemo)(()=>u2(y),[y]),x=(0,G.useMemo)(()=>d===`shellLine`?{kind:`shellLine`,template:p}:{kind:`argv`,parts:_.map(prt).filter(e=>e!==null)},[d,_,p]),S=(0,G.useMemo)(()=>{if(x.kind===`argv`){let e=x.parts.find(e=>e.kind===`literal`);return e?.kind===`literal`?e.value:`command`}return p.trim().split(/\s+/)[0]||`command`},[x,p]),C=(0,G.useMemo)(()=>n.find(e=>e.id===l),[l,n]),w=(0,G.useMemo)(()=>[{value:``,label:`Default shell`},...n.map(e=>({value:e.id,label:e.label}))],[n]),T=(0,G.useMemo)(()=>y.map(e=>({value:e.id,label:e.label})),[y]),E=x.kind===`argv`?x.parts.length>0:x.template.trim().length>0,D=(0,G.useMemo)(()=>({id:t?.id??`preview`,label:a.trim()||S,description:s.trim()||void 0,command:S,args:[],fields:y,parameters:b,builder:x,shellProfileId:l||void 0,source:`custom`}),[x,t?.id,s,S,a,y,b,l]),O=(0,G.useMemo)(()=>h2({command:D,values:{...f2(D),...grt(y)},quoteStyle:C?.quoteStyle??`posix`}),[y,D,C?.quoteStyle]),k=()=>{let e=h.length+1;g(t=>[...t,{key:k9(`field`),id:`arg${e}`,label:`Arg ${e}`,type:`text`,description:``,defaultValue:``,options:``,required:!1,advanced:!1}])},A=e=>{if(e===`booleanFlag`){let t=y.find(e=>e.type===`boolean`),n=t?.id??`flag${h.length+1}`;t||g(e=>[...e,{key:k9(`field`),id:n,label:`Flag Enabled`,type:`boolean`,description:``,defaultValue:!1,options:``,required:!1,advanced:!1}]),v(t=>[...t,{key:k9(`part`),kind:e,value:``,fieldId:n,flag:`--flag`,prefix:``,omitWhenEmpty:!0}]);return}v(t=>[...t,{key:k9(`part`),kind:e,value:e===`literal`?`literal`:``,fieldId:y[0]?.id??``,flag:``,prefix:``,omitWhenEmpty:!0}])};return e?(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(K.Fragment,{children:[t?(0,K.jsx)(Nm,{className:`text-primary h-4 w-4`}):(0,K.jsx)(km,{className:`text-primary h-4 w-4`}),(0,K.jsx)(`span`,{children:t?`Edit Command`:`Add Command`})]}),onClose:r,className:`max-w-4xl`,footer:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`border-border hover:bg-muted rounded-md border px-3 py-1.5 text-xs`,children:`Cancel`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{let e=a.trim()||S;!e||!E||(i({id:t?.id??$nt(`command`,e),label:e,description:s.trim()||void 0,command:S,args:[],fields:y,parameters:b,builder:x,shellProfileId:l||void 0,source:`custom`}),r())},disabled:!E,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs disabled:cursor-not-allowed disabled:opacity-50`,children:[t?(0,K.jsx)(Nm,{className:`h-3.5 w-3.5`}):(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),t?`Save`:`Add`]})]}),children:(0,K.jsxs)(`div`,{className:`grid gap-5`,children:[(0,K.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_220px]`,children:[(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Label`,(0,K.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Command label`,className:E9})]}),(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Shell`,(0,K.jsx)(W1,{value:l,options:w,onValueChange:u,ariaLabel:`Shell`,className:E9})]}),(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium md:col-span-2`,children:[`Description`,(0,K.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Optional description`,className:E9})]})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Parameters`}),(0,K.jsxs)(`button`,{type:`button`,onClick:k,className:O9,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Parameter`]})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:h.map((e,t)=>(0,K.jsxs)(`div`,{className:`border-border rounded-md border p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[11px] font-medium uppercase`,children:[`Parameter `,t+1]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsx)(LA,{checked:e.advanced,onCheckedChange:e=>g(n=>n.map((n,r)=>r===t?{...n,advanced:e}:n))}),`Advanced`]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>g(e=>e.filter((e,n)=>n!==t)),className:ort,"aria-label":`Remove ${e.label||e.id}`,title:`Remove ${e.label||e.id}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[150px_minmax(0,1fr)]`,children:[(0,K.jsxs)(`label`,{className:D9,children:[`Field`,(0,K.jsx)(`input`,{value:e.id,onChange:n=>{let r=T9(e.id||e.label),i=n.target.value,a=T9(i||e.label);g(e=>e.map((e,n)=>n===t?{...e,id:i}:e)),r!==a&&v(e=>e.map(e=>e.fieldId===r?{...e,fieldId:a}:e))},placeholder:`fieldId`,className:E9})]}),(0,K.jsxs)(`label`,{className:D9,children:[`Title`,(0,K.jsx)(`input`,{value:e.label,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,label:e.target.value}:n)),placeholder:`Label`,className:E9})]}),(0,K.jsxs)(`label`,{className:`${D9} md:col-span-2`,children:[`Description`,(0,K.jsx)(`input`,{value:e.description,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,description:e.target.value}:n)),placeholder:`Shown below the rendered field`,className:E9})]})]}),(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-[180px_minmax(0,1fr)_160px]`,children:[(0,K.jsxs)(`label`,{className:D9,children:[`Control Type`,(0,K.jsx)(W1,{value:e.type,options:srt,onValueChange:e=>g(n=>n.map((n,r)=>r===t?{...n,type:e,defaultValue:e===`boolean`?!1:String(n.defaultValue)}:n)),ariaLabel:`Control Type for ${e.label||e.id}`,className:E9})]}),e.type===`textarea`?(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(`textarea`,{value:typeof e.defaultValue==`string`?e.defaultValue:``,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e.target.value}:n)),placeholder:`Default text`,rows:3,className:E9})]}):e.type===`boolean`?(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(W1,{value:e.defaultValue===!0?`true`:`false`,options:[{value:`false`,label:`false`},{value:`true`,label:`true`}],onValueChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e===`true`}:n)),ariaLabel:`Default Value for ${e.label||e.id}`,className:E9})]}):(0,K.jsxs)(`label`,{className:D9,children:[`Default Value`,(0,K.jsx)(`input`,{value:typeof e.defaultValue==`string`?e.defaultValue:``,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,defaultValue:e.target.value}:n)),placeholder:e.type===`select`?`Default option`:`Default value`,className:E9})]}),(0,K.jsxs)(`label`,{className:D9,children:[`Required`,(0,K.jsxs)(`span`,{className:`border-border flex min-h-9 items-center justify-between gap-3 rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{children:`Required`}),(0,K.jsx)(LA,{checked:e.required,onCheckedChange:e=>g(n=>n.map((n,r)=>r===t?{...n,required:e}:n))})]})]})]}),e.type===`select`&&(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsxs)(`label`,{className:D9,children:[`Select Options`,(0,K.jsx)(`input`,{value:e.options,onChange:e=>g(n=>n.map((n,r)=>r===t?{...n,options:e.target.value}:n)),placeholder:`Option A, Option B`,className:E9})]})})]},e.key))})]}),(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Builder`}),(0,K.jsx)(wj,{value:d,onChange:f,options:lrt})]}),d===`shellLine`?(0,K.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium`,children:[`Template`,(0,K.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),placeholder:`claude {{prompt}}`,rows:4,className:E9})]}):(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`literal`),className:O9,children:`Add Literal`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`field`),className:O9,children:`Add Field`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`booleanFlag`),className:O9,children:`Add Boolean Flag`})]}),_.map((e,t)=>(0,K.jsxs)(`div`,{className:`border-border grid items-end gap-3 rounded-md border p-3 md:grid-cols-[150px_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[(0,K.jsxs)(`div`,{className:`text-muted-foreground text-[11px] font-medium uppercase md:col-span-4`,children:[`Builder Part `,t+1]}),(0,K.jsxs)(`label`,{className:D9,children:[`Part Type`,(0,K.jsx)(W1,{value:e.kind,options:crt,onValueChange:e=>v(n=>n.map((n,r)=>r===t?{...n,kind:e}:n)),ariaLabel:`Part Type for builder part ${t+1}`,className:E9})]}),e.kind===`literal`?(0,K.jsxs)(`label`,{className:D9,children:[`Literal Value`,(0,K.jsx)(`input`,{value:e.value,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,value:e.target.value}:n)),placeholder:`claude`,className:E9})]}):(0,K.jsxs)(`label`,{className:D9,children:[`Source Field`,(0,K.jsx)(W1,{value:e.fieldId,options:T,onValueChange:e=>v(n=>n.map((n,r)=>r===t?{...n,fieldId:e}:n)),ariaLabel:`Source Field for builder part ${t+1}`,className:E9})]}),e.kind===`booleanFlag`?(0,K.jsxs)(`label`,{className:D9,children:[`Flag Token`,(0,K.jsx)(`input`,{value:e.flag,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,flag:e.target.value}:n)),placeholder:`--flag`,className:E9})]}):e.kind===`field`?(0,K.jsxs)(`label`,{className:D9,children:[`Prefix`,(0,K.jsx)(`input`,{value:e.prefix,onChange:e=>v(n=>n.map((n,r)=>r===t?{...n,prefix:e.target.value}:n)),placeholder:`Prefix`,className:E9})]}):(0,K.jsx)(`div`,{}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e.filter((e,n)=>n!==t)),className:ort,"aria-label":`Remove builder part ${t+1}`,title:`Remove builder part ${t+1}`,children:(0,K.jsx)(Vm,{className:`h-4 w-4`})})]},e.key))]})]}),(0,K.jsxs)(`div`,{className:`bg-muted/30 border-border rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground mr-1`,children:`Preview:`}),(0,K.jsx)(`code`,{className:`whitespace-pre-wrap break-words`,children:O}),(0,K.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:nrt(D)})]})]})}):null}function vrt({spawnCommands:e,shellProfiles:t}){let[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(!1),o=()=>{r(null),a(!0)},s=e=>{r(e),a(!0)};return(0,K.jsxs)(`div`,{className:`border-border/60 space-y-2 border-t pt-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium`,children:`Spawn Commands`}),(0,K.jsxs)(`button`,{type:`button`,onClick:o,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium hover:opacity-90`,children:[(0,K.jsx)(km,{className:`h-3.5 w-3.5`}),`Add Command`]})]}),(0,K.jsx)(`div`,{className:`border-border divide-border overflow-hidden rounded-md border`,children:e.map(e=>{let n=t.find(t=>t.id===e.shellProfileId);return(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.label}),(0,K.jsx)(`span`,{className:`text-muted-foreground rounded border px-1.5 py-0.5 text-[10px] uppercase`,children:e.source})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground truncate text-xs`,children:[nrt(e),n?` · ${n.label}`:` · Default shell`]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>s(e),className:`hover:bg-muted rounded p-1`,"aria-label":`Edit ${e.label}`,title:`Edit ${e.label}`,children:(0,K.jsx)(Dm,{className:`h-3.5 w-3.5`})}),e.source===`custom`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>b2.removeCustomSpawnCommand(e.id),className:`inline-flex items-center justify-center rounded bg-red-600 p-1 text-white hover:bg-red-700 focus:outline-none focus:ring-1 focus:ring-red-500`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})})]})]},e.id)})}),(0,K.jsx)(_rt,{open:i,command:n,shellProfiles:t,onClose:()=>a(!1),onSave:e=>{b2.upsertCustomSpawnCommand(e)}})]})}function yrt(){let e=x2();return(0,K.jsxs)(`div`,{className:`border-border/70 space-y-4 rounded-md border p-3`,children:[(0,K.jsx)(art,{shellDefaults:e.shellDefaults,shellProfiles:e.shellProfiles,defaultShellProfile:e.defaultShellProfile}),(0,K.jsx)(vrt,{spawnCommands:e.spawnCommands,shellProfiles:e.shellProfiles})]})}var brt=md;function xrt(e){let t=[`init`];if(e.mode===`selected`){let n=e.selectedToolIds.filter(t=>e.cliSupportedToolIds.has(t));t.push(`--tools`,n.length>0?n.join(`,`):`none`)}else e.mode===`all`&&t.push(`--tools`,`all`);return e.profileOverride!==`default`&&t.push(`--profile`,e.profileOverride),e.force&&t.push(`--force`),t}function j9(e,t){return e.get(t)?.status??`uninitialized`}function Srt(e,t){let n=0,r=0;for(let i of t){let t=j9(e,i);t===`partial`?r+=1:t===`uninitialized`&&(n+=1)}return{newCount:n,repairCount:r}}function Crt(e){return e.newCount>0&&e.repairCount>0?`Initialize selected (${e.newCount} new, ${e.repairCount} repair)`:e.newCount>0?`Initialize selected (${e.newCount} new)`:e.repairCount>0?`Initialize selected (${e.repairCount} repair)`:`Initialize selected`}function wrt(e){return e.length>0}function Trt(e){return e.mode===`auto`?e.autoInitDisabled?{label:`Initialize (auto-detect)`,disabled:!0,title:`No project tool directories detected yet. Use selected or all instead.`,helperText:`Auto-detect only works when this project already contains tool directories such as .claude or .cursor. No project tool directories are currently detected.`}:{label:`Initialize (auto-detect)`,disabled:!1,helperText:`Auto-detect uses the tool directories already present in this project, such as .claude or .cursor.`}:e.mode===`selected`?{label:e.selectedLabel,disabled:!e.hasSelectedToolActions,title:e.hasSelectedToolActions?void 0:`Select at least one uninitialized or repairable tool first.`,helperText:`Selected mode only includes the tools marked above. Exact-match tools are not reselected because they already match the current OpenSpec profile state.`}:{label:`Initialize with all tools`,disabled:!1,helperText:`All mode initializes every OpenSpec-supported provider and repairs stale artifacts for the current profile when possible.`}}var Ert={ar:`هذه جملة قصيرة لاختبار الترجمة.`,bg:`Това е кратко изречение за тестване на превода.`,bn:`এটি অনুবাদ পরীক্ষা করার জন্য একটি ছোট বাক্য।`,cs:`Toto je krátká věta pro otestování překladu.`,da:`Dette er en kort sætning til at teste oversættelsen.`,de:`Dies ist ein kurzer Satz zum Testen der Übersetzung.`,el:`Αυτή είναι μια σύντομη πρόταση για τη δοκιμή της μετάφρασης.`,en:`My name is Sarah and I live in London.`,es:`Esta es una frase corta para probar la traducción.`,fi:`Tämä on lyhyt lause käännöksen testaamiseen.`,fr:`Ceci est une courte phrase pour tester la traduction.`,hi:`यह अनुवाद का परीक्षण करने के लिए एक छोटा वाक्य है।`,hr:`Ovo je kratka rečenica za testiranje prijevoda.`,hu:`Ez egy rövid mondat a fordítás teszteléséhez.`,id:`Ini adalah kalimat singkat untuk menguji terjemahan.`,it:`Questa è una breve frase per testare la traduzione.`,iw:`זהו משפט קצר לבדיקת התרגום.`,ja:`これは翻訳エンジンを確認するための短い文です。`,kn:`ಇದು ಅನುವಾದವನ್ನು ಪರೀಕ್ಷಿಸಲು ಒಂದು ಚಿಕ್ಕ ವಾಕ್ಯವಾಗಿದೆ.`,ko:`이 문장은 번역 엔진을 확인하기 위한 짧은 문장입니다.`,lt:`Tai trumpas sakinys vertimui patikrinti.`,mr:`हे भाषांतर तपासण्यासाठी एक छोटे वाक्य आहे.`,nl:`Dit is een korte zin om de vertaling te testen.`,no:`Dette er en liten oversettelsestest fra norsk til tysk.`,pl:`To jest krótkie zdanie do przetestowania tłumaczenia.`,pt:`Esta é uma frase curta para testar a tradução.`,ro:`Aceasta este o propoziție scurtă pentru a testa traducerea.`,ru:`Это короткое предложение для проверки перевода.`,sk:`Toto je krátka veta na otestovanie prekladu.`,sl:`To je kratek stavek za preizkus prevoda.`,sv:`Det här är en kort mening för att testa översättningen.`,ta:`இது மொழிபெயர்ப்பைச் சோதிக்க ஒரு குறுகிய வாக்கியம்.`,te:`ఇది అనువాదాన్ని పరీక్షించడానికి ఒక చిన్న వాక్యం.`,th:`นี่คือประโยคสั้น ๆ สำหรับทดสอบการแปล.`,tr:`Bu, çeviriyi test etmek için kısa bir cümledir.`,uk:`Це коротке речення для перевірки перекладу.`,vi:`Đây là một câu ngắn để kiểm tra bản dịch.`,zh:`这是一句用于验证翻译引擎的短句。`,"zh-Hant":`這是一句用來驗證翻譯引擎的短句。`},Drt=new Map(Object.entries(Ert).map(([e,t])=>[e.toLowerCase(),t]));function Ort(e){let t=e.trim().toLowerCase(),n=t.split(/[-_]/,1)[0]??t;return Drt.get(t)??Drt.get(n)??Ert.en}var M9=`zh`,N9=`direct`,P9=!1,krt=Math.round(rc/1e3),F9=`Xenova/opus-mt-no-de`,Art=`ooeoeo/opus-mt-en-zh-ct2-float16`,jrt=`bartowski/Qwen2.5-0.5B-Instruct-GGUF`,I9=`en`,Mrt=[{value:`direct`,label:`Direct`},{value:`bilingual`,label:`Bilingual`}],Nrt=new Set([`available`,`downloading`,`downloadable`]);function L9(e){return e?.table?.rows??[]}function R9(e,t=null){if(t&&e.some(e=>z9(e)===t))return t;let n=e.find(e=>e.availability===`available`);return n?z9(n):e[0]?z9(e[0]):null}function z9(e){return`${e.sourceLanguage}->${e.targetLanguage}`}function Prt(e){let t=uJ(e.sourceLanguage),n=uJ(e.targetLanguage);return`${t?.code??e.sourceLanguage} -> ${n?.code??e.targetLanguage}`}function Frt(e){let t=uJ(e.sourceLanguage),n=uJ(e.targetLanguage);return`${t?.label??e.sourceLanguage} to ${n?.label??e.targetLanguage}`}function Irt(e){return e?e.message??`Browser translation support is unavailable.`:`Browser translation support has not been checked yet.`}function B9(e){let t=e.interactive??!0;return`${e.selected?`border-solid`:`border-dashed`} ${e.tone===`downloaded`?`border-emerald-500 text-emerald-700 dark:text-emerald-400`:e.tone===`partial`?`border-sky-500 text-sky-700 dark:text-sky-400`:`border-border text-foreground`} ${t?`hover:border-current`:``}`.trim()}function Lrt(e){return e===`available`?`downloaded`:e===`downloading`?`partial`:`not-started`}function Rrt(e){return e?e.state===`checking`?`Checking browser translation support.`:e.state===`ready`?`Browser translation support is available.`:e.message??`Browser translation support is unavailable.`:`Browser translation support has not been checked yet.`}function zrt(e){return e.row?e.row.availability===`available`?`downloaded`:e.row.availability===`downloading`&&e.activeSourceLanguage===e.row.sourceLanguage?`cancel`:e.row.availability===`downloadable`?`download`:`progress`:`progress`}function Brt(e){if(!e||e.state===`idle`||e.state===`checking`)return`checking`;if(e.state!==`ready`)return`unavailable`;let t=L9(e);return t.some(e=>e.availability===`available`)?`available`:t.some(e=>Nrt.has(e.availability))?`downloadable`:`unavailable`}function Vrt(){return{sourceLanguage:I9,sourceText:``}}function Hrt(e){return Ort(e)}function Urt(e){if(!nc(e.engineId))return I9;let t=QK(e.model);return t&&$K({model:e.model,sourceLanguage:t.sourceLanguage,targetLanguage:e.targetLanguage}).supported?t.sourceLanguage:I9}function Wrt(e,t){return e&&typeof e==`object`&&`data`in e&&`isLoading`in e?{...e,data:t,isLoading:!1,isFetching:!1}:t}function Grt(e,t){let n=e=>e?.map(e=>e.id===t.engineId?{...e,lifecycle:t.lifecycle}:e);return Array.isArray(e)?n(e):e&&typeof e==`object`&&`data`in e?{...e,data:n(e.data)}:e}function Krt(...e){let t=new Map;for(let n of e)if(n)for(let e of n){let n=t.get(e.id);t.set(e.id,n?qrt(n,e):e)}return[...t.values()]}function qrt(e,t){let n=[...new Set([...e.sources,...t.sources])],r=n.includes(`recommended`)?`recommended`:n.includes(`local`)?`local`:e.primarySource===`recommended`||t.primarySource===`recommended`?`recommended`:e.primarySource===`local`||t.primarySource===`local`?`local`:`network`,i=(t.downloadGroups?.length??0)>(e.downloadGroups?.length??0)?t.downloadGroups:e.downloadGroups,a=t.local||(t.asset.progress??0)>(e.asset.progress??0)?t.asset:e.asset;return{...e,...t,summary:t.primarySource===`recommended`&&e.primarySource!==`recommended`?t.summary:e.summary,downloads:Math.max(e.downloads,t.downloads),likes:Math.max(e.likes,t.likes),trendingScore:Math.max(e.trendingScore??0,t.trendingScore??0)||void 0,downloadGroups:i,asset:a,selectable:e.selectable||t.selectable,local:e.local||t.local,primarySource:r,sources:n}}function Jrt(e){return e===`local-ct2`?Art:e===`local-llama`?jrt:F9}function Yrt(e){let t=e.engineId===`local-ct2`?e.resolvedTranslationConfig?.engines?.localCt2:e.engineId===`local-llama`?e.resolvedTranslationConfig?.engines?.localLlama:e.resolvedTranslationConfig?.engines?.local,n=e.engineId===`local-ct2`?e.globalSettings?.translationEngines?.localCt2:e.engineId===`local-llama`?e.globalSettings?.translationEngines?.localLlama:e.globalSettings?.translationEngines?.local;return{model:t?.model??n?.model??Jrt(e.engineId),selectedGroupId:t?.selectedGroupId??n?.selectedGroupId,hfEndpoint:n?.hfEndpoint??``,memoryBudgetPercent:n?.memoryBudgetPercent??25}}function Xrt(e,t){return e===`local-ct2`?{localCt2:t}:e===`local-llama`?{localLlama:t}:{local:t}}function Zrt(e,t){return e===`local-ct2`?{localCt2:t}:e===`local-llama`?{localLlama:t}:{local:t}}function Qrt(e){return e.enabled!==void 0||e.targetLanguage!==void 0||e.displayMode!==void 0||e.cacheEnabled!==void 0}function $rt(e,t){let n={},r={};return t.enabled!==void 0&&(e?.translation.enabled?n.enabled=t.enabled:r.enabled=t.enabled),t.targetLanguage!==void 0&&(e?.translation.targetLanguage?n.targetLanguage=t.targetLanguage:r.targetLanguage=t.targetLanguage),t.displayMode!==void 0&&(e?.translation.displayMode?n.displayMode=t.displayMode:r.displayMode=t.displayMode),t.cacheEnabled!==void 0&&(e?.translation.cacheEnabled?n.cacheEnabled=t.cacheEnabled:r.cacheEnabled=t.cacheEnabled),{project:n,global:r}}function eit(e,t){return t===`local-ct2`?e?.translation.engines.localCt2===!0:t===`local-llama`?e?.translation.engines.localLlama===!0:e?.translation.engines.local===!0}function tit(e){return[`translation`,`managed-local`,e.engineId,`panel-state`,e.modelId,e.selectedGroupId??``]}function nit(e){return e===`local`?X.localModels.listLocal.query():e===`local-ct2`?X.localCt2Models.listLocal.query():X.localLlamaModels.listLocal.query()}function rit(e,t,n){return e===`local`?X.localModels.searchRemoteStream.subscribe(t,n):e===`local-ct2`?X.localCt2Models.searchRemoteStream.subscribe(t,n):X.localLlamaModels.searchRemoteStream.subscribe(t,n)}function iit(e,t){return e===`local`?X.localModels.subscribeLogs.subscribe(void 0,t):e===`local-ct2`?X.localCt2Models.subscribeLogs.subscribe(void 0,t):X.localLlamaModels.subscribeLogs.subscribe(void 0,t)}function V9(e){let t={modelId:e.modelId,selectedGroupId:e.selectedGroupId};return e.engineId===`local`?X.localModels.panelState.query(t):e.engineId===`local-ct2`?X.localCt2Models.panelState.query(t):X.localLlamaModels.panelState.query(t)}function ait(e,t){return e===`local`?X.localModels.markSelected.mutate({modelId:t}):e===`local-ct2`?X.localCt2Models.markSelected.mutate({modelId:t}):X.localLlamaModels.markSelected.mutate({modelId:t})}function oit(e,t){return e===`local`?X.localModels.refreshArtifacts.mutate(t):e===`local-ct2`?X.localCt2Models.refreshArtifacts.mutate(t):X.localLlamaModels.refreshArtifacts.mutate(t)}function H9(e){let t=new Set([e.panelState.selectedGroupId,e.requestedSelectedGroupId,void 0]);for(let n of t)e.queryClient.setQueryData(tit({engineId:e.engineId,modelId:e.panelState.modelId,selectedGroupId:n}),t=>Wrt(t,e.panelState))}function sit(e){let t=e?.asset.status;return t===`queued`||t===`downloading`||t===`deleting`}async function U9(e){let t=await V9({engineId:e.engineId,modelId:e.modelId,selectedGroupId:e.requestedSelectedGroupId});return H9({engineId:e.engineId,panelState:t,queryClient:e.queryClient,requestedSelectedGroupId:e.requestedSelectedGroupId}),t}async function cit(e){let t=await oit(e.engineId,{modelId:e.modelId});return H9({engineId:e.engineId,panelState:t,queryClient:e.queryClient,requestedSelectedGroupId:e.requestedSelectedGroupId}),t}function lit({index:e}){let t=qa(),{data:n,isLoading:r}=op(),{data:i,isLoading:a}=mce(),{data:o,isLoading:s}=sp(),{data:c,refetch:l,isLoading:u,isFetching:d,error:f}=Br({...tp.translationEngines.list.queryOptions(),enabled:!t}),p=(0,G.useMemo)(()=>eY(n?.translation,o,i),[n?.translation,i,o]),{data:m,refetch:h}=Br({...tp.translationCache.stats.queryOptions(),enabled:!t&&(p?.cacheEnabled??!1)}),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(M9),[b,x]=(0,G.useState)(N9),[S,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(P9),[E,D]=(0,G.useState)(gc),[O,k]=(0,G.useState)(null),[A,j]=(0,G.useState)(null),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(``),[ee,I]=(0,G.useState)(``),[L,R]=(0,G.useState)(`gpt-4.1-mini`),[z,te]=(0,G.useState)(F9),[B,V]=(0,G.useState)(F9),[ne,re]=(0,G.useState)(F9),[ie,ae]=(0,G.useState)(``),[oe,se]=(0,G.useState)(25),[ce,le]=(0,G.useState)(void 0),[ue,H]=(0,G.useState)([]),[de,fe]=(0,G.useState)([]),[pe,me]=(0,G.useState)(!1),[he,ge]=(0,G.useState)(!1),[_e,ve]=(0,G.useState)(!1),[ye,be]=(0,G.useState)(I9),[xe,Se]=(0,G.useState)(``),[Ce,we]=(0,G.useState)(``),[Te,Ee]=(0,G.useState)(null),[De,Oe]=(0,G.useState)(null),[ke,Ae]=(0,G.useState)(!1),[je,Me]=(0,G.useState)(krt),[Ne,Pe]=(0,G.useState)(null),[Fe,Ie]=(0,G.useState)(``),Le=Or(),Re=(0,G.useRef)(Le),ze=(0,G.useRef)(null),Be=(0,G.useRef)(null),Ve=(0,G.useRef)(null),He=(0,G.useRef)(z),Ue=(0,G.useRef)(ce),We=(0,G.useRef)(null),Ge=(0,G.useRef)(null),Ke=S??p?.engineId??null,qe=tc(Ke)?Ke:null;(0,G.useEffect)(()=>{Re.current=Le},[Le]),(0,G.useEffect)(()=>{n&&(_(p?.enabled??!1),y(p?.targetLanguage??M9),x(p?.displayMode??N9),C(p?.engineId??`browser`),T(p?.cacheEnabled??P9))},[n,p?.cacheEnabled,p?.displayMode,p?.enabled,p?.engineId,p?.targetLanguage]),(0,G.useEffect)(()=>{if(D(o?.translationCache?.entryLimit??1e4),F(o?.translationEngines?.openai?.baseUrl??``),I(o?.translationEngines?.openai?.token??``),R(p?.engines?.openai?.model??o?.translationEngines?.openai?.model??`gpt-4.1-mini`),!qe)return;let e=Yrt({engineId:qe,resolvedTranslationConfig:p,globalSettings:o});te(e.model),V(e.model),re(e.model),ae(e.hfEndpoint),se(e.memoryBudgetPercent),le(e.selectedGroupId)},[qe,n?.translation?.engines?.local?.model,n?.translation?.engines?.local?.selectedGroupId,n?.translation?.engines?.localCt2?.model,n?.translation?.engines?.localCt2?.selectedGroupId,n?.translation?.engines?.localLlama?.model,n?.translation?.engines?.localLlama?.selectedGroupId,o?.translationCache?.entryLimit,o?.translationEngines?.openai?.baseUrl,o?.translationEngines?.openai?.model,o?.translationEngines?.openai?.token,o?.translationEngines?.local?.hfEndpoint,o?.translationEngines?.local?.memoryBudgetPercent,o?.translationEngines?.local?.model,o?.translationEngines?.local?.selectedGroupId,o?.translationEngines?.localCt2?.hfEndpoint,o?.translationEngines?.localCt2?.memoryBudgetPercent,o?.translationEngines?.localCt2?.model,o?.translationEngines?.localCt2?.selectedGroupId,o?.translationEngines?.localLlama?.hfEndpoint,o?.translationEngines?.localLlama?.memoryBudgetPercent,o?.translationEngines?.localLlama?.model,o?.translationEngines?.localLlama?.selectedGroupId,p?.engines?.local?.model,p?.engines?.local?.selectedGroupId,p?.engines?.localCt2?.model,p?.engines?.localCt2?.selectedGroupId,p?.engines?.localLlama?.model,p?.engines?.localLlama?.selectedGroupId,p?.engines?.openai?.model]),(0,G.useEffect)(()=>{He.current=z},[z]),(0,G.useEffect)(()=>{Ue.current=ce},[ce]),(0,G.useEffect)(()=>{if(!qe)return;let e=window.setTimeout(()=>{re(B.trim())},300);return()=>window.clearTimeout(e)},[qe,B]),(0,G.useEffect)(()=>{if(!qe)return;let e=!1;return nit(qe).then(t=>{e||H(t.items)}).catch(()=>{e||H([])}),()=>{e=!0}},[qe]),(0,G.useEffect)(()=>{if(!qe)return;let e=`local-search-${Date.now()}-${Math.random().toString(36).slice(2)}`;if(!he){me(!1);return}me(!0);let t=rit(qe,{requestId:e,targetLanguage:v,query:ne||void 0,limit:6},{onData:t=>{t.requestId===e&&(t.items&&fe(t.items),(t.phase===`complete`||t.phase===`error`)&&me(!1))},onError:()=>{me(!1),fe([])}});return()=>{t.unsubscribe()}},[qe,ne,ie,he,v]),(0,G.useEffect)(()=>{if(t||!qe)return;let e=iit(qe,{onData:e=>{let t=Ue.current,n=He.current.trim(),r=e.modelId===n?t:e.selectedGroupId;V9({engineId:qe,modelId:e.modelId,selectedGroupId:r}).then(t=>{H9({engineId:qe,panelState:t,queryClient:Re.current,requestedSelectedGroupId:r}),e.modelId===n&&(We.current=t,le(t.selectedGroupId))}).catch(()=>void 0),nit(qe).then(e=>H(e.items)).catch(()=>void 0)},onError:()=>void 0});return()=>{e.unsubscribe()}},[qe,t]),(0,G.useEffect)(()=>{qe||(H([]),fe([]),me(!1))},[qe]);let Je=Vr({mutationFn:e=>X.config.update.mutate({translation:e}),onSuccess:async()=>{await l()}}),Ye=Vr({mutationFn:e=>X.globalSettings.update.mutate(e),onSuccess:async()=>{await l()}}),Xe=Vr({mutationFn:e=>X.translationEngines.select.mutate({engineId:e}),onSuccess:async()=>{await l()}}),Ze=(0,G.useCallback)(e=>{let t=$rt(i,e);Qrt(t.project)&&Je.mutate(t.project),Qrt(t.global)&&Ye.mutate({translation:t.global})},[i,Ye,Je]),Qe=(0,G.useCallback)((e,t)=>{if(eit(i,e)){Je.mutate({engines:Xrt(e,t)});return}Ye.mutate({translationEngines:Zrt(e,t)})},[i,Ye,Je]),$e=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.download.mutate(e):qe===`local-ct2`?X.localCt2Models.download.mutate(e):X.localLlamaModels.download.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),et=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.pause.mutate(e):qe===`local-ct2`?X.localCt2Models.pause.mutate(e):X.localLlamaModels.pause.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),tt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.resume.mutate(e):qe===`local-ct2`?X.localCt2Models.resume.mutate(e):X.localLlamaModels.resume.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),nt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return qe===`local`?X.localModels.delete.mutate(e):qe===`local-ct2`?X.localCt2Models.delete.mutate(e):X.localLlamaModels.delete.mutate(e)},onSuccess:async(e,t)=>{if(!qe)return;let n=await U9({engineId:qe,modelId:t.modelId,requestedSelectedGroupId:t.groupId,queryClient:Le});We.current=n,le(n.selectedGroupId)}}),rt=Vr({mutationFn:e=>{if(!qe)throw Error(`A managed local translation engine is required.`);return oit(qe,e)},onSuccess:(e,t)=>{qe&&(H9({engineId:qe,panelState:e,queryClient:Le,requestedSelectedGroupId:t.modelId?Ue.current:void 0}),We.current=e)}}),it=Vr({mutationFn:()=>X.translationCache.clean.mutate()}),at=Vr({mutationFn:()=>X.translationCache.clear.mutate()}),ot=Vr({mutationFn:async e=>(Be.current?.unsubscribe(),Ie(``),await new Promise((t,n)=>{Be.current=X.translationEngines.installStream.subscribe({engineId:e},{onData:e=>{if(e.type===`status`){Pe(e.lifecycle);return}if(e.type===`log`){Ie(t=>`${t}${e.text}`);return}if(Pe(e.lifecycle),!sc(e.lifecycle)){t(e.lifecycle);return}n(Error(cc(e.lifecycle)??`Install failed.`))},onError:e=>{n(e instanceof Error?e:Error(String(e)))}})})),onSuccess:async(e,t)=>{if(Pe(e),Re.current.setQueryData(tp.translationEngines.list.queryOptions().queryKey,n=>Grt(n,{engineId:t,lifecycle:e})),tc(t)){let e=He.current.trim();if(e)try{let n=await cit({engineId:t,modelId:e,requestedSelectedGroupId:Ue.current,queryClient:Le});qe===t&&(We.current=n,le(n.selectedGroupId))}catch{}}await l()},onError:e=>{let t=e instanceof Error?e.message:String(e);Pe(oc({dependency:{state:`error`,message:`Translation engine installation failed.`,error:t},runtime:{state:`error`,error:t},summary:`Translation engine installation failed.`}))}}),st=i?.translation.engineId===!0,ct=t||n!==void 0&&i!==void 0&&(st||o!==void 0),lt=ct?S??p?.engineId??`browser`:null,ut=tc(lt)?lt:null,dt=n?n.translation?.engineId??`browser`:null,ft=(0,G.useMemo)(()=>Urt({engineId:lt,model:z,targetLanguage:v}),[lt,z,v]);(0,G.useEffect)(()=>{be(ft)},[ft]);let pt=(0,G.useCallback)(async e=>{if(t)return;let n=new AbortController;try{let t=await bJ(e,{signal:n.signal,onProgress:e=>{k(e)}});k(t);let r=L9(t);j(e=>R9(r,e))}finally{n.abort()}},[t]);(0,G.useEffect)(()=>{if(t||dt!==`browser`||lt!==`browser`)return;let e=_J(v);if(e){k(e);let t=L9(e);j(e=>R9(t,e));return}pt(v)},[t,dt,lt,pt,v]),(0,G.useEffect)(()=>{lt!==`browser`&&(ze.current?.abort(),ze.current=null,N(null))},[lt]);let mt=(0,G.useMemo)(()=>Qs.map(e=>{let n=c?.find(t=>t.id===e),r=lc(e);return{value:e,label:n?.label??r.label,disabled:t&&e!==`browser`}}),[c,t]),ht=c?.find(e=>e.id===lt),gt=lt?lc(lt):null,_t=!ht&&lt!==null&&lt!==`browser`&&(u||d),vt=(0,G.useMemo)(()=>ht?.lifecycle?ht.lifecycle:!lt||lt===`browser`||ht?null:f instanceof Error?oc({dependency:{state:`error`,message:`Failed to load translation engine status.`,error:f.message},runtime:{state:`error`,error:f.message},summary:`Failed to load translation engine status.`}):null,[lt,f,ht]),yt=ut?Zre(ut):null,bt=(0,G.useMemo)(()=>L9(O),[O]),xt=(0,G.useMemo)(()=>R9(bt,A),[bt,A]),St=(0,G.useMemo)(()=>bt.find(e=>z9(e)===xt)??null,[bt,xt]),Ct=Brt(O),wt=Irt(O),Tt=Ne&&lt===ht?.id?Ne:vt,Et=lt===`browser`?Rrt(O):_t?`Loading translation engine metadata.`:cc(Tt)??ht?.message??ht?.description??gt?.description,Dt=zrt({row:St,activeSourceLanguage:M}),Ot=St?.availability===`available`?100:Math.round((St?.progress??0)*100),kt=O?.state===`checking`,At=ut?Yrt({engineId:ut,resolvedTranslationConfig:p,globalSettings:o}):null,jt=yt?.modelLabel??`Local model`,Mt=yt?.downloadGroupsLabel??`Local download profiles`,Nt=yt?.refreshTooltip??`Refresh local model profiles`,Pt=z.trim(),Ft=ut&&Pt.length>0?`${ut}:${Pt}`:null,It=At?.selectedGroupId,U=ce??It,Lt=Br({queryKey:ut&&Pt.length>0?tit({engineId:ut,modelId:Pt,selectedGroupId:U}):[`translation`,`managed-local`,`idle`],queryFn:()=>{if(!ut)throw Error(`A managed local translation engine is required.`);return V9({engineId:ut,modelId:Pt,selectedGroupId:U})},enabled:ut!==null&&Pt.length>0}),Rt=Lt.data?.modelId===Pt?Lt.data:null;(0,G.useEffect)(()=>{if(Rt){We.current=Rt;return}(!ut||Pt.length===0)&&(We.current=null)},[ut,Pt,Rt]);let zt=We.current?.modelId===Pt?We.current:null,Bt=Rt??zt,Vt=Lt.error instanceof Error?Lt.error.message:null,Ht=(0,G.useMemo)(()=>Krt(ue,de),[ue,de]),Ut=Bt?.asset??null,Wt=Bt?.downloadPlan??Ut?.plan??null,Gt=Wt?.groups??[],Kt=Gt.find(e=>e.selected)??null,qt=Kt?.id??Bt?.selectedGroupId??Ut?.plan?.selectedGroupId??U,Jt=(Kt?.estimatedTotalBytes??Wt?.estimatedTotalBytes??0)>0,Yt=Ut,Xt=Yt?.progress===void 0?void 0:Math.round(Yt.progress*100),Zt=Yt?.status===`deleting`,Qt=ie.trim()||`https://huggingface.co`,$t=Ut?.profileLoad?.status===`loading`,en=Ft!==null&&Ge.current!==Ft&&Yt!==null&&Yt.status!==`downloaded`&&Yt.profileLoad?.status!==`error`&&!Wt&&(Yt.files.length??0)===0,tn=rt.isPending||(Lt.isLoading||Lt.isFetching)&&!Ut||$t||en;(0,G.useEffect)(()=>{!ut||!Pt||t||_t||sc(Tt)||Lt.isLoading||Lt.isFetching||Ut?.plan?.groups?.length||(Ut?.files.length??0)>0||Ut?.profileLoad?.status!==`loading`&&Ut?.profileLoad?.status!==`error`&&Ft!==null&&Ge.current!==Ft&&(Ge.current=Ft,rt.mutate({modelId:Pt}))},[ut,_t,t,Pt,rt,Tt,Lt.isFetching,Lt.isLoading,Ut?.plan?.groups?.length,Ut?.files.length,Ut?.profileLoad?.status,Ft]),(0,G.useEffect)(()=>{if(!qe||!Pt||t||!sit(Bt))return;let e=window.setTimeout(()=>{Lt.refetch()},750);return()=>window.clearTimeout(e)},[qe,t,Bt,Lt,Pt]);let nn=lt!==null&&sc(Tt)||_t,rn=Fe.length>0&&(Tt?.dependency.state===`installing`||Tt?.dependency.state===`error`||Tt?.runtime.state===`error`),an=(0,G.useCallback)(async e=>{ze.current?.abort();let t=new AbortController;ze.current=t,N(e.sourceLanguage),k(yJ(e.targetLanguage,{...e,availability:`downloading`,progress:e.progress??0,message:`Downloading browser translation support.`},{state:`ready`}));try{let n=await gJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,signal:t.signal,onStatus:t=>{k(yJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage,availability:t.availability,progress:t.progress,message:t.message},{state:t.availability===`error`?`error`:`ready`}))}});k(yJ(e.targetLanguage,{sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage,availability:n.availability,progress:n.progress,message:n.message},{state:n.availability===`error`?`error`:`ready`}))}finally{ze.current===t&&(ze.current=null),N(t=>t===e.sourceLanguage?null:t)}},[]),on=(0,G.useCallback)(()=>{ze.current?.abort(),ze.current=null,N(null)},[]),sn=(0,G.useCallback)(async()=>{if(!lt)return;let e=xe.trim()||Hrt(ye),t=ye.trim()||I9,n=v.trim()||M9,r=Math.max(1,Math.round(je*1e3||15e3));Ae(!0),Ee(null),we(``),Oe(null);try{let i=performance.now(),a=await JHe({engineId:lt,sourceLanguage:t,targetLanguage:n,model:tc(lt)?z.trim()||void 0:lt===`openai`&&L.trim()||void 0,selectedGroupId:tc(lt)?qt:void 0,text:e,timeoutMs:r});Oe(Math.max(1,Math.round(performance.now()-i))),we(a)}catch(e){Oe(null),Ee(e instanceof Error?e.message:`Translation test failed.`)}finally{Ae(!1)}},[L,qt,z,ye,xe,je,lt,v]),cn={enabled:p?.enabled??!1,targetLanguage:p?.targetLanguage??M9,displayMode:p?.displayMode??N9,cacheEnabled:p?.cacheEnabled??P9,engineId:p?.engineId??`browser`},ln=o?.translationCache?.entryLimit??1e4,un=ct&&(cn.enabled!==g||cn.targetLanguage!==v||cn.displayMode!==b||cn.cacheEnabled!==w||cn.engineId!==lt||ln!==E);return(0,G.useEffect)(()=>{if(!lt||lt===`browser`){Pe(null),Ie(``),Be.current?.unsubscribe(),Be.current=null;return}Pe(vt),Ie(``)},[lt]),(0,G.useEffect)(()=>{!lt||lt===`browser`||Pe(e=>e?.dependency.state===`installing`&&sc(vt)?e:vt)},[lt,vt]),(0,G.useEffect)(()=>{if(!Fe)return;let e=Ve.current;e&&(e.scrollTop=e.scrollHeight)},[Fe]),(0,G.useEffect)(()=>()=>{Be.current?.unsubscribe()},[]),(0,K.jsxs)(m$,{id:`settings-translation`,index:e,className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(bm,{className:`h-5 w-5`}),`Translation`]}),(0,K.jsxs)(`div`,{className:`border-border @container space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Enable document translation`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:`Select a translator engine for Markdown document views.`})]}),(0,K.jsx)(LA,{checked:g,onCheckedChange:e=>{_(e),Ze({enabled:e}),e&&lt===`browser`&&pt(v)},ariaLabel:`Enable document translation`,disabled:Je.isPending||Ye.isPending||t})]}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-2 grid gap-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Target Language`}),(0,K.jsx)(Sit,{value:v,onChange:e=>{y(e),Ze({targetLanguage:e}),lt===`browser`&&(k(null),j(null),pt(e))},disabled:Je.isPending||Ye.isPending||t})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Display Mode`}),(0,K.jsx)(wj,{value:b,onChange:e=>{x(e),Ze({displayMode:e})},options:Mrt})]})]}),(0,K.jsx)(`div`,{className:`border-border/60 space-y-3 border-t pt-3`,children:(0,K.jsx)(`div`,{className:`space-y-3`,children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Engine`}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(15rem,17rem)_minmax(0,1fr)_auto] grid gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[lt?(0,K.jsx)(W1,{value:lt,onValueChange:e=>{if(C(e),Xe.mutate(e),e===`browser`&&!t){let e=_J(v);if(e){k(e);let t=L9(e);j(e=>R9(t,e))}else pt(v)}},options:mt,ariaLabel:`Engine`,className:`min-w-[12rem]`,disabled:!ct||Xe.isPending||t}):(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Engine`,className:`border-border bg-background text-muted-foreground inline-flex h-9 min-w-[12rem] items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm`,disabled:!0,children:[(0,K.jsx)(`span`,{children:r||a||s?`Loading engine...`:`Select engine`}),(0,K.jsx)(Xp,{className:`h-4 w-4 shrink-0`})]}),(0,K.jsx)(Xy,{content:`Open translation test`,delay:0,children:(0,K.jsx)(Cj,{variant:`primary`,size:`icon-md`,"aria-label":`Open translation test`,onClick:()=>ve(!0),className:`bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(dm,{className:`h-4 w-4`})})})]}),(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1.5 text-sm`,children:[ht?.technicalSummary?(0,K.jsx)(`div`,{className:`text-muted-foreground whitespace-normal text-xs leading-5 [overflow-wrap:anywhere]`,children:ht.technicalSummary}):null,(0,K.jsx)(`div`,{className:`text-muted-foreground whitespace-normal text-xs leading-5 [overflow-wrap:anywhere]`,children:`Switching engines only checks installation state. Run Test Translate manually to validate runtime errors and latency.`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex min-w-0 items-center gap-2 leading-5`,children:[lt===`browser`?Ct===`checking`?(0,K.jsx)(Em,{className:`h-4 w-4 shrink-0 animate-spin`}):Ct===`available`?(0,K.jsx)(Xy,{content:`Installed`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Installed`,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):Ct===`downloadable`?(0,K.jsx)(nm,{className:`h-4 w-4 shrink-0 text-sky-500`}):(0,K.jsx)(Hm,{className:`h-4 w-4 shrink-0 text-amber-500`}):_t?(0,K.jsx)(Xy,{content:`Loading translation engine metadata`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Loading translation engine metadata`,className:`text-muted-foreground inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`})})}):sc(Tt)?Tt?.dependency.state===`installing`?(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Installing translation engine`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):Tt?.runtime.state===`probing`?(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Checking translation engine status`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,disabled:!0,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):(0,K.jsx)(Cj,{type:`button`,size:`icon-sm`,variant:`primary`,"aria-label":`Install translation engine`,className:`bg-primary text-primary-foreground hover:bg-primary/90 h-7 w-7 shrink-0 rounded-full`,onClick:()=>{if(!lt)return;let e=ht?.label??gt?.label??lt;Pe(oc({dependency:{state:`installing`,message:`Installing ${e}.`},summary:`Installing ${e}.`})),ot.mutate(lt)},disabled:!lt||ot.isPending,children:ot.isPending?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})}):(0,K.jsx)(Xy,{content:`Installed`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Installed`,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}),(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:rn?(0,K.jsx)(`pre`,{ref:Ve,className:`bg-muted/40 border-border scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md border px-3 py-2 font-mono text-[11px] leading-5`,children:(0,K.jsx)(`code`,{children:Fe})}):Et})]})]})]})]})})}),nn?null:lt===`openai`?(0,K.jsxs)(`div`,{className:`border-border/60 @[56rem]:grid-cols-3 grid gap-3 border-t pt-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`API Base URL`,(0,K.jsx)(`input`,{value:P,onChange:e=>F(e.currentTarget.value),onBlur:()=>Ye.mutate({translationEngines:{openai:{baseUrl:P.trim()}}}),className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`,placeholder:`https://api.openai.com/v1`})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Token`,(0,K.jsx)(`input`,{value:ee,type:`password`,onChange:e=>I(e.currentTarget.value),onBlur:()=>Ye.mutate({translationEngines:{openai:{token:ee}}}),className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`,placeholder:`sk-...`})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Model`,(0,K.jsx)(`input`,{value:L,onChange:e=>R(e.currentTarget.value),onBlur:()=>{let e=L.trim();if(i?.translation.engines.openai){Je.mutate({engines:{openai:{model:e}}});return}Ye.mutate({translationEngines:{openai:{model:e}}})},className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`})]})]}):null,nn?null:lt===`browser`?(0,K.jsx)(`div`,{className:`border-border/60 border-t pt-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Browser language pairs`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex min-w-0 items-center gap-2 text-[11px] leading-5`,children:[O?.state===`checking`?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 shrink-0 animate-spin`}):null,(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:wt})]})]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>void pt(v),disabled:kt,children:[(0,K.jsx)(Am,{className:`h-3.5 w-3.5`}),`Check`]})]}),bt.length>0?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,"aria-label":`Browser translation language pairs`,children:bt.map(e=>{let t=z9(e)===xt;return(0,K.jsx)(`button`,{type:`button`,onClick:()=>j(z9(e)),className:`inline-flex items-center gap-1.5 rounded border px-2.5 py-1 text-[11px] leading-none transition-colors ${B9({tone:Lrt(e.availability),selected:t})}`,title:Frt(e),children:(0,K.jsx)(`span`,{className:`font-medium`,children:Prt(e)})},z9(e))})}):null]}),St?(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`text-foreground flex min-w-0 items-center gap-2 font-medium`,children:(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:Frt(St)})}),(0,K.jsxs)(`div`,{className:`relative inline-flex h-10 w-10 items-center justify-center`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 40 40`,className:`h-10 w-10 -rotate-90`,children:[(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`stroke-border fill-none`,strokeWidth:`3`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`fill-none transition-all ${Dt===`downloaded`?`stroke-emerald-500`:`stroke-primary`}`,strokeWidth:`3`,strokeDasharray:100.531,strokeDashoffset:100.531*(1-Ot/100),strokeLinecap:`round`})]}),Dt===`download`?(0,K.jsx)(Xy,{content:`Download language pair`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Download browser language pair`,onClick:()=>void an(St),className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):Dt===`cancel`?(0,K.jsx)(Xy,{content:`Cancel download`,delay:0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Cancel browser language pair download`,onClick:on,className:`text-foreground focus-visible:ring-primary group absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium group-hover:hidden`,children:`${Ot}%`}),(0,K.jsx)(Wm,{className:`hidden h-3.5 w-3.5 group-hover:block`})]})}):Dt===`downloaded`?(0,K.jsx)(Xy,{content:`Downloaded`,delay:0,children:(0,K.jsx)(`span`,{"aria-label":`Downloaded`,className:`absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):(0,K.jsx)(`span`,{className:`text-foreground absolute text-[10px] font-medium`,children:kt?`...`:`${Ot}%`})]})]}),(0,K.jsx)(`div`,{className:`text-muted-foreground mt-2 leading-5`,children:St.message??(St.availability===`available`?`This language pair is ready in the browser.`:St.availability===`downloading`?`Chrome is downloading this language pair.`:`This language pair can be downloaded by Chrome.`)})]}):null]})}):null,nn?null:ut?(0,K.jsx)(`div`,{className:`border-border/60 border-t pt-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:jt}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(Xy,{content:Nt,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":Nt,onClick:()=>{Pt&&rt.mutate({modelId:Pt})},disabled:!Pt||rt.isPending,className:`text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-primary inline-flex h-8 w-8 items-center justify-center rounded-md outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(Am,{className:`h-4 w-4 ${rt.isPending?`animate-spin`:``}`})})}),(0,K.jsx)(pit,{value:ie,memoryBudgetPercent:oe,resolvedEndpoint:Qt,onValueChange:ae,onMemoryBudgetPercentChange:se,onCommit:e=>{Ye.mutate({translationEngines:Zrt(ut,{hfEndpoint:e,memoryBudgetPercent:oe})}),fe([])}})]})]}),(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(0,1fr)_auto] grid gap-2`,children:[(0,K.jsx)(uit,{value:z,query:B,options:Ht,remoteLoading:pe,onQueryChange:V,onOpenChange:e=>{ge(e),e&&(fe([]),V(``),re(``))},onChange:e=>{te(e),V(e)},onCommit:async e=>{let t=await ait(ut,e);H9({engineId:ut,panelState:t,queryClient:Le,requestedSelectedGroupId:U}),We.current=t,Qe(ut,{model:e,selectedGroupId:null}),le(t.selectedGroupId)},ariaLabel:jt}),(0,K.jsxs)(`div`,{className:`text-muted-foreground inline-flex min-w-0 items-center text-[11px] leading-5 [overflow-wrap:anywhere]`,children:[`HF: `,Qt]})]}),(0,K.jsx)(hit,{ariaLabel:Mt,groups:Gt,loading:tn,disabled:Zt,onSelectGroup:e=>{le(e),Qe(ut,{selectedGroupId:e})}})]}),(0,K.jsx)(yit,{plan:Yt?.plan??Wt,groups:Gt,state:Yt,progressPercent:Xt,loading:tn,error:Vt??(Ut?.status===`error`?Ut.error??null:null),onDownload:()=>{$e.mutate({modelId:Pt,groupId:qt})},onPause:()=>{et.mutate({modelId:Pt,groupId:qt})},onResume:()=>{tt.mutate({modelId:Pt,groupId:qt})},onDelete:()=>{nt.mutate({modelId:Pt,groupId:qt})},knownSize:Jt,modelId:Pt})]})}):null,(0,K.jsxs)(`div`,{className:`border-border/60 space-y-3 border-t pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`block text-sm font-medium`,children:`Translation cache`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:`Stores validated translation projections in the shared user cache.`})]}),(0,K.jsx)(LA,{checked:w,onCheckedChange:e=>{T(e),Ze({cacheEnabled:e}),e&&h()},ariaLabel:`Enable translation cache`,disabled:Je.isPending||Ye.isPending||t})]}),w?(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(12rem,1fr)_auto] grid gap-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Entry limit`,(0,K.jsx)(`input`,{type:`number`,min:100,max:2e5,step:100,value:E,onChange:e=>D(Number(e.currentTarget.value)),onBlur:()=>{let e=Math.round(E);D(e),Ye.mutate({translationCache:{entryLimit:e}})},className:`border-input bg-background mt-2 h-9 w-full rounded-md border px-3 text-sm`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>it.mutate(void 0,{onSuccess:()=>void h()}),disabled:it.isPending,children:[(0,K.jsx)(Mm,{className:`h-3.5 w-3.5`}),`Clean`]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:()=>at.mutate(void 0,{onSuccess:()=>void h()}),disabled:at.isPending,children:[(0,K.jsx)(em,{className:`h-3.5 w-3.5`}),`Clear`]})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground @[42rem]:col-span-2 text-xs`,children:m?`${m.entries} / ${m.entryLimit} entries`:`Cache stats unavailable.`})]}):null]}),un?(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Saving translation settings...`}):null,(0,K.jsx)(dit,{open:_e,onClose:()=>ve(!1),engineId:lt,sourceLanguage:ye,sourceText:xe,timeoutSeconds:je,result:Ce,error:Te,running:ke,onSample:()=>{let e=Vrt();be(e.sourceLanguage),Se(e.sourceText),we(``),Ee(null),Oe(null)},onRun:()=>void sn(),targetLanguage:v,onSourceLanguageChange:e=>{be(e),we(``),Ee(null),Oe(null)},onSourceTextChange:Se,onTimeoutSecondsChange:Me,elapsedMs:De})]})]})}function uit({ariaLabel:e,value:t,query:n,options:r,remoteLoading:i,onQueryChange:a,onOpenChange:o,onChange:s,onCommit:c}){let l=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),u=`translation-local-model-popover-${l}`,d=`translation-local-model-options-${l}`,f=(0,G.useRef)(null),p=(0,G.useRef)(null),m=(0,G.useRef)(null),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=(0,G.useCallback)(()=>{let e=f.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,420),window.innerWidth-16);v({left:Math.min(window.innerWidth-n-8,Math.max(8,t.left)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]);(0,G.useEffect)(()=>{h&&(y(),m.current?.focus(),m.current?.select())},[h,y]),(0,G.useEffect)(()=>{if(h)return window.addEventListener(`resize`,y),window.addEventListener(`scroll`,y,!0),()=>{window.removeEventListener(`resize`,y),window.removeEventListener(`scroll`,y,!0)}},[h,y]);let b=(0,G.useCallback)(()=>{let e=p.current;if(!e){g(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}g(!1)},[]),x=(0,G.useCallback)(e=>{let t=e.newState===`open`;g(t),o(t)},[o]);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{ref:f,type:`button`,"aria-label":e??`Local model`,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":u,popoverTarget:u,popoverTargetAction:`toggle`,onClick:y,className:`border-border bg-background text-foreground hover:bg-muted/30 focus:ring-primary inline-flex h-9 w-full min-w-[12rem] items-center gap-2 rounded-md border px-3 py-2 text-left text-sm outline-none focus:ring-1`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t||`Select model`}),(0,K.jsx)(Xp,{className:`text-muted-foreground h-4 w-4 shrink-0`})]}),(0,K.jsxs)(`div`,{id:u,ref:p,role:`dialog`,"aria-label":`Select local model`,popover:`auto`,onToggle:x,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 rounded-md border p-2 shadow-lg backdrop:bg-black/20`,style:_?{position:`fixed`,inset:`auto`,left:_.left,top:_.top,width:_.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`border-border bg-popover sticky top-0 z-10 mb-2 grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md border px-2 py-1.5`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground h-4 w-4`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:m,role:`textbox`,"aria-label":`Search local models`,"aria-autocomplete":`list`,"aria-controls":d,value:n,onChange:e=>a(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&b(),e.key===`Enter`){let e=n.trim()||t;s(e),c(e),b()}},className:`text-foreground placeholder:text-muted-foreground min-w-0 bg-transparent text-sm outline-none`,placeholder:`Search Hugging Face translation models`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":`Clear model search`,title:`Clear`,onClick:()=>{a(``),m.current?.focus()},className:`text-muted-foreground hover:bg-muted hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded transition-colors`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{id:d,role:`listbox`,"aria-label":`Local model options`,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-72 overflow-y-auto`,children:[r.length>0?r.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.id===t,className:`grid w-full gap-1 rounded-sm px-2 py-2 text-left text-sm ${e.id===t?`bg-primary/10 text-primary`:`text-popover-foreground hover:bg-muted/70`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>{e.selectable&&(s(e.id),c(e.id),b())},disabled:!e.selectable,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-medium`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.id}),e.local?(0,K.jsx)(`span`,{className:`text-emerald-600`,children:xit(e.asset.status)}):null]}),(0,K.jsx)(`span`,{className:`text-muted-foreground whitespace-normal text-xs [overflow-wrap:anywhere]`,children:e.summary}),(0,K.jsxs)(`span`,{className:`text-muted-foreground flex flex-wrap items-center gap-2 text-[11px]`,children:[e.downloads>0?`${bit(e.downloads)} downloads · `:``,W9(e.size.estimatedTotalBytes),e.asset.progress!==void 0&&e.asset.status!==`downloaded`?(0,K.jsxs)(`span`,{children:[`· `,Math.round(e.asset.progress*100),`%`]}):null,e.selectable?null:(0,K.jsx)(`span`,{children:`· Size required`})]}),(0,K.jsx)(mit,{groups:e.downloadGroups??e.asset.plan?.groups??[]})]},e.id)):(0,K.jsx)(`div`,{className:`text-muted-foreground px-2 py-2 text-sm`,children:`No matching models`}),i?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 px-2 py-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Loading remote models…`]}):null]})]})]})}function dit({open:e,onClose:t,engineId:n,sourceLanguage:r,sourceText:i,targetLanguage:a,timeoutSeconds:o,result:s,error:c,elapsedMs:l,running:u,onSample:d,onRun:f,onSourceLanguageChange:p,onSourceTextChange:m,onTimeoutSecondsChange:h}){if(!e)return null;let g=uJ(a)?.label??a,_=c?`border-destructive/30 bg-destructive/5 text-destructive`:`border-input bg-background text-foreground`;return(0,K.jsx)(xA,{open:e,title:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(dm,{className:`text-muted-foreground h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:`Translation Test`})]}),onClose:t,headerActions:(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:d,children:[(0,K.jsx)(Mm,{className:`h-3.5 w-3.5`}),`Sample`]}),className:`max-w-5xl`,footer:(0,K.jsxs)(`div`,{className:`@[42rem]:grid-cols-[minmax(0,1fr)_auto] grid w-full gap-3`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground max-w-2xl text-xs`,children:n===`local`?`Uses the configured local model and server runtime.`:n===`local-ct2`?`Uses the configured CT2 model artifacts and server runtime.`:n===`local-llama`?`Uses the configured local GGUF model and llama.cpp server runtime.`:n===`openai`?`Uses the configured OpenAI-compatible provider and model.`:`Uses the current browser Translator API capability.`}),(0,K.jsxs)(`div`,{className:`@[42rem]:justify-end flex flex-wrap items-end justify-start gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,K.jsx)(`span`,{children:`Timeout (seconds)`}),(0,K.jsx)(`input`,{type:`number`,min:1,step:1,value:o,onChange:e=>h(Math.max(1,Number(e.currentTarget.value)||krt)),className:`border-input bg-background h-9 w-24 rounded-md border px-3 text-sm`})]}),(0,K.jsxs)(Cj,{size:`sm`,variant:`secondary`,onClick:f,disabled:u,children:[u?(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(Om,{className:`h-3.5 w-3.5`}),`Run Test`]})]})]}),children:(0,K.jsxs)(`div`,{className:`@[64rem]:grid-cols-2 grid gap-4`,children:[(0,K.jsxs)(`section`,{className:`bg-muted/20 border-border flex min-h-[23rem] flex-col rounded-xl border`,children:[(0,K.jsxs)(`div`,{className:`border-border space-y-2 border-b px-4 py-4`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Source Language`}),(0,K.jsx)(`div`,{children:(0,K.jsx)(Sit,{value:r,onChange:p,ariaLabel:`Translation test source language`,dialogLabel:`Select translation test source language`,searchInputLabel:`Search translation test source languages`,optionsListLabel:`Translation test source language options`,clearButtonLabel:`Clear translation test source language search`,placeholder:`Select source language`,disabled:u})})]}),(0,K.jsxs)(`label`,{className:`flex min-h-0 flex-1 flex-col px-4 py-4 text-sm font-medium`,children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Source Text`}),(0,K.jsx)(`textarea`,{"aria-label":`Translation test source text`,value:i,onChange:e=>m(e.currentTarget.value),rows:10,className:`border-input bg-background focus:ring-ring mt-2 min-h-[15rem] flex-1 resize-none rounded-md border px-3 py-3 text-sm focus:outline-none focus:ring-2`,placeholder:Hrt(r)})]})]}),(0,K.jsxs)(`section`,{className:`bg-muted/20 border-border flex min-h-[23rem] flex-col rounded-xl border`,children:[(0,K.jsxs)(`div`,{className:`border-border space-y-2 border-b px-4 py-4`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Target Language`}),(0,K.jsx)(`div`,{"aria-label":`Translation test target language`,className:`border-input bg-background text-foreground flex h-10 items-center rounded-md border px-3 text-sm`,children:g})]}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col px-4 py-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`text-foreground text-sm font-medium`,children:`Translated Output`}),l===null?null:(0,K.jsx)(`div`,{"aria-label":`Translation test elapsed time`,className:`text-muted-foreground shrink-0 text-xs`,children:fit(l)})]}),(0,K.jsx)(`div`,{className:`mt-2 min-h-[15rem] flex-1 rounded-md border px-3 py-3 text-sm ${_}`,children:u?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Running translation test…`]}):s?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:s}):c?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:c}):(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`Run a test to inspect translated output for the current engine.`})})]})]})]})})}function fit(e){return e>=1e3?`Elapsed ${Math.max(.01,e/1e3).toFixed(2)}s`:`Elapsed ${Math.max(1,Math.round(e))}ms`}function pit({value:e,memoryBudgetPercent:t,resolvedEndpoint:n,onValueChange:r,onMemoryBudgetPercentChange:i,onCommit:a}){let o=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),s=`translation-local-provider-popover-${o}`,c=`translation-local-provider-endpoint-${o}`,l=`translation-local-provider-endpoint-hint-${o}`,u=(0,G.useRef)(null),d=(0,G.useRef)(null),f=(0,G.useRef)(null),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=(0,G.useCallback)(()=>{let e=u.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,320),window.innerWidth-16);g({left:Math.min(window.innerWidth-n-8,Math.max(8,t.right-n)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]),v=(0,G.useCallback)(()=>{a(e.trim())},[a,e]),y=(0,G.useCallback)(()=>{let e=d.current;if(!e){m(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}m(!1)},[]);(0,G.useEffect)(()=>{p&&(_(),f.current?.focus(),f.current?.select())},[p,_]),(0,G.useEffect)(()=>{if(p)return window.addEventListener(`resize`,_),window.addEventListener(`scroll`,_,!0),()=>{window.removeEventListener(`resize`,_),window.removeEventListener(`scroll`,_,!0)}},[p,_]);let b=(0,G.useCallback)(e=>{let t=e.newState===`open`;m(t),t?_():v()},[v,_]);return(0,K.jsxs)(`div`,{className:`shrink-0`,children:[(0,K.jsx)(Xy,{content:`Hugging Face endpoint`,delay:0,children:(0,K.jsx)(`button`,{ref:u,type:`button`,"aria-label":`Local provider settings`,"aria-haspopup":`dialog`,"aria-expanded":p,"aria-controls":s,popoverTarget:s,popoverTargetAction:`toggle`,onClick:_,className:`text-muted-foreground hover:bg-muted hover:text-foreground focus:ring-primary inline-flex h-7 w-7 items-center justify-center rounded-md outline-none transition-colors focus:ring-1`,children:(0,K.jsx)(Lm,{className:`h-3.5 w-3.5`})})}),(0,K.jsxs)(`div`,{id:s,ref:d,role:`dialog`,"aria-label":`Local provider settings`,popover:`auto`,onToggle:b,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 space-y-3 rounded-md border p-3 shadow-lg backdrop:bg-black/20`,style:h?{position:`fixed`,inset:`auto`,left:h.left,top:h.top,width:h.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium`,children:`HF Endpoint`}),(0,K.jsx)(`input`,{id:c,ref:f,value:e,"aria-describedby":l,onChange:e=>r(e.currentTarget.value),onBlur:v,onKeyDown:e=>{e.key===`Enter`&&(v(),y()),e.key===`Escape`&&y()},className:`border-input bg-background h-9 w-full rounded-md border px-3 text-sm`,placeholder:`https://huggingface.co`}),(0,K.jsxs)(`div`,{id:l,className:`text-muted-foreground text-xs leading-5 [overflow-wrap:anywhere]`,children:[(0,K.jsxs)(`div`,{children:[`Current endpoint: `,n]}),(0,K.jsx)(`div`,{children:`Mirror example: https://hf-mirror.com`})]})]}),(0,K.jsxs)(`label`,{className:`block text-sm font-medium`,children:[`Max memory budget`,(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,K.jsx)(`input`,{type:`range`,min:0,max:100,step:5,value:t,onChange:e=>i(Math.max(0,Math.min(100,Number(e.currentTarget.value)||0))),className:`flex-1`}),(0,K.jsxs)(`span`,{className:`text-muted-foreground min-w-12 text-right text-xs`,children:[t,`%`]})]})]})]})]})}function mit({groups:e}){return e.length===0?null:(0,K.jsx)(`span`,{className:`flex flex-wrap gap-1 pt-1`,children:e.slice(0,5).map(e=>{let t=git(e.status);return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${e.selectable?B9({tone:t,selected:e.selected,interactive:!1}):`text-muted-foreground/60 border-dashed`}`,children:[(0,K.jsx)(`span`,{children:e.label}),(0,K.jsx)(`span`,{children:W9(e.estimatedTotalBytes)})]},e.id)})})}function hit({ariaLabel:e,groups:t,loading:n,disabled:r,onSelectGroup:i}){return t.length===0?null:(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,"aria-label":e??`Local download profiles`,"aria-busy":n,children:t.map(e=>{let t=git(e.status);return(0,K.jsxs)(`button`,{type:`button`,disabled:!e.selectable||r,onClick:()=>i(e.id),className:`inline-flex items-center gap-1.5 rounded border px-2.5 py-1 text-[11px] leading-none transition-colors ${B9({tone:t,selected:e.selected})} disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,K.jsx)(`span`,{children:W9(e.estimatedTotalBytes)})]},e.id)})})})}function git(e){return e===`downloaded`?`downloaded`:e===`queued`||e===`downloading`||e===`paused`||e===`error`||e===`deleting`?`partial`:`not-started`}function _it(e){if(e.loading)return`progress`;switch(e.state?.status){case`deleting`:return`deleting`;case`downloading`:return`pause`;case`paused`:return`resume`;case`downloaded`:return`downloaded`;case`error`:case`not-downloaded`:case void 0:return e.knownSize?`download`:`progress`;case`queued`:return`progress`}}function vit(e,t,n){let r=t?.commitHash??n.find(e=>e.revision)?.revision;return r?{commitHash:r,href:`https://huggingface.co/${e}/tree/${encodeURIComponent(r)}`}:null}function yit({plan:e,groups:t,state:n,progressPercent:r,loading:i,error:a,onDownload:o,onPause:s,onResume:c,onDelete:l,knownSize:u,modelId:d}){let f=n?.status===`deleting`,p=n?.status===`paused`,m=n?.status===`downloaded`,h=n?.status===`error`,g=_it({state:n,loading:i,knownSize:u}),_=!i&&!f&&(m||p||h),v=r??0,y=t.find(e=>e.selected)??null,b=y?.files??e?.files??n?.plan?.files??[],x=vit(d,y,b),S=new Map(n?.files.map(e=>[e.path,e])??[]),C=b.length>0?b.map(e=>({...e,downloadedBytes:S.get(e.path)?.downloadedBytes})):n?.files??[],w=n?.profileLoad?.status===`loading`?n.profileLoad.message??`Loading model files…`:null,T=C.length===0&&(i||w!==null);return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[!i&&e&&!u?(0,K.jsx)(`div`,{className:`text-amber-600`,children:`This model is not downloadable here until concrete artifact sizes are known.`}):null,(0,K.jsxs)(`div`,{className:`border-border rounded-md border px-3 py-2 text-xs ${m?`bg-emerald-500/5`:`bg-muted/30`}`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`text-foreground flex min-w-0 items-center gap-2 font-medium`,children:[(0,K.jsx)(`span`,{children:`Download files`}),e?(0,K.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-normal`,children:W9(y?.estimatedTotalBytes??e.estimatedTotalBytes)}):n?.totalBytes===void 0?null:(0,K.jsx)(`span`,{className:`text-muted-foreground text-[11px] font-normal`,children:W9(n.totalBytes)})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[_?(0,K.jsx)(`button`,{type:`button`,"aria-label":`Delete model`,title:`Delete local model`,onClick:l,disabled:!d,className:`text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:ring-destructive/40 inline-flex h-8 w-8 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(Vm,{className:`h-3.5 w-3.5`})}):null,(0,K.jsxs)(`div`,{className:`relative inline-flex h-10 w-10 items-center justify-center`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 40 40`,className:`h-10 w-10 -rotate-90`,children:[(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`stroke-border fill-none`,strokeWidth:`3`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`16`,className:`fill-none transition-all ${m?`stroke-emerald-500`:`stroke-primary`}`,strokeWidth:`3`,strokeDasharray:100.531,strokeDashoffset:100.531*(1-v/100),strokeLinecap:`round`})]}),g===`download`?(0,K.jsx)(Xy,{content:`Download model`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Download model`,"data-local-plan-action":`download`,onClick:o,disabled:!d,className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):g===`pause`?(0,K.jsx)(Xy,{content:`Pause`,delay:0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":`Pause download`,"data-local-plan-action":`pause`,onClick:s,disabled:!d,className:`text-foreground focus-visible:ring-primary group absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium group-hover:hidden`,children:`${v}%`}),(0,K.jsx)(Dle,{className:`hidden h-3.5 w-3.5 group-hover:block`})]})}):g===`resume`?(0,K.jsx)(Xy,{content:`Resume download`,delay:0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`Resume download`,"data-local-plan-action":`resume`,onClick:c,disabled:!d,className:`text-foreground focus-visible:ring-primary absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent outline-none transition-[background-color,transform] hover:scale-105 focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,K.jsx)(nm,{className:`h-3.5 w-3.5`})})}):g===`downloaded`?(0,K.jsx)(Xy,{content:`Downloaded`,delay:0,children:(0,K.jsx)(`span`,{"aria-label":`Downloaded`,"data-local-plan-action":`downloaded`,className:`absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent text-emerald-500`,children:(0,K.jsx)($p,{className:`h-4 w-4`})})}):g===`deleting`?(0,K.jsx)(`span`,{"data-local-plan-action":`deleting`,className:`text-foreground absolute inline-flex h-8 w-8 items-center justify-center rounded-full bg-transparent`,children:(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`})}):(0,K.jsx)(`span`,{"data-local-plan-action":`progress`,className:`text-foreground absolute text-[10px] font-medium`,children:i?`...`:`${v}%`})]})]})]}),f?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex items-center gap-2`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Removing local model files…`]}):a?(0,K.jsxs)(`div`,{className:`text-destructive mt-2 flex items-center gap-2 leading-5`,children:[(0,K.jsx)(em,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:a})]}):(0,K.jsxs)(K.Fragment,{children:[x?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1 leading-5`,children:[(0,K.jsx)(`span`,{children:`Revision`}),(0,K.jsxs)(`a`,{href:x.href,target:`_blank`,rel:`noreferrer`,className:`text-primary bg-muted inline-flex min-w-0 items-center gap-1 rounded px-1 py-0.5 font-mono text-[11px] hover:underline`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:x.commitHash}),(0,K.jsx)(im,{className:`h-3 w-3 shrink-0`})]})]}):null,T?(0,K.jsxs)(`div`,{className:`text-muted-foreground mt-2 flex items-center gap-2 leading-5`,children:[(0,K.jsx)(Em,{className:`h-3.5 w-3.5 animate-spin`}),w??`Loading model files…`]}):C.length>0?(0,K.jsx)(`ul`,{className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] text-muted-foreground mt-2 max-h-48 space-y-1 overflow-y-auto pr-1`,children:C.map(e=>{let t=e.sizeBytes,n=`downloadedBytes`in e?e.downloadedBytes??(m&&t!==void 0?t:t===void 0?void 0:0):void 0;return(0,K.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3`,children:[(0,K.jsx)(`span`,{className:`min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:e.path}),(0,K.jsx)(`span`,{className:`shrink-0`,children:n!==void 0||t!==void 0?`${W9(n)} / ${W9(t)}`:`Pending`})]},e.path)})}):(0,K.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`No runtime download plan available.`})]})]})]})}function W9(e){if(e===void 0||e<0)return`Unknown size`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=100||r===0?0:1;return`${n.toFixed(i)} ${t[r]}`}function bit(e){return new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e)}function xit(e){switch(e){case`not-downloaded`:return`Not downloaded`;case`queued`:return`Queued`;case`downloading`:return`Downloading`;case`paused`:return`Paused`;case`downloaded`:return`Downloaded`;case`error`:return`Error`;case`deleting`:return`Deleting`}}function Sit({value:e,onChange:t,ariaLabel:n=`Translation target language`,dialogLabel:r=`Select translation target language`,searchInputLabel:i=`Search translation languages`,optionsListLabel:a=`Translation target language options`,clearButtonLabel:o=`Clear search`,placeholder:s=`Select language`,disabled:c}){let l=(0,G.useId)().replace(/[^a-zA-Z0-9_-]/g,``),u=`translation-target-language-popover-${l}`,d=`translation-target-language-options-${l}`,f=uJ(e),p=f?.label??e,m=(0,G.useRef)(null),h=(0,G.useRef)(null),g=(0,G.useRef)(null),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(null),C=(0,G.useMemo)(()=>QVe(y),[y]),w=(0,G.useCallback)(()=>{let e=m.current;if(!e)return;let t=e.getBoundingClientRect(),n=Math.min(Math.max(t.width,320),window.innerWidth-16);S({left:Math.min(window.innerWidth-n-8,Math.max(8,t.left)),top:Math.min(window.innerHeight-8,Math.max(8,t.bottom+4)),width:n})},[]),T=(0,G.useCallback)(()=>{let e=h.current;if(!e){v(!1);return}if(typeof e.hidePopover==`function`)try{e.hidePopover();return}catch{}v(!1)},[]);(0,G.useEffect)(()=>{_&&w()},[_,w]),(0,G.useEffect)(()=>{_&&(g.current?.focus(),g.current?.select())},[_]),(0,G.useEffect)(()=>{if(_)return window.addEventListener(`resize`,w),window.addEventListener(`scroll`,w,!0),()=>{window.removeEventListener(`resize`,w),window.removeEventListener(`scroll`,w,!0)}},[_,w]),(0,G.useEffect)(()=>{c&&(T(),b(``))},[c,T]);let E=(0,G.useCallback)(e=>{b(``),t(e),T()},[T,t]),D=(0,G.useCallback)(e=>{let t=e.newState===`open`;v(t),t?w():b(``)},[w]);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{ref:m,type:`button`,"aria-label":n,"aria-haspopup":`dialog`,"aria-expanded":_,"aria-controls":u,popoverTarget:u,popoverTargetAction:`toggle`,disabled:c,onClick:w,className:`border-border bg-background text-foreground hover:bg-muted/30 focus:ring-primary inline-flex h-9 w-full min-w-0 items-center gap-2 rounded-md border px-3 py-2 text-left text-sm outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(bm,{className:`text-muted-foreground h-4 w-4 shrink-0`}),f?(0,K.jsx)(`span`,{className:`text-muted-foreground shrink-0 font-mono text-xs`,children:f.code}):null,(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p||s}),(0,K.jsx)(Xp,{className:`text-muted-foreground h-4 w-4 shrink-0`})]}),(0,K.jsxs)(`div`,{id:u,ref:h,role:`dialog`,"aria-label":r,popover:`auto`,onToggle:D,className:`settings-floating-popover bg-popover text-popover-foreground border-border m-0 rounded-md border p-2 shadow-lg backdrop:bg-black/20`,style:x?{position:`fixed`,inset:`auto`,left:x.left,top:x.top,width:x.width}:void 0,children:[(0,K.jsxs)(`div`,{className:`border-border bg-popover sticky top-0 z-10 mb-2 grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md border px-2 py-1.5`,children:[(0,K.jsx)(Pm,{className:`text-muted-foreground h-4 w-4`,"aria-hidden":`true`}),(0,K.jsx)(`input`,{ref:g,role:`textbox`,"aria-label":i,"aria-autocomplete":`list`,"aria-controls":d,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T()},className:`text-foreground placeholder:text-muted-foreground min-w-0 bg-transparent text-sm outline-none`,placeholder:`Search code, English, or native name`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o,title:`Clear`,onClick:()=>{b(``),g.current?.focus()},disabled:c||y.length===0,className:`text-muted-foreground hover:bg-muted hover:text-foreground inline-flex h-6 w-6 items-center justify-center rounded transition-colors disabled:pointer-events-none disabled:opacity-40`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),(0,K.jsx)(`div`,{id:d,role:`listbox`,"aria-label":a,className:`scrollbar-thin scrollbar-track-transparent scrollbar-thumb-[color-mix(in_srgb,currentColor,transparent_78%)] max-h-60 overflow-y-auto`,children:C.length>0?C.map(t=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t.code===e,className:`grid w-full grid-cols-[4.5rem_minmax(0,1fr)] items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm ${t.code===e?`bg-primary/10 text-primary`:`text-popover-foreground hover:bg-muted/70`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>E(t.code),children:[(0,K.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t.code}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label})]},t.code)):(0,K.jsx)(`div`,{className:`text-muted-foreground px-2 py-2 text-sm`,children:`No matching languages`})})]})]})}function G9(e,t=[]){let n=e=>e?/[\s"'\\]/.test(e)?JSON.stringify(e):e:`""`;return[e,...t].map(n).join(` `)}var Cit=[{value:`auto`,label:`Auto-detect tools (recommended)`},{value:`selected`,label:`Use selected tools`},{value:`all`,label:`Use all tools`}],wit=[{value:`default`,label:`Use global default`},{value:`core`,label:`core`},{value:`custom`,label:`custom`}],Tit=13,Eit=``,Dit=!0,Oit=`block`,kit=1e3,Ait=`xterm`,jit=1,Mit=100,Nit=1e3,Pit=[{value:`light`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mle,{className:`h-3.5 w-3.5`}),`Light`]})},{value:`dark`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Sle,{className:`h-3.5 w-3.5`}),`Dark`]})},{value:`system`,label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(xle,{className:`h-3.5 w-3.5`}),`System`]})}],Fit=[{value:`block`,label:`Block`},{value:`underline`,label:`Underline`},{value:`bar`,label:`Bar`}],K9=[{id:`settings-appearance`,label:`Appearance`},{id:`settings-opsx-invocation`,label:`OPSX Invocation`},{id:`settings-terminal`,label:`Terminal`},{id:`settings-notifications`,label:`Notifications`},{id:`settings-translation`,label:`Translation`},{id:`settings-dashboard`,label:`Dashboard`},{id:`settings-git-detail`,label:`Git Detail`},{id:`settings-project-directory`,label:`Project Directory`},{id:`settings-cli-configuration`,label:`CLI Configuration`},{id:`settings-openspec-profile`,label:`OpenSpec Profile`},{id:`settings-api-configuration`,label:`API Configuration`},{id:`settings-hosted-app`,label:`Hosted App`},{id:`settings-file-watcher`,label:`File Watcher`},{id:`settings-init-openspec`,label:`Initialize OpenSpec`}];function q9(e){let t=K9.findIndex(t=>t.id===e);return t===-1?0:t}function Iit({value:e,onChange:t,onBlur:n}){let r=(0,G.useRef)(null),[i,a]=(0,G.useState)(``),o=n=>{let r=e.trim();t(r?`${r}, ${n}`:n)};return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Font Family`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:e,onChange:e=>t(e.target.value),onBlur:n,placeholder:`e.g. JetBrains Mono, monospace`,className:`bg-background border-border text-foreground focus:ring-primary flex-1 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(`button`,{type:`button`,popoverTarget:`font-family-popover`,className:`border-border hover:bg-muted rounded-md border px-2 py-2 transition-colors`,"aria-label":`Add font`,children:(0,K.jsx)(km,{className:`h-4 w-4`})})]}),(0,K.jsx)(`div`,{id:`font-family-popover`,ref:r,popover:`auto`,className:`bg-popover text-popover-foreground border-border m-auto rounded-lg border p-4 shadow-lg backdrop:bg-black/20`,children:(0,K.jsxs)(`div`,{className:`w-64 space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Google Fonts`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:sA.map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o(e),r.current?.hidePopover()},className:`border-border hover:bg-muted rounded-md border px-2 py-1 text-xs transition-colors`,children:e},e))}),(0,K.jsx)(`hr`,{className:`border-border`}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Custom Font URL`}),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`https://...`,className:`bg-background border-border text-foreground focus:ring-primary min-w-0 flex-1 rounded-md border px-2 py-1 text-xs focus:outline-none focus:ring-1`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let e=i.trim();e&&(o(e),a(``),r.current?.hidePopover())},className:`bg-primary text-primary-foreground hover:bg-primary/90 rounded-md px-2 py-1 text-xs font-medium transition-colors`,children:`Add`})]})]})})]})}function Lit(){let[e,t]=(0,G.useState)(UA),[n,r]=(0,G.useState)(rDe),[i,a]=(0,G.useState)($a()||``),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)([]),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(`auto`),[v,y]=(0,G.useState)(`default`),[b,x]=(0,G.useState)(!0),S=FA(),C=FA(),{lines:w,status:T,commands:E,cancel:D,reset:O}=S,k=T===`error`?`error`:T===`success`?`success`:`default`,{lines:A,status:j,commands:M,cancel:N,reset:P}=C,F=j===`error`?`error`:j===`success`?`success`:`default`,ee=ab(),I=qa(),{data:L}=op(),{data:R,isLoading:z,refetch:te}=Br({...tp.cli.sniffGlobalCli.queryOptions(),staleTime:0,gcTime:0,enabled:!I}),{data:B,isLoading:V,refetch:ne}=Br({...tp.cli.checkAvailability.queryOptions(),enabled:!I}),{data:re,refetch:ie}=Br({...tp.config.getEffectiveCliCommand.queryOptions(),enabled:!I}),{data:ae}=Br({...tp.cli.getAllTools.queryOptions(),enabled:!I}),{data:oe,isLoading:se,refetch:ce}=Br({...tp.cli.getDetectedProjectTools.queryOptions(),enabled:!I}),{data:le,isLoading:ue,refetch:H}=Br({...tp.cli.getProfileState.queryOptions(),enabled:!I}),de=(0,G.useMemo)(()=>!le?.available||!le.delivery?null:{delivery:le.delivery,workflows:le.workflows},[le?.available,le?.delivery,le?.workflows]),{data:fe,refetch:pe}=Br({...tp.cli.getToolInitStates.queryOptions(de??{delivery:`both`,workflows:[]}),enabled:!I&&de!==null}),me=(0,G.useMemo)(()=>ae?.filter(e=>e.available)??[],[ae]),he=(0,G.useMemo)(()=>me.map(e=>e.value),[me]),ge=(0,G.useMemo)(()=>new Set(he),[he]),_e=(0,G.useMemo)(()=>he.join(`|`),[he]),ve=(0,G.useMemo)(()=>oe?.map(e=>e.value)??[],[oe]),ye=(0,G.useMemo)(()=>new Map((fe??[]).map(e=>[e.toolId,e])),[fe]),be=(0,G.useMemo)(()=>he.filter(e=>j9(ye,e)===`initialized`),[he,ye]),xe=(0,G.useMemo)(()=>new Set(be),[be]),Se=(0,G.useMemo)(()=>be.join(`|`),[be]),Ce=(0,G.useMemo)(()=>he.filter(e=>j9(ye,e)!==`initialized`),[he,ye]),we=(0,G.useMemo)(()=>u.filter(e=>ge.has(e)&&!xe.has(e)),[ge,xe,u]);(0,G.useEffect)(()=>{L?.cli?.command?l(G9(L.cli.command,L.cli.args??[])):l(``)},[L?.cli?.args,L?.cli?.command]);let Te=(0,G.useMemo)(()=>L?.cli?.command?G9(L.cli.command,L.cli.args??[]):``,[L?.cli?.args,L?.cli?.command]);(0,G.useEffect)(()=>{L?.theme&&t(L.theme)},[L?.theme]),(0,G.useEffect)(()=>{let e=L?.codeEditor?.theme;!e||!aDe(e)||r(e)},[L?.codeEditor?.theme]),(0,G.useEffect)(()=>{s(L?.appBaseUrl??``)},[L?.appBaseUrl]);let Ee=(0,G.useCallback)(()=>{te(),ne(),h(!1)},[te,ne]),De=R?.hasGlobal?`openspec (v`+(R.version||`detected`)+`)`:`npx @fission-ai/openspec`;(0,G.useEffect)(()=>{d(e=>{let t=e.filter(e=>ge.has(e)&&!xe.has(e));return e.length===t.length&&e.every((e,n)=>e===t[n])?e:t})},[ge,_e,xe,Se]);let Oe=(0,G.useMemo)(()=>Srt(ye,we),[we,ye]),ke=(0,G.useMemo)(()=>(fe??[]).filter(e=>e.status===`initialized`).length,[fe]),Ae=(0,G.useMemo)(()=>(fe??[]).filter(e=>e.status===`partial`).length,[fe]),je=e=>{_(e),p(!0)};(0,G.useEffect)(()=>{f||(D(),O())},[f,D,O]);let Me=(0,G.useMemo)(()=>xrt({mode:g,selectedToolIds:we,cliSupportedToolIds:ge,profileOverride:v,force:b}),[ge,b,v,g,we]);(0,G.useEffect)(()=>{f&&E.replaceAll([{command:`openspec`,args:Me}])},[Me,E,f]),(0,G.useEffect)(()=>{m?(M.replaceAll([{command:`npm`,args:[`install`,`-g`,`@fission-ai/openspec`]}]),M.runAll()):(N(),P())},[m,M,N,P]),(0,G.useEffect)(()=>{T===`success`&&Promise.allSettled([H(),ce(),pe(),ne(),te()])},[T,ce,H,pe,ne,te]);let Ne=e=>j9(ye,e)===`initialized`,Pe=e=>{!ge.has(e)||Ne(e)||d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},Fe=()=>{if(Ce.length>0&&Ce.every(e=>u.includes(e))){d([]);return}d([...Ce])},Ie=Oe.newCount,Le=Oe.repairCount,Re=Crt(Oe),ze=Ie+Le>0,Be=g===`selected`,Ve=se||!wrt(ve),He=(0,G.useMemo)(()=>Trt({mode:g,selectedLabel:Re,autoInitDisabled:Ve,hasSelectedToolActions:ze}),[Ve,ze,g,Re]),Ue=()=>{p(!1),D(),O()},We=()=>{h(!1),N(),P()},Ge=Vr({mutationFn:e=>X.config.update.mutate({cli:{command:e}}),onSuccess:async()=>{await Promise.allSettled([ne(),ie(),te()]),await Promise.allSettled([Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter()),Xf.invalidateQueries(tp.config.getEffectiveCliCommand.queryFilter())])}}),Ke=Vr({mutationFn:()=>X.cli.execute.mutate({args:[`update`]}),onSuccess:async()=>{await Promise.allSettled([H(),ne(),te(),Xf.invalidateQueries(tp.cli.checkAvailability.queryFilter())])}}),qe=Vr({mutationFn:()=>X.cli.execute.mutate({args:[`config`,`profile`,`core`]}),onSuccess:async()=>{await Promise.allSettled([H()])}}),Je=Vr({mutationFn:e=>X.config.update.mutate({theme:e})}),Ye=Vr({mutationFn:e=>X.config.update.mutate({codeEditor:{theme:e}})}),Xe=Vr({mutationFn:e=>X.config.update.mutate({appBaseUrl:e.trim()})}),Ze=Vr({mutationFn:e=>X.config.update.mutate({opsx:{agentInvocationMode:e}})}),Qe=(0,G.useMemo)(()=>uA.getConfig(),[]),[$e,et]=(0,G.useState)(Qe.fontSize),[tt,nt]=(0,G.useState)(Qe.fontFamily),[rt,it]=(0,G.useState)(Qe.cursorBlink),[at,ot]=(0,G.useState)(Qe.cursorStyle),[st,ct]=(0,G.useState)(Qe.scrollback),[lt,ut]=(0,G.useState)(Qe.useTheme),[dt,ft]=(0,G.useState)(Qe.lightTheme),[pt,mt]=(0,G.useState)(Qe.darkTheme),[ht,gt]=(0,G.useState)(Qe.rendererEngine),[_t,vt]=(0,G.useState)(Qe.bellSound),[yt,bt]=(0,G.useState)(Qe.bellVolume),[xt,St]=(0,G.useState)(100),[Ct,wt]=(0,G.useState)(1e3),[Tt,Et]=(0,G.useState)(null),Dt=iDe,Ot=eTe,kt=(0,G.useMemo)(()=>[...$k.map(e=>({value:e,label:e===`ghostty`?`ghostty-web`:e})),...eA(ht)?[]:[{value:ht,label:`Invalid value: ${ht}`}]],[ht]),At=eA(ht),jt=(0,G.useMemo)(()=>{let e=new Ok;return e.init(),e},[]);(0,G.useEffect)(()=>{let e=uA.getConfig();et(e.fontSize),nt(e.fontFamily),it(e.cursorBlink),ot(e.cursorStyle),ct(e.scrollback),ut(e.useTheme),ft(e.lightTheme),mt(e.darkTheme),gt(e.rendererEngine),vt(e.bellSound),bt(e.bellVolume)},[]),(0,G.useEffect)(()=>{let e=L?.terminal?.useTheme;e&&nTe(e)&&ut(e)},[L?.terminal?.useTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.lightTheme;e&&Zk(e)&&ft(e)},[L?.terminal?.lightTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.darkTheme;e&&Zk(e)&&mt(e)},[L?.terminal?.darkTheme]),(0,G.useEffect)(()=>{let e=L?.terminal?.rendererEngine;typeof e==`string`&&e.length>0&&gt(e)},[L?.terminal?.rendererEngine]),(0,G.useEffect)(()=>{let e=brt.safeParse(L?.terminal?.bellSound);e.success&&vt(e.data)},[L?.terminal?.bellSound]),(0,G.useEffect)(()=>{let e=L?.terminal?.bellVolume;typeof e==`number`&&Number.isFinite(e)&&bt(e)},[L?.terminal?.bellVolume]);let Mt=(0,G.useCallback)(e=>{uA.applyConfig({fontSize:e.fontSize??$e,fontFamily:e.fontFamily??tt,cursorBlink:e.cursorBlink??rt,cursorStyle:e.cursorStyle??at,scrollback:e.scrollback??st,useTheme:e.useTheme??lt,lightTheme:e.lightTheme??dt,darkTheme:e.darkTheme??pt,bellSound:e.bellSound??_t,bellVolume:e.bellVolume??yt})},[$e,tt,rt,at,st,lt,dt,pt,_t,yt]),Nt=(0,G.useCallback)(async e=>{Et(null);try{await uA.setRendererEngine(e),gt(e)}catch(e){gt(uA.getConfig().rendererEngine),Et(e instanceof Error?e.message:String(e))}},[]),Pt=Vr({mutationFn:e=>X.config.update.mutate({terminal:e})}),Ft=Vr({mutationFn:e=>X.config.update.mutate({dashboard:{trendPointLimit:e}})}),It=Vr({mutationFn:e=>X.config.update.mutate({git:{diffEagerLineBudget:e}}),onSuccess:async()=>{await Xf.invalidateQueries({queryKey:[`git`]})}});(0,G.useEffect)(()=>{let e=L?.dashboard?.trendPointLimit;typeof e==`number`&&Number.isFinite(e)&&St(e)},[L?.dashboard?.trendPointLimit]),(0,G.useEffect)(()=>{let e=L?.git?.diffEagerLineBudget;typeof e==`number`&&Number.isFinite(e)&&wt(e)},[L?.git?.diffEagerLineBudget]);let U=L?.dashboard?.trendPointLimit??Mit,Lt=L?.git?.diffEagerLineBudget??Nit,Rt=L?.appBaseUrl??``,zt=L?.terminal?.fontFamily??Eit,Bt={fontSize:L?.terminal?.fontSize??Tit,fontFamily:zt,cursorBlink:L?.terminal?.cursorBlink??Dit,cursorStyle:L?.terminal?.cursorStyle??Oit,scrollback:L?.terminal?.scrollback??kit,useTheme:L?.terminal?.useTheme??`app`,lightTheme:L?.terminal?.lightTheme??`default-light`,darkTheme:L?.terminal?.darkTheme??`default-dark`,rendererEngine:L?.terminal?.rendererEngine??Ait,bellSound:L?.terminal?.bellSound??`builtin:Tink`,bellVolume:L?.terminal?.bellVolume??jit},Vt=tt.split(/[,]+/).map(e=>e.trim()).filter(Boolean).join(`, `),Ht=$e===Bt.fontSize&&Vt===Bt.fontFamily&&rt===Bt.cursorBlink&&at===Bt.cursorStyle&&st===Bt.scrollback&&lt===Bt.useTheme&&dt===Bt.lightTheme&&pt===Bt.darkTheme&&ht===Bt.rendererEngine&&_t===Bt.bellSound&&yt===Bt.bellVolume,Ut=xt===U,Wt=Ct===Lt,Gt=c.trim()===Te,Kt=i===($a()||``),qt=o.trim()===Rt,Jt=L?.opsx?.agentInvocationMode??`compose`,Yt=dA.parse(L?.notifications?.sound??`builtin:Blow`),Xt=L?.notifications?.volume??1,Zt=L?.notifications?.systemNotificationsEnabled??!1,Qt=(0,G.useMemo)(()=>vnt.map(e=>({...e,disabled:Ze.isPending})),[Ze.isPending]);(0,G.useEffect)(()=>{GA(e),WA(e)},[e]),(0,G.useEffect)(()=>{if(e!==`system`)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>GA(`system`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]);let $t=()=>{let e=new URL(window.location.href);i?e.searchParams.set(`api`,i):e.searchParams.delete(`api`),window.location.href=e.toString()},[en,tn]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{tn(!1)},[]),en?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading settings...`}):(0,K.jsx)(`div`,{className:`@container-[size] scrollbar-thin scrollbar-track-transparent h-full min-h-0 overflow-y-auto scroll-smooth`,style:{timelineScope:p$(K9)},children:(0,K.jsxs)(`div`,{className:`toc-page-layout min-h-full gap-6 p-4 [--toc-page-sidebar-min:14rem]`,children:[(0,K.jsx)(d$,{items:K9,className:`toc-page-sidebar [--toc-sticky-top:16px]`}),(0,K.jsxs)(`div`,{className:`toc-page-content min-w-0 space-y-8`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(Fm,{className:`h-6 w-6 shrink-0`}),`Settings`]}),(0,K.jsxs)(m$,{id:`settings-appearance`,index:q9(`settings-appearance`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Appearance`}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`label`,{className:`mb-3 block text-sm font-medium`,children:`Theme`}),(0,K.jsx)(wj,{value:e,onChange:e=>{t(e),Je.mutate(e)},options:Pit}),(0,K.jsxs)(`div`,{className:`border-border/60 mt-4 border-t pt-4`,children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Code Editor Theme`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(W1,{value:n,options:Dt,onValueChange:e=>{r(e),I||Ye.mutate(e)},ariaLabel:`Code Editor Theme`,className:`w-full`,disabled:I||Ye.isPending}),Ye.isPending?(0,K.jsx)(Em,{className:`text-muted-foreground h-4 w-4 animate-spin`}):Ye.isSuccess?(0,K.jsx)(Yp,{className:`h-4 w-4 text-emerald-500`}):null]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Changes apply immediately to all CodeMirror editors.`})]})]})]}),!I&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(m$,{id:`settings-opsx-invocation`,index:q9(`settings-opsx-invocation`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Rm,{className:`h-5 w-5`}),`OPSX Invocation`]}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`label`,{className:`mb-3 block text-sm font-medium`,children:`Agent invocation mode`}),(0,K.jsx)(wj,{value:Jt,onChange:e=>Ze.mutate(e),options:Qt}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Unsupported command actions automatically keep compose mode.`})]})]}),(0,K.jsxs)(m$,{id:`settings-terminal`,index:q9(`settings-terminal`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Bm,{className:`h-5 w-5`}),`Terminal`]}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsx)(yrt,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Use Theme`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(wj,{value:lt,onChange:e=>{ut(e),Mt({useTheme:e})},options:Xk.map(e=>({value:e,disabled:Pt.isPending,label:e===`app`?`App`:e===`system`?`System`:e===`light`?`Light`:`Dark`}))})}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:[(0,K.jsx)(`code`,{children:`app`}),` follows the current openspecui theme. `,(0,K.jsx)(`code`,{children:`system`}),` `,`follows the OS color scheme.`]})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Light Theme`}),(0,K.jsx)(W1,{value:dt,options:Ot,onValueChange:e=>{ft(e),Mt({lightTheme:e})},ariaLabel:`Light Theme`,className:`w-full`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Dark Theme`}),(0,K.jsx)(W1,{value:pt,options:Ot,onValueChange:e=>{mt(e),Mt({darkTheme:e})},ariaLabel:`Dark Theme`,className:`w-full`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Renderer Engine`}),(0,K.jsx)(W1,{value:ht,options:kt,onValueChange:e=>{gt(e),eA(e)?Nt(e):Et(`Invalid renderer engine: ${e}`)},ariaLabel:`Renderer Engine`,className:`w-full`}),Tt?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-red-500`,children:Tt}):(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Switches immediately and remounts current terminal sessions.`}),!At&&(0,K.jsx)(`p`,{className:`mt-2 text-xs text-amber-500`,children:`Current config contains an unsupported renderer value. Select a valid one to fix it.`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Bell Sound`}),(0,K.jsx)(Xnt,{value:_t,defaultValue:`builtin:Tink`,onValueChange:e=>{vt(e),Mt({bellSound:e})},onPreview:e=>void jt.play(e??_t,yt),ariaLabel:`Bell Sound`,previewDisabled:_t===`silent`||yt===0,volume:yt,onVolumeChange:e=>{bt(e),Mt({bellVolume:e})}})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`mb-2 block text-sm font-medium`,children:[`Font Size: `,$e,`px`]}),(0,K.jsx)(`input`,{type:`range`,min:8,max:32,value:$e,onChange:e=>{let t=Number(e.target.value);et(t),Mt({fontSize:t})},className:`accent-primary w-full`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex justify-between text-xs`,children:[(0,K.jsx)(`span`,{children:`8`}),(0,K.jsx)(`span`,{children:`32`})]})]}),(0,K.jsx)(Iit,{value:tt,onChange:e=>{nt(e),Mt({fontFamily:e})},onBlur:()=>Mt({fontFamily:tt})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Cursor Style`}),(0,K.jsx)(wj,{value:at,onChange:e=>{ot(e),Mt({cursorStyle:e})},options:Fit})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`Cursor Blink`}),(0,K.jsx)(LA,{checked:rt,onCheckedChange:e=>{it(e),Mt({cursorBlink:e})},ariaLabel:`Cursor Blink`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`mb-2 block text-sm font-medium`,children:[`Scrollback Lines: `,st.toLocaleString()]}),(0,K.jsx)(`input`,{type:`range`,min:0,max:1e5,step:1e3,value:st,onChange:e=>{let t=Number(e.target.value);ct(t),Mt({scrollback:t})},className:`accent-primary w-full`}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex justify-between text-xs`,children:[(0,K.jsx)(`span`,{children:`0`}),(0,K.jsx)(`span`,{children:`100,000`})]})]}),(0,K.jsx)(`div`,{className:`flex justify-end`,children:(0,K.jsxs)(Cj,{onClick:()=>{Pt.mutate({fontSize:$e,fontFamily:Vt,cursorBlink:rt,cursorStyle:at,scrollback:st,useTheme:lt,lightTheme:dt,darkTheme:pt,rendererEngine:At?ht:void 0,bellSound:_t,bellVolume:yt})},disabled:Pt.isPending||!At,activity:Ht&&At,children:[Pt.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):Ht?(0,K.jsx)(Yp,{className:`h-4 w-4`}):null,Pt.isPending?`Saving...`:Ht?`Saved`:`Save`]})})]})]}),(0,K.jsx)(m$,{id:`settings-notifications`,index:q9(`settings-notifications`),className:`space-y-4`,children:(0,K.jsx)(Znt,{sound:Yt,volume:Xt,systemNotificationsEnabled:Zt})}),(0,K.jsx)(lit,{index:q9(`settings-translation`)}),(0,K.jsxs)(m$,{id:`settings-dashboard`,index:q9(`settings-dashboard`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(Sm,{className:`h-5 w-5`}),`Dashboard`]}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Trend Point Limit`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Max data points kept per top metric card trend (server-shared in-memory history).`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`number`,min:20,max:500,step:10,value:xt,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&St(t)},className:`bg-background border-border text-foreground focus:ring-primary w-36 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(Cj,{onClick:()=>{let e=Math.max(20,Math.min(500,Math.trunc(xt||100)));St(e),Ft.mutate(e)},disabled:Ft.isPending,activity:Ut,children:Ft.isPending?`Saving...`:Ut?`Saved`:`Save`})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`Allowed range: 20-500. Lower values reduce memory and increase visual smoothing.`})]})})]}),(0,K.jsxs)(m$,{id:`settings-git-detail`,index:q9(`settings-git-detail`),className:`space-y-4`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,K.jsx)(_m,{className:`h-5 w-5`}),`Git Detail`]}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Eager Patch Line Budget`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Server-side line budget for the initial Git detail payload. Files are included as a prefix, and the file that crosses the budget still ships eagerly.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`number`,min:0,max:2e5,step:100,value:Ct,onChange:e=>{let t=Number(e.target.value);Number.isFinite(t)&&wt(t)},className:`bg-background border-border text-foreground focus:ring-primary w-40 rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-1`}),(0,K.jsx)(Cj,{onClick:()=>{let e=Math.max(0,Math.min(2e5,Math.trunc(Ct||0)));wt(e),It.mutate(e)},disabled:It.isPending,activity:Wt,children:It.isPending?`Saving...`:Wt?`Saved`:`Save`})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:"Set to `0` to force fully lazy patch loading. Default is `1000`."})]})})]}),(0,K.jsxs)(m$,{id:`settings-project-directory`,index:q9(`settings-project-directory`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Project Directory`}),(0,K.jsx)(`div`,{className:`border-border rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(pm,{className:`text-muted-foreground mt-1 h-4 w-4 shrink-0`}),ee.projectDir?(0,K.jsx)(Hnt,{path:ee.projectDir,className:`flex-1`}):(0,K.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Loading...`})]})})]}),(0,K.jsxs)(m$,{id:`settings-cli-configuration`,index:q9(`settings-cli-configuration`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`CLI Configuration`}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Global CLI Detection`}),(0,K.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:z?(0,K.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Detecting global openspec command...`]}):R?.hasGlobal?(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Global CLI installed:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`openspec `,R.version]})]}),R.hasUpdate&&R.latestVersion&&(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-amber-600`,children:[(0,K.jsx)(qp,{className:`h-4 w-4`}),`Update available:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`v`,R.latestVersion]})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm text-yellow-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Global CLI not found`]}),R?.latestVersion&&(0,K.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Latest version:`,` `,(0,K.jsxs)(`code`,{className:`bg-muted rounded px-1`,children:[`v`,R.latestVersion]})]})]})}),!z&&(!R?.hasGlobal||R?.hasUpdate)&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:()=>h(!0),className:`bg-primary text-primary-foreground flex items-center gap-2 rounded-md px-3 py-1.5 text-sm hover:opacity-90`,children:R?.hasUpdate?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qp,{className:`h-4 w-4`}),`Update to v`,R.latestVersion]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nm,{className:`h-4 w-4`}),`Install Globally`]})}),(0,K.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Run:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`npm install -g @fission-ai/openspec`})]})]}),R?.error&&(0,K.jsxs)(`p`,{className:`mt-1 text-sm text-red-500`,children:[`Detection error: `,R.error]})]}),(0,K.jsxs)(`div`,{className:`border-border border-t pt-3`,children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Execute Path`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Override the runner command used to execute OpenSpec. Leave empty to auto-resolve.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:De,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2 font-mono text-sm`}),(0,K.jsx)(Cj,{onClick:()=>Ge.mutate(c),disabled:Ge.isPending,activity:Gt,children:Ge.isPending?`Saving...`:Gt?`Saved`:`Save`})]}),L?.cli?.command&&(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:[`Saved execute path:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:G9(L.cli.command,L.cli.args??[])})]})]}),(0,K.jsxs)(`div`,{className:`border-border border-t pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Bm,{className:`text-muted-foreground h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`CLI Status:`}),V?(0,K.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-1 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Checking...`]}):B?.available?(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Available `,B.version&&`(${B.version})`]}):(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-sm text-red-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Not available`]})]}),re&&(0,K.jsxs)(`p`,{className:`text-muted-foreground ml-6 mt-1 text-sm`,children:[`Effective execute path:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:re})]}),B&&!B.available&&B.error&&(0,K.jsxs)(`p`,{className:`text-muted-foreground ml-6 mt-1 text-sm`,children:[B.error,(0,K.jsx)(`br`,{}),`Set an explicit execute path above to recover quickly.`]})]})]})]}),(0,K.jsxs)(m$,{id:`settings-openspec-profile`,index:q9(`settings-openspec-profile`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`OpenSpec Profile & Sync`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:ue?(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}),`Loading profile state...`]}):le?.available?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Profile`}),(0,K.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:le.profile})]}),(0,K.jsxs)(`div`,{className:`border-border bg-muted/30 rounded-md border px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Delivery`}),(0,K.jsx)(`div`,{className:`mt-1 text-sm font-medium`,children:le.delivery})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-muted-foreground mb-1 text-xs`,children:`Workflows`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:le.workflows.length>0?le.workflows.map(e=>(0,K.jsx)(`span`,{className:`border-border bg-muted rounded border px-1.5 py-0.5 text-xs`,children:e},e)):(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`(none)`})})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-wrap items-center gap-2 border-t pt-3`,children:[le.driftStatus===`drift`?(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm text-amber-600`,children:[(0,K.jsx)(Hm,{className:`h-4 w-4`}),`Global profile is not fully applied to this project.`]}):le.driftStatus===`in-sync`?(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),`Project files are in sync with global profile.`]}):(0,K.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Drift status unavailable.`}),le.warningText&&(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:le.warningText})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-wrap items-center gap-2 border-t pt-3`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>Ke.mutate(),disabled:Ke.isPending,className:`bg-primary text-primary-foreground inline-flex items-center gap-2 rounded-md px-3 py-1.5 text-sm disabled:opacity-50`,children:[Ke.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Am,{className:`h-4 w-4`}),`Run openspec update`]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>qe.mutate(),disabled:qe.isPending,className:`border-border hover:bg-muted inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm disabled:opacity-50`,children:[qe.isPending?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):(0,K.jsx)(Yp,{className:`h-4 w-4`}),`Set profile to core`]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void H(),className:`border-border hover:bg-muted inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-sm`,children:[(0,K.jsx)(Am,{className:`h-4 w-4`}),`Refresh state`]})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Note: `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec update`}),` follows OpenSpec CLI profile behavior and prunes deselected workflow command/skill files.`]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`For interactive custom profile editing, run`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec config profile`}),` in a local terminal.`]})]}):(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600`,children:[(0,K.jsx)(em,{className:`h-4 w-4`}),`Unable to read profile state from OpenSpec CLI.`]}),le?.error&&(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:le.error})]})})]}),(0,K.jsxs)(m$,{id:`settings-api-configuration`,index:q9(`settings-api-configuration`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`API Configuration`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`API Server URL`}),(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`Leave empty for same-origin requests. Set a custom URL to connect to a different server.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:window.location.origin,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2`}),(0,K.jsx)(Cj,{onClick:$t,activity:Kt,children:Kt?`Applied`:`Apply`})]}),$a()&&(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:[`Current: `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:$a()})]})]})})]}),(0,K.jsxs)(m$,{id:`settings-hosted-app`,index:q9(`settings-hosted-app`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Hosted App`}),(0,K.jsx)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,children:`Base URL`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:[`Used by `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspecui --app`}),` when no explicit base URL is passed. Leave empty to use the official app shell. Reusing an installed PWA only works when that PWA was installed from this same shell origin.`]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`https://app.openspecui.com`,className:`border-border bg-background text-foreground flex-1 rounded-md border px-3 py-2`}),(0,K.jsx)(Cj,{onClick:()=>Xe.mutate(o),disabled:Xe.isPending,activity:qt,children:Xe.isPending?`Saving...`:qt?`Saved`:`Save`})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:[`Effective default:`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:Rt||`https://app.openspecui.com`})]})]})})]}),(0,K.jsxs)(m$,{id:`settings-file-watcher`,index:q9(`settings-file-watcher`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`File Watcher`}),(0,K.jsxs)(`div`,{className:`border-border rounded-lg border p-4`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground mb-3 text-sm`,children:`File watcher is configured on the server side. Check the status bar at the bottom of the page to see if file watching is enabled.`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Cm,{className:`h-4 w-4 text-green-500`}),(0,K.jsx)(`span`,{children:`Enabled: Real-time updates when files change`})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-sm`,children:[(0,K.jsx)(Um,{className:`h-4 w-4 text-yellow-500`}),(0,K.jsx)(`span`,{children:`Disabled: Manual refresh required`})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground mt-3 text-sm`,children:[`To disable file watching, restart the server with`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`--no-watch`}),` flag.`]})]})]}),(0,K.jsxs)(m$,{id:`settings-init-openspec`,index:q9(`settings-init-openspec`),className:`space-y-4`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Initialize OpenSpec`}),(0,K.jsxs)(`div`,{className:`border-border space-y-4 rounded-lg border p-4`,children:[(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Create the OpenSpec directory structure in the current project. This will create`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec/`}),` with specs, changes, and archive directories.`]}),(0,K.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Init Mode`}),(0,K.jsx)(W1,{value:g,options:Cit,onValueChange:_,ariaLabel:`Init Mode`,className:`w-full`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`OpenSpec CLI can auto-detect existing tool directories. OpenSpecUI 4.x uses OpenSpec CLI 1.4.x as the current tool line.`})]}),(0,K.jsxs)(`label`,{className:`space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:`Profile Override`}),(0,K.jsx)(W1,{value:v,options:wit,onValueChange:y,ariaLabel:`Profile Override`,className:`w-full`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Adds `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`--profile`}),` when set.`]})]})]}),(0,K.jsxs)(`div`,{className:`space-y-4 ${Be?``:`opacity-60`}`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`AI Tools Configuration`}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Color encodes current init state. Hover a tool for the exact status.`})]}),(0,K.jsx)(`button`,{onClick:Fe,disabled:!Be,className:`text-primary shrink-0 text-xs hover:underline disabled:cursor-not-allowed disabled:opacity-50`,children:we.length>0&&we.length===Ce.length?`Deselect All`:`Select All`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-muted-foreground mb-2 text-xs font-medium`,children:`Natively supported providers (OpenSpec custom commands + skills)`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,children:me.map(e=>{let t=j9(ye,e.value),n=t===`initialized`,r=t===`partial`,i=we.includes(e.value),a=ye.get(e.value)?.legacyCommandWorkflows??[],o=n?a.length>0?`Initialized: legacy-compatible command paths detected for ${a.join(`, `)}`:`Initialized: exact match for current delivery/workflows`:r?`Partial: detected artifacts need repair for current delivery/workflows`:`Uninitialized: no generated artifacts detected`;return(0,K.jsxs)(`button`,{onClick:()=>Pe(e.value),disabled:n||!Be,title:o,className:`flex min-w-0 items-center gap-1.5 rounded border px-2.5 py-1.5 text-left text-xs font-medium transition-colors ${n?`cursor-not-allowed border-emerald-500/50 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:r?`text-foreground border-amber-500/50 bg-amber-500/10 hover:bg-amber-500/15`:i?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted`}`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,K.jsx)($p,{className:`h-3 w-3 shrink-0 text-emerald-600 dark:text-emerald-300`}):r?(0,K.jsx)(Hm,{className:`h-3 w-3 shrink-0 text-amber-600 dark:text-amber-300`}):i?(0,K.jsx)(Yp,{className:`h-3 w-3 shrink-0`}):null]},e.value)})})]}),(0,K.jsxs)(`div`,{className:`text-muted-foreground flex flex-wrap gap-4 text-xs`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-500/50`}),ke,` initialized`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-500/50`}),Ae,` repair needed`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`bg-primary/50 h-2 w-2 rounded-full`}),we.length,` selected`]})]})]}),(0,K.jsxs)(`div`,{className:`border-border flex flex-row flex-wrap gap-2.5 border-t pt-3 md:flex-nowrap`,children:[(0,K.jsxs)(`button`,{onClick:()=>je(g),disabled:He.disabled,title:He.title,className:`bg-primary text-primary-foreground inline-flex grow-0 items-start justify-start gap-2 self-start rounded-md px-3.5 py-2 text-[13px] font-medium leading-5 hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50 md:min-w-0 md:max-w-none md:text-balance`,children:[(0,K.jsx)(mm,{className:`mt-1 h-4 w-4 shrink-0`}),He.label]}),(0,K.jsxs)(`label`,{className:`border-border bg-background/50 flex min-w-0 flex-col gap-1 rounded-md border px-3 py-2`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`break-word text-xs font-medium leading-4`,children:`Force non-interactive init`}),(0,K.jsx)(LA,{checked:b,onCheckedChange:x,ariaLabel:`Force non-interactive init`})]}),(0,K.jsxs)(`span`,{className:`text-muted-foreground text-[11px] leading-4`,children:[`Enabled by default so`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec init --tools ...`}),` `,`also writes`,` `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspec/config.yaml`}),`.`]})]})]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:He.helperText})]})]})]}),!I&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(xA,{open:f,onClose:Ue,bodyClassName:`max-h-[70vh]`,borderVariant:k,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Bm,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:`Initialize OpenSpec`})]}),footer:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:Ue,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:T===`running`,children:`Close`}),T!==`success`&&(0,K.jsx)(`button`,{onClick:()=>E.runAll(),className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:T===`running`||g===`selected`&&!ze,children:T===`running`?(0,K.jsx)(Em,{className:`h-4 w-4 animate-spin`}):`Run init`})]}),children:(0,K.jsx)(IA,{lines:w})}),(0,K.jsxs)(xA,{open:m,onClose:We,bodyClassName:`max-h-[70vh]`,borderVariant:F,title:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(nm,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:R?.hasUpdate?`Update OpenSpec CLI`:`Install OpenSpec CLI Globally`})]}),footer:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`button`,{onClick:We,className:`bg-muted hover:bg-muted/80 rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:j===`running`,children:`Close`}),(0,K.jsx)(`button`,{onClick:()=>{We(),Ee()},className:`bg-primary text-primary-foreground rounded-md px-4 py-2 disabled:cursor-not-allowed disabled:opacity-50`,disabled:j!==`success`,children:`Re-detect CLI`})]}),children:[(0,K.jsx)(IA,{lines:A}),j===`success`&&(0,K.jsxs)(`div`,{className:`border-border bg-muted/40 mt-3 rounded border px-3 py-2 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-green-600`,children:[(0,K.jsx)($p,{className:`h-4 w-4`}),R?.hasUpdate?`OpenSpec CLI updated to v${R?.latestVersion??``}`:`OpenSpec CLI installed globally`]}),(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`You can now run the "openspec" command directly. Click "Re-detect CLI" to refresh status.`})]})]})]})]})]})})}function Rit(){let{data:e,isLoading:t}=sce();return t&&!e?(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading specs...`}):(0,K.jsxs)(`div`,{className:`space-y-6 p-4`,children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{className:`h-6 w-6 shrink-0`}),`Specifications`]}),(0,K.jsxs)(`div`,{className:`border-border divide-border divide-y rounded-lg border`,children:[e?.map(e=>{let t={family:`specs`,entityId:e.id};return(0,K.jsxs)(Lp,{to:`/specs/$specId`,params:{specId:e.id},state:t=>({...t,__vtHandoff:{family:`specs`,entityId:e.id,title:e.name,subtitle:e.id}}),vt:{sharedElements:t},...kp(t,`container`),className:`hover:bg-muted/50 flex items-center justify-between p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(sm,{...kp(t,`icon`),className:`text-muted-foreground h-5 w-5`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{...kp(t,`title`),className:`font-medium`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-muted-foreground text-sm`,children:[e.id,e.updatedAt>0&&(0,K.jsxs)(K.Fragment,{children:[` · `,qA(e.updatedAt)]})]})]})]}),(0,K.jsx)(Zp,{className:`text-muted-foreground h-4 w-4`})]},e.id)}),e?.length===0&&(0,K.jsxs)(`div`,{className:`text-muted-foreground p-4 text-center`,children:[`No specs found. Create a spec in `,(0,K.jsx)(`code`,{children:`openspec/specs/`})]})]})]})}function zit(){let{specId:e}=va({from:`/specs/$specId`}),t=Mp(Va().state),n=(0,G.useMemo)(()=>({family:`specs`,entityId:e}),[e]),{data:r,isLoading:i}=cce(e),{data:a,isLoading:o}=lce(e),{data:s}=op(),{data:c}=sp(),l=(0,G.useMemo)(()=>eY(s?.translation,c),[s?.translation,c]);return i&&!r||o&&!a?t?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(Lp,{to:`/specs`,vt:{sharedElements:n},className:`hover:bg-muted rounded-md p-2`,children:(0,K.jsx)(Wp,{className:`h-5 w-5`})}),(0,K.jsxs)(`div`,{...kp(n,`container`),children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{...kp(n,`icon`),className:`h-6 w-6 shrink-0`}),(0,K.jsx)(`span`,{...kp(n,`title`),children:t.title??e})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`ID: `,t.subtitle??e]})]})]}),(0,K.jsx)(`div`,{className:`vt-detail-content route-loading animate-pulse rounded-lg border p-4`,children:`Loading spec...`})]}):(0,K.jsx)(`div`,{className:`route-loading animate-pulse`,children:`Loading spec...`}):r?(0,K.jsx)(Bit,{spec:r,rawMarkdown:a??``,validation:null,translationConfig:l}):(0,K.jsx)(`div`,{className:`text-red-600`,children:`Spec not found`})}function Bit({spec:e,rawMarkdown:t,validation:n,translationConfig:r}){let i=(0,G.useRef)(null),a=(0,G.useMemo)(()=>({family:`specs`,entityId:e.id}),[e.id]);return(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,K.jsx)(Lp,{to:`/specs`,vt:{source:i,sharedElements:a},className:`hover:bg-muted rounded-md p-2`,children:(0,K.jsx)(Wp,{className:`h-5 w-5`})}),(0,K.jsxs)(`div`,{ref:i,...kp(a,`container`),children:[(0,K.jsxs)(`h1`,{className:`font-nav flex items-center gap-2 text-2xl font-bold`,children:[(0,K.jsx)(sm,{...kp(a,`icon`),className:`h-6 w-6 shrink-0`}),(0,K.jsx)(`span`,{...kp(a,`title`),children:e.name})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`ID: `,e.id]})]})]}),n&&(0,K.jsx)(Vit,{validation:n}),(0,K.jsx)(v$,{markdown:t,path:`specs/${e.id}/spec.md`,className:`vt-detail-content min-h-0 flex-1`,translationConfig:r})]})}function Vit({validation:e}){let t=e.issues.filter(e=>e.severity===`ERROR`),n=e.issues.filter(e=>e.severity===`WARNING`),r=e.issues.filter(e=>e.severity===`INFO`);return(0,K.jsxs)(`div`,{className:`flex rounded-lg border p-4 ${e.valid?`border-green-500 bg-green-500/10`:`border-red-500 bg-red-500/10`}`,children:[(0,K.jsxs)(`div`,{className:`align-content flex gap-2`,children:[e.valid?(0,K.jsx)($p,{className:`h-5 w-5 text-green-500`}):(0,K.jsx)(Qp,{className:`h-5 w-5 text-red-500`}),(0,K.jsx)(`span`,{className:`font-medium ${e.valid?`text-green-600`:`text-red-600`}`,children:e.valid?`Validation Passed`:`Validation Failed`})]}),e.issues.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[t.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-red-600`,children:[(0,K.jsx)(Qp,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t)),n.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-yellow-600`,children:[(0,K.jsx)(Hm,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t)),r.map((e,t)=>(0,K.jsxs)(`div`,{className:`text-muted-foreground flex items-start gap-2`,children:[(0,K.jsx)(ym,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:e.message})]},t))]})]})}var J9=`border-terminal-foreground/20`,Y9=`ease-[cubic-bezier(0.22,0.61,0.36,1)]`;function Hit({tabs:e,selectedTab:t,onTabChange:n,onTabClose:r,onTabOrderChange:i,actions:a,onTabBarDoubleClick:o,className:s}){return(0,K.jsx)(bj,{tabs:e,selectedTab:t,onTabChange:n,onTabClose:r,onTabOrderChange:i,onTabBarDoubleClick:o,actions:a,className:s,showHeaderShell:!1,showSelectionIndicator:!0,decorateStrip:!1,selectionIndicatorLayout:`overlay`,classNames:{header:`bg-terminal text-terminal-foreground`,headerForeground:`z-auto flex-1`,headerFrame:`items-end`,strip:`min-w-0 flex-1 items-end border-b ${J9} px-4 rounded-none`,list:`flex-1 items-end overflow-y-hidden pt-2 [&::scroll-button(*)]:mt-3`,buttonBase:`z-20 w-[clamp(8.5rem,18vw,13rem)] rounded-t-[8px] border border-b-0 border-transparent px-0 py-0 transition-[color,background-color,border-color] duration-180 ${Y9}`,buttonInner:`grid h-full min-w-0 w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded-t-[8px] px-3 py-1.5 transition-[color,background-color,transform,filter] duration-180 ${Y9} will-change-transform`,activeButton:`bg-transparent text-terminal-foreground`,activeButtonInner:`bg-transparent text-terminal-foreground [transform:translateY(0)]`,inactiveButton:`bg-transparent text-terminal-foreground/72 hover:border-[color-mix(in_oklab,var(--background)_10%,transparent)] hover:text-terminal-foreground`,inactiveButtonInner:`bg-terminal [filter:brightness(0.9)] [transform:translateY(0.25em)] hover:text-terminal-foreground hover:[filter:brightness(0.96)] hover:[transform:translateY(0.125em)]`,actions:`${J9} bg-terminal text-terminal-foreground border-b rounded-none px-1`,selectionIndicatorViewport:`inset-x-0 top-0 bottom-[-1px] overflow-visible overflow-x-hidden`,closeButtonActive:`text-terminal-foreground/70 hover:text-terminal-foreground`,closeButtonInactive:`text-terminal-foreground/50 hover:text-terminal-foreground`,selectionIndicator:`${J9} border-x border-t border-b-0 bg-terminal rounded-t-[8px] shadow-[0_1px_0_var(--terminal)] duration-180 ${Y9}`}})}var Uit=8;function Wit(e,t){for(let n=0;n<e.length;n+=1){let r=e.item?.(n)??e[n];if(r?.identifier===t)return r}return null}function Git(e){return e.item?.(0)??e[0]??null}function Kit(e,t){let n=t.clientX-e.startX,r=t.clientY-e.startY;return Math.sqrt(n*n+r*r)>Uit}function qit(e,t){if(!(t instanceof Node)||!e.contains(t)||t instanceof Element&&t.closest(`input-panel`))return!1;let n=e.querySelector(`.xterm`)??e.querySelector(`.xterm-screen`);return n?t===e||n.contains(t):!0}function X9(e,t,n){let r=document.elementFromPoint(t,n);return r&&e.contains(r)&&!r.classList.contains(`terminal-touch-mouse-overlay`)?r:e.querySelector(`.xterm-screen`)??e}function Z9(e,t,n,r){let i=e.ownerDocument.defaultView??window;e.dispatchEvent(new i.MouseEvent(t,{bubbles:!0,cancelable:!0,clientX:n.clientX,clientY:n.clientY,button:0,buttons:r.buttons,detail:r.detail??1}))}function Jit({sessionId:e}){let t=(0,G.useRef)(null),n=(0,G.useRef)(null),r=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{let e=t.current?.parentElement;if(!e)return;let i=e=>{e.preventDefault(),e.stopPropagation()},a=t=>{if(t.touches.length!==1||!qit(e,t.target))return;i(t);let a=Git(t.touches);a&&(n.current={identifier:a.identifier,startX:a.clientX,startY:a.clientY},r.current=!1,Z9(X9(e,a.clientX,a.clientY),`mousedown`,a,{buttons:1}))},o=t=>{let a=n.current;if(!a)return;i(t);let o=Wit(t.touches,a.identifier);o&&(Kit(a,o)&&(r.current=!0),Z9(X9(e,o.clientX,o.clientY),`mousemove`,o,{buttons:1}))},s=(t,a)=>{let o=n.current;if(!o)return;i(t);let s=Wit(t.changedTouches,o.identifier);if(!s)return;let c=X9(e,s.clientX,s.clientY);Z9(c,`mouseup`,s,{buttons:0}),a&&!r.current&&Z9(c,`click`,s,{buttons:0}),n.current=null,r.current=!1},c=e=>s(e,!0),l=e=>s(e,!1);return e.addEventListener(`touchstart`,a,{capture:!0,passive:!1}),e.addEventListener(`touchmove`,o,{capture:!0,passive:!1}),e.addEventListener(`touchend`,c,{capture:!0,passive:!1}),e.addEventListener(`touchcancel`,l,{capture:!0,passive:!1}),()=>{e.removeEventListener(`touchstart`,a,{capture:!0}),e.removeEventListener(`touchmove`,o,{capture:!0}),e.removeEventListener(`touchend`,c,{capture:!0}),e.removeEventListener(`touchcancel`,l,{capture:!0})}},[]),(0,K.jsx)(`div`,{ref:t,"data-testid":`terminal-touch-mouse-overlay-${e}`,className:`terminal-touch-mouse-overlay absolute inset-0 z-20 bg-transparent`,"aria-hidden":`true`})}function Yit({sessionId:e}){let t=(0,G.useRef)(null);return(0,G.useEffect)(()=>{let n=t.current;if(n)return uA.mount(e,n),()=>{uA.unmount(e)}},[e]),(0,K.jsx)(`div`,{ref:t,className:`relative h-full w-full`,style:{minHeight:0},onPointerDown:()=>uA.focusSession(e),children:(0,K.jsx)(Jit,{sessionId:e})})}function Xit({session:e,onRename:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(``),o=(0,G.useRef)(null),s=(0,G.useCallback)(()=>{a(``),r(!0),requestAnimationFrame(()=>o.current?.focus())},[]),c=(0,G.useCallback)(()=>{r(!1);let n=i.trim();n&&t(e.id,n)},[i,e.id,t]),l=(0,G.useCallback)(()=>{r(!1)},[]),u=(0,K.jsxs)(`span`,{className:`relative inline-flex h-3 w-3 shrink-0 items-center justify-center`,children:[e.lastBellAt!==null&&(0,K.jsx)(`span`,{"data-testid":`terminal-bell-ripple-${e.id}`,className:`animate-terminal-bell-ripple bg-primary/45 absolute h-2 w-2 rounded-full`},e.lastBellAt),(0,K.jsx)(`span`,{className:[`relative inline-block h-2 w-2 rounded-full`,e.isExited?e.exitCode===0?`bg-emerald-500`:`bg-red-500`:e.outputActive?`animate-terminal-breathing`:`bg-zinc-400`].join(` `)})]});return n?(0,K.jsxs)(`span`,{className:`grid min-w-0 grid-cols-[0.75rem_minmax(0,1fr)] items-center gap-1.5`,children:[u,(0,K.jsx)(`input`,{ref:o,value:i,placeholder:e.displayTitle,onChange:e=>a(e.target.value),onBlur:c,onKeyDown:e=>{e.key===`Enter`&&c(),e.key===`Escape`&&l(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:`placeholder:text-muted-foreground min-w-0 border-b border-current bg-transparent text-sm text-inherit outline-none`})]}):(0,K.jsxs)(`span`,{className:`grid min-w-0 grid-cols-[0.75rem_minmax(0,1fr)] items-center gap-1.5`,onDoubleClick:s,children:[u,(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.displayTitle})]})}function Zit({unreadCount:e}){if(e<=0)return null;let t=`${e} unread notification${e===1?``:`s`}`;return e===1?(0,K.jsx)(ob,{size:`dot`,className:`-mr-0.5 -mt-0.5 ring-1 ring-[var(--terminal)]`,title:t,"aria-label":t}):(0,K.jsx)(sb,{count:e,className:`ring-1 ring-[var(--terminal)]`,title:t,"aria-label":t})}var Qit=2e3;function $it({className:e}){let{sessions:t,activeSessionId:n,setActiveSession:r,createShellSession:i,closeSession:a,setCustomTitle:o}=K1(),{notifications:s,clearTerminalSession:c}=gA(),{shellProfiles:l,spawnCommands:u,defaultShellProfile:d}=x2(),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),g=(0,G.useRef)(null),_=ko(),v=_.bottomTabs.includes(`/terminal`),y=_.mainLocation.pathname===`/terminal`||_.mainLocation.pathname.startsWith(`/terminal/`)||_.bottomLocation.pathname===`/terminal`||_.bottomLocation.pathname.startsWith(`/terminal/`),b=(0,G.useMemo)(()=>{let e=uA.getResolvedTheme();return{"--terminal":e.definition.palette.background,"--terminal-foreground":e.definition.palette.foreground}},[(0,G.useSyncExternalStore)(e=>uA.subscribe(e),()=>uA.getSnapshot(),()=>uA.getSnapshot())]);(0,G.useEffect)(()=>(g.current&&uA.setInputPanelMountTarget(g.current),()=>{uA.setInputPanelMountTarget(null)}),[]);let x=(0,G.useCallback)((e,t)=>{o(e,t)},[o]),S=(0,G.useMemo)(()=>{let e=new Map;for(let t of s)t.source.type===`terminal`&&e.set(t.source.sessionId,(e.get(t.source.sessionId)??0)+1);return e},[s]);(0,G.useEffect)(()=>{if(!y)return;let e=t.find(e=>e.id===n)?.serverSessionId;if(!e||!s.some(t=>t.source.type===`terminal`&&t.source.sessionId===e))return;let r=window.setTimeout(()=>{c(e)},Qit);return()=>window.clearTimeout(r)},[n,c,y,s,t]);let C=(0,G.useMemo)(()=>{let e=new Map;for(let n of t)e.set(n.id,(0,K.jsx)(`div`,{className:`bg-terminal h-full`,children:(0,K.jsx)(Yit,{sessionId:n.id})}));return e},[t]),w=(0,G.useMemo)(()=>t.map(e=>{let t=e.serverSessionId?S.get(e.serverSessionId)??0:0;return{id:e.id,title:e.displayTitle,label:(0,K.jsx)(Xit,{session:e,onRename:x}),badge:t>0?(0,K.jsx)(Zit,{unreadCount:t}):void 0,unmountOnHide:!0,closable:!0,closeButtonVisibility:`always`,content:C.get(e.id)}}),[t,x,C,S]);(0,G.useLayoutEffect)(()=>{uA.setInputPanelDefaultLayout(v?`floating`:`fixed`)},[v]);let T=(0,G.useCallback)(()=>{Oo.moveTab(`/terminal`,v?`main`:`bottom`)},[v]),E=(0,G.useCallback)(()=>{v&&Oo.closeTab(`/terminal`)},[v]),D=(0,G.useCallback)(()=>{uA.openInputPanel(n??void 0)},[n]),O=(0,G.useCallback)(e=>{r(e);let n=t.find(t=>t.id===e);n?.serverSessionId&&c(n.serverSessionId)},[c,t,r]),k=(0,G.useCallback)(()=>{i(d)},[i,d]),A=(0,G.useCallback)(e=>{e.preventDefault();let t=e.currentTarget;p(e=>e?.type===`target`&&e.element===t?null:{type:`target`,element:t,placement:`bottom-end`})},[]),j=(0,G.useMemo)(()=>{let e=l.map(e=>({id:`shell:${e.id}`,label:e.label,icon:(0,K.jsx)(Bm,{className:`h-3.5 w-3.5`}),onSelect:()=>{i(e),p(null)}})),t=u.map(e=>({id:`command:${e.id}`,label:e.label,icon:(0,K.jsx)(jm,{className:`h-3.5 w-3.5`}),onSelect:()=>{h(e),p(null)}}));return[...e,...e.length>0&&t.length>0?[{id:`separator`,label:``,disabled:!0,onSelect:()=>{}}]:[],...t]},[i,l,u]),M=(0,K.jsx)(`button`,{type:`button`,onClick:k,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,"aria-label":`New terminal`,title:`New terminal`,children:(0,K.jsx)(km,{className:`h-3.5 w-3.5`})}),N=(0,K.jsx)(`button`,{type:`button`,onClick:A,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,"aria-label":`New terminal options`,title:`New terminal options`,children:(0,K.jsx)(Xp,{className:`h-3.5 w-3.5`})}),P=(0,K.jsxs)(`div`,{className:`ml-auto flex items-center`,children:[M,N,(0,K.jsx)(`button`,{type:`button`,onClick:D,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:`Open InputPanel`,children:(0,K.jsx)(_le,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(`button`,{type:`button`,onClick:T,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:v?`Move to main area`:`Move to bottom area`,children:v?(0,K.jsx)(Ele,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Cle,{className:`h-3.5 w-3.5`})}),v&&(0,K.jsx)(`button`,{type:`button`,onClick:E,className:`text-terminal-foreground/72 hover:bg-terminal-foreground/10 hover:text-terminal-foreground shrink-0 rounded-md p-1.5 transition`,title:`Close panel`,children:(0,K.jsx)(Wm,{className:`h-3.5 w-3.5`})})]});return(0,K.jsxs)(`div`,{ref:g,style:b,className:`bg-background flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden ${e}`,children:[t.length===0?(0,K.jsxs)(`div`,{className:`text-terminal-foreground bg-terminal flex h-full flex-wrap content-center items-center justify-center whitespace-pre p-4 text-sm`,children:[(0,K.jsx)(`span`,{children:`No terminal sessions. Click`}),(0,K.jsxs)(`span`,{className:`mx-2 flex gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:k,className:`bg-primary text-primary-foreground px-2 text-lg font-bold`,"aria-label":`New terminal`,children:`+`}),N]}),(0,K.jsx)(`span`,{children:`to create one.`})]}):(0,K.jsx)(Hit,{tabs:w,selectedTab:n??void 0,onTabChange:O,onTabClose:a,onTabBarDoubleClick:k,actions:P}),(0,K.jsx)(DW,{open:f!==null,anchor:f,items:j,wrapperElement:g.current,onClose:()=>p(null)}),(0,K.jsx)(lnt,{open:m!==null,command:m,onClose:()=>h(null)})]})}function eat(){return(0,K.jsx)($it,{className:`h-full min-w-0 overflow-hidden`})}function Q9(e,t){let n=[Oa({getParentRoute:()=>e,path:`/`,component:()=>null}),Oa({getParentRoute:()=>e,path:`/dashboard`,component:FZe}),Oa({getParentRoute:()=>e,path:`/config`,component:cZe}),Oa({getParentRoute:()=>e,path:`/git`,component:zZe}),Oa({getParentRoute:()=>e,path:`/git/uncommitted`,component:yQe}),Oa({getParentRoute:()=>e,path:`/git/commit/$hash`,component:bQe}),Oa({getParentRoute:()=>e,path:`/specs`,component:Rit}),Oa({getParentRoute:()=>e,path:`/specs/$specId`,component:zit}),Oa({getParentRoute:()=>e,path:`/changes`,component:wYe}),Oa({getParentRoute:()=>e,path:`/changes/$changeId`,component:AYe}),Oa({getParentRoute:()=>e,path:`/archive`,component:CEe}),Oa({getParentRoute:()=>e,path:`/archive/$changeId`,component:SYe}),Oa({getParentRoute:()=>e,path:`/settings`,component:Lit})];return t?.includeTerminal!==!1&&n.push(Oa({getParentRoute:()=>e,path:`/terminal`,component:eat})),e.addChildren(n)}function tat(e){return e.addChildren([Oa({getParentRoute:()=>e,path:`/`,component:()=>null}),Oa({getParentRoute:()=>e,path:`/search`,component:Vnt}),Oa({getParentRoute:()=>e,path:`/notifications`,component:TQe}),Oa({getParentRoute:()=>e,path:`/opsx-new`,component:Ant}),Oa({getParentRoute:()=>e,path:`/opsx-propose`,component:jnt}),Oa({getParentRoute:()=>e,path:`/opsx-verify`,component:Mnt}),Oa({getParentRoute:()=>e,path:`/opsx-compose`,component:knt})])}function nat(){return(0,G.useEffect)(()=>{Tp()},[]),null}var rat=qa(),iat=ka({component:bEe,pendingComponent:()=>(0,K.jsx)(`div`,{className:`route-loading text-muted-foreground animate-pulse p-6 text-center text-sm`,children:`Loading...`})}),$9=Ya(),aat=za(rat?{routeTree:Q9(iat),basepath:$9}:{routeTree:Q9(iat),history:KA(`main`,Oo),basepath:$9});rat||vEe(za({routeTree:Q9(ka({component:_Ee})),history:KA(`bottom`,Oo),basepath:$9})),BTe(za({routeTree:tat(ka({component:RTe})),history:KA(`pop`,Oo),basepath:$9}));function oat(){return(0,K.jsx)(Pee,{client:Xf,children:(0,K.jsx)(JTe,{children:(0,K.jsx)(QXe,{children:(0,K.jsxs)(PTe,{children:[(0,K.jsx)(nat,{}),(0,K.jsx)(xEe,{}),(0,K.jsx)(Ba,{router:aat})]})})})})}function sat(){return(0,K.jsx)(`main`,{className:`bg-background text-foreground flex min-h-screen items-center justify-center p-6`,children:(0,K.jsxs)(`section`,{className:`bg-card flex w-full max-w-lg flex-col gap-3 border p-6`,children:[(0,K.jsx)(`h1`,{className:`font-nav text-sm uppercase tracking-[0.14em]`,children:`Hosted Session Not Connected`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-sm leading-6`,children:[`This embedded UI session needs explicit `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`api`}),` `,`and `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`session`}),` query parameters from the app shell. Open it through `,(0,K.jsx)(`code`,{className:`bg-muted rounded px-1`,children:`openspecui --app`}),` `,`instead of loading the backend page directly.`]})]})})}var cat=()=>{let e=document.getElementById(`root`);return e&&e.innerHTML.trim().length>0},lat=()=>typeof window<`u`&&window.__OPENSPEC_STATIC_MODE__===!0;async function uat(){let e=document.getElementById(`root`),t=Qa();if(t.hosted&&!t.apiBaseUrl){(0,Ha.createRoot)(e).render((0,K.jsx)(sat,{}));return}let n=lat()||await One();kne(n),n&&console.log(`[OpenSpec UI] Running in static mode`),cat()&&n?(console.log(`[OpenSpec UI] Hydrating pre-rendered content`),(0,Ha.hydrateRoot)(e,(0,K.jsx)(oat,{}))):(console.log(`[OpenSpec UI] Fresh render`),(0,Ha.createRoot)(e).render((0,K.jsx)(oat,{})))}uat();export{jye as A,pCe as C,Jbe as D,FE as E,X as F,ep as M,Xf as N,NE as O,tp as P,PCe as S,LE as T,LP as _,TF as a,VM as b,kF as c,dF as d,lF as f,zP as g,cF as h,OF as i,Zf as j,Mye as k,vF as l,iF as m,vje as n,wF as o,rF as p,_F as r,jF as s,yje as t,NF as u,RP as v,tSe as w,BM as x,IP as y};