openfox 2.0.0-beta.9 → 2.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.
- package/README.md +11 -0
- package/dist/{chat-handler-6COBLIDR.js → chat-handler-LJMW4OK3.js} +9 -9
- package/dist/{chunk-LR5R7EEE.js → chunk-32GQUDLN.js} +22 -18
- package/dist/{chunk-DMH6JVPF.js → chunk-7ZMMDZU7.js} +431 -32
- package/dist/{chunk-CDDMHSZF.js → chunk-CK6LGE7G.js} +10 -6
- package/dist/{chunk-VIIRNJDT.js → chunk-FFEAEPJB.js} +80 -245
- package/dist/{chunk-EZUR7OEP.js → chunk-HPCGVAS4.js} +21 -45
- package/dist/{chunk-XJEOP6XU.js → chunk-ITWVFGFV.js} +1 -30
- package/dist/{chunk-C75I2KZM.js → chunk-LEDG5WAN.js} +29 -35
- package/dist/{chunk-KUG27ZUR.js → chunk-MFUPS6UE.js} +6 -6
- package/dist/{chunk-NPHYEUYE.js → chunk-XEK3KII6.js} +55 -4
- package/dist/{chunk-J2FFLZ5Z.js → chunk-ZDY4WMZJ.js} +184 -71
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{config-TDVA7MQN.js → config-BU66P4KX.js} +2 -7
- package/dist/{events-PQ3KTI5H.js → events-ZKWAKWI7.js} +3 -3
- package/dist/{folding-CXORTBAU.js → folding-YOCGTZYH.js} +2 -2
- package/dist/{orchestrator-ZNGTMZ7W.js → orchestrator-LX6FKB6L.js} +8 -8
- package/dist/package.json +2 -1
- package/dist/{processor-WMAU4C2N.js → processor-NMYSEBC7.js} +11 -6
- package/dist/{protocol-CDOV1pyc.d.ts → protocol-D59sCy9L.d.ts} +15 -6
- package/dist/{provider-BGH4MBLH.js → provider-DTNQYCMV.js} +9 -20
- package/dist/provider-manager-LMHAHLIF.js +15 -0
- package/dist/{serve-N3LBZUVN.js → serve-SGNL43UL.js} +14 -15
- package/dist/server/index.d.ts +22 -16
- package/dist/server/index.js +9 -10
- package/dist/shared/index.d.ts +2 -2
- package/dist/{tools-CQGEU3JK.js → tools-BOE5T3KC.js} +7 -7
- package/dist/web/assets/index-Bego8SwT.js +299 -0
- package/dist/web/assets/{index-CSOB8dwI.css → index-Sdax8ayU.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-UKTPL5ZG.js +0 -469
- package/dist/web/assets/index-BJuF4wi7.js +0 -299
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-UfJy6YNI.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-Dm6A9KJ5.js","assets/ruby-DyJCeAvU.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-DbPARsA_.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-D7OTSIA_.js","assets/r-Dspwwk_N.js","assets/just-CUsbIsdP.js","assets/perl-B9cMNwum.js","assets/latex-CaSxy8MP.js","assets/tex-idrVyKtj.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/php-Csjmro_R.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/csharp-DSvCPggb.js","assets/rst-CpCqk9r5.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/go-C27-OAKa.js","assets/ts-tags-D351s5mN.js","assets/twig-CW1WmMYd.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var XE=Object.defineProperty;var QE=Object.getPrototypeOf;var JE=Reflect.get;var Jy=e=>{throw TypeError(e)};var ZE=(e,t,n)=>t in e?XE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var he=(e,t,n)=>ZE(e,typeof t!="symbol"?t+"":t,n),bf=(e,t,n)=>t.has(e)||Jy("Cannot "+n);var wn=(e,t,n)=>(bf(e,t,"read from private field"),n?n.call(e):t.get(e)),fi=(e,t,n)=>t.has(e)?Jy("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),mr=(e,t,n,s)=>(bf(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Sf=(e,t,n)=>(bf(e,t,"access private method"),n);var Zy=(e,t,n)=>JE(QE(e),n,t);function e2(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(s,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function Mu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wf={exports:{}},Ho={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var ev;function t2(){if(ev)return Ho;ev=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var u=null;if(o!==void 0&&(u=""+o),a.key!==void 0&&(u=""+a.key),"key"in a){o={};for(var c in a)c!=="key"&&(o[c]=a[c])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:u,ref:a!==void 0?a:null,props:o}}return Ho.Fragment=t,Ho.jsx=n,Ho.jsxs=n,Ho}var tv;function n2(){return tv||(tv=1,wf.exports=t2()),wf.exports}var l=n2(),Cf={exports:{}},Ve={};/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var nv;function r2(){if(nv)return Ve;nv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),x=Symbol.iterator;function _(z){return z===null||typeof z!="object"?null:(z=x&&z[x]||z["@@iterator"],typeof z=="function"?z:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,v={};function S(z,V,$){this.props=z,this.context=V,this.refs=v,this.updater=$||w}S.prototype.isReactComponent={},S.prototype.setState=function(z,V){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,V,"setState")},S.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function y(){}y.prototype=S.prototype;function b(z,V,$){this.props=z,this.context=V,this.refs=v,this.updater=$||w}var E=b.prototype=new y;E.constructor=b,k(E,S.prototype),E.isPureReactComponent=!0;var N=Array.isArray;function T(){}var L={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function M(z,V,$){var ee=$.ref;return{$$typeof:e,type:z,key:V,ref:ee!==void 0?ee:null,props:$}}function D(z,V){return M(z.type,V,z.props)}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function F(z){var V={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function($){return V[$]})}var B=/\/+/g;function Y(z,V){return typeof z=="object"&&z!==null&&z.key!=null?F(""+z.key):V.toString(36)}function W(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(T,T):(z.status="pending",z.then(function(V){z.status==="pending"&&(z.status="fulfilled",z.value=V)},function(V){z.status==="pending"&&(z.status="rejected",z.reason=V)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function H(z,V,$,ee,Z){var re=typeof z;(re==="undefined"||re==="boolean")&&(z=null);var Q=!1;if(z===null)Q=!0;else switch(re){case"bigint":case"string":case"number":Q=!0;break;case"object":switch(z.$$typeof){case e:case t:Q=!0;break;case p:return Q=z._init,H(Q(z._payload),V,$,ee,Z)}}if(Q)return Z=Z(z),Q=ee===""?"."+Y(z,0):ee,N(Z)?($="",Q!=null&&($=Q.replace(B,"$&/")+"/"),H(Z,V,$,"",function(se){return se})):Z!=null&&(U(Z)&&(Z=D(Z,$+(Z.key==null||z&&z.key===Z.key?"":(""+Z.key).replace(B,"$&/")+"/")+Q)),V.push(Z)),1;Q=0;var G=ee===""?".":ee+":";if(N(z))for(var te=0;te<z.length;te++)ee=z[te],re=G+Y(ee,te),Q+=H(ee,V,$,re,Z);else if(te=_(z),typeof te=="function")for(z=te.call(z),te=0;!(ee=z.next()).done;)ee=ee.value,re=G+Y(ee,te++),Q+=H(ee,V,$,re,Z);else if(re==="object"){if(typeof z.then=="function")return H(W(z),V,$,ee,Z);throw V=String(z),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Q}function K(z,V,$){if(z==null)return z;var ee=[],Z=0;return H(z,ee,"","",function(re){return V.call($,re,Z++)}),ee}function X(z){if(z._status===-1){var V=z._result;V=V(),V.then(function($){(z._status===0||z._status===-1)&&(z._status=1,z._result=$)},function($){(z._status===0||z._status===-1)&&(z._status=2,z._result=$)}),z._status===-1&&(z._status=0,z._result=V)}if(z._status===1)return z._result.default;throw z._result}var P=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},O={map:K,forEach:function(z,V,$){K(z,function(){V.apply(this,arguments)},$)},count:function(z){var V=0;return K(z,function(){V++}),V},toArray:function(z){return K(z,function(V){return V})||[]},only:function(z){if(!U(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Ve.Activity=m,Ve.Children=O,Ve.Component=S,Ve.Fragment=n,Ve.Profiler=a,Ve.PureComponent=b,Ve.StrictMode=s,Ve.Suspense=d,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(z){return L.H.useMemoCache(z)}},Ve.cache=function(z){return function(){return z.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(z,V,$){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ee=k({},z.props),Z=z.key;if(V!=null)for(re in V.key!==void 0&&(Z=""+V.key),V)!A.call(V,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&V.ref===void 0||(ee[re]=V[re]);var re=arguments.length-2;if(re===1)ee.children=$;else if(1<re){for(var Q=Array(re),G=0;G<re;G++)Q[G]=arguments[G+2];ee.children=Q}return M(z.type,Z,ee)},Ve.createContext=function(z){return z={$$typeof:u,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:o,_context:z},z},Ve.createElement=function(z,V,$){var ee,Z={},re=null;if(V!=null)for(ee in V.key!==void 0&&(re=""+V.key),V)A.call(V,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(Z[ee]=V[ee]);var Q=arguments.length-2;if(Q===1)Z.children=$;else if(1<Q){for(var G=Array(Q),te=0;te<Q;te++)G[te]=arguments[te+2];Z.children=G}if(z&&z.defaultProps)for(ee in Q=z.defaultProps,Q)Z[ee]===void 0&&(Z[ee]=Q[ee]);return M(z,re,Z)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(z){return{$$typeof:c,render:z}},Ve.isValidElement=U,Ve.lazy=function(z){return{$$typeof:p,_payload:{_status:-1,_result:z},_init:X}},Ve.memo=function(z,V){return{$$typeof:f,type:z,compare:V===void 0?null:V}},Ve.startTransition=function(z){var V=L.T,$={};L.T=$;try{var ee=z(),Z=L.S;Z!==null&&Z($,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(T,P)}catch(re){P(re)}finally{V!==null&&$.types!==null&&(V.types=$.types),L.T=V}},Ve.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Ve.use=function(z){return L.H.use(z)},Ve.useActionState=function(z,V,$){return L.H.useActionState(z,V,$)},Ve.useCallback=function(z,V){return L.H.useCallback(z,V)},Ve.useContext=function(z){return L.H.useContext(z)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(z,V){return L.H.useDeferredValue(z,V)},Ve.useEffect=function(z,V){return L.H.useEffect(z,V)},Ve.useEffectEvent=function(z){return L.H.useEffectEvent(z)},Ve.useId=function(){return L.H.useId()},Ve.useImperativeHandle=function(z,V,$){return L.H.useImperativeHandle(z,V,$)},Ve.useInsertionEffect=function(z,V){return L.H.useInsertionEffect(z,V)},Ve.useLayoutEffect=function(z,V){return L.H.useLayoutEffect(z,V)},Ve.useMemo=function(z,V){return L.H.useMemo(z,V)},Ve.useOptimistic=function(z,V){return L.H.useOptimistic(z,V)},Ve.useReducer=function(z,V,$){return L.H.useReducer(z,V,$)},Ve.useRef=function(z){return L.H.useRef(z)},Ve.useState=function(z){return L.H.useState(z)},Ve.useSyncExternalStore=function(z,V,$){return L.H.useSyncExternalStore(z,V,$)},Ve.useTransition=function(){return L.H.useTransition()},Ve.version="19.2.4",Ve}var rv;function Iu(){return rv||(rv=1,Cf.exports=r2()),Cf.exports}var R=Iu();const $s=Mu(R),s2=e2({__proto__:null,default:$s},[R]);var kf={exports:{}},$o={},Ef={exports:{}},jf={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var sv;function i2(){return sv||(sv=1,(function(e){function t(H,K){var X=H.length;H.push(K);e:for(;0<X;){var P=X-1>>>1,O=H[P];if(0<a(O,K))H[P]=K,H[X]=O,X=P;else break e}}function n(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var K=H[0],X=H.pop();if(X!==K){H[0]=X;e:for(var P=0,O=H.length,z=O>>>1;P<z;){var V=2*(P+1)-1,$=H[V],ee=V+1,Z=H[ee];if(0>a($,X))ee<O&&0>a(Z,$)?(H[P]=Z,H[ee]=X,P=ee):(H[P]=$,H[V]=X,P=V);else if(ee<O&&0>a(Z,X))H[P]=Z,H[ee]=X,P=ee;else break e}}return K}function a(H,K){var X=H.sortIndex-K.sortIndex;return X!==0?X:H.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,c=u.now();e.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,x=3,_=!1,w=!1,k=!1,v=!1,S=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function E(H){for(var K=n(f);K!==null;){if(K.callback===null)s(f);else if(K.startTime<=H)s(f),K.sortIndex=K.expirationTime,t(d,K);else break;K=n(f)}}function N(H){if(k=!1,E(H),!w)if(n(d)!==null)w=!0,T||(T=!0,F());else{var K=n(f);K!==null&&W(N,K.startTime-H)}}var T=!1,L=-1,A=5,M=-1;function D(){return v?!0:!(e.unstable_now()-M<A)}function U(){if(v=!1,T){var H=e.unstable_now();M=H;var K=!0;try{e:{w=!1,k&&(k=!1,y(L),L=-1),_=!0;var X=x;try{t:{for(E(H),m=n(d);m!==null&&!(m.expirationTime>H&&D());){var P=m.callback;if(typeof P=="function"){m.callback=null,x=m.priorityLevel;var O=P(m.expirationTime<=H);if(H=e.unstable_now(),typeof O=="function"){m.callback=O,E(H),K=!0;break t}m===n(d)&&s(d),E(H)}else s(d);m=n(d)}if(m!==null)K=!0;else{var z=n(f);z!==null&&W(N,z.startTime-H),K=!1}}break e}finally{m=null,x=X,_=!1}K=void 0}}finally{K?F():T=!1}}}var F;if(typeof b=="function")F=function(){b(U)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,Y=B.port2;B.port1.onmessage=U,F=function(){Y.postMessage(null)}}else F=function(){S(U,0)};function W(H,K){L=S(function(){H(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(H){switch(x){case 1:case 2:case 3:var K=3;break;default:K=x}var X=x;x=K;try{return H()}finally{x=X}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var X=x;x=H;try{return K()}finally{x=X}},e.unstable_scheduleCallback=function(H,K,X){var P=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?P+X:P):X=P,H){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=X+O,H={id:p++,callback:K,priorityLevel:H,startTime:X,expirationTime:O,sortIndex:-1},X>P?(H.sortIndex=X,t(f,H),n(d)===null&&H===n(f)&&(k?(y(L),L=-1):k=!0,W(N,X-P))):(H.sortIndex=O,t(d,H),w||_||(w=!0,T||(T=!0,F()))),H},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(H){var K=x;return function(){var X=x;x=K;try{return H.apply(this,arguments)}finally{x=X}}}})(jf)),jf}var iv;function a2(){return iv||(iv=1,Ef.exports=i2()),Ef.exports}var Tf={exports:{}},xn={};/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var av;function o2(){if(av)return xn;av=1;var e=Iu();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(d,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:d,containerInfo:f,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,xn.createPortal=function(d,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(d,f,null,p)},xn.flushSync=function(d){var f=u.T,p=s.p;try{if(u.T=null,s.p=2,d)return d()}finally{u.T=f,s.p=p,s.d.f()}},xn.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(d,f))},xn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},xn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,_=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?s.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:x,fetchPriority:_}):p==="script"&&s.d.X(d,{crossOrigin:m,integrity:x,fetchPriority:_,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},xn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=c(f.as,f.crossOrigin);s.d.M(d,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(d)},xn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin);s.d.L(d,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},xn.preloadModule=function(d,f){if(typeof d=="string")if(f){var p=c(f.as,f.crossOrigin);s.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(d)},xn.requestFormReset=function(d){s.d.r(d)},xn.unstable_batchedUpdates=function(d,f){return d(f)},xn.useFormState=function(d,f,p){return u.H.useFormState(d,f,p)},xn.useFormStatus=function(){return u.H.useHostTransitionStatus()},xn.version="19.2.4",xn}var ov;function J0(){if(ov)return Tf.exports;ov=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Tf.exports=o2(),Tf.exports}/**
|
|
35
|
-
* @license React
|
|
36
|
-
* react-dom-client.production.js
|
|
37
|
-
*
|
|
38
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the MIT license found in the
|
|
41
|
-
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var lv;function l2(){if(lv)return $o;lv=1;var e=a2(),t=Iu(),n=J0();function s(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)i+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,h=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(h=i.return),r=i.return;while(r)}return i.tag===3?h:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function c(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function d(r){if(o(r)!==r)throw Error(s(188))}function f(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(s(188));return i!==r?null:r}for(var h=r,g=i;;){var C=h.return;if(C===null)break;var j=C.alternate;if(j===null){if(g=C.return,g!==null){h=g;continue}break}if(C.child===j.child){for(j=C.child;j;){if(j===h)return d(C),r;if(j===g)return d(C),i;j=j.sibling}throw Error(s(188))}if(h.return!==g.return)h=C,g=j;else{for(var I=!1,q=C.child;q;){if(q===h){I=!0,h=C,g=j;break}if(q===g){I=!0,g=C,h=j;break}q=q.sibling}if(!I){for(q=j.child;q;){if(q===h){I=!0,h=j,g=C;break}if(q===g){I=!0,g=j,h=C;break}q=q.sibling}if(!I)throw Error(s(189))}}if(h.alternate!==g)throw Error(s(190))}if(h.tag!==3)throw Error(s(188));return h.stateNode.current===h?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),b=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function F(r){return r===null||typeof r!="object"?null:(r=U&&r[U]||r["@@iterator"],typeof r=="function"?r:null)}var B=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===B?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case S:return"Profiler";case v:return"StrictMode";case N:return"Suspense";case T:return"SuspenseList";case M:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case w:return"Portal";case b:return r.displayName||"Context";case y:return(r._context.displayName||"Context")+".Consumer";case E:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case L:return i=r.displayName||null,i!==null?i:Y(r.type)||"Memo";case A:i=r._payload,r=r._init;try{return Y(r(i))}catch{}}return null}var W=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},P=[],O=-1;function z(r){return{current:r}}function V(r){0>O||(r.current=P[O],P[O]=null,O--)}function $(r,i){O++,P[O]=r.current,r.current=i}var ee=z(null),Z=z(null),re=z(null),Q=z(null);function G(r,i){switch($(re,i),$(Z,r),$(ee,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?by(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=by(i),r=Sy(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}V(ee),$(ee,r)}function te(){V(ee),V(Z),V(re)}function se(r){r.memoizedState!==null&&$(Q,r);var i=ee.current,h=Sy(i,r.type);i!==h&&($(Z,r),$(ee,h))}function _e(r){Z.current===r&&(V(ee),V(Z)),Q.current===r&&(V(Q),Io._currentValue=X)}var ye,Ae;function De(r){if(ye===void 0)try{throw Error()}catch(h){var i=h.stack.trim().match(/\n( *(at )?)/);ye=i&&i[1]||"",Ae=-1<h.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<h.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+ye+r+Ae}var Me=!1;function $e(r,i){if(!r||Me)return"";Me=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(i){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(ue){var ce=ue}Reflect.construct(r,[],be)}else{try{be.call()}catch(ue){ce=ue}r.call(be.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(be=r())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=g.DetermineComponentFrameRoot(),I=j[0],q=j[1];if(I&&q){var ne=I.split(`
|
|
45
|
-
`),le=q.split(`
|
|
46
|
-
`);for(C=g=0;g<ne.length&&!ne[g].includes("DetermineComponentFrameRoot");)g++;for(;C<le.length&&!le[C].includes("DetermineComponentFrameRoot");)C++;if(g===ne.length||C===le.length)for(g=ne.length-1,C=le.length-1;1<=g&&0<=C&&ne[g]!==le[C];)C--;for(;1<=g&&0<=C;g--,C--)if(ne[g]!==le[C]){if(g!==1||C!==1)do if(g--,C--,0>C||ne[g]!==le[C]){var pe=`
|
|
47
|
-
`+ne[g].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),pe}while(1<=g&&0<=C);break}}}finally{Me=!1,Error.prepareStackTrace=h}return(h=r?r.displayName||r.name:"")?De(h):""}function de(r,i){switch(r.tag){case 26:case 27:case 5:return De(r.type);case 16:return De("Lazy");case 13:return r.child!==i&&i!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return $e(r.type,!1);case 11:return $e(r.type.render,!1);case 1:return $e(r.type,!0);case 31:return De("Activity");default:return""}}function Ie(r){try{var i="",h=null;do i+=de(r,h),h=r,r=r.return;while(r);return i}catch(g){return`
|
|
48
|
-
Error generating stack: `+g.message+`
|
|
49
|
-
`+g.stack}}var Se=Object.prototype.hasOwnProperty,fe=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,ot=e.unstable_shouldYield,Ut=e.unstable_requestPaint,St=e.unstable_now,pn=e.unstable_getCurrentPriorityLevel,me=e.unstable_ImmediatePriority,Ee=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,Fe=e.unstable_LowPriority,Ke=e.unstable_IdlePriority,At=e.log,et=e.unstable_setDisableYieldValue,Lt=null,ft=null;function gn(r){if(typeof At=="function"&&et(r),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(Lt,r)}catch{}}var pt=Math.clz32?Math.clz32:Mi,cr=Math.log,Mn=Math.LN2;function Mi(r){return r>>>=0,r===0?32:31-(cr(r)/Mn|0)|0}var ur=256,Ii=262144,Pi=4194304;function Sr(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Bi(r,i,h){var g=r.pendingLanes;if(g===0)return 0;var C=0,j=r.suspendedLanes,I=r.pingedLanes;r=r.warmLanes;var q=g&134217727;return q!==0?(g=q&~j,g!==0?C=Sr(g):(I&=q,I!==0?C=Sr(I):h||(h=q&~r,h!==0&&(C=Sr(h))))):(q=g&~j,q!==0?C=Sr(q):I!==0?C=Sr(I):h||(h=g&~r,h!==0&&(C=Sr(h)))),C===0?0:i!==0&&i!==C&&(i&j)===0&&(j=C&-C,h=i&-i,j>=h||j===32&&(h&4194048)!==0)?i:C}function Ys(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Ya(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nl(){var r=Pi;return Pi<<=1,(Pi&62914560)===0&&(Pi=4194304),r}function zi(r){for(var i=[],h=0;31>h;h++)i.push(r);return i}function hs(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function xe(r,i,h,g,C,j){var I=r.pendingLanes;r.pendingLanes=h,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=h,r.entangledLanes&=h,r.errorRecoveryDisabledLanes&=h,r.shellSuspendCounter=0;var q=r.entanglements,ne=r.expirationTimes,le=r.hiddenUpdates;for(h=I&~h;0<h;){var pe=31-pt(h),be=1<<pe;q[pe]=0,ne[pe]=-1;var ce=le[pe];if(ce!==null)for(le[pe]=null,pe=0;pe<ce.length;pe++){var ue=ce[pe];ue!==null&&(ue.lane&=-536870913)}h&=~be}g!==0&&ge(r,g,0),j!==0&&C===0&&r.tag!==0&&(r.suspendedLanes|=j&~(I&~i))}function ge(r,i,h){r.pendingLanes|=i,r.suspendedLanes&=~i;var g=31-pt(i);r.entangledLanes|=i,r.entanglements[g]=r.entanglements[g]|1073741824|h&261930}function Ne(r,i){var h=r.entangledLanes|=i;for(r=r.entanglements;h;){var g=31-pt(h),C=1<<g;C&i|r[g]&i&&(r[g]|=i),h&=~C}}function ze(r,i){var h=i&-i;return h=(h&42)!==0?1:Ze(h),(h&(r.suspendedLanes|i))!==0?0:h}function Ze(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Ge(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ct(){var r=K.p;return r!==0?r:(r=window.event,r===void 0?32:Gy(r.type))}function un(r,i){var h=K.p;try{return K.p=r,i()}finally{K.p=h}}var Mt=Math.random().toString(36).slice(2),gt="__reactFiber$"+Mt,kn="__reactProps$"+Mt,Hi="__reactContainer$"+Mt,dd="__reactEvents$"+Mt,zC="__reactListeners$"+Mt,HC="__reactHandles$"+Mt,lg="__reactResources$"+Mt,Xa="__reactMarker$"+Mt;function hd(r){delete r[gt],delete r[kn],delete r[dd],delete r[zC],delete r[HC]}function $i(r){var i=r[gt];if(i)return i;for(var h=r.parentNode;h;){if(i=h[Hi]||h[gt]){if(h=i.alternate,i.child!==null||h!==null&&h.child!==null)for(r=Ny(r);r!==null;){if(h=r[gt])return h;r=Ny(r)}return i}r=h,h=r.parentNode}return null}function Ui(r){if(r=r[gt]||r[Hi]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Qa(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function Fi(r){var i=r[lg];return i||(i=r[lg]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function an(r){r[Xa]=!0}var cg=new Set,ug={};function Xs(r,i){Vi(r,i),Vi(r+"Capture",i)}function Vi(r,i){for(ug[r]=i,r=0;r<i.length;r++)cg.add(i[r])}var $C=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),dg={},hg={};function UC(r){return Se.call(hg,r)?!0:Se.call(dg,r)?!1:$C.test(r)?hg[r]=!0:(dg[r]=!0,!1)}function Al(r,i,h){if(UC(i))if(h===null)r.removeAttribute(i);else{switch(typeof h){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var g=i.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+h)}}function Ll(r,i,h){if(h===null)r.removeAttribute(i);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+h)}}function Pr(r,i,h,g){if(g===null)r.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(h);return}r.setAttributeNS(i,h,""+g)}}function Kn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function fg(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function FC(r,i,h){var g=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var C=g.get,j=g.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return C.call(this)},set:function(I){h=""+I,j.call(this,I)}}),Object.defineProperty(r,i,{enumerable:g.enumerable}),{getValue:function(){return h},setValue:function(I){h=""+I},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function fd(r){if(!r._valueTracker){var i=fg(r)?"checked":"value";r._valueTracker=FC(r,i,""+r[i])}}function mg(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var h=i.getValue(),g="";return r&&(g=fg(r)?r.checked?"true":"false":r.value),r=g,r!==h?(i.setValue(r),!0):!1}function Dl(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var VC=/[\n"\\]/g;function Yn(r){return r.replace(VC,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function md(r,i,h,g,C,j,I,q){r.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?r.type=I:r.removeAttribute("type"),i!=null?I==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Kn(i)):r.value!==""+Kn(i)&&(r.value=""+Kn(i)):I!=="submit"&&I!=="reset"||r.removeAttribute("value"),i!=null?pd(r,I,Kn(i)):h!=null?pd(r,I,Kn(h)):g!=null&&r.removeAttribute("value"),C==null&&j!=null&&(r.defaultChecked=!!j),C!=null&&(r.checked=C&&typeof C!="function"&&typeof C!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?r.name=""+Kn(q):r.removeAttribute("name")}function pg(r,i,h,g,C,j,I,q){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(r.type=j),i!=null||h!=null){if(!(j!=="submit"&&j!=="reset"||i!=null)){fd(r);return}h=h!=null?""+Kn(h):"",i=i!=null?""+Kn(i):h,q||i===r.value||(r.value=i),r.defaultValue=i}g=g??C,g=typeof g!="function"&&typeof g!="symbol"&&!!g,r.checked=q?r.checked:!!g,r.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(r.name=I),fd(r)}function pd(r,i,h){i==="number"&&Dl(r.ownerDocument)===r||r.defaultValue===""+h||(r.defaultValue=""+h)}function Gi(r,i,h,g){if(r=r.options,i){i={};for(var C=0;C<h.length;C++)i["$"+h[C]]=!0;for(h=0;h<r.length;h++)C=i.hasOwnProperty("$"+r[h].value),r[h].selected!==C&&(r[h].selected=C),C&&g&&(r[h].defaultSelected=!0)}else{for(h=""+Kn(h),i=null,C=0;C<r.length;C++){if(r[C].value===h){r[C].selected=!0,g&&(r[C].defaultSelected=!0);return}i!==null||r[C].disabled||(i=r[C])}i!==null&&(i.selected=!0)}}function gg(r,i,h){if(i!=null&&(i=""+Kn(i),i!==r.value&&(r.value=i),h==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=h!=null?""+Kn(h):""}function xg(r,i,h,g){if(i==null){if(g!=null){if(h!=null)throw Error(s(92));if(W(g)){if(1<g.length)throw Error(s(93));g=g[0]}h=g}h==null&&(h=""),i=h}h=Kn(i),r.defaultValue=h,g=r.textContent,g===h&&g!==""&&g!==null&&(r.value=g),fd(r)}function Wi(r,i){if(i){var h=r.firstChild;if(h&&h===r.lastChild&&h.nodeType===3){h.nodeValue=i;return}}r.textContent=i}var GC=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _g(r,i,h){var g=i.indexOf("--")===0;h==null||typeof h=="boolean"||h===""?g?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":g?r.setProperty(i,h):typeof h!="number"||h===0||GC.has(i)?i==="float"?r.cssFloat=h:r[i]=(""+h).trim():r[i]=h+"px"}function yg(r,i,h){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,h!=null){for(var g in h)!h.hasOwnProperty(g)||i!=null&&i.hasOwnProperty(g)||(g.indexOf("--")===0?r.setProperty(g,""):g==="float"?r.cssFloat="":r[g]="");for(var C in i)g=i[C],i.hasOwnProperty(C)&&h[C]!==g&&_g(r,C,g)}else for(var j in i)i.hasOwnProperty(j)&&_g(r,j,i[j])}function gd(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var WC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),qC=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Rl(r){return qC.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Br(){}var xd=null;function _d(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var qi=null,Ki=null;function vg(r){var i=Ui(r);if(i&&(r=i.stateNode)){var h=r[kn]||null;e:switch(r=i.stateNode,i.type){case"input":if(md(r,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name),i=h.name,h.type==="radio"&&i!=null){for(h=r;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll('input[name="'+Yn(""+i)+'"][type="radio"]'),i=0;i<h.length;i++){var g=h[i];if(g!==r&&g.form===r.form){var C=g[kn]||null;if(!C)throw Error(s(90));md(g,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(i=0;i<h.length;i++)g=h[i],g.form===r.form&&mg(g)}break e;case"textarea":gg(r,h.value,h.defaultValue);break e;case"select":i=h.value,i!=null&&Gi(r,!!h.multiple,i,!1)}}}var yd=!1;function bg(r,i,h){if(yd)return r(i,h);yd=!0;try{var g=r(i);return g}finally{if(yd=!1,(qi!==null||Ki!==null)&&(vc(),qi&&(i=qi,r=Ki,Ki=qi=null,vg(i),r)))for(i=0;i<r.length;i++)vg(r[i])}}function Ja(r,i){var h=r.stateNode;if(h===null)return null;var g=h[kn]||null;if(g===null)return null;h=g[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(h&&typeof h!="function")throw Error(s(231,i,typeof h));return h}var zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vd=!1;if(zr)try{var Za={};Object.defineProperty(Za,"passive",{get:function(){vd=!0}}),window.addEventListener("test",Za,Za),window.removeEventListener("test",Za,Za)}catch{vd=!1}var fs=null,bd=null,Ol=null;function Sg(){if(Ol)return Ol;var r,i=bd,h=i.length,g,C="value"in fs?fs.value:fs.textContent,j=C.length;for(r=0;r<h&&i[r]===C[r];r++);var I=h-r;for(g=1;g<=I&&i[h-g]===C[j-g];g++);return Ol=C.slice(r,1<g?1-g:void 0)}function Ml(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Il(){return!0}function wg(){return!1}function En(r){function i(h,g,C,j,I){this._reactName=h,this._targetInst=C,this.type=g,this.nativeEvent=j,this.target=I,this.currentTarget=null;for(var q in r)r.hasOwnProperty(q)&&(h=r[q],this[q]=h?h(j):j[q]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Il:wg,this.isPropagationStopped=wg,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=Il)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=Il)},persist:function(){},isPersistent:Il}),i}var Qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pl=En(Qs),eo=m({},Qs,{view:0,detail:0}),KC=En(eo),Sd,wd,to,Bl=m({},eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==to&&(to&&r.type==="mousemove"?(Sd=r.screenX-to.screenX,wd=r.screenY-to.screenY):wd=Sd=0,to=r),Sd)},movementY:function(r){return"movementY"in r?r.movementY:wd}}),Cg=En(Bl),YC=m({},Bl,{dataTransfer:0}),XC=En(YC),QC=m({},eo,{relatedTarget:0}),Cd=En(QC),JC=m({},Qs,{animationName:0,elapsedTime:0,pseudoElement:0}),ZC=En(JC),ek=m({},Qs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),tk=En(ek),nk=m({},Qs,{data:0}),kg=En(nk),rk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ik={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ak(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=ik[r])?!!i[r]:!1}function kd(){return ak}var ok=m({},eo,{key:function(r){if(r.key){var i=rk[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=Ml(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?sk[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kd,charCode:function(r){return r.type==="keypress"?Ml(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ml(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),lk=En(ok),ck=m({},Bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eg=En(ck),uk=m({},eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kd}),dk=En(uk),hk=m({},Qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),fk=En(hk),mk=m({},Bl,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),pk=En(mk),gk=m({},Qs,{newState:0,oldState:0}),xk=En(gk),_k=[9,13,27,32],Ed=zr&&"CompositionEvent"in window,no=null;zr&&"documentMode"in document&&(no=document.documentMode);var yk=zr&&"TextEvent"in window&&!no,jg=zr&&(!Ed||no&&8<no&&11>=no),Tg=" ",Ng=!1;function Ag(r,i){switch(r){case"keyup":return _k.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lg(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Yi=!1;function vk(r,i){switch(r){case"compositionend":return Lg(i);case"keypress":return i.which!==32?null:(Ng=!0,Tg);case"textInput":return r=i.data,r===Tg&&Ng?null:r;default:return null}}function bk(r,i){if(Yi)return r==="compositionend"||!Ed&&Ag(r,i)?(r=Sg(),Ol=bd=fs=null,Yi=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return jg&&i.locale!=="ko"?null:i.data;default:return null}}var Sk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Dg(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!Sk[r.type]:i==="textarea"}function Rg(r,i,h,g){qi?Ki?Ki.push(g):Ki=[g]:qi=g,i=jc(i,"onChange"),0<i.length&&(h=new Pl("onChange","change",null,h,g),r.push({event:h,listeners:i}))}var ro=null,so=null;function wk(r){py(r,0)}function zl(r){var i=Qa(r);if(mg(i))return r}function Og(r,i){if(r==="change")return i}var Mg=!1;if(zr){var jd;if(zr){var Td="oninput"in document;if(!Td){var Ig=document.createElement("div");Ig.setAttribute("oninput","return;"),Td=typeof Ig.oninput=="function"}jd=Td}else jd=!1;Mg=jd&&(!document.documentMode||9<document.documentMode)}function Pg(){ro&&(ro.detachEvent("onpropertychange",Bg),so=ro=null)}function Bg(r){if(r.propertyName==="value"&&zl(so)){var i=[];Rg(i,so,r,_d(r)),bg(wk,i)}}function Ck(r,i,h){r==="focusin"?(Pg(),ro=i,so=h,ro.attachEvent("onpropertychange",Bg)):r==="focusout"&&Pg()}function kk(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return zl(so)}function Ek(r,i){if(r==="click")return zl(i)}function jk(r,i){if(r==="input"||r==="change")return zl(i)}function Tk(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var In=typeof Object.is=="function"?Object.is:Tk;function io(r,i){if(In(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var h=Object.keys(r),g=Object.keys(i);if(h.length!==g.length)return!1;for(g=0;g<h.length;g++){var C=h[g];if(!Se.call(i,C)||!In(r[C],i[C]))return!1}return!0}function zg(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Hg(r,i){var h=zg(r);r=0;for(var g;h;){if(h.nodeType===3){if(g=r+h.textContent.length,r<=i&&g>=i)return{node:h,offset:i-r};r=g}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=zg(h)}}function $g(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?$g(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Ug(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Dl(r.document);i instanceof r.HTMLIFrameElement;){try{var h=typeof i.contentWindow.location.href=="string"}catch{h=!1}if(h)r=i.contentWindow;else break;i=Dl(r.document)}return i}function Nd(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var Nk=zr&&"documentMode"in document&&11>=document.documentMode,Xi=null,Ad=null,ao=null,Ld=!1;function Fg(r,i,h){var g=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Ld||Xi==null||Xi!==Dl(g)||(g=Xi,"selectionStart"in g&&Nd(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ao&&io(ao,g)||(ao=g,g=jc(Ad,"onSelect"),0<g.length&&(i=new Pl("onSelect","select",null,i,h),r.push({event:i,listeners:g}),i.target=Xi)))}function Js(r,i){var h={};return h[r.toLowerCase()]=i.toLowerCase(),h["Webkit"+r]="webkit"+i,h["Moz"+r]="moz"+i,h}var Qi={animationend:Js("Animation","AnimationEnd"),animationiteration:Js("Animation","AnimationIteration"),animationstart:Js("Animation","AnimationStart"),transitionrun:Js("Transition","TransitionRun"),transitionstart:Js("Transition","TransitionStart"),transitioncancel:Js("Transition","TransitionCancel"),transitionend:Js("Transition","TransitionEnd")},Dd={},Vg={};zr&&(Vg=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function Zs(r){if(Dd[r])return Dd[r];if(!Qi[r])return r;var i=Qi[r],h;for(h in i)if(i.hasOwnProperty(h)&&h in Vg)return Dd[r]=i[h];return r}var Gg=Zs("animationend"),Wg=Zs("animationiteration"),qg=Zs("animationstart"),Ak=Zs("transitionrun"),Lk=Zs("transitionstart"),Dk=Zs("transitioncancel"),Kg=Zs("transitionend"),Yg=new Map,Rd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Rd.push("scrollEnd");function dr(r,i){Yg.set(r,i),Xs(i,[r])}var Hl=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Xn=[],Ji=0,Od=0;function $l(){for(var r=Ji,i=Od=Ji=0;i<r;){var h=Xn[i];Xn[i++]=null;var g=Xn[i];Xn[i++]=null;var C=Xn[i];Xn[i++]=null;var j=Xn[i];if(Xn[i++]=null,g!==null&&C!==null){var I=g.pending;I===null?C.next=C:(C.next=I.next,I.next=C),g.pending=C}j!==0&&Xg(h,C,j)}}function Ul(r,i,h,g){Xn[Ji++]=r,Xn[Ji++]=i,Xn[Ji++]=h,Xn[Ji++]=g,Od|=g,r.lanes|=g,r=r.alternate,r!==null&&(r.lanes|=g)}function Md(r,i,h,g){return Ul(r,i,h,g),Fl(r)}function ei(r,i){return Ul(r,null,null,i),Fl(r)}function Xg(r,i,h){r.lanes|=h;var g=r.alternate;g!==null&&(g.lanes|=h);for(var C=!1,j=r.return;j!==null;)j.childLanes|=h,g=j.alternate,g!==null&&(g.childLanes|=h),j.tag===22&&(r=j.stateNode,r===null||r._visibility&1||(C=!0)),r=j,j=j.return;return r.tag===3?(j=r.stateNode,C&&i!==null&&(C=31-pt(h),r=j.hiddenUpdates,g=r[C],g===null?r[C]=[i]:g.push(i),i.lane=h|536870912),j):null}function Fl(r){if(50<No)throw No=0,Vh=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Zi={};function Rk(r,i,h,g){this.tag=r,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pn(r,i,h,g){return new Rk(r,i,h,g)}function Id(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Hr(r,i){var h=r.alternate;return h===null?(h=Pn(r.tag,i,r.key,r.mode),h.elementType=r.elementType,h.type=r.type,h.stateNode=r.stateNode,h.alternate=r,r.alternate=h):(h.pendingProps=i,h.type=r.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=r.flags&65011712,h.childLanes=r.childLanes,h.lanes=r.lanes,h.child=r.child,h.memoizedProps=r.memoizedProps,h.memoizedState=r.memoizedState,h.updateQueue=r.updateQueue,i=r.dependencies,h.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},h.sibling=r.sibling,h.index=r.index,h.ref=r.ref,h.refCleanup=r.refCleanup,h}function Qg(r,i){r.flags&=65011714;var h=r.alternate;return h===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=h.childLanes,r.lanes=h.lanes,r.child=h.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=h.memoizedProps,r.memoizedState=h.memoizedState,r.updateQueue=h.updateQueue,r.type=h.type,i=h.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Vl(r,i,h,g,C,j){var I=0;if(g=r,typeof r=="function")Id(r)&&(I=1);else if(typeof r=="string")I=BE(r,h,ee.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case M:return r=Pn(31,h,i,C),r.elementType=M,r.lanes=j,r;case k:return ti(h.children,C,j,i);case v:I=8,C|=24;break;case S:return r=Pn(12,h,i,C|2),r.elementType=S,r.lanes=j,r;case N:return r=Pn(13,h,i,C),r.elementType=N,r.lanes=j,r;case T:return r=Pn(19,h,i,C),r.elementType=T,r.lanes=j,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case b:I=10;break e;case y:I=9;break e;case E:I=11;break e;case L:I=14;break e;case A:I=16,g=null;break e}I=29,h=Error(s(130,r===null?"null":typeof r,"")),g=null}return i=Pn(I,h,i,C),i.elementType=r,i.type=g,i.lanes=j,i}function ti(r,i,h,g){return r=Pn(7,r,g,i),r.lanes=h,r}function Pd(r,i,h){return r=Pn(6,r,null,i),r.lanes=h,r}function Jg(r){var i=Pn(18,null,null,0);return i.stateNode=r,i}function Bd(r,i,h){return i=Pn(4,r.children!==null?r.children:[],r.key,i),i.lanes=h,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Zg=new WeakMap;function Qn(r,i){if(typeof r=="object"&&r!==null){var h=Zg.get(r);return h!==void 0?h:(i={value:r,source:i,stack:Ie(i)},Zg.set(r,i),i)}return{value:r,source:i,stack:Ie(i)}}var ea=[],ta=0,Gl=null,oo=0,Jn=[],Zn=0,ms=null,wr=1,Cr="";function $r(r,i){ea[ta++]=oo,ea[ta++]=Gl,Gl=r,oo=i}function ex(r,i,h){Jn[Zn++]=wr,Jn[Zn++]=Cr,Jn[Zn++]=ms,ms=r;var g=wr;r=Cr;var C=32-pt(g)-1;g&=~(1<<C),h+=1;var j=32-pt(i)+C;if(30<j){var I=C-C%5;j=(g&(1<<I)-1).toString(32),g>>=I,C-=I,wr=1<<32-pt(i)+C|h<<C|g,Cr=j+r}else wr=1<<j|h<<C|g,Cr=r}function zd(r){r.return!==null&&($r(r,1),ex(r,1,0))}function Hd(r){for(;r===Gl;)Gl=ea[--ta],ea[ta]=null,oo=ea[--ta],ea[ta]=null;for(;r===ms;)ms=Jn[--Zn],Jn[Zn]=null,Cr=Jn[--Zn],Jn[Zn]=null,wr=Jn[--Zn],Jn[Zn]=null}function tx(r,i){Jn[Zn++]=wr,Jn[Zn++]=Cr,Jn[Zn++]=ms,wr=i.id,Cr=i.overflow,ms=r}var dn=null,Dt=null,at=!1,ps=null,er=!1,$d=Error(s(519));function gs(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw lo(Qn(i,r)),$d}function nx(r){var i=r.stateNode,h=r.type,g=r.memoizedProps;switch(i[gt]=r,i[kn]=g,h){case"dialog":nt("cancel",i),nt("close",i);break;case"iframe":case"object":case"embed":nt("load",i);break;case"video":case"audio":for(h=0;h<Lo.length;h++)nt(Lo[h],i);break;case"source":nt("error",i);break;case"img":case"image":case"link":nt("error",i),nt("load",i);break;case"details":nt("toggle",i);break;case"input":nt("invalid",i),pg(i,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":nt("invalid",i);break;case"textarea":nt("invalid",i),xg(i,g.value,g.defaultValue,g.children)}h=g.children,typeof h!="string"&&typeof h!="number"&&typeof h!="bigint"||i.textContent===""+h||g.suppressHydrationWarning===!0||yy(i.textContent,h)?(g.popover!=null&&(nt("beforetoggle",i),nt("toggle",i)),g.onScroll!=null&&nt("scroll",i),g.onScrollEnd!=null&&nt("scrollend",i),g.onClick!=null&&(i.onclick=Br),i=!0):i=!1,i||gs(r,!0)}function rx(r){for(dn=r.return;dn;)switch(dn.tag){case 5:case 31:case 13:er=!1;return;case 27:case 3:er=!0;return;default:dn=dn.return}}function na(r){if(r!==dn)return!1;if(!at)return rx(r),at=!0,!1;var i=r.tag,h;if((h=i!==3&&i!==27)&&((h=i===5)&&(h=r.type,h=!(h!=="form"&&h!=="button")||af(r.type,r.memoizedProps)),h=!h),h&&Dt&&gs(r),rx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Dt=Ty(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Dt=Ty(r)}else i===27?(i=Dt,As(r.type)?(r=df,df=null,Dt=r):Dt=i):Dt=dn?nr(r.stateNode.nextSibling):null;return!0}function ni(){Dt=dn=null,at=!1}function Ud(){var r=ps;return r!==null&&(An===null?An=r:An.push.apply(An,r),ps=null),r}function lo(r){ps===null?ps=[r]:ps.push(r)}var Fd=z(null),ri=null,Ur=null;function xs(r,i,h){$(Fd,i._currentValue),i._currentValue=h}function Fr(r){r._currentValue=Fd.current,V(Fd)}function Vd(r,i,h){for(;r!==null;){var g=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,g!==null&&(g.childLanes|=i)):g!==null&&(g.childLanes&i)!==i&&(g.childLanes|=i),r===h)break;r=r.return}}function Gd(r,i,h,g){var C=r.child;for(C!==null&&(C.return=r);C!==null;){var j=C.dependencies;if(j!==null){var I=C.child;j=j.firstContext;e:for(;j!==null;){var q=j;j=C;for(var ne=0;ne<i.length;ne++)if(q.context===i[ne]){j.lanes|=h,q=j.alternate,q!==null&&(q.lanes|=h),Vd(j.return,h,r),g||(I=null);break e}j=q.next}}else if(C.tag===18){if(I=C.return,I===null)throw Error(s(341));I.lanes|=h,j=I.alternate,j!==null&&(j.lanes|=h),Vd(I,h,r),I=null}else I=C.child;if(I!==null)I.return=C;else for(I=C;I!==null;){if(I===r){I=null;break}if(C=I.sibling,C!==null){C.return=I.return,I=C;break}I=I.return}C=I}}function ra(r,i,h,g){r=null;for(var C=i,j=!1;C!==null;){if(!j){if((C.flags&524288)!==0)j=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var I=C.alternate;if(I===null)throw Error(s(387));if(I=I.memoizedProps,I!==null){var q=C.type;In(C.pendingProps.value,I.value)||(r!==null?r.push(q):r=[q])}}else if(C===Q.current){if(I=C.alternate,I===null)throw Error(s(387));I.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(r!==null?r.push(Io):r=[Io])}C=C.return}r!==null&&Gd(i,r,h,g),i.flags|=262144}function Wl(r){for(r=r.firstContext;r!==null;){if(!In(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function si(r){ri=r,Ur=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function hn(r){return sx(ri,r)}function ql(r,i){return ri===null&&si(r),sx(r,i)}function sx(r,i){var h=i._currentValue;if(i={context:i,memoizedValue:h,next:null},Ur===null){if(r===null)throw Error(s(308));Ur=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Ur=Ur.next=i;return h}var Ok=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(h,g){r.push(g)}};this.abort=function(){i.aborted=!0,r.forEach(function(h){return h()})}},Mk=e.unstable_scheduleCallback,Ik=e.unstable_NormalPriority,qt={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wd(){return{controller:new Ok,data:new Map,refCount:0}}function co(r){r.refCount--,r.refCount===0&&Mk(Ik,function(){r.controller.abort()})}var uo=null,qd=0,sa=0,ia=null;function Pk(r,i){if(uo===null){var h=uo=[];qd=0,sa=Xh(),ia={status:"pending",value:void 0,then:function(g){h.push(g)}}}return qd++,i.then(ix,ix),i}function ix(){if(--qd===0&&uo!==null){ia!==null&&(ia.status="fulfilled");var r=uo;uo=null,sa=0,ia=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function Bk(r,i){var h=[],g={status:"pending",value:null,reason:null,then:function(C){h.push(C)}};return r.then(function(){g.status="fulfilled",g.value=i;for(var C=0;C<h.length;C++)(0,h[C])(i)},function(C){for(g.status="rejected",g.reason=C,C=0;C<h.length;C++)(0,h[C])(void 0)}),g}var ax=H.S;H.S=function(r,i){F_=St(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Pk(r,i),ax!==null&&ax(r,i)};var ii=z(null);function Kd(){var r=ii.current;return r!==null?r:wt.pooledCache}function Kl(r,i){i===null?$(ii,ii.current):$(ii,i.pool)}function ox(){var r=Kd();return r===null?null:{parent:qt._currentValue,pool:r}}var aa=Error(s(460)),Yd=Error(s(474)),Yl=Error(s(542)),Xl={then:function(){}};function lx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function cx(r,i,h){switch(h=r[h],h===void 0?r.push(i):h!==i&&(i.then(Br,Br),i=h),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,dx(r),r;default:if(typeof i.status=="string")i.then(Br,Br);else{if(r=wt,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(g){if(i.status==="pending"){var C=i;C.status="fulfilled",C.value=g}},function(g){if(i.status==="pending"){var C=i;C.status="rejected",C.reason=g}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,dx(r),r}throw oi=i,aa}}function ai(r){try{var i=r._init;return i(r._payload)}catch(h){throw h!==null&&typeof h=="object"&&typeof h.then=="function"?(oi=h,aa):h}}var oi=null;function ux(){if(oi===null)throw Error(s(459));var r=oi;return oi=null,r}function dx(r){if(r===aa||r===Yl)throw Error(s(483))}var oa=null,ho=0;function Ql(r){var i=ho;return ho+=1,oa===null&&(oa=[]),cx(oa,r,i)}function fo(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Jl(r,i){throw i.$$typeof===x?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function hx(r){function i(ae,ie){if(r){var oe=ae.deletions;oe===null?(ae.deletions=[ie],ae.flags|=16):oe.push(ie)}}function h(ae,ie){if(!r)return null;for(;ie!==null;)i(ae,ie),ie=ie.sibling;return null}function g(ae){for(var ie=new Map;ae!==null;)ae.key!==null?ie.set(ae.key,ae):ie.set(ae.index,ae),ae=ae.sibling;return ie}function C(ae,ie){return ae=Hr(ae,ie),ae.index=0,ae.sibling=null,ae}function j(ae,ie,oe){return ae.index=oe,r?(oe=ae.alternate,oe!==null?(oe=oe.index,oe<ie?(ae.flags|=67108866,ie):oe):(ae.flags|=67108866,ie)):(ae.flags|=1048576,ie)}function I(ae){return r&&ae.alternate===null&&(ae.flags|=67108866),ae}function q(ae,ie,oe,ve){return ie===null||ie.tag!==6?(ie=Pd(oe,ae.mode,ve),ie.return=ae,ie):(ie=C(ie,oe),ie.return=ae,ie)}function ne(ae,ie,oe,ve){var Pe=oe.type;return Pe===k?pe(ae,ie,oe.props.children,ve,oe.key):ie!==null&&(ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&ai(Pe)===ie.type)?(ie=C(ie,oe.props),fo(ie,oe),ie.return=ae,ie):(ie=Vl(oe.type,oe.key,oe.props,null,ae.mode,ve),fo(ie,oe),ie.return=ae,ie)}function le(ae,ie,oe,ve){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==oe.containerInfo||ie.stateNode.implementation!==oe.implementation?(ie=Bd(oe,ae.mode,ve),ie.return=ae,ie):(ie=C(ie,oe.children||[]),ie.return=ae,ie)}function pe(ae,ie,oe,ve,Pe){return ie===null||ie.tag!==7?(ie=ti(oe,ae.mode,ve,Pe),ie.return=ae,ie):(ie=C(ie,oe),ie.return=ae,ie)}function be(ae,ie,oe){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=Pd(""+ie,ae.mode,oe),ie.return=ae,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case _:return oe=Vl(ie.type,ie.key,ie.props,null,ae.mode,oe),fo(oe,ie),oe.return=ae,oe;case w:return ie=Bd(ie,ae.mode,oe),ie.return=ae,ie;case A:return ie=ai(ie),be(ae,ie,oe)}if(W(ie)||F(ie))return ie=ti(ie,ae.mode,oe,null),ie.return=ae,ie;if(typeof ie.then=="function")return be(ae,Ql(ie),oe);if(ie.$$typeof===b)return be(ae,ql(ae,ie),oe);Jl(ae,ie)}return null}function ce(ae,ie,oe,ve){var Pe=ie!==null?ie.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Pe!==null?null:q(ae,ie,""+oe,ve);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return oe.key===Pe?ne(ae,ie,oe,ve):null;case w:return oe.key===Pe?le(ae,ie,oe,ve):null;case A:return oe=ai(oe),ce(ae,ie,oe,ve)}if(W(oe)||F(oe))return Pe!==null?null:pe(ae,ie,oe,ve,null);if(typeof oe.then=="function")return ce(ae,ie,Ql(oe),ve);if(oe.$$typeof===b)return ce(ae,ie,ql(ae,oe),ve);Jl(ae,oe)}return null}function ue(ae,ie,oe,ve,Pe){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ae=ae.get(oe)||null,q(ie,ae,""+ve,Pe);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case _:return ae=ae.get(ve.key===null?oe:ve.key)||null,ne(ie,ae,ve,Pe);case w:return ae=ae.get(ve.key===null?oe:ve.key)||null,le(ie,ae,ve,Pe);case A:return ve=ai(ve),ue(ae,ie,oe,ve,Pe)}if(W(ve)||F(ve))return ae=ae.get(oe)||null,pe(ie,ae,ve,Pe,null);if(typeof ve.then=="function")return ue(ae,ie,oe,Ql(ve),Pe);if(ve.$$typeof===b)return ue(ae,ie,oe,ql(ie,ve),Pe);Jl(ie,ve)}return null}function Le(ae,ie,oe,ve){for(var Pe=null,ut=null,Re=ie,Ye=ie=0,it=null;Re!==null&&Ye<oe.length;Ye++){Re.index>Ye?(it=Re,Re=null):it=Re.sibling;var dt=ce(ae,Re,oe[Ye],ve);if(dt===null){Re===null&&(Re=it);break}r&&Re&&dt.alternate===null&&i(ae,Re),ie=j(dt,ie,Ye),ut===null?Pe=dt:ut.sibling=dt,ut=dt,Re=it}if(Ye===oe.length)return h(ae,Re),at&&$r(ae,Ye),Pe;if(Re===null){for(;Ye<oe.length;Ye++)Re=be(ae,oe[Ye],ve),Re!==null&&(ie=j(Re,ie,Ye),ut===null?Pe=Re:ut.sibling=Re,ut=Re);return at&&$r(ae,Ye),Pe}for(Re=g(Re);Ye<oe.length;Ye++)it=ue(Re,ae,Ye,oe[Ye],ve),it!==null&&(r&&it.alternate!==null&&Re.delete(it.key===null?Ye:it.key),ie=j(it,ie,Ye),ut===null?Pe=it:ut.sibling=it,ut=it);return r&&Re.forEach(function(Ms){return i(ae,Ms)}),at&&$r(ae,Ye),Pe}function Ue(ae,ie,oe,ve){if(oe==null)throw Error(s(151));for(var Pe=null,ut=null,Re=ie,Ye=ie=0,it=null,dt=oe.next();Re!==null&&!dt.done;Ye++,dt=oe.next()){Re.index>Ye?(it=Re,Re=null):it=Re.sibling;var Ms=ce(ae,Re,dt.value,ve);if(Ms===null){Re===null&&(Re=it);break}r&&Re&&Ms.alternate===null&&i(ae,Re),ie=j(Ms,ie,Ye),ut===null?Pe=Ms:ut.sibling=Ms,ut=Ms,Re=it}if(dt.done)return h(ae,Re),at&&$r(ae,Ye),Pe;if(Re===null){for(;!dt.done;Ye++,dt=oe.next())dt=be(ae,dt.value,ve),dt!==null&&(ie=j(dt,ie,Ye),ut===null?Pe=dt:ut.sibling=dt,ut=dt);return at&&$r(ae,Ye),Pe}for(Re=g(Re);!dt.done;Ye++,dt=oe.next())dt=ue(Re,ae,Ye,dt.value,ve),dt!==null&&(r&&dt.alternate!==null&&Re.delete(dt.key===null?Ye:dt.key),ie=j(dt,ie,Ye),ut===null?Pe=dt:ut.sibling=dt,ut=dt);return r&&Re.forEach(function(YE){return i(ae,YE)}),at&&$r(ae,Ye),Pe}function bt(ae,ie,oe,ve){if(typeof oe=="object"&&oe!==null&&oe.type===k&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:e:{for(var Pe=oe.key;ie!==null;){if(ie.key===Pe){if(Pe=oe.type,Pe===k){if(ie.tag===7){h(ae,ie.sibling),ve=C(ie,oe.props.children),ve.return=ae,ae=ve;break e}}else if(ie.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===A&&ai(Pe)===ie.type){h(ae,ie.sibling),ve=C(ie,oe.props),fo(ve,oe),ve.return=ae,ae=ve;break e}h(ae,ie);break}else i(ae,ie);ie=ie.sibling}oe.type===k?(ve=ti(oe.props.children,ae.mode,ve,oe.key),ve.return=ae,ae=ve):(ve=Vl(oe.type,oe.key,oe.props,null,ae.mode,ve),fo(ve,oe),ve.return=ae,ae=ve)}return I(ae);case w:e:{for(Pe=oe.key;ie!==null;){if(ie.key===Pe)if(ie.tag===4&&ie.stateNode.containerInfo===oe.containerInfo&&ie.stateNode.implementation===oe.implementation){h(ae,ie.sibling),ve=C(ie,oe.children||[]),ve.return=ae,ae=ve;break e}else{h(ae,ie);break}else i(ae,ie);ie=ie.sibling}ve=Bd(oe,ae.mode,ve),ve.return=ae,ae=ve}return I(ae);case A:return oe=ai(oe),bt(ae,ie,oe,ve)}if(W(oe))return Le(ae,ie,oe,ve);if(F(oe)){if(Pe=F(oe),typeof Pe!="function")throw Error(s(150));return oe=Pe.call(oe),Ue(ae,ie,oe,ve)}if(typeof oe.then=="function")return bt(ae,ie,Ql(oe),ve);if(oe.$$typeof===b)return bt(ae,ie,ql(ae,oe),ve);Jl(ae,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ie!==null&&ie.tag===6?(h(ae,ie.sibling),ve=C(ie,oe),ve.return=ae,ae=ve):(h(ae,ie),ve=Pd(oe,ae.mode,ve),ve.return=ae,ae=ve),I(ae)):h(ae,ie)}return function(ae,ie,oe,ve){try{ho=0;var Pe=bt(ae,ie,oe,ve);return oa=null,Pe}catch(Re){if(Re===aa||Re===Yl)throw Re;var ut=Pn(29,Re,null,ae.mode);return ut.lanes=ve,ut.return=ae,ut}finally{}}}var li=hx(!0),fx=hx(!1),_s=!1;function Xd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qd(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ys(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function vs(r,i,h){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(mt&2)!==0){var C=g.pending;return C===null?i.next=i:(i.next=C.next,C.next=i),g.pending=i,i=Fl(r),Xg(r,null,h),i}return Ul(r,g,i,h),Fl(r)}function mo(r,i,h){if(i=i.updateQueue,i!==null&&(i=i.shared,(h&4194048)!==0)){var g=i.lanes;g&=r.pendingLanes,h|=g,i.lanes=h,Ne(r,h)}}function Jd(r,i){var h=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,h===g)){var C=null,j=null;if(h=h.firstBaseUpdate,h!==null){do{var I={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};j===null?C=j=I:j=j.next=I,h=h.next}while(h!==null);j===null?C=j=i:j=j.next=i}else C=j=i;h={baseState:g.baseState,firstBaseUpdate:C,lastBaseUpdate:j,shared:g.shared,callbacks:g.callbacks},r.updateQueue=h;return}r=h.lastBaseUpdate,r===null?h.firstBaseUpdate=i:r.next=i,h.lastBaseUpdate=i}var Zd=!1;function po(){if(Zd){var r=ia;if(r!==null)throw r}}function go(r,i,h,g){Zd=!1;var C=r.updateQueue;_s=!1;var j=C.firstBaseUpdate,I=C.lastBaseUpdate,q=C.shared.pending;if(q!==null){C.shared.pending=null;var ne=q,le=ne.next;ne.next=null,I===null?j=le:I.next=le,I=ne;var pe=r.alternate;pe!==null&&(pe=pe.updateQueue,q=pe.lastBaseUpdate,q!==I&&(q===null?pe.firstBaseUpdate=le:q.next=le,pe.lastBaseUpdate=ne))}if(j!==null){var be=C.baseState;I=0,pe=le=ne=null,q=j;do{var ce=q.lane&-536870913,ue=ce!==q.lane;if(ue?(st&ce)===ce:(g&ce)===ce){ce!==0&&ce===sa&&(Zd=!0),pe!==null&&(pe=pe.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var Le=r,Ue=q;ce=i;var bt=h;switch(Ue.tag){case 1:if(Le=Ue.payload,typeof Le=="function"){be=Le.call(bt,be,ce);break e}be=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=Ue.payload,ce=typeof Le=="function"?Le.call(bt,be,ce):Le,ce==null)break e;be=m({},be,ce);break e;case 2:_s=!0}}ce=q.callback,ce!==null&&(r.flags|=64,ue&&(r.flags|=8192),ue=C.callbacks,ue===null?C.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:q.tag,payload:q.payload,callback:q.callback,next:null},pe===null?(le=pe=ue,ne=be):pe=pe.next=ue,I|=ce;if(q=q.next,q===null){if(q=C.shared.pending,q===null)break;ue=q,q=ue.next,ue.next=null,C.lastBaseUpdate=ue,C.shared.pending=null}}while(!0);pe===null&&(ne=be),C.baseState=ne,C.firstBaseUpdate=le,C.lastBaseUpdate=pe,j===null&&(C.shared.lanes=0),ks|=I,r.lanes=I,r.memoizedState=be}}function mx(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function px(r,i){var h=r.callbacks;if(h!==null)for(r.callbacks=null,r=0;r<h.length;r++)mx(h[r],i)}var la=z(null),Zl=z(0);function gx(r,i){r=Jr,$(Zl,r),$(la,i),Jr=r|i.baseLanes}function eh(){$(Zl,Jr),$(la,la.current)}function th(){Jr=Zl.current,V(la),V(Zl)}var Bn=z(null),tr=null;function bs(r){var i=r.alternate;$(Ft,Ft.current&1),$(Bn,r),tr===null&&(i===null||la.current!==null||i.memoizedState!==null)&&(tr=r)}function nh(r){$(Ft,Ft.current),$(Bn,r),tr===null&&(tr=r)}function xx(r){r.tag===22?($(Ft,Ft.current),$(Bn,r),tr===null&&(tr=r)):Ss()}function Ss(){$(Ft,Ft.current),$(Bn,Bn.current)}function zn(r){V(Bn),tr===r&&(tr=null),V(Ft)}var Ft=z(0);function ec(r){for(var i=r;i!==null;){if(i.tag===13){var h=i.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||cf(h)||uf(h)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Vr=0,qe=null,yt=null,Kt=null,tc=!1,ca=!1,ci=!1,nc=0,xo=0,ua=null,zk=0;function zt(){throw Error(s(321))}function rh(r,i){if(i===null)return!1;for(var h=0;h<i.length&&h<r.length;h++)if(!In(r[h],i[h]))return!1;return!0}function sh(r,i,h,g,C,j){return Vr=j,qe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=r===null||r.memoizedState===null?e_:yh,ci=!1,j=h(g,C),ci=!1,ca&&(j=yx(i,h,g,C)),_x(r),j}function _x(r){H.H=vo;var i=yt!==null&&yt.next!==null;if(Vr=0,Kt=yt=qe=null,tc=!1,xo=0,ua=null,i)throw Error(s(300));r===null||Yt||(r=r.dependencies,r!==null&&Wl(r)&&(Yt=!0))}function yx(r,i,h,g){qe=r;var C=0;do{if(ca&&(ua=null),xo=0,ca=!1,25<=C)throw Error(s(301));if(C+=1,Kt=yt=null,r.updateQueue!=null){var j=r.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}H.H=t_,j=i(h,g)}while(ca);return j}function Hk(){var r=H.H,i=r.useState()[0];return i=typeof i.then=="function"?_o(i):i,r=r.useState()[0],(yt!==null?yt.memoizedState:null)!==r&&(qe.flags|=1024),i}function ih(){var r=nc!==0;return nc=0,r}function ah(r,i,h){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~h}function oh(r){if(tc){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}tc=!1}Vr=0,Kt=yt=qe=null,ca=!1,xo=nc=0,ua=null}function Sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?qe.memoizedState=Kt=r:Kt=Kt.next=r,Kt}function Vt(){if(yt===null){var r=qe.alternate;r=r!==null?r.memoizedState:null}else r=yt.next;var i=Kt===null?qe.memoizedState:Kt.next;if(i!==null)Kt=i,yt=r;else{if(r===null)throw qe.alternate===null?Error(s(467)):Error(s(310));yt=r,r={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Kt===null?qe.memoizedState=Kt=r:Kt=Kt.next=r}return Kt}function rc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _o(r){var i=xo;return xo+=1,ua===null&&(ua=[]),r=cx(ua,r,i),i=qe,(Kt===null?i.memoizedState:Kt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?e_:yh),r}function sc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return _o(r);if(r.$$typeof===b)return hn(r)}throw Error(s(438,String(r)))}function lh(r){var i=null,h=qe.updateQueue;if(h!==null&&(i=h.memoCache),i==null){var g=qe.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(i={data:g.data.map(function(C){return C.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),h===null&&(h=rc(),qe.updateQueue=h),h.memoCache=i,h=i.data[i.index],h===void 0)for(h=i.data[i.index]=Array(r),g=0;g<r;g++)h[g]=D;return i.index++,h}function Gr(r,i){return typeof i=="function"?i(r):i}function ic(r){var i=Vt();return ch(i,yt,r)}function ch(r,i,h){var g=r.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=h;var C=r.baseQueue,j=g.pending;if(j!==null){if(C!==null){var I=C.next;C.next=j.next,j.next=I}i.baseQueue=C=j,g.pending=null}if(j=r.baseState,C===null)r.memoizedState=j;else{i=C.next;var q=I=null,ne=null,le=i,pe=!1;do{var be=le.lane&-536870913;if(be!==le.lane?(st&be)===be:(Vr&be)===be){var ce=le.revertLane;if(ce===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),be===sa&&(pe=!0);else if((Vr&ce)===ce){le=le.next,ce===sa&&(pe=!0);continue}else be={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},ne===null?(q=ne=be,I=j):ne=ne.next=be,qe.lanes|=ce,ks|=ce;be=le.action,ci&&h(j,be),j=le.hasEagerState?le.eagerState:h(j,be)}else ce={lane:be,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},ne===null?(q=ne=ce,I=j):ne=ne.next=ce,qe.lanes|=be,ks|=be;le=le.next}while(le!==null&&le!==i);if(ne===null?I=j:ne.next=q,!In(j,r.memoizedState)&&(Yt=!0,pe&&(h=ia,h!==null)))throw h;r.memoizedState=j,r.baseState=I,r.baseQueue=ne,g.lastRenderedState=j}return C===null&&(g.lanes=0),[r.memoizedState,g.dispatch]}function uh(r){var i=Vt(),h=i.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=r;var g=h.dispatch,C=h.pending,j=i.memoizedState;if(C!==null){h.pending=null;var I=C=C.next;do j=r(j,I.action),I=I.next;while(I!==C);In(j,i.memoizedState)||(Yt=!0),i.memoizedState=j,i.baseQueue===null&&(i.baseState=j),h.lastRenderedState=j}return[j,g]}function vx(r,i,h){var g=qe,C=Vt(),j=at;if(j){if(h===void 0)throw Error(s(407));h=h()}else h=i();var I=!In((yt||C).memoizedState,h);if(I&&(C.memoizedState=h,Yt=!0),C=C.queue,fh(wx.bind(null,g,C,r),[r]),C.getSnapshot!==i||I||Kt!==null&&Kt.memoizedState.tag&1){if(g.flags|=2048,da(9,{destroy:void 0},Sx.bind(null,g,C,h,i),null),wt===null)throw Error(s(349));j||(Vr&127)!==0||bx(g,i,h)}return h}function bx(r,i,h){r.flags|=16384,r={getSnapshot:i,value:h},i=qe.updateQueue,i===null?(i=rc(),qe.updateQueue=i,i.stores=[r]):(h=i.stores,h===null?i.stores=[r]:h.push(r))}function Sx(r,i,h,g){i.value=h,i.getSnapshot=g,Cx(i)&&kx(r)}function wx(r,i,h){return h(function(){Cx(i)&&kx(r)})}function Cx(r){var i=r.getSnapshot;r=r.value;try{var h=i();return!In(r,h)}catch{return!0}}function kx(r){var i=ei(r,2);i!==null&&Ln(i,r,2)}function dh(r){var i=Sn();if(typeof r=="function"){var h=r;if(r=h(),ci){gn(!0);try{h()}finally{gn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gr,lastRenderedState:r},i}function Ex(r,i,h,g){return r.baseState=h,ch(r,yt,typeof g=="function"?g:Gr)}function $k(r,i,h,g,C){if(lc(r))throw Error(s(485));if(r=i.action,r!==null){var j={payload:C,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){j.listeners.push(I)}};H.T!==null?h(!0):j.isTransition=!1,g(j),h=i.pending,h===null?(j.next=i.pending=j,jx(i,j)):(j.next=h.next,i.pending=h.next=j)}}function jx(r,i){var h=i.action,g=i.payload,C=r.state;if(i.isTransition){var j=H.T,I={};H.T=I;try{var q=h(C,g),ne=H.S;ne!==null&&ne(I,q),Tx(r,i,q)}catch(le){hh(r,i,le)}finally{j!==null&&I.types!==null&&(j.types=I.types),H.T=j}}else try{j=h(C,g),Tx(r,i,j)}catch(le){hh(r,i,le)}}function Tx(r,i,h){h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(function(g){Nx(r,i,g)},function(g){return hh(r,i,g)}):Nx(r,i,h)}function Nx(r,i,h){i.status="fulfilled",i.value=h,Ax(i),r.state=h,i=r.pending,i!==null&&(h=i.next,h===i?r.pending=null:(h=h.next,i.next=h,jx(r,h)))}function hh(r,i,h){var g=r.pending;if(r.pending=null,g!==null){g=g.next;do i.status="rejected",i.reason=h,Ax(i),i=i.next;while(i!==g)}r.action=null}function Ax(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Lx(r,i){return i}function Dx(r,i){if(at){var h=wt.formState;if(h!==null){e:{var g=qe;if(at){if(Dt){t:{for(var C=Dt,j=er;C.nodeType!==8;){if(!j){C=null;break t}if(C=nr(C.nextSibling),C===null){C=null;break t}}j=C.data,C=j==="F!"||j==="F"?C:null}if(C){Dt=nr(C.nextSibling),g=C.data==="F!";break e}}gs(g)}g=!1}g&&(i=h[0])}}return h=Sn(),h.memoizedState=h.baseState=i,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lx,lastRenderedState:i},h.queue=g,h=Qx.bind(null,qe,g),g.dispatch=h,g=dh(!1),j=_h.bind(null,qe,!1,g.queue),g=Sn(),C={state:i,dispatch:null,action:r,pending:null},g.queue=C,h=$k.bind(null,qe,C,j,h),C.dispatch=h,g.memoizedState=r,[i,h,!1]}function Rx(r){var i=Vt();return Ox(i,yt,r)}function Ox(r,i,h){if(i=ch(r,i,Lx)[0],r=ic(Gr)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var g=_o(i)}catch(I){throw I===aa?Yl:I}else g=i;i=Vt();var C=i.queue,j=C.dispatch;return h!==i.memoizedState&&(qe.flags|=2048,da(9,{destroy:void 0},Uk.bind(null,C,h),null)),[g,j,r]}function Uk(r,i){r.action=i}function Mx(r){var i=Vt(),h=yt;if(h!==null)return Ox(i,h,r);Vt(),i=i.memoizedState,h=Vt();var g=h.queue.dispatch;return h.memoizedState=r,[i,g,!1]}function da(r,i,h,g){return r={tag:r,create:h,deps:g,inst:i,next:null},i=qe.updateQueue,i===null&&(i=rc(),qe.updateQueue=i),h=i.lastEffect,h===null?i.lastEffect=r.next=r:(g=h.next,h.next=r,r.next=g,i.lastEffect=r),r}function Ix(){return Vt().memoizedState}function ac(r,i,h,g){var C=Sn();qe.flags|=r,C.memoizedState=da(1|i,{destroy:void 0},h,g===void 0?null:g)}function oc(r,i,h,g){var C=Vt();g=g===void 0?null:g;var j=C.memoizedState.inst;yt!==null&&g!==null&&rh(g,yt.memoizedState.deps)?C.memoizedState=da(i,j,h,g):(qe.flags|=r,C.memoizedState=da(1|i,j,h,g))}function Px(r,i){ac(8390656,8,r,i)}function fh(r,i){oc(2048,8,r,i)}function Fk(r){qe.flags|=4;var i=qe.updateQueue;if(i===null)i=rc(),qe.updateQueue=i,i.events=[r];else{var h=i.events;h===null?i.events=[r]:h.push(r)}}function Bx(r){var i=Vt().memoizedState;return Fk({ref:i,nextImpl:r}),function(){if((mt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function zx(r,i){return oc(4,2,r,i)}function Hx(r,i){return oc(4,4,r,i)}function $x(r,i){if(typeof i=="function"){r=r();var h=i(r);return function(){typeof h=="function"?h():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function Ux(r,i,h){h=h!=null?h.concat([r]):null,oc(4,4,$x.bind(null,i,r),h)}function mh(){}function Fx(r,i){var h=Vt();i=i===void 0?null:i;var g=h.memoizedState;return i!==null&&rh(i,g[1])?g[0]:(h.memoizedState=[r,i],r)}function Vx(r,i){var h=Vt();i=i===void 0?null:i;var g=h.memoizedState;if(i!==null&&rh(i,g[1]))return g[0];if(g=r(),ci){gn(!0);try{r()}finally{gn(!1)}}return h.memoizedState=[g,i],g}function ph(r,i,h){return h===void 0||(Vr&1073741824)!==0&&(st&261930)===0?r.memoizedState=i:(r.memoizedState=h,r=G_(),qe.lanes|=r,ks|=r,h)}function Gx(r,i,h,g){return In(h,i)?h:la.current!==null?(r=ph(r,h,g),In(r,i)||(Yt=!0),r):(Vr&42)===0||(Vr&1073741824)!==0&&(st&261930)===0?(Yt=!0,r.memoizedState=h):(r=G_(),qe.lanes|=r,ks|=r,i)}function Wx(r,i,h,g,C){var j=K.p;K.p=j!==0&&8>j?j:8;var I=H.T,q={};H.T=q,_h(r,!1,i,h);try{var ne=C(),le=H.S;if(le!==null&&le(q,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var pe=Bk(ne,g);yo(r,i,pe,Un(r))}else yo(r,i,g,Un(r))}catch(be){yo(r,i,{then:function(){},status:"rejected",reason:be},Un())}finally{K.p=j,I!==null&&q.types!==null&&(I.types=q.types),H.T=I}}function Vk(){}function gh(r,i,h,g){if(r.tag!==5)throw Error(s(476));var C=qx(r).queue;Wx(r,C,i,X,h===null?Vk:function(){return Kx(r),h(g)})}function qx(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gr,lastRenderedState:X},next:null};var h={};return i.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gr,lastRenderedState:h},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function Kx(r){var i=qx(r);i.next===null&&(i=r.alternate.memoizedState),yo(r,i.next.queue,{},Un())}function xh(){return hn(Io)}function Yx(){return Vt().memoizedState}function Xx(){return Vt().memoizedState}function Gk(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var h=Un();r=ys(h);var g=vs(i,r,h);g!==null&&(Ln(g,i,h),mo(g,i,h)),i={cache:Wd()},r.payload=i;return}i=i.return}}function Wk(r,i,h){var g=Un();h={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},lc(r)?Jx(i,h):(h=Md(r,i,h,g),h!==null&&(Ln(h,r,g),Zx(h,i,g)))}function Qx(r,i,h){var g=Un();yo(r,i,h,g)}function yo(r,i,h,g){var C={lane:g,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(lc(r))Jx(i,C);else{var j=r.alternate;if(r.lanes===0&&(j===null||j.lanes===0)&&(j=i.lastRenderedReducer,j!==null))try{var I=i.lastRenderedState,q=j(I,h);if(C.hasEagerState=!0,C.eagerState=q,In(q,I))return Ul(r,i,C,0),wt===null&&$l(),!1}catch{}finally{}if(h=Md(r,i,C,g),h!==null)return Ln(h,r,g),Zx(h,i,g),!0}return!1}function _h(r,i,h,g){if(g={lane:2,revertLane:Xh(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},lc(r)){if(i)throw Error(s(479))}else i=Md(r,h,g,2),i!==null&&Ln(i,r,2)}function lc(r){var i=r.alternate;return r===qe||i!==null&&i===qe}function Jx(r,i){ca=tc=!0;var h=r.pending;h===null?i.next=i:(i.next=h.next,h.next=i),r.pending=i}function Zx(r,i,h){if((h&4194048)!==0){var g=i.lanes;g&=r.pendingLanes,h|=g,i.lanes=h,Ne(r,h)}}var vo={readContext:hn,use:sc,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useLayoutEffect:zt,useInsertionEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useSyncExternalStore:zt,useId:zt,useHostTransitionStatus:zt,useFormState:zt,useActionState:zt,useOptimistic:zt,useMemoCache:zt,useCacheRefresh:zt};vo.useEffectEvent=zt;var e_={readContext:hn,use:sc,useCallback:function(r,i){return Sn().memoizedState=[r,i===void 0?null:i],r},useContext:hn,useEffect:Px,useImperativeHandle:function(r,i,h){h=h!=null?h.concat([r]):null,ac(4194308,4,$x.bind(null,i,r),h)},useLayoutEffect:function(r,i){return ac(4194308,4,r,i)},useInsertionEffect:function(r,i){ac(4,2,r,i)},useMemo:function(r,i){var h=Sn();i=i===void 0?null:i;var g=r();if(ci){gn(!0);try{r()}finally{gn(!1)}}return h.memoizedState=[g,i],g},useReducer:function(r,i,h){var g=Sn();if(h!==void 0){var C=h(i);if(ci){gn(!0);try{h(i)}finally{gn(!1)}}}else C=i;return g.memoizedState=g.baseState=C,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:C},g.queue=r,r=r.dispatch=Wk.bind(null,qe,r),[g.memoizedState,r]},useRef:function(r){var i=Sn();return r={current:r},i.memoizedState=r},useState:function(r){r=dh(r);var i=r.queue,h=Qx.bind(null,qe,i);return i.dispatch=h,[r.memoizedState,h]},useDebugValue:mh,useDeferredValue:function(r,i){var h=Sn();return ph(h,r,i)},useTransition:function(){var r=dh(!1);return r=Wx.bind(null,qe,r.queue,!0,!1),Sn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,h){var g=qe,C=Sn();if(at){if(h===void 0)throw Error(s(407));h=h()}else{if(h=i(),wt===null)throw Error(s(349));(st&127)!==0||bx(g,i,h)}C.memoizedState=h;var j={value:h,getSnapshot:i};return C.queue=j,Px(wx.bind(null,g,j,r),[r]),g.flags|=2048,da(9,{destroy:void 0},Sx.bind(null,g,j,h,i),null),h},useId:function(){var r=Sn(),i=wt.identifierPrefix;if(at){var h=Cr,g=wr;h=(g&~(1<<32-pt(g)-1)).toString(32)+h,i="_"+i+"R_"+h,h=nc++,0<h&&(i+="H"+h.toString(32)),i+="_"}else h=zk++,i="_"+i+"r_"+h.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:xh,useFormState:Dx,useActionState:Dx,useOptimistic:function(r){var i=Sn();i.memoizedState=i.baseState=r;var h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=h,i=_h.bind(null,qe,!0,h),h.dispatch=i,[r,i]},useMemoCache:lh,useCacheRefresh:function(){return Sn().memoizedState=Gk.bind(null,qe)},useEffectEvent:function(r){var i=Sn(),h={impl:r};return i.memoizedState=h,function(){if((mt&2)!==0)throw Error(s(440));return h.impl.apply(void 0,arguments)}}},yh={readContext:hn,use:sc,useCallback:Fx,useContext:hn,useEffect:fh,useImperativeHandle:Ux,useInsertionEffect:zx,useLayoutEffect:Hx,useMemo:Vx,useReducer:ic,useRef:Ix,useState:function(){return ic(Gr)},useDebugValue:mh,useDeferredValue:function(r,i){var h=Vt();return Gx(h,yt.memoizedState,r,i)},useTransition:function(){var r=ic(Gr)[0],i=Vt().memoizedState;return[typeof r=="boolean"?r:_o(r),i]},useSyncExternalStore:vx,useId:Yx,useHostTransitionStatus:xh,useFormState:Rx,useActionState:Rx,useOptimistic:function(r,i){var h=Vt();return Ex(h,yt,r,i)},useMemoCache:lh,useCacheRefresh:Xx};yh.useEffectEvent=Bx;var t_={readContext:hn,use:sc,useCallback:Fx,useContext:hn,useEffect:fh,useImperativeHandle:Ux,useInsertionEffect:zx,useLayoutEffect:Hx,useMemo:Vx,useReducer:uh,useRef:Ix,useState:function(){return uh(Gr)},useDebugValue:mh,useDeferredValue:function(r,i){var h=Vt();return yt===null?ph(h,r,i):Gx(h,yt.memoizedState,r,i)},useTransition:function(){var r=uh(Gr)[0],i=Vt().memoizedState;return[typeof r=="boolean"?r:_o(r),i]},useSyncExternalStore:vx,useId:Yx,useHostTransitionStatus:xh,useFormState:Mx,useActionState:Mx,useOptimistic:function(r,i){var h=Vt();return yt!==null?Ex(h,yt,r,i):(h.baseState=r,[r,h.queue.dispatch])},useMemoCache:lh,useCacheRefresh:Xx};t_.useEffectEvent=Bx;function vh(r,i,h,g){i=r.memoizedState,h=h(g,i),h=h==null?i:m({},i,h),r.memoizedState=h,r.lanes===0&&(r.updateQueue.baseState=h)}var bh={enqueueSetState:function(r,i,h){r=r._reactInternals;var g=Un(),C=ys(g);C.payload=i,h!=null&&(C.callback=h),i=vs(r,C,g),i!==null&&(Ln(i,r,g),mo(i,r,g))},enqueueReplaceState:function(r,i,h){r=r._reactInternals;var g=Un(),C=ys(g);C.tag=1,C.payload=i,h!=null&&(C.callback=h),i=vs(r,C,g),i!==null&&(Ln(i,r,g),mo(i,r,g))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var h=Un(),g=ys(h);g.tag=2,i!=null&&(g.callback=i),i=vs(r,g,h),i!==null&&(Ln(i,r,h),mo(i,r,h))}};function n_(r,i,h,g,C,j,I){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,j,I):i.prototype&&i.prototype.isPureReactComponent?!io(h,g)||!io(C,j):!0}function r_(r,i,h,g){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(h,g),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(h,g),i.state!==r&&bh.enqueueReplaceState(i,i.state,null)}function ui(r,i){var h=i;if("ref"in i){h={};for(var g in i)g!=="ref"&&(h[g]=i[g])}if(r=r.defaultProps){h===i&&(h=m({},h));for(var C in r)h[C]===void 0&&(h[C]=r[C])}return h}function s_(r){Hl(r)}function i_(r){console.error(r)}function a_(r){Hl(r)}function cc(r,i){try{var h=r.onUncaughtError;h(i.value,{componentStack:i.stack})}catch(g){setTimeout(function(){throw g})}}function o_(r,i,h){try{var g=r.onCaughtError;g(h.value,{componentStack:h.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function Sh(r,i,h){return h=ys(h),h.tag=3,h.payload={element:null},h.callback=function(){cc(r,i)},h}function l_(r){return r=ys(r),r.tag=3,r}function c_(r,i,h,g){var C=h.type.getDerivedStateFromError;if(typeof C=="function"){var j=g.value;r.payload=function(){return C(j)},r.callback=function(){o_(i,h,g)}}var I=h.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(r.callback=function(){o_(i,h,g),typeof C!="function"&&(Es===null?Es=new Set([this]):Es.add(this));var q=g.stack;this.componentDidCatch(g.value,{componentStack:q!==null?q:""})})}function qk(r,i,h,g,C){if(h.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(i=h.alternate,i!==null&&ra(i,h,C,!0),h=Bn.current,h!==null){switch(h.tag){case 31:case 13:return tr===null?bc():h.alternate===null&&Ht===0&&(Ht=3),h.flags&=-257,h.flags|=65536,h.lanes=C,g===Xl?h.flags|=16384:(i=h.updateQueue,i===null?h.updateQueue=new Set([g]):i.add(g),qh(r,g,C)),!1;case 22:return h.flags|=65536,g===Xl?h.flags|=16384:(i=h.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([g])},h.updateQueue=i):(h=i.retryQueue,h===null?i.retryQueue=new Set([g]):h.add(g)),qh(r,g,C)),!1}throw Error(s(435,h.tag))}return qh(r,g,C),bc(),!1}if(at)return i=Bn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=C,g!==$d&&(r=Error(s(422),{cause:g}),lo(Qn(r,h)))):(g!==$d&&(i=Error(s(423),{cause:g}),lo(Qn(i,h))),r=r.current.alternate,r.flags|=65536,C&=-C,r.lanes|=C,g=Qn(g,h),C=Sh(r.stateNode,g,C),Jd(r,C),Ht!==4&&(Ht=2)),!1;var j=Error(s(520),{cause:g});if(j=Qn(j,h),To===null?To=[j]:To.push(j),Ht!==4&&(Ht=2),i===null)return!0;g=Qn(g,h),h=i;do{switch(h.tag){case 3:return h.flags|=65536,r=C&-C,h.lanes|=r,r=Sh(h.stateNode,g,r),Jd(h,r),!1;case 1:if(i=h.type,j=h.stateNode,(h.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(Es===null||!Es.has(j))))return h.flags|=65536,C&=-C,h.lanes|=C,C=l_(C),c_(C,r,h,g),Jd(h,C),!1}h=h.return}while(h!==null);return!1}var wh=Error(s(461)),Yt=!1;function fn(r,i,h,g){i.child=r===null?fx(i,null,h,g):li(i,r.child,h,g)}function u_(r,i,h,g,C){h=h.render;var j=i.ref;if("ref"in g){var I={};for(var q in g)q!=="ref"&&(I[q]=g[q])}else I=g;return si(i),g=sh(r,i,h,I,j,C),q=ih(),r!==null&&!Yt?(ah(r,i,C),Wr(r,i,C)):(at&&q&&zd(i),i.flags|=1,fn(r,i,g,C),i.child)}function d_(r,i,h,g,C){if(r===null){var j=h.type;return typeof j=="function"&&!Id(j)&&j.defaultProps===void 0&&h.compare===null?(i.tag=15,i.type=j,h_(r,i,j,g,C)):(r=Vl(h.type,null,g,i,i.mode,C),r.ref=i.ref,r.return=i,i.child=r)}if(j=r.child,!Lh(r,C)){var I=j.memoizedProps;if(h=h.compare,h=h!==null?h:io,h(I,g)&&r.ref===i.ref)return Wr(r,i,C)}return i.flags|=1,r=Hr(j,g),r.ref=i.ref,r.return=i,i.child=r}function h_(r,i,h,g,C){if(r!==null){var j=r.memoizedProps;if(io(j,g)&&r.ref===i.ref)if(Yt=!1,i.pendingProps=g=j,Lh(r,C))(r.flags&131072)!==0&&(Yt=!0);else return i.lanes=r.lanes,Wr(r,i,C)}return Ch(r,i,h,g,C)}function f_(r,i,h,g){var C=g.children,j=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((i.flags&128)!==0){if(j=j!==null?j.baseLanes|h:h,r!==null){for(g=i.child=r.child,C=0;g!==null;)C=C|g.lanes|g.childLanes,g=g.sibling;g=C&~j}else g=0,i.child=null;return m_(r,i,j,h,g)}if((h&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Kl(i,j!==null?j.cachePool:null),j!==null?gx(i,j):eh(),xx(i);else return g=i.lanes=536870912,m_(r,i,j!==null?j.baseLanes|h:h,h,g)}else j!==null?(Kl(i,j.cachePool),gx(i,j),Ss(),i.memoizedState=null):(r!==null&&Kl(i,null),eh(),Ss());return fn(r,i,C,h),i.child}function bo(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function m_(r,i,h,g,C){var j=Kd();return j=j===null?null:{parent:qt._currentValue,pool:j},i.memoizedState={baseLanes:h,cachePool:j},r!==null&&Kl(i,null),eh(),xx(i),r!==null&&ra(r,i,g,!0),i.childLanes=C,null}function uc(r,i){return i=hc({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function p_(r,i,h){return li(i,r.child,null,h),r=uc(i,i.pendingProps),r.flags|=2,zn(i),i.memoizedState=null,r}function Kk(r,i,h){var g=i.pendingProps,C=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(at){if(g.mode==="hidden")return r=uc(i,g),i.lanes=536870912,bo(null,r);if(nh(i),(r=Dt)?(r=jy(r,er),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ms!==null?{id:wr,overflow:Cr}:null,retryLane:536870912,hydrationErrors:null},h=Jg(r),h.return=i,i.child=h,dn=i,Dt=null)):r=null,r===null)throw gs(i);return i.lanes=536870912,null}return uc(i,g)}var j=r.memoizedState;if(j!==null){var I=j.dehydrated;if(nh(i),C)if(i.flags&256)i.flags&=-257,i=p_(r,i,h);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(Yt||ra(r,i,h,!1),C=(h&r.childLanes)!==0,Yt||C){if(g=wt,g!==null&&(I=ze(g,h),I!==0&&I!==j.retryLane))throw j.retryLane=I,ei(r,I),Ln(g,r,I),wh;bc(),i=p_(r,i,h)}else r=j.treeContext,Dt=nr(I.nextSibling),dn=i,at=!0,ps=null,er=!1,r!==null&&tx(i,r),i=uc(i,g),i.flags|=4096;return i}return r=Hr(r.child,{mode:g.mode,children:g.children}),r.ref=i.ref,i.child=r,r.return=i,r}function dc(r,i){var h=i.ref;if(h===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof h!="function"&&typeof h!="object")throw Error(s(284));(r===null||r.ref!==h)&&(i.flags|=4194816)}}function Ch(r,i,h,g,C){return si(i),h=sh(r,i,h,g,void 0,C),g=ih(),r!==null&&!Yt?(ah(r,i,C),Wr(r,i,C)):(at&&g&&zd(i),i.flags|=1,fn(r,i,h,C),i.child)}function g_(r,i,h,g,C,j){return si(i),i.updateQueue=null,h=yx(i,g,h,C),_x(r),g=ih(),r!==null&&!Yt?(ah(r,i,j),Wr(r,i,j)):(at&&g&&zd(i),i.flags|=1,fn(r,i,h,j),i.child)}function x_(r,i,h,g,C){if(si(i),i.stateNode===null){var j=Zi,I=h.contextType;typeof I=="object"&&I!==null&&(j=hn(I)),j=new h(g,j),i.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=bh,i.stateNode=j,j._reactInternals=i,j=i.stateNode,j.props=g,j.state=i.memoizedState,j.refs={},Xd(i),I=h.contextType,j.context=typeof I=="object"&&I!==null?hn(I):Zi,j.state=i.memoizedState,I=h.getDerivedStateFromProps,typeof I=="function"&&(vh(i,h,I,g),j.state=i.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(I=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),I!==j.state&&bh.enqueueReplaceState(j,j.state,null),go(i,g,j,C),po(),j.state=i.memoizedState),typeof j.componentDidMount=="function"&&(i.flags|=4194308),g=!0}else if(r===null){j=i.stateNode;var q=i.memoizedProps,ne=ui(h,q);j.props=ne;var le=j.context,pe=h.contextType;I=Zi,typeof pe=="object"&&pe!==null&&(I=hn(pe));var be=h.getDerivedStateFromProps;pe=typeof be=="function"||typeof j.getSnapshotBeforeUpdate=="function",q=i.pendingProps!==q,pe||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(q||le!==I)&&r_(i,j,g,I),_s=!1;var ce=i.memoizedState;j.state=ce,go(i,g,j,C),po(),le=i.memoizedState,q||ce!==le||_s?(typeof be=="function"&&(vh(i,h,be,g),le=i.memoizedState),(ne=_s||n_(i,h,ne,g,ce,le,I))?(pe||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(i.flags|=4194308)):(typeof j.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=g,i.memoizedState=le),j.props=g,j.state=le,j.context=I,g=ne):(typeof j.componentDidMount=="function"&&(i.flags|=4194308),g=!1)}else{j=i.stateNode,Qd(r,i),I=i.memoizedProps,pe=ui(h,I),j.props=pe,be=i.pendingProps,ce=j.context,le=h.contextType,ne=Zi,typeof le=="object"&&le!==null&&(ne=hn(le)),q=h.getDerivedStateFromProps,(le=typeof q=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(I!==be||ce!==ne)&&r_(i,j,g,ne),_s=!1,ce=i.memoizedState,j.state=ce,go(i,g,j,C),po();var ue=i.memoizedState;I!==be||ce!==ue||_s||r!==null&&r.dependencies!==null&&Wl(r.dependencies)?(typeof q=="function"&&(vh(i,h,q,g),ue=i.memoizedState),(pe=_s||n_(i,h,pe,g,ce,ue,ne)||r!==null&&r.dependencies!==null&&Wl(r.dependencies))?(le||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(g,ue,ne),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(g,ue,ne)),typeof j.componentDidUpdate=="function"&&(i.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof j.componentDidUpdate!="function"||I===r.memoizedProps&&ce===r.memoizedState||(i.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ce===r.memoizedState||(i.flags|=1024),i.memoizedProps=g,i.memoizedState=ue),j.props=g,j.state=ue,j.context=ne,g=pe):(typeof j.componentDidUpdate!="function"||I===r.memoizedProps&&ce===r.memoizedState||(i.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ce===r.memoizedState||(i.flags|=1024),g=!1)}return j=g,dc(r,i),g=(i.flags&128)!==0,j||g?(j=i.stateNode,h=g&&typeof h.getDerivedStateFromError!="function"?null:j.render(),i.flags|=1,r!==null&&g?(i.child=li(i,r.child,null,C),i.child=li(i,null,h,C)):fn(r,i,h,C),i.memoizedState=j.state,r=i.child):r=Wr(r,i,C),r}function __(r,i,h,g){return ni(),i.flags|=256,fn(r,i,h,g),i.child}var kh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Eh(r){return{baseLanes:r,cachePool:ox()}}function jh(r,i,h){return r=r!==null?r.childLanes&~h:0,i&&(r|=$n),r}function y_(r,i,h){var g=i.pendingProps,C=!1,j=(i.flags&128)!==0,I;if((I=j)||(I=r!==null&&r.memoizedState===null?!1:(Ft.current&2)!==0),I&&(C=!0,i.flags&=-129),I=(i.flags&32)!==0,i.flags&=-33,r===null){if(at){if(C?bs(i):Ss(),(r=Dt)?(r=jy(r,er),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ms!==null?{id:wr,overflow:Cr}:null,retryLane:536870912,hydrationErrors:null},h=Jg(r),h.return=i,i.child=h,dn=i,Dt=null)):r=null,r===null)throw gs(i);return uf(r)?i.lanes=32:i.lanes=536870912,null}var q=g.children;return g=g.fallback,C?(Ss(),C=i.mode,q=hc({mode:"hidden",children:q},C),g=ti(g,C,h,null),q.return=i,g.return=i,q.sibling=g,i.child=q,g=i.child,g.memoizedState=Eh(h),g.childLanes=jh(r,I,h),i.memoizedState=kh,bo(null,g)):(bs(i),Th(i,q))}var ne=r.memoizedState;if(ne!==null&&(q=ne.dehydrated,q!==null)){if(j)i.flags&256?(bs(i),i.flags&=-257,i=Nh(r,i,h)):i.memoizedState!==null?(Ss(),i.child=r.child,i.flags|=128,i=null):(Ss(),q=g.fallback,C=i.mode,g=hc({mode:"visible",children:g.children},C),q=ti(q,C,h,null),q.flags|=2,g.return=i,q.return=i,g.sibling=q,i.child=g,li(i,r.child,null,h),g=i.child,g.memoizedState=Eh(h),g.childLanes=jh(r,I,h),i.memoizedState=kh,i=bo(null,g));else if(bs(i),uf(q)){if(I=q.nextSibling&&q.nextSibling.dataset,I)var le=I.dgst;I=le,g=Error(s(419)),g.stack="",g.digest=I,lo({value:g,source:null,stack:null}),i=Nh(r,i,h)}else if(Yt||ra(r,i,h,!1),I=(h&r.childLanes)!==0,Yt||I){if(I=wt,I!==null&&(g=ze(I,h),g!==0&&g!==ne.retryLane))throw ne.retryLane=g,ei(r,g),Ln(I,r,g),wh;cf(q)||bc(),i=Nh(r,i,h)}else cf(q)?(i.flags|=192,i.child=r.child,i=null):(r=ne.treeContext,Dt=nr(q.nextSibling),dn=i,at=!0,ps=null,er=!1,r!==null&&tx(i,r),i=Th(i,g.children),i.flags|=4096);return i}return C?(Ss(),q=g.fallback,C=i.mode,ne=r.child,le=ne.sibling,g=Hr(ne,{mode:"hidden",children:g.children}),g.subtreeFlags=ne.subtreeFlags&65011712,le!==null?q=Hr(le,q):(q=ti(q,C,h,null),q.flags|=2),q.return=i,g.return=i,g.sibling=q,i.child=g,bo(null,g),g=i.child,q=r.child.memoizedState,q===null?q=Eh(h):(C=q.cachePool,C!==null?(ne=qt._currentValue,C=C.parent!==ne?{parent:ne,pool:ne}:C):C=ox(),q={baseLanes:q.baseLanes|h,cachePool:C}),g.memoizedState=q,g.childLanes=jh(r,I,h),i.memoizedState=kh,bo(r.child,g)):(bs(i),h=r.child,r=h.sibling,h=Hr(h,{mode:"visible",children:g.children}),h.return=i,h.sibling=null,r!==null&&(I=i.deletions,I===null?(i.deletions=[r],i.flags|=16):I.push(r)),i.child=h,i.memoizedState=null,h)}function Th(r,i){return i=hc({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function hc(r,i){return r=Pn(22,r,null,i),r.lanes=0,r}function Nh(r,i,h){return li(i,r.child,null,h),r=Th(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function v_(r,i,h){r.lanes|=i;var g=r.alternate;g!==null&&(g.lanes|=i),Vd(r.return,i,h)}function Ah(r,i,h,g,C,j){var I=r.memoizedState;I===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:g,tail:h,tailMode:C,treeForkCount:j}:(I.isBackwards=i,I.rendering=null,I.renderingStartTime=0,I.last=g,I.tail=h,I.tailMode=C,I.treeForkCount=j)}function b_(r,i,h){var g=i.pendingProps,C=g.revealOrder,j=g.tail;g=g.children;var I=Ft.current,q=(I&2)!==0;if(q?(I=I&1|2,i.flags|=128):I&=1,$(Ft,I),fn(r,i,g,h),g=at?oo:0,!q&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&v_(r,h,i);else if(r.tag===19)v_(r,h,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(C){case"forwards":for(h=i.child,C=null;h!==null;)r=h.alternate,r!==null&&ec(r)===null&&(C=h),h=h.sibling;h=C,h===null?(C=i.child,i.child=null):(C=h.sibling,h.sibling=null),Ah(i,!1,C,h,j,g);break;case"backwards":case"unstable_legacy-backwards":for(h=null,C=i.child,i.child=null;C!==null;){if(r=C.alternate,r!==null&&ec(r)===null){i.child=C;break}r=C.sibling,C.sibling=h,h=C,C=r}Ah(i,!0,h,null,j,g);break;case"together":Ah(i,!1,null,null,void 0,g);break;default:i.memoizedState=null}return i.child}function Wr(r,i,h){if(r!==null&&(i.dependencies=r.dependencies),ks|=i.lanes,(h&i.childLanes)===0)if(r!==null){if(ra(r,i,h,!1),(h&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,h=Hr(r,r.pendingProps),i.child=h,h.return=i;r.sibling!==null;)r=r.sibling,h=h.sibling=Hr(r,r.pendingProps),h.return=i;h.sibling=null}return i.child}function Lh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Wl(r)))}function Yk(r,i,h){switch(i.tag){case 3:G(i,i.stateNode.containerInfo),xs(i,qt,r.memoizedState.cache),ni();break;case 27:case 5:se(i);break;case 4:G(i,i.stateNode.containerInfo);break;case 10:xs(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,nh(i),null;break;case 13:var g=i.memoizedState;if(g!==null)return g.dehydrated!==null?(bs(i),i.flags|=128,null):(h&i.child.childLanes)!==0?y_(r,i,h):(bs(i),r=Wr(r,i,h),r!==null?r.sibling:null);bs(i);break;case 19:var C=(r.flags&128)!==0;if(g=(h&i.childLanes)!==0,g||(ra(r,i,h,!1),g=(h&i.childLanes)!==0),C){if(g)return b_(r,i,h);i.flags|=128}if(C=i.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),$(Ft,Ft.current),g)break;return null;case 22:return i.lanes=0,f_(r,i,h,i.pendingProps);case 24:xs(i,qt,r.memoizedState.cache)}return Wr(r,i,h)}function S_(r,i,h){if(r!==null)if(r.memoizedProps!==i.pendingProps)Yt=!0;else{if(!Lh(r,h)&&(i.flags&128)===0)return Yt=!1,Yk(r,i,h);Yt=(r.flags&131072)!==0}else Yt=!1,at&&(i.flags&1048576)!==0&&ex(i,oo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var g=i.pendingProps;if(r=ai(i.elementType),i.type=r,typeof r=="function")Id(r)?(g=ui(r,g),i.tag=1,i=x_(null,i,r,g,h)):(i.tag=0,i=Ch(null,i,r,g,h));else{if(r!=null){var C=r.$$typeof;if(C===E){i.tag=11,i=u_(null,i,r,g,h);break e}else if(C===L){i.tag=14,i=d_(null,i,r,g,h);break e}}throw i=Y(r)||r,Error(s(306,i,""))}}return i;case 0:return Ch(r,i,i.type,i.pendingProps,h);case 1:return g=i.type,C=ui(g,i.pendingProps),x_(r,i,g,C,h);case 3:e:{if(G(i,i.stateNode.containerInfo),r===null)throw Error(s(387));g=i.pendingProps;var j=i.memoizedState;C=j.element,Qd(r,i),go(i,g,null,h);var I=i.memoizedState;if(g=I.cache,xs(i,qt,g),g!==j.cache&&Gd(i,[qt],h,!0),po(),g=I.element,j.isDehydrated)if(j={element:g,isDehydrated:!1,cache:I.cache},i.updateQueue.baseState=j,i.memoizedState=j,i.flags&256){i=__(r,i,g,h);break e}else if(g!==C){C=Qn(Error(s(424)),i),lo(C),i=__(r,i,g,h);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Dt=nr(r.firstChild),dn=i,at=!0,ps=null,er=!0,h=fx(i,null,g,h),i.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling}else{if(ni(),g===C){i=Wr(r,i,h);break e}fn(r,i,g,h)}i=i.child}return i;case 26:return dc(r,i),r===null?(h=Ry(i.type,null,i.pendingProps,null))?i.memoizedState=h:at||(h=i.type,r=i.pendingProps,g=Tc(re.current).createElement(h),g[gt]=i,g[kn]=r,mn(g,h,r),an(g),i.stateNode=g):i.memoizedState=Ry(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return se(i),r===null&&at&&(g=i.stateNode=Ay(i.type,i.pendingProps,re.current),dn=i,er=!0,C=Dt,As(i.type)?(df=C,Dt=nr(g.firstChild)):Dt=C),fn(r,i,i.pendingProps.children,h),dc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&at&&((C=g=Dt)&&(g=kE(g,i.type,i.pendingProps,er),g!==null?(i.stateNode=g,dn=i,Dt=nr(g.firstChild),er=!1,C=!0):C=!1),C||gs(i)),se(i),C=i.type,j=i.pendingProps,I=r!==null?r.memoizedProps:null,g=j.children,af(C,j)?g=null:I!==null&&af(C,I)&&(i.flags|=32),i.memoizedState!==null&&(C=sh(r,i,Hk,null,null,h),Io._currentValue=C),dc(r,i),fn(r,i,g,h),i.child;case 6:return r===null&&at&&((r=h=Dt)&&(h=EE(h,i.pendingProps,er),h!==null?(i.stateNode=h,dn=i,Dt=null,r=!0):r=!1),r||gs(i)),null;case 13:return y_(r,i,h);case 4:return G(i,i.stateNode.containerInfo),g=i.pendingProps,r===null?i.child=li(i,null,g,h):fn(r,i,g,h),i.child;case 11:return u_(r,i,i.type,i.pendingProps,h);case 7:return fn(r,i,i.pendingProps,h),i.child;case 8:return fn(r,i,i.pendingProps.children,h),i.child;case 12:return fn(r,i,i.pendingProps.children,h),i.child;case 10:return g=i.pendingProps,xs(i,i.type,g.value),fn(r,i,g.children,h),i.child;case 9:return C=i.type._context,g=i.pendingProps.children,si(i),C=hn(C),g=g(C),i.flags|=1,fn(r,i,g,h),i.child;case 14:return d_(r,i,i.type,i.pendingProps,h);case 15:return h_(r,i,i.type,i.pendingProps,h);case 19:return b_(r,i,h);case 31:return Kk(r,i,h);case 22:return f_(r,i,h,i.pendingProps);case 24:return si(i),g=hn(qt),r===null?(C=Kd(),C===null&&(C=wt,j=Wd(),C.pooledCache=j,j.refCount++,j!==null&&(C.pooledCacheLanes|=h),C=j),i.memoizedState={parent:g,cache:C},Xd(i),xs(i,qt,C)):((r.lanes&h)!==0&&(Qd(r,i),go(i,null,null,h),po()),C=r.memoizedState,j=i.memoizedState,C.parent!==g?(C={parent:g,cache:g},i.memoizedState=C,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=C),xs(i,qt,g)):(g=j.cache,xs(i,qt,g),g!==C.cache&&Gd(i,[qt],h,!0))),fn(r,i,i.pendingProps.children,h),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function qr(r){r.flags|=4}function Dh(r,i,h,g,C){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(C&335544128)===C)if(r.stateNode.complete)r.flags|=8192;else if(Y_())r.flags|=8192;else throw oi=Xl,Yd}else r.flags&=-16777217}function w_(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!By(i))if(Y_())r.flags|=8192;else throw oi=Xl,Yd}function fc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Nl():536870912,r.lanes|=i,pa|=i)}function So(r,i){if(!at)switch(r.tailMode){case"hidden":i=r.tail;for(var h=null;i!==null;)i.alternate!==null&&(h=i),i=i.sibling;h===null?r.tail=null:h.sibling=null;break;case"collapsed":h=r.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function Rt(r){var i=r.alternate!==null&&r.alternate.child===r.child,h=0,g=0;if(i)for(var C=r.child;C!==null;)h|=C.lanes|C.childLanes,g|=C.subtreeFlags&65011712,g|=C.flags&65011712,C.return=r,C=C.sibling;else for(C=r.child;C!==null;)h|=C.lanes|C.childLanes,g|=C.subtreeFlags,g|=C.flags,C.return=r,C=C.sibling;return r.subtreeFlags|=g,r.childLanes=h,i}function Xk(r,i,h){var g=i.pendingProps;switch(Hd(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(i),null;case 1:return Rt(i),null;case 3:return h=i.stateNode,g=null,r!==null&&(g=r.memoizedState.cache),i.memoizedState.cache!==g&&(i.flags|=2048),Fr(qt),te(),h.pendingContext&&(h.context=h.pendingContext,h.pendingContext=null),(r===null||r.child===null)&&(na(i)?qr(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ud())),Rt(i),null;case 26:var C=i.type,j=i.memoizedState;return r===null?(qr(i),j!==null?(Rt(i),w_(i,j)):(Rt(i),Dh(i,C,null,g,h))):j?j!==r.memoizedState?(qr(i),Rt(i),w_(i,j)):(Rt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==g&&qr(i),Rt(i),Dh(i,C,r,g,h)),null;case 27:if(_e(i),h=re.current,C=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==g&&qr(i);else{if(!g){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}r=ee.current,na(i)?nx(i):(r=Ay(C,g,h),i.stateNode=r,qr(i))}return Rt(i),null;case 5:if(_e(i),C=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==g&&qr(i);else{if(!g){if(i.stateNode===null)throw Error(s(166));return Rt(i),null}if(j=ee.current,na(i))nx(i);else{var I=Tc(re.current);switch(j){case 1:j=I.createElementNS("http://www.w3.org/2000/svg",C);break;case 2:j=I.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;default:switch(C){case"svg":j=I.createElementNS("http://www.w3.org/2000/svg",C);break;case"math":j=I.createElementNS("http://www.w3.org/1998/Math/MathML",C);break;case"script":j=I.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?j.multiple=!0:g.size&&(j.size=g.size);break;default:j=typeof g.is=="string"?I.createElement(C,{is:g.is}):I.createElement(C)}}j[gt]=i,j[kn]=g;e:for(I=i.child;I!==null;){if(I.tag===5||I.tag===6)j.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===i)break e;for(;I.sibling===null;){if(I.return===null||I.return===i)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}i.stateNode=j;e:switch(mn(j,C,g),C){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&qr(i)}}return Rt(i),Dh(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,h),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==g&&qr(i);else{if(typeof g!="string"&&i.stateNode===null)throw Error(s(166));if(r=re.current,na(i)){if(r=i.stateNode,h=i.memoizedProps,g=null,C=dn,C!==null)switch(C.tag){case 27:case 5:g=C.memoizedProps}r[gt]=i,r=!!(r.nodeValue===h||g!==null&&g.suppressHydrationWarning===!0||yy(r.nodeValue,h)),r||gs(i,!0)}else r=Tc(r).createTextNode(g),r[gt]=i,i.stateNode=r}return Rt(i),null;case 31:if(h=i.memoizedState,r===null||r.memoizedState!==null){if(g=na(i),h!==null){if(r===null){if(!g)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[gt]=i}else ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),r=!1}else h=Ud(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=h),r=!0;if(!r)return i.flags&256?(zn(i),i):(zn(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Rt(i),null;case 13:if(g=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(C=na(i),g!==null&&g.dehydrated!==null){if(r===null){if(!C)throw Error(s(318));if(C=i.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(s(317));C[gt]=i}else ni(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),C=!1}else C=Ud(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=C),C=!0;if(!C)return i.flags&256?(zn(i),i):(zn(i),null)}return zn(i),(i.flags&128)!==0?(i.lanes=h,i):(h=g!==null,r=r!==null&&r.memoizedState!==null,h&&(g=i.child,C=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(C=g.alternate.memoizedState.cachePool.pool),j=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(j=g.memoizedState.cachePool.pool),j!==C&&(g.flags|=2048)),h!==r&&h&&(i.child.flags|=8192),fc(i,i.updateQueue),Rt(i),null);case 4:return te(),r===null&&ef(i.stateNode.containerInfo),Rt(i),null;case 10:return Fr(i.type),Rt(i),null;case 19:if(V(Ft),g=i.memoizedState,g===null)return Rt(i),null;if(C=(i.flags&128)!==0,j=g.rendering,j===null)if(C)So(g,!1);else{if(Ht!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(j=ec(r),j!==null){for(i.flags|=128,So(g,!1),r=j.updateQueue,i.updateQueue=r,fc(i,r),i.subtreeFlags=0,r=h,h=i.child;h!==null;)Qg(h,r),h=h.sibling;return $(Ft,Ft.current&1|2),at&&$r(i,g.treeForkCount),i.child}r=r.sibling}g.tail!==null&&St()>_c&&(i.flags|=128,C=!0,So(g,!1),i.lanes=4194304)}else{if(!C)if(r=ec(j),r!==null){if(i.flags|=128,C=!0,r=r.updateQueue,i.updateQueue=r,fc(i,r),So(g,!0),g.tail===null&&g.tailMode==="hidden"&&!j.alternate&&!at)return Rt(i),null}else 2*St()-g.renderingStartTime>_c&&h!==536870912&&(i.flags|=128,C=!0,So(g,!1),i.lanes=4194304);g.isBackwards?(j.sibling=i.child,i.child=j):(r=g.last,r!==null?r.sibling=j:i.child=j,g.last=j)}return g.tail!==null?(r=g.tail,g.rendering=r,g.tail=r.sibling,g.renderingStartTime=St(),r.sibling=null,h=Ft.current,$(Ft,C?h&1|2:h&1),at&&$r(i,g.treeForkCount),r):(Rt(i),null);case 22:case 23:return zn(i),th(),g=i.memoizedState!==null,r!==null?r.memoizedState!==null!==g&&(i.flags|=8192):g&&(i.flags|=8192),g?(h&536870912)!==0&&(i.flags&128)===0&&(Rt(i),i.subtreeFlags&6&&(i.flags|=8192)):Rt(i),h=i.updateQueue,h!==null&&fc(i,h.retryQueue),h=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(h=r.memoizedState.cachePool.pool),g=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(g=i.memoizedState.cachePool.pool),g!==h&&(i.flags|=2048),r!==null&&V(ii),null;case 24:return h=null,r!==null&&(h=r.memoizedState.cache),i.memoizedState.cache!==h&&(i.flags|=2048),Fr(qt),Rt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function Qk(r,i){switch(Hd(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Fr(qt),te(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return _e(i),null;case 31:if(i.memoizedState!==null){if(zn(i),i.alternate===null)throw Error(s(340));ni()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(zn(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));ni()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return V(Ft),null;case 4:return te(),null;case 10:return Fr(i.type),null;case 22:case 23:return zn(i),th(),r!==null&&V(ii),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Fr(qt),null;case 25:return null;default:return null}}function C_(r,i){switch(Hd(i),i.tag){case 3:Fr(qt),te();break;case 26:case 27:case 5:_e(i);break;case 4:te();break;case 31:i.memoizedState!==null&&zn(i);break;case 13:zn(i);break;case 19:V(Ft);break;case 10:Fr(i.type);break;case 22:case 23:zn(i),th(),r!==null&&V(ii);break;case 24:Fr(qt)}}function wo(r,i){try{var h=i.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var C=g.next;h=C;do{if((h.tag&r)===r){g=void 0;var j=h.create,I=h.inst;g=j(),I.destroy=g}h=h.next}while(h!==C)}}catch(q){_t(i,i.return,q)}}function ws(r,i,h){try{var g=i.updateQueue,C=g!==null?g.lastEffect:null;if(C!==null){var j=C.next;g=j;do{if((g.tag&r)===r){var I=g.inst,q=I.destroy;if(q!==void 0){I.destroy=void 0,C=i;var ne=h,le=q;try{le()}catch(pe){_t(C,ne,pe)}}}g=g.next}while(g!==j)}}catch(pe){_t(i,i.return,pe)}}function k_(r){var i=r.updateQueue;if(i!==null){var h=r.stateNode;try{px(i,h)}catch(g){_t(r,r.return,g)}}}function E_(r,i,h){h.props=ui(r.type,r.memoizedProps),h.state=r.memoizedState;try{h.componentWillUnmount()}catch(g){_t(r,i,g)}}function Co(r,i){try{var h=r.ref;if(h!==null){switch(r.tag){case 26:case 27:case 5:var g=r.stateNode;break;case 30:g=r.stateNode;break;default:g=r.stateNode}typeof h=="function"?r.refCleanup=h(g):h.current=g}}catch(C){_t(r,i,C)}}function kr(r,i){var h=r.ref,g=r.refCleanup;if(h!==null)if(typeof g=="function")try{g()}catch(C){_t(r,i,C)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(C){_t(r,i,C)}else h.current=null}function j_(r){var i=r.type,h=r.memoizedProps,g=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":h.autoFocus&&g.focus();break e;case"img":h.src?g.src=h.src:h.srcSet&&(g.srcset=h.srcSet)}}catch(C){_t(r,r.return,C)}}function Rh(r,i,h){try{var g=r.stateNode;yE(g,r.type,h,i),g[kn]=i}catch(C){_t(r,r.return,C)}}function T_(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&As(r.type)||r.tag===4}function Oh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||T_(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&As(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Mh(r,i,h){var g=r.tag;if(g===5||g===6)r=r.stateNode,i?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(r,i):(i=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,i.appendChild(r),h=h._reactRootContainer,h!=null||i.onclick!==null||(i.onclick=Br));else if(g!==4&&(g===27&&As(r.type)&&(h=r.stateNode,i=null),r=r.child,r!==null))for(Mh(r,i,h),r=r.sibling;r!==null;)Mh(r,i,h),r=r.sibling}function mc(r,i,h){var g=r.tag;if(g===5||g===6)r=r.stateNode,i?h.insertBefore(r,i):h.appendChild(r);else if(g!==4&&(g===27&&As(r.type)&&(h=r.stateNode),r=r.child,r!==null))for(mc(r,i,h),r=r.sibling;r!==null;)mc(r,i,h),r=r.sibling}function N_(r){var i=r.stateNode,h=r.memoizedProps;try{for(var g=r.type,C=i.attributes;C.length;)i.removeAttributeNode(C[0]);mn(i,g,h),i[gt]=r,i[kn]=h}catch(j){_t(r,r.return,j)}}var Kr=!1,Xt=!1,Ih=!1,A_=typeof WeakSet=="function"?WeakSet:Set,on=null;function Jk(r,i){if(r=r.containerInfo,rf=Mc,r=Ug(r),Nd(r)){if("selectionStart"in r)var h={start:r.selectionStart,end:r.selectionEnd};else e:{h=(h=r.ownerDocument)&&h.defaultView||window;var g=h.getSelection&&h.getSelection();if(g&&g.rangeCount!==0){h=g.anchorNode;var C=g.anchorOffset,j=g.focusNode;g=g.focusOffset;try{h.nodeType,j.nodeType}catch{h=null;break e}var I=0,q=-1,ne=-1,le=0,pe=0,be=r,ce=null;t:for(;;){for(var ue;be!==h||C!==0&&be.nodeType!==3||(q=I+C),be!==j||g!==0&&be.nodeType!==3||(ne=I+g),be.nodeType===3&&(I+=be.nodeValue.length),(ue=be.firstChild)!==null;)ce=be,be=ue;for(;;){if(be===r)break t;if(ce===h&&++le===C&&(q=I),ce===j&&++pe===g&&(ne=I),(ue=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=ue}h=q===-1||ne===-1?null:{start:q,end:ne}}else h=null}h=h||{start:0,end:0}}else h=null;for(sf={focusedElem:r,selectionRange:h},Mc=!1,on=i;on!==null;)if(i=on,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,on=r;else for(;on!==null;){switch(i=on,j=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(h=0;h<r.length;h++)C=r[h],C.ref.impl=C.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&j!==null){r=void 0,h=i,C=j.memoizedProps,j=j.memoizedState,g=h.stateNode;try{var Le=ui(h.type,C);r=g.getSnapshotBeforeUpdate(Le,j),g.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){_t(h,h.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,h=r.nodeType,h===9)lf(r);else if(h===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":lf(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=i.sibling,r!==null){r.return=i.return,on=r;break}on=i.return}}function L_(r,i,h){var g=h.flags;switch(h.tag){case 0:case 11:case 15:Xr(r,h),g&4&&wo(5,h);break;case 1:if(Xr(r,h),g&4)if(r=h.stateNode,i===null)try{r.componentDidMount()}catch(I){_t(h,h.return,I)}else{var C=ui(h.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(C,i,r.__reactInternalSnapshotBeforeUpdate)}catch(I){_t(h,h.return,I)}}g&64&&k_(h),g&512&&Co(h,h.return);break;case 3:if(Xr(r,h),g&64&&(r=h.updateQueue,r!==null)){if(i=null,h.child!==null)switch(h.child.tag){case 27:case 5:i=h.child.stateNode;break;case 1:i=h.child.stateNode}try{px(r,i)}catch(I){_t(h,h.return,I)}}break;case 27:i===null&&g&4&&N_(h);case 26:case 5:Xr(r,h),i===null&&g&4&&j_(h),g&512&&Co(h,h.return);break;case 12:Xr(r,h);break;case 31:Xr(r,h),g&4&&O_(r,h);break;case 13:Xr(r,h),g&4&&M_(r,h),g&64&&(r=h.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(h=oE.bind(null,h),jE(r,h))));break;case 22:if(g=h.memoizedState!==null||Kr,!g){i=i!==null&&i.memoizedState!==null||Xt,C=Kr;var j=Xt;Kr=g,(Xt=i)&&!j?Qr(r,h,(h.subtreeFlags&8772)!==0):Xr(r,h),Kr=C,Xt=j}break;case 30:break;default:Xr(r,h)}}function D_(r){var i=r.alternate;i!==null&&(r.alternate=null,D_(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&hd(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var It=null,jn=!1;function Yr(r,i,h){for(h=h.child;h!==null;)R_(r,i,h),h=h.sibling}function R_(r,i,h){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(Lt,h)}catch{}switch(h.tag){case 26:Xt||kr(h,i),Yr(r,i,h),h.memoizedState?h.memoizedState.count--:h.stateNode&&(h=h.stateNode,h.parentNode.removeChild(h));break;case 27:Xt||kr(h,i);var g=It,C=jn;As(h.type)&&(It=h.stateNode,jn=!1),Yr(r,i,h),Ro(h.stateNode),It=g,jn=C;break;case 5:Xt||kr(h,i);case 6:if(g=It,C=jn,It=null,Yr(r,i,h),It=g,jn=C,It!==null)if(jn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(h.stateNode)}catch(j){_t(h,i,j)}else try{It.removeChild(h.stateNode)}catch(j){_t(h,i,j)}break;case 18:It!==null&&(jn?(r=It,ky(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,h.stateNode),wa(r)):ky(It,h.stateNode));break;case 4:g=It,C=jn,It=h.stateNode.containerInfo,jn=!0,Yr(r,i,h),It=g,jn=C;break;case 0:case 11:case 14:case 15:ws(2,h,i),Xt||ws(4,h,i),Yr(r,i,h);break;case 1:Xt||(kr(h,i),g=h.stateNode,typeof g.componentWillUnmount=="function"&&E_(h,i,g)),Yr(r,i,h);break;case 21:Yr(r,i,h);break;case 22:Xt=(g=Xt)||h.memoizedState!==null,Yr(r,i,h),Xt=g;break;default:Yr(r,i,h)}}function O_(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{wa(r)}catch(h){_t(i,i.return,h)}}}function M_(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{wa(r)}catch(h){_t(i,i.return,h)}}function Zk(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new A_),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new A_),i;default:throw Error(s(435,r.tag))}}function pc(r,i){var h=Zk(r);i.forEach(function(g){if(!h.has(g)){h.add(g);var C=lE.bind(null,r,g);g.then(C,C)}})}function Tn(r,i){var h=i.deletions;if(h!==null)for(var g=0;g<h.length;g++){var C=h[g],j=r,I=i,q=I;e:for(;q!==null;){switch(q.tag){case 27:if(As(q.type)){It=q.stateNode,jn=!1;break e}break;case 5:It=q.stateNode,jn=!1;break e;case 3:case 4:It=q.stateNode.containerInfo,jn=!0;break e}q=q.return}if(It===null)throw Error(s(160));R_(j,I,C),It=null,jn=!1,j=C.alternate,j!==null&&(j.return=null),C.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)I_(i,r),i=i.sibling}var hr=null;function I_(r,i){var h=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Tn(i,r),Nn(r),g&4&&(ws(3,r,r.return),wo(3,r),ws(5,r,r.return));break;case 1:Tn(i,r),Nn(r),g&512&&(Xt||h===null||kr(h,h.return)),g&64&&Kr&&(r=r.updateQueue,r!==null&&(g=r.callbacks,g!==null&&(h=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=h===null?g:h.concat(g))));break;case 26:var C=hr;if(Tn(i,r),Nn(r),g&512&&(Xt||h===null||kr(h,h.return)),g&4){var j=h!==null?h.memoizedState:null;if(g=r.memoizedState,h===null)if(g===null)if(r.stateNode===null){e:{g=r.type,h=r.memoizedProps,C=C.ownerDocument||C;t:switch(g){case"title":j=C.getElementsByTagName("title")[0],(!j||j[Xa]||j[gt]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=C.createElement(g),C.head.insertBefore(j,C.querySelector("head > title"))),mn(j,g,h),j[gt]=r,an(j),g=j;break e;case"link":var I=Iy("link","href",C).get(g+(h.href||""));if(I){for(var q=0;q<I.length;q++)if(j=I[q],j.getAttribute("href")===(h.href==null||h.href===""?null:h.href)&&j.getAttribute("rel")===(h.rel==null?null:h.rel)&&j.getAttribute("title")===(h.title==null?null:h.title)&&j.getAttribute("crossorigin")===(h.crossOrigin==null?null:h.crossOrigin)){I.splice(q,1);break t}}j=C.createElement(g),mn(j,g,h),C.head.appendChild(j);break;case"meta":if(I=Iy("meta","content",C).get(g+(h.content||""))){for(q=0;q<I.length;q++)if(j=I[q],j.getAttribute("content")===(h.content==null?null:""+h.content)&&j.getAttribute("name")===(h.name==null?null:h.name)&&j.getAttribute("property")===(h.property==null?null:h.property)&&j.getAttribute("http-equiv")===(h.httpEquiv==null?null:h.httpEquiv)&&j.getAttribute("charset")===(h.charSet==null?null:h.charSet)){I.splice(q,1);break t}}j=C.createElement(g),mn(j,g,h),C.head.appendChild(j);break;default:throw Error(s(468,g))}j[gt]=r,an(j),g=j}r.stateNode=g}else Py(C,r.type,r.stateNode);else r.stateNode=My(C,g,r.memoizedProps);else j!==g?(j===null?h.stateNode!==null&&(h=h.stateNode,h.parentNode.removeChild(h)):j.count--,g===null?Py(C,r.type,r.stateNode):My(C,g,r.memoizedProps)):g===null&&r.stateNode!==null&&Rh(r,r.memoizedProps,h.memoizedProps)}break;case 27:Tn(i,r),Nn(r),g&512&&(Xt||h===null||kr(h,h.return)),h!==null&&g&4&&Rh(r,r.memoizedProps,h.memoizedProps);break;case 5:if(Tn(i,r),Nn(r),g&512&&(Xt||h===null||kr(h,h.return)),r.flags&32){C=r.stateNode;try{Wi(C,"")}catch(Le){_t(r,r.return,Le)}}g&4&&r.stateNode!=null&&(C=r.memoizedProps,Rh(r,C,h!==null?h.memoizedProps:C)),g&1024&&(Ih=!0);break;case 6:if(Tn(i,r),Nn(r),g&4){if(r.stateNode===null)throw Error(s(162));g=r.memoizedProps,h=r.stateNode;try{h.nodeValue=g}catch(Le){_t(r,r.return,Le)}}break;case 3:if(Lc=null,C=hr,hr=Nc(i.containerInfo),Tn(i,r),hr=C,Nn(r),g&4&&h!==null&&h.memoizedState.isDehydrated)try{wa(i.containerInfo)}catch(Le){_t(r,r.return,Le)}Ih&&(Ih=!1,P_(r));break;case 4:g=hr,hr=Nc(r.stateNode.containerInfo),Tn(i,r),Nn(r),hr=g;break;case 12:Tn(i,r),Nn(r);break;case 31:Tn(i,r),Nn(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,pc(r,g)));break;case 13:Tn(i,r),Nn(r),r.child.flags&8192&&r.memoizedState!==null!=(h!==null&&h.memoizedState!==null)&&(xc=St()),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,pc(r,g)));break;case 22:C=r.memoizedState!==null;var ne=h!==null&&h.memoizedState!==null,le=Kr,pe=Xt;if(Kr=le||C,Xt=pe||ne,Tn(i,r),Xt=pe,Kr=le,Nn(r),g&8192)e:for(i=r.stateNode,i._visibility=C?i._visibility&-2:i._visibility|1,C&&(h===null||ne||Kr||Xt||di(r)),h=null,i=r;;){if(i.tag===5||i.tag===26){if(h===null){ne=h=i;try{if(j=ne.stateNode,C)I=j.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{q=ne.stateNode;var be=ne.memoizedProps.style,ce=be!=null&&be.hasOwnProperty("display")?be.display:null;q.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Le){_t(ne,ne.return,Le)}}}else if(i.tag===6){if(h===null){ne=i;try{ne.stateNode.nodeValue=C?"":ne.memoizedProps}catch(Le){_t(ne,ne.return,Le)}}}else if(i.tag===18){if(h===null){ne=i;try{var ue=ne.stateNode;C?Ey(ue,!0):Ey(ne.stateNode,!1)}catch(Le){_t(ne,ne.return,Le)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;h===i&&(h=null),i=i.return}h===i&&(h=null),i.sibling.return=i.return,i=i.sibling}g&4&&(g=r.updateQueue,g!==null&&(h=g.retryQueue,h!==null&&(g.retryQueue=null,pc(r,h))));break;case 19:Tn(i,r),Nn(r),g&4&&(g=r.updateQueue,g!==null&&(r.updateQueue=null,pc(r,g)));break;case 30:break;case 21:break;default:Tn(i,r),Nn(r)}}function Nn(r){var i=r.flags;if(i&2){try{for(var h,g=r.return;g!==null;){if(T_(g)){h=g;break}g=g.return}if(h==null)throw Error(s(160));switch(h.tag){case 27:var C=h.stateNode,j=Oh(r);mc(r,j,C);break;case 5:var I=h.stateNode;h.flags&32&&(Wi(I,""),h.flags&=-33);var q=Oh(r);mc(r,q,I);break;case 3:case 4:var ne=h.stateNode.containerInfo,le=Oh(r);Mh(r,le,ne);break;default:throw Error(s(161))}}catch(pe){_t(r,r.return,pe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function P_(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;P_(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Xr(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)L_(r,i.alternate,i),i=i.sibling}function di(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ws(4,i,i.return),di(i);break;case 1:kr(i,i.return);var h=i.stateNode;typeof h.componentWillUnmount=="function"&&E_(i,i.return,h),di(i);break;case 27:Ro(i.stateNode);case 26:case 5:kr(i,i.return),di(i);break;case 22:i.memoizedState===null&&di(i);break;case 30:di(i);break;default:di(i)}r=r.sibling}}function Qr(r,i,h){for(h=h&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var g=i.alternate,C=r,j=i,I=j.flags;switch(j.tag){case 0:case 11:case 15:Qr(C,j,h),wo(4,j);break;case 1:if(Qr(C,j,h),g=j,C=g.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(le){_t(g,g.return,le)}if(g=j,C=g.updateQueue,C!==null){var q=g.stateNode;try{var ne=C.shared.hiddenCallbacks;if(ne!==null)for(C.shared.hiddenCallbacks=null,C=0;C<ne.length;C++)mx(ne[C],q)}catch(le){_t(g,g.return,le)}}h&&I&64&&k_(j),Co(j,j.return);break;case 27:N_(j);case 26:case 5:Qr(C,j,h),h&&g===null&&I&4&&j_(j),Co(j,j.return);break;case 12:Qr(C,j,h);break;case 31:Qr(C,j,h),h&&I&4&&O_(C,j);break;case 13:Qr(C,j,h),h&&I&4&&M_(C,j);break;case 22:j.memoizedState===null&&Qr(C,j,h),Co(j,j.return);break;case 30:break;default:Qr(C,j,h)}i=i.sibling}}function Ph(r,i){var h=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(h=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==h&&(r!=null&&r.refCount++,h!=null&&co(h))}function Bh(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&co(r))}function fr(r,i,h,g){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)B_(r,i,h,g),i=i.sibling}function B_(r,i,h,g){var C=i.flags;switch(i.tag){case 0:case 11:case 15:fr(r,i,h,g),C&2048&&wo(9,i);break;case 1:fr(r,i,h,g);break;case 3:fr(r,i,h,g),C&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&co(r)));break;case 12:if(C&2048){fr(r,i,h,g),r=i.stateNode;try{var j=i.memoizedProps,I=j.id,q=j.onPostCommit;typeof q=="function"&&q(I,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(ne){_t(i,i.return,ne)}}else fr(r,i,h,g);break;case 31:fr(r,i,h,g);break;case 13:fr(r,i,h,g);break;case 23:break;case 22:j=i.stateNode,I=i.alternate,i.memoizedState!==null?j._visibility&2?fr(r,i,h,g):ko(r,i):j._visibility&2?fr(r,i,h,g):(j._visibility|=2,ha(r,i,h,g,(i.subtreeFlags&10256)!==0||!1)),C&2048&&Ph(I,i);break;case 24:fr(r,i,h,g),C&2048&&Bh(i.alternate,i);break;default:fr(r,i,h,g)}}function ha(r,i,h,g,C){for(C=C&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var j=r,I=i,q=h,ne=g,le=I.flags;switch(I.tag){case 0:case 11:case 15:ha(j,I,q,ne,C),wo(8,I);break;case 23:break;case 22:var pe=I.stateNode;I.memoizedState!==null?pe._visibility&2?ha(j,I,q,ne,C):ko(j,I):(pe._visibility|=2,ha(j,I,q,ne,C)),C&&le&2048&&Ph(I.alternate,I);break;case 24:ha(j,I,q,ne,C),C&&le&2048&&Bh(I.alternate,I);break;default:ha(j,I,q,ne,C)}i=i.sibling}}function ko(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var h=r,g=i,C=g.flags;switch(g.tag){case 22:ko(h,g),C&2048&&Ph(g.alternate,g);break;case 24:ko(h,g),C&2048&&Bh(g.alternate,g);break;default:ko(h,g)}i=i.sibling}}var Eo=8192;function fa(r,i,h){if(r.subtreeFlags&Eo)for(r=r.child;r!==null;)z_(r,i,h),r=r.sibling}function z_(r,i,h){switch(r.tag){case 26:fa(r,i,h),r.flags&Eo&&r.memoizedState!==null&&zE(h,hr,r.memoizedState,r.memoizedProps);break;case 5:fa(r,i,h);break;case 3:case 4:var g=hr;hr=Nc(r.stateNode.containerInfo),fa(r,i,h),hr=g;break;case 22:r.memoizedState===null&&(g=r.alternate,g!==null&&g.memoizedState!==null?(g=Eo,Eo=16777216,fa(r,i,h),Eo=g):fa(r,i,h));break;default:fa(r,i,h)}}function H_(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function jo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var h=0;h<i.length;h++){var g=i[h];on=g,U_(g,r)}H_(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)$_(r),r=r.sibling}function $_(r){switch(r.tag){case 0:case 11:case 15:jo(r),r.flags&2048&&ws(9,r,r.return);break;case 3:jo(r);break;case 12:jo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,gc(r)):jo(r);break;default:jo(r)}}function gc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var h=0;h<i.length;h++){var g=i[h];on=g,U_(g,r)}H_(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ws(8,i,i.return),gc(i);break;case 22:h=i.stateNode,h._visibility&2&&(h._visibility&=-3,gc(i));break;default:gc(i)}r=r.sibling}}function U_(r,i){for(;on!==null;){var h=on;switch(h.tag){case 0:case 11:case 15:ws(8,h,i);break;case 23:case 22:if(h.memoizedState!==null&&h.memoizedState.cachePool!==null){var g=h.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:co(h.memoizedState.cache)}if(g=h.child,g!==null)g.return=h,on=g;else e:for(h=r;on!==null;){g=on;var C=g.sibling,j=g.return;if(D_(g),g===h){on=null;break e}if(C!==null){C.return=j,on=C;break e}on=j}}}var eE={getCacheForType:function(r){var i=hn(qt),h=i.data.get(r);return h===void 0&&(h=r(),i.data.set(r,h)),h},cacheSignal:function(){return hn(qt).controller.signal}},tE=typeof WeakMap=="function"?WeakMap:Map,mt=0,wt=null,tt=null,st=0,xt=0,Hn=null,Cs=!1,ma=!1,zh=!1,Jr=0,Ht=0,ks=0,hi=0,Hh=0,$n=0,pa=0,To=null,An=null,$h=!1,xc=0,F_=0,_c=1/0,yc=null,Es=null,Zt=0,js=null,ga=null,Zr=0,Uh=0,Fh=null,V_=null,No=0,Vh=null;function Un(){return(mt&2)!==0&&st!==0?st&-st:H.T!==null?Xh():ct()}function G_(){if($n===0)if((st&536870912)===0||at){var r=Ii;Ii<<=1,(Ii&3932160)===0&&(Ii=262144),$n=r}else $n=536870912;return r=Bn.current,r!==null&&(r.flags|=32),$n}function Ln(r,i,h){(r===wt&&(xt===2||xt===9)||r.cancelPendingCommit!==null)&&(xa(r,0),Ts(r,st,$n,!1)),hs(r,h),((mt&2)===0||r!==wt)&&(r===wt&&((mt&2)===0&&(hi|=h),Ht===4&&Ts(r,st,$n,!1)),Er(r))}function W_(r,i,h){if((mt&6)!==0)throw Error(s(327));var g=!h&&(i&127)===0&&(i&r.expiredLanes)===0||Ys(r,i),C=g?sE(r,i):Wh(r,i,!0),j=g;do{if(C===0){ma&&!g&&Ts(r,i,0,!1);break}else{if(h=r.current.alternate,j&&!nE(h)){C=Wh(r,i,!1),j=!1;continue}if(C===2){if(j=i,r.errorRecoveryDisabledLanes&j)var I=0;else I=r.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){i=I;e:{var q=r;C=To;var ne=q.current.memoizedState.isDehydrated;if(ne&&(xa(q,I).flags|=256),I=Wh(q,I,!1),I!==2){if(zh&&!ne){q.errorRecoveryDisabledLanes|=j,hi|=j,C=4;break e}j=An,An=C,j!==null&&(An===null?An=j:An.push.apply(An,j))}C=I}if(j=!1,C!==2)continue}}if(C===1){xa(r,0),Ts(r,i,0,!0);break}e:{switch(g=r,j=C,j){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ts(g,i,$n,!Cs);break e;case 2:An=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(C=xc+300-St(),10<C)){if(Ts(g,i,$n,!Cs),Bi(g,0,!0)!==0)break e;Zr=i,g.timeoutHandle=wy(q_.bind(null,g,h,An,yc,$h,i,$n,hi,pa,Cs,j,"Throttled",-0,0),C);break e}q_(g,h,An,yc,$h,i,$n,hi,pa,Cs,j,null,-0,0)}}break}while(!0);Er(r)}function q_(r,i,h,g,C,j,I,q,ne,le,pe,be,ce,ue){if(r.timeoutHandle=-1,be=i.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Br},z_(i,j,be);var Le=(j&62914560)===j?xc-St():(j&4194048)===j?F_-St():0;if(Le=HE(be,Le),Le!==null){Zr=j,r.cancelPendingCommit=Le(ty.bind(null,r,i,j,h,g,C,I,q,ne,pe,be,null,ce,ue)),Ts(r,j,I,!le);return}}ty(r,i,j,h,g,C,I,q,ne)}function nE(r){for(var i=r;;){var h=i.tag;if((h===0||h===11||h===15)&&i.flags&16384&&(h=i.updateQueue,h!==null&&(h=h.stores,h!==null)))for(var g=0;g<h.length;g++){var C=h[g],j=C.getSnapshot;C=C.value;try{if(!In(j(),C))return!1}catch{return!1}}if(h=i.child,i.subtreeFlags&16384&&h!==null)h.return=i,i=h;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ts(r,i,h,g){i&=~Hh,i&=~hi,r.suspendedLanes|=i,r.pingedLanes&=~i,g&&(r.warmLanes|=i),g=r.expirationTimes;for(var C=i;0<C;){var j=31-pt(C),I=1<<j;g[j]=-1,C&=~I}h!==0&&ge(r,h,i)}function vc(){return(mt&6)===0?(Ao(0),!1):!0}function Gh(){if(tt!==null){if(xt===0)var r=tt.return;else r=tt,Ur=ri=null,oh(r),oa=null,ho=0,r=tt;for(;r!==null;)C_(r.alternate,r),r=r.return;tt=null}}function xa(r,i){var h=r.timeoutHandle;h!==-1&&(r.timeoutHandle=-1,SE(h)),h=r.cancelPendingCommit,h!==null&&(r.cancelPendingCommit=null,h()),Zr=0,Gh(),wt=r,tt=h=Hr(r.current,null),st=i,xt=0,Hn=null,Cs=!1,ma=Ys(r,i),zh=!1,pa=$n=Hh=hi=ks=Ht=0,An=To=null,$h=!1,(i&8)!==0&&(i|=i&32);var g=r.entangledLanes;if(g!==0)for(r=r.entanglements,g&=i;0<g;){var C=31-pt(g),j=1<<C;i|=r[C],g&=~j}return Jr=i,$l(),h}function K_(r,i){qe=null,H.H=vo,i===aa||i===Yl?(i=ux(),xt=3):i===Yd?(i=ux(),xt=4):xt=i===wh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Hn=i,tt===null&&(Ht=1,cc(r,Qn(i,r.current)))}function Y_(){var r=Bn.current;return r===null?!0:(st&4194048)===st?tr===null:(st&62914560)===st||(st&536870912)!==0?r===tr:!1}function X_(){var r=H.H;return H.H=vo,r===null?vo:r}function Q_(){var r=H.A;return H.A=eE,r}function bc(){Ht=4,Cs||(st&4194048)!==st&&Bn.current!==null||(ma=!0),(ks&134217727)===0&&(hi&134217727)===0||wt===null||Ts(wt,st,$n,!1)}function Wh(r,i,h){var g=mt;mt|=2;var C=X_(),j=Q_();(wt!==r||st!==i)&&(yc=null,xa(r,i)),i=!1;var I=Ht;e:do try{if(xt!==0&&tt!==null){var q=tt,ne=Hn;switch(xt){case 8:Gh(),I=6;break e;case 3:case 2:case 9:case 6:Bn.current===null&&(i=!0);var le=xt;if(xt=0,Hn=null,_a(r,q,ne,le),h&&ma){I=0;break e}break;default:le=xt,xt=0,Hn=null,_a(r,q,ne,le)}}rE(),I=Ht;break}catch(pe){K_(r,pe)}while(!0);return i&&r.shellSuspendCounter++,Ur=ri=null,mt=g,H.H=C,H.A=j,tt===null&&(wt=null,st=0,$l()),I}function rE(){for(;tt!==null;)J_(tt)}function sE(r,i){var h=mt;mt|=2;var g=X_(),C=Q_();wt!==r||st!==i?(yc=null,_c=St()+500,xa(r,i)):ma=Ys(r,i);e:do try{if(xt!==0&&tt!==null){i=tt;var j=Hn;t:switch(xt){case 1:xt=0,Hn=null,_a(r,i,j,1);break;case 2:case 9:if(lx(j)){xt=0,Hn=null,Z_(i);break}i=function(){xt!==2&&xt!==9||wt!==r||(xt=7),Er(r)},j.then(i,i);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:lx(j)?(xt=0,Hn=null,Z_(i)):(xt=0,Hn=null,_a(r,i,j,7));break;case 5:var I=null;switch(tt.tag){case 26:I=tt.memoizedState;case 5:case 27:var q=tt;if(I?By(I):q.stateNode.complete){xt=0,Hn=null;var ne=q.sibling;if(ne!==null)tt=ne;else{var le=q.return;le!==null?(tt=le,Sc(le)):tt=null}break t}}xt=0,Hn=null,_a(r,i,j,5);break;case 6:xt=0,Hn=null,_a(r,i,j,6);break;case 8:Gh(),Ht=6;break e;default:throw Error(s(462))}}iE();break}catch(pe){K_(r,pe)}while(!0);return Ur=ri=null,H.H=g,H.A=C,mt=h,tt!==null?0:(wt=null,st=0,$l(),Ht)}function iE(){for(;tt!==null&&!ot();)J_(tt)}function J_(r){var i=S_(r.alternate,r,Jr);r.memoizedProps=r.pendingProps,i===null?Sc(r):tt=i}function Z_(r){var i=r,h=i.alternate;switch(i.tag){case 15:case 0:i=g_(h,i,i.pendingProps,i.type,void 0,st);break;case 11:i=g_(h,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:oh(i);default:C_(h,i),i=tt=Qg(i,Jr),i=S_(h,i,Jr)}r.memoizedProps=r.pendingProps,i===null?Sc(r):tt=i}function _a(r,i,h,g){Ur=ri=null,oh(i),oa=null,ho=0;var C=i.return;try{if(qk(r,C,i,h,st)){Ht=1,cc(r,Qn(h,r.current)),tt=null;return}}catch(j){if(C!==null)throw tt=C,j;Ht=1,cc(r,Qn(h,r.current)),tt=null;return}i.flags&32768?(at||g===1?r=!0:ma||(st&536870912)!==0?r=!1:(Cs=r=!0,(g===2||g===9||g===3||g===6)&&(g=Bn.current,g!==null&&g.tag===13&&(g.flags|=16384))),ey(i,r)):Sc(i)}function Sc(r){var i=r;do{if((i.flags&32768)!==0){ey(i,Cs);return}r=i.return;var h=Xk(i.alternate,i,Jr);if(h!==null){tt=h;return}if(i=i.sibling,i!==null){tt=i;return}tt=i=r}while(i!==null);Ht===0&&(Ht=5)}function ey(r,i){do{var h=Qk(r.alternate,r);if(h!==null){h.flags&=32767,tt=h;return}if(h=r.return,h!==null&&(h.flags|=32768,h.subtreeFlags=0,h.deletions=null),!i&&(r=r.sibling,r!==null)){tt=r;return}tt=r=h}while(r!==null);Ht=6,tt=null}function ty(r,i,h,g,C,j,I,q,ne){r.cancelPendingCommit=null;do wc();while(Zt!==0);if((mt&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(j=i.lanes|i.childLanes,j|=Od,xe(r,h,j,I,q,ne),r===wt&&(tt=wt=null,st=0),ga=i,js=r,Zr=h,Uh=j,Fh=C,V_=g,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,cE(Oe,function(){return ay(),null})):(r.callbackNode=null,r.callbackPriority=0),g=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||g){g=H.T,H.T=null,C=K.p,K.p=2,I=mt,mt|=4;try{Jk(r,i,h)}finally{mt=I,K.p=C,H.T=g}}Zt=1,ny(),ry(),sy()}}function ny(){if(Zt===1){Zt=0;var r=js,i=ga,h=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||h){h=H.T,H.T=null;var g=K.p;K.p=2;var C=mt;mt|=4;try{I_(i,r);var j=sf,I=Ug(r.containerInfo),q=j.focusedElem,ne=j.selectionRange;if(I!==q&&q&&q.ownerDocument&&$g(q.ownerDocument.documentElement,q)){if(ne!==null&&Nd(q)){var le=ne.start,pe=ne.end;if(pe===void 0&&(pe=le),"selectionStart"in q)q.selectionStart=le,q.selectionEnd=Math.min(pe,q.value.length);else{var be=q.ownerDocument||document,ce=be&&be.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),Le=q.textContent.length,Ue=Math.min(ne.start,Le),bt=ne.end===void 0?Ue:Math.min(ne.end,Le);!ue.extend&&Ue>bt&&(I=bt,bt=Ue,Ue=I);var ae=Hg(q,Ue),ie=Hg(q,bt);if(ae&&ie&&(ue.rangeCount!==1||ue.anchorNode!==ae.node||ue.anchorOffset!==ae.offset||ue.focusNode!==ie.node||ue.focusOffset!==ie.offset)){var oe=be.createRange();oe.setStart(ae.node,ae.offset),ue.removeAllRanges(),Ue>bt?(ue.addRange(oe),ue.extend(ie.node,ie.offset)):(oe.setEnd(ie.node,ie.offset),ue.addRange(oe))}}}}for(be=[],ue=q;ue=ue.parentNode;)ue.nodeType===1&&be.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<be.length;q++){var ve=be[q];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Mc=!!rf,sf=rf=null}finally{mt=C,K.p=g,H.T=h}}r.current=i,Zt=2}}function ry(){if(Zt===2){Zt=0;var r=js,i=ga,h=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||h){h=H.T,H.T=null;var g=K.p;K.p=2;var C=mt;mt|=4;try{L_(r,i.alternate,i)}finally{mt=C,K.p=g,H.T=h}}Zt=3}}function sy(){if(Zt===4||Zt===3){Zt=0,Ut();var r=js,i=ga,h=Zr,g=V_;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Zt=5:(Zt=0,ga=js=null,iy(r,r.pendingLanes));var C=r.pendingLanes;if(C===0&&(Es=null),Ge(h),i=i.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(Lt,i,void 0,(i.current.flags&128)===128)}catch{}if(g!==null){i=H.T,C=K.p,K.p=2,H.T=null;try{for(var j=r.onRecoverableError,I=0;I<g.length;I++){var q=g[I];j(q.value,{componentStack:q.stack})}}finally{H.T=i,K.p=C}}(Zr&3)!==0&&wc(),Er(r),C=r.pendingLanes,(h&261930)!==0&&(C&42)!==0?r===Vh?No++:(No=0,Vh=r):No=0,Ao(0)}}function iy(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,co(i)))}function wc(){return ny(),ry(),sy(),ay()}function ay(){if(Zt!==5)return!1;var r=js,i=Uh;Uh=0;var h=Ge(Zr),g=H.T,C=K.p;try{K.p=32>h?32:h,H.T=null,h=Fh,Fh=null;var j=js,I=Zr;if(Zt=0,ga=js=null,Zr=0,(mt&6)!==0)throw Error(s(331));var q=mt;if(mt|=4,$_(j.current),B_(j,j.current,I,h),mt=q,Ao(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(Lt,j)}catch{}return!0}finally{K.p=C,H.T=g,iy(r,i)}}function oy(r,i,h){i=Qn(h,i),i=Sh(r.stateNode,i,2),r=vs(r,i,2),r!==null&&(hs(r,2),Er(r))}function _t(r,i,h){if(r.tag===3)oy(r,r,h);else for(;i!==null;){if(i.tag===3){oy(i,r,h);break}else if(i.tag===1){var g=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Es===null||!Es.has(g))){r=Qn(h,r),h=l_(2),g=vs(i,h,2),g!==null&&(c_(h,g,i,r),hs(g,2),Er(g));break}}i=i.return}}function qh(r,i,h){var g=r.pingCache;if(g===null){g=r.pingCache=new tE;var C=new Set;g.set(i,C)}else C=g.get(i),C===void 0&&(C=new Set,g.set(i,C));C.has(h)||(zh=!0,C.add(h),r=aE.bind(null,r,i,h),i.then(r,r))}function aE(r,i,h){var g=r.pingCache;g!==null&&g.delete(i),r.pingedLanes|=r.suspendedLanes&h,r.warmLanes&=~h,wt===r&&(st&h)===h&&(Ht===4||Ht===3&&(st&62914560)===st&&300>St()-xc?(mt&2)===0&&xa(r,0):Hh|=h,pa===st&&(pa=0)),Er(r)}function ly(r,i){i===0&&(i=Nl()),r=ei(r,i),r!==null&&(hs(r,i),Er(r))}function oE(r){var i=r.memoizedState,h=0;i!==null&&(h=i.retryLane),ly(r,h)}function lE(r,i){var h=0;switch(r.tag){case 31:case 13:var g=r.stateNode,C=r.memoizedState;C!==null&&(h=C.retryLane);break;case 19:g=r.stateNode;break;case 22:g=r.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(i),ly(r,h)}function cE(r,i){return fe(r,i)}var Cc=null,ya=null,Kh=!1,kc=!1,Yh=!1,Ns=0;function Er(r){r!==ya&&r.next===null&&(ya===null?Cc=ya=r:ya=ya.next=r),kc=!0,Kh||(Kh=!0,dE())}function Ao(r,i){if(!Yh&&kc){Yh=!0;do for(var h=!1,g=Cc;g!==null;){if(r!==0){var C=g.pendingLanes;if(C===0)var j=0;else{var I=g.suspendedLanes,q=g.pingedLanes;j=(1<<31-pt(42|r)+1)-1,j&=C&~(I&~q),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(h=!0,hy(g,j))}else j=st,j=Bi(g,g===wt?j:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(j&3)===0||Ys(g,j)||(h=!0,hy(g,j));g=g.next}while(h);Yh=!1}}function uE(){cy()}function cy(){kc=Kh=!1;var r=0;Ns!==0&&bE()&&(r=Ns);for(var i=St(),h=null,g=Cc;g!==null;){var C=g.next,j=uy(g,i);j===0?(g.next=null,h===null?Cc=C:h.next=C,C===null&&(ya=h)):(h=g,(r!==0||(j&3)!==0)&&(kc=!0)),g=C}Zt!==0&&Zt!==5||Ao(r),Ns!==0&&(Ns=0)}function uy(r,i){for(var h=r.suspendedLanes,g=r.pingedLanes,C=r.expirationTimes,j=r.pendingLanes&-62914561;0<j;){var I=31-pt(j),q=1<<I,ne=C[I];ne===-1?((q&h)===0||(q&g)!==0)&&(C[I]=Ya(q,i)):ne<=i&&(r.expiredLanes|=q),j&=~q}if(i=wt,h=st,h=Bi(r,r===i?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g=r.callbackNode,h===0||r===i&&(xt===2||xt===9)||r.cancelPendingCommit!==null)return g!==null&&g!==null&&je(g),r.callbackNode=null,r.callbackPriority=0;if((h&3)===0||Ys(r,h)){if(i=h&-h,i===r.callbackPriority)return i;switch(g!==null&&je(g),Ge(h)){case 2:case 8:h=Ee;break;case 32:h=Oe;break;case 268435456:h=Ke;break;default:h=Oe}return g=dy.bind(null,r),h=fe(h,g),r.callbackPriority=i,r.callbackNode=h,i}return g!==null&&g!==null&&je(g),r.callbackPriority=2,r.callbackNode=null,2}function dy(r,i){if(Zt!==0&&Zt!==5)return r.callbackNode=null,r.callbackPriority=0,null;var h=r.callbackNode;if(wc()&&r.callbackNode!==h)return null;var g=st;return g=Bi(r,r===wt?g:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),g===0?null:(W_(r,g,i),uy(r,St()),r.callbackNode!=null&&r.callbackNode===h?dy.bind(null,r):null)}function hy(r,i){if(wc())return null;W_(r,i,!0)}function dE(){wE(function(){(mt&6)!==0?fe(me,uE):cy()})}function Xh(){if(Ns===0){var r=sa;r===0&&(r=ur,ur<<=1,(ur&261888)===0&&(ur=256)),Ns=r}return Ns}function fy(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Rl(""+r)}function my(r,i){var h=i.ownerDocument.createElement("input");return h.name=i.name,h.value=i.value,r.id&&h.setAttribute("form",r.id),i.parentNode.insertBefore(h,i),r=new FormData(r),h.parentNode.removeChild(h),r}function hE(r,i,h,g,C){if(i==="submit"&&h&&h.stateNode===C){var j=fy((C[kn]||null).action),I=g.submitter;I&&(i=(i=I[kn]||null)?fy(i.formAction):I.getAttribute("formAction"),i!==null&&(j=i,I=null));var q=new Pl("action","action",null,g,C);r.push({event:q,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(Ns!==0){var ne=I?my(C,I):new FormData(C);gh(h,{pending:!0,data:ne,method:C.method,action:j},null,ne)}}else typeof j=="function"&&(q.preventDefault(),ne=I?my(C,I):new FormData(C),gh(h,{pending:!0,data:ne,method:C.method,action:j},j,ne))},currentTarget:C}]})}}for(var Qh=0;Qh<Rd.length;Qh++){var Jh=Rd[Qh],fE=Jh.toLowerCase(),mE=Jh[0].toUpperCase()+Jh.slice(1);dr(fE,"on"+mE)}dr(Gg,"onAnimationEnd"),dr(Wg,"onAnimationIteration"),dr(qg,"onAnimationStart"),dr("dblclick","onDoubleClick"),dr("focusin","onFocus"),dr("focusout","onBlur"),dr(Ak,"onTransitionRun"),dr(Lk,"onTransitionStart"),dr(Dk,"onTransitionCancel"),dr(Kg,"onTransitionEnd"),Vi("onMouseEnter",["mouseout","mouseover"]),Vi("onMouseLeave",["mouseout","mouseover"]),Vi("onPointerEnter",["pointerout","pointerover"]),Vi("onPointerLeave",["pointerout","pointerover"]),Xs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),pE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lo));function py(r,i){i=(i&4)!==0;for(var h=0;h<r.length;h++){var g=r[h],C=g.event;g=g.listeners;e:{var j=void 0;if(i)for(var I=g.length-1;0<=I;I--){var q=g[I],ne=q.instance,le=q.currentTarget;if(q=q.listener,ne!==j&&C.isPropagationStopped())break e;j=q,C.currentTarget=le;try{j(C)}catch(pe){Hl(pe)}C.currentTarget=null,j=ne}else for(I=0;I<g.length;I++){if(q=g[I],ne=q.instance,le=q.currentTarget,q=q.listener,ne!==j&&C.isPropagationStopped())break e;j=q,C.currentTarget=le;try{j(C)}catch(pe){Hl(pe)}C.currentTarget=null,j=ne}}}}function nt(r,i){var h=i[dd];h===void 0&&(h=i[dd]=new Set);var g=r+"__bubble";h.has(g)||(gy(i,r,2,!1),h.add(g))}function Zh(r,i,h){var g=0;i&&(g|=4),gy(h,r,g,i)}var Ec="_reactListening"+Math.random().toString(36).slice(2);function ef(r){if(!r[Ec]){r[Ec]=!0,cg.forEach(function(h){h!=="selectionchange"&&(pE.has(h)||Zh(h,!1,r),Zh(h,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Ec]||(i[Ec]=!0,Zh("selectionchange",!1,i))}}function gy(r,i,h,g){switch(Gy(i)){case 2:var C=FE;break;case 8:C=VE;break;default:C=gf}h=C.bind(null,i,h,r),C=void 0,!vd||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(C=!0),g?C!==void 0?r.addEventListener(i,h,{capture:!0,passive:C}):r.addEventListener(i,h,!0):C!==void 0?r.addEventListener(i,h,{passive:C}):r.addEventListener(i,h,!1)}function tf(r,i,h,g,C){var j=g;if((i&1)===0&&(i&2)===0&&g!==null)e:for(;;){if(g===null)return;var I=g.tag;if(I===3||I===4){var q=g.stateNode.containerInfo;if(q===C)break;if(I===4)for(I=g.return;I!==null;){var ne=I.tag;if((ne===3||ne===4)&&I.stateNode.containerInfo===C)return;I=I.return}for(;q!==null;){if(I=$i(q),I===null)return;if(ne=I.tag,ne===5||ne===6||ne===26||ne===27){g=j=I;continue e}q=q.parentNode}}g=g.return}bg(function(){var le=j,pe=_d(h),be=[];e:{var ce=Yg.get(r);if(ce!==void 0){var ue=Pl,Le=r;switch(r){case"keypress":if(Ml(h)===0)break e;case"keydown":case"keyup":ue=lk;break;case"focusin":Le="focus",ue=Cd;break;case"focusout":Le="blur",ue=Cd;break;case"beforeblur":case"afterblur":ue=Cd;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Cg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=XC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=dk;break;case Gg:case Wg:case qg:ue=ZC;break;case Kg:ue=fk;break;case"scroll":case"scrollend":ue=KC;break;case"wheel":ue=pk;break;case"copy":case"cut":case"paste":ue=tk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Eg;break;case"toggle":case"beforetoggle":ue=xk}var Ue=(i&4)!==0,bt=!Ue&&(r==="scroll"||r==="scrollend"),ae=Ue?ce!==null?ce+"Capture":null:ce;Ue=[];for(var ie=le,oe;ie!==null;){var ve=ie;if(oe=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||oe===null||ae===null||(ve=Ja(ie,ae),ve!=null&&Ue.push(Do(ie,ve,oe))),bt)break;ie=ie.return}0<Ue.length&&(ce=new ue(ce,Le,null,h,pe),be.push({event:ce,listeners:Ue}))}}if((i&7)===0){e:{if(ce=r==="mouseover"||r==="pointerover",ue=r==="mouseout"||r==="pointerout",ce&&h!==xd&&(Le=h.relatedTarget||h.fromElement)&&($i(Le)||Le[Hi]))break e;if((ue||ce)&&(ce=pe.window===pe?pe:(ce=pe.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(Le=h.relatedTarget||h.toElement,ue=le,Le=Le?$i(Le):null,Le!==null&&(bt=o(Le),Ue=Le.tag,Le!==bt||Ue!==5&&Ue!==27&&Ue!==6)&&(Le=null)):(ue=null,Le=le),ue!==Le)){if(Ue=Cg,ve="onMouseLeave",ae="onMouseEnter",ie="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=Eg,ve="onPointerLeave",ae="onPointerEnter",ie="pointer"),bt=ue==null?ce:Qa(ue),oe=Le==null?ce:Qa(Le),ce=new Ue(ve,ie+"leave",ue,h,pe),ce.target=bt,ce.relatedTarget=oe,ve=null,$i(pe)===le&&(Ue=new Ue(ae,ie+"enter",Le,h,pe),Ue.target=oe,Ue.relatedTarget=bt,ve=Ue),bt=ve,ue&&Le)t:{for(Ue=gE,ae=ue,ie=Le,oe=0,ve=ae;ve;ve=Ue(ve))oe++;ve=0;for(var Pe=ie;Pe;Pe=Ue(Pe))ve++;for(;0<oe-ve;)ae=Ue(ae),oe--;for(;0<ve-oe;)ie=Ue(ie),ve--;for(;oe--;){if(ae===ie||ie!==null&&ae===ie.alternate){Ue=ae;break t}ae=Ue(ae),ie=Ue(ie)}Ue=null}else Ue=null;ue!==null&&xy(be,ce,ue,Ue,!1),Le!==null&&bt!==null&&xy(be,bt,Le,Ue,!0)}}e:{if(ce=le?Qa(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var ut=Og;else if(Dg(ce))if(Mg)ut=jk;else{ut=kk;var Re=Ck}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&gd(le.elementType)&&(ut=Og):ut=Ek;if(ut&&(ut=ut(r,le))){Rg(be,ut,h,pe);break e}Re&&Re(r,ce,le),r==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&pd(ce,"number",ce.value)}switch(Re=le?Qa(le):window,r){case"focusin":(Dg(Re)||Re.contentEditable==="true")&&(Xi=Re,Ad=le,ao=null);break;case"focusout":ao=Ad=Xi=null;break;case"mousedown":Ld=!0;break;case"contextmenu":case"mouseup":case"dragend":Ld=!1,Fg(be,h,pe);break;case"selectionchange":if(Nk)break;case"keydown":case"keyup":Fg(be,h,pe)}var Ye;if(Ed)e:{switch(r){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Yi?Ag(r,h)&&(it="onCompositionEnd"):r==="keydown"&&h.keyCode===229&&(it="onCompositionStart");it&&(jg&&h.locale!=="ko"&&(Yi||it!=="onCompositionStart"?it==="onCompositionEnd"&&Yi&&(Ye=Sg()):(fs=pe,bd="value"in fs?fs.value:fs.textContent,Yi=!0)),Re=jc(le,it),0<Re.length&&(it=new kg(it,r,null,h,pe),be.push({event:it,listeners:Re}),Ye?it.data=Ye:(Ye=Lg(h),Ye!==null&&(it.data=Ye)))),(Ye=yk?vk(r,h):bk(r,h))&&(it=jc(le,"onBeforeInput"),0<it.length&&(Re=new kg("onBeforeInput","beforeinput",null,h,pe),be.push({event:Re,listeners:it}),Re.data=Ye)),hE(be,r,le,h,pe)}py(be,i)})}function Do(r,i,h){return{instance:r,listener:i,currentTarget:h}}function jc(r,i){for(var h=i+"Capture",g=[];r!==null;){var C=r,j=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||j===null||(C=Ja(r,h),C!=null&&g.unshift(Do(r,C,j)),C=Ja(r,i),C!=null&&g.push(Do(r,C,j))),r.tag===3)return g;r=r.return}return[]}function gE(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function xy(r,i,h,g,C){for(var j=i._reactName,I=[];h!==null&&h!==g;){var q=h,ne=q.alternate,le=q.stateNode;if(q=q.tag,ne!==null&&ne===g)break;q!==5&&q!==26&&q!==27||le===null||(ne=le,C?(le=Ja(h,j),le!=null&&I.unshift(Do(h,le,ne))):C||(le=Ja(h,j),le!=null&&I.push(Do(h,le,ne)))),h=h.return}I.length!==0&&r.push({event:i,listeners:I})}var xE=/\r\n?/g,_E=/\u0000|\uFFFD/g;function _y(r){return(typeof r=="string"?r:""+r).replace(xE,`
|
|
50
|
-
`).replace(_E,"")}function yy(r,i){return i=_y(i),_y(r)===i}function vt(r,i,h,g,C,j){switch(h){case"children":typeof g=="string"?i==="body"||i==="textarea"&&g===""||Wi(r,g):(typeof g=="number"||typeof g=="bigint")&&i!=="body"&&Wi(r,""+g);break;case"className":Ll(r,"class",g);break;case"tabIndex":Ll(r,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ll(r,h,g);break;case"style":yg(r,g,j);break;case"data":if(i!=="object"){Ll(r,"data",g);break}case"src":case"href":if(g===""&&(i!=="a"||h!=="href")){r.removeAttribute(h);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(h);break}g=Rl(""+g),r.setAttribute(h,g);break;case"action":case"formAction":if(typeof g=="function"){r.setAttribute(h,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(h==="formAction"?(i!=="input"&&vt(r,i,"name",C.name,C,null),vt(r,i,"formEncType",C.formEncType,C,null),vt(r,i,"formMethod",C.formMethod,C,null),vt(r,i,"formTarget",C.formTarget,C,null)):(vt(r,i,"encType",C.encType,C,null),vt(r,i,"method",C.method,C,null),vt(r,i,"target",C.target,C,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){r.removeAttribute(h);break}g=Rl(""+g),r.setAttribute(h,g);break;case"onClick":g!=null&&(r.onclick=Br);break;case"onScroll":g!=null&&nt("scroll",r);break;case"onScrollEnd":g!=null&&nt("scrollend",r);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(C.children!=null)throw Error(s(60));r.innerHTML=h}}break;case"multiple":r.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":r.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){r.removeAttribute("xlink:href");break}h=Rl(""+g),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",h);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(h,""+g):r.removeAttribute(h);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(h,""):r.removeAttribute(h);break;case"capture":case"download":g===!0?r.setAttribute(h,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?r.setAttribute(h,g):r.removeAttribute(h);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?r.setAttribute(h,g):r.removeAttribute(h);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?r.removeAttribute(h):r.setAttribute(h,g);break;case"popover":nt("beforetoggle",r),nt("toggle",r),Al(r,"popover",g);break;case"xlinkActuate":Pr(r,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":Pr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":Pr(r,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":Pr(r,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":Pr(r,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":Pr(r,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":Pr(r,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":Pr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":Pr(r,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Al(r,"is",g);break;case"innerText":case"textContent":break;default:(!(2<h.length)||h[0]!=="o"&&h[0]!=="O"||h[1]!=="n"&&h[1]!=="N")&&(h=WC.get(h)||h,Al(r,h,g))}}function nf(r,i,h,g,C,j){switch(h){case"style":yg(r,g,j);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(h=g.__html,h!=null){if(C.children!=null)throw Error(s(60));r.innerHTML=h}}break;case"children":typeof g=="string"?Wi(r,g):(typeof g=="number"||typeof g=="bigint")&&Wi(r,""+g);break;case"onScroll":g!=null&&nt("scroll",r);break;case"onScrollEnd":g!=null&&nt("scrollend",r);break;case"onClick":g!=null&&(r.onclick=Br);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ug.hasOwnProperty(h))e:{if(h[0]==="o"&&h[1]==="n"&&(C=h.endsWith("Capture"),i=h.slice(2,C?h.length-7:void 0),j=r[kn]||null,j=j!=null?j[h]:null,typeof j=="function"&&r.removeEventListener(i,j,C),typeof g=="function")){typeof j!="function"&&j!==null&&(h in r?r[h]=null:r.hasAttribute(h)&&r.removeAttribute(h)),r.addEventListener(i,g,C);break e}h in r?r[h]=g:g===!0?r.setAttribute(h,""):Al(r,h,g)}}}function mn(r,i,h){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",r),nt("load",r);var g=!1,C=!1,j;for(j in h)if(h.hasOwnProperty(j)){var I=h[j];if(I!=null)switch(j){case"src":g=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:vt(r,i,j,I,h,null)}}C&&vt(r,i,"srcSet",h.srcSet,h,null),g&&vt(r,i,"src",h.src,h,null);return;case"input":nt("invalid",r);var q=j=I=C=null,ne=null,le=null;for(g in h)if(h.hasOwnProperty(g)){var pe=h[g];if(pe!=null)switch(g){case"name":C=pe;break;case"type":I=pe;break;case"checked":ne=pe;break;case"defaultChecked":le=pe;break;case"value":j=pe;break;case"defaultValue":q=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(s(137,i));break;default:vt(r,i,g,pe,h,null)}}pg(r,j,q,ne,le,I,C,!1);return;case"select":nt("invalid",r),g=I=j=null;for(C in h)if(h.hasOwnProperty(C)&&(q=h[C],q!=null))switch(C){case"value":j=q;break;case"defaultValue":I=q;break;case"multiple":g=q;default:vt(r,i,C,q,h,null)}i=j,h=I,r.multiple=!!g,i!=null?Gi(r,!!g,i,!1):h!=null&&Gi(r,!!g,h,!0);return;case"textarea":nt("invalid",r),j=C=g=null;for(I in h)if(h.hasOwnProperty(I)&&(q=h[I],q!=null))switch(I){case"value":g=q;break;case"defaultValue":C=q;break;case"children":j=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(s(91));break;default:vt(r,i,I,q,h,null)}xg(r,g,C,j);return;case"option":for(ne in h)if(h.hasOwnProperty(ne)&&(g=h[ne],g!=null))switch(ne){case"selected":r.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:vt(r,i,ne,g,h,null)}return;case"dialog":nt("beforetoggle",r),nt("toggle",r),nt("cancel",r),nt("close",r);break;case"iframe":case"object":nt("load",r);break;case"video":case"audio":for(g=0;g<Lo.length;g++)nt(Lo[g],r);break;case"image":nt("error",r),nt("load",r);break;case"details":nt("toggle",r);break;case"embed":case"source":case"link":nt("error",r),nt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in h)if(h.hasOwnProperty(le)&&(g=h[le],g!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:vt(r,i,le,g,h,null)}return;default:if(gd(i)){for(pe in h)h.hasOwnProperty(pe)&&(g=h[pe],g!==void 0&&nf(r,i,pe,g,h,void 0));return}}for(q in h)h.hasOwnProperty(q)&&(g=h[q],g!=null&&vt(r,i,q,g,h,null))}function yE(r,i,h,g){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,j=null,I=null,q=null,ne=null,le=null,pe=null;for(ue in h){var be=h[ue];if(h.hasOwnProperty(ue)&&be!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":ne=be;default:g.hasOwnProperty(ue)||vt(r,i,ue,null,g,be)}}for(var ce in g){var ue=g[ce];if(be=h[ce],g.hasOwnProperty(ce)&&(ue!=null||be!=null))switch(ce){case"type":j=ue;break;case"name":C=ue;break;case"checked":le=ue;break;case"defaultChecked":pe=ue;break;case"value":I=ue;break;case"defaultValue":q=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,i));break;default:ue!==be&&vt(r,i,ce,ue,g,be)}}md(r,I,q,ne,le,pe,j,C);return;case"select":ue=I=q=ce=null;for(j in h)if(ne=h[j],h.hasOwnProperty(j)&&ne!=null)switch(j){case"value":break;case"multiple":ue=ne;default:g.hasOwnProperty(j)||vt(r,i,j,null,g,ne)}for(C in g)if(j=g[C],ne=h[C],g.hasOwnProperty(C)&&(j!=null||ne!=null))switch(C){case"value":ce=j;break;case"defaultValue":q=j;break;case"multiple":I=j;default:j!==ne&&vt(r,i,C,j,g,ne)}i=q,h=I,g=ue,ce!=null?Gi(r,!!h,ce,!1):!!g!=!!h&&(i!=null?Gi(r,!!h,i,!0):Gi(r,!!h,h?[]:"",!1));return;case"textarea":ue=ce=null;for(q in h)if(C=h[q],h.hasOwnProperty(q)&&C!=null&&!g.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:vt(r,i,q,null,g,C)}for(I in g)if(C=g[I],j=h[I],g.hasOwnProperty(I)&&(C!=null||j!=null))switch(I){case"value":ce=C;break;case"defaultValue":ue=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(s(91));break;default:C!==j&&vt(r,i,I,C,g,j)}gg(r,ce,ue);return;case"option":for(var Le in h)if(ce=h[Le],h.hasOwnProperty(Le)&&ce!=null&&!g.hasOwnProperty(Le))switch(Le){case"selected":r.selected=!1;break;default:vt(r,i,Le,null,g,ce)}for(ne in g)if(ce=g[ne],ue=h[ne],g.hasOwnProperty(ne)&&ce!==ue&&(ce!=null||ue!=null))switch(ne){case"selected":r.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:vt(r,i,ne,ce,g,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in h)ce=h[Ue],h.hasOwnProperty(Ue)&&ce!=null&&!g.hasOwnProperty(Ue)&&vt(r,i,Ue,null,g,ce);for(le in g)if(ce=g[le],ue=h[le],g.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,i));break;default:vt(r,i,le,ce,g,ue)}return;default:if(gd(i)){for(var bt in h)ce=h[bt],h.hasOwnProperty(bt)&&ce!==void 0&&!g.hasOwnProperty(bt)&&nf(r,i,bt,void 0,g,ce);for(pe in g)ce=g[pe],ue=h[pe],!g.hasOwnProperty(pe)||ce===ue||ce===void 0&&ue===void 0||nf(r,i,pe,ce,g,ue);return}}for(var ae in h)ce=h[ae],h.hasOwnProperty(ae)&&ce!=null&&!g.hasOwnProperty(ae)&&vt(r,i,ae,null,g,ce);for(be in g)ce=g[be],ue=h[be],!g.hasOwnProperty(be)||ce===ue||ce==null&&ue==null||vt(r,i,be,ce,g,ue)}function vy(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function vE(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,h=performance.getEntriesByType("resource"),g=0;g<h.length;g++){var C=h[g],j=C.transferSize,I=C.initiatorType,q=C.duration;if(j&&q&&vy(I)){for(I=0,q=C.responseEnd,g+=1;g<h.length;g++){var ne=h[g],le=ne.startTime;if(le>q)break;var pe=ne.transferSize,be=ne.initiatorType;pe&&vy(be)&&(ne=ne.responseEnd,I+=pe*(ne<q?1:(q-le)/(ne-le)))}if(--g,i+=8*(j+I)/(C.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var rf=null,sf=null;function Tc(r){return r.nodeType===9?r:r.ownerDocument}function by(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sy(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function af(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var of=null;function bE(){var r=window.event;return r&&r.type==="popstate"?r===of?!1:(of=r,!0):(of=null,!1)}var wy=typeof setTimeout=="function"?setTimeout:void 0,SE=typeof clearTimeout=="function"?clearTimeout:void 0,Cy=typeof Promise=="function"?Promise:void 0,wE=typeof queueMicrotask=="function"?queueMicrotask:typeof Cy<"u"?function(r){return Cy.resolve(null).then(r).catch(CE)}:wy;function CE(r){setTimeout(function(){throw r})}function As(r){return r==="head"}function ky(r,i){var h=i,g=0;do{var C=h.nextSibling;if(r.removeChild(h),C&&C.nodeType===8)if(h=C.data,h==="/$"||h==="/&"){if(g===0){r.removeChild(C),wa(i);return}g--}else if(h==="$"||h==="$?"||h==="$~"||h==="$!"||h==="&")g++;else if(h==="html")Ro(r.ownerDocument.documentElement);else if(h==="head"){h=r.ownerDocument.head,Ro(h);for(var j=h.firstChild;j;){var I=j.nextSibling,q=j.nodeName;j[Xa]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&j.rel.toLowerCase()==="stylesheet"||h.removeChild(j),j=I}}else h==="body"&&Ro(r.ownerDocument.body);h=C}while(h);wa(i)}function Ey(r,i){var h=r;r=0;do{var g=h.nextSibling;if(h.nodeType===1?i?(h._stashedDisplay=h.style.display,h.style.display="none"):(h.style.display=h._stashedDisplay||"",h.getAttribute("style")===""&&h.removeAttribute("style")):h.nodeType===3&&(i?(h._stashedText=h.nodeValue,h.nodeValue=""):h.nodeValue=h._stashedText||""),g&&g.nodeType===8)if(h=g.data,h==="/$"){if(r===0)break;r--}else h!=="$"&&h!=="$?"&&h!=="$~"&&h!=="$!"||r++;h=g}while(h)}function lf(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var h=i;switch(i=i.nextSibling,h.nodeName){case"HTML":case"HEAD":case"BODY":lf(h),hd(h);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(h.rel.toLowerCase()==="stylesheet")continue}r.removeChild(h)}}function kE(r,i,h,g){for(;r.nodeType===1;){var C=h;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!g&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(g){if(!r[Xa])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(j=r.getAttribute("rel"),j==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(j!==C.rel||r.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||r.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||r.getAttribute("title")!==(C.title==null?null:C.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(j=r.getAttribute("src"),(j!==(C.src==null?null:C.src)||r.getAttribute("type")!==(C.type==null?null:C.type)||r.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&j&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var j=C.name==null?null:""+C.name;if(C.type==="hidden"&&r.getAttribute("name")===j)return r}else return r;if(r=nr(r.nextSibling),r===null)break}return null}function EE(r,i,h){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!h||(r=nr(r.nextSibling),r===null))return null;return r}function jy(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=nr(r.nextSibling),r===null))return null;return r}function cf(r){return r.data==="$?"||r.data==="$~"}function uf(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function jE(r,i){var h=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||h.readyState!=="loading")i();else{var g=function(){i(),h.removeEventListener("DOMContentLoaded",g)};h.addEventListener("DOMContentLoaded",g),r._reactRetry=g}}function nr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var df=null;function Ty(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var h=r.data;if(h==="/$"||h==="/&"){if(i===0)return nr(r.nextSibling);i--}else h!=="$"&&h!=="$!"&&h!=="$?"&&h!=="$~"&&h!=="&"||i++}r=r.nextSibling}return null}function Ny(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var h=r.data;if(h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"){if(i===0)return r;i--}else h!=="/$"&&h!=="/&"||i++}r=r.previousSibling}return null}function Ay(r,i,h){switch(i=Tc(h),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function Ro(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);hd(r)}var rr=new Map,Ly=new Set;function Nc(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var es=K.d;K.d={f:TE,r:NE,D:AE,C:LE,L:DE,m:RE,X:ME,S:OE,M:IE};function TE(){var r=es.f(),i=vc();return r||i}function NE(r){var i=Ui(r);i!==null&&i.tag===5&&i.type==="form"?Kx(i):es.r(r)}var va=typeof document>"u"?null:document;function Dy(r,i,h){var g=va;if(g&&typeof i=="string"&&i){var C=Yn(i);C='link[rel="'+r+'"][href="'+C+'"]',typeof h=="string"&&(C+='[crossorigin="'+h+'"]'),Ly.has(C)||(Ly.add(C),r={rel:r,crossOrigin:h,href:i},g.querySelector(C)===null&&(i=g.createElement("link"),mn(i,"link",r),an(i),g.head.appendChild(i)))}}function AE(r){es.D(r),Dy("dns-prefetch",r,null)}function LE(r,i){es.C(r,i),Dy("preconnect",r,i)}function DE(r,i,h){es.L(r,i,h);var g=va;if(g&&r&&i){var C='link[rel="preload"][as="'+Yn(i)+'"]';i==="image"&&h&&h.imageSrcSet?(C+='[imagesrcset="'+Yn(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(C+='[imagesizes="'+Yn(h.imageSizes)+'"]')):C+='[href="'+Yn(r)+'"]';var j=C;switch(i){case"style":j=ba(r);break;case"script":j=Sa(r)}rr.has(j)||(r=m({rel:"preload",href:i==="image"&&h&&h.imageSrcSet?void 0:r,as:i},h),rr.set(j,r),g.querySelector(C)!==null||i==="style"&&g.querySelector(Oo(j))||i==="script"&&g.querySelector(Mo(j))||(i=g.createElement("link"),mn(i,"link",r),an(i),g.head.appendChild(i)))}}function RE(r,i){es.m(r,i);var h=va;if(h&&r){var g=i&&typeof i.as=="string"?i.as:"script",C='link[rel="modulepreload"][as="'+Yn(g)+'"][href="'+Yn(r)+'"]',j=C;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Sa(r)}if(!rr.has(j)&&(r=m({rel:"modulepreload",href:r},i),rr.set(j,r),h.querySelector(C)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(Mo(j)))return}g=h.createElement("link"),mn(g,"link",r),an(g),h.head.appendChild(g)}}}function OE(r,i,h){es.S(r,i,h);var g=va;if(g&&r){var C=Fi(g).hoistableStyles,j=ba(r);i=i||"default";var I=C.get(j);if(!I){var q={loading:0,preload:null};if(I=g.querySelector(Oo(j)))q.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":i},h),(h=rr.get(j))&&hf(r,h);var ne=I=g.createElement("link");an(ne),mn(ne,"link",r),ne._p=new Promise(function(le,pe){ne.onload=le,ne.onerror=pe}),ne.addEventListener("load",function(){q.loading|=1}),ne.addEventListener("error",function(){q.loading|=2}),q.loading|=4,Ac(I,i,g)}I={type:"stylesheet",instance:I,count:1,state:q},C.set(j,I)}}}function ME(r,i){es.X(r,i);var h=va;if(h&&r){var g=Fi(h).hoistableScripts,C=Sa(r),j=g.get(C);j||(j=h.querySelector(Mo(C)),j||(r=m({src:r,async:!0},i),(i=rr.get(C))&&ff(r,i),j=h.createElement("script"),an(j),mn(j,"link",r),h.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},g.set(C,j))}}function IE(r,i){es.M(r,i);var h=va;if(h&&r){var g=Fi(h).hoistableScripts,C=Sa(r),j=g.get(C);j||(j=h.querySelector(Mo(C)),j||(r=m({src:r,async:!0,type:"module"},i),(i=rr.get(C))&&ff(r,i),j=h.createElement("script"),an(j),mn(j,"link",r),h.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},g.set(C,j))}}function Ry(r,i,h,g){var C=(C=re.current)?Nc(C):null;if(!C)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(i=ba(h.href),h=Fi(C).hoistableStyles,g=h.get(i),g||(g={type:"style",instance:null,count:0,state:null},h.set(i,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){r=ba(h.href);var j=Fi(C).hoistableStyles,I=j.get(r);if(I||(C=C.ownerDocument||C,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(r,I),(j=C.querySelector(Oo(r)))&&!j._p&&(I.instance=j,I.state.loading=5),rr.has(r)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},rr.set(r,h),j||PE(C,r,h,I.state))),i&&g===null)throw Error(s(528,""));return I}if(i&&g!==null)throw Error(s(529,""));return null;case"script":return i=h.async,h=h.src,typeof h=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Sa(h),h=Fi(C).hoistableScripts,g=h.get(i),g||(g={type:"script",instance:null,count:0,state:null},h.set(i,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function ba(r){return'href="'+Yn(r)+'"'}function Oo(r){return'link[rel="stylesheet"]['+r+"]"}function Oy(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function PE(r,i,h,g){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?g.loading=1:(i=r.createElement("link"),g.preload=i,i.addEventListener("load",function(){return g.loading|=1}),i.addEventListener("error",function(){return g.loading|=2}),mn(i,"link",h),an(i),r.head.appendChild(i))}function Sa(r){return'[src="'+Yn(r)+'"]'}function Mo(r){return"script[async]"+r}function My(r,i,h){if(i.count++,i.instance===null)switch(i.type){case"style":var g=r.querySelector('style[data-href~="'+Yn(h.href)+'"]');if(g)return i.instance=g,an(g),g;var C=m({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return g=(r.ownerDocument||r).createElement("style"),an(g),mn(g,"style",C),Ac(g,h.precedence,r),i.instance=g;case"stylesheet":C=ba(h.href);var j=r.querySelector(Oo(C));if(j)return i.state.loading|=4,i.instance=j,an(j),j;g=Oy(h),(C=rr.get(C))&&hf(g,C),j=(r.ownerDocument||r).createElement("link"),an(j);var I=j;return I._p=new Promise(function(q,ne){I.onload=q,I.onerror=ne}),mn(j,"link",g),i.state.loading|=4,Ac(j,h.precedence,r),i.instance=j;case"script":return j=Sa(h.src),(C=r.querySelector(Mo(j)))?(i.instance=C,an(C),C):(g=h,(C=rr.get(j))&&(g=m({},h),ff(g,C)),r=r.ownerDocument||r,C=r.createElement("script"),an(C),mn(C,"link",g),r.head.appendChild(C),i.instance=C);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(g=i.instance,i.state.loading|=4,Ac(g,h.precedence,r));return i.instance}function Ac(r,i,h){for(var g=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=g.length?g[g.length-1]:null,j=C,I=0;I<g.length;I++){var q=g[I];if(q.dataset.precedence===i)j=q;else if(j!==C)break}j?j.parentNode.insertBefore(r,j.nextSibling):(i=h.nodeType===9?h.head:h,i.insertBefore(r,i.firstChild))}function hf(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function ff(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Lc=null;function Iy(r,i,h){if(Lc===null){var g=new Map,C=Lc=new Map;C.set(h,g)}else C=Lc,g=C.get(h),g||(g=new Map,C.set(h,g));if(g.has(r))return g;for(g.set(r,null),h=h.getElementsByTagName(r),C=0;C<h.length;C++){var j=h[C];if(!(j[Xa]||j[gt]||r==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var I=j.getAttribute(i)||"";I=r+I;var q=g.get(I);q?q.push(j):g.set(I,[j])}}return g}function Py(r,i,h){r=r.ownerDocument||r,r.head.insertBefore(h,i==="title"?r.querySelector("head > title"):null)}function BE(r,i,h){if(h===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function By(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function zE(r,i,h,g){if(h.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var C=ba(g.href),j=i.querySelector(Oo(C));if(j){i=j._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Dc.bind(r),i.then(r,r)),h.state.loading|=4,h.instance=j,an(j);return}j=i.ownerDocument||i,g=Oy(g),(C=rr.get(C))&&hf(g,C),j=j.createElement("link"),an(j);var I=j;I._p=new Promise(function(q,ne){I.onload=q,I.onerror=ne}),mn(j,"link",g),h.instance=j}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(h,i),(i=h.state.preload)&&(h.state.loading&3)===0&&(r.count++,h=Dc.bind(r),i.addEventListener("load",h),i.addEventListener("error",h))}}var mf=0;function HE(r,i){return r.stylesheets&&r.count===0&&Oc(r,r.stylesheets),0<r.count||0<r.imgCount?function(h){var g=setTimeout(function(){if(r.stylesheets&&Oc(r,r.stylesheets),r.unsuspend){var j=r.unsuspend;r.unsuspend=null,j()}},6e4+i);0<r.imgBytes&&mf===0&&(mf=62500*vE());var C=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Oc(r,r.stylesheets),r.unsuspend)){var j=r.unsuspend;r.unsuspend=null,j()}},(r.imgBytes>mf?50:800)+i);return r.unsuspend=h,function(){r.unsuspend=null,clearTimeout(g),clearTimeout(C)}}:null}function Dc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oc(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Rc=null;function Oc(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Rc=new Map,i.forEach($E,r),Rc=null,Dc.call(r))}function $E(r,i){if(!(i.state.loading&4)){var h=Rc.get(r);if(h)var g=h.get(null);else{h=new Map,Rc.set(r,h);for(var C=r.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<C.length;j++){var I=C[j];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(h.set(I.dataset.precedence,I),g=I)}g&&h.set(null,g)}C=i.instance,I=C.getAttribute("data-precedence"),j=h.get(I)||g,j===g&&h.set(null,C),h.set(I,C),this.count++,g=Dc.bind(this),C.addEventListener("load",g),C.addEventListener("error",g),j?j.parentNode.insertBefore(C,j.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(C,r.firstChild)),i.state.loading|=4}}var Io={$$typeof:b,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function UE(r,i,h,g,C,j,I,q,ne){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zi(0),this.hiddenUpdates=zi(null),this.identifierPrefix=g,this.onUncaughtError=C,this.onCaughtError=j,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function zy(r,i,h,g,C,j,I,q,ne,le,pe,be){return r=new UE(r,i,h,I,ne,le,pe,be,q),i=1,j===!0&&(i|=24),j=Pn(3,null,null,i),r.current=j,j.stateNode=r,i=Wd(),i.refCount++,r.pooledCache=i,i.refCount++,j.memoizedState={element:g,isDehydrated:h,cache:i},Xd(j),r}function Hy(r){return r?(r=Zi,r):Zi}function $y(r,i,h,g,C,j){C=Hy(C),g.context===null?g.context=C:g.pendingContext=C,g=ys(i),g.payload={element:h},j=j===void 0?null:j,j!==null&&(g.callback=j),h=vs(r,g,i),h!==null&&(Ln(h,r,i),mo(h,r,i))}function Uy(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var h=r.retryLane;r.retryLane=h!==0&&h<i?h:i}}function pf(r,i){Uy(r,i),(r=r.alternate)&&Uy(r,i)}function Fy(r){if(r.tag===13||r.tag===31){var i=ei(r,67108864);i!==null&&Ln(i,r,67108864),pf(r,67108864)}}function Vy(r){if(r.tag===13||r.tag===31){var i=Un();i=Ze(i);var h=ei(r,i);h!==null&&Ln(h,r,i),pf(r,i)}}var Mc=!0;function FE(r,i,h,g){var C=H.T;H.T=null;var j=K.p;try{K.p=2,gf(r,i,h,g)}finally{K.p=j,H.T=C}}function VE(r,i,h,g){var C=H.T;H.T=null;var j=K.p;try{K.p=8,gf(r,i,h,g)}finally{K.p=j,H.T=C}}function gf(r,i,h,g){if(Mc){var C=xf(g);if(C===null)tf(r,i,g,Ic,h),Wy(r,g);else if(WE(C,r,i,h,g))g.stopPropagation();else if(Wy(r,g),i&4&&-1<GE.indexOf(r)){for(;C!==null;){var j=Ui(C);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var I=Sr(j.pendingLanes);if(I!==0){var q=j;for(q.pendingLanes|=2,q.entangledLanes|=2;I;){var ne=1<<31-pt(I);q.entanglements[1]|=ne,I&=~ne}Er(j),(mt&6)===0&&(_c=St()+500,Ao(0))}}break;case 31:case 13:q=ei(j,2),q!==null&&Ln(q,j,2),vc(),pf(j,2)}if(j=xf(g),j===null&&tf(r,i,g,Ic,h),j===C)break;C=j}C!==null&&g.stopPropagation()}else tf(r,i,g,null,h)}}function xf(r){return r=_d(r),_f(r)}var Ic=null;function _f(r){if(Ic=null,r=$i(r),r!==null){var i=o(r);if(i===null)r=null;else{var h=i.tag;if(h===13){if(r=u(i),r!==null)return r;r=null}else if(h===31){if(r=c(i),r!==null)return r;r=null}else if(h===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Ic=r,null}function Gy(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(pn()){case me:return 2;case Ee:return 8;case Oe:case Fe:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var yf=!1,Ls=null,Ds=null,Rs=null,Po=new Map,Bo=new Map,Os=[],GE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Wy(r,i){switch(r){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":Ds=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":Po.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bo.delete(i.pointerId)}}function zo(r,i,h,g,C,j){return r===null||r.nativeEvent!==j?(r={blockedOn:i,domEventName:h,eventSystemFlags:g,nativeEvent:j,targetContainers:[C]},i!==null&&(i=Ui(i),i!==null&&Fy(i)),r):(r.eventSystemFlags|=g,i=r.targetContainers,C!==null&&i.indexOf(C)===-1&&i.push(C),r)}function WE(r,i,h,g,C){switch(i){case"focusin":return Ls=zo(Ls,r,i,h,g,C),!0;case"dragenter":return Ds=zo(Ds,r,i,h,g,C),!0;case"mouseover":return Rs=zo(Rs,r,i,h,g,C),!0;case"pointerover":var j=C.pointerId;return Po.set(j,zo(Po.get(j)||null,r,i,h,g,C)),!0;case"gotpointercapture":return j=C.pointerId,Bo.set(j,zo(Bo.get(j)||null,r,i,h,g,C)),!0}return!1}function qy(r){var i=$i(r.target);if(i!==null){var h=o(i);if(h!==null){if(i=h.tag,i===13){if(i=u(h),i!==null){r.blockedOn=i,un(r.priority,function(){Vy(h)});return}}else if(i===31){if(i=c(h),i!==null){r.blockedOn=i,un(r.priority,function(){Vy(h)});return}}else if(i===3&&h.stateNode.current.memoizedState.isDehydrated){r.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Pc(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var h=xf(r.nativeEvent);if(h===null){h=r.nativeEvent;var g=new h.constructor(h.type,h);xd=g,h.target.dispatchEvent(g),xd=null}else return i=Ui(h),i!==null&&Fy(i),r.blockedOn=h,!1;i.shift()}return!0}function Ky(r,i,h){Pc(r)&&h.delete(i)}function qE(){yf=!1,Ls!==null&&Pc(Ls)&&(Ls=null),Ds!==null&&Pc(Ds)&&(Ds=null),Rs!==null&&Pc(Rs)&&(Rs=null),Po.forEach(Ky),Bo.forEach(Ky)}function Bc(r,i){r.blockedOn===i&&(r.blockedOn=null,yf||(yf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,qE)))}var zc=null;function Yy(r){zc!==r&&(zc=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zc===r&&(zc=null);for(var i=0;i<r.length;i+=3){var h=r[i],g=r[i+1],C=r[i+2];if(typeof g!="function"){if(_f(g||h)===null)continue;break}var j=Ui(h);j!==null&&(r.splice(i,3),i-=3,gh(j,{pending:!0,data:C,method:h.method,action:g},g,C))}}))}function wa(r){function i(ne){return Bc(ne,r)}Ls!==null&&Bc(Ls,r),Ds!==null&&Bc(Ds,r),Rs!==null&&Bc(Rs,r),Po.forEach(i),Bo.forEach(i);for(var h=0;h<Os.length;h++){var g=Os[h];g.blockedOn===r&&(g.blockedOn=null)}for(;0<Os.length&&(h=Os[0],h.blockedOn===null);)qy(h),h.blockedOn===null&&Os.shift();if(h=(r.ownerDocument||r).$$reactFormReplay,h!=null)for(g=0;g<h.length;g+=3){var C=h[g],j=h[g+1],I=C[kn]||null;if(typeof j=="function")I||Yy(h);else if(I){var q=null;if(j&&j.hasAttribute("formAction")){if(C=j,I=j[kn]||null)q=I.formAction;else if(_f(C)!==null)continue}else q=I.action;typeof q=="function"?h[g+1]=q:(h.splice(g,3),g-=3),Yy(h)}}}function Xy(){function r(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(I){return C=I})},focusReset:"manual",scroll:"manual"})}function i(){C!==null&&(C(),C=null),g||setTimeout(h,20)}function h(){if(!g&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,C=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(h,100),function(){g=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),C!==null&&(C(),C=null)}}}function vf(r){this._internalRoot=r}Hc.prototype.render=vf.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var h=i.current,g=Un();$y(h,g,r,i,null,null)},Hc.prototype.unmount=vf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;$y(r.current,2,null,r,null,null),vc(),i[Hi]=null}};function Hc(r){this._internalRoot=r}Hc.prototype.unstable_scheduleHydration=function(r){if(r){var i=ct();r={blockedOn:null,target:r,priority:i};for(var h=0;h<Os.length&&i!==0&&i<Os[h].priority;h++);Os.splice(h,0,r),h===0&&qy(r)}};var Qy=t.version;if(Qy!=="19.2.4")throw Error(s(527,Qy,"19.2.4"));K.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=f(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var KE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$c.isDisabled&&$c.supportsFiber)try{Lt=$c.inject(KE),ft=$c}catch{}}return $o.createRoot=function(r,i){if(!a(r))throw Error(s(299));var h=!1,g="",C=s_,j=i_,I=a_;return i!=null&&(i.unstable_strictMode===!0&&(h=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onUncaughtError!==void 0&&(C=i.onUncaughtError),i.onCaughtError!==void 0&&(j=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError)),i=zy(r,1,!1,null,null,h,g,null,C,j,I,Xy),r[Hi]=i.current,ef(r),new vf(i)},$o.hydrateRoot=function(r,i,h){if(!a(r))throw Error(s(299));var g=!1,C="",j=s_,I=i_,q=a_,ne=null;return h!=null&&(h.unstable_strictMode===!0&&(g=!0),h.identifierPrefix!==void 0&&(C=h.identifierPrefix),h.onUncaughtError!==void 0&&(j=h.onUncaughtError),h.onCaughtError!==void 0&&(I=h.onCaughtError),h.onRecoverableError!==void 0&&(q=h.onRecoverableError),h.formState!==void 0&&(ne=h.formState)),i=zy(r,1,!0,i,h??null,g,C,ne,j,I,q,Xy),i.context=Hy(null),h=i.current,g=Un(),g=Ze(g),C=ys(g),C.callback=null,vs(h,C,g),h=g,i.current.lanes=h,hs(i,h),Er(i),r[Hi]=i.current,ef(r),new Hc(i)},$o.version="19.2.4",$o}var cv;function c2(){if(cv)return kf.exports;cv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),kf.exports=l2(),kf.exports}var u2=c2();const d2=Mu(u2),uv=e=>{let t;const n=new Set,s=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const x=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(_=>_(t,x))}},a=()=>t,c={setState:s,getState:a,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f))},d=t=e(s,a,c);return c},h2=(e=>e?uv(e):uv),f2=e=>e;function m2(e,t=f2){const n=$s.useSyncExternalStore(e.subscribe,$s.useCallback(()=>t(e.getState()),[e,t]),$s.useCallback(()=>t(e.getInitialState()),[e,t]));return $s.useDebugValue(n),n}const dv=e=>{const t=h2(e),n=s=>m2(t,s);return Object.assign(n,t),n},qn=(e=>e?dv(e):dv);async function Te(e,t={}){const n=localStorage.getItem("openfox_token"),s={...t.headers instanceof Headers?Object.fromEntries(t.headers.entries()):t.headers,...n?{"x-session-token":n}:{}};return fetch(e,{...t,headers:s})}async function p2(e,t){try{return(await Te(`/api/sessions/${e}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messageIndex:t})})).ok}catch{return!1}}const Be={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings",DISPLAY_SHOW_THINKING:"display.showThinking",DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT:"display.showVerboseToolOutput",DISPLAY_SHOW_STATS:"display.showStats",DISPLAY_SHOW_AGENT_DEFINITIONS:"display.showAgentDefinitions",DISPLAY_SHOW_WORKFLOW_BARS:"display.showWorkflowBars",DISPLAY_SHOW_SYNTAX_HIGHLIGHTING:"display.showSyntaxHighlighting",DISPLAY_THEME:"display.theme",DISPLAY_USER_PRESETS:"display.userPresets",DISPLAY_FOLLOW_SYSTEM_THEME:"display.followSystemTheme",DISPLAY_SHOW_OPEN_IN_EDITOR:"display.showOpenInEditorLinks",LLM_DYNAMIC_SYSTEM_PROMPT:"llm.dynamicSystemPrompt",KEYBINDINGS:"keybindings",RETRY_PATTERNS:"agent.retryPatterns"};function Uc(e,t){return n=>({loading:{...n.loading,[e]:t}})}function hv(e,t){return n=>({settings:{...n.settings,[e]:t},loading:{...n.loading,[e]:!1}})}const Z0=[Be.DISPLAY_SHOW_THINKING,Be.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,Be.DISPLAY_SHOW_STATS,Be.DISPLAY_SHOW_AGENT_DEFINITIONS,Be.DISPLAY_SHOW_WORKFLOW_BARS,Be.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING,Be.DISPLAY_FOLLOW_SYSTEM_THEME,Be.DISPLAY_SHOW_OPEN_IN_EDITOR];function Pu(){return{showThinking:rn(e=>e.settings[Be.DISPLAY_SHOW_THINKING]??"true")==="true",showVerboseToolOutput:rn(e=>e.settings[Be.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT]??"true")==="true",showStats:rn(e=>e.settings[Be.DISPLAY_SHOW_STATS]??"true")==="true",showAgentDefinitions:rn(e=>e.settings[Be.DISPLAY_SHOW_AGENT_DEFINITIONS]??"true")==="true",showWorkflowBars:rn(e=>e.settings[Be.DISPLAY_SHOW_WORKFLOW_BARS]??"true")==="true",showSyntaxHighlighting:rn(e=>e.settings[Be.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING]??"true")==="true"}}const rn=qn(e=>({settings:{},loading:{},getSetting:async t=>{e(Uc(t,!0));try{const s=await(await Te(`/api/settings/${t}`)).json();return e(hv(t,s.value??"")),s.value}catch{return e(Uc(t,!1)),null}},getSettings:async t=>{if(t.length!==0)try{const s=await(await Te(`/api/settings?keys=${encodeURIComponent(t.join(","))}`)).json();e({settings:s,loading:Object.fromEntries(t.map(a=>[a,!1]))})}catch{e({loading:Object.fromEntries(t.map(n=>[n,!1]))})}},setSetting:async(t,n)=>{e(Uc(t,!0));try{const a=await(await Te(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n})})).json();e(hv(t,a.value??""))}catch{e(Uc(t,!1))}}})),Nf=Object.freeze(Object.defineProperty({__proto__:null,DISPLAY_SETTINGS_KEYS:Z0,SETTINGS_KEYS:Be,useDisplaySettings:Pu,useSettingsStore:rn},Symbol.toStringTag,{value:"Module"}));function g2(){const[e,t]=R.useState({offsetTop:0,height:window.innerHeight,keyboardVisible:!1}),n=R.useRef(window.innerHeight);return R.useEffect(()=>{const s=window.visualViewport;if(!s)return;const a=()=>{const o=s.offsetTop,u=s.height,c=n.current-u>100;t({offsetTop:o,height:u,keyboardVisible:c})};return a(),s.addEventListener("resize",a),s.addEventListener("scroll",a),()=>{s.removeEventListener("resize",a),s.removeEventListener("scroll",a)}},[]),e}function x2(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,s,a,o,u=[],c="",d=e.split("/");for(d[0]||d.shift();a=d.shift();)n=a[0],n==="*"?(u.push(n),c+=a[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(s=a.indexOf("?",1),o=a.indexOf(".",1),u.push(a.substring(1,~s?s:~o?o:a.length)),c+=~s&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(c+=(~s?"?":"")+"\\"+a.substring(o))):c+="/"+a;return{keys:u,pattern:new RegExp("^"+c+(t?"(?=$|/)":"/?$"),"i")}}var Af={exports:{}},Lf={};/**
|
|
51
|
-
* @license React
|
|
52
|
-
* use-sync-external-store-shim.production.js
|
|
53
|
-
*
|
|
54
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the MIT license found in the
|
|
57
|
-
* LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/var fv;function _2(){if(fv)return Lf;fv=1;var e=Iu();function t(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,o=e.useLayoutEffect,u=e.useDebugValue;function c(m,x){var _=x(),w=s({inst:{value:_,getSnapshot:x}}),k=w[0].inst,v=w[1];return o(function(){k.value=_,k.getSnapshot=x,d(k)&&v({inst:k})},[m,_,x]),a(function(){return d(k)&&v({inst:k}),m(function(){d(k)&&v({inst:k})})},[m]),u(_),_}function d(m){var x=m.getSnapshot;m=m.value;try{var _=x();return!n(m,_)}catch{return!0}}function f(m,x){return x()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Lf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Lf}var mv;function y2(){return mv||(mv=1,Af.exports=_2()),Af.exports}var v2=y2();const b2=s2.useInsertionEffect,S2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",w2=S2?R.useLayoutEffect:R.useEffect,C2=b2||w2,eS=e=>{const t=R.useRef([e,(...n)=>t[0](...n)]).current;return C2(()=>{t[0]=e}),t[1]},k2="popstate",ip="pushState",ap="replaceState",E2="hashchange",pv=[k2,ip,ap,E2],j2=e=>{for(const t of pv)addEventListener(t,e);return()=>{for(const t of pv)removeEventListener(t,e)}},tS=(e,t)=>v2.useSyncExternalStore(j2,e,t),gv=()=>location.search,T2=({ssrSearch:e}={})=>tS(gv,e!=null?()=>e:gv),xv=()=>location.pathname,N2=({ssrPath:e}={})=>tS(xv,e!=null?()=>e:xv),A2=(e,{replace:t=!1,state:n=null}={})=>history[t?ap:ip](n,"",e),L2=(e={})=>[N2(e),A2],_v=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[_v]>"u"){for(const e of[ip,ap]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),n}}Object.defineProperty(window,_v,{value:!0})}const D2=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",nS=(e="")=>e==="/"?"":e,R2=(e,t)=>e[0]==="~"?e.slice(1):nS(t)+e,O2=(e="",t)=>D2(yv(nS(e)),yv(t)),yv=e=>{try{return decodeURI(e)}catch{return e}},rS={hook:L2,searchHook:T2,parser:x2,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,t,n)=>e(t,n)},sS=R.createContext(rS),Fa=()=>R.useContext(sS),iS={},aS=R.createContext(iS),M2=()=>R.useContext(aS),Bu=e=>{const[t,n]=e.hook(e);return[O2(e.base,t),eS((s,a)=>e.aroundNav(n,R2(s,e.base),a))]},br=()=>Bu(Fa()),op=(e,t,n,s)=>{const{pattern:a,keys:o}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",s),u=a.exec(n)||[],[c,...d]=u;return c!==void 0?[!0,(()=>{const f=o!==!1?Object.fromEntries(o.map((m,x)=>[m,d[x]])):u.groups;let p={...d};return f&&Object.assign(p,f),p})(),...s?[c]:[]]:[!1,null]},lp=e=>op(Fa().parser,e,br()[0]),I2=({children:e,...t})=>{var p,m,x;const n=Fa(),s=t.hook?rS:n;let a=s;const[o,u=t.ssrSearch??""]=((p=t.ssrPath)==null?void 0:p.split("?"))??[];o&&(t.ssrSearch=u,t.ssrPath=o),t.hrefs=t.hrefs??((m=t.hook)==null?void 0:m.hrefs),t.searchHook=t.searchHook??((x=t.hook)==null?void 0:x.searchHook);let c=R.useRef({}),d=c.current,f=d;for(let _ in s){const w=_==="base"?s[_]+(t[_]??""):t[_]??s[_];d===f&&w!==f[_]&&(c.current=f={...f}),f[_]=w,(w!==s[_]||w!==a[_])&&(a=f)}return R.createElement(sS.Provider,{value:a,children:e})},vv=({children:e,component:t},n)=>t?R.createElement(t,{params:n}):typeof e=="function"?e(n):e,P2=e=>{let t=R.useRef(iS);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([s,a])=>a!==n[s])?e:n},Uo=({path:e,nest:t,match:n,...s})=>{const a=Fa(),[o]=Bu(a),[u,c,d]=n??op(a.parser,e,o,t),f=P2({...M2(),...c});if(!u)return null;const p=d?R.createElement(I2,{base:d},vv(s,f)):vv(s,f);return R.createElement(aS.Provider,{value:f,children:p})},Gn=R.forwardRef((e,t)=>{const n=Fa(),[s,a]=Bu(n),{to:o="",href:u=o,onClick:c,asChild:d,children:f,className:p,replace:m,state:x,transition:_,...w}=e,k=eS(S=>{S.ctrlKey||S.metaKey||S.altKey||S.shiftKey||S.button!==0||(c==null||c(S),S.defaultPrevented||(S.preventDefault(),a(u,e)))}),v=n.hrefs(u[0]==="~"?u.slice(1):n.base+u,n);return d&&R.isValidElement(f)?R.cloneElement(f,{onClick:k,href:v}):R.createElement("a",{...w,onClick:k,href:v,className:p!=null&&p.call?p(s===u):p,children:f,ref:t})}),oS=e=>Array.isArray(e)?e.flatMap(t=>oS(t&&t.type===R.Fragment?t.props.children:t)):[e],B2=({children:e,location:t})=>{const n=Fa(),[s]=Bu(n);for(const a of oS(e)){let o=0;if(R.isValidElement(a)&&(o=op(n.parser,a.props.path,t||s,a.props.nest))[0])return R.cloneElement(a,{match:o})}return null};function z2(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function lS(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class H2{constructor(t){he(this,"ws",null);he(this,"handlers",new Set);he(this,"statusHandler",null);he(this,"baseUrl");he(this,"isReconnecting",!1);he(this,"connectingPromise",null);he(this,"lastCloseCode",0);he(this,"reconnectAttempts",0);he(this,"manualReconnectScheduled",!1);this.baseUrl=t}getUrl(){const t=localStorage.getItem("openfox_token");if(t){const n=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${n}token=${encodeURIComponent(t)}`}return this.baseUrl}setToken(t){localStorage.setItem("openfox_token",t)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(t){this.statusHandler=t}connect(){var t,n,s;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((n=this.ws)==null?void 0:n.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.CONNECTING?(console.warn("[WS CLIENT] Connection already in progress, returning existing promise"),this.connectingPromise):(this.connectingPromise=new Promise((a,o)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const c=setTimeout(()=>{var d;((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING&&(this.ws.close(),o(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var d;clearTimeout(c),this.isReconnecting=!1,this.connectingPromise=null,(d=this.statusHandler)==null||d.call(this,"connected"),a()},this.ws.onclose=d=>{var f,p,m;clearTimeout(c),this.lastCloseCode=d.code,((f=this.ws)==null?void 0:f.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),o(new Error(`Connection closed: ${d.code}`))):(this.connectingPromise=null,(m=this.statusHandler)==null||m.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=d=>{clearTimeout(c),console.error("WebSocket error:",d),this.connectingPromise=null,o(d)},this.ws.onmessage=d=>{try{const f=JSON.parse(d.data);z2(f)&&this.handlers.forEach(p=>p(f))}catch(f){console.error("Failed to parse WebSocket message:",f)}}}catch(u){this.connectingPromise=null,o(u)}}),this.connectingPromise)))}attemptReconnect(){var a;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.warn("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(a=this.statusHandler)==null||a.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(t,n){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=lS(),a={id:s,type:t,payload:n};return this.ws.send(JSON.stringify(a)),s}subscribe(t){return this.handlers.add(t),()=>this.handlers.delete(t)}get isConnected(){var t;return((t=this.ws)==null?void 0:t.readyState)===WebSocket.OPEN}}const $2=window.location.protocol==="https:"?"wss:":"ws:";let Sm=window.location.port;Sm||(Sm=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"10469":window.location.protocol==="https:"?"443":"80");const U2=`${$2}//${window.location.hostname}:${Sm}/ws`,Pt=new H2(U2);function F2(e){return{...e.temperature!=null&&{temperature:e.temperature},...e.topP!=null&&{topP:e.topP},...e.topK!=null&&{topK:e.topK},...e.maxTokens!=null&&{maxTokens:e.maxTokens}}}function bv(e){e&&we.getState().updateContextState({...e,dynamicContextChanged:e.dynamicContextChanged??!1})}async function Sv(e,t,n){const s=await Te(`/api/providers/${e}/models/${encodeURIComponent(t)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){const a=await s.json();throw new Error(a.error??"Failed to update model")}return s.json()}function wv(e,t,n,s){return e.map(a=>a.id===t?{...a,models:a.models.map(o=>o.id===n?{...o,...s,source:"user"}:o)}:a)}const V2=3e4;function wm(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const Ot=qn((e,t)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const n=await Te("/api/config");if(!n.ok)throw new Error("Failed to fetch config");const s=await n.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(n){e({error:n instanceof Error?n.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const n=await Te("/api/model/refresh",{method:"POST"});if(!n.ok)throw new Error("Failed to refresh model");const s=await n.json(),o=we.getState().currentSession;if(o!=null&&o.providerId&&o.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(n){console.error("Failed to refresh model:",n)}},activateProvider:async n=>{const{activeProviderId:s,providers:a}=t();if(n===s)return!0;e({activating:!0,error:null});try{const o=await Te(`/api/providers/${n}/activate`,{method:"POST"});if(!o.ok){const c=await o.json();throw new Error(c.error??"Failed to activate provider")}const u=await o.json();return e({activeProviderId:u.activeProviderId,model:u.model,backend:u.backend,providers:a.map(c=>({...c,isActive:c.id===u.activeProviderId})),activating:!1}),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(n,s)=>{var c;const{providers:a,defaultModelSelection:o}=t();let u=s;if(!u){const d=o?o.split("/"):[],f=d[0],p=d.slice(1).join("/")??"";if(f===n&&p)u=p;else{const m=a.find(x=>x.id===n);u=((c=m==null?void 0:m.models[0])==null?void 0:c.id)??""}}e({activeProviderId:n,model:u,defaultModelSelection:`${n}/${u}`,providers:a.map(d=>({...d,isActive:d.id===n}))})},updateModelContext:async(n,s,a)=>{e({activating:!0,error:null});try{const o=await Sv(n,s,{contextWindow:a}),{providers:u}=t();return e({providers:wv(u,n,s,{contextWindow:a}),activating:!1}),bv(o.contextState),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to update model context",activating:!1}),!1}},updateModelSettings:async(n,s,a)=>{e({activating:!0,error:null});try{const o=await Sv(n,s,a),{providers:u}=t(),c={...a.contextWindow!==void 0&&{contextWindow:a.contextWindow},...F2({temperature:a.temperature??void 0,topP:a.topP??void 0,topK:a.topK??void 0,maxTokens:a.maxTokens??void 0}),...a.supportsVision!==void 0&&{supportsVision:a.supportsVision}};return e({providers:wv(u,n,s,c),activating:!1}),bv(o.contextState),!0}catch(o){return e({error:o instanceof Error?o.message:"Failed to update model settings",activating:!1}),!1}},refreshProviderModels:async n=>{e({activating:!0,error:null});try{const s=await Te(`/api/providers/${n}/refresh`,{method:"POST"});if(!s.ok){const u=await s.json();throw new Error(u.error??"Failed to refresh models")}const a=await s.json(),{providers:o}=t();return e({providers:o.map(u=>u.id===n?{...u,models:a.models,status:a.status}:u),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:n,refreshModel:s}=t();if(n)return;const a=setInterval(()=>{s()},V2);e({autoRefreshInterval:a})},stopAutoRefresh:()=>{const{autoRefreshInterval:n}=t();n&&(clearInterval(n),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:n,activeProviderId:s}=t();return n.find(a=>a.id===s)},getModelContext:n=>{const{providers:s,activeProviderId:a}=t(),o=s.find(c=>c.id===a);if(!o)return 2e5;const u=o.models.find(c=>c.id===n);return(u==null?void 0:u.contextWindow)??2e5}})),Bt=qn((e,t)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Te("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch(n){console.error("Failed to load projects:",n),e({loading:!1})}},createProject:async(n,s)=>{try{const a=await Te("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,workdir:s})});if(!a.ok){const u=await a.json().catch(()=>({}));return{error:{code:u.code||"UNKNOWN",path:u.path,message:u.error}}}const o=await a.json();return await t().listProjects(),o.project}catch{return null}},loadProject:async n=>{try{const s=await Te(`/api/projects/${n}`);if(!s.ok)return null;const a=await s.json();return e({currentProject:a.project}),t().projects.length===0&&await t().listProjects(),a.project}catch{return null}},updateProject:async(n,s)=>{var a;try{const o=await Te(`/api/projects/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)return null;const u=await o.json();return((a=t().currentProject)==null?void 0:a.id)===n&&e({currentProject:u.project}),await t().listProjects(),u.project}catch{return null}},deleteProject:async n=>{var s;try{return(await Te(`/api/projects/${n}`,{method:"DELETE"})).ok?(await t().listProjects(),((s=t().currentProject)==null?void 0:s.id)===n&&e({currentProject:null}),!0):!1}catch{return!1}},toggleStar:async(n,s)=>{var a;try{const o=await Te(`/api/projects/${n}/star`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isStarred:s})});if(!o.ok)return!1;if(((a=t().currentProject)==null?void 0:a.id)===n){const u=await o.json();e({currentProject:u.project})}return await t().listProjects(),!0}catch{return!1}},clearProject:()=>{e({currentProject:null})}})),Ws=async(e,t,n)=>{try{const s=await Te(t,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},zu=async(e,t,n)=>{try{const s=await Te(e,{method:"POST",body:n?JSON.stringify({destination:n}):void 0,headers:n?{"Content-Type":"application/json"}:void 0}),a=await s.json();return s.ok?(await t(),{success:!0}):{success:!1,error:a.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}};function cS(e){let t=null;function n(){t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))}return n}let Fc=[];const nl=qn()((e,t)=>{function n(){if(Fc.length===0)return;const a=Fc;Fc=[],e(o=>{const u={...o.logs};for(const c of a){const d=u[c.processId]??[];u[c.processId]=[...d,{offset:d.length,content:c.content,timestamp:Date.now(),stream:c.stream}]}return{logs:u}})}const s=cS(n);return{processes:[],logs:{},loading:!1,setProcesses:a=>e({processes:a}),addProcess:a=>e(o=>({processes:[...o.processes,a]})),updateProcess:(a,o)=>e(u=>({processes:u.processes.map(c=>c.id===a?{...c,...o}:c)})),removeProcess:a=>e(o=>({processes:o.processes.filter(u=>u.id!==a),logs:Object.fromEntries(Object.entries(o.logs).filter(([u])=>u!==a))})),stopProcess:async(a,o)=>{try{(await Te(`/api/sessions/${o}/background-process/${a}/stop`,{method:"POST"})).ok&&t().removeProcess(a)}catch{}},appendLog:(a,o,u)=>{Fc.push({processId:a,stream:o,content:u}),s()},setLogs:(a,o)=>e(u=>({logs:{...u.logs,[a]:o}})),clearLogs:a=>e(o=>({logs:{...o.logs,[a]:[]}})),handleMessage:(a,o)=>{switch(a){case"backgroundProcess.started":{const{processId:u,name:c,pid:d,status:f}=o;e(p=>({processes:[...p.processes,{id:u,sessionId:"",name:c,command:"",cwd:"",pid:d,status:f,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const u=o.processId,c=o.stream,d=o.content;t().appendLog(u,c,d);break}case"backgroundProcess.exited":{const u=o.processId,c=o.exitCode;e(d=>({processes:d.processes.map(f=>f.id===u?{...f,status:"exited",exitCode:c}:f)}));break}case"backgroundProcess.removed":{const u=o.processId;t().removeProcess(u);break}}}}}),G2={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ia=null,lu=null;function W2(e){lu=e}function yi(){return G2}function Df(){Ia===null&&(Ia=requestAnimationFrame(()=>{Ia=null,lu==null||lu()}))}function wi(){Ia!==null&&(cancelAnimationFrame(Ia),Ia=null)}let Vc=[];const Dr=qn()((e,t)=>{function n(){if(Vc.length===0)return;const a=Vc;Vc=[],e(o=>({logs:[...o.logs,...a]}))}const s=cS(n);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:a=>{t().workdir!==a&&(e({workdir:a,status:null,logs:[],config:null,loading:!0}),a&&(t().fetchStatus(),t().fetchConfig()))},fetchStatus:async()=>{const a=t().workdir;if(a)try{const u=await(await Te(`/api/dev-server?workdir=${encodeURIComponent(a)}`)).json();e({status:u,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const a=t().workdir;if(a)try{const u=await(await Te(`/api/dev-server/config?workdir=${encodeURIComponent(a)}`)).json();e({config:u.config??null})}catch{}},fetchLogs:async()=>{const a=t().workdir;if(a)try{const c=(await(await Te(`/api/dev-server/logs?workdir=${encodeURIComponent(a)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:c})}catch{}},start:async()=>{const a=t().workdir;if(a)try{const u=await(await Te(`/api/dev-server/start?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:u,logs:[]})}catch{}},stop:async()=>{const a=t().workdir;if(a)try{const u=await(await Te(`/api/dev-server/stop?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:u})}catch{}},restart:async()=>{const a=t().workdir;if(a)try{const u=await(await Te(`/api/dev-server/restart?workdir=${encodeURIComponent(a)}`,{method:"POST"})).json();e({status:u,logs:[]})}catch{}},saveConfig:async a=>{const o=t().workdir;if(o)try{const c=await(await Te(`/api/dev-server/config?workdir=${encodeURIComponent(o)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();e({config:c.config??a}),t().fetchStatus()}catch{}},handleMessage:a=>{const o=t().workdir;if(o)switch(a.type){case"devServer.output":{const u=a.payload;if(u.workdir!==o)return;Vc.push({stream:u.stream,content:u.content}),s();break}case"devServer.state":{const u=a.payload;if(u.workdir!==o)return;e(c=>({status:c.status?{...c.status,state:u.state,errorMessage:u.errorMessage}:c.status}));break}}}}}),q2=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],K2=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],uS={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},Us={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},dS={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Cm={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...Us},waiting_for_user:{...Us},phase_done:{...Us},phase_blocked:{...Us},new_message:{...dS}},agentOverrides:{}};function hS(e,t,n){var o;const s=e.events[t];if(!n)return s;const a=(o=e.agentOverrides[n])==null?void 0:o[t];return a?{soundEnabled:a.soundEnabled??s.soundEnabled,browserNotification:a.browserNotification??s.browserNotification,customSoundUrl:a.customSoundUrl!==void 0?a.customSoundUrl:s.customSoundUrl}:s}const bi=qn((e,t)=>({settings:Cm,loaded:!1,load:()=>{rn.getState().getSetting(Be.NOTIFICATION_SETTINGS);const s=rn.subscribe(o=>{const u=o.settings[Be.NOTIFICATION_SETTINGS];if(u!==void 0)try{const c=JSON.parse(u);e({settings:Cv(c),loaded:!0})}catch{e({loaded:!0})}}),a=rn.getState().settings[Be.NOTIFICATION_SETTINGS];if(a)try{const o=JSON.parse(a);e({settings:Cv(o),loaded:!0})}catch{e({loaded:!0})}return s},update:n=>{e({settings:n}),Rf(n)},updateEvent:(n,s)=>{const a=t().settings,o={...a,events:{...a.events,[n]:{...a.events[n],...s}}};e({settings:o}),Rf(o)},updateAgentOverride:(n,s,a)=>{var d;const o=t().settings,u={...o.agentOverrides};if(a===null){if(u[n]){const f={...u[n]};delete f[s],Object.keys(f).length===0?delete u[n]:u[n]=f}}else u[n]={...u[n],[s]:{...((d=u[n])==null?void 0:d[s])??{},...a}};const c={...o,agentOverrides:u};e({settings:c}),Rf(c)}}));function Rf(e){rn.getState().setSetting(Be.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Cv(e){var t,n,s,a,o;return{soundEnabled:e.soundEnabled??Cm.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Cm.browserNotificationEnabled,events:{complete:{...Us,...(t=e.events)==null?void 0:t.complete},waiting_for_user:{...Us,...(n=e.events)==null?void 0:n.waiting_for_user},phase_done:{...Us,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...Us,...(a=e.events)==null?void 0:a.phase_blocked},new_message:{...dS,...(o=e.events)==null?void 0:o.new_message}},agentOverrides:e.agentOverrides??{}}}const kv=new Map;function Y2(e){let t=kv.get(e);return t||(t=new Audio(e),t.volume=.5,kv.set(e,t)),t}let fS=typeof Notification<"u"?Notification.permission:"denied";function X2(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(fS=e,e))}const Q2={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},J2={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function Z2(e){typeof Notification>"u"||fS==="granted"&&(document.hasFocus()||new Notification(Q2[e],{body:J2[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function xl(e,t){const{settings:n}=bi.getState(),s=hS(n,e,t);if(n.soundEnabled&&s.soundEnabled){const a=s.customSoundUrl??uS[e],o=Y2(a);o.currentTime=0,o.play().catch(()=>{})}n.browserNotificationEnabled&&s.browserNotification&&Z2(e)}const ej=e=>xl("complete",e),tj=e=>xl("phase_done",e),nj=e=>xl("phase_blocked",e),Ev=e=>xl("waiting_for_user",e),rj=e=>xl("new_message",e),jv=new Map;function Zo(e,t){var o;const n=t===((o=e.currentSession)==null?void 0:o.id)?e.currentSession:null,s=e.sessions.find(u=>u.id===t),a=(n==null?void 0:n.mode)??(s==null?void 0:s.mode);return a==="planner"?"planner":a==="builder"?"build":"planner"}function sj(e,t){if(e.type==="chat.done"){const n=e.payload,s=Zo(t,e.sessionId),a=n.agentType??s;n.reason==="complete"&&ej(a),n.reason==="waiting_for_user"&&Ev(a);return}if(e.type==="chat.path_confirmation"){const n=Zo(t,e.sessionId);Ev(n);return}if(e.type==="task.completed"){const n=Zo(t,e.sessionId);tj(n);return}if(e.type==="phase.changed"&&e.sessionId){const n=e.payload,s=jv.get(e.sessionId)??null;if(jv.set(e.sessionId,n.phase),s===n.phase)return;const a=Zo(t,e.sessionId);n.phase==="blocked"&&nj(a)}}const Of=new Set;function Gt(e,t){return t!==null&&e.sessionId===t}function ij(e,t,n){return e.id!==void 0||Gt(e,t)||n===!0&&e.sessionId!==void 0}function aj(e,t){return e.includes(t)?e:[...e,t]}function Tv(e,t){return e.filter(n=>n!==t)}function oj(e,t){const n=e.find(o=>o.id===t.id),s=t.messageCount??t.messages.length,a=n?{...n,projectId:t.projectId,workdir:t.workdir,mode:t.mode,phase:t.phase,isRunning:t.isRunning&&n.isRunning!==!1,messageCount:s,criteriaCount:t.criteria.length,criteriaCompleted:t.criteria.filter(o=>o.status.type==="passed").length}:{id:t.id,projectId:t.projectId,workdir:t.workdir,mode:t.mode,phase:t.phase,isRunning:t.isRunning,createdAt:"",updatedAt:"",criteriaCount:t.criteria.length,criteriaCompleted:t.criteria.filter(o=>o.status.type==="passed").length,messageCount:s};return n?e.map(o=>o.id===t.id?a:o):[a,...e]}function lj(e,t,n){return e.map(s=>{const a=(n==null?void 0:n.id)===s.id?n:null,o=t.find(u=>u.id===s.id);return{...s,title:s.title??(o==null?void 0:o.title),mode:(a==null?void 0:a.mode)??(o==null?void 0:o.mode)??s.mode,phase:(a==null?void 0:a.phase)??(o==null?void 0:o.phase)??s.phase,isRunning:s.isRunning&&(o==null?void 0:o.isRunning)!==!1,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}function Nv(e,t,n,s){var c;const a=e.sessionId,o=(c=n().currentSession)==null?void 0:c.id,u=a&&a!==o;if(t(d=>({sessions:d.sessions.map(f=>f.id===a?s(f):f)})),!u){const d=n().currentSession;if(d){const f=s(d);t(()=>({currentSession:f}))}}}function Av(e,t,n){var u,c,d,f,p,m,x,_,w,k,v,S,y,b,E,N,T,L,A,M,D,U,F;const s=n();sj(e,s);const a=((u=s.currentSession)==null?void 0:u.id)??null,o=()=>{const B=e.sessionId;!B||B===a||t(Y=>({unreadSessionIds:aj(Y.unreadSessionIds,B)}))};switch(e.type){case"session.state":{const B=e.payload;if(!ij(e,a,s.pendingSessionCreate))break;wi();const Y=B.messages.find(H=>H.isStreaming)??null,W=n().pendingSessionCreate===!0;if(t({currentSession:B.session,sessions:oj(n().sessions,B.session),unreadSessionIds:Tv(n().unreadSessionIds,B.session.id),messages:B.messages,streamingMessageId:(Y==null?void 0:Y.id)??null,streamingMessage:Y,currentTodos:[],pendingPathConfirmations:B.pendingConfirmations??[],error:null,...W?{pendingSessionCreate:B.session.id}:{}}),B.session.providerId){const H=Ot.getState();H.providers.find(X=>X.id===B.session.providerId)&&H.syncFromSession(B.session.providerId,B.session.providerModel??"")}break}case"session.list":{const B=e.payload;t(Y=>({sessions:lj(B.sessions,Y.sessions,Y.currentSession)}));break}case"session.deleted":{const B=e.payload;t(Y=>({unreadSessionIds:Tv(Y.unreadSessionIds,B.sessionId)})),n().listSessions();break}case"session.deletedAll":{n().listSessions();break}case"session.running":{const B=e.payload;Nv(e,t,n,Y=>({...Y,isRunning:B.isRunning})),B.isRunning||t({abortInProgress:!1,queuedMessages:[]});break}case"chat.message":{if(!Gt(e,((c=n().currentSession)==null?void 0:c.id)??null)){o();break}const B=e.payload;t(Y=>{if(Y.messages.some(H=>H.id===B.message.id))return Y;const W=B.message.role==="user";return{messages:[...Y.messages,B.message],sessions:Y.sessions.map(H=>H.id===e.sessionId&&W?{...H,messageCount:H.messageCount+1}:H),streamingMessageId:B.message.isStreaming?B.message.id:Y.streamingMessageId,streamingMessage:B.message.isStreaming?B.message:Y.streamingMessage}});break}case"chat.message_updated":{if(!Gt(e,((d=n().currentSession)==null?void 0:d.id)??null)){o();break}const B=e.payload,Y=B.updates.isStreaming===!1&&n().streamingMessageId===B.messageId;Y&&wi(),t(W=>{const H=W.streamingMessage;if(H&&H.id===B.messageId){const K={...H,...B.updates};return{messages:W.messages.map(X=>X.id===B.messageId?K:X),streamingMessageId:Y?null:W.streamingMessageId,streamingMessage:Y?null:{...H,...B.updates}}}return{messages:W.messages.map(K=>K.id===B.messageId?{...K,...B.updates}:K),streamingMessageId:Y?null:W.streamingMessageId}});break}case"chat.delta":{if(!Gt(e,((f=n().currentSession)==null?void 0:f.id)??null)){o();break}const B=e.payload;if(!Of.has(B.messageId)){Of.add(B.messageId);const W=B.subAgentType?"sub-agent":Zo(n(),e.sessionId);rj(W)}const Y=yi();Y.messageId=B.messageId,Y.deltaContent+=B.content,Df();break}case"chat.thinking":{if(!Gt(e,((p=n().currentSession)==null?void 0:p.id)??null)){o();break}const B=e.payload,Y=yi();Y.messageId=B.messageId,Y.thinkingContent+=B.content,Df();break}case"chat.tool_preparing":{if(!Gt(e,((m=n().currentSession)==null?void 0:m.id)??null)){o();break}const B=e.payload,Y=n().streamingMessage;if(!Y||Y.id!==B.messageId||((x=Y.toolCalls)==null?void 0:x.find((H,K)=>K===B.index)))return;t(H=>{const K=H.streamingMessage.preparingToolCalls??[],X=K.findIndex(O=>O.index===B.index);let P;return X>=0?P=K.map((O,z)=>z===X?{...O,arguments:B.arguments}:O):P=[...K,{index:B.index,name:B.name,...B.arguments?{arguments:B.arguments}:{}}],{streamingMessage:{...H.streamingMessage,preparingToolCalls:P}}});break}case"chat.tool_call":{if(!Gt(e,((_=n().currentSession)==null?void 0:_.id)??null)){o();break}const B=e.payload,Y=W=>{var P;const H=(P=W.preparingToolCalls)==null?void 0:P.filter((O,z)=>{var V;return O.name===B.tool?(V=W.preparingToolCalls)==null?void 0:V.slice(0,z).some(ee=>ee.name===B.tool):!0}),K=yi(),X=K.toolOutput.filter(O=>O.callId===B.callId);return X.length>0&&(K.toolOutput=K.toolOutput.filter(O=>O.callId!==B.callId)),{...W,toolCalls:[...W.toolCalls??[],{id:B.callId,name:B.tool,arguments:B.args,startedAt:Date.now(),...X.length>0?{streamingOutput:X.map(O=>({stream:O.stream,content:O.content,timestamp:Date.now()}))}:{}}],...H&&H.length>0?{preparingToolCalls:H}:{preparingToolCalls:void 0}}};t(W=>{const H=W.streamingMessage;return H&&H.id===B.messageId?{streamingMessage:Y(H)}:{messages:W.messages.map(K=>K.id===B.messageId?Y(K):K)}});break}case"chat.tool_output":{if(!Gt(e,((w=n().currentSession)==null?void 0:w.id)??null)){o();break}const B=e.payload,Y=yi();Y.messageId=B.messageId,Y.toolOutput.push({messageId:B.messageId,callId:B.callId,stream:B.stream,content:B.output}),Df();break}case"chat.tool_result":{if(!Gt(e,((k=n().currentSession)==null?void 0:k.id)??null)){o();break}const B=e.payload,Y=W=>{var K;const H=(K=W.toolCalls)==null?void 0:K.map(X=>X.id===B.callId?{...X,result:B.result}:X);return{...W,toolCalls:H}};t(W=>{const H=W.streamingMessage;return H&&H.id===B.messageId?{streamingMessage:Y(H)}:{messages:W.messages.map(K=>K.id===B.messageId?Y(K):K)}});break}case"chat.vision_fallback":{if(!Gt(e,((v=n().currentSession)==null?void 0:v.id)??null)){o();break}const B=e.payload;t(Y=>{const W=`${B.messageId}-${B.attachmentId}`,H={...Y.visionFallbackByMessage};return H[W]={type:B.type,attachmentId:B.attachmentId,filename:B.filename,description:B.description},{visionFallbackByMessage:H}});break}case"chat.todo":{if(!Gt(e,((S=n().currentSession)==null?void 0:S.id)??null)){o();break}const B=e.payload;t({currentTodos:B.todos});break}case"chat.progress":{if(!Gt(e,((y=n().currentSession)==null?void 0:y.id)??null)){o();break}const B=e.payload;console.warn("Progress:",B.message,B.phase);break}case"chat.format_retry":{if(!Gt(e,((b=n().currentSession)==null?void 0:b.id)??null)){o();break}const B=e.payload;console.warn("Format retry:",B.attempt,"/",B.maxAttempts);break}case"chat.done":{if(!Gt(e,((E=n().currentSession)==null?void 0:E.id)??null)){o();break}wi();const B=yi();B.messageId=null,B.deltaContent="",B.thinkingContent="",B.toolOutput=[],Of.delete(e.payload.messageId);const Y=e.payload,W=Y.stats;t(H=>{const K=H.streamingMessage,X=K&&K.id===Y.messageId?{...K,isStreaming:!1,stats:W??K.stats}:null;return{messages:H.messages.map(P=>P.id===Y.messageId?X??{...P,isStreaming:!1,stats:W??P.stats,completeReason:Y.reason}:P),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Gt(e,((N=n().currentSession)==null?void 0:N.id)??null)){o();break}wi();const B=yi(),Y=e.payload;console.error("Chat error:",Y.error,"recoverable:",Y.recoverable),Y.recoverable||(B.messageId=null,B.deltaContent="",B.thinkingContent="",B.toolOutput=[]),t(W=>({error:{code:"CHAT_ERROR",message:Y.error},streamingMessageId:Y.recoverable?W.streamingMessageId:null,...Y.recoverable?{}:{messages:W.streamingMessage?W.messages.map(H=>H.id===W.streamingMessage.id?W.streamingMessage:H):W.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Gt(e,((T=n().currentSession)==null?void 0:T.id)??null)){o();break}const B=e.payload,Y={callId:B.callId,tool:B.tool,paths:B.paths,workdir:B.workdir,reason:B.reason};t(W=>({pendingPathConfirmations:[...W.pendingPathConfirmations,Y]}));break}case"chat.ask_user":{if(!Gt(e,((L=n().currentSession)==null?void 0:L.id)??null)){o();return}const B=e.payload;t({pendingQuestion:{callId:B.callId,question:B.question}});break}case"mode.changed":{if(!Gt(e,((A=n().currentSession)==null?void 0:A.id)??null)){o();break}const B=e.payload;t(Y=>({currentSession:Y.currentSession?{...Y.currentSession,mode:B.mode}:null}));break}case"phase.changed":{const B=e.payload;Nv(e,t,n,Y=>({...Y,phase:B.phase}));break}case"criteria.updated":{if(!Gt(e,((M=n().currentSession)==null?void 0:M.id)??null)){o();break}const B=e.payload;t(Y=>({currentSession:Y.currentSession?{...Y.currentSession,criteria:B.criteria}:null}));break}case"metadata.updated":{if(!Gt(e,((D=n().currentSession)==null?void 0:D.id)??null)){o();break}const B=e.payload;t(Y=>({currentSession:Y.currentSession?{...Y.currentSession,metadataEntries:{...Y.currentSession.metadataEntries,[B.key]:B.entries}}:null}));break}case"context.state":{const B=e.payload,Y=Gt(e,((U=n().currentSession)==null?void 0:U.id)??null);B.subAgentId?Y&&n().updateSubAgentContextState(B.subAgentId,B.context):Y?t({contextState:B.context}):o();break}case"session.name_generated":{const B=e.payload,Y=e.sessionId,W=(F=n().currentSession)==null?void 0:F.id;t(H=>{const K=H.sessions.map(P=>P.id===Y?{...P,title:B.name,updatedAt:new Date().toISOString()}:P),X=W===Y?H.currentSession?{...H.currentSession,title:B.name,updatedAt:new Date().toISOString()}:null:H.currentSession;return{sessions:K,currentSession:X}});break}case"queue.state":{const B=e.payload;t({queuedMessages:B.messages??[]});break}case"git.status":{const B=e.payload;t({gitStatus:{branch:B.branch,diff:B.diff}});break}case"devServer.output":case"devServer.state":{Dr.getState().handleMessage(e);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{nl.getState().handleMessage(e.type,e.payload);break}case"error":{const B=e.payload;console.error("Server error:",B),t({error:{code:B.code,message:B.message},streamingMessageId:null});break}}}let Fo=!1,jr=null;const Mf=new Set,Gc=new Map;function Lv(e,t,n){return e==null?void 0:e.map(s=>{const a=t.filter(o=>o.callId===s.id);return a.length===0?s:(n.add(s.id),{...s,streamingOutput:[...s.streamingOutput??[],...a.map(o=>({stream:o.stream,content:o.content,timestamp:Date.now()}))]})})}async function Dv(e,t,n,s,a){try{const u=await(await Te(`/api/sessions/${e}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,attachments:n,messageKind:s})})).json();u.queueState&&a({queuedMessages:u.queueState})}catch(o){console.error("Error queueing message:",o)}}const we=qn((e,t)=>(W2(()=>{const n=yi();if(!n.messageId)return;const s=n.deltaContent.length>0,a=n.thinkingContent.length>0,o=n.toolOutput.length>0;if(!s&&!a&&!o)return;const u=n.deltaContent,c=n.thinkingContent,d=n.toolOutput;n.deltaContent="",n.thinkingContent="",n.toolOutput=[],e(f=>{const p=f.streamingMessage;if(p&&p.id===n.messageId){const m={...p};if(s&&(m.content=m.content+u),a&&(m.thinkingContent=(m.thinkingContent??"")+c),o){const x=new Set;m.toolCalls=Lv(m.toolCalls,d,x);const _=d.filter(w=>!x.has(w.callId));_.length>0&&n.toolOutput.push(..._)}return{streamingMessage:m}}if(o){const m=new Set,x=f.messages.map(w=>w.id!==n.messageId?w:{...w,toolCalls:Lv(w.toolCalls,d,m)}),_=d.filter(w=>!m.has(w.callId));return _.length>0&&n.toolOutput.push(..._),{messages:x}}return f})}),{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmations:[],pendingQuestion:null,visionFallbackByMessage:{},gitStatus:null,queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{if(t().connectionStatus==="connected")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Te("/api/auth")).json()).requiresAuth}catch{}if(s&&!Pt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Pt.onStatusChange(a=>{var o;if(e({connectionStatus:a}),a==="connected"){t().listSessions(void 0),Bt.getState().listProjects();const u=(o=t().currentSession)==null?void 0:o.id;u&&t().loadSession(u)}});try{await Pt.connect(),Fo||(Fo=!0,jr=Pt.subscribe(a=>{Av(a,e,t)}))}catch(a){console.error("Failed to connect:",a);const o=Pt.getLastCloseCode();if(!Pt.hasToken()&&(o===1006||o===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}jr&&(jr(),jr=null),Fo=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Pt.disconnect(),jr&&(jr(),jr=null),Fo=!1,e({connectionStatus:"disconnected"}),t().connect()},disconnect:()=>{Pt.disconnect(),jr&&(jr(),jr=null),Fo=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async n=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:n})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:a}=await s.json();Pt.setToken(a),e({showPasswordModal:!1}),t().connect();const{listProjects:o}=Bt.getState(),{fetchConfig:u}=Ot.getState();o(),u(),t().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Pt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(n,s)=>{if(t().pendingSessionCreate)return null;try{e({pendingSessionCreate:!0});const o=await Te("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:n,title:s})});if(!o.ok)return e({pendingSessionCreate:!1}),null;const u=await o.json();try{Pt.send("session.load",{sessionId:u.session.id})}catch{}return u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async n=>{if(!Mf.has(n)){Mf.add(n);try{const s=t().currentSession;!s||s.id!==n?(wi(),e({currentSession:null,unreadSessionIds:t().unreadSessionIds.filter(u=>u!==n),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmations:[],queuedMessages:[],abortInProgress:!1,error:null,pendingSessionCreate:!1})):e({unreadSessionIds:t().unreadSessionIds.filter(u=>u!==n)});const a=await Te(`/api/sessions/${n}`);if(!a.ok)return;const o=await a.json();e({currentSession:o.session,messages:o.messages??[],contextState:o.contextState,queuedMessages:o.queueState??[]}),Pt.send("session.load",{sessionId:n});try{const u=await Te(`/api/sessions/${n}/background-processes`);if(u.ok){const c=await u.json();nl.getState().setProcesses(c.processes??[])}}catch{}}catch{}finally{Mf.delete(n)}}},listSessions:async(n,s=20)=>{const a=n??"global";if(Gc.has(a))return Gc.get(a);const o=(async()=>{try{const u=new URLSearchParams;u.set("limit",String(s)),n&&u.set("projectId",n);const d=await(await Te(`/api/sessions?${u.toString()}`)).json(),f=d.sessions??[];e(p=>({sessions:f.map(m=>{var _,w;const x=p.sessions.find(k=>k.id===m.id);return{...m,title:m.title??(x==null?void 0:x.title),mode:((_=p.currentSession)==null?void 0:_.id)===m.id?p.currentSession.mode:(x==null?void 0:x.mode)??m.mode,phase:((w=p.currentSession)==null?void 0:w.id)===m.id?p.currentSession.phase:(x==null?void 0:x.phase)??m.phase,isRunning:m.isRunning&&(x==null?void 0:x.isRunning)!==!1,messageCount:m.messageCount,recentUserPrompts:m.recentUserPrompts}}),sessionsHasMore:n?d.hasMore??!1:!0}))}catch{}finally{Gc.delete(a)}})();return Gc.set(a,o),o},loadMoreSessions:async n=>{const s=t();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const a=new URLSearchParams;a.set("limit","20"),a.set("offset",String(s.sessions.length)),a.set("projectId",n);const u=await(await Te(`/api/sessions?${a.toString()}`)).json(),c=u.sessions??[];e(d=>({sessions:[...d.sessions,...c.map(f=>{const p=d.sessions.find(m=>m.id===f.id);return(p==null?void 0:p.isRunning)===!1?{...f,isRunning:!1}:f})],sessionsHasMore:u.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async n=>{var s;try{return(await Te(`/api/sessions/${n}`,{method:"DELETE"})).ok?(await t().listSessions(),((s=t().currentSession)==null?void 0:s.id)===n&&t().clearSession(),!0):!1}catch{return!1}},renameSession:async(n,s)=>{var a;try{const o=await Te(`/api/sessions/${n}/title`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!o.ok)return!1;if(await t().listSessions(),((a=t().currentSession)==null?void 0:a.id)===n){const c=await o.json();c.session&&e({currentSession:c.session})}return!0}catch{return!1}},deleteAllSessions:async n=>{try{return(await Te(`/api/projects/${n}/sessions`,{method:"DELETE"})).ok?(await t().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{wi(),e(n=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingSessionCreate:!1,unreadSessionIds:n.currentSession?n.unreadSessionIds.filter(s=>s!==n.currentSession.id):n.unreadSessionIds}))},sendMessage:async(n,s,a)=>{var u;const o=(u=t().currentSession)==null?void 0:u.id;if(o){e({streamingMessageId:null});try{const d=await(await Te(`/api/sessions/${o}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,attachments:s,messageKind:a==null?void 0:a.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(c){console.error("Error sending message:",c)}}},stopGeneration:async()=>{var s;const n=(s=t().currentSession)==null?void 0:s.id;if(n&&!t().abortInProgress){wi(),e({abortInProgress:!0});try{await Te(`/api/sessions/${n}/stop`,{method:"POST"})}catch(a){console.error("Error stopping generation:",a)}}},continueGeneration:async()=>{var s;const n=(s=t().currentSession)==null?void 0:s.id;if(n){e({streamingMessageId:null});try{await Te(`/api/sessions/${n}/continue`,{method:"POST"})}catch(a){console.error("Error continuing generation:",a)}}},launchRunner:(n,s,a,o)=>{e({streamingMessageId:null});const u={};n!=null&&n.trim()&&(u.content=n),s&&s.length>0&&(u.attachments=s),a&&(u.workflowId=a),o&&(u.subGroup=o),Pt.send("runner.launch",u)},switchMode:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await Te(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:n})});if(!o.ok){console.error("Failed to switch mode:",await o.json());return}const u=await o.json();u.session&&e({currentSession:u.session})}catch(o){console.error("Error switching mode:",o)}},switchDangerLevel:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await Te(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:n})});if(!o.ok){console.error("Failed to switch danger level:",await o.json());return}const u=await o.json();u.session&&e({currentSession:u.session})}catch(o){console.error("Error switching danger level:",o)}},acceptAndBuild:(n,s,a,o)=>{var d;e({streamingMessageId:null});const u={};n&&(u.workflowId=n),s!=null&&s.trim()&&(u.content=s),a&&a.length>0&&(u.attachments=a),o&&(u.subGroup=o);const c=(d=t().currentSession)==null?void 0:d.id;c&&Te(`/api/sessions/${c}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"builder"})}).then(()=>{Pt.send("runner.launch",u)})},editCriteria:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const o=await Te(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:n})});o.ok||console.error("Failed to update criteria:",await o.json())}catch(o){console.error("Error updating criteria:",o)}},compactContext:()=>{Pt.send("context.compact",{})},setSessionProvider:async(n,s)=>{var a,o;try{const u=(a=t().currentSession)==null?void 0:a.id;if(!u)return null;const c=await Te(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:n,...s?{model:s}:{}})});if(!c.ok)return null;const d=await c.json();if(e({currentSession:d.session,messages:d.messages??[],contextState:d.contextState}),(o=d.session)!=null&&o.providerId){const f=Ot.getState();f.providers.find(m=>m.id===d.session.providerId)&&f.syncFromSession(d.session.providerId,d.session.providerModel??"")}return d.session}catch{return null}},updateContextState:n=>{e({contextState:n})},updateSubAgentContextState:(n,s)=>{e(a=>({subAgentContextStates:{...a.subAgentContextStates,[n]:s}}))},clearSubAgentContextState:n=>{e(s=>{const a={...s.subAgentContextStates};return delete a[n],{subAgentContextStates:a}})},confirmPath:async(n,s,a=!1)=>{var u;const o=(u=t().currentSession)==null?void 0:u.id;if(o)try{await Te(`/api/sessions/${o}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:n,approved:s,alwaysAllow:a})})}catch(c){console.error("Error confirming path:",c)}},answerQuestion:async(n,s)=>{var o;const a=(o=t().currentSession)==null?void 0:o.id;if(a){try{await Te(`/api/sessions/${a}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:n,answer:s})})}catch(u){console.error("Error answering question:",u)}e({pendingQuestion:null})}},queueAsap:async(n,s,a)=>{var u;const o=(u=t().currentSession)==null?void 0:u.id;o&&await Dv(o,n,s,a,e)},queueCompletion:async(n,s,a)=>{var u;const o=(u=t().currentSession)==null?void 0:u.id;o&&await Dv(o,n,s,a,e)},cancelQueued:async n=>{var a;const s=(a=t().currentSession)==null?void 0:a.id;if(s)try{const u=await(await Te(`/api/sessions/${s}/queue/${n}`,{method:"DELETE"})).json();u.queueState&&e({queuedMessages:u.queueState})}catch(o){console.error("Error canceling queued message:",o)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:n=>{Av(n,e,t)}}));function Hu(){return we(e=>{var t;return((t=e.currentSession)==null?void 0:t.isRunning)??!1})}function cj(){return we(e=>e.abortInProgress)}function uj(){const e=we(s=>s.connect),t=we(s=>s.connectionStatus),n=bi(s=>s.load);return R.useEffect(()=>{e()},[e]),R.useEffect(()=>{t==="connected"&&n()},[t,n]),{connectionStatus:t}}const dj="modulepreload",hj=function(e){return"/"+e},Rv={},J=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let u=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=u(n.map(f=>{if(f=hj(f),f in Rv)return;Rv[f]=!0;const p=f.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":dj,p||(x.as="script"),x.crossOrigin="",x.href=f,d&&x.setAttribute("nonce",d),document.head.appendChild(x),p)return new Promise((_,w)=>{x.addEventListener("load",_),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(u){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=u,window.dispatchEvent(c),!c.defaultPrevented)throw u}return a.then(u=>{for(const c of u||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})},mS=[{key:"color-bg-primary",category:"background",label:"Primary Background",defaultValue:"13 17 23"},{key:"color-bg-secondary",category:"background",label:"Secondary Background",defaultValue:"22 27 34"},{key:"color-bg-tertiary",category:"background",label:"Tertiary Background",defaultValue:"33 38 45"},{key:"color-primary",category:"surface",label:"Primary Surface",defaultValue:"10 10 10"},{key:"color-secondary",category:"surface",label:"Secondary Surface",defaultValue:"20 20 20"},{key:"color-text-primary",category:"text",label:"Primary Text",defaultValue:"139 148 158"},{key:"color-text-secondary",category:"text",label:"Secondary Text",defaultValue:"139 148 158"},{key:"color-text-muted",category:"text",label:"Muted Text",defaultValue:"72 79 88"},{key:"color-accent-primary",category:"accent",label:"Primary Accent",defaultValue:"88 166 255"},{key:"color-accent-success",category:"accent",label:"Success Accent",defaultValue:"63 185 80"},{key:"color-accent-warning",category:"accent",label:"Warning Accent",defaultValue:"210 153 34"},{key:"color-accent-error",category:"accent",label:"Error Accent",defaultValue:"248 81 73"},{key:"color-border",category:"border",label:"Border",defaultValue:"48 53 60"}],Rr=[{id:"system",name:"System",tokens:{}},{id:"dark",name:"Dark",tokens:{"color-bg-primary":"13 17 23","color-bg-secondary":"22 27 34","color-bg-tertiary":"33 38 45","color-primary":"10 10 10","color-secondary":"20 20 20","color-text-primary":"255 255 255","color-text-secondary":"139 148 158","color-text-muted":"72 79 88","color-accent-primary":"88 166 255","color-accent-success":"63 185 80","color-accent-warning":"210 153 34","color-accent-error":"248 81 73","color-border":"48 53 60"}},{id:"light",name:"Light",tokens:{"color-bg-primary":"255 255 255","color-bg-secondary":"250 251 252","color-bg-tertiary":"243 244 246","color-primary":"245 245 245","color-secondary":"229 229 229","color-text-primary":"15 23 42","color-text-secondary":"30 41 59","color-text-muted":"100 116 139","color-accent-primary":"37 99 235","color-accent-success":"22 163 74","color-accent-warning":"217 119 6","color-accent-error":"220 38 38","color-border":"203 213 225"}},{id:"monokai",name:"Monokai",tokens:{"color-bg-primary":"39 40 34","color-bg-secondary":"30 31 28","color-bg-tertiary":"62 61 50","color-primary":"30 31 28","color-secondary":"45 46 39","color-text-primary":"248 248 242","color-text-secondary":"207 207 194","color-text-muted":"117 113 94","color-accent-primary":"102 217 239","color-accent-success":"166 226 46","color-accent-warning":"230 219 116","color-accent-error":"249 38 114","color-border":"73 72 62"}},{id:"dracula",name:"Dracula",tokens:{"color-bg-primary":"40 42 54","color-bg-secondary":"33 34 44","color-bg-tertiary":"68 71 90","color-primary":"30 31 41","color-secondary":"44 46 61","color-text-primary":"248 248 242","color-text-secondary":"230 230 230","color-text-muted":"98 114 164","color-accent-primary":"189 147 249","color-accent-success":"80 250 123","color-accent-warning":"255 184 108","color-accent-error":"255 85 85","color-border":"68 71 90"}},{id:"nord",name:"Nord",tokens:{"color-bg-primary":"46 52 64","color-bg-secondary":"59 66 82","color-bg-tertiary":"67 76 94","color-primary":"46 52 64","color-secondary":"59 66 82","color-text-primary":"236 239 244","color-text-secondary":"229 233 240","color-text-muted":"76 86 106","color-accent-primary":"129 161 193","color-accent-success":"163 190 140","color-accent-warning":"235 203 139","color-accent-error":"191 97 106","color-border":"76 86 106"}}];function Ov(){try{const e=localStorage.getItem("openfox:userPresets");if(e)return JSON.parse(e)}catch{}return[]}const $t=qn((e,t)=>({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:Ov(),followSystemTheme:!0,isSystem:!1,applySavedTheme:()=>{const{getSavedTheme:n,applyPreset:s,applyTokens:a}=t(),o=n();if(o)try{const u=JSON.parse(o);u.preset&&u.tokens?(s(u.preset),e({basePreset:u.preset}),a(u.tokens)):u.preset?s(u.preset):u.tokens&&a(u.tokens)}catch{s("dark")}else s("dark")},applyPreset:n=>{if(Rr.find(a=>a.id===n))if(n==="system"){const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";e({basePreset:"system",currentPreset:o,customTokens:{},isCustom:!1,isCustomizing:!1,isSystem:!0}),t().applyTheme()}else e({currentPreset:n,basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,isSystem:!1}),t().applyTheme()},startCustomizing:()=>{var a;const{currentPreset:n}=t(),s=((a=Rr.find(o=>o.id===n))==null?void 0:a.tokens)??{};e({basePreset:n,customTokens:{...s},isCustom:!0,isCustomizing:!0})},setCustomToken:(n,s)=>{e(a=>({customTokens:{...a.customTokens,[n]:s}})),t().applyTheme()},cancelCustomizing:()=>{t().applyPreset(t().basePreset||t().currentPreset)},saveCustomTheme:()=>{const{customTokens:n}=t();t().saveTheme(JSON.stringify({tokens:n})).catch(()=>{}),e({isCustomizing:!1})},applyTokens:n=>{e({customTokens:n,isCustom:!0,isCustomizing:!1}),t().applyTheme()},getActiveTheme:()=>{var u,c;const{basePreset:n,customTokens:s,isCustom:a}=t();if(a&&n)return{...((u=Rr.find(f=>f.id===n))==null?void 0:u.tokens)??{},...s};if(a)return{...mS.reduce((d,f)=>({...d,[f.key]:f.defaultValue}),{}),...s};const o=Rr.find(d=>d.id===t().currentPreset);return(o==null?void 0:o.tokens)??((c=Rr[0])==null?void 0:c.tokens)??{}},applyTheme:()=>{if(typeof document>"u")return;const n=t().getActiveTheme(),s=document.documentElement;Object.entries(n).forEach(([a,o])=>{s.style.setProperty(`--${a}`,o)})},getSavedTheme:()=>{try{const n=localStorage.getItem("openfox:theme");if(!n)return null;if(n[0]!=="{")return JSON.stringify({preset:n});const s=JSON.parse(n);if(s.preset)return JSON.stringify({preset:s.preset});if(s.tokens)return JSON.stringify({tokens:s.tokens})}catch{return null}return null},saveTheme:async n=>{localStorage.setItem("openfox:theme",n);const{useSettingsStore:s}=await J(async()=>{const{useSettingsStore:a}=await Promise.resolve().then(()=>Nf);return{useSettingsStore:a}},void 0);await s.getState().setSetting(Be.DISPLAY_THEME,n)},clearCustomTheme:()=>{localStorage.removeItem("openfox:theme"),e({isCustom:!1,isCustomizing:!1,basePreset:""})},setFollowSystemTheme:n=>{e({followSystemTheme:n}),J(async()=>{const{useSettingsStore:s,SETTINGS_KEYS:a}=await Promise.resolve().then(()=>Nf);return{useSettingsStore:s,SETTINGS_KEYS:a}},void 0).then(({useSettingsStore:s,SETTINGS_KEYS:a})=>{s.getState().setSetting(a.DISPLAY_FOLLOW_SYSTEM_THEME,String(n))})},initSystemThemeListener:()=>{if(typeof window>"u")return()=>{};const n=window.matchMedia("(prefers-color-scheme: dark)"),s=o=>{const{followSystemTheme:u}=t();u&&(t().applyPreset(o?"dark":"light"),t().saveTheme(JSON.stringify({preset:o?"dark":"light"})))},a=o=>s(o.matches);return n.addEventListener("change",a),()=>n.removeEventListener("change",a)},reset:()=>{e({currentPreset:"dark",basePreset:"",customTokens:{},isCustom:!1,isCustomizing:!1,userPresets:[],followSystemTheme:!0})},addUserPreset:n=>{const{basePreset:s,customTokens:a,currentPreset:o}=t(),u={id:"custom-"+Date.now(),name:n,basePreset:s||o,tokens:{...a}},c=[...t().userPresets,u];e({userPresets:c}),t().saveUserPresets()},applyUserPreset:n=>{const s=t().userPresets[n];s&&(e({currentPreset:s.basePreset,basePreset:s.basePreset,customTokens:{...s.tokens},isCustom:!0,isCustomizing:!1}),t().applyTheme(),t().saveTheme(JSON.stringify({preset:s.basePreset,tokens:s.tokens})).catch(()=>{}))},deleteUserPreset:n=>{const s=t().userPresets.filter((a,o)=>o!==n);e({userPresets:s}),t().saveUserPresets()},loadUserPresets:()=>{e({userPresets:Ov()})},saveUserPresets:()=>{localStorage.setItem("openfox:userPresets",JSON.stringify(t().userPresets)),J(async()=>{const{useSettingsStore:n}=await Promise.resolve().then(()=>Nf);return{useSettingsStore:n}},void 0).then(({useSettingsStore:n})=>{n.getState().setSetting(Be.DISPLAY_USER_PRESETS,JSON.stringify(t().userPresets)).catch(()=>{})})}}));function fj({canLoad:e,projectId:t,currentProjectId:n}){const s=Bt(u=>u.loadProject),a=we(u=>u.listSessions),o=we(u=>u.clearSession);R.useEffect(()=>{e&&t&&(n!==t&&s(t),a(t),o())},[e,t,n,s,a,o])}function mj({canLoad:e,projectId:t,sessionId:n,currentProjectId:s,currentSessionId:a}){const o=we(f=>f.loadSession),u=Bt(f=>f.loadProject),c=we(f=>f.listSessions),d=we(f=>f.pendingSessionCreate);R.useEffect(()=>{e&&t&&s!==t&&u(t)},[e,t,s,u]),R.useEffect(()=>{e&&n&&a!==n&&o(n),e&&t&&c(t)},[e,n,a,o,c,d,t])}function pj({className:e="w-5 h-5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function pS({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}function gj({className:e="w-5 h-5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}function xj({className:e="w-3 h-3 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}function _j({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:l.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})})}function Or({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function Mr({className:e="w-3 h-3 text-text-muted",rotate:t}){return l.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:t!==void 0?{transform:`rotate(${t}deg)`}:void 0,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function yj({className:e="w-4 h-4"}){return l.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})}function cp({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}function vj({className:e="w-3 h-3"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}function up({className:e="w-4 h-4"}){return l.jsxs("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("circle",{cx:"12",cy:"5",r:"2"}),l.jsx("circle",{cx:"12",cy:"12",r:"2"}),l.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}function fu({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}function dp({className:e="w-5 h-5 text-accent-primary"}){return l.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}function bj({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"})})}function Sj({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}function wj({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:l.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})})}function gS({className:e="w-3 h-3"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Cj({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function Mv({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}function xS({className:e="w-[18px] h-[18px]"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[l.jsx("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function kj({className:e="w-4 h-4"}){return l.jsxs("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),l.jsx("path",{d:"M9.5 2h4.5v4.5"}),l.jsx("path",{d:"M14 2L7.5 8.5"})]})}function Ej({className:e="w-3 h-3",color:t}){return l.jsx("svg",{className:e,fill:t??"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{d:"M8 5v14l11-7z"})})}function qs({className:e="w-3 h-3 text-accent-primary"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function jj({className:e="w-5 h-5"}){return l.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}function hp({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}function Tj({className:e="w-4 h-4"}){return l.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Nj({className:e="w-3 h-3 text-blue-400 animate-spin flex-shrink-0"}){return l.jsxs("svg",{"aria-label":"Session running",className:e,viewBox:"0 0 24 24",fill:"none",children:[l.jsx("title",{children:"Running"}),l.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),l.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}function Aj({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z"})})}function Lj({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})})}function _S({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:l.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})})}function Dj({className:e="w-3.5 h-3.5 shrink-0",color:t}){return l.jsx("svg",{className:e,fill:"none",stroke:t,viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Rj({className:e="w-4 h-4"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("polyline",{points:"4 17 10 11 4 5"}),l.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function _l({className:e="w-3.5 h-3.5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function fp(){return l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function Oj({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function km({className:e="w-2.5 h-2.5"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function yl({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor",children:l.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}function yS({className:e="w-4 h-4"}){return l.jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"currentColor",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.55 0 0 1 0-.708z"})})}function Mj({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}function Ij({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}function Iv({className:e="w-3.5 h-3.5 text-text-muted"}){return l.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}function Em(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Pv(e,t){const n=Pt.ws;!n||n.readyState!==WebSocket.OPEN||n.send(JSON.stringify({id:Em(),type:e,payload:t}))}const xr=qn((e,t)=>({isOpen:!1,sessions:[],workdir:null,setOpen:n=>e({isOpen:n}),toggleOpen:()=>e(n=>({isOpen:!n.isOpen})),setWorkdir:n=>e({workdir:n}),fetchSessions:async n=>{if(!n){e({sessions:[]});return}try{const s=await Te(`/api/terminals?projectId=${encodeURIComponent(n)}`);if(s.ok){const a=await s.json();e({sessions:a});const o=Pt.ws;if(o&&o.readyState===WebSocket.OPEN)for(const u of a)o.send(JSON.stringify({id:Em(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(s){console.error("Failed to fetch terminals:",s)}},createSession:async(n,s)=>{try{const a=await Te("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:n??t().workdir??void 0,projectId:s})});if(a.ok){const o=await a.json();e(c=>({sessions:[...c.sessions,o]}));const u=Pt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Em(),type:"terminal.subscribe",payload:{sessionId:o.id}}))}}catch(a){console.error("Failed to create terminal:",a)}},writeSession:(n,s)=>{Pv("terminal.write",{sessionId:n,data:s})},resizeSession:(n,s,a)=>{Pv("terminal.resize",{sessionId:n,cols:s,rows:a})},killSession:async n=>{try{(await Te(`/api/terminals/${n}`,{method:"DELETE"})).ok&&e(a=>({sessions:a.sessions.filter(o=>o.id!==n)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:n=>{switch(n.type){case"terminal.exit":{const{sessionId:s}=n.payload||{};s&&e(a=>{const o=a.sessions.filter(u=>u.id!==s);return o.length===0&&a.isOpen?{sessions:[],isOpen:!1}:{sessions:o}});break}}}}));Pt.subscribe(e=>{var t;(t=e.type)!=null&&t.startsWith("terminal.")&&xr.getState().handleMessage(e)});const Da={terminalToggle:{type:"double-press",key:"Control",threshold:300},quickAction:{type:"double-press",key:"Shift",threshold:300},agentSwitching:[{type:"chord",key:"1",modifiers:["ctrl"]},{type:"chord",key:"2",modifiers:["ctrl"]},{type:"chord",key:"3",modifiers:["ctrl"]},{type:"chord",key:"4",modifiers:["ctrl"]}]};function jm(e){if(!e)return structuredClone(Da);try{const t=JSON.parse(e);return{terminalToggle:t.terminalToggle??structuredClone(Da.terminalToggle),quickAction:t.quickAction??structuredClone(Da.quickAction),agentSwitching:t.agentSwitching??structuredClone(Da.agentSwitching)}}catch{return structuredClone(Da)}}function Bv(e){return e.code.startsWith("Digit")?e.code.slice(-1):e.code.startsWith("Key")?e.code.slice(3).toLowerCase():e.key}function vS(e){if(e.type==="double-press")return`Double ${e.key==="Control"?"Ctrl":e.key==="Shift"?"Shift":e.key==="Alt"?"Alt":e.key==="Meta"?"Meta":e.key}`;const t=e.modifiers.map(s=>{switch(s){case"ctrl":return"Ctrl";case"meta":return"⌘";case"alt":return"Alt";case"shift":return"Shift"}}),n=e.key.length===1?e.key.toUpperCase():e.key;return[...t,n].join("+")}function Pj(e){return e.type==="double-press"}function bS(e){return e.type==="chord"}function Bj(e,t){return t.length===1&&/^[a-z]$/i.test(t)?e.code===`Key${t.toUpperCase()}`:t.length===1&&/^[0-9]$/.test(t)?e.code===`Digit${t}`:e.key.toLowerCase()===t.toLowerCase()}function SS(e,t){const n=t.modifiers.includes("ctrl"),s=t.modifiers.includes("meta"),a=t.modifiers.includes("alt"),o=t.modifiers.includes("shift");return Bj(e,t.key)&&e.ctrlKey===n&&e.metaKey===s&&e.altKey===a&&e.shiftKey===o}function mp(){const e=rn(t=>t.settings[Be.KEYBINDINGS]);return jm(e)}function zj(e,t,n){const s=R.useRef(0),a=R.useRef(t);a.current=t,R.useEffect(()=>{if(!e)return;const o=e.threshold??300,u=c=>{if(c.key!==e.key)return;const d=e.key==="Control",f=e.key==="Shift",p=e.key==="Alt",m=e.key==="Meta";if(!d&&c.ctrlKey||!f&&c.shiftKey||!p&&c.altKey||!m&&c.metaKey)return;const x=Date.now();x-s.current<o?(c.preventDefault(),c.stopPropagation(),a.current(),s.current=0):s.current=x};return window.addEventListener("keydown",u,n!=null&&n.capture?!0:void 0),()=>window.removeEventListener("keydown",u,n!=null&&n.capture?!0:void 0)},[e,n==null?void 0:n.capture])}function Hj(e,t){const n=R.useRef(t);n.current=t,R.useEffect(()=>{if(!e)return;const s=a=>{SS(a,e)&&(a.preventDefault(),n.current())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e])}function wS(e,t,n){zj(e&&Pj(e)?e:void 0,t,n),Hj(e&&bS(e)?e:void 0,t)}function $j(e,t,n){const s=R.useRef(n);s.current=n,R.useEffect(()=>{const a=o=>{for(let u=0;u<e.length;u++){const c=e[u];if(!c)continue;const d=t[u];if(d&&bS(c)&&SS(o,c)){o.preventDefault(),s.current(d.id);return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,t])}var Di=J0();const $u=R.forwardRef(({icon:e,iconSize:t="w-3.5 h-3.5",className:n="",...s},a)=>l.jsx("button",{ref:a,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${n}`,...s,children:l.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));$u.displayName="IconButton";const Uj="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",Fs=R.forwardRef((e,t)=>l.jsx($u,{ref:t,icon:Uj,title:"Edit",...e}));Fs.displayName="EditButton";const Fj="M6 18L18 6M6 6l12 12",pp=R.forwardRef((e,t)=>l.jsx($u,{ref:t,icon:Fj,...e}));pp.displayName="CloseButton";const Vj={sm:"max-w-sm",md:"max-w-md",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[95vw] h-[90vh] flex-1"};function kt({label:e,title:t,size:n="md",minHeight:s,children:a,footer:o,className:u,onClose:c,isOpen:d,closeOnBackdropClick:f=!0,closeOnEscape:p=!0,showCloseButton:m=!0}){const[x,_]=R.useState(!1),w=d!==void 0,k=w?d:x,v=R.useCallback(()=>{w||_(!0)},[w]),S=R.useCallback(()=>{w||_(!1),c==null||c()},[w,c]);R.useEffect(()=>{if(!k||!p)return;const b=E=>{E.key==="Escape"&&(E.stopPropagation(),S())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[k,S,p]);const y=e&&(typeof e=="string"?l.jsx("button",{type:"button",onClick:v,className:u,children:e}):l.jsx("span",{onClick:v,className:u,style:{cursor:"pointer"},children:e}));return l.jsxs(l.Fragment,{children:[y,k&&(typeof document<"u"?Di.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:f?S:void 0}),l.jsxs("div",{className:`relative w-full ${Vj[n]} max-h-[90vh] bg-bg-secondary border border-border rounded shadow-xl flex flex-col`,children:[(t||m)&&l.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[t&&l.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:t}),m&&l.jsx(pp,{onClick:S,className:"ml-auto","aria-label":"Close"})]}),l.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",style:s?{minHeight:s}:void 0,children:a}),o&&l.jsx("div",{className:"px-4 py-3 border-t border-border",children:o})]})]}),document.body):null)]})}function Gj({value:e,defaultUrl:t,disabled:n,onChange:s}){const a=e??t;return l.jsxs("div",{className:"relative",children:[l.jsx("select",{value:a,disabled:n,onChange:o=>{const u=o.target.value;s(u===t?null:u)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:K2.map(({url:o,label:u})=>l.jsx("option",{value:o,title:u,children:u.split(" ")[0]},o))}),l.jsx(Mr,{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted"})]})}const zv=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function Wj(){const e=bi(d=>d.settings),t=bi(d=>d.update),n=bi(d=>d.updateEvent),s=bi(d=>d.updateAgentOverride),a=bi(d=>d.load);R.useEffect(()=>{a()},[a]);const o=async()=>{await X2()==="granted"&&t({...e,browserNotificationEnabled:!0})},u=(d,f,p,m)=>{d==="general"?n(f,{[p]:m}):s(d,f,{[p]:m})},c=(d,f,p)=>{d==="general"?n(f,{customSoundUrl:p}):s(d,f,{customSoundUrl:p})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),l.jsx(Hv,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>t({...e,soundEnabled:d})}),l.jsx(Hv,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?o():t({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&l.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),l.jsx("div",{className:"border border-border rounded overflow-hidden",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),zv.map(d=>l.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),l.jsx("tbody",{children:q2.map(d=>l.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[l.jsx("td",{className:"px-3 py-2",children:l.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),zv.map(f=>{const p=hS(e,d.key,f.key==="general"?void 0:f.key),m=uS[d.key];return l.jsx("td",{className:"px-2 py-2 align-top",children:l.jsxs("div",{className:"flex flex-col items-center gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:l.jsx("input",{type:"checkbox",checked:p.soundEnabled,onChange:x=>u(f.key,d.key,"soundEnabled",x.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),l.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:l.jsx("input",{type:"checkbox",checked:p.browserNotification,onChange:x=>u(f.key,d.key,"browserNotification",x.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),p.soundEnabled&&e.soundEnabled&&l.jsx(Gj,{value:p.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:x=>c(f.key,d.key,x)})]})},f.key)})]},d.key))})]})})]})]})}function Hv({label:e,description:t,checked:n,onChange:s}){return l.jsxs("label",{className:"flex items-start justify-between gap-3 cursor-pointer group",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),l.jsx("div",{className:"text-xs text-text-muted mt-0.5",children:t})]}),l.jsx("div",{className:"flex-shrink-0 pt-0.5",children:l.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${n?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:a=>{a.preventDefault(),s(!n)},children:l.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${n?"translate-x-4":"translate-x-0.5"}`})})})]})}const Je=R.forwardRef(({variant:e="secondary",size:t="md",className:n="",children:s,...a},o)=>{const u="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",c={primary:"bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return l.jsx("button",{ref:o,className:`${u} ${c[e]} ${d[t]} ${n}`,...a,children:s})});Je.displayName="Button";async function gp(e,t,n){t({loading:!0});try{const a=await(await Te(e)).json();t({defaults:a.defaults??[],userItems:a.userItems??[],...n?{projectItems:a.projectItems??[]}:{},loading:!1})}catch{t({loading:!1})}}const Tr=qn((e,t)=>({defaults:[],userItems:[],projectItems:[],loading:!1,fetchSkills:async()=>{await gp("/api/skills",e,!0)},toggleSkill:async n=>{try{const a=await(await Te(`/api/skills/${n}/toggle`,{method:"POST"})).json();e(o=>({defaults:o.defaults.map(u=>u.id===n?{...u,enabled:a.enabled}:u),userItems:o.userItems.map(u=>u.id===n?{...u,enabled:a.enabled}:u)}))}catch{}},fetchSkill:async n=>{try{const s=await Te(`/api/skills/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await Te(`/api/skills/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createSkill:async(n,s)=>{const a=await Ws("POST","/api/skills",{...n,destination:s});return a.success&&await t().fetchSkills(),a},updateSkill:async(n,s)=>{const a=await Ws("PUT",`/api/skills/${n}`,s);return a.success&&await t().fetchSkills(),a},deleteSkill:async n=>{try{const s=await Te(`/api/skills/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(u=>u.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async(n,s)=>zu(`/api/skills/${n}/duplicate`,()=>t().fetchSkills(),s)}));function xp(){const[e,t]=R.useState({id:null,type:null}),n=R.useCallback(o=>t({id:o,type:"delete"}),[]),s=R.useCallback(()=>t({id:null,type:null}),[]),a=R.useCallback((o,u)=>e.id===o&&e.type===u,[e.id,e.type]);return{requestDelete:n,clearConfirm:s,isConfirming:a}}function _p({onConfirm:e,onCancel:t}){return l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),l.jsx("button",{onClick:t,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function yp({onClick:e}){return l.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:l.jsx(_l,{})})}function mu({onClick:e}){return l.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:l.jsx(cp,{})})}function Ti({label:e,value:t,onChange:n,placeholder:s,readOnly:a,hint:o,mono:u}){return l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,o&&l.jsx("span",{className:"text-text-muted ml-1",children:o})]}),l.jsx("input",{value:t,onChange:c=>n(c.target.value),readOnly:a,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${u?"font-mono":""} ${a?"opacity-60":""}`})]})}function qj({onCancel:e,onSave:t,saving:n,saveDisabled:s}){return l.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[l.jsx(Je,{variant:"secondary",onClick:e,children:"Cancel"}),l.jsx(Je,{variant:"primary",onClick:t,disabled:n||s,children:n?"Saving...":"Save"})]})}function vp({message:e}){return l.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function CS({description:e,onNew:t,loading:n,hasItems:s,children:a}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("p",{className:"text-text-secondary text-sm",children:e}),l.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:l.jsx(Je,{variant:"primary",size:"sm",onClick:t,children:"+ New"})})]}),n&&!s?l.jsx("div",{className:"text-text-muted text-sm",children:"Loading..."}):s?a:l.jsx("div",{className:"text-text-muted text-sm",children:"No items defined."})]})}function kS({label:e="Custom",children:t}){return l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),l.jsx("div",{className:"space-y-2",children:t})]})}function ES({description:e,onNew:t,newLabel:n="+ New"}){return l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("p",{className:"text-text-secondary text-sm",children:e}),l.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:l.jsx(Je,{variant:"primary",size:"sm",onClick:t,children:n})})]})}function jS({isBuiltIn:e,isConfirmingDelete:t,onView:n,onEdit:s,onDuplicate:a,onDelete:o,children:u}){return l.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[l.jsx("div",{className:"min-w-0 flex-1 mr-3",children:u}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&n&&l.jsx("button",{onClick:n,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:l.jsx(fu,{})}),l.jsx(mu,{onClick:a}),!e&&s&&l.jsx(Fs,{onClick:s}),!e&&(t?l.jsx(_p,{onConfirm:()=>{o==null||o()},onCancel:()=>{}}):l.jsx(yp,{onClick:()=>o==null?void 0:o()}))]})]})}function Kj({id:e,name:t,description:n,isBuiltIn:s,isConfirmingDelete:a,onView:o,onEdit:u,onDuplicate:c,onDelete:d}){return l.jsxs(jS,{isBuiltIn:s,isConfirmingDelete:a,onView:o,onEdit:u,onDuplicate:c,onDelete:d,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-text-primary text-sm font-medium",children:t}),l.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),n&&l.jsx("p",{className:"text-text-muted text-xs truncate",children:n})]})}function TS({loading:e,hasItems:t,loadingLabel:n,emptyLabel:s,children:a}){return e&&!t?l.jsx("div",{className:"text-text-muted text-sm",children:n}):t?l.jsx("div",{className:"space-y-4",children:a}):s?l.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function NS({name:e,id:t,nameLabel:n="Name",idLabel:s="ID",namePlaceholder:a="My Item",idPlaceholder:o="my-item",nameHint:u,readOnlyId:c=!1,readOnlyHint:d="(read-only)",onNameChange:f,onIdChange:p}){return l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Ti,{label:n,value:e,onChange:f,placeholder:a,hint:u}),l.jsx(Ti,{label:s,value:t,onChange:p,readOnly:c,placeholder:o,hint:c?d:void 0,mono:!0})]})}function AS(e={}){const{initialData:t={}}=e,[n,s]=R.useState("list"),[a,o]=R.useState(null),[u,c]=R.useState(""),[d,f]=R.useState(!1),[p,m]=R.useState(t),x=R.useCallback(()=>{m(t),c(""),o(null)},[t]),_=R.useCallback(S=>{s(S),S==="list"&&x()},[x]),w=R.useCallback(S=>{m(y=>typeof S=="function"?S(y):S)},[]),k=R.useCallback((S,y={})=>{o(S),s("edit"),m({...y}),c("")},[]),v=R.useCallback(()=>{o(null),s("edit"),m(t),c("")},[t]);return{view:n,editingId:a,formError:u,saving:d,formData:p,setView:_,setEditingId:o,setFormError:c,setFormData:w,setSaving:f,resetForm:x,startEditing:k,startNew:v}}function $v({skill:e,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:u}){return l.jsx(Kj,{id:e.id,name:e.name,description:e.description,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:u})}function Yj({isOpen:e}){const t=Tr(H=>H.defaults),n=Tr(H=>H.userItems),s=Tr(H=>H.projectItems),a=Tr(H=>H.loading),o=Tr(H=>H.fetchSkills),u=Tr(H=>H.fetchSkill),c=Tr(H=>H.fetchDefaultContent),d=Tr(H=>H.createSkill),f=Tr(H=>H.updateSkill),p=Tr(H=>H.deleteSkill),{view:m,editingId:x,formError:_,saving:w,formData:k,setView:v,setEditingId:S,setFormError:y,setFormData:b,setSaving:E}=AS(),{clearConfirm:N}=xp();R.useEffect(()=>{e&&(o(),v("list"),S(null),N())},[e,o,N]);const T=(H,K,X,P)=>{b({name:P??H.metadata.name,id:X??H.metadata.id,description:H.metadata.description??"",version:H.metadata.version??"1.0.0",prompt:H.prompt,isReadOnly:K,destination:"user"})},L=async H=>{if(t.some(X=>X.id===H)){const X=await c(H);if(!X)return;T(X,!0),S(H),y(""),v("edit")}else{const X=await u(H);if(!X)return;T(X,!0),S(H),y(""),v("edit")}},A=async H=>{const X=t.some(O=>O.id===H)?await c(H):await u(H);if(!X)return;const P=`${H}-copy-${Date.now()}`;T(X,!1,P,`${X.metadata.name} (copy)`),S(null),y(""),v("edit")},M=()=>{b({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1,destination:"user"}),v("edit")},D=async H=>{const K=await u(H);K&&(T(K,!1),S(H),y(""),v("edit"))},U=async H=>{await p(H),N()},F=async()=>{const H=x??k.id;if(!H||!k.name||!k.prompt){y("Name, ID, and prompt are required.");return}E(!0),y("");const K={metadata:{id:H,name:k.name,description:k.description,version:k.version},prompt:k.prompt},X=x?await f(x,K):await d(K,k.destination);if(E(!1),!X.success){y(X.error??"Failed to save skill.");return}v("list")},B=H=>{b(K=>({...K,name:H})),x||b(K=>({...K,id:H.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},Y=k.isReadOnly;if(m==="edit")return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex justify-between items-center mb-3",children:[l.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:Y?k.name:x?"Edit Skill":"New Skill"}),l.jsx("button",{onClick:()=>v("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),_&&l.jsx(vp,{message:_}),l.jsxs("div",{className:"space-y-3 mb-3",children:[l.jsx(NS,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:B,onIdChange:()=>{}}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Ti,{label:"Description",value:k.description,onChange:H=>b(K=>({...K,description:H})),placeholder:"What this skill does...",readOnly:Y}),l.jsx(Ti,{label:"Version",value:k.version,onChange:H=>b(K=>({...K,version:H})),placeholder:"1.0.0",readOnly:Y})]})]}),l.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),l.jsx("textarea",{value:k.prompt,onChange:H=>b(K=>({...K,prompt:H.target.value})),readOnly:Y,placeholder:"The system prompt for this skill...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),!x&&l.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[l.jsx("label",{className:"text-xs text-text-secondary",children:"Save to:"}),l.jsxs("select",{value:k.destination,onChange:H=>b(K=>({...K,destination:H.target.value})),className:"px-2 py-1 bg-bg-tertiary border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[l.jsx("option",{value:"user",children:"Global config"}),l.jsx("option",{value:"project",children:"Project (.openfox/)"})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-border flex-shrink-0",children:[l.jsx(Je,{variant:"secondary",onClick:()=>v("list"),children:"Cancel"}),Y?l.jsx(Je,{variant:"primary",onClick:()=>{b(H=>({...H,name:H.name+" (copy)",id:`${x}-copy-${Date.now()}`,isReadOnly:!1})),S(null)},children:"Duplicate & Customize"}):l.jsx(Je,{variant:"primary",onClick:F,disabled:w||!k.name||!k.id||!k.prompt,children:w?"Saving...":"Save"})]})]});function W({items:H}){return H.map(K=>l.jsx($v,{skill:K,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>L(K.id),onEdit:()=>D(K.id),onDuplicate:()=>A(K.id),onDelete:()=>U(K.id)},K.id))}return l.jsxs("div",{children:[l.jsx(ES,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:M}),l.jsxs(TS,{loading:a,hasItems:t.length>0||n.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[t.length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),l.jsx("div",{className:"space-y-2",children:t.map(H=>l.jsx($v,{skill:H,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>L(H.id),onDuplicate:()=>A(H.id)},H.id))})]}),n.length>0&&l.jsx(kS,{children:l.jsx(W,{items:n})}),s.length>0&&l.jsxs("div",{className:"mt-4",children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Project"}),l.jsx("div",{className:"space-y-2",children:l.jsx(W,{items:s})})]})]})]})}function Uu(){const e=rn(a=>a.settings),t=rn(a=>a.loading),n=rn(a=>a.getSetting),s=rn(a=>a.setSetting);return{settings:e,loading:t,getSetting:n,setSetting:s}}function Xj({isOpen:e}){const{settings:t,loading:n,getSetting:s,setSetting:a}=Uu(),o=t[Be.GLOBAL_INSTRUCTIONS]??"",u=n[Be.GLOBAL_INSTRUCTIONS]??!1,[c,d]=R.useState(o),[f,p]=R.useState(!1),[m,x]=R.useState(!1);R.useEffect(()=>{e&&s(Be.GLOBAL_INSTRUCTIONS)},[e,s]),R.useEffect(()=>{d(o),p(!1)},[o]);const _=async()=>{x(!0),await a(Be.GLOBAL_INSTRUCTIONS,c),x(!1),p(!1)},w=()=>{d(o),p(!1)},k=u||m;return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),l.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),l.jsx("textarea",{value:c,onChange:v=>{d(v.target.value),p(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full min-h-80 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:k})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{variant:"secondary",onClick:w,disabled:!f,children:"Discard"}),l.jsx(Je,{variant:"primary",onClick:_,disabled:!f||k,children:m?"Saving...":"Save"})]})]})}function Qj(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t){const n=parseInt(t[1]??"0",16),s=parseInt(t[2]??"0",16),a=parseInt(t[3]??"0",16);return`${n} ${s} ${a}`}return e}function vi(e){const t=e.split(" ").map(n=>parseInt(n,10));return t.length===3&&t.every(n=>!isNaN(n))?`#${t.map(n=>(n??0).toString(16).padStart(2,"0")).join("")}`:e}function Jj({isOpen:e,isNew:t,basePresetId:n,presetName:s,initialTokens:a,onClose:o,onSave:u}){const[c,d]=R.useState(a),[f,p]=R.useState(s);R.useEffect(()=>{d(a),p(s)},[a,s]);const m=(v,S)=>{const y=S.startsWith("#")?Qj(S):S;d(b=>({...b,[v]:y}))},x=()=>{u(f.trim()||"Untitled",{...c})},_=mS.reduce((v,S)=>{const y=S.category;return v[y]||(v[y]=[]),v[y].push(S),v},{}),w={background:"Backgrounds",surface:"Surfaces",text:"Text",accent:"Accents",border:"Border"},k=Rr.find(v=>v.id===n);return l.jsx(kt,{isOpen:e,onClose:o,size:"lg",title:t?"New Theme":"Edit Theme",closeOnBackdropClick:!0,closeOnEscape:!0,footer:l.jsxs("div",{className:"flex gap-2 justify-end",children:[l.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 border border-border rounded text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:"Cancel"}),l.jsx("button",{type:"button",onClick:x,className:"px-4 py-2 bg-accent-primary text-white rounded hover:bg-accent-primary/80 transition-colors text-sm",children:"Save"})]}),children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-xs text-text-muted block mb-1",children:"Name"}),l.jsx("input",{type:"text",value:f,onChange:v=>p(v.target.value),className:"w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),!t&&l.jsxs("div",{className:"text-xs text-text-muted",children:["Based on ",l.jsx("span",{className:"text-text-primary",children:k==null?void 0:k.name})]}),Object.entries(_).map(([v,S])=>l.jsxs("div",{className:"space-y-3",children:[l.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:w[v]??v}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:S.map(y=>l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("label",{htmlFor:y.key,className:"text-xs text-text-muted",children:y.label}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"color",id:y.key,value:vi(c[y.key]??y.defaultValue),onChange:b=>m(y.key,b.target.value),className:"w-8 h-8 rounded cursor-pointer border border-border bg-transparent flex-shrink-0"}),l.jsx("input",{type:"text",value:c[y.key]??y.defaultValue,onChange:b=>m(y.key,b.target.value),className:"flex-1 min-w-0 px-2 py-1 bg-bg-tertiary border border-border rounded text-xs text-text-primary font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]},y.key))})]},v))]})})}function Zj(){const[e,t]=R.useState(null),n=$t(b=>b.currentPreset),s=$t(b=>b.isCustom),a=$t(b=>b.basePreset),o=$t(b=>b.isSystem),u=$t(b=>b.applyPreset),c=$t(b=>b.applyUserPreset),d=$t(b=>b.deleteUserPreset),f=$t(b=>b.saveTheme),p=$t(b=>b.userPresets),m=b=>{b==="system"?(u(b),f(JSON.stringify({preset:"system"})).catch(()=>{})):(u(b),f(JSON.stringify({preset:b})).catch(()=>{}))},x=b=>{c(b)},_=b=>{const E=Rr.find(N=>N.id===b);E&&t({type:"new",presetIndex:p.length,basePresetId:b,presetName:E.name+" Copy",tokens:{...E.tokens}})},w=b=>{const E=p[b];if(!E)return;const N=Rr.find(L=>L.id===E.basePreset),T=N?{...N.tokens,...E.tokens}:E.tokens;t({type:"edit",presetIndex:b,basePresetId:E.basePreset,presetName:E.name,tokens:T})},k=(b,E)=>{if(!e)return;const N=[...p];if(e.type==="new"){const T={id:"custom-"+Date.now(),name:b,basePreset:e.basePresetId,tokens:E};N.push(T);const L=N.length-1;$t.setState({userPresets:N}),$t.getState().saveUserPresets(),$t.getState().applyUserPreset(L)}else{const T=N[e.presetIndex];T&&(N[e.presetIndex]={...T,name:b,tokens:E}),$t.setState({userPresets:N}),$t.getState().saveUserPresets(),$t.getState().applyUserPreset(e.presetIndex)}t(null)},v=()=>{t(null)},S=(b,E)=>{b.stopPropagation(),d(E)},y=o?"system":s?a:n;return l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Theme"}),l.jsx("div",{className:"flex flex-wrap gap-2 pb-2",children:Rr.map(b=>{const E=b.id===y&&!s;return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{type:"button",onClick:()=>m(b.id),className:`flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors min-w-[80px] ${E?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[l.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:b.id==="system"?"transparent":vi(b.tokens["color-bg-primary"]??"#000"),borderColor:vi(b.tokens["color-border"]??"#000")},children:b.id==="system"?l.jsx("div",{className:"w-4 h-4 rounded-full",style:{background:"linear-gradient(135deg, #000 50%, #fff 50%)"}}):l.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:vi(b.tokens["color-text-primary"]??"#fff")}})}),l.jsx("span",{className:"text-xs",children:b.name})]}),b.id!=="system"&&l.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),_(b.id)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Create custom theme based on this",children:l.jsx("span",{className:"text-xs",children:"✎"})})]},b.id)})}),p.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("h4",{className:"text-xs font-medium text-text-muted uppercase",children:"My Themes"}),l.jsx("div",{className:"grid grid-cols-5 gap-2",children:p.map((b,E)=>{const N=Rr.find(L=>L.id===b.basePreset),T=N?{...N.tokens,...b.tokens}:b.tokens;return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{type:"button",onClick:()=>x(E),className:`w-full flex flex-col items-center gap-2 px-3 py-3 rounded-lg border transition-colors ${s&&a===b.basePreset&&y===b.basePreset?"border-accent-primary bg-bg-tertiary text-text-primary":"border-border bg-bg-secondary text-text-muted hover:border-text-muted"}`,children:[l.jsx("div",{className:"w-8 h-8 rounded border flex items-center justify-center",style:{backgroundColor:vi(T["color-bg-primary"]??"#000"),borderColor:vi(T["color-border"]??"#000")},children:l.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:vi(T["color-text-primary"]??"#fff")}})}),l.jsx("span",{className:"text-xs truncate w-full text-center",children:b.name})]}),l.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),w(E)},className:"absolute top-1 right-1 w-6 h-6 rounded bg-bg-tertiary border border-border flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10 hover:border-text-muted",title:"Edit",children:l.jsx("span",{className:"text-xs",children:"✎"})}),l.jsx("button",{type:"button",onClick:L=>S(L,E),className:"absolute -top-1 -left-1 w-5 h-5 rounded-full bg-accent-error text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-20",children:l.jsx(yl,{className:"w-3 h-3"})})]},b.id)})})]}),e&&l.jsx(Jj,{isOpen:!0,isNew:e.type==="new",presetIndex:e.presetIndex,basePresetId:e.basePresetId,presetName:e.presetName,initialTokens:e.tokens,onClose:v,onSave:k})]})}function eT(){return l.jsx(Zj,{})}function tT(){const{settings:e,loading:t,getSetting:n,setSetting:s}=Uu(),a=t[Be.DISPLAY_SHOW_THINKING]??!1,o=[{key:Be.DISPLAY_SHOW_THINKING,label:"Show thinking blocks",description:"Display AI reasoning content in the feed"},{key:Be.DISPLAY_SHOW_VERBOSE_TOOL_OUTPUT,label:"Show expanded tool output",description:"Always show full tool call details instead of compact view"},{key:Be.DISPLAY_SHOW_STATS,label:"Show stats bar",description:"Display model, tokens, and timing information"},{key:Be.DISPLAY_SHOW_AGENT_DEFINITIONS,label:"Show agent definitions",description:"Display agent definition injections in the feed"},{key:Be.DISPLAY_SHOW_WORKFLOW_BARS,label:"Show workflow bars",description:"Display workflow start and end markers"},{key:Be.DISPLAY_SHOW_SYNTAX_HIGHLIGHTING,label:"Show syntax highlighting",description:"Nicer formatting, but very slow - does not affect red/green diff coloring"}],u=Object.fromEntries(o.map(p=>[p.key,e[p.key]??"true"])),[c,d]=R.useState(()=>Object.fromEntries(o.map(p=>[p.key,u[p.key]==="true"])));R.useEffect(()=>{o.forEach(p=>n(p.key))},[n]),R.useEffect(()=>{d(Object.fromEntries(o.map(p=>[p.key,u[p.key]==="true"])))},[JSON.stringify(u)]);const f=async p=>{const m=String(!c[p]);d(x=>({...x,[p]:!x[p]})),await s(p,m)};return a?l.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):l.jsxs("div",{className:"space-y-6",children:[l.jsx(eT,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary mb-4",children:"Feed Display"}),l.jsx("div",{className:"space-y-4",children:o.map(({key:p,label:m,description:x})=>l.jsxs("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm text-text-primary font-medium",children:m}),l.jsx("div",{className:"text-xs text-text-muted mt-0.5",children:x})]}),l.jsx("button",{type:"button",onClick:()=>f(p),className:`relative inline-flex h-6 w-11 flex-shrink-0 items-center rounded-full transition-colors ${c[p]?"bg-accent-primary":"bg-bg-tertiary"}`,children:l.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${c[p]?"translate-x-6":"translate-x-1"}`})})]},p))})]})]})}function nT({enabled:e,onClick:t}){return l.jsx("button",{type:"button",onClick:t,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${e?"bg-accent-primary":"bg-bg-tertiary"}`,children:l.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?"translate-x-6":"translate-x-1"}`})})}function rT(e){try{return new RegExp(e),!0}catch{return!1}}function sT({value:e,onChange:t}){const[n,s]=R.useState({}),a=(d,f)=>{const p=e.patterns.map((m,x)=>x===d?{...m,...f}:m);t({...e,patterns:p})},o=d=>{const f=e.patterns.filter((p,m)=>m!==d);t({...e,patterns:f})},u=()=>{const d={field:"content",pattern:"",action:"retry",active:!0};t({...e,patterns:[...e.patterns,d]})},c=(d,f)=>{s(p=>({...p,[d]:f.length>0&&!rT(f)})),a(d,{pattern:f})};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-text-primary",children:"Max Retries Per Turn"}),l.jsx("input",{type:"number",min:1,max:100,value:e.maxRetriesPerTurn,onChange:d=>{const f=parseInt(d.target.value,10),p=isNaN(f)?10:Math.max(1,Math.min(100,f));t({...e,maxRetriesPerTurn:p})},className:"mt-1 block w-24 px-2 py-1 text-sm bg-bg-secondary border border-border rounded"})]}),e.patterns.length===0?l.jsx("p",{className:"text-sm text-text-muted",children:"No retry patterns configured."}):l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-left text-text-muted border-b border-border",children:[l.jsx("th",{className:"pb-2 pr-2 w-12",children:"Active"}),l.jsx("th",{className:"pb-2 pr-2",children:"Field"}),l.jsx("th",{className:"pb-2 pr-2",children:"Pattern"}),l.jsx("th",{className:"pb-2 pr-2",children:"Action"}),l.jsx("th",{className:"pb-2 w-8"})]})}),l.jsx("tbody",{children:e.patterns.map((d,f)=>l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("td",{className:"py-2 pr-2",children:l.jsx("input",{type:"checkbox",checked:d.active,onChange:()=>a(f,{active:!d.active}),className:"accent-accent-primary","aria-label":`Toggle pattern ${f+1}`})}),l.jsx("td",{className:"py-2 pr-2",children:l.jsxs("select",{value:d.field,onChange:p=>a(f,{field:p.target.value}),className:"px-2 py-1 bg-bg-secondary border border-border rounded text-sm",children:[l.jsx("option",{value:"content",children:"content"}),l.jsx("option",{value:"thinking",children:"thinking"}),l.jsx("option",{value:"both",children:"both"})]})}),l.jsx("td",{className:"py-2 pr-2",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("input",{type:"text",value:d.pattern,onChange:p=>c(f,p.target.value),placeholder:"regex pattern",className:"flex-1 px-2 py-1 bg-bg-secondary border border-border rounded text-sm font-mono"}),d.pattern.length>0&&l.jsx("span",{className:`text-sm ${n[f]?"text-red-500":"text-green-500"}`,children:n[f]?"✗":"✓"})]})}),l.jsx("td",{className:"py-2 pr-2 text-text-muted",children:"retry"}),l.jsx("td",{className:"py-2",children:l.jsx("button",{onClick:()=>o(f),title:"Remove pattern",className:"text-text-muted hover:text-red-500 transition-colors",children:"×"})})]},f))})]}),l.jsx(Je,{variant:"secondary",onClick:u,children:"Add Pattern"})]})}function iT({onClose:e}){const[,t]=br(),{settings:n,getSetting:s,setSetting:a}=Uu(),o=n[Be.DISPLAY_SHOW_OPEN_IN_EDITOR]==="true",u=n[Be.LLM_DYNAMIC_SYSTEM_PROMPT]==="true",[c,d]=R.useState({openInEditor:o,dynamicPrompt:u}),[f,p]=R.useState({patterns:[],maxRetriesPerTurn:10});R.useEffect(()=>{d({openInEditor:o,dynamicPrompt:u})},[o,u]),R.useEffect(()=>{s(Be.DISPLAY_SHOW_OPEN_IN_EDITOR),s(Be.LLM_DYNAMIC_SYSTEM_PROMPT),s(Be.RETRY_PATTERNS)},[s]),R.useEffect(()=>{const k=n[Be.RETRY_PATTERNS];if(k)try{p(JSON.parse(k))}catch{}},[n]);const m=R.useCallback(k=>{p(k),a(Be.RETRY_PATTERNS,JSON.stringify(k))},[a]),x=()=>{const k=!c.openInEditor;d(v=>({...v,openInEditor:k})),a(Be.DISPLAY_SHOW_OPEN_IN_EDITOR,String(k))},_=()=>{const k=!c.dynamicPrompt;d(v=>({...v,dynamicPrompt:k})),a(Be.LLM_DYNAMIC_SYSTEM_PROMPT,String(k))};function w(){e(),t("/onboarding")}return l.jsxs("div",{className:"space-y-6",children:[l.jsx(Uv,{title:"Dynamic System Prompt",description:"Rebuild the system prompt on every turn. When disabled, changes are applied on demand via the context header for better cache performance.",enabled:c.dynamicPrompt,onToggle:_,boldTitle:!0}),l.jsx("hr",{className:"border-border"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary mb-3",children:"Auto-Retry Patterns"}),l.jsx("p",{className:"text-xs text-text-muted mb-3",children:'Define regex patterns that, when matched against LLM responses mid-stream, trigger an automatic retry with a "continue" prompt. The content that triggered the match is preserved in the chat feed.'}),l.jsx(sT,{value:f,onChange:m})]}),l.jsx("hr",{className:"border-border"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary mb-3",children:"Integrations"}),l.jsx(Uv,{title:'Show "Open in VSCode" links',description:"Display a link on file reads to open the file directly in VS Code.",enabled:c.openInEditor,onToggle:x})]}),l.jsx("hr",{className:"border-border"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),l.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),l.jsx(Je,{variant:"secondary",onClick:w,children:"Launch Onboarding"})]})]})}function Uv({title:e,description:t,enabled:n,onToggle:s,boldTitle:a}){return l.jsxs("label",{className:"flex items-start justify-between gap-3 cursor-pointer",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:`text-sm ${a?"font-medium":""} text-text-primary`,children:e}),l.jsx("div",{className:"text-xs text-text-muted mt-0.5",children:t})]}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(nT,{enabled:n,onClick:s})})]})}function aT({label:e,binding:t,isRecording:n,onStartRecording:s,onBindingRecorded:a,onCancelRecording:o}){const u=R.useRef(null),c=R.useRef(0),d=R.useRef("");return R.useEffect(()=>{if(!n)return;const f=new Set(["Control","Shift","Alt","Meta"]);let p=[];const m=_=>{if(_.preventDefault(),_.stopPropagation(),_.key==="Escape"){o();return}if(f.has(_.key)){_.ctrlKey&&!p.includes("ctrl")&&p.push("ctrl"),_.metaKey&&!p.includes("meta")&&p.push("meta"),_.altKey&&!p.includes("alt")&&p.push("alt"),_.shiftKey&&!p.includes("shift")&&p.push("shift");return}if(p.length>0||_.ctrlKey||_.metaKey||_.altKey||_.shiftKey){const v=[...p];_.ctrlKey&&!v.includes("ctrl")&&v.push("ctrl"),_.metaKey&&!v.includes("meta")&&v.push("meta"),_.altKey&&!v.includes("alt")&&v.push("alt"),_.shiftKey&&!v.includes("shift")&&v.push("shift"),a({type:"chord",key:Bv(_),modifiers:v});return}const w=Date.now(),k=Bv(_);if(k===d.current&&w-c.current<400){a({type:"double-press",key:k,threshold:300});return}c.current=w,d.current=k},x=_=>{_.key==="Control"&&(p=p.filter(w=>w!=="ctrl")),_.key==="Shift"&&(p=p.filter(w=>w!=="shift")),_.key==="Alt"&&(p=p.filter(w=>w!=="alt")),_.key==="Meta"&&(p=p.filter(w=>w!=="meta"))};return window.addEventListener("keydown",m,!0),window.addEventListener("keyup",x,!0),()=>{window.removeEventListener("keydown",m,!0),window.removeEventListener("keyup",x,!0)}},[n,a,o]),l.jsxs("div",{ref:u,className:`flex items-center justify-between px-3 py-2 rounded transition-colors ${n?"bg-accent-primary/10 ring-1 ring-accent-primary":"hover:bg-bg-tertiary"}`,children:[l.jsx("span",{className:"text-sm text-text-primary",children:e}),l.jsx("div",{className:"flex items-center gap-2",children:n?l.jsx("span",{className:"text-xs text-accent-primary font-medium animate-pulse",children:"Press shortcut..."}):l.jsx("button",{type:"button",onClick:s,className:"px-2 py-0.5 text-xs font-mono bg-bg-tertiary text-text-secondary rounded border border-border hover:border-accent-primary hover:text-accent-primary transition-colors",children:vS(t)})})]})}function oT(){const{settings:e,loading:t,setSetting:n}=Uu(),s=e[Be.KEYBINDINGS],a=t[Be.KEYBINDINGS]??!1,o=jm(s),[u,c]=R.useState(null),d=[{id:"terminalToggle",label:"Toggle Terminal",binding:o.terminalToggle},{id:"quickAction",label:"Quick Action",binding:o.quickAction},...o.agentSwitching.map((x,_)=>({id:`agentSwitching.${_}`,label:`Switch to Agent ${_+1}`,binding:x}))],f=x=>{c(x)},p=R.useCallback(x=>{if(!u)return;const _=jm(s),w=structuredClone(_);if(u.startsWith("agentSwitching.")){const k=parseInt(u.split(".")[1],10);w.agentSwitching[k]=x}else u==="terminalToggle"?w.terminalToggle=x:u==="quickAction"&&(w.quickAction=x);c(null),n(Be.KEYBINDINGS,JSON.stringify(w))},[u,s,n]),m=()=>{n(Be.KEYBINDINGS,JSON.stringify(Da))};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Keyboard Shortcuts"}),l.jsx("button",{type:"button",onClick:m,disabled:a,className:"text-xs text-text-muted hover:text-text-primary px-2 py-1 rounded hover:bg-bg-tertiary transition-colors disabled:opacity-30",children:"Reset to defaults"})]}),a?l.jsx("div",{className:"text-sm text-text-muted",children:"Loading..."}):l.jsx("div",{className:"space-y-1",children:d.map(x=>l.jsx(aT,{label:x.label,binding:x.binding,isRecording:u===x.id,onStartRecording:()=>f(x.id),onBindingRecorded:p,onCancelRecording:()=>c(null)},x.id))})]})}function lT({isOpen:e,onClose:t}){const[n,s]=R.useState("instructions"),a=()=>{try{Pt.send("context.checkDynamic",{})}catch{}t()};return l.jsx(kt,{isOpen:e,onClose:a,title:"Settings",size:"xl",minHeight:"500px",children:l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1 overflow-x-auto scrollbar-hide",children:[l.jsx(Ca,{label:"Instructions",active:n==="instructions",onClick:()=>s("instructions")}),l.jsx(Ca,{label:"Skills",active:n==="skills",onClick:()=>s("skills")}),l.jsx(Ca,{label:"Notifications",active:n==="notifications",onClick:()=>s("notifications")}),l.jsx(Ca,{label:"Display",active:n==="display",onClick:()=>s("display")}),l.jsx(Ca,{label:"Keybindings",active:n==="keybindings",onClick:()=>s("keybindings")}),l.jsx(Ca,{label:"Advanced",active:n==="advanced",onClick:()=>s("advanced")})]}),n==="instructions"&&l.jsx(Xj,{isOpen:e}),n==="skills"&&l.jsx(Yj,{isOpen:e}),n==="notifications"&&l.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:l.jsx(Wj,{})}),n==="display"&&l.jsx(tT,{}),n==="keybindings"&&l.jsx(oT,{}),n==="advanced"&&l.jsx(iT,{onClose:t})]})})}function Ca({label:e,active:t,onClick:n}){return l.jsx("button",{onClick:n,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${t?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}var If={exports:{}},Fv;function cT(){return Fv||(Fv=1,(function(e,t){(function(n,s){e.exports=s()})(globalThis,(()=>(()=>{var n={4567:function(u,c,d){var f=this&&this.__decorate||function(y,b,E,N){var T,L=arguments.length,A=L<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,b,E,N);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(A=(L<3?T(A):L>3?T(b,E,A):T(b,E))||A);return L>3&&A&&Object.defineProperty(b,E,A),A},p=this&&this.__param||function(y,b){return function(E,N){b(E,N,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=d(9042),x=d(9924),_=d(844),w=d(4725),k=d(2585),v=d(3656);let S=c.AccessibilityManager=class extends _.Disposable{constructor(y,b,E,N){super(),this._terminal=y,this._coreBrowserService=E,this._renderService=N,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new x.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
59
|
-
`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(y){for(let b=0;b<y;b++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
|
|
60
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,b){this._liveRegionDebouncer.refresh(y,b,this._terminal.rows)}_renderRows(y,b){const E=this._terminal.buffer,N=E.lines.length.toString();for(let T=y;T<=b;T++){const L=E.lines.get(E.ydisp+T),A=[],M=(L==null?void 0:L.translateToString(!0,void 0,void 0,A))||"",D=(E.ydisp+T+1).toString(),U=this._rowElements[T];U&&(M.length===0?(U.innerText=" ",this._rowColumns.set(U,[0,1])):(U.textContent=M,this._rowColumns.set(U,A)),U.setAttribute("aria-posinset",D),U.setAttribute("aria-setsize",N))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,b){const E=y.target,N=this._rowElements[b===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(b===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==N)return;let T,L;if(b===0?(T=E,L=this._rowElements.pop(),this._rowContainer.removeChild(L)):(T=this._rowElements.shift(),L=E,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),L.removeEventListener("focus",this._bottomBoundaryFocusListener),b===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(b===0?-1:1),this._rowElements[b===0?1:this._rowElements.length-2].focus(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:y.anchorNode,offset:y.anchorOffset},E={node:y.focusNode,offset:y.focusOffset};if((b.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===E.node&&b.offset>E.offset)&&([b,E]=[E,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;const N=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(N)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:N,offset:((M=N.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(E.node))return;const T=({node:D,offset:U})=>{const F=D instanceof Text?D.parentNode:D;let B=parseInt(F==null?void 0:F.getAttribute("aria-posinset"),10)-1;if(isNaN(B))return console.warn("row is invalid. Race condition?"),null;const Y=this._rowColumns.get(F);if(!Y)return console.warn("columns is null. Race condition?"),null;let W=U<Y.length?Y[U]:Y.slice(-1)[0]+1;return W>=this._terminal.cols&&(++B,W=0),{row:B,column:W}},L=T(b),A=T(E);if(L&&A){if(L.row>A.row||L.row===A.row&&L.column>=A.column)throw new Error("invalid range");this._terminal.select(L.column,L.row,(A.row-L.row)*this._terminal.cols-L.column+A.column)}}_handleResize(y){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let b=this._rowContainer.children.length;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=S=f([p(1,k.IInstantiationService),p(2,w.ICoreBrowserService),p(3,w.IRenderService)],S)},3614:(u,c)=>{function d(x){return x.replace(/\r?\n/g,"\r")}function f(x,_){return _?"\x1B[200~"+x+"\x1B[201~":x}function p(x,_,w,k){x=f(x=d(x),w.decPrivateModes.bracketedPasteMode&&k.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(x,!0),_.value=""}function m(x,_,w){const k=w.getBoundingClientRect(),v=x.clientX-k.left-10,S=x.clientY-k.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${v}px`,_.style.top=`${S}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=d,c.bracketTextForPaste=f,c.copyHandler=function(x,_){x.clipboardData&&x.clipboardData.setData("text/plain",_.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,_,w,k){x.stopPropagation(),x.clipboardData&&p(x.clipboardData.getData("text/plain"),_,w,k)},c.paste=p,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(x,_,w,k,v){m(x,_,w),v&&k.rightClickSelect(x),_.value=k.selectionText,_.select()}},7239:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const f=d(1505);c.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(p,m,x){this._css.set(p,m,x)}getCss(p,m){return this._css.get(p,m)}setColor(p,m,x){this._color.set(p,m,x)}getColor(p,m){return this._color.get(p,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(d,f,p,m){d.addEventListener(f,p,m);let x=!1;return{dispose:()=>{x||(x=!0,d.removeEventListener(f,p,m))}}}},3551:function(u,c,d){var f=this&&this.__decorate||function(S,y,b,E){var N,T=arguments.length,L=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,b):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,y,b,E);else for(var A=S.length-1;A>=0;A--)(N=S[A])&&(L=(T<3?N(L):T>3?N(y,b,L):N(y,b))||L);return T>3&&L&&Object.defineProperty(y,b,L),L},p=this&&this.__param||function(S,y){return function(b,E){y(b,E,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=d(3656),x=d(8460),_=d(844),w=d(2585),k=d(4725);let v=c.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(S,y,b,E,N){super(),this._element=S,this._mouseService=y,this._renderService=b,this._bufferService=E,this._linkProviderService=N,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(S){this._lastMouseEvent=S;const y=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const b=S.composedPath();for(let E=0;E<b.length;E++){const N=b[E];if(N.classList.contains("xterm"))break;if(N.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(S){if(this._activeLine!==S.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(S,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,S)||(this._clearCurrentLink(),this._askForLink(S,!0))}_askForLink(S,y){var E,N;this._activeProviderReplies&&y||((E=this._activeProviderReplies)==null||E.forEach((T=>{T==null||T.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let b=!1;for(const[T,L]of this._linkProviderService.linkProviders.entries())y?(N=this._activeProviderReplies)!=null&&N.get(T)&&(b=this._checkLinkProviderResult(T,S,b)):L.provideLinks(S.y,(A=>{var D,U;if(this._isMouseOut)return;const M=A==null?void 0:A.map((F=>({link:F})));(D=this._activeProviderReplies)==null||D.set(T,M),b=this._checkLinkProviderResult(T,S,b),((U=this._activeProviderReplies)==null?void 0:U.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,y){const b=new Set;for(let E=0;E<y.size;E++){const N=y.get(E);if(N)for(let T=0;T<N.length;T++){const L=N[T],A=L.link.range.start.y<S?0:L.link.range.start.x,M=L.link.range.end.y>S?this._bufferService.cols:L.link.range.end.x;for(let D=A;D<=M;D++){if(b.has(D)){N.splice(T--,1);break}b.add(D)}}}}_checkLinkProviderResult(S,y,b){var T;if(!this._activeProviderReplies)return b;const E=this._activeProviderReplies.get(S);let N=!1;for(let L=0;L<S;L++)this._activeProviderReplies.has(L)&&!this._activeProviderReplies.get(L)||(N=!0);if(!N&&E){const L=E.find((A=>this._linkAtPosition(A.link,y)));L&&(b=!0,this._handleNewLink(L))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!b)for(let L=0;L<this._activeProviderReplies.size;L++){const A=(T=this._activeProviderReplies.get(L))==null?void 0:T.find((M=>this._linkAtPosition(M.link,y)));if(A){b=!0,this._handleNewLink(A);break}}return b}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const y=this._positionFromMouseEvent(S,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,y){this._currentLink&&this._lastMouseEvent&&(!S||!y||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(S.link,y)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var b,E;return(E=(b=this._currentLink)==null?void 0:b.state)==null?void 0:E.decorations.pointerCursor},set:b=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==b&&(this._currentLink.state.decorations.pointerCursor=b,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",b))}},underline:{get:()=>{var b,E;return(E=(b=this._currentLink)==null?void 0:b.state)==null?void 0:E.decorations.underline},set:b=>{var E,N,T;(E=this._currentLink)!=null&&E.state&&((T=(N=this._currentLink)==null?void 0:N.state)==null?void 0:T.decorations.underline)!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((b=>{if(!this._currentLink)return;const E=b.start===0?0:b.start+1+this._bufferService.buffer.ydisp,N=this._bufferService.buffer.ydisp+1+b.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=N&&(this._clearCurrentLink(E,N),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(S,y,b){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(b,y.text)}_fireUnderlineEvent(S,y){const b=S.range,E=this._bufferService.buffer.ydisp,N=this._createLinkUnderlineEvent(b.start.x-1,b.start.y-E-1,b.end.x,b.end.y-E-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(N)}_linkLeave(S,y,b){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(b,y.text)}_linkAtPosition(S,y){const b=S.range.start.y*this._bufferService.cols+S.range.start.x,E=S.range.end.y*this._bufferService.cols+S.range.end.x,N=y.y*this._bufferService.cols+y.x;return b<=N&&N<=E}_positionFromMouseEvent(S,y,b){const E=b.getCoords(S,y,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,y,b,E,N){return{x1:S,y1:y,x2:b,y2:E,cols:this._bufferService.cols,fg:N}}};c.Linkifier=v=f([p(1,k.IMouseService),p(2,k.IRenderService),p(3,w.IBufferService),p(4,k.ILinkProviderService)],v)},9042:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(u,c,d){var f=this&&this.__decorate||function(k,v,S,y){var b,E=arguments.length,N=E<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,S,y);else for(var T=k.length-1;T>=0;T--)(b=k[T])&&(N=(E<3?b(N):E>3?b(v,S,N):b(v,S))||N);return E>3&&N&&Object.defineProperty(v,S,N),N},p=this&&this.__param||function(k,v){return function(S,y){v(S,y,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=d(511),x=d(2585);let _=c.OscLinkProvider=class{constructor(k,v,S){this._bufferService=k,this._optionsService=v,this._oscLinkService=S}provideLinks(k,v){var M;const S=this._bufferService.buffer.lines.get(k-1);if(!S)return void v(void 0);const y=[],b=this._optionsService.rawOptions.linkHandler,E=new m.CellData,N=S.getTrimmedLength();let T=-1,L=-1,A=!1;for(let D=0;D<N;D++)if(L!==-1||S.hasContent(D)){if(S.loadCell(D,E),E.hasExtendedAttrs()&&E.extended.urlId){if(L===-1){L=D,T=E.extended.urlId;continue}A=E.extended.urlId!==T}else L!==-1&&(A=!0);if(A||L!==-1&&D===N-1){const U=(M=this._oscLinkService.getLinkData(T))==null?void 0:M.uri;if(U){const F={start:{x:L+1,y:k},end:{x:D+(A||D!==N-1?0:1),y:k}};let B=!1;if(!(b!=null&&b.allowNonHttpProtocols))try{const Y=new URL(U);["http:","https:"].includes(Y.protocol)||(B=!0)}catch{B=!0}B||y.push({text:U,range:F,activate:(Y,W)=>b?b.activate(Y,W,F):w(0,W),hover:(Y,W)=>{var H;return(H=b==null?void 0:b.hover)==null?void 0:H.call(b,Y,W,F)},leave:(Y,W)=>{var H;return(H=b==null?void 0:b.leave)==null?void 0:H.call(b,Y,W,F)}})}A=!1,E.hasExtendedAttrs()&&E.extended.urlId?(L=D,T=E.extended.urlId):(L=-1,T=-1)}}v(y)}};function w(k,v){if(confirm(`Do you want to navigate to ${v}?
|
|
61
|
-
|
|
62
|
-
WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=_=f([p(0,x.IBufferService),p(1,x.IOptionsService),p(2,x.IOscLinkService)],_)},6193:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(d,f){this._renderCallback=d,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(d){return this._refreshCallbacks.push(d),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const d of this._refreshCallbacks)d(0);this._refreshCallbacks=[]}}},3236:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const f=d(3614),p=d(3656),m=d(3551),x=d(9042),_=d(3730),w=d(1680),k=d(3107),v=d(5744),S=d(2950),y=d(1296),b=d(428),E=d(4269),N=d(5114),T=d(8934),L=d(3230),A=d(9312),M=d(4725),D=d(6731),U=d(8055),F=d(8969),B=d(8460),Y=d(844),W=d(6114),H=d(8437),K=d(2584),X=d(7399),P=d(5941),O=d(9074),z=d(2585),V=d(5435),$=d(4567),ee=d(779);class Z extends F.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(Q={}){super(Q),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(O.DecorationService),this._instantiationService.setService(z.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((G,te)=>this.refresh(G,te)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((G=>this._reportWindowsOptions(G)))),this.register(this._inputHandler.onColor((G=>this._handleColorEvent(G)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((G=>this._afterResize(G.cols,G.rows)))),this.register((0,Y.toDisposable)((()=>{var G,te;this._customKeyEventHandler=void 0,(te=(G=this.element)==null?void 0:G.parentNode)==null||te.removeChild(this.element)})))}_handleColorEvent(Q){if(this._themeService)for(const G of Q){let te,se="";switch(G.index){case 256:te="foreground",se="10";break;case 257:te="background",se="11";break;case 258:te="cursor",se="12";break;default:te="ansi",se="4;"+G.index}switch(G.type){case 0:const _e=U.color.toColorRGB(te==="ansi"?this._themeService.colors.ansi[G.index]:this._themeService.colors[te]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${se};${(0,P.toRgbString)(_e)}${K.C1_ESCAPED.ST}`);break;case 1:if(te==="ansi")this._themeService.modifyColors((ye=>ye.ansi[G.index]=U.channels.toColor(...G.color)));else{const ye=te;this._themeService.modifyColors((Ae=>Ae[ye]=U.channels.toColor(...G.color)))}break;case 2:this._themeService.restoreColor(G.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Q){Q?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Q){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Q;return(Q=this.textarea)==null?void 0:Q.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Q=this.buffer.ybase+this.buffer.y,G=this.buffer.lines.get(Q);if(!G)return;const te=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,_e=G.getWidth(te),ye=this._renderService.dimensions.css.cell.width*_e,Ae=this.buffer.y*this._renderService.dimensions.css.cell.height,De=te*this._renderService.dimensions.css.cell.width;this.textarea.style.left=De+"px",this.textarea.style.top=Ae+"px",this.textarea.style.width=ye+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(G=>{this.hasSelection()&&(0,f.copyHandler)(G,this._selectionService)})));const Q=G=>(0,f.handlePasteEvent)(G,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",Q)),this.register((0,p.addDisposableDomListener)(this.element,"paste",Q)),W.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(G=>{G.button===2&&(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(G=>{(0,f.rightClickHandler)(G,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(G=>{G.button===1&&(0,f.moveTextAreaUnderMouseCursor)(G,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(Q=>this._keyUp(Q)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(Q=>this._keyDown(Q)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(Q=>this._keyPress(Q)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(Q=>this._compositionHelper.compositionupdate(Q)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(Q=>this._inputEvent(Q)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Q){var te;if(!Q)throw new Error("Terminal requires a parent element.");if(Q.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((te=this.element)==null?void 0:te.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Q.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),Q.appendChild(this.element);const G=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),G.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),G.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",x.promptLabel),W.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(N.CoreBrowserService,this.textarea,Q.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(L.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(G);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(k.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(y.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Q=this,G=this.element;function te(ye){const Ae=Q._mouseService.getMouseReportCoords(ye,Q.screenElement);if(!Ae)return!1;let De,Me;switch(ye.overrideType||ye.type){case"mousemove":Me=32,ye.buttons===void 0?(De=3,ye.button!==void 0&&(De=ye.button<3?ye.button:3)):De=1&ye.buttons?0:4&ye.buttons?1:2&ye.buttons?2:3;break;case"mouseup":Me=0,De=ye.button<3?ye.button:3;break;case"mousedown":Me=1,De=ye.button<3?ye.button:3;break;case"wheel":if(Q._customWheelEventHandler&&Q._customWheelEventHandler(ye)===!1||Q.viewport.getLinesScrolled(ye)===0)return!1;Me=ye.deltaY<0?0:1,De=4;break;default:return!1}return!(Me===void 0||De===void 0||De>4)&&Q.coreMouseService.triggerMouseEvent({col:Ae.col,row:Ae.row,x:Ae.x,y:Ae.y,button:De,action:Me,ctrl:ye.ctrlKey,alt:ye.altKey,shift:ye.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},_e={mouseup:ye=>(te(ye),ye.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(ye)),wheel:ye=>(te(ye),this.cancel(ye,!0)),mousedrag:ye=>{ye.buttons&&te(ye)},mousemove:ye=>{ye.buttons||te(ye)}};this.register(this.coreMouseService.onProtocolChange((ye=>{ye?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ye)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ye?se.mousemove||(G.addEventListener("mousemove",_e.mousemove),se.mousemove=_e.mousemove):(G.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&ye?se.wheel||(G.addEventListener("wheel",_e.wheel,{passive:!1}),se.wheel=_e.wheel):(G.removeEventListener("wheel",se.wheel),se.wheel=null),2&ye?se.mouseup||(se.mouseup=_e.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&ye?se.mousedrag||(se.mousedrag=_e.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(G,"mousedown",(ye=>{if(ye.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ye))return te(ye),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(ye)}))),this.register((0,p.addDisposableDomListener)(G,"wheel",(ye=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ye)===!1)return!1;if(!this.buffer.hasScrollback){const Ae=this.viewport.getLinesScrolled(ye);if(Ae===0)return;const De=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ye.deltaY<0?"A":"B");let Me="";for(let $e=0;$e<Math.abs(Ae);$e++)Me+=De;return this.coreService.triggerDataEvent(Me,!0),this.cancel(ye,!0)}return this.viewport.handleWheel(ye)?this.cancel(ye):void 0}}),{passive:!1})),this.register((0,p.addDisposableDomListener)(G,"touchstart",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ye),this.cancel(ye)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(G,"touchmove",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ye)?void 0:this.cancel(ye)}),{passive:!1}))}refresh(Q,G){var te;(te=this._renderService)==null||te.refreshRows(Q,G)}updateCursorStyle(Q){var G;(G=this._selectionService)!=null&&G.shouldColumnSelect(Q)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(Q,G,te=0){var se;te===1?(super.scrollLines(Q,G,te),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(Q)}paste(Q){(0,f.paste)(Q,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Q){this._customKeyEventHandler=Q}attachCustomWheelEventHandler(Q){this._customWheelEventHandler=Q}registerLinkProvider(Q){return this._linkProviderService.registerLinkProvider(Q)}registerCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const G=this._characterJoinerService.register(Q);return this.refresh(0,this.rows-1),G}deregisterCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Q)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Q){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Q)}registerDecoration(Q){return this._decorationService.registerDecoration(Q)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Q,G,te){this._selectionService.setSelection(Q,G,te)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var Q;(Q=this._selectionService)==null||Q.clearSelection()}selectAll(){var Q;(Q=this._selectionService)==null||Q.selectAll()}selectLines(Q,G){var te;(te=this._selectionService)==null||te.selectLines(Q,G)}_keyDown(Q){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;const G=this.browser.isMac&&this.options.macOptionIsMeta&&Q.altKey;if(!G&&!this._compositionHelper.keydown(Q))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;G||Q.key!=="Dead"&&Q.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const te=(0,X.evaluateKeyboardEvent)(Q,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Q),te.type===3||te.type===2){const se=this.rows-1;return this.scrollLines(te.type===2?-se:se),this.cancel(Q,!0)}return te.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Q)||(te.cancel&&this.cancel(Q,!0),!te.key||!!(Q.key&&!Q.ctrlKey&&!Q.altKey&&!Q.metaKey&&Q.key.length===1&&Q.key.charCodeAt(0)>=65&&Q.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(te.key!==K.C0.ETX&&te.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:te.key,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(te.key,!0),!this.optionsService.rawOptions.screenReaderMode||Q.altKey||Q.ctrlKey?this.cancel(Q,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Q,G){const te=Q.isMac&&!this.options.macOptionIsMeta&&G.altKey&&!G.ctrlKey&&!G.metaKey||Q.isWindows&&G.altKey&&G.ctrlKey&&!G.metaKey||Q.isWindows&&G.getModifierState("AltGraph");return G.type==="keypress"?te:te&&(!G.keyCode||G.keyCode>47)}_keyUp(Q){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1||((function(G){return G.keyCode===16||G.keyCode===17||G.keyCode===18})(Q)||this.focus(),this.updateCursorStyle(Q),this._keyPressHandled=!1)}_keyPress(Q){let G;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;if(this.cancel(Q),Q.charCode)G=Q.charCode;else if(Q.which===null||Q.which===void 0)G=Q.keyCode;else{if(Q.which===0||Q.charCode===0)return!1;G=Q.which}return!(!G||(Q.altKey||Q.ctrlKey||Q.metaKey)&&!this._isThirdLevelShift(this.browser,Q)||(G=String.fromCharCode(G),this._onKey.fire({key:G,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(G,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Q){if(Q.data&&Q.inputType==="insertText"&&(!Q.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const G=Q.data;return this.coreService.triggerDataEvent(G,!0),this.cancel(Q),!0}return!1}resize(Q,G){Q!==this.cols||G!==this.rows?super.resize(Q,G):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Q,G){var te,se;(te=this._charSizeService)==null||te.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var Q;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(H.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Q=this.viewport)==null||Q.reset(),this.refresh(0,this.rows-1)}}reset(){var G,te;this.options.rows=this.rows,this.options.cols=this.cols;const Q=this._customKeyEventHandler;this._setup(),super.reset(),(G=this._selectionService)==null||G.reset(),this._decorationService.reset(),(te=this.viewport)==null||te.reset(),this._customKeyEventHandler=Q,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Q;(Q=this._renderService)==null||Q.clearTextureAtlas()}_reportFocus(){var Q;(Q=this.element)!=null&&Q.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(Q){if(this._renderService)switch(Q){case V.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const G=this._renderService.dimensions.css.canvas.width.toFixed(0),te=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${te};${G}t`);break;case V.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),_e=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${_e};${se}t`)}}cancel(Q,G){if(this.options.cancelEvents||G)return Q.preventDefault(),Q.stopPropagation(),!1}}c.Terminal=Z},9924:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(d,f=1e3){this._renderCallback=d,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(d,f,p){this._rowCount=p,d=d!==void 0?d:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,d):d,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const x=m-this._lastRefreshMs,_=this._debounceThresholdMS-x;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const d=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(d,f)}}},1680:function(u,c,d){var f=this&&this.__decorate||function(S,y,b,E){var N,T=arguments.length,L=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,b):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,y,b,E);else for(var A=S.length-1;A>=0;A--)(N=S[A])&&(L=(T<3?N(L):T>3?N(y,b,L):N(y,b))||L);return T>3&&L&&Object.defineProperty(y,b,L),L},p=this&&this.__param||function(S,y){return function(b,E){y(b,E,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=d(3656),x=d(4725),_=d(8460),w=d(844),k=d(2585);let v=c.Viewport=class extends w.Disposable{constructor(S,y,b,E,N,T,L,A){super(),this._viewportElement=S,this._scrollArea=y,this._bufferService=b,this._optionsService=E,this._charSizeService=N,this._renderService=T,this._coreBrowserService=L,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new _.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(S){if(S)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const y=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==y&&(this._lastRecordedBufferHeight=y,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const y=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(S,y){const b=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(y<0&&this._viewportElement.scrollTop!==0||y>0&&b<this._lastRecordedBufferHeight)||(S.cancelable&&S.preventDefault(),!1)}handleWheel(S){const y=this._getPixelsScrolled(S);return y!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+y:this._smoothScrollState.target+=y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=y,this._bubbleScroll(S,y))}scrollLines(S){if(S!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const y=S*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+y,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:S,suppressScrollEvent:!1})}_getPixelsScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let y=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_LINE?y*=this._currentRowHeight:S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._currentRowHeight*this._bufferService.rows),y}getBufferElements(S,y){var A;let b,E="";const N=[],T=y??this._bufferService.buffer.lines.length,L=this._bufferService.buffer.lines;for(let M=S;M<T;M++){const D=L.get(M);if(!D)continue;const U=(A=L.get(M+1))==null?void 0:A.isWrapped;if(E+=D.translateToString(!U),!U||M===L.length-1){const F=document.createElement("div");F.textContent=E,N.push(F),E.length>0&&(b=F),E=""}}return{bufferElements:N,cursorElement:b}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let y=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(y/=this._currentRowHeight+0,this._wheelPartialScroll+=y,y=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(y*=this._bufferService.rows),y}_applyScrollModifier(S,y){const b=this._optionsService.rawOptions.fastScrollModifier;return b==="alt"&&y.altKey||b==="ctrl"&&y.ctrlKey||b==="shift"&&y.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const y=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,y!==0&&(this._viewportElement.scrollTop+=y,this._bubbleScroll(S,y))}};c.Viewport=v=f([p(2,k.IBufferService),p(3,k.IOptionsService),p(4,x.ICharSizeService),p(5,x.IRenderService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],v)},3107:function(u,c,d){var f=this&&this.__decorate||function(k,v,S,y){var b,E=arguments.length,N=E<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,S,y);else for(var T=k.length-1;T>=0;T--)(b=k[T])&&(N=(E<3?b(N):E>3?b(v,S,N):b(v,S))||N);return E>3&&N&&Object.defineProperty(v,S,N),N},p=this&&this.__param||function(k,v){return function(S,y){v(S,y,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=d(4725),x=d(844),_=d(2585);let w=c.BufferDecorationRenderer=class extends x.Disposable{constructor(k,v,S,y,b){super(),this._screenElement=k,this._bufferService=v,this._coreBrowserService=S,this._decorationService=y,this._renderService=b,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((E=>this._removeDecoration(E)))),this.register((0,x.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const k of this._decorationService.decorations)this._renderDecoration(k);this._dimensionsChanged=!1}_renderDecoration(k){this._refreshStyle(k),this._dimensionsChanged&&this._refreshXPosition(k)}_createElement(k){var y;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((y=k==null?void 0:k.options)==null?void 0:y.layer)==="top"),v.style.width=`${Math.round((k.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(k.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(k.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=k.options.x??0;return S&&S>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(k,v),v}_refreshStyle(k){const v=k.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)k.element&&(k.element.style.display="none",k.onRenderEmitter.fire(k.element));else{let S=this._decorationElements.get(k);S||(S=this._createElement(k),k.element=S,this._decorationElements.set(k,S),this._container.appendChild(S),k.onDispose((()=>{this._decorationElements.delete(k),S.remove()}))),S.style.top=v*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",k.onRenderEmitter.fire(S)}}_refreshXPosition(k,v=k.element){if(!v)return;const S=k.options.x??0;(k.options.anchor||"left")==="right"?v.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(k){var v;(v=this._decorationElements.get(k))==null||v.remove(),this._decorationElements.delete(k),k.dispose()}};c.BufferDecorationRenderer=w=f([p(1,_.IBufferService),p(2,m.ICoreBrowserService),p(3,_.IDecorationService),p(4,m.IRenderService)],w)},5871:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(d){if(d.options.overviewRulerOptions){for(const f of this._zones)if(f.color===d.options.overviewRulerOptions.color&&f.position===d.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,d.marker.line))return;if(this._lineAdjacentToZone(f,d.marker.line,d.options.overviewRulerOptions.position))return void this._addLineToZone(f,d.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=d.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=d.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=d.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=d.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:d.options.overviewRulerOptions.color,position:d.options.overviewRulerOptions.position,startBufferLine:d.marker.line,endBufferLine:d.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(d){this._linePadding=d}_lineIntersectsZone(d,f){return f>=d.startBufferLine&&f<=d.endBufferLine}_lineAdjacentToZone(d,f,p){return f>=d.startBufferLine-this._linePadding[p||"full"]&&f<=d.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(u,c,d){var f=this&&this.__decorate||function(b,E,N,T){var L,A=arguments.length,M=A<3?E:T===null?T=Object.getOwnPropertyDescriptor(E,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,E,N,T);else for(var D=b.length-1;D>=0;D--)(L=b[D])&&(M=(A<3?L(M):A>3?L(E,N,M):L(E,N))||M);return A>3&&M&&Object.defineProperty(E,N,M),M},p=this&&this.__param||function(b,E){return function(N,T){E(N,T,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=d(5871),x=d(4725),_=d(844),w=d(2585),k={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let y=c.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(b,E,N,T,L,A,M){var U;super(),this._viewportElement=b,this._screenElement=E,this._bufferService=N,this._decorationService=T,this._renderService=L,this._optionsService=A,this._coreBrowserService=M,this._colorZoneStore=new m.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(U=this._viewportElement.parentElement)==null||U.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,_.toDisposable)((()=>{var F;(F=this._canvas)==null||F.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const b=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=b,v.center=E,v.right=b,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=v.left,S.right=v.left+v.center}_refreshDrawHeightConstants(){k.full=Math.round(2*this._coreBrowserService.dpr);const b=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(b,12),6)*this._coreBrowserService.dpr);k.left=E,k.center=E,k.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*k.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const b=this._colorZoneStore.zones;for(const E of b)E.position!=="full"&&this._renderColorZone(E);for(const E of b)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(b){this._ctx.fillStyle=b.color,this._ctx.fillRect(S[b.position||"full"],Math.round((this._canvas.height-1)*(b.startBufferLine/this._bufferService.buffers.active.lines.length)-k[b.position||"full"]/2),v[b.position||"full"],Math.round((this._canvas.height-1)*((b.endBufferLine-b.startBufferLine)/this._bufferService.buffers.active.lines.length)+k[b.position||"full"]))}_queueRefresh(b,E){this._shouldUpdateDimensions=b||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=y=f([p(2,w.IBufferService),p(3,w.IDecorationService),p(4,x.IRenderService),p(5,w.IOptionsService),p(6,x.ICoreBrowserService)],y)},2950:function(u,c,d){var f=this&&this.__decorate||function(k,v,S,y){var b,E=arguments.length,N=E<3?v:y===null?y=Object.getOwnPropertyDescriptor(v,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(k,v,S,y);else for(var T=k.length-1;T>=0;T--)(b=k[T])&&(N=(E<3?b(N):E>3?b(v,S,N):b(v,S))||N);return E>3&&N&&Object.defineProperty(v,S,N),N},p=this&&this.__param||function(k,v){return function(S,y){v(S,y,k)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=d(4725),x=d(2585),_=d(2584);let w=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(k,v,S,y,b,E){this._textarea=k,this._compositionView=v,this._bufferService=S,this._optionsService=y,this._coreService=b,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(k){this._compositionView.textContent=k.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(k){if(this._isComposing||this._isSendingComposition){if(k.keyCode===229||k.keyCode===16||k.keyCode===17||k.keyCode===18)return!1;this._finalizeComposition(!1)}return k.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(k){if(this._compositionView.classList.remove("active"),this._isComposing=!1,k){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const k=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,S=v.replace(k,"");this._dataAlreadySent=S,v.length>k.length?this._coreService.triggerDataEvent(S,!0):v.length<k.length?this._coreService.triggerDataEvent(`${_.C0.DEL}`,!0):v.length===k.length&&v!==k&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(k){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),S=this._renderService.dimensions.css.cell.height,y=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,b=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=b+"px",this._compositionView.style.top=y+"px",this._compositionView.style.height=S+"px",this._compositionView.style.lineHeight=S+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const E=this._compositionView.getBoundingClientRect();this._textarea.style.left=b+"px",this._textarea.style.top=y+"px",this._textarea.style.width=Math.max(E.width,1)+"px",this._textarea.style.height=Math.max(E.height,1)+"px",this._textarea.style.lineHeight=E.height+"px"}k||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=w=f([p(2,x.IBufferService),p(3,x.IOptionsService),p(4,x.ICoreService),p(5,m.IRenderService)],w)},9806:(u,c)=>{function d(f,p,m){const x=m.getBoundingClientRect(),_=f.getComputedStyle(m),w=parseInt(_.getPropertyValue("padding-left")),k=parseInt(_.getPropertyValue("padding-top"));return[p.clientX-x.left-w,p.clientY-x.top-k]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=d,c.getCoords=function(f,p,m,x,_,w,k,v,S){if(!w)return;const y=d(f,p,m);return y?(y[0]=Math.ceil((y[0]+(S?k/2:0))/k),y[1]=Math.ceil(y[1]/v),y[0]=Math.min(Math.max(y[0],1),x+(S?1:0)),y[1]=Math.min(Math.max(y[1],1),_),y):void 0}},9504:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const f=d(2584);function p(v,S,y,b){const E=v-m(v,y),N=S-m(S,y),T=Math.abs(E-N)-(function(L,A,M){let D=0;const U=L-m(L,M),F=A-m(A,M);for(let B=0;B<Math.abs(U-F);B++){const Y=x(L,A)==="A"?-1:1,W=M.buffer.lines.get(U+Y*B);W!=null&&W.isWrapped&&D++}return D})(v,S,y);return k(T,w(x(v,S),b))}function m(v,S){let y=0,b=S.buffer.lines.get(v),E=b==null?void 0:b.isWrapped;for(;E&&v>=0&&v<S.rows;)y++,b=S.buffer.lines.get(--v),E=b==null?void 0:b.isWrapped;return y}function x(v,S){return v>S?"A":"B"}function _(v,S,y,b,E,N){let T=v,L=S,A="";for(;T!==y||L!==b;)T+=E?1:-1,E&&T>N.cols-1?(A+=N.buffer.translateBufferLineToString(L,!1,v,T),T=0,v=0,L++):!E&&T<0&&(A+=N.buffer.translateBufferLineToString(L,!1,0,v+1),T=N.cols-1,v=T,L--);return A+N.buffer.translateBufferLineToString(L,!1,v,T)}function w(v,S){const y=S?"O":"[";return f.C0.ESC+y+v}function k(v,S){v=Math.floor(v);let y="";for(let b=0;b<v;b++)y+=S;return y}c.moveToCellSequence=function(v,S,y,b){const E=y.buffer.x,N=y.buffer.y;if(!y.buffer.hasScrollback)return(function(A,M,D,U,F,B){return p(M,U,F,B).length===0?"":k(_(A,M,A,M-m(M,F),!1,F).length,w("D",B))})(E,N,0,S,y,b)+p(N,S,y,b)+(function(A,M,D,U,F,B){let Y;Y=p(M,U,F,B).length>0?U-m(U,F):M;const W=U,H=(function(K,X,P,O,z,V){let $;return $=p(P,O,z,V).length>0?O-m(O,z):X,K<P&&$<=O||K>=P&&$<O?"C":"D"})(A,M,D,U,F,B);return k(_(A,Y,D,W,H==="C",F).length,w(H,B))})(E,N,v,S,y,b);let T;if(N===S)return T=E>v?"D":"C",k(Math.abs(E-v),w(T,b));T=N>S?"D":"C";const L=Math.abs(N-S);return k((function(A,M){return M.cols-A})(N>S?v:E,y)+(L-1)*y.cols+1+((N>S?E:v)-1),w(T,b))}},1296:function(u,c,d){var f=this&&this.__decorate||function(B,Y,W,H){var K,X=arguments.length,P=X<3?Y:H===null?H=Object.getOwnPropertyDescriptor(Y,W):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(B,Y,W,H);else for(var O=B.length-1;O>=0;O--)(K=B[O])&&(P=(X<3?K(P):X>3?K(Y,W,P):K(Y,W))||P);return X>3&&P&&Object.defineProperty(Y,W,P),P},p=this&&this.__param||function(B,Y){return function(W,H){Y(W,H,B)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=d(3787),x=d(2550),_=d(2223),w=d(6171),k=d(6052),v=d(4725),S=d(8055),y=d(8460),b=d(844),E=d(2585),N="xterm-dom-renderer-owner-",T="xterm-rows",L="xterm-fg-",A="xterm-bg-",M="xterm-focus",D="xterm-selection";let U=1,F=c.DomRenderer=class extends b.Disposable{constructor(B,Y,W,H,K,X,P,O,z,V,$,ee,Z){super(),this._terminal=B,this._document=Y,this._element=W,this._screenElement=H,this._viewportElement=K,this._helperContainer=X,this._linkifier2=P,this._charSizeService=z,this._optionsService=V,this._bufferService=$,this._coreBrowserService=ee,this._themeService=Z,this._terminalClass=U++,this._rowElements=[],this._selectionRenderModel=(0,k.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new y.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(D),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((re=>this._injectCss(re)))),this._injectCss(this._themeService.colors),this._rowFactory=O.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(N+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((re=>this._handleLinkHover(re)))),this.register(this._linkifier2.onHideLinkUnderline((re=>this._handleLinkLeave(re)))),this.register((0,b.toDisposable)((()=>{this._element.classList.remove(N+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new x.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${T} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${T} .xterm-dim { color: ${S.color.multiplyOpacity(B.foreground,.5).css};}`,Y+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const W=`blink_underline_${this._terminalClass}`,H=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${H} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${K} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,Y+=`${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${T}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[X,P]of B.ansi.entries())Y+=`${this._terminalSelector} .${L}${X} { color: ${P.css}; }${this._terminalSelector} .${L}${X}.xterm-dim { color: ${S.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${A}${X} { background-color: ${P.css}; }`;Y+=`${this._terminalSelector} .${L}${_.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(B.background).css}; }${this._terminalSelector} .${L}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${A}${_.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,Y){for(let W=this._rowElements.length;W<=Y;W++){const H=this._document.createElement("div");this._rowContainer.appendChild(H),this._rowElements.push(H)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,Y){this._refreshRowElements(B,Y),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,Y,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,Y,W),this.renderRows(0,this._bufferService.rows-1),!B||!Y)return;this._selectionRenderModel.update(this._terminal,B,Y,W);const H=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,X=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(X>=this._bufferService.rows||P<0)return;const O=this._document.createDocumentFragment();if(W){const z=B[0]>Y[0];O.appendChild(this._createSelectionElement(X,z?Y[0]:B[0],z?B[0]:Y[0],P-X+1))}else{const z=H===X?B[0]:0,V=X===K?Y[0]:this._bufferService.cols;O.appendChild(this._createSelectionElement(X,z,V));const $=P-X-1;if(O.appendChild(this._createSelectionElement(X+1,0,this._bufferService.cols,$)),X!==P){const ee=K===P?Y[0]:this._bufferService.cols;O.appendChild(this._createSelectionElement(P,0,ee))}}this._selectionContainer.appendChild(O)}_createSelectionElement(B,Y,W,H=1){const K=this._document.createElement("div"),X=Y*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(W-Y);return X+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-X),K.style.height=H*this.dimensions.css.cell.height+"px",K.style.top=B*this.dimensions.css.cell.height+"px",K.style.left=`${X}px`,K.style.width=`${P}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const B of this._rowElements)B.replaceChildren()}renderRows(B,Y){const W=this._bufferService.buffer,H=W.ybase+W.y,K=Math.min(W.x,this._bufferService.cols-1),X=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,O=this._optionsService.rawOptions.cursorInactiveStyle;for(let z=B;z<=Y;z++){const V=z+W.ydisp,$=this._rowElements[z],ee=W.lines.get(V);if(!$||!ee)break;$.replaceChildren(...this._rowFactory.createRow(ee,V,V===H,P,O,K,X,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${N}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,Y,W,H,K,X){W<0&&(B=0),H<0&&(Y=0);const P=this._bufferService.rows-1;W=Math.max(Math.min(W,P),0),H=Math.max(Math.min(H,P),0),K=Math.min(K,this._bufferService.cols);const O=this._bufferService.buffer,z=O.ybase+O.y,V=Math.min(O.x,K-1),$=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,Z=this._optionsService.rawOptions.cursorInactiveStyle;for(let re=W;re<=H;++re){const Q=re+O.ydisp,G=this._rowElements[re],te=O.lines.get(Q);if(!G||!te)break;G.replaceChildren(...this._rowFactory.createRow(te,Q,Q===z,ee,Z,V,$,this.dimensions.css.cell.width,this._widthCache,X?re===W?B:0:-1,X?(re===H?Y:K)-1:-1))}}};c.DomRenderer=F=f([p(7,E.IInstantiationService),p(8,v.ICharSizeService),p(9,E.IOptionsService),p(10,E.IBufferService),p(11,v.ICoreBrowserService),p(12,v.IThemeService)],F)},3787:function(u,c,d){var f=this&&this.__decorate||function(T,L,A,M){var D,U=arguments.length,F=U<3?L:M===null?M=Object.getOwnPropertyDescriptor(L,A):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,L,A,M);else for(var B=T.length-1;B>=0;B--)(D=T[B])&&(F=(U<3?D(F):U>3?D(L,A,F):D(L,A))||F);return U>3&&F&&Object.defineProperty(L,A,F),F},p=this&&this.__param||function(T,L){return function(A,M){L(A,M,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=d(2223),x=d(643),_=d(511),w=d(2585),k=d(8055),v=d(4725),S=d(4269),y=d(6171),b=d(3734);let E=c.DomRendererRowFactory=class{constructor(T,L,A,M,D,U,F){this._document=T,this._characterJoinerService=L,this._optionsService=A,this._coreBrowserService=M,this._coreService=D,this._decorationService=U,this._themeService=F,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,L,A){this._selectionStart=T,this._selectionEnd=L,this._columnSelectMode=A}createRow(T,L,A,M,D,U,F,B,Y,W,H){const K=[],X=this._characterJoinerService.getJoinedCharacters(L),P=this._themeService.colors;let O,z=T.getNoBgTrimmedLength();A&&z<U+1&&(z=U+1);let V=0,$="",ee=0,Z=0,re=0,Q=!1,G=0,te=!1,se=0;const _e=[],ye=W!==-1&&H!==-1;for(let Ae=0;Ae<z;Ae++){T.loadCell(Ae,this._workCell);let De=this._workCell.getWidth();if(De===0)continue;let Me=!1,$e=Ae,de=this._workCell;if(X.length>0&&Ae===X[0][0]){Me=!0;const et=X.shift();de=new S.JoinedCellData(this._workCell,T.translateToString(!0,et[0],et[1]),et[1]-et[0]),$e=et[1]-1,De=de.getWidth()}const Ie=this._isCellInSelection(Ae,L),Se=A&&Ae===U,fe=ye&&Ae>=W&&Ae<=H;let je=!1;this._decorationService.forEachDecorationAtCell(Ae,L,void 0,(et=>{je=!0}));let ot=de.getChars()||x.WHITESPACE_CELL_CHAR;if(ot===" "&&(de.isUnderline()||de.isOverline())&&(ot=" "),se=De*B-Y.get(ot,de.isBold(),de.isItalic()),O){if(V&&(Ie&&te||!Ie&&!te&&de.bg===ee)&&(Ie&&te&&P.selectionForeground||de.fg===Z)&&de.extended.ext===re&&fe===Q&&se===G&&!Se&&!Me&&!je){de.isInvisible()?$+=x.WHITESPACE_CELL_CHAR:$+=ot,V++;continue}V&&(O.textContent=$),O=this._document.createElement("span"),V=0,$=""}else O=this._document.createElement("span");if(ee=de.bg,Z=de.fg,re=de.extended.ext,Q=fe,G=se,te=Ie,Me&&U>=Ae&&U<=$e&&(U=Ae),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if(_e.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&_e.push("xterm-cursor-blink"),_e.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":_e.push("xterm-cursor-outline");break;case"block":_e.push("xterm-cursor-block");break;case"bar":_e.push("xterm-cursor-bar");break;case"underline":_e.push("xterm-cursor-underline")}}if(de.isBold()&&_e.push("xterm-bold"),de.isItalic()&&_e.push("xterm-italic"),de.isDim()&&_e.push("xterm-dim"),$=de.isInvisible()?x.WHITESPACE_CELL_CHAR:de.getChars()||x.WHITESPACE_CELL_CHAR,de.isUnderline()&&(_e.push(`xterm-underline-${de.extended.underlineStyle}`),$===" "&&($=" "),!de.isUnderlineColorDefault()))if(de.isUnderlineColorRGB())O.style.textDecorationColor=`rgb(${b.AttributeData.toColorRGB(de.getUnderlineColor()).join(",")})`;else{let et=de.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&de.isBold()&&et<8&&(et+=8),O.style.textDecorationColor=P.ansi[et].css}de.isOverline()&&(_e.push("xterm-overline"),$===" "&&($=" ")),de.isStrikethrough()&&_e.push("xterm-strikethrough"),fe&&(O.style.textDecoration="underline");let Ut=de.getFgColor(),St=de.getFgColorMode(),pn=de.getBgColor(),me=de.getBgColorMode();const Ee=!!de.isInverse();if(Ee){const et=Ut;Ut=pn,pn=et;const Lt=St;St=me,me=Lt}let Oe,Fe,Ke,At=!1;switch(this._decorationService.forEachDecorationAtCell(Ae,L,void 0,(et=>{et.options.layer!=="top"&&At||(et.backgroundColorRGB&&(me=50331648,pn=et.backgroundColorRGB.rgba>>8&16777215,Oe=et.backgroundColorRGB),et.foregroundColorRGB&&(St=50331648,Ut=et.foregroundColorRGB.rgba>>8&16777215,Fe=et.foregroundColorRGB),At=et.options.layer==="top")})),!At&&Ie&&(Oe=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,pn=Oe.rgba>>8&16777215,me=50331648,At=!0,P.selectionForeground&&(St=50331648,Ut=P.selectionForeground.rgba>>8&16777215,Fe=P.selectionForeground)),At&&_e.push("xterm-decoration-top"),me){case 16777216:case 33554432:Ke=P.ansi[pn],_e.push(`xterm-bg-${pn}`);break;case 50331648:Ke=k.channels.toColor(pn>>16,pn>>8&255,255&pn),this._addStyle(O,`background-color:#${N((pn>>>0).toString(16),"0",6)}`);break;default:Ee?(Ke=P.foreground,_e.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Ke=P.background}switch(Oe||de.isDim()&&(Oe=k.color.multiplyOpacity(Ke,.5)),St){case 16777216:case 33554432:de.isBold()&&Ut<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ut+=8),this._applyMinimumContrast(O,Ke,P.ansi[Ut],de,Oe,void 0)||_e.push(`xterm-fg-${Ut}`);break;case 50331648:const et=k.channels.toColor(Ut>>16&255,Ut>>8&255,255&Ut);this._applyMinimumContrast(O,Ke,et,de,Oe,Fe)||this._addStyle(O,`color:#${N(Ut.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(O,Ke,P.foreground,de,Oe,Fe)||Ee&&_e.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}_e.length&&(O.className=_e.join(" "),_e.length=0),Se||Me||je?O.textContent=$:V++,se!==this.defaultSpacing&&(O.style.letterSpacing=`${se}px`),K.push(O),Ae=$e}return O&&V&&(O.textContent=$),K}_applyMinimumContrast(T,L,A,M,D,U){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,y.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const F=this._getContrastCache(M);let B;if(D||U||(B=F.getColor(L.rgba,A.rgba)),B===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);B=k.color.ensureContrastRatio(D||L,U||A,Y),F.setColor((D||L).rgba,(U||A).rgba,B??null)}return!!B&&(this._addStyle(T,`color:${B.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,L){T.setAttribute("style",`${T.getAttribute("style")||""}${L};`)}_isCellInSelection(T,L){const A=this._selectionStart,M=this._selectionEnd;return!(!A||!M)&&(this._columnSelectMode?A[0]<=M[0]?T>=A[0]&&L>=A[1]&&T<M[0]&&L<=M[1]:T<A[0]&&L>=A[1]&&T>=M[0]&&L<=M[1]:L>A[1]&&L<M[1]||A[1]===M[1]&&L===A[1]&&T>=A[0]&&T<M[0]||A[1]<M[1]&&L===M[1]&&T<M[0]||A[1]<M[1]&&L===A[1]&&T>=A[0])}};function N(T,L,A){for(;T.length<A;)T=L+T;return T}c.DomRendererRowFactory=E=f([p(1,v.ICharacterJoinerService),p(2,w.IOptionsService),p(3,v.ICoreBrowserService),p(4,w.ICoreService),p(5,w.IDecorationService),p(6,v.IThemeService)],E)},2550:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(d,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=d.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=d.createElement("span");p.classList.add("xterm-char-measure-element");const m=d.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const x=d.createElement("span");x.classList.add("xterm-char-measure-element"),x.style.fontStyle="italic";const _=d.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[p,m,x,_],this._container.appendChild(p),this._container.appendChild(m),this._container.appendChild(x),this._container.appendChild(_),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(d,f,p,m){d===this._font&&f===this._fontSize&&p===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=f,this._weight=p,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,f,p){let m=0;if(!f&&!p&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const w=this._measure(d,0);return w>0&&(this._flat[m]=w),w}let x=d;f&&(x+="B"),p&&(x+="I");let _=this._holey.get(x);if(_===void 0){let w=0;f&&(w|=1),p&&(w|=2),_=this._measure(d,w),_>0&&this._holey.set(x,_)}return _}_measure(d,f){const p=this._measureElements[f];return p.textContent=d.repeat(32),p.offsetWidth/32}}},2223:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(u,c)=>{function d(p){return 57508<=p&&p<=57558}function f(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},c.isPowerlineGlyph=d,c.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},c.isEmoji=f,c.allowRescaling=function(p,m,x,_){return m===1&&x>Math.ceil(1.5*_)&&p!==void 0&&p>255&&!f(p)&&!d(p)&&!(function(w){return 57344<=w&&w<=63743})(p)},c.treatGlyphAsBackgroundColor=function(p){return d(p)||(function(m){return 9472<=m&&m<=9631})(p)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(p,m,x=0){return(p-(2*Math.round(m)-x))%(2*Math.round(m))}},6052:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class d{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,m,x,_=!1){if(this.selectionStart=m,this.selectionEnd=x,!m||!x||m[0]===x[0]&&m[1]===x[1])return void this.clear();const w=p.buffers.active.ydisp,k=m[1]-w,v=x[1]-w,S=Math.max(k,0),y=Math.min(v,p.rows-1);S>=p.rows||y<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=k,this.viewportEndRow=v,this.viewportCappedStartRow=S,this.viewportCappedEndRow=y,this.startCol=m[0],this.endCol=x[0])}isCellSelected(p,m,x){return!!this.hasSelection&&(x-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&x>=this.viewportCappedStartRow&&m<this.endCol&&x<=this.viewportCappedEndRow:m<this.startCol&&x>=this.viewportCappedStartRow&&m>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportStartRow&&m>=this.startCol)}}c.createSelectionRenderModel=function(){return new d}},456:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(d){this._bufferService=d,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?d%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)-1]:[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[d,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const d=this.selectionStart[0]+this.selectionStartLength;return d>this._bufferService.cols?[d%this._bufferService.cols,this.selectionStart[1]+Math.floor(d/this._bufferService.cols)]:[Math.max(d,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const d=this.selectionStart,f=this.selectionEnd;return!(!d||!f)&&(d[1]>f[1]||d[1]===f[1]&&d[0]>f[0])}handleTrim(d){return this.selectionStart&&(this.selectionStart[1]-=d),this.selectionEnd&&(this.selectionEnd[1]-=d),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(u,c,d){var f=this&&this.__decorate||function(y,b,E,N){var T,L=arguments.length,A=L<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,b,E,N);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(A=(L<3?T(A):L>3?T(b,E,A):T(b,E))||A);return L>3&&A&&Object.defineProperty(b,E,A),A},p=this&&this.__param||function(y,b){return function(E,N){b(E,N,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=d(2585),x=d(8460),_=d(844);let w=c.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(y,b,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new v(y,b,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const y=this._measureStrategy.measure();y.width===this.width&&y.height===this.height||(this.width=y.width,this.height=y.height,this._onCharSizeChange.fire())}};c.CharSizeService=w=f([p(2,m.IOptionsService)],w);class k extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(b,E){b!==void 0&&b>0&&E!==void 0&&E>0&&(this._result.width=b,this._result.height=E)}}class v extends k{constructor(b,E,N){super(),this._document=b,this._parentElement=E,this._optionsService=N,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class S extends k{constructor(b){super(),this._optionsService=b,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const b=this._ctx.measureText("W");return this._validateAndSet(b.width,b.fontBoundingBoxAscent+b.fontBoundingBoxDescent),this._result}}},4269:function(u,c,d){var f=this&&this.__decorate||function(S,y,b,E){var N,T=arguments.length,L=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,b):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,y,b,E);else for(var A=S.length-1;A>=0;A--)(N=S[A])&&(L=(T<3?N(L):T>3?N(y,b,L):N(y,b))||L);return T>3&&L&&Object.defineProperty(y,b,L),L},p=this&&this.__param||function(S,y){return function(b,E){y(b,E,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=d(3734),x=d(643),_=d(511),w=d(2585);class k extends m.AttributeData{constructor(y,b,E){super(),this.content=0,this.combinedData="",this.fg=y.fg,this.bg=y.bg,this.combinedData=b,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(y){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=k;let v=c.CharacterJoinerService=class LS{constructor(y){this._bufferService=y,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(y){const b={id:this._nextCharacterJoinerId++,handler:y};return this._characterJoiners.push(b),b.id}deregister(y){for(let b=0;b<this._characterJoiners.length;b++)if(this._characterJoiners[b].id===y)return this._characterJoiners.splice(b,1),!0;return!1}getJoinedCharacters(y){if(this._characterJoiners.length===0)return[];const b=this._bufferService.buffer.lines.get(y);if(!b||b.length===0)return[];const E=[],N=b.translateToString(!0);let T=0,L=0,A=0,M=b.getFg(0),D=b.getBg(0);for(let U=0;U<b.getTrimmedLength();U++)if(b.loadCell(U,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==M||this._workCell.bg!==D){if(U-T>1){const F=this._getJoinedRanges(N,A,L,b,T);for(let B=0;B<F.length;B++)E.push(F[B])}T=U,A=L,M=this._workCell.fg,D=this._workCell.bg}L+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const U=this._getJoinedRanges(N,A,L,b,T);for(let F=0;F<U.length;F++)E.push(U[F])}return E}_getJoinedRanges(y,b,E,N,T){const L=y.substring(b,E);let A=[];try{A=this._characterJoiners[0].handler(L)}catch(M){console.error(M)}for(let M=1;M<this._characterJoiners.length;M++)try{const D=this._characterJoiners[M].handler(L);for(let U=0;U<D.length;U++)LS._mergeRanges(A,D[U])}catch(D){console.error(D)}return this._stringRangesToCellRanges(A,N,T),A}_stringRangesToCellRanges(y,b,E){let N=0,T=!1,L=0,A=y[N];if(A){for(let M=E;M<this._bufferService.cols;M++){const D=b.getWidth(M),U=b.getString(M).length||x.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!T&&A[0]<=L&&(A[0]=M,T=!0),A[1]<=L){if(A[1]=M,A=y[++N],!A)break;A[0]<=L?(A[0]=M,T=!0):T=!1}L+=U}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(y,b){let E=!1;for(let N=0;N<y.length;N++){const T=y[N];if(E){if(b[1]<=T[0])return y[N-1][1]=b[1],y;if(b[1]<=T[1])return y[N-1][1]=Math.max(b[1],T[1]),y.splice(N,1),y;y.splice(N,1),N--}else{if(b[1]<=T[0])return y.splice(N,0,b),y;if(b[1]<=T[1])return T[0]=Math.min(b[0],T[0]),y;b[0]<T[1]&&(T[0]=Math.min(b[0],T[0]),E=!0)}}return E?y[y.length-1][1]=b[1]:y.push(b),y}};c.CharacterJoinerService=v=f([p(0,w.IBufferService)],v)},5114:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const f=d(844),p=d(8460),m=d(3656);class x extends f.Disposable{constructor(k,v,S){super(),this._textarea=k,this._window=v,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((y=>this._screenDprMonitor.setWindow(y)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(k){this._window!==k&&(this._window=k,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}c.CoreBrowserService=x;class _ extends f.Disposable{constructor(k){super(),this._parentWindow=k,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(k){this._parentWindow=k,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var k;this._outerListener&&((k=this._resolutionMediaMatchList)==null||k.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const f=d(844);class p extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const _=this.linkProviders.indexOf(x);_!==-1&&this.linkProviders.splice(_,1)}}}}c.LinkProviderService=p},8934:function(u,c,d){var f=this&&this.__decorate||function(w,k,v,S){var y,b=arguments.length,E=b<3?k:S===null?S=Object.getOwnPropertyDescriptor(k,v):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(w,k,v,S);else for(var N=w.length-1;N>=0;N--)(y=w[N])&&(E=(b<3?y(E):b>3?y(k,v,E):y(k,v))||E);return b>3&&E&&Object.defineProperty(k,v,E),E},p=this&&this.__param||function(w,k){return function(v,S){k(v,S,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=d(4725),x=d(9806);let _=c.MouseService=class{constructor(w,k){this._renderService=w,this._charSizeService=k}getCoords(w,k,v,S,y){return(0,x.getCoords)(window,w,k,v,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,y)}getMouseReportCoords(w,k){const v=(0,x.getCoordsRelativeToElement)(window,w,k);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};c.MouseService=_=f([p(0,m.IRenderService),p(1,m.ICharSizeService)],_)},3230:function(u,c,d){var f=this&&this.__decorate||function(y,b,E,N){var T,L=arguments.length,A=L<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,b,E,N);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(A=(L<3?T(A):L>3?T(b,E,A):T(b,E))||A);return L>3&&A&&Object.defineProperty(b,E,A),A},p=this&&this.__param||function(y,b){return function(E,N){b(E,N,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=d(6193),x=d(4725),_=d(8460),w=d(844),k=d(7226),v=d(2585);let S=c.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(y,b,E,N,T,L,A,M){super(),this._rowCount=y,this._charSizeService=N,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new k.DebouncedIdleTask,this._observerDisposable=this.register(new w.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((D,U)=>this._renderRows(D,U)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(L.onResize((()=>this._fullRefresh()))),this.register(L.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(L.cols,L.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(L.buffer.y,L.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,b),this.register(A.onWindowChange((D=>this._registerIntersectionObserver(D,b))))}_registerIntersectionObserver(y,b){if("IntersectionObserver"in y){const E=new y.IntersectionObserver((N=>this._handleIntersectionChange(N[N.length-1])),{threshold:0});E.observe(b),this._observerDisposable.value=(0,w.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(y){this._isPaused=y.isIntersecting===void 0?y.intersectionRatio===0:!y.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(y,b,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(y,b,this._rowCount))}_renderRows(y,b){this._renderer.value&&(y=Math.min(y,this._rowCount-1),b=Math.min(b,this._rowCount-1),this._renderer.value.renderRows(y,b),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:y,end:b}),this._onRender.fire({start:y,end:b}),this._isNextRenderRedrawOnly=!0)}resize(y,b){this._rowCount=b,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(y){this._renderer.value=y,this._renderer.value&&(this._renderer.value.onRequestRedraw((b=>this.refreshRows(b.start,b.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(y){return this._renderDebouncer.addRefreshCallback(y)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var y,b;this._renderer.value&&((b=(y=this._renderer.value).clearTextureAtlas)==null||b.call(y),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(y,b){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(y,b)})):this._renderer.value.handleResize(y,b),this._fullRefresh())}handleCharSizeChanged(){var y;(y=this._renderer.value)==null||y.handleCharSizeChanged()}handleBlur(){var y;(y=this._renderer.value)==null||y.handleBlur()}handleFocus(){var y;(y=this._renderer.value)==null||y.handleFocus()}handleSelectionChanged(y,b,E){var N;this._selectionState.start=y,this._selectionState.end=b,this._selectionState.columnSelectMode=E,(N=this._renderer.value)==null||N.handleSelectionChanged(y,b,E)}handleCursorMove(){var y;(y=this._renderer.value)==null||y.handleCursorMove()}clear(){var y;(y=this._renderer.value)==null||y.clear()}};c.RenderService=S=f([p(2,v.IOptionsService),p(3,x.ICharSizeService),p(4,v.IDecorationService),p(5,v.IBufferService),p(6,x.ICoreBrowserService),p(7,x.IThemeService)],S)},9312:function(u,c,d){var f=this&&this.__decorate||function(A,M,D,U){var F,B=arguments.length,Y=B<3?M:U===null?U=Object.getOwnPropertyDescriptor(M,D):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(A,M,D,U);else for(var W=A.length-1;W>=0;W--)(F=A[W])&&(Y=(B<3?F(Y):B>3?F(M,D,Y):F(M,D))||Y);return B>3&&Y&&Object.defineProperty(M,D,Y),Y},p=this&&this.__param||function(A,M){return function(D,U){M(D,U,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=d(9806),x=d(9504),_=d(456),w=d(4725),k=d(8460),v=d(844),S=d(6114),y=d(4841),b=d(511),E=d(2585),N=" ",T=new RegExp(N,"g");let L=c.SelectionService=class extends v.Disposable{constructor(A,M,D,U,F,B,Y,W,H){super(),this._element=A,this._screenElement=M,this._linkifier=D,this._bufferService=U,this._coreService=F,this._mouseService=B,this._optionsService=Y,this._renderService=W,this._coreBrowserService=H,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new b.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new k.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new k.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new k.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new k.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!A||!M||A[0]===M[0]&&A[1]===M[1])}get selectionText(){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!A||!M)return"";const D=this._bufferService.buffer,U=[];if(this._activeSelectionMode===3){if(A[0]===M[0])return"";const F=A[0]<M[0]?A[0]:M[0],B=A[0]<M[0]?M[0]:A[0];for(let Y=A[1];Y<=M[1];Y++){const W=D.translateBufferLineToString(Y,!0,F,B);U.push(W)}}else{const F=A[1]===M[1]?M[0]:void 0;U.push(D.translateBufferLineToString(A[1],!0,A[0],F));for(let B=A[1]+1;B<=M[1]-1;B++){const Y=D.lines.get(B),W=D.translateBufferLineToString(B,!0);Y!=null&&Y.isWrapped?U[U.length-1]+=W:U.push(W)}if(A[1]!==M[1]){const B=D.lines.get(M[1]),Y=D.translateBufferLineToString(M[1],!0,0,M[0]);B&&B.isWrapped?U[U.length-1]+=Y:U.push(Y)}}return U.map((F=>F.replace(T," "))).join(S.isWindows?`\r
|
|
63
|
-
`:`
|
|
64
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&A&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(A){const M=this._getMouseBufferCoords(A),D=this._model.finalSelectionStart,U=this._model.finalSelectionEnd;return!!(D&&U&&M)&&this._areCoordsInSelection(M,D,U)}isCellInSelection(A,M){const D=this._model.finalSelectionStart,U=this._model.finalSelectionEnd;return!(!D||!U)&&this._areCoordsInSelection([A,M],D,U)}_areCoordsInSelection(A,M,D){return A[1]>M[1]&&A[1]<D[1]||M[1]===D[1]&&A[1]===M[1]&&A[0]>=M[0]&&A[0]<D[0]||M[1]<D[1]&&A[1]===D[1]&&A[0]<D[0]||M[1]<D[1]&&A[1]===M[1]&&A[0]>=M[0]}_selectWordAtCursor(A,M){var F,B;const D=(B=(F=this._linkifier.currentLink)==null?void 0:F.link)==null?void 0:B.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,y.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const U=this._getMouseBufferCoords(A);return!!U&&(this._selectWordAt(U,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,M){this._model.clearSelection(),A=Math.max(A,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const M=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(A){let M=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=D?0:(M>D&&(M-=D),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(A){return S.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const M=this._getMouseBufferCoords(A);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(A){return A.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const U=D.lines.get(this._model.selectionEnd[1]);U&&U.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}M&&M[0]===this._model.selectionEnd[0]&&M[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const M=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const U=(0,x.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(U,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,D=!(!A||!M||A[0]===M[0]&&A[1]===M[1]);D?A&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,M,D)):this._oldHasSelection&&this._fireOnSelectionChange(A,M,D)}_fireOnSelectionChange(A,M,D){this._oldSelectionStart=A,this._oldSelectionEnd=M,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(A,M){let D=M;for(let U=0;M>=U;U++){const F=A.loadCell(U,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:F>1&&M!==U&&(D+=F-1)}return D}setSelection(A,M,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,M],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,M,D=!0,U=!0){if(A[0]>=this._bufferService.cols)return;const F=this._bufferService.buffer,B=F.lines.get(A[1]);if(!B)return;const Y=F.translateBufferLineToString(A[1],!1);let W=this._convertViewportColToCharacterIndex(B,A[0]),H=W;const K=A[0]-W;let X=0,P=0,O=0,z=0;if(Y.charAt(W)===" "){for(;W>0&&Y.charAt(W-1)===" ";)W--;for(;H<Y.length&&Y.charAt(H+1)===" ";)H++}else{let ee=A[0],Z=A[0];B.getWidth(ee)===0&&(X++,ee--),B.getWidth(Z)===2&&(P++,Z++);const re=B.getString(Z).length;for(re>1&&(z+=re-1,H+=re-1);ee>0&&W>0&&!this._isCharWordSeparator(B.loadCell(ee-1,this._workCell));){B.loadCell(ee-1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===0?(X++,ee--):Q>1&&(O+=Q-1,W-=Q-1),W--,ee--}for(;Z<B.length&&H+1<Y.length&&!this._isCharWordSeparator(B.loadCell(Z+1,this._workCell));){B.loadCell(Z+1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,Z++):Q>1&&(z+=Q-1,H+=Q-1),H++,Z++}}H++;let V=W+K-X+O,$=Math.min(this._bufferService.cols,H-W+X+P-O-z);if(M||Y.slice(W,H).trim()!==""){if(D&&V===0&&B.getCodePoint(0)!==32){const ee=F.lines.get(A[1]-1);if(ee&&B.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const Z=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Z){const re=this._bufferService.cols-Z.start;V-=re,$+=re}}}if(U&&V+$===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const ee=F.lines.get(A[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const Z=this._getWordAt([0,A[1]+1],!1,!1,!0);Z&&($+=Z.length)}}return{start:V,length:$}}}_selectWordAt(A,M){const D=this._getWordAt(A,M);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[D.start,A[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(A){const M=this._getWordAt(A,!0);if(M){let D=A[1];for(;M.start<0;)M.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,D]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const M=this._bufferService.buffer.getWrappedRangeForLine(A),D={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,y.getRangeLength)(D,this._bufferService.cols)}};c.SelectionService=L=f([p(3,E.IBufferService),p(4,E.ICoreService),p(5,w.IMouseService),p(6,E.IOptionsService),p(7,w.IRenderService),p(8,w.ICoreBrowserService)],L)},4725:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const f=d(8343);c.ICharSizeService=(0,f.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),c.IMouseService=(0,f.createDecorator)("MouseService"),c.IRenderService=(0,f.createDecorator)("RenderService"),c.ISelectionService=(0,f.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,f.createDecorator)("ThemeService"),c.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(u,c,d){var f=this&&this.__decorate||function(L,A,M,D){var U,F=arguments.length,B=F<3?A:D===null?D=Object.getOwnPropertyDescriptor(A,M):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(L,A,M,D);else for(var Y=L.length-1;Y>=0;Y--)(U=L[Y])&&(B=(F<3?U(B):F>3?U(A,M,B):U(A,M))||B);return F>3&&B&&Object.defineProperty(A,M,B),B},p=this&&this.__param||function(L,A){return function(M,D){A(M,D,L)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),x=d(8055),_=d(8460),w=d(844),k=d(2585),v=x.css.toColor("#ffffff"),S=x.css.toColor("#000000"),y=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const L=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let M=0;M<216;M++){const D=A[M/36%6|0],U=A[M/6%6|0],F=A[M%6];L.push({css:x.channels.toCss(D,U,F),rgba:x.channels.toRgba(D,U,F)})}for(let M=0;M<24;M++){const D=8+10*M;L.push({css:x.channels.toCss(D,D,D),rgba:x.channels.toRgba(D,D,D)})}return L})());let N=c.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(L){super(),this._optionsService=L,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:S,cursor:y,cursorAccent:b,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:x.color.blend(S,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:x.color.blend(S,E),ansi:c.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(L={}){const A=this._colors;if(A.foreground=T(L.foreground,v),A.background=T(L.background,S),A.cursor=T(L.cursor,y),A.cursorAccent=T(L.cursorAccent,b),A.selectionBackgroundTransparent=T(L.selectionBackground,E),A.selectionBackgroundOpaque=x.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=T(L.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=x.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=L.selectionForeground?T(L.selectionForeground,x.NULL_COLOR):void 0,A.selectionForeground===x.NULL_COLOR&&(A.selectionForeground=void 0),x.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=x.color.opacity(A.selectionBackgroundTransparent,.3)),x.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=x.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=T(L.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=T(L.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=T(L.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=T(L.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=T(L.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=T(L.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=T(L.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=T(L.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=T(L.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=T(L.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=T(L.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=T(L.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=T(L.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=T(L.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=T(L.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=T(L.brightWhite,c.DEFAULT_ANSI_COLORS[15]),L.extendedAnsi){const M=Math.min(A.ansi.length-16,L.extendedAnsi.length);for(let D=0;D<M;D++)A.ansi[D+16]=T(L.extendedAnsi[D],c.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(L){this._restoreColor(L),this._onChangeColors.fire(this.colors)}_restoreColor(L){if(L!==void 0)switch(L){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[L]=this._restoreColors.ansi[L]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(L){L(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function T(L,A){if(L!==void 0)try{return x.css.toColor(L)}catch{}return A}c.ThemeService=N=f([p(0,k.IOptionsService)],N)},6349:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const f=d(8460),p=d(844);class m extends p.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(_){if(this._maxLength===_)return;const w=new Array(_);for(let k=0;k<Math.min(_,this.length);k++)w[k]=this._array[this._getCyclicIndex(k)];this._array=w,this._maxLength=_,this._startIndex=0}get length(){return this._length}set length(_){if(_>this._length)for(let w=this._length;w<_;w++)this._array[w]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,w){this._array[this._getCyclicIndex(_)]=w}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,w,...k){if(w){for(let v=_;v<this._length-w;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+w)];this._length-=w,this.onDeleteEmitter.fire({index:_,amount:w})}for(let v=this._length-1;v>=_;v--)this._array[this._getCyclicIndex(v+k.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<k.length;v++)this._array[this._getCyclicIndex(_+v)]=k[v];if(k.length&&this.onInsertEmitter.fire({index:_,amount:k.length}),this._length+k.length>this._maxLength){const v=this._length+k.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=k.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,w,k){if(!(w<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+k<0)throw new Error("Cannot shift elements in list beyond index 0");if(k>0){for(let S=w-1;S>=0;S--)this.set(_+S+k,this.get(_+S));const v=_+w+k-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v<w;v++)this.set(_+v+k,this.get(_+v))}}_getCyclicIndex(_){return(this._startIndex+_)%this._maxLength}}c.CircularList=m},1439:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function d(f,p=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const x in f)m[x]=p<=1?f[x]:f[x]&&d(f[x],p-1);return m}},8055:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let d=0,f=0,p=0,m=0;var x,_,w,k,v;function S(b){const E=b.toString(16);return E.length<2?"0"+E:E}function y(b,E){return b<E?(E+.05)/(b+.05):(b+.05)/(E+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(b){b.toCss=function(E,N,T,L){return L!==void 0?`#${S(E)}${S(N)}${S(T)}${S(L)}`:`#${S(E)}${S(N)}${S(T)}`},b.toRgba=function(E,N,T,L=255){return(E<<24|N<<16|T<<8|L)>>>0},b.toColor=function(E,N,T,L){return{css:b.toCss(E,N,T,L),rgba:b.toRgba(E,N,T,L)}}})(x||(c.channels=x={})),(function(b){function E(N,T){return m=Math.round(255*T),[d,f,p]=v.toChannels(N.rgba),{css:x.toCss(d,f,p,m),rgba:x.toRgba(d,f,p,m)}}b.blend=function(N,T){if(m=(255&T.rgba)/255,m===1)return{css:T.css,rgba:T.rgba};const L=T.rgba>>24&255,A=T.rgba>>16&255,M=T.rgba>>8&255,D=N.rgba>>24&255,U=N.rgba>>16&255,F=N.rgba>>8&255;return d=D+Math.round((L-D)*m),f=U+Math.round((A-U)*m),p=F+Math.round((M-F)*m),{css:x.toCss(d,f,p),rgba:x.toRgba(d,f,p)}},b.isOpaque=function(N){return(255&N.rgba)==255},b.ensureContrastRatio=function(N,T,L){const A=v.ensureContrastRatio(N.rgba,T.rgba,L);if(A)return x.toColor(A>>24&255,A>>16&255,A>>8&255)},b.opaque=function(N){const T=(255|N.rgba)>>>0;return[d,f,p]=v.toChannels(T),{css:x.toCss(d,f,p),rgba:T}},b.opacity=E,b.multiplyOpacity=function(N,T){return m=255&N.rgba,E(N,m*T/255)},b.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}})(_||(c.color=_={})),(function(b){let E,N;try{const T=document.createElement("canvas");T.width=1,T.height=1;const L=T.getContext("2d",{willReadFrequently:!0});L&&(E=L,E.globalCompositeOperation="copy",N=E.createLinearGradient(0,0,1,1))}catch{}b.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return d=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),x.toColor(d,f,p);case 5:return d=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),p=parseInt(T.slice(3,4).repeat(2),16),m=parseInt(T.slice(4,5).repeat(2),16),x.toColor(d,f,p,m);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const L=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(L)return d=parseInt(L[1]),f=parseInt(L[2]),p=parseInt(L[3]),m=Math.round(255*(L[5]===void 0?1:parseFloat(L[5]))),x.toColor(d,f,p,m);if(!E||!N)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=N,E.fillStyle=T,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[d,f,p,m]=E.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(d,f,p,m),css:T}}})(w||(c.css=w={})),(function(b){function E(N,T,L){const A=N/255,M=T/255,D=L/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}b.relativeLuminance=function(N){return E(N>>16&255,N>>8&255,255&N)},b.relativeLuminance2=E})(k||(c.rgb=k={})),(function(b){function E(T,L,A){const M=T>>24&255,D=T>>16&255,U=T>>8&255;let F=L>>24&255,B=L>>16&255,Y=L>>8&255,W=y(k.relativeLuminance2(F,B,Y),k.relativeLuminance2(M,D,U));for(;W<A&&(F>0||B>0||Y>0);)F-=Math.max(0,Math.ceil(.1*F)),B-=Math.max(0,Math.ceil(.1*B)),Y-=Math.max(0,Math.ceil(.1*Y)),W=y(k.relativeLuminance2(F,B,Y),k.relativeLuminance2(M,D,U));return(F<<24|B<<16|Y<<8|255)>>>0}function N(T,L,A){const M=T>>24&255,D=T>>16&255,U=T>>8&255;let F=L>>24&255,B=L>>16&255,Y=L>>8&255,W=y(k.relativeLuminance2(F,B,Y),k.relativeLuminance2(M,D,U));for(;W<A&&(F<255||B<255||Y<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),B=Math.min(255,B+Math.ceil(.1*(255-B))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),W=y(k.relativeLuminance2(F,B,Y),k.relativeLuminance2(M,D,U));return(F<<24|B<<16|Y<<8|255)>>>0}b.blend=function(T,L){if(m=(255&L)/255,m===1)return L;const A=L>>24&255,M=L>>16&255,D=L>>8&255,U=T>>24&255,F=T>>16&255,B=T>>8&255;return d=U+Math.round((A-U)*m),f=F+Math.round((M-F)*m),p=B+Math.round((D-B)*m),x.toRgba(d,f,p)},b.ensureContrastRatio=function(T,L,A){const M=k.relativeLuminance(T>>8),D=k.relativeLuminance(L>>8);if(y(M,D)<A){if(D<M){const B=E(T,L,A),Y=y(M,k.relativeLuminance(B>>8));if(Y<A){const W=N(T,L,A);return Y>y(M,k.relativeLuminance(W>>8))?B:W}return B}const U=N(T,L,A),F=y(M,k.relativeLuminance(U>>8));if(F<A){const B=E(T,L,A);return F>y(M,k.relativeLuminance(B>>8))?U:B}return U}},b.reduceLuminance=E,b.increaseLuminance=N,b.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(v||(c.rgba=v={})),c.toPaddedHex=S,c.contrastRatio=y},8969:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const f=d(844),p=d(2585),m=d(4348),x=d(7866),_=d(744),w=d(7302),k=d(6975),v=d(8460),S=d(1753),y=d(1480),b=d(7994),E=d(9282),N=d(5435),T=d(5981),L=d(2660);let A=!1;class M extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((U=>{var F;(F=this._onScrollApi)==null||F.fire(U.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(U){for(const F in U)this.optionsService.options[F]=U[F]}constructor(U){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new w.OptionsService(U)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(k.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(y.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(L.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new N.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new T.WriteBuffer(((F,B)=>this._inputHandler.parse(F,B)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(U,F){this._writeBuffer.write(U,F)}writeSync(U,F){this._logService.logLevel<=p.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(U,F)}input(U,F=!0){this.coreService.triggerDataEvent(U,F)}resize(U,F){isNaN(U)||isNaN(F)||(U=Math.max(U,_.MINIMUM_COLS),F=Math.max(F,_.MINIMUM_ROWS),this._bufferService.resize(U,F))}scroll(U,F=!1){this._bufferService.scroll(U,F)}scrollLines(U,F,B){this._bufferService.scrollLines(U,F,B)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){const F=U-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(U,F){return this._inputHandler.registerEscHandler(U,F)}registerDcsHandler(U,F){return this._inputHandler.registerDcsHandler(U,F)}registerCsiHandler(U,F){return this._inputHandler.registerCsiHandler(U,F)}registerOscHandler(U,F){return this._inputHandler.registerOscHandler(U,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let U=!1;const F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?U=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(U=!0),U?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const U=[];U.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),U.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const F of U)F.dispose()}))}}}c.CoreTerminal=M},8460:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=d=>(this._listeners.push(d),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===d)return void this._listeners.splice(f,1)}}})),this._event}fire(d,f){const p=[];for(let m=0;m<this._listeners.length;m++)p.push(this._listeners[m]);for(let m=0;m<p.length;m++)p[m].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(d,f){return d((p=>f.fire(p)))},c.runAndSubscribe=function(d,f){return f(void 0),d((p=>f(p)))}},5435:function(u,c,d){var f=this&&this.__decorate||function(X,P,O,z){var V,$=arguments.length,ee=$<3?P:z===null?z=Object.getOwnPropertyDescriptor(P,O):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(X,P,O,z);else for(var Z=X.length-1;Z>=0;Z--)(V=X[Z])&&(ee=($<3?V(ee):$>3?V(P,O,ee):V(P,O))||ee);return $>3&&ee&&Object.defineProperty(P,O,ee),ee},p=this&&this.__param||function(X,P){return function(O,z){P(O,z,X)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=d(2584),x=d(7116),_=d(2015),w=d(844),k=d(482),v=d(8437),S=d(8460),y=d(643),b=d(511),E=d(3734),N=d(2585),T=d(1480),L=d(6242),A=d(6351),M=d(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},U=131072;function F(X,P){if(X>24)return P.setWinLines||!1;switch(X){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var B;(function(X){X[X.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",X[X.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(c.WindowsOptionsReportType=B={}));let Y=0;class W extends w.Disposable{getAttrData(){return this._curAttrData}constructor(P,O,z,V,$,ee,Z,re,Q=new _.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=O,this._coreService=z,this._logService=V,this._optionsService=$,this._oscLinkService=ee,this._coreMouseService=Z,this._unicodeService=re,this._parser=Q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new k.StringToUtf32,this._utf8Decoder=new k.Utf8ToUtf32,this._workCell=new b.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new H(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,te)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:te.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,te,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:te,data:se})})),this._parser.setDcsHandlerFallback(((G,te,se)=>{te==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:te,payload:se})})),this._parser.setPrintHandler(((G,te,se)=>this.print(G,te,se))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new L.OscHandler((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new L.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new L.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new L.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new L.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new L.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new L.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new L.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new L.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new L.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new L.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new L.OscHandler((G=>this.restoreCursorColor(G)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const G in x.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((G,te)=>this.requestStatusString(G,te))))}_preserveStack(P,O,z,V){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=O,this._parseStack.decodedLength=z,this._parseStack.position=V}_logSlowResolvingAsync(P){this._logService.logLevel<=N.LogLevelEnum.WARN&&Promise.race([P,new Promise(((O,z)=>setTimeout((()=>z("#SLOW_TIMEOUT")),5e3)))]).catch((O=>{if(O!=="#SLOW_TIMEOUT")throw O;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(P,O){let z,V=this._activeBuffer.x,$=this._activeBuffer.y,ee=0;const Z=this._parseStack.paused;if(Z){if(z=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,O))return this._logSlowResolvingAsync(z),z;V=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>U&&(ee=this._parseStack.position+U)}if(this._logService.logLevel<=N.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(G=>String.fromCharCode(G))).join("")}"`),typeof P=="string"?P.split("").map((G=>G.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<U&&(this._parseBuffer=new Uint32Array(Math.min(P.length,U))),Z||this._dirtyRowTracker.clearRange(),P.length>U)for(let G=ee;G<P.length;G+=U){const te=G+U<P.length?G+U:P.length,se=typeof P=="string"?this._stringDecoder.decode(P.substring(G,te),this._parseBuffer):this._utf8Decoder.decode(P.subarray(G,te),this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,se))return this._preserveStack(V,$,se,G),this._logSlowResolvingAsync(z),z}else if(!Z){const G=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if(z=this._parser.parse(this._parseBuffer,G))return this._preserveStack(V,$,G,0),this._logSlowResolvingAsync(z),z}this._activeBuffer.x===V&&this._activeBuffer.y===$||this._onCursorMove.fire();const re=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Q<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Q,this._bufferService.rows-1),Math.min(re,this._bufferService.rows-1))}print(P,O,z){let V,$;const ee=this._charsetService.charset,Z=this._optionsService.rawOptions.screenReaderMode,re=this._bufferService.cols,Q=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,te=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&z-O>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,te);let _e=this._parser.precedingJoinState;for(let ye=O;ye<z;++ye){if(V=P[ye],V<127&&ee){const $e=ee[String.fromCharCode(V)];$e&&(V=$e.charCodeAt(0))}const Ae=this._unicodeService.charProperties(V,_e);$=T.UnicodeService.extractWidth(Ae);const De=T.UnicodeService.extractShouldJoin(Ae),Me=De?T.UnicodeService.extractWidth(_e):0;if(_e=Ae,Z&&this._onA11yChar.fire((0,k.stringFromCodePoint)(V)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-Me>re){if(Q){const $e=se;let de=this._activeBuffer.x-Me;for(this._activeBuffer.x=Me,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Me>0&&se instanceof v.BufferLine&&se.copyCellsFrom($e,de,0,Me,!1);de<re;)$e.setCellFromCodepoint(de++,0,1,te)}else if(this._activeBuffer.x=re-1,$===2)continue}if(De&&this._activeBuffer.x){const $e=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-$e,V,$);for(let de=$-Me;--de>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}else if(G&&(se.insertCells(this._activeBuffer.x,$-Me,this._activeBuffer.getNullCell(te)),se.getWidth(re-1)===2&&se.setCellFromCodepoint(re-1,y.NULL_CELL_CODE,y.NULL_CELL_WIDTH,te)),se.setCellFromCodepoint(this._activeBuffer.x++,V,$,te),$>0)for(;--$;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}this._parser.precedingJoinState=_e,this._activeBuffer.x<re&&z-O>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,te),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(P,O){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,O):this._parser.registerCsiHandler(P,(z=>!F(z.params[0],this._optionsService.rawOptions.windowOptions)||O(z)))}registerDcsHandler(P,O){return this._parser.registerDcsHandler(P,new A.DcsHandler(O))}registerEscHandler(P,O){return this._parser.registerEscHandler(P,O)}registerOscHandler(P,O){return this._parser.registerOscHandler(P,new L.OscHandler(O))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var P;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);O.hasWidth(this._activeBuffer.x)&&!O.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(P,O){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+O):(this._activeBuffer.x=P,this._activeBuffer.y=O),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,O){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+O)}cursorUp(P){const O=this._activeBuffer.y-this._activeBuffer.scrollTop;return O>=0?this._moveCursor(0,-Math.min(O,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const O=this._activeBuffer.scrollBottom-this._activeBuffer.y;return O>=0?this._moveCursor(0,Math.min(O,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const O=P.params[0];return O===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:O===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let O=P.params[0]||1;for(;O--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let O=P.params[0]||1;for(;O--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const O=P.params[0];return O===1&&(this._curAttrData.bg|=536870912),O!==2&&O!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,O,z,V=!1,$=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);ee.replaceCells(O,z,this._activeBuffer.getNullCell(this._eraseAttrData()),$),V&&(ee.isWrapped=!1)}_resetBufferLine(P,O=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);z&&(z.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),O),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),z.isWrapped=!1)}eraseInDisplay(P,O=!1){let z;switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,O);z<this._bufferService.rows;z++)this._resetBufferLine(z,O);this._dirtyRowTracker.markDirty(z);break;case 1:for(z=this._activeBuffer.y,this._dirtyRowTracker.markDirty(z),this._eraseInBufferLine(z,0,this._activeBuffer.x+1,!0,O),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(z+1).isWrapped=!1);z--;)this._resetBufferLine(z,O);this._dirtyRowTracker.markDirty(0);break;case 2:for(z=this._bufferService.rows,this._dirtyRowTracker.markDirty(z-1);z--;)this._resetBufferLine(z,O);this._dirtyRowTracker.markDirty(0);break;case 3:const V=this._activeBuffer.lines.length-this._bufferService.rows;V>0&&(this._activeBuffer.lines.trimStart(V),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-V,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-V,0),this._onScroll.fire(0))}return!0}eraseInLine(P,O=!1){switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,O);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,O);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,O)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(P){this._restrictCursor();let O=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=this._activeBuffer.ybase+this._activeBuffer.y,V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-V+1;for(;O--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(P){this._restrictCursor();let O=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=this._activeBuffer.ybase+this._activeBuffer.y;let V;for(V=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-V;O--;)this._activeBuffer.lines.splice(z,1),this._activeBuffer.lines.splice(V,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let O=P.params[0]||1;for(;O--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(P){let O=P.params[0]||1;for(;O--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(v.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=P.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.deleteCells(0,O,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=P.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.insertCells(0,O,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=P.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.insertCells(this._activeBuffer.x,O,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const O=P.params[0]||1;for(let z=this._activeBuffer.scrollTop;z<=this._activeBuffer.scrollBottom;++z){const V=this._activeBuffer.lines.get(this._activeBuffer.ybase+z);V.deleteCells(this._activeBuffer.x,O,this._activeBuffer.getNullCell(this._eraseAttrData())),V.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return O&&(O.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const O=this._parser.precedingJoinState;if(!O)return!0;const z=P.params[0]||1,V=T.UnicodeService.extractWidth(O),$=this._activeBuffer.x-V,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),Z=new Uint32Array(ee.length*z);let re=0;for(let G=0;G<ee.length;){const te=ee.codePointAt(G)||0;Z[re++]=te,G+=te>65535?2:1}let Q=re;for(let G=1;G<z;++G)Z.copyWithin(Q,0,re),Q+=re;return this.print(Z,0,Q),!0}sendDeviceAttributesPrimary(P){return P.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(P){return P.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let O=0;O<P.length;O++)switch(P.params[O]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let O=0;O<P.length;O++)switch(P.params[O]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(P){for(let O=0;O<P.length;O++)switch(P.params[O]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let O=0;O<P.length;O++)switch(P.params[O]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),P.params[O]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(P,O){const z=this._coreService.decPrivateModes,{activeProtocol:V,activeEncoding:$}=this._coreMouseService,ee=this._coreService,{buffers:Z,cols:re}=this._bufferService,{active:Q,alt:G}=Z,te=this._optionsService.rawOptions,se=De=>De?1:2,_e=P.params[0];return ye=_e,Ae=O?_e===2?4:_e===4?se(ee.modes.insertMode):_e===12?3:_e===20?se(te.convertEol):0:_e===1?se(z.applicationCursorKeys):_e===3?te.windowOptions.setWinLines?re===80?2:re===132?1:0:0:_e===6?se(z.origin):_e===7?se(z.wraparound):_e===8?3:_e===9?se(V==="X10"):_e===12?se(te.cursorBlink):_e===25?se(!ee.isCursorHidden):_e===45?se(z.reverseWraparound):_e===66?se(z.applicationKeypad):_e===67?4:_e===1e3?se(V==="VT200"):_e===1002?se(V==="DRAG"):_e===1003?se(V==="ANY"):_e===1004?se(z.sendFocus):_e===1005?4:_e===1006?se($==="SGR"):_e===1015?4:_e===1016?se($==="SGR_PIXELS"):_e===1048?1:_e===47||_e===1047||_e===1049?se(Q===G):_e===2004?se(z.bracketedPasteMode):0,ee.triggerDataEvent(`${m.C0.ESC}[${O?"":"?"}${ye};${Ae}$y`),!0;var ye,Ae}_updateAttrColor(P,O,z,V,$){return O===2?(P|=50331648,P&=-16777216,P|=E.AttributeData.fromColorRGB([z,V,$])):O===5&&(P&=-50331904,P|=33554432|255&z),P}_extractColor(P,O,z){const V=[0,0,-1,0,0,0];let $=0,ee=0;do{if(V[ee+$]=P.params[O+ee],P.hasSubParams(O+ee)){const Z=P.getSubParams(O+ee);let re=0;do V[1]===5&&($=1),V[ee+re+1+$]=Z[re];while(++re<Z.length&&re+ee+1+$<V.length);break}if(V[1]===5&&ee+$>=2||V[1]===2&&ee+$>=5)break;V[1]&&($=1)}while(++ee+O<P.length&&ee+$<V.length);for(let Z=2;Z<V.length;++Z)V[Z]===-1&&(V[Z]=0);switch(V[0]){case 38:z.fg=this._updateAttrColor(z.fg,V[1],V[3],V[4],V[5]);break;case 48:z.bg=this._updateAttrColor(z.bg,V[1],V[3],V[4],V[5]);break;case 58:z.extended=z.extended.clone(),z.extended.underlineColor=this._updateAttrColor(z.extended.underlineColor,V[1],V[3],V[4],V[5])}return ee}_processUnderline(P,O){O.extended=O.extended.clone(),(!~P||P>5)&&(P=1),O.extended.underlineStyle=P,O.fg|=268435456,P===0&&(O.fg&=-268435457),O.updateExtended()}_processSGR0(P){P.fg=v.DEFAULT_ATTR_DATA.fg,P.bg=v.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const O=P.length;let z;const V=this._curAttrData;for(let $=0;$<O;$++)z=P.params[$],z>=30&&z<=37?(V.fg&=-50331904,V.fg|=16777216|z-30):z>=40&&z<=47?(V.bg&=-50331904,V.bg|=16777216|z-40):z>=90&&z<=97?(V.fg&=-50331904,V.fg|=16777224|z-90):z>=100&&z<=107?(V.bg&=-50331904,V.bg|=16777224|z-100):z===0?this._processSGR0(V):z===1?V.fg|=134217728:z===3?V.bg|=67108864:z===4?(V.fg|=268435456,this._processUnderline(P.hasSubParams($)?P.getSubParams($)[0]:1,V)):z===5?V.fg|=536870912:z===7?V.fg|=67108864:z===8?V.fg|=1073741824:z===9?V.fg|=2147483648:z===2?V.bg|=134217728:z===21?this._processUnderline(2,V):z===22?(V.fg&=-134217729,V.bg&=-134217729):z===23?V.bg&=-67108865:z===24?(V.fg&=-268435457,this._processUnderline(0,V)):z===25?V.fg&=-536870913:z===27?V.fg&=-67108865:z===28?V.fg&=-1073741825:z===29?V.fg&=2147483647:z===39?(V.fg&=-67108864,V.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):z===49?(V.bg&=-67108864,V.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):z===38||z===48||z===58?$+=this._extractColor(P,$,V):z===53?V.bg|=1073741824:z===55?V.bg&=-1073741825:z===59?(V.extended=V.extended.clone(),V.extended.underlineColor=-1,V.updateExtended()):z===100?(V.fg&=-67108864,V.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,V.bg&=-67108864,V.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",z);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const O=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${O};${z}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const O=this._activeBuffer.y+1,z=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${O};${z}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(P){const O=P.params[0]||1;switch(O){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const z=O%2==1;return this._optionsService.options.cursorBlink=z,!0}setScrollRegion(P){const O=P.params[0]||1;let z;return(P.length<2||(z=P.params[1])>this._bufferService.rows||z===0)&&(z=this._bufferService.rows),z>O&&(this._activeBuffer.scrollTop=O-1,this._activeBuffer.scrollBottom=z-1,this._setCursor(0,0)),!0}windowOptions(P){if(!F(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const O=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:O!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:O!==0&&O!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),O!==0&&O!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:O!==0&&O!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),O!==0&&O!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(P){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(P){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const O=[],z=P.split(";");for(;z.length>1;){const V=z.shift(),$=z.shift();if(/^\d+$/.exec(V)){const ee=parseInt(V);if(K(ee))if($==="?")O.push({type:0,index:ee});else{const Z=(0,M.parseColor)($);Z&&O.push({type:1,index:ee,color:Z})}}}return O.length&&this._onColor.fire(O),!0}setHyperlink(P){const O=P.split(";");return!(O.length<2)&&(O[1]?this._createHyperlink(O[0],O[1]):!O[0]&&this._finishHyperlink())}_createHyperlink(P,O){this._getCurrentLinkId()&&this._finishHyperlink();const z=P.split(":");let V;const $=z.findIndex((ee=>ee.startsWith("id=")));return $!==-1&&(V=z[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:V,uri:O}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,O){const z=P.split(";");for(let V=0;V<z.length&&!(O>=this._specialColors.length);++V,++O)if(z[V]==="?")this._onColor.fire([{type:0,index:this._specialColors[O]}]);else{const $=(0,M.parseColor)(z[V]);$&&this._onColor.fire([{type:1,index:this._specialColors[O],color:$}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const O=[],z=P.split(";");for(let V=0;V<z.length;++V)if(/^\d+$/.exec(z[V])){const $=parseInt(z[V]);K($)&&O.push({type:2,index:$})}return O.length&&this._onColor.fire(O),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),!0}selectCharset(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(D[P[0]],x.CHARSETS[P[1]]||x.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new b.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let O=0;O<this._bufferService.rows;++O){const z=this._activeBuffer.ybase+this._activeBuffer.y+O,V=this._activeBuffer.lines.get(z);V&&(V.fill(P),V.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,O){const z=this._bufferService.buffer,V=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${$}${m.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${z.scrollTop+1};${z.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[V.cursorStyle]-(V.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,O){this._dirtyRowTracker.markRangeDirty(P,O)}}c.InputHandler=W;let H=class{constructor(X){this._bufferService=X,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(X){X<this.start?this.start=X:X>this.end&&(this.end=X)}markRangeDirty(X,P){X>P&&(Y=X,X=P,P=Y),X<this.start&&(this.start=X),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(X){return 0<=X&&X<256}H=f([p(0,N.IBufferService)],H)},844:(u,c)=>{function d(f){for(const p of f)p.dispose();f.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const p=this._disposables.indexOf(f);p!==-1&&this._disposables.splice(p,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var p;this._isDisposed||f===this._value||((p=this._value)==null||p.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},c.toDisposable=function(f){return{dispose:f}},c.disposeArray=d,c.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(p,m,x){this._data[p]||(this._data[p]={}),this._data[p][m]=x}get(p,m){return this._data[p]?this._data[p][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=d,c.FourKeyMap=class{constructor(){this._data=new d}set(f,p,m,x,_){this._data.get(f,p)||this._data.set(f,p,new d),this._data.get(f,p).set(m,x,_)}get(f,p,m,x){var _;return(_=this._data.get(f,p))==null?void 0:_.get(m,x)}clear(){this._data.clear()}}},6114:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const d=c.isNode?"node":navigator.userAgent,f=c.isNode?"node":navigator.platform;c.isFirefox=d.includes("Firefox"),c.isLegacyEdge=d.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(d),c.getSafariVersion=function(){if(!c.isSafari)return 0;const p=d.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),c.isIpad=f==="iPad",c.isIphone=f==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),c.isLinux=f.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(d)},6106:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let d=0;c.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(d=this._search(this._getKey(f)),this._array.splice(d,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const p=this._getKey(f);if(p===void 0||(d=this._search(p),d===-1)||this._getKey(this._array[d])!==p)return!1;do if(this._array[d]===f)return this._array.splice(d,1),!0;while(++d<this._array.length&&this._getKey(this._array[d])===p);return!1}*getKeyIterator(f){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do yield this._array[d];while(++d<this._array.length&&this._getKey(this._array[d])===f)}forEachByKey(f,p){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do p(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let p=0,m=this._array.length-1;for(;m>=p;){let x=p+m>>1;const _=this._getKey(this._array[x]);if(_>f)m=x-1;else{if(!(_<f)){for(;x>0&&this._getKey(this._array[x-1])===f;)x--;return x}p=x+1}}return p}}},7226:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const f=d(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(_){this._idleCallback=void 0;let w=0,k=0,v=_.timeRemaining(),S=0;for(;this._i<this._tasks.length;){if(w=Date.now(),this._tasks[this._i]()||this._i++,w=Math.max(1,Date.now()-w),k=Math.max(w,k),S=_.timeRemaining(),1.5*k>S)return v-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-w))}ms`),void this._start();v=S}this.clear()}}class m extends p{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const w=Date.now()+_;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}c.PriorityTaskQueue=m,c.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}flush(){this._queue.flush()}}},9282:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const f=d(643);c.updateWindowsModeWrappedState=function(p){const m=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),x=m==null?void 0:m.get(p.cols-1),_=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);_&&x&&(_.isWrapped=x[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&x[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new d;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=d;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,x=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=x}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=f},9092:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const f=d(6349),p=d(7226),m=d(3734),x=d(8437),_=d(4634),w=d(511),k=d(643),v=d(4863),S=d(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(y,b,E){this._hasScrollback=y,this._optionsService=b,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=x.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,k.NULL_CELL_CHAR,k.NULL_CELL_WIDTH,k.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,k.WHITESPACE_CELL_CHAR,k.WHITESPACE_CELL_WIDTH,k.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(y){return y?(this._nullCell.fg=y.fg,this._nullCell.bg=y.bg,this._nullCell.extended=y.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(y){return y?(this._whitespaceCell.fg=y.fg,this._whitespaceCell.bg=y.bg,this._whitespaceCell.extended=y.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(y,b){return new x.BufferLine(this._bufferService.cols,this.getNullCell(y),b)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const y=this.ybase+this.y-this.ydisp;return y>=0&&y<this._rows}_getCorrectBufferLength(y){if(!this._hasScrollback)return y;const b=y+this._optionsService.rawOptions.scrollback;return b>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:b}fillViewportRows(y){if(this.lines.length===0){y===void 0&&(y=x.DEFAULT_ATTR_DATA);let b=this._rows;for(;b--;)this.lines.push(this.getBlankLine(y))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(y,b){const E=this.getNullCell(x.DEFAULT_ATTR_DATA);let N=0;const T=this._getCorrectBufferLength(b);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<y)for(let A=0;A<this.lines.length;A++)N+=+this.lines.get(A).resize(y,E);let L=0;if(this._rows<b)for(let A=this._rows;A<b;A++)this.lines.length<b+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(y,E)):this.ybase>0&&this.lines.length<=this.ybase+this.y+L+1?(this.ybase--,L++,this.ydisp>0&&this.ydisp--):this.lines.push(new x.BufferLine(y,E)));else for(let A=this._rows;A>b;A--)this.lines.length>b+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T<this.lines.maxLength){const A=this.lines.length-T;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=T}this.x=Math.min(this.x,y-1),this.y=Math.min(this.y,b-1),L&&(this.y+=L),this.savedX=Math.min(this.savedX,y-1),this.scrollTop=0}if(this.scrollBottom=b-1,this._isReflowEnabled&&(this._reflow(y,b),this._cols>y))for(let L=0;L<this.lines.length;L++)N+=+this.lines.get(L).resize(y,E);this._cols=y,this._rows=b,this._memoryCleanupQueue.clear(),N>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let y=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,y=!1);let b=0;for(;this._memoryCleanupPosition<this.lines.length;)if(b+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),b>100)return!0;return y}get _isReflowEnabled(){const y=this._optionsService.rawOptions.windowsPty;return y&&y.buildNumber?this._hasScrollback&&y.backend==="conpty"&&y.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(y,b){this._cols!==y&&(y>this._cols?this._reflowLarger(y,b):this._reflowSmaller(y,b))}_reflowLarger(y,b){const E=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,y,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(E.length>0){const N=(0,_.reflowLargerCreateNewLayout)(this.lines,E);(0,_.reflowLargerApplyNewLayout)(this.lines,N.layout),this._reflowLargerAdjustViewport(y,b,N.countRemoved)}}_reflowLargerAdjustViewport(y,b,E){const N=this.getNullCell(x.DEFAULT_ATTR_DATA);let T=E;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<b&&this.lines.push(new x.BufferLine(y,N))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-E,0)}_reflowSmaller(y,b){const E=this.getNullCell(x.DEFAULT_ATTR_DATA),N=[];let T=0;for(let L=this.lines.length-1;L>=0;L--){let A=this.lines.get(L);if(!A||!A.isWrapped&&A.getTrimmedLength()<=y)continue;const M=[A];for(;A.isWrapped&&L>0;)A=this.lines.get(--L),M.unshift(A);const D=this.ybase+this.y;if(D>=L&&D<L+M.length)continue;const U=M[M.length-1].getTrimmedLength(),F=(0,_.reflowSmallerGetNewLineLengths)(M,this._cols,y),B=F.length-M.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const W=[];for(let z=0;z<B;z++){const V=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);W.push(V)}W.length>0&&(N.push({start:L+M.length+T,newLines:W}),T+=W.length),M.push(...W);let H=F.length-1,K=F[H];K===0&&(H--,K=F[H]);let X=M.length-B-1,P=U;for(;X>=0;){const z=Math.min(P,K);if(M[H]===void 0)break;if(M[H].copyCellsFrom(M[X],P-z,K-z,z,!0),K-=z,K===0&&(H--,K=F[H]),P-=z,P===0){X--;const V=Math.max(X,0);P=(0,_.getWrappedLineTrimmedLength)(M,V,this._cols)}}for(let z=0;z<M.length;z++)F[z]<y&&M[z].setCell(F[z],E);let O=B-Y;for(;O-- >0;)this.ybase===0?this.y<b-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-b&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+b-1)}if(N.length>0){const L=[],A=[];for(let H=0;H<this.lines.length;H++)A.push(this.lines.get(H));const M=this.lines.length;let D=M-1,U=0,F=N[U];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let B=0;for(let H=Math.min(this.lines.maxLength-1,M+T-1);H>=0;H--)if(F&&F.start>D+B){for(let K=F.newLines.length-1;K>=0;K--)this.lines.set(H--,F.newLines[K]);H++,L.push({index:D+1,amount:F.newLines.length}),B+=F.newLines.length,F=N[++U]}else this.lines.set(H,A[D--]);let Y=0;for(let H=L.length-1;H>=0;H--)L[H].index+=Y,this.lines.onInsertEmitter.fire(L[H]),Y+=L[H].amount;const W=Math.max(0,M+T-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(y,b,E=0,N){const T=this.lines.get(y);return T?T.translateToString(b,E,N):""}getWrappedRangeForLine(y){let b=y,E=y;for(;b>0&&this.lines.get(b).isWrapped;)b--;for(;E+1<this.lines.length&&this.lines.get(E+1).isWrapped;)E++;return{first:b,last:E}}setupTabStops(y){for(y!=null?this.tabs[y]||(y=this.prevStop(y)):(this.tabs={},y=0);y<this._cols;y+=this._optionsService.rawOptions.tabStopWidth)this.tabs[y]=!0}prevStop(y){for(y==null&&(y=this.x);!this.tabs[--y]&&y>0;);return y>=this._cols?this._cols-1:y<0?0:y}nextStop(y){for(y==null&&(y=this.x);!this.tabs[++y]&&y<this._cols;);return y>=this._cols?this._cols-1:y<0?0:y}clearMarkers(y){this._isClearing=!0;for(let b=0;b<this.markers.length;b++)this.markers[b].line===y&&(this.markers[b].dispose(),this.markers.splice(b--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].dispose(),this.markers.splice(y--,1);this._isClearing=!1}addMarker(y){const b=new v.Marker(y);return this.markers.push(b),b.register(this.lines.onTrim((E=>{b.line-=E,b.line<0&&b.dispose()}))),b.register(this.lines.onInsert((E=>{b.line>=E.index&&(b.line+=E.amount)}))),b.register(this.lines.onDelete((E=>{b.line>=E.index&&b.line<E.index+E.amount&&b.dispose(),b.line>E.index&&(b.line-=E.amount)}))),b.register(b.onDispose((()=>this._removeMarker(b)))),b}_removeMarker(y){this._isClearing||this.markers.splice(this.markers.indexOf(y),1)}}},8437:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const f=d(3734),p=d(511),m=d(643),x=d(482);c.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let _=0;class w{constructor(v,S,y=!1){this.isWrapped=y,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const b=S||p.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let E=0;E<v;++E)this.setCell(E,b);this.length=v}get(v){const S=this._data[3*v+0],y=2097151&S;return[this._data[3*v+1],2097152&S?this._combined[v]:y?(0,x.stringFromCodePoint)(y):"",S>>22,2097152&S?this._combined[v].charCodeAt(this._combined[v].length-1):y]}set(v,S){this._data[3*v+1]=S[m.CHAR_DATA_ATTR_INDEX],S[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=S[1],this._data[3*v+0]=2097152|v|S[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=S[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const S=this._data[3*v+0];return 2097152&S?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&S}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const S=this._data[3*v+0];return 2097152&S?this._combined[v]:2097151&S?(0,x.stringFromCodePoint)(2097151&S):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,S){return _=3*v,S.content=this._data[_+0],S.fg=this._data[_+1],S.bg=this._data[_+2],2097152&S.content&&(S.combinedData=this._combined[v]),268435456&S.bg&&(S.extended=this._extendedAttrs[v]),S}setCell(v,S){2097152&S.content&&(this._combined[v]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[v]=S.extended),this._data[3*v+0]=S.content,this._data[3*v+1]=S.fg,this._data[3*v+2]=S.bg}setCellFromCodepoint(v,S,y,b){268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=S|y<<22,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}addCodepointToCell(v,S,y){let b=this._data[3*v+0];2097152&b?this._combined[v]+=(0,x.stringFromCodePoint)(S):2097151&b?(this._combined[v]=(0,x.stringFromCodePoint)(2097151&b)+(0,x.stringFromCodePoint)(S),b&=-2097152,b|=2097152):b=S|4194304,y&&(b&=-12582913,b|=y<<22),this._data[3*v+0]=b}insertCells(v,S,y){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),S<this.length-v){const b=new p.CellData;for(let E=this.length-v-S-1;E>=0;--E)this.setCell(v+S+E,this.loadCell(v+E,b));for(let E=0;E<S;++E)this.setCell(v+E,y)}else for(let b=v;b<this.length;++b)this.setCell(b,y);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,y)}deleteCells(v,S,y){if(v%=this.length,S<this.length-v){const b=new p.CellData;for(let E=0;E<this.length-v-S;++E)this.setCell(v+E,this.loadCell(v+S+E,b));for(let E=this.length-S;E<this.length;++E)this.setCell(E,y)}else for(let b=v;b<this.length;++b)this.setCell(b,y);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,y)}replaceCells(v,S,y,b=!1){if(b)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,y),S<this.length&&this.getWidth(S-1)===2&&!this.isProtected(S)&&this.setCellFromCodepoint(S,0,1,y);v<S&&v<this.length;)this.isProtected(v)||this.setCell(v,y),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,y),S<this.length&&this.getWidth(S-1)===2&&this.setCellFromCodepoint(S,0,1,y);v<S&&v<this.length;)this.setCell(v++,y)}resize(v,S){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const y=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*y)this._data=new Uint32Array(this._data.buffer,0,y);else{const b=new Uint32Array(y);b.set(this._data),this._data=b}for(let b=this.length;b<v;++b)this.setCell(b,S)}else{this._data=this._data.subarray(0,y);const b=Object.keys(this._combined);for(let N=0;N<b.length;N++){const T=parseInt(b[N],10);T>=v&&delete this._combined[T]}const E=Object.keys(this._extendedAttrs);for(let N=0;N<E.length;N++){const T=parseInt(E[N],10);T>=v&&delete this._extendedAttrs[T]}}return this.length=v,4*y*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const v=new Uint32Array(this._data.length);return v.set(this._data),this._data=v,1}return 0}fill(v,S=!1){if(S)for(let y=0;y<this.length;++y)this.isProtected(y)||this.setCell(y,v);else{this._combined={},this._extendedAttrs={};for(let y=0;y<this.length;++y)this.setCell(y,v)}}copyFrom(v){this.length!==v.length?this._data=new Uint32Array(v._data):this._data.set(v._data),this.length=v.length,this._combined={};for(const S in v._combined)this._combined[S]=v._combined[S];this._extendedAttrs={};for(const S in v._extendedAttrs)this._extendedAttrs[S]=v._extendedAttrs[S];this.isWrapped=v.isWrapped}clone(){const v=new w(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const S in this._combined)v._combined[S]=this._combined[S];for(const S in this._extendedAttrs)v._extendedAttrs[S]=this._extendedAttrs[S];return v.isWrapped=this.isWrapped,v}getTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,S,y,b,E){const N=v._data;if(E)for(let L=b-1;L>=0;L--){for(let A=0;A<3;A++)this._data[3*(y+L)+A]=N[3*(S+L)+A];268435456&N[3*(S+L)+2]&&(this._extendedAttrs[y+L]=v._extendedAttrs[S+L])}else for(let L=0;L<b;L++){for(let A=0;A<3;A++)this._data[3*(y+L)+A]=N[3*(S+L)+A];268435456&N[3*(S+L)+2]&&(this._extendedAttrs[y+L]=v._extendedAttrs[S+L])}const T=Object.keys(v._combined);for(let L=0;L<T.length;L++){const A=parseInt(T[L],10);A>=S&&(this._combined[A-S+y]=v._combined[A])}}translateToString(v,S,y,b){S=S??0,y=y??this.length,v&&(y=Math.min(y,this.getTrimmedLength())),b&&(b.length=0);let E="";for(;S<y;){const N=this._data[3*S+0],T=2097151&N,L=2097152&N?this._combined[S]:T?(0,x.stringFromCodePoint)(T):m.WHITESPACE_CELL_CHAR;if(E+=L,b)for(let A=0;A<L.length;++A)b.push(S);S+=N>>22||1}return b&&b.push(S),E}}c.BufferLine=w},4841:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(d,f){if(d.start.y>d.end.y)throw new Error(`Buffer range end (${d.end.x}, ${d.end.y}) cannot be before start (${d.start.x}, ${d.start.y})`);return f*(d.end.y-d.start.y)+(d.end.x-d.start.x+1)}},4634:(u,c)=>{function d(f,p,m){if(p===f.length-1)return f[p].getTrimmedLength();const x=!f[p].hasContent(m-1)&&f[p].getWidth(m-1)===1,_=f[p+1].getWidth(0)===2;return x&&_?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(f,p,m,x,_){const w=[];for(let k=0;k<f.length-1;k++){let v=k,S=f.get(++v);if(!S.isWrapped)continue;const y=[f.get(k)];for(;v<f.length&&S.isWrapped;)y.push(S),S=f.get(++v);if(x>=k&&x<v){k+=y.length-1;continue}let b=0,E=d(y,b,p),N=1,T=0;for(;N<y.length;){const A=d(y,N,p),M=A-T,D=m-E,U=Math.min(M,D);y[b].copyCellsFrom(y[N],T,E,U,!1),E+=U,E===m&&(b++,E=0),T+=U,T===A&&(N++,T=0),E===0&&b!==0&&y[b-1].getWidth(m-1)===2&&(y[b].copyCellsFrom(y[b-1],m-1,E++,1,!1),y[b-1].setCell(m-1,_))}y[b].replaceCells(E,m,_);let L=0;for(let A=y.length-1;A>0&&(A>b||y[A].getTrimmedLength()===0);A--)L++;L>0&&(w.push(k+y.length-L),w.push(L)),k+=y.length-1}return w},c.reflowLargerCreateNewLayout=function(f,p){const m=[];let x=0,_=p[x],w=0;for(let k=0;k<f.length;k++)if(_===k){const v=p[++x];f.onDeleteEmitter.fire({index:k-w,amount:v}),k+=v-1,w+=v,_=p[++x]}else m.push(k);return{layout:m,countRemoved:w}},c.reflowLargerApplyNewLayout=function(f,p){const m=[];for(let x=0;x<p.length;x++)m.push(f.get(p[x]));for(let x=0;x<m.length;x++)f.set(x,m[x]);f.length=p.length},c.reflowSmallerGetNewLineLengths=function(f,p,m){const x=[],_=f.map(((S,y)=>d(f,y,p))).reduce(((S,y)=>S+y));let w=0,k=0,v=0;for(;v<_;){if(_-v<m){x.push(_-v);break}w+=m;const S=d(f,k,p);w>S&&(w-=S,k++);const y=f[k].getWidth(w-1)===2;y&&w--;const b=y?m-1:m;x.push(b),v+=b}return x},c.getWrappedLineTrimmedLength=d},5295:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const f=d(8460),p=d(844),m=d(9092);class x extends p.Disposable{constructor(w,k){super(),this._optionsService=w,this._bufferService=k,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(w,k){this._normal.resize(w,k),this._alt.resize(w,k),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}c.BufferSet=x},511:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const f=d(482),p=d(643),m=d(3734);class x extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const k=new x;return k.setFromCharData(w),k}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let k=!1;if(w[p.CHAR_DATA_CHAR_INDEX].length>2)k=!0;else if(w[p.CHAR_DATA_CHAR_INDEX].length===2){const v=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const S=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(v-55296)+S-56320+65536|w[p.CHAR_DATA_WIDTH_INDEX]<<22:k=!0}else k=!0}else this.content=w[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[p.CHAR_DATA_WIDTH_INDEX]<<22;k&&(this.combinedData=w[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=x},643:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const f=d(8460),p=d(844);class m{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}c.Marker=m,m._nextId=1},7116:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(u,c)=>{var d,f,p;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
|
|
65
|
-
`,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(d||(c.C0=d={})),(function(m){m.PAD="",m.HOP="",m.BPH="",m.NBH="",m.IND="",m.NEL="
",m.SSA="",m.ESA="",m.HTS="",m.HTJ="",m.VTS="",m.PLD="",m.PLU="",m.RI="",m.SS2="",m.SS3="",m.DCS="",m.PU1="",m.PU2="",m.STS="",m.CCH="",m.MW="",m.SPA="",m.EPA="",m.SOS="",m.SGCI="",m.SCI="",m.CSI="",m.ST="",m.OSC="",m.PM="",m.APC=""})(f||(c.C1=f={})),(function(m){m.ST=`${d.ESC}\\`})(p||(c.C1_ESCAPED=p={}))},7399:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const f=d(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};c.evaluateKeyboardEvent=function(m,x,_,w){const k={type:0,cancel:!1,key:void 0},v=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?k.key=x?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?k.key=x?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?k.key=x?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(k.key=x?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:k.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(k.key=f.C0.ESC+k.key);break;case 9:if(m.shiftKey){k.key=f.C0.ESC+"[Z";break}k.key=f.C0.HT,k.cancel=!0;break;case 13:k.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,k.cancel=!0;break;case 27:k.key=f.C0.ESC,m.altKey&&(k.key=f.C0.ESC+f.C0.ESC),k.cancel=!0;break;case 37:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"D",k.key===f.C0.ESC+"[1;3D"&&(k.key=f.C0.ESC+(_?"b":"[1;5D"))):k.key=x?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"C",k.key===f.C0.ESC+"[1;3C"&&(k.key=f.C0.ESC+(_?"f":"[1;5C"))):k.key=x?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"A",_||k.key!==f.C0.ESC+"[1;3A"||(k.key=f.C0.ESC+"[1;5A")):k.key=x?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;v?(k.key=f.C0.ESC+"[1;"+(v+1)+"B",_||k.key!==f.C0.ESC+"[1;3B"||(k.key=f.C0.ESC+"[1;5B")):k.key=x?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(k.key=f.C0.ESC+"[2~");break;case 46:k.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:k.key=v?f.C0.ESC+"[1;"+(v+1)+"H":x?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:k.key=v?f.C0.ESC+"[1;"+(v+1)+"F":x?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?k.type=2:m.ctrlKey?k.key=f.C0.ESC+"[5;"+(v+1)+"~":k.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?k.type=3:m.ctrlKey?k.key=f.C0.ESC+"[6;"+(v+1)+"~":k.key=f.C0.ESC+"[6~";break;case 112:k.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:k.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:k.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:k.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:k.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:k.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:k.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:k.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:k.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:k.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:k.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:k.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(_&&!w||!m.altKey||m.metaKey)!_||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?k.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(k.key=f.C0.US),m.key==="@"&&(k.key=f.C0.NUL)):m.keyCode===65&&(k.type=1);else{const S=p[m.keyCode],y=S==null?void 0:S[m.shiftKey?1:0];if(y)k.key=f.C0.ESC+y;else if(m.keyCode>=65&&m.keyCode<=90){const b=m.ctrlKey?m.keyCode-64:m.keyCode+32;let E=String.fromCharCode(b);m.shiftKey&&(E=E.toUpperCase()),k.key=f.C0.ESC+E}else if(m.keyCode===32)k.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let b=m.code.slice(3,4);m.shiftKey||(b=b.toLowerCase()),k.key=f.C0.ESC+b,k.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?k.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?k.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?k.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?k.key=f.C0.DEL:m.keyCode===219?k.key=f.C0.ESC:m.keyCode===220?k.key=f.C0.FS:m.keyCode===221&&(k.key=f.C0.GS)}return k}},482:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},c.utf32ToString=function(d,f=0,p=d.length){let m="";for(let x=f;x<p;++x){let _=d[x];_>65535?(_-=65536,m+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):m+=String.fromCharCode(_)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const p=d.length;if(!p)return 0;let m=0,x=0;if(this._interim){const _=d.charCodeAt(x++);56320<=_&&_<=57343?f[m++]=1024*(this._interim-55296)+_-56320+65536:(f[m++]=this._interim,f[m++]=_),this._interim=0}for(let _=x;_<p;++_){const w=d.charCodeAt(_);if(55296<=w&&w<=56319){if(++_>=p)return this._interim=w,m;const k=d.charCodeAt(_);56320<=k&&k<=57343?f[m++]=1024*(w-55296)+k-56320+65536:(f[m++]=w,f[m++]=k)}else w!==65279&&(f[m++]=w)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const p=d.length;if(!p)return 0;let m,x,_,w,k=0,v=0,S=0;if(this.interim[0]){let E=!1,N=this.interim[0];N&=(224&N)==192?31:(240&N)==224?15:7;let T,L=0;for(;(T=63&this.interim[++L])&&L<4;)N<<=6,N|=T;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=A-L;for(;S<M;){if(S>=p)return 0;if(T=d[S++],(192&T)!=128){S--,E=!0;break}this.interim[L++]=T,N<<=6,N|=63&T}E||(A===2?N<128?S--:f[k++]=N:A===3?N<2048||N>=55296&&N<=57343||N===65279||(f[k++]=N):N<65536||N>1114111||(f[k++]=N)),this.interim.fill(0)}const y=p-4;let b=S;for(;b<p;){for(;!(!(b<y)||128&(m=d[b])||128&(x=d[b+1])||128&(_=d[b+2])||128&(w=d[b+3]));)f[k++]=m,f[k++]=x,f[k++]=_,f[k++]=w,b+=4;if(m=d[b++],m<128)f[k++]=m;else if((224&m)==192){if(b>=p)return this.interim[0]=m,k;if(x=d[b++],(192&x)!=128){b--;continue}if(v=(31&m)<<6|63&x,v<128){b--;continue}f[k++]=v}else if((240&m)==224){if(b>=p)return this.interim[0]=m,k;if(x=d[b++],(192&x)!=128){b--;continue}if(b>=p)return this.interim[0]=m,this.interim[1]=x,k;if(_=d[b++],(192&_)!=128){b--;continue}if(v=(15&m)<<12|(63&x)<<6|63&_,v<2048||v>=55296&&v<=57343||v===65279)continue;f[k++]=v}else if((248&m)==240){if(b>=p)return this.interim[0]=m,k;if(x=d[b++],(192&x)!=128){b--;continue}if(b>=p)return this.interim[0]=m,this.interim[1]=x,k;if(_=d[b++],(192&_)!=128){b--;continue}if(b>=p)return this.interim[0]=m,this.interim[1]=x,this.interim[2]=_,k;if(w=d[b++],(192&w)!=128){b--;continue}if(v=(7&m)<<18|(63&x)<<12|(63&_)<<6|63&w,v<65536||v>1114111)continue;f[k++]=v}}return k}}},225:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const f=d(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let _=0;_<p.length;++_)x.fill(0,p[_][0],p[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?x[_]:(function(w,k){let v,S=0,y=k.length-1;if(w<k[0][0]||w>k[y][1])return!1;for(;y>=S;)if(v=S+y>>1,w>k[v][1])S=v+1;else{if(!(w<k[v][0]))return!0;y=v-1}return!1})(_,m)?0:_>=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,w){let k=this.wcwidth(_),v=k===0&&w!==0;if(v){const S=f.UnicodeService.extractWidth(w);S===0?v=!1:S>k&&(k=S)}return f.UnicodeService.createPropertyValue(0,k,v)}}},5981:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const f=d(8460),p=d(844);class m extends p.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let k;for(this._isSyncWriting=!0;k=this._writeBuffer.shift();){this._action(k);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,w){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(w)}_innerWrite(_=0,w=!0){const k=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],S=this._action(v,w);if(S){const b=E=>Date.now()-k>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(k,E);return void S.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(b)}const y=this._callbacks[this._bufferOffset];if(y&&y(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-k>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}c.WriteBuffer=m},5941:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const d=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function p(m,x){const _=m.toString(16),w=_.length<2?"0"+_:_;switch(x){case 4:return _[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}c.parseColor=function(m){if(!m)return;let x=m.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const _=d.exec(x);if(_){const w=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/w*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/w*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/w*255)]}}else if(x.indexOf("#")===0&&(x=x.slice(1),f.exec(x)&&[3,6,9,12].includes(x.length))){const _=x.length/3,w=[0,0,0];for(let k=0;k<3;++k){const v=parseInt(x.slice(_*k,_*k+_),16);w[k]=_===1?v<<4:_===2?v:_===3?v>>4:v>>8}return w}},c.toRgbString=function(m,x=16){const[_,w,k]=m;return`rgb:${p(_,x)}/${p(w,x)}/${p(k,x)}`}},5770:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const f=d(482),p=d(8742),m=d(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}registerHandler(w,k){this._handlers[w]===void 0&&(this._handlers[w]=[]);const v=this._handlers[w];return v.push(k),{dispose:()=>{const S=v.indexOf(k);S!==-1&&v.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=x,this._ident=0}hook(w,k){if(this.reset(),this._ident=w,this._active=this._handlers[w]||x,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(k);else this._handlerFb(this._ident,"HOOK",k)}put(w,k,v){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,k,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,k,v))}unhook(w,k=!0){if(this._active.length){let v=!1,S=this._active.length-1,y=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,v=k,y=this._stack.fallThrough,this._stack.paused=!1),!y&&v===!1){for(;S>=0&&(v=this._active[S].unhook(w),v!==!0);S--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,v;S--}for(;S>=0;S--)if(v=this._active[S].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",w);this._active=x,this._ident=0}};const _=new p.Params;_.addParam(0),c.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=_,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():_,this._data="",this._hitLimit=!1}put(w,k,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,k,v),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let k=!1;if(this._hitLimit)k=!1;else if(w&&(k=this._handler(this._data,this._params),k instanceof Promise))return k.then((v=>(this._params=_,this._data="",this._hitLimit=!1,v)));return this._params=_,this._data="",this._hitLimit=!1,k}}},2015:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const f=d(844),p=d(8742),m=d(6242),x=d(6351);class _{constructor(S){this.table=new Uint8Array(S)}setDefault(S,y){this.table.fill(S<<4|y)}add(S,y,b,E){this.table[y<<8|S]=b<<4|E}addMany(S,y,b,E){for(let N=0;N<S.length;N++)this.table[y<<8|S[N]]=b<<4|E}}c.TransitionTable=_;const w=160;c.VT500_TRANSITION_TABLE=(function(){const v=new _(4095),S=Array.apply(null,Array(256)).map(((L,A)=>A)),y=(L,A)=>S.slice(L,A),b=y(32,127),E=y(0,24);E.push(25),E.push.apply(E,y(28,32));const N=y(0,14);let T;for(T in v.setDefault(1,0),v.addMany(b,0,2,0),N)v.addMany([24,26,153,154],T,3,0),v.addMany(y(128,144),T,3,0),v.addMany(y(144,152),T,3,0),v.add(156,T,0,0),v.add(27,T,11,1),v.add(157,T,4,8),v.addMany([152,158,159],T,0,7),v.add(155,T,11,3),v.add(144,T,11,9);return v.addMany(E,0,3,0),v.addMany(E,1,3,1),v.add(127,1,0,1),v.addMany(E,8,0,8),v.addMany(E,3,3,3),v.add(127,3,0,3),v.addMany(E,4,3,4),v.add(127,4,0,4),v.addMany(E,6,3,6),v.addMany(E,5,3,5),v.add(127,5,0,5),v.addMany(E,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(b,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(y(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(b,7,0,7),v.addMany(E,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(y(64,127),3,7,0),v.addMany(y(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(y(48,60),4,8,4),v.addMany(y(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(y(32,64),6,0,6),v.add(127,6,0,6),v.addMany(y(64,127),6,0,0),v.addMany(y(32,48),3,9,5),v.addMany(y(32,48),5,9,5),v.addMany(y(48,64),5,0,6),v.addMany(y(64,127),5,7,0),v.addMany(y(32,48),4,9,5),v.addMany(y(32,48),1,9,2),v.addMany(y(32,48),2,9,2),v.addMany(y(48,127),2,10,0),v.addMany(y(48,80),1,10,0),v.addMany(y(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(y(96,127),1,10,0),v.add(80,1,11,9),v.addMany(E,9,0,9),v.add(127,9,0,9),v.addMany(y(28,32),9,0,9),v.addMany(y(32,48),9,9,12),v.addMany(y(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(E,11,0,11),v.addMany(y(32,128),11,0,11),v.addMany(y(28,32),11,0,11),v.addMany(E,10,0,10),v.add(127,10,0,10),v.addMany(y(28,32),10,0,10),v.addMany(y(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(y(32,48),10,9,12),v.addMany(E,12,0,12),v.add(127,12,0,12),v.addMany(y(28,32),12,0,12),v.addMany(y(32,48),12,9,12),v.addMany(y(48,64),12,0,11),v.addMany(y(64,127),12,12,13),v.addMany(y(64,127),10,12,13),v.addMany(y(64,127),9,12,13),v.addMany(E,13,13,13),v.addMany(b,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(w,0,2,0),v.add(w,8,5,8),v.add(w,6,0,6),v.add(w,11,0,11),v.add(w,13,13,13),v})();class k extends f.Disposable{constructor(S=c.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(y,b,E)=>{},this._executeHandlerFb=y=>{},this._csiHandlerFb=(y,b)=>{},this._escHandlerFb=y=>{},this._errorHandlerFb=y=>y,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,y=[64,126]){let b=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(b=S.prefix.charCodeAt(0),b&&60>b||b>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let N=0;N<S.intermediates.length;++N){const T=S.intermediates.charCodeAt(N);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");b<<=8,b|=T}}if(S.final.length!==1)throw new Error("final must be a single byte");const E=S.final.charCodeAt(0);if(y[0]>E||E>y[1])throw new Error(`final must be in range ${y[0]} .. ${y[1]}`);return b<<=8,b|=E,b}identToString(S){const y=[];for(;S;)y.push(String.fromCharCode(255&S)),S>>=8;return y.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,y){const b=this._identifier(S,[48,126]);this._escHandlers[b]===void 0&&(this._escHandlers[b]=[]);const E=this._escHandlers[b];return E.push(y),{dispose:()=>{const N=E.indexOf(y);N!==-1&&E.splice(N,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,y){this._executeHandlers[S.charCodeAt(0)]=y}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,y){const b=this._identifier(S);this._csiHandlers[b]===void 0&&(this._csiHandlers[b]=[]);const E=this._csiHandlers[b];return E.push(y),{dispose:()=>{const N=E.indexOf(y);N!==-1&&E.splice(N,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,y){return this._dcsParser.registerHandler(this._identifier(S),y)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,y){return this._oscParser.registerHandler(S,y)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(S,y,b,E,N){this._parseStack.state=S,this._parseStack.handlers=y,this._parseStack.handlerPos=b,this._parseStack.transition=E,this._parseStack.chunkPos=N}parse(S,y,b){let E,N=0,T=0,L=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,L=this._parseStack.chunkPos+1;else{if(b===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(b===!1&&M>-1){for(;M>=0&&(E=A[M](this._params),E!==!0);M--)if(E instanceof Promise)return this._parseStack.handlerPos=M,E}this._parseStack.handlers=[];break;case 4:if(b===!1&&M>-1){for(;M>=0&&(E=A[M](),E!==!0);M--)if(E instanceof Promise)return this._parseStack.handlerPos=M,E}this._parseStack.handlers=[];break;case 6:if(N=S[this._parseStack.chunkPos],E=this._dcsParser.unhook(N!==24&&N!==26,b),E)return E;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(N=S[this._parseStack.chunkPos],E=this._oscParser.end(N!==24&&N!==26,b),E)return E;N===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,L=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=L;A<y;++A){switch(N=S[A],T=this._transitions.table[this.currentState<<8|(N<160?N:w)],T>>4){case 2:for(let B=A+1;;++B){if(B>=y||(N=S[B])<32||N>126&&N<w){this._printHandler(S,A,B),A=B-1;break}if(++B>=y||(N=S[B])<32||N>126&&N<w){this._printHandler(S,A,B),A=B-1;break}if(++B>=y||(N=S[B])<32||N>126&&N<w){this._printHandler(S,A,B),A=B-1;break}if(++B>=y||(N=S[B])<32||N>126&&N<w){this._printHandler(S,A,B),A=B-1;break}}break;case 3:this._executeHandlers[N]?this._executeHandlers[N]():this._executeHandlerFb(N),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:N,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const M=this._csiHandlers[this._collect<<8|N];let D=M?M.length-1:-1;for(;D>=0&&(E=M[D](this._params),E!==!0);D--)if(E instanceof Promise)return this._preserveStack(3,M,D,T,A),E;D<0&&this._csiHandlerFb(this._collect<<8|N,this._params),this.precedingJoinState=0;break;case 8:do switch(N){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(N-48)}while(++A<y&&(N=S[A])>47&&N<60);A--;break;case 9:this._collect<<=8,this._collect|=N;break;case 10:const U=this._escHandlers[this._collect<<8|N];let F=U?U.length-1:-1;for(;F>=0&&(E=U[F](),E!==!0);F--)if(E instanceof Promise)return this._preserveStack(4,U,F,T,A),E;F<0&&this._escHandlerFb(this._collect<<8|N),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|N,this._params);break;case 13:for(let B=A+1;;++B)if(B>=y||(N=S[B])===24||N===26||N===27||N>127&&N<w){this._dcsParser.put(S,A,B),A=B-1;break}break;case 14:if(E=this._dcsParser.unhook(N!==24&&N!==26),E)return this._preserveStack(6,[],0,T,A),E;N===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let B=A+1;;B++)if(B>=y||(N=S[B])<32||N>127&&N<w){this._oscParser.put(S,A,B),A=B-1;break}break;case 6:if(E=this._oscParser.end(N!==24&&N!==26),E)return this._preserveStack(5,[],0,T,A),E;N===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}c.EscapeSequenceParser=k},6242:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const f=d(5770),p=d(482),m=[];c.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(x,_){this._handlers[x]===void 0&&(this._handlers[x]=[]);const w=this._handlers[x];return w.push(_),{dispose:()=>{const k=w.indexOf(_);k!==-1&&w.splice(k,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,_,w){if(this._active.length)for(let k=this._active.length-1;k>=0;k--)this._active[k].put(x,_,w);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(x,_,w))}start(){this.reset(),this._state=1}put(x,_,w){if(this._state!==3){if(this._state===1)for(;_<w;){const k=x[_++];if(k===59){this._state=2,this._start();break}if(k<48||57<k)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+k-48}this._state===2&&w-_>0&&this._put(x,_,w)}}end(x,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,k=this._active.length-1,v=!1;if(this._stack.paused&&(k=this._stack.loopPosition-1,w=_,v=this._stack.fallThrough,this._stack.paused=!1),!v&&w===!1){for(;k>=0&&(w=this._active[k].end(x),w!==!0);k--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=k,this._stack.fallThrough=!1,w;k--}for(;k>=0;k--)if(w=this._active[k].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=k,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",x);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,_,w){this._hitLimit||(this._data+=(0,p.utf32ToString)(x,_,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let _=!1;if(this._hitLimit)_=!1;else if(x&&(_=this._handler(this._data),_ instanceof Promise))return _.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,_}}},8742:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const d=2147483647;class f{static fromArray(m){const x=new f;if(!m.length)return x;for(let _=Array.isArray(m[0])?1:0;_<m.length;++_){const w=m[_];if(Array.isArray(w))for(let k=0;k<w.length;++k)x.addSubParam(w[k]);else x.addParam(w)}return x}constructor(m=32,x=32){if(this.maxLength=m,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(x),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let x=0;x<this.length;++x){m.push(this.params[x]);const _=this._subParamsIdx[x]>>8,w=255&this._subParamsIdx[x];w-_>0&&m.push(Array.prototype.slice.call(this._subParams,_,w))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>d?d:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>d?d:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const x=this._subParamsIdx[m]>>8,_=255&this._subParamsIdx[m];return _-x>0?this._subParams.subarray(x,_):null}getSubParamsAll(){const m={};for(let x=0;x<this.length;++x){const _=this._subParamsIdx[x]>>8,w=255&this._subParamsIdx[x];w-_>0&&(m[x]=this._subParams.slice(_,w))}return m}addDigit(m){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,w=_[x-1];_[x-1]=~w?Math.min(10*w+m,d):m}}c.Params=f},5741:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let d=this._addons.length-1;d>=0;d--)this._addons[d].instance.dispose()}loadAddon(d,f){const p={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(p),f.dispose=()=>this._wrappedAddonDispose(p),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===d){f=p;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");d.isDisposed=!0,d.dispose.apply(d.instance),this._addons.splice(f,1)}}},8771:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const f=d(3785),p=d(511);c.BufferApiView=class{constructor(m,x){this._buffer=m,this.type=x}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const x=this._buffer.lines.get(m);if(x)return new f.BufferLineApiView(x)}getNullCell(){return new p.CellData}}},3785:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const f=d(511);c.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,m){if(!(p<0||p>=this._line.length))return m?(this._line.loadCell(p,m),m):this._line.loadCell(p,new f.CellData)}translateToString(p,m,x){return this._line.translateToString(p,m,x)}}},8285:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const f=d(8771),p=d(8460),m=d(844);class x extends m.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=x},7975:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(p=>f(p.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((p,m)=>f(p,m.toArray())))}addDcsHandler(d,f){return this.registerDcsHandler(d,f)}registerEscHandler(d,f){return this._core.registerEscHandler(d,f)}addEscHandler(d,f){return this.registerEscHandler(d,f)}registerOscHandler(d,f){return this._core.registerOscHandler(d,f)}addOscHandler(d,f){return this.registerOscHandler(d,f)}}},7090:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(d){this._core=d}register(d){this._core.unicodeService.register(d)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(d){this._core.unicodeService.activeVersion=d}}},744:function(u,c,d){var f=this&&this.__decorate||function(v,S,y,b){var E,N=arguments.length,T=N<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,S,y,b);else for(var L=v.length-1;L>=0;L--)(E=v[L])&&(T=(N<3?E(T):N>3?E(S,y,T):E(S,y))||T);return N>3&&T&&Object.defineProperty(S,y,T),T},p=this&&this.__param||function(v,S){return function(y,b){S(y,b,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=d(8460),x=d(844),_=d(5295),w=d(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let k=c.BufferService=class extends x.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(v,this))}resize(v,S){this.cols=v,this.rows=S,this.buffers.resize(v,S),this._onResize.fire({cols:v,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,S=!1){const y=this.buffer;let b;b=this._cachedBlankLine,b&&b.length===this.cols&&b.getFg(0)===v.fg&&b.getBg(0)===v.bg||(b=y.getBlankLine(v,S),this._cachedBlankLine=b),b.isWrapped=S;const E=y.ybase+y.scrollTop,N=y.ybase+y.scrollBottom;if(y.scrollTop===0){const T=y.lines.isFull;N===y.lines.length-1?T?y.lines.recycle().copyFrom(b):y.lines.push(b.clone()):y.lines.splice(N+1,0,b.clone()),T?this.isUserScrolling&&(y.ydisp=Math.max(y.ydisp-1,0)):(y.ybase++,this.isUserScrolling||y.ydisp++)}else{const T=N-E+1;y.lines.shiftElements(E+1,T-1,-1),y.lines.set(N,b.clone())}this.isUserScrolling||(y.ydisp=y.ybase),this._onScroll.fire(y.ydisp)}scrollLines(v,S,y){const b=this.buffer;if(v<0){if(b.ydisp===0)return;this.isUserScrolling=!0}else v+b.ydisp>=b.ybase&&(this.isUserScrolling=!1);const E=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+v,b.ybase),0),E!==b.ydisp&&(S||this._onScroll.fire(b.ydisp))}};c.BufferService=k=f([p(0,w.IOptionsService)],k)},7994:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(d){this.glevel=d,this.charset=this._charsets[d]}setgCharset(d,f){this._charsets[d]=f,this.glevel===d&&(this.charset=f)}}},1753:function(u,c,d){var f=this&&this.__decorate||function(b,E,N,T){var L,A=arguments.length,M=A<3?E:T===null?T=Object.getOwnPropertyDescriptor(E,N):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(b,E,N,T);else for(var D=b.length-1;D>=0;D--)(L=b[D])&&(M=(A<3?L(M):A>3?L(E,N,M):L(E,N))||M);return A>3&&M&&Object.defineProperty(E,N,M),M},p=this&&this.__param||function(b,E){return function(N,T){E(N,T,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=d(2585),x=d(8460),_=d(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:b=>b.button!==4&&b.action===1&&(b.ctrl=!1,b.alt=!1,b.shift=!1,!0)},VT200:{events:19,restrict:b=>b.action!==32},DRAG:{events:23,restrict:b=>b.action!==32||b.button!==3},ANY:{events:31,restrict:b=>!0}};function k(b,E){let N=(b.ctrl?16:0)|(b.shift?4:0)|(b.alt?8:0);return b.button===4?(N|=64,N|=b.action):(N|=3&b.button,4&b.button&&(N|=64),8&b.button&&(N|=128),b.action===32?N|=32:b.action!==0||E||(N|=3)),N}const v=String.fromCharCode,S={DEFAULT:b=>{const E=[k(b,!1)+32,b.col+32,b.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${v(E[0])}${v(E[1])}${v(E[2])}`},SGR:b=>{const E=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${k(b,!0)};${b.col};${b.row}${E}`},SGR_PIXELS:b=>{const E=b.action===0&&b.button!==4?"m":"M";return`\x1B[<${k(b,!0)};${b.x};${b.y}${E}`}};let y=c.CoreMouseService=class extends _.Disposable{constructor(b,E){super(),this._bufferService=b,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const N of Object.keys(w))this.addProtocol(N,w[N]);for(const N of Object.keys(S))this.addEncoding(N,S[N]);this.reset()}addProtocol(b,E){this._protocols[b]=E}addEncoding(b,E){this._encodings[b]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(b){if(!this._protocols[b])throw new Error(`unknown protocol "${b}"`);this._activeProtocol=b,this._onProtocolChange.fire(this._protocols[b].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(b){if(!this._encodings[b])throw new Error(`unknown encoding "${b}"`);this._activeEncoding=b}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(b){if(b.col<0||b.col>=this._bufferService.cols||b.row<0||b.row>=this._bufferService.rows||b.button===4&&b.action===32||b.button===3&&b.action!==32||b.button!==4&&(b.action===2||b.action===3)||(b.col++,b.row++,b.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,b,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(b))return!1;const E=this._encodings[this._activeEncoding](b);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=b,!0}explainEvents(b){return{down:!!(1&b),up:!!(2&b),drag:!!(4&b),move:!!(8&b),wheel:!!(16&b)}}_equalEvents(b,E,N){if(N){if(b.x!==E.x||b.y!==E.y)return!1}else if(b.col!==E.col||b.row!==E.row)return!1;return b.button===E.button&&b.action===E.action&&b.ctrl===E.ctrl&&b.alt===E.alt&&b.shift===E.shift}};c.CoreMouseService=y=f([p(0,m.IBufferService),p(1,m.ICoreService)],y)},6975:function(u,c,d){var f=this&&this.__decorate||function(y,b,E,N){var T,L=arguments.length,A=L<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(y,b,E,N);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(A=(L<3?T(A):L>3?T(b,E,A):T(b,E))||A);return L>3&&A&&Object.defineProperty(b,E,A),A},p=this&&this.__param||function(y,b){return function(E,N){b(E,N,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=d(1439),x=d(8460),_=d(844),w=d(2585),k=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=c.CoreService=class extends _.Disposable{constructor(y,b,E){super(),this._bufferService=y,this._logService=b,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(k),this.decPrivateModes=(0,m.clone)(v)}reset(){this.modes=(0,m.clone)(k),this.decPrivateModes=(0,m.clone)(v)}triggerDataEvent(y,b=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;b&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),b&&this._onUserInput.fire(),this._logService.debug(`sending data "${y}"`,(()=>y.split("").map((N=>N.charCodeAt(0))))),this._onData.fire(y)}triggerBinaryEvent(y){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${y}"`,(()=>y.split("").map((b=>b.charCodeAt(0))))),this._onBinary.fire(y))}};c.CoreService=S=f([p(0,w.IBufferService),p(1,w.ILogService),p(2,w.IOptionsService)],S)},9074:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const f=d(8055),p=d(8460),m=d(844),x=d(6106);let _=0,w=0;class k extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((y=>y==null?void 0:y.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(y){if(y.marker.isDisposed)return;const b=new v(y);if(b){const E=b.marker.onDispose((()=>b.dispose()));b.onDispose((()=>{b&&(this._decorations.delete(b)&&this._onDecorationRemoved.fire(b),E.dispose())})),this._decorations.insert(b),this._onDecorationRegistered.fire(b)}return b}reset(){for(const y of this._decorations.values())y.dispose();this._decorations.clear()}*getDecorationsAtCell(y,b,E){let N=0,T=0;for(const L of this._decorations.getKeyIterator(b))N=L.options.x??0,T=N+(L.options.width??1),y>=N&&y<T&&(!E||(L.options.layer??"bottom")===E)&&(yield L)}forEachDecorationAtCell(y,b,E,N){this._decorations.forEachByKey(b,(T=>{_=T.options.x??0,w=_+(T.options.width??1),y>=_&&y<w&&(!E||(T.options.layer??"bottom")===E)&&N(T)}))}}c.DecorationService=k;class v extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(y){super(),this.options=y,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=y.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const f=d(2585),p=d(8343);class m{constructor(..._){this._entries=new Map;for(const[w,k]of _)this.set(w,k)}set(_,w){const k=this._entries.get(_);return this._entries.set(_,w),k}forEach(_){for(const[w,k]of this._entries.entries())_(w,k)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}c.ServiceCollection=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(x,_){this._services.set(x,_)}getService(x){return this._services.get(x)}createInstance(x,..._){const w=(0,p.getServiceDependencies)(x).sort(((S,y)=>S.index-y.index)),k=[];for(const S of w){const y=this._services.get(S.id);if(!y)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${S.id}.`);k.push(y)}const v=w.length>0?w[0].index:_.length;if(_.length!==v)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${v+1} conflicts with ${_.length} static arguments`);return new x(..._,...k)}}},7866:function(u,c,d){var f=this&&this.__decorate||function(v,S,y,b){var E,N=arguments.length,T=N<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(v,S,y,b);else for(var L=v.length-1;L>=0;L--)(E=v[L])&&(T=(N<3?E(T):N>3?E(S,y,T):E(S,y))||T);return N>3&&T&&Object.defineProperty(S,y,T),T},p=this&&this.__param||function(v,S){return function(y,b){S(y,b,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=d(844),x=d(2585),_={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let w,k=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=x.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let S=0;S<v.length;S++)typeof v[S]=="function"&&(v[S]=v[S]())}_log(v,S,y){this._evalLazyOptionalParams(y),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+S,...y)}trace(v,...S){var y;this._logLevel<=x.LogLevelEnum.TRACE&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.trace.bind(this._optionsService.options.logger))??console.log,v,S)}debug(v,...S){var y;this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.debug.bind(this._optionsService.options.logger))??console.log,v,S)}info(v,...S){var y;this._logLevel<=x.LogLevelEnum.INFO&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.info.bind(this._optionsService.options.logger))??console.info,v,S)}warn(v,...S){var y;this._logLevel<=x.LogLevelEnum.WARN&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.warn.bind(this._optionsService.options.logger))??console.warn,v,S)}error(v,...S){var y;this._logLevel<=x.LogLevelEnum.ERROR&&this._log(((y=this._optionsService.options.logger)==null?void 0:y.error.bind(this._optionsService.options.logger))??console.error,v,S)}};c.LogService=k=f([p(0,x.IOptionsService)],k),c.setTraceLogger=function(v){w=v},c.traceCall=function(v,S,y){if(typeof y.value!="function")throw new Error("not supported");const b=y.value;y.value=function(...E){if(w.logLevel!==x.LogLevelEnum.TRACE)return b.apply(this,E);w.trace(`GlyphRenderer#${b.name}(${E.map((T=>JSON.stringify(T))).join(", ")})`);const N=b.apply(this,E);return w.trace(`GlyphRenderer#${b.name} return`,N),N}}},7302:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const f=d(8460),p=d(844),m=d(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const x=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends p.Disposable{constructor(k){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...c.DEFAULT_OPTIONS};for(const S in k)if(S in v)try{const y=k[S];v[S]=this._sanitizeAndValidateOption(S,y)}catch(y){console.error(y)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(k,v){return this.onOptionChange((S=>{S===k&&v(this.rawOptions[k])}))}onMultipleOptionChange(k,v){return this.onOptionChange((S=>{k.indexOf(S)!==-1&&v()}))}_setupOptions(){const k=S=>{if(!(S in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},v=(S,y)=>{if(!(S in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);y=this._sanitizeAndValidateOption(S,y),this.rawOptions[S]!==y&&(this.rawOptions[S]=y,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const y={get:k.bind(this,S),set:v.bind(this,S)};Object.defineProperty(this.options,S,y)}}_sanitizeAndValidateOption(k,v){switch(k){case"cursorStyle":if(v||(v=c.DEFAULT_OPTIONS[k]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${k}`);break;case"wordSeparator":v||(v=c.DEFAULT_OPTIONS[k]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=x.includes(v)?v:c.DEFAULT_OPTIONS[k];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${k} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${k} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${k} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${k} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}c.OptionsService=_},2660:function(u,c,d){var f=this&&this.__decorate||function(_,w,k,v){var S,y=arguments.length,b=y<3?w:v===null?v=Object.getOwnPropertyDescriptor(w,k):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(_,w,k,v);else for(var E=_.length-1;E>=0;E--)(S=_[E])&&(b=(y<3?S(b):y>3?S(w,k,b):S(w,k))||b);return y>3&&b&&Object.defineProperty(w,k,b),b},p=this&&this.__param||function(_,w){return function(k,v){w(k,v,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=d(2585);let x=c.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const w=this._bufferService.buffer;if(_.id===void 0){const E=w.addMarker(w.ybase+w.y),N={data:_,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(N,E))),this._dataByLinkId.set(N.id,N),N.id}const k=_,v=this._getEntryIdKey(k),S=this._entriesWithId.get(v);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const y=w.addMarker(w.ybase+w.y),b={id:this._nextId++,key:this._getEntryIdKey(k),data:k,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(b,y))),this._entriesWithId.set(b.key,b),this._dataByLinkId.set(b.id,b),b.id}addLineToLink(_,w){const k=this._dataByLinkId.get(_);if(k&&k.lines.every((v=>v.line!==w))){const v=this._bufferService.buffer.addMarker(w);k.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(k,v)))}}getLinkData(_){var w;return(w=this._dataByLinkId.get(_))==null?void 0:w.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,w){const k=_.lines.indexOf(w);k!==-1&&(_.lines.splice(k,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};c.OscLinkService=x=f([p(0,m.IBufferService)],x)},8343:(u,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const d="di$target",f="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(p){return p[f]||[]},c.createDecorator=function(p){if(c.serviceRegistry.has(p))return c.serviceRegistry.get(p);const m=function(x,_,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(k,v,S){v[d]===v?v[f].push({id:k,index:S}):(v[f]=[{id:k,index:S}],v[d]=v)})(m,x,w)};return m.toString=()=>p,c.serviceRegistry.set(p,m),m}},2585:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const f=d(8343);var p;c.IBufferService=(0,f.createDecorator)("BufferService"),c.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),c.ICoreService=(0,f.createDecorator)("CoreService"),c.ICharsetService=(0,f.createDecorator)("CharsetService"),c.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(p||(c.LogLevelEnum=p={})),c.ILogService=(0,f.createDecorator)("LogService"),c.IOptionsService=(0,f.createDecorator)("OptionsService"),c.IOscLinkService=(0,f.createDecorator)("OscLinkService"),c.IUnicodeService=(0,f.createDecorator)("UnicodeService"),c.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(u,c,d)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const f=d(8460),p=d(225);class m{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,w,k=!1){return(16777215&_)<<3|(3&w)<<1|(k?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const _=new p.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let w=0,k=0;const v=_.length;for(let S=0;S<v;++S){let y=_.charCodeAt(S);if(55296<=y&&y<=56319){if(++S>=v)return w+this.wcwidth(y);const N=_.charCodeAt(S);56320<=N&&N<=57343?y=1024*(y-55296)+N-56320+65536:w+=this.wcwidth(N)}const b=this.charProperties(y,k);let E=m.extractWidth(b);m.extractShouldJoin(b)&&(E-=m.extractWidth(k)),w+=E,k=b}return w}charProperties(_,w){return this._activeProvider.charProperties(_,w)}}c.UnicodeService=m}},s={};function a(u){var c=s[u];if(c!==void 0)return c.exports;var d=s[u]={exports:{}};return n[u].call(d.exports,d,d.exports,a),d.exports}var o={};return(()=>{var u=o;Object.defineProperty(u,"__esModule",{value:!0}),u.Terminal=void 0;const c=a(9042),d=a(3236),f=a(844),p=a(5741),m=a(8285),x=a(7975),_=a(7090),w=["cols","rows"];class k extends f.Disposable{constructor(S){super(),this._core=this.register(new d.Terminal(S)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const y=E=>this._core.options[E],b=(E,N)=>{this._checkReadonlyOptions(E),this._core.options[E]=N};for(const E in this._core.options){const N={get:y.bind(this,E),set:b.bind(this,E)};Object.defineProperty(this._publicOptions,E,N)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new x.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const S=this._core.coreService.decPrivateModes;let y="none";switch(this._core.coreMouseService.activeProtocol){case"X10":y="x10";break;case"VT200":y="vt200";break;case"DRAG":y="drag";break;case"ANY":y="any"}return{applicationCursorKeysMode:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:y,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const y in S)this._publicOptions[y]=S[y]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,y=!0){this._core.input(S,y)}resize(S,y){this._verifyIntegers(S,y),this._core.resize(S,y)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,y,b){this._verifyIntegers(S,y,b),this._core.select(S,y,b)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,y){this._verifyIntegers(S,y),this._core.selectLines(S,y)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,y){this._core.write(S,y)}writeln(S,y){this._core.write(S),this._core.write(`\r
|
|
66
|
-
`,y)}paste(S){this._core.paste(S)}refresh(S,y){this._verifyIntegers(S,y),this._core.refresh(S,y)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return c}_verifyIntegers(...S){for(const y of S)if(y===1/0||isNaN(y)||y%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const y of S)if(y&&(y===1/0||isNaN(y)||y%1!=0||y<0))throw new Error("This API only accepts positive integers")}}u.Terminal=k})(),o})()))})(If)),If.exports}var uT=cT();/**
|
|
67
|
-
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
68
|
-
* @license MIT
|
|
69
|
-
*
|
|
70
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
71
|
-
* @license MIT
|
|
72
|
-
*
|
|
73
|
-
* Originally forked from (with the author's permission):
|
|
74
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
75
|
-
* http://bellard.org/jslinux/
|
|
76
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
77
|
-
*/var dT=2,hT=1,fT=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let n=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(n._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var x;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let n=this._terminal.options.scrollback===0?0:((x=this._terminal.options.overviewRuler)==null?void 0:x.width)||14,s=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),c={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},d=c.top+c.bottom,f=c.right+c.left,p=a-d,m=o-f-n;return{cols:Math.max(dT,Math.floor(m/t.css.cell.width)),rows:Math.max(hT,Math.floor(p/t.css.cell.height))}}};function mT({sessionId:e,onClose:t,onEscape:n,autoFocus:s}){const a=R.useRef(null),o=R.useRef(e),u=R.useRef(null),c=R.useRef(null),d=xr(p=>p.writeSession),f=xr(p=>p.resizeSession);return R.useEffect(()=>{o.current=e},[e]),R.useEffect(()=>{if(!n)return;const p=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),n())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[n]),R.useEffect(()=>{if(!a.current)return;const p=new uT.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new fT;p.loadAddon(m),u.current={term:p,fitAddon:m},a.current.addEventListener("keydown",k=>{k.key==="Escape"&&n&&(k.preventDefault(),k.stopPropagation(),n())}),p.open(a.current);const x=a.current.querySelector(".xterm");x&&(x.style.padding="8px"),m.fit(),s&&setTimeout(()=>{p.focus()},150);const _=new ResizeObserver(()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const k=(v=u.current)==null?void 0:v.term;k&&k.cols>0&&k.rows>0&&f(o.current,k.cols,k.rows)})},100)});_.observe(a.current),p.onData(k=>{if(k==="\x1B"&&n){n();return}d(o.current,k)}),p.onKey(k=>{k.key==="\x1B"&&n&&(k.domEvent.stopPropagation(),n())});const w=Pt.subscribe(k=>{const v=k.payload;if(k.type==="terminal.output"&&(v==null?void 0:v.sessionId)===o.current){const S=v==null?void 0:v.data;S&&p.write(S)}});return()=>{w(),_.disconnect(),c.current&&clearTimeout(c.current),p.dispose(),u.current=null}},[e,d,f]),l.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[l.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[l.jsx("div",{}),l.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:l.jsx(yS,{})})]}),l.jsx("div",{ref:a,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:p=>{p.key==="Escape"&&n&&(p.preventDefault(),p.stopPropagation(),n())}})]})}const DS="openfox-chat-textarea";function RS(){const e=document.getElementById(DS);e&&e.focus()}function pT(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function gT({isOpen:e,onClose:t}){const n=xr(w=>w.createSession),s=xr(w=>w.killSession),a=xr(w=>w.sessions),o=xr(w=>w.setWorkdir),u=xr(w=>w.fetchSessions),c=Bt(w=>w.currentProject),[d,f]=R.useState(!0),p=R.useRef(null),m=R.useRef(!1),x=R.useRef(!1),_=R.useCallback(()=>{t()},[t]);return R.useEffect(()=>{c!=null&&c.workdir&&o(c.workdir)},[c==null?void 0:c.workdir,o]),R.useEffect(()=>{e?(f(!0),u(c==null?void 0:c.id).finally(()=>f(!1))):RS()},[e,u,c==null?void 0:c.id]),R.useEffect(()=>{e&&a.length===0&&!d&&!x.current&&(x.current=!0,n(void 0,c==null?void 0:c.id))},[e,a.length,d,n,c==null?void 0:c.id]),R.useEffect(()=>{e?(m.current=!0,setTimeout(()=>{var w;(w=p.current)==null||w.focus(),setTimeout(()=>{m.current=!1},200)},100)):x.current=!1},[e]),R.useEffect(()=>{if(!e)return;const w=k=>{m.current||k.key==="Escape"&&(k.preventDefault(),t())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[e,t]),e?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:_}),l.jsxs("div",{ref:p,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:w=>w.stopPropagation(),onKeyDown:w=>{w.key==="Escape"&&(w.preventDefault(),_())},children:[l.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[l.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:()=>n(void 0,c==null?void 0:c.id),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:l.jsx(jj,{})}),l.jsx("button",{onClick:t,className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:l.jsx(yl,{})})]})]}),l.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:d?l.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):a.length===0?l.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"mb-4",children:"No terminal sessions"}),l.jsx("button",{onClick:()=>n(void 0,c==null?void 0:c.id),className:"px-4 py-2 bg-accent-primary/25 text-text-primary rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):l.jsx("div",{className:`grid ${pT(a.length)} gap-2 h-full auto-rows-fr`,children:a.map(w=>l.jsx(mT,{sessionId:w.id,onClose:()=>s(w.id),onEscape:_,autoFocus:a.length===1},w.id))})})]})]}):null}function vl({items:e,trigger:t,minWidth:n="120px",isOpen:s,onOpenChange:a}){const[o,u]=R.useState(!1),c=s!==void 0,d=c?s:o,f=D=>{if(c){const U=typeof D=="function"?D(o):D;a==null||a(U)}else u(D)},[p,m]=R.useState(null),x=R.useRef(null),_=R.useRef(null),[w,k]=R.useState(0),v=R.useRef(0),S=R.useRef(e),y=R.useCallback(()=>{if(!x.current)return;const D=x.current.getBoundingClientRect(),U=200,B=window.innerHeight-D.bottom<U;m({top:B?D.top-U-4:D.bottom+4,left:D.left,alignToTop:B})},[]);R.useEffect(()=>{S.current=e},[e]),R.useEffect(()=>{function D(U){if(_.current){const F=U.target;_.current.contains(F)||f(!1)}}return d&&document.addEventListener("mousedown",D),()=>{document.removeEventListener("mousedown",D)}},[d]),R.useEffect(()=>{d&&y()},[d,y]),R.useEffect(()=>{if(!d)return;setTimeout(()=>{var U;(U=_.current)==null||U.focus()},0);function D(U){const F=S.current,B=F.filter(W=>!b(W)),Y=E(v.current,F);switch(U.key){case"ArrowDown":if(U.preventDefault(),U.stopPropagation(),Y<B.length-1){const W=N(v.current+1,F);v.current=W,k(W)}break;case"ArrowUp":if(U.preventDefault(),U.stopPropagation(),Y>0){const W=T(v.current-1,F);v.current=W,k(W)}break;case"Enter":U.preventDefault(),U.stopPropagation(),L(v.current,F);break;case"Escape":U.preventDefault(),U.stopPropagation(),f(!1);break}}return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[d,e]);function b(D){var B;const U=D.label;return U?String(((B=U.props)==null?void 0:B.className)??"").includes("cursor-default"):!1}function E(D,U){let F=0;for(let B=0;B<D;B++){const Y=U[B];Y&&!b(Y)&&F++}return F}function N(D,U){for(let F=D;F<U.length;F++){const B=U[F];if(B&&!b(B))return F}return D}function T(D,U){for(let F=D;F>=0;F--){const B=U[F];if(B&&!b(B))return F}return D}function L(D,U){var B;const F=U[D];!F||b(F)||((B=F.onClick)==null||B.call(F),F.href&&(window.history.pushState(null,"",F.href),window.dispatchEvent(new PopStateEvent("popstate"))),f(!1))}R.useEffect(()=>{d&&(k(e.findIndex(D=>!b(D))),v.current=e.findIndex(D=>!b(D)))},[d,e]);const A=D=>{D.stopPropagation(),d||y(),f(!d)},M=p&&l.jsx("div",{ref:_,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${p.alignToTop?"mb-1":"mt-1"}`,style:{top:p.top,left:p.left,minWidth:n},tabIndex:-1,children:e.map((D,U)=>{const B=!b(D)&&U===w,Y=l.jsxs(l.Fragment,{children:[D.icon&&l.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:D.icon}),D.label]});return D.href?l.jsx(Gn,{href:D.href,onClick:W=>{var H;(H=D.onClick)==null||H.call(D,W),f(!1)},onAuxClick:()=>f(!1),className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${D.danger?"text-accent-error hover:bg-accent-error/10":B?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${U!==e.length-1?"border-b border-border":""}`,children:Y},U):l.jsx("button",{onClick:W=>{var H;(H=D.onClick)==null||H.call(D,W),D.closeOnClick!==!1&&f(!1)},className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${D.danger?"text-accent-error hover:bg-accent-error/10":B?"bg-accent-primary/20 text-text-primary":"hover:bg-bg-tertiary text-text-primary"} ${U!==e.length-1?"border-b border-border":""}`,children:Y},U)})});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"relative",children:l.jsx("div",{ref:x,onClick:A,children:t})}),d&&Di.createPortal(M,document.body)]})}function xT({projects:e,currentProject:t}){const n=Bt(u=>u.loadProject),s=Bt(u=>u.toggleStar),o=R.useMemo(()=>{const u=e.filter(d=>d.isStarred).sort((d,f)=>d.name.localeCompare(f.name)),c=e.filter(d=>!d.isStarred).sort((d,f)=>d.name.localeCompare(f.name));return[...u,...c]},[e]).map(u=>({label:l.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[l.jsx("span",{className:"truncate flex-1",children:u.name}),l.jsx("button",{onClick:c=>{c.stopPropagation(),c.preventDefault(),c.nativeEvent.stopImmediatePropagation(),s(u.id,!u.isStarred)},className:"flex-shrink-0 p-1 hover:bg-bg-tertiary rounded transition-colors",title:u.isStarred?"Unstar project":"Star project",children:u.isStarred?l.jsx(Aj,{className:"w-3.5 h-3.5 text-yellow-500"}):l.jsx(Lj,{className:"w-3.5 h-3.5 text-text-muted hover:text-yellow-500"})})]}),icon:u.id===t.id?l.jsx(Or,{}):void 0,href:`/p/${u.id}`,closeOnClick:!0,onClick:()=>{n(u.id)}}));return l.jsx(vl,{items:o,trigger:l.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:t.name,children:[t.name,l.jsx(Mr,{})]}),minWidth:"250px"})}function OS(e){const t=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.getDay()],a=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),u=String(t.getDate()).padStart(2,"0");return`${s} ${a}/${o}/${u}`}function Fu(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${n}:${s}`}function _T(e){const t=new Date(e),n=new Date,s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=Math.floor((s.getTime()-a.getTime())/(1e3*60*60*24)),u=Fu(e);if(o===0)return`today ${u}`;if(o===1)return`yesterday ${u}`;if(o<7)return`${o} days ago ${u}`;{const c=t.getFullYear(),d=String(t.getMonth()+1).padStart(2,"0"),f=String(t.getDate()).padStart(2,"0");return`${c}/${d}/${f} ${u}`}}function MS(e){const t=new Date(e);return{year:t.getFullYear(),month:String(t.getMonth()+1).padStart(2,"0"),day:String(t.getDate()).padStart(2,"0")}}function yT(e){const{year:t,month:n,day:s}=MS(e);return`${t}-${n}-${s}`}function IS(e){const t=new Map;for(const a of e){const o=yT(a.updatedAt);t.has(o)||t.set(o,[]),t.get(o).push(a)}for(const[a,o]of t)o.sort((u,c)=>{const d=new Date(u.updatedAt).getTime();return new Date(c.updatedAt).getTime()-d});const n=Array.from(t.keys()).sort((a,o)=>o.localeCompare(a)),s=new Map;for(const a of n)s.set(a,t.get(a));return s}function vT({sessions:e,currentProject:t,currentSession:n,isOpen:s,onOpenChange:a}){var p;const o=we(m=>m.loadSession),u=e.filter(m=>m.projectId===t.id).slice(0,15),c=IS(u),d=R.useMemo(()=>{const m=[];m.push({label:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(qs,{className:"w-4 h-4 text-accent-primary"}),l.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${t.id}/new`,onClick:()=>{}});for(const[x,_]of c){const w=_[0];if(w){m.push({label:l.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:OS(w.updatedAt)}),onClick:()=>{}});for(const k of _)m.push({label:l.jsxs("div",{className:"min-w-[160px]",children:[l.jsx("div",{className:"truncate text-sm",children:k.title??k.id.slice(0,8)}),l.jsx("div",{className:"text-text-muted text-xs",children:Fu(k.updatedAt)})]}),icon:k.id===(n==null?void 0:n.id)?l.jsx(Or,{}):void 0,href:`/p/${t.id}/s/${k.id}`,onClick:()=>{o(k.id)}})}}return m},[t.id,c,n==null?void 0:n.id]),f=n?((p=n.metadata)==null?void 0:p.title)??n.id.slice(0,8):"No session selected";return l.jsx(vl,{items:d,isOpen:s,onOpenChange:a,trigger:l.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:f,"data-testid":"header-session-dropdown",children:[f,l.jsx(Mr,{})]}),minWidth:"280px"})}function bT({items:e,trigger:t,isActive:n=!1}){const[s,a]=R.useState(!1),o=R.useRef(null);return R.useEffect(()=>{function u(c){o.current&&!o.current.contains(c.target)&&a(!1)}if(s)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),l.jsxs("div",{className:"relative",ref:o,children:[l.jsxs("button",{type:"button",onClick:()=>a(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${n?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof t=="string"?l.jsx("span",{className:"text-sm text-text-secondary font-medium",children:t}):t,l.jsx(Mr,{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",rotate:s?180:0})]}),s&&e.length>0&&l.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((u,c)=>{const d=u.label&&typeof u.label=="object"&&u.label.type===Gn?u.label:null;if(d){const f=d.props.href||"";return l.jsxs(Gn,{href:f,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[u.icon,d.props.children]},c)}return u.href?l.jsxs("a",{href:u.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[u.icon,u.label]},c):l.jsxs("button",{type:"button",onClick:()=>{var f;(f=u.onClick)==null||f.call(u),a(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[u.icon,u.label]},c)})})]})}function ST({currentProject:e,sessions:t,currentSession:n,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const a=t.filter(u=>u.projectId===e.id).sort((u,c)=>new Date(c.updatedAt).getTime()-new Date(u.updatedAt).getTime()).slice(0,5),o=[{label:l.jsxs(Gn,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[l.jsx(qs,{className:"w-3 h-3 text-accent-primary"}),l.jsx("span",{className:"text-sm",children:"New Session"})]})},...a.map(u=>({label:l.jsx(Gn,{href:`/p/${e.id}/s/${u.id}`,className:"flex items-center gap-2 truncate text-sm",children:l.jsx("span",{children:u.title??u.id.slice(0,8)})}),icon:u.id===(n==null?void 0:n.id)?l.jsx(Or,{className:"w-3 h-3"}):void 0})),{label:l.jsxs(Gn,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[l.jsx(xj,{className:"w-3 h-3"}),l.jsx("span",{className:"text-sm",children:"Projects"})]})}];return l.jsx(bT,{items:o,trigger:l.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function wT({onMenuClick:e,onCriteriaToggle:t}){const[n,s]=R.useState(!1),[a,o]=R.useState(!1),[u,c]=R.useState(!!document.fullscreenElement);R.useEffect(()=>{const E=()=>c(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",E),()=>document.removeEventListener("fullscreenchange",E)},[]);const[d]=br(),f=d.startsWith("/p/"),p=/^\/p\/[^/]+\/s\/[^/]+$/.test(d),m=we(E=>E.currentSession),x=we(E=>E.sessions),_=Bt(E=>E.currentProject),w=Bt(E=>E.projects),k=Ot(E=>E.startAutoRefresh),v=Ot(E=>E.stopAutoRefresh),S=xr(E=>E.setOpen),y=xr(E=>E.isOpen);R.useEffect(()=>{const E=()=>o(!0);return window.addEventListener("open-session-dropdown",E),()=>window.removeEventListener("open-session-dropdown",E)},[]);const b=mp();return wS(b.terminalToggle,()=>{xr.getState().toggleOpen()},{capture:!0}),R.useEffect(()=>(k(),()=>v()),[k,v]),l.jsxs("header",{className:"h-8 bg-secondary border-b border-border flex items-center justify-between px-2",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&f&&l.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:l.jsx(Mv,{})}),l.jsx(Gn,{href:"/",className:"text-accent-primary font-semibold text-sm hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),_&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),l.jsx("span",{className:"hidden md:inline",children:l.jsx(xT,{projects:w,currentProject:_})}),l.jsx("span",{className:"md:hidden",children:l.jsx(ST,{currentProject:_,sessions:x,currentSession:m,projectIdFromUrl:f&&d.split("/")[2]||null},_==null?void 0:_.id)}),l.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),l.jsx("span",{className:"hidden md:inline",children:l.jsx(vT,{sessions:x,currentProject:_,currentSession:m,isOpen:a,onOpenChange:o})})]})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[p&&l.jsx("button",{onClick:()=>{var E,N,T;document.fullscreenElement?(E=document.exitFullscreen)==null||E.call(document):(T=(N=document.documentElement).requestFullscreen)==null||T.call(N)},className:"max-sm:block hidden p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:u?"Exit fullscreen":"Enter fullscreen",children:u?l.jsx(bj,{}):l.jsx(Sj,{})}),f&&l.jsx("button",{onClick:()=>S(!y),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${y?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (double Ctrl)",children:l.jsx(Rj,{})}),l.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:l.jsx(Tj,{})}),l.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:l.jsx(Cj,{})}),t&&p&&l.jsx("button",{onClick:t,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle sidebar",children:l.jsx(Mv,{})})]}),l.jsx(lT,{isOpen:n,onClose:()=>s(!1)}),l.jsx(gT,{isOpen:y,onClose:()=>S(!1)})]})}function CT({onCancel:e,onSave:t,saving:n,saveDisabled:s,cancelLabel:a="Cancel",saveLabel:o=n?"Saving...":"Save"}){return l.jsxs("div",{className:"flex justify-end gap-2 flex-shrink-0",children:[l.jsx(Je,{variant:"secondary",onClick:e,children:a}),l.jsx(Je,{variant:"primary",onClick:t,disabled:s??n,children:o})]})}function kT({isOpen:e,onClose:t,project:n}){const s=Bt(E=>E.updateProject),a=()=>{try{Pt.send("context.checkDynamic",{})}catch{}t()},[o,u]=R.useState(n.customInstructions??""),[c,d]=R.useState(n.dangerLevel??""),[f,p]=R.useState(!1),[m,x]=R.useState(!1),[_,w]=R.useState(!1),k=f||m;R.useEffect(()=>{u(n.customInstructions??""),d(n.dangerLevel??""),p(!1),x(!1)},[n]);const v=E=>{u(E.target.value),p(!0)},S=E=>{d(E),x(!0)},y=async()=>{w(!0);const E=c===""?null:c;await s(n.id,{customInstructions:o||null,dangerLevel:E}),w(!1),p(!1),x(!1),a()},b=()=>{u(n.customInstructions??""),d(n.dangerLevel??""),p(!1),x(!1),a()};return l.jsx(kt,{isOpen:e,onClose:b,title:`${n.name} Settings`,size:"lg",footer:l.jsx(CT,{onCancel:b,onSave:y,saving:_,saveDisabled:!k||_}),children:l.jsxs("div",{className:"flex flex-col gap-5 -mt-1",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Default Danger Level"}),l.jsx("p",{className:"text-sm text-text-muted mb-3",children:"Default danger level for new sessions in this project. Existing sessions are not affected."}),l.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1 rounded bg-bg-tertiary/50 w-fit",children:[l.jsx("button",{type:"button",onClick:()=>S(""),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c===""?"bg-bg-tertiary text-text-primary border border-border":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Use global default (Normal)",children:"Default"}),l.jsx("button",{type:"button",onClick:()=>S("normal"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c==="normal"?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),l.jsx("button",{type:"button",onClick:()=>S("dangerous"),className:`px-3 py-1 text-sm font-medium rounded transition-colors ${c==="dangerous"?"bg-red-500/20 text-red-400 border border-red-500/30":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Path"}),l.jsx("p",{className:"text-sm text-text-muted font-mono",children:n.workdir})]}),l.jsxs("div",{className:"flex-1 min-h-[150px] pb-4",children:[l.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:"Project Instructions"}),l.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files."}),l.jsx("textarea",{value:o,onChange:v,placeholder:"Enter project-specific instructions...",className:"w-full h-full px-3 py-2 mb-3 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:_})]})]})})}const ET={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"},jT="M6 18L18 6M6 6l12 12";function bl({onClick:e,className:t="",size:n="md",variant:s="default"}){const a=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return l.jsx($u,{onClick:e,icon:jT,iconSize:ET[n],className:`${a} ${t}`,title:"Close"})}function PS({projectId:e,isOpen:t=!0,onClose:n}){const[,s]=br(),[a,o]=R.useState(!1),u=we(N=>N.sessions),c=we(N=>N.currentSession),d=we(N=>N.unreadSessionIds),f=we(N=>N.deleteSession),p=we(N=>N.deleteAllSessions),m=we(N=>N.loadMoreSessions),x=we(N=>N.sessionsHasMore),_=we(N=>N.sessionsPaginationLoading),w=Bt(N=>N.currentProject),k=R.useRef(null),v=R.useCallback(()=>{x&&!_&&w&&m(w.id)},[x,_,w,m]);R.useEffect(()=>{if(!k.current||!x)return;const N=new IntersectionObserver(T=>{const L=T[0];L&&L.isIntersecting&&v()},{threshold:.1});return N.observe(k.current),()=>N.disconnect()},[x,v]);const S=u.filter(N=>N.projectId===(w==null?void 0:w.id)),y=(N,T)=>{T==null||T.stopPropagation(),confirm("Delete this session?")&&(f(N),(c==null?void 0:c.id)===N&&s(`/p/${e}`))},b=(N,T)=>{T==null||T.stopPropagation();const L=u.find(D=>D.id===N),A=(L==null?void 0:L.title)??N.slice(0,6),M=prompt("Rename session:",A);if(M!==null&&M.trim()!==""){const D=we.getState().renameSession;D(N,M.trim())}},E=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(p(e),s(`/p/${e}`))};return l.jsxs(l.Fragment,{children:[t&&n&&l.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:n}),l.jsxs("aside",{className:`
|
|
78
|
-
${t?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
|
|
79
|
-
md:relative md:h-auto md:translate-x-0
|
|
80
|
-
|
|
81
|
-
fixed z-50 h-[calc(100vh-32px)]
|
|
82
|
-
w-[300px] bg-secondary border-r border-border flex flex-col
|
|
83
|
-
transition-all duration-300 ease-in-out
|
|
84
|
-
${t?"translate-x-0":"-translate-x-full"}
|
|
85
|
-
`,children:[l.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[l.jsx(Gn,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),l.jsx(vl,{items:[{label:"Edit project settings",onClick:()=>o(!0)},{label:"Delete all sessions",onClick:E,danger:!0}],trigger:l.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:l.jsx(up,{})})}),n&&l.jsx(bl,{onClick:n,className:"md:hidden",variant:"sidebar",size:"md"})]}),w&&l.jsx(kT,{isOpen:a,onClose:()=>o(!1),project:w}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:S.length===0?l.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"divide-y divide-border",children:TT(S,c,d,y,b,e)}),_&&l.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),l.jsx("div",{ref:k,className:"h-px"})]})})]})]})}function TT(e,t,n,s,a,o){const u=IS(e);return Array.from(u).map(([c,d])=>{const f=d[0];return f?l.jsxs("div",{children:[l.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:OS(f.updatedAt)}),d.map(p=>{const m=(t==null?void 0:t.id)===p.id,x=n.includes(p.id),_=p.isRunning;return l.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${m?"bg-bg-tertiary":""}`,children:l.jsxs(Gn,{href:`/p/${o}/s/${p.id}`,className:`block ${m?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[l.jsxs("div",{className:"flex justify-between items-center mb-1",children:[l.jsx("span",{className:`font-medium truncate text-sm ${m?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),l.jsx(vl,{items:[{label:"Rename session",onClick:w=>a(p.id,w)},{label:"Delete session",onClick:w=>s(p.id,w),danger:!0}],trigger:l.jsx("button",{onClick:w=>w.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:l.jsx(up,{})})})]}),l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[_?l.jsx(Nj,{}):x&&!m?l.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,l.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Fu(p.updatedAt)}),l.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},c):null})}const Vv=["⠋","⠙","⠹","⠸","⠼","⠴"];function NT(){var c;const e=Bt(d=>d.currentProject),t=we(d=>d.currentSession),n=Hu(),s=!1,a=R.useRef(0),o=R.useRef(null);R.useEffect(()=>(n?(o.current=window.setInterval(()=>{a.current=(a.current+1)%Vv.length,u()},150),u()):(o.current&&(clearInterval(o.current),o.current=null),u()),()=>{o.current&&(clearInterval(o.current),o.current=null)}),[n,e,t,s]);const u=()=>{var m;const f=(m=t==null?void 0:t.metadata)==null?void 0:m.title,p=n?`${Vv[a.current]} `:"";e&&f?document.title=`${p}${e.name} - ${f} | OpenFox`:e?document.title=`${p}${e.name} | OpenFox`:document.title=`${p}OpenFox`};return typeof window<"u"&&((c=t==null?void 0:t.metadata)!=null&&c.title)&&window.document.documentElement.setAttribute("data-session-title",t.metadata.title),null}function BS(e,t=28){if(e.length<=t)return e;const n=e.split("/").filter(Boolean);if(n.length<=2)return e;const s=n[0],a=n[n.length-1],o=n.slice(1,-1).join("/"),u=t-s.length-a.length-3;if(u<0)return e;const c=o.slice(0,Math.floor(u/2)),d=o.slice(-Math.ceil(u/2));return`/${s}/${c}...${d}/${a}`}function zS({isOpen:e,onClose:t,projectName:n,onConfirm:s}){const a=()=>{s(),t()};return l.jsx(kt,{isOpen:e,onClose:t,title:"Delete Project",size:"sm",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project"," ",l.jsx("span",{className:"font-semibold text-text-primary",children:n})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{variant:"secondary",onClick:t,children:"Cancel"}),l.jsx(Je,{variant:"danger",onClick:a,children:"Delete"})]})]})})}const Vu=R.forwardRef(({className:e="",...t},n)=>l.jsx("input",{ref:n,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...t}));Vu.displayName="Input";function AT(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function HS({isOpen:e,onClose:t,path:n,onRetry:s}){const[a,o]=R.useState(!1),[u,c]=R.useState(null),[d,f]=R.useState(null);R.useEffect(()=>{e&&p()},[e]);const p=async()=>{try{const E=await(await Te("/api/projects/check-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})})).json();f({sudoAvailable:E.sudoAvailable,userInGroup:E.userInGroup,groupHasWrite:E.groupHasWrite,groupName:E.groupName||null})}catch{f({sudoAvailable:!1,userInGroup:!1,groupHasWrite:!1,groupName:null})}},m=R.useCallback(async b=>{o(!0),c(null);try{const N=await(await Te("/api/projects/fix-permissions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n,action:b})})).json();N.success?(s(),t()):N.sudoAvailable?c("Failed to fix permissions: "+(N.error||"Unknown error")):c(`Passwordless sudo is not available. Please fix permissions manually:
|
|
86
|
-
|
|
87
|
-
`+(b==="group"?`sudo chmod g+w "${n}"`:"sudo usermod -aG <group> $USER"))}catch(E){c("Failed to fix permissions: "+(E instanceof Error?E.message:"Unknown error"))}finally{o(!1)}},[n,s,t]),x=(d==null?void 0:d.userInGroup)??!1,_=(d==null?void 0:d.groupHasWrite)??!1,w=(d==null?void 0:d.sudoAvailable)??!1,k=(d==null?void 0:d.groupName)??"",v=x&&!_,S=!x&&_,y=!x&&!_;return l.jsx(kt,{isOpen:e,onClose:t,title:"Permission Denied",size:"sm",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"text-sm text-text-secondary",children:[l.jsx("p",{children:v?l.jsxs(l.Fragment,{children:["The group ",l.jsx("strong",{children:k})," doesn't have write access:"]}):S?l.jsxs(l.Fragment,{children:["You're not a member of group ",l.jsx("strong",{children:k}),":"]}):l.jsxs(l.Fragment,{children:["You're not a member of group ",l.jsx("strong",{children:k})," and it doesn't have write access:"]})}),l.jsx("p",{className:"mt-2 font-mono text-xs bg-bg-tertiary p-2 rounded break-all",children:n})]}),u?l.jsx("div",{className:"p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error whitespace-pre-wrap",children:u}):d?l.jsxs("div",{className:"flex flex-col gap-2",children:[v&&l.jsxs(l.Fragment,{children:[l.jsx(Je,{type:"button",variant:"primary",onClick:()=>m("group"),disabled:a||!w,className:"w-full",children:a?"Granting access...":"Extend group permissions"}),l.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),l.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',n,'"']})]}),S&&l.jsxs(l.Fragment,{children:[l.jsx(Je,{type:"button",variant:"primary",onClick:()=>m("join_group"),disabled:a||!w,className:"w-full",children:a?"Joining group...":"Join group"}),l.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),l.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",k," $USER"]})]}),y&&l.jsxs(l.Fragment,{children:[l.jsx(Je,{type:"button",variant:"primary",onClick:()=>m("join_group_and_group"),disabled:a||!w,className:"w-full",children:a?"Joining group...":"Join group & grant write permissions"}),l.jsx("div",{className:"text-xs text-text-secondary",children:"Or manually execute:"}),l.jsxs("code",{className:"text-xs text-text-muted p-2 bg-bg-tertiary rounded break-all",children:["sudo usermod -aG ",k," $USER",l.jsx("br",{}),'sudo chmod g+w "',n,'"']})]}),!w&&!u&&l.jsxs("div",{className:"text-xs text-text-secondary",children:[l.jsx("p",{children:"Passwordless sudo is not available. Please fix permissions manually:"}),l.jsxs("code",{className:"block mt-1 p-2 bg-bg-tertiary rounded break-all",children:['sudo chmod g+w "',n,'"']})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Je,{type:"button",variant:"secondary",onClick:t,disabled:a,children:"Cancel"})})]}):null]})})}function LT({isOpen:e,onClose:t}){const[,n]=br(),[s,a]=R.useState(""),[o,u]=R.useState(null),[c,d]=R.useState(!1),[f,p]=R.useState(""),[m,x]=R.useState(null),_=R.useRef(null);R.useEffect(()=>{e&&(Te("/api/config").then(E=>E.json()).then(E=>{E.workdir&&p(E.workdir)}),a(""),u(null),d(!1),x(null),setTimeout(()=>{var E;(E=_.current)==null||E.focus()},100))},[e]);const w=R.useCallback(async E=>{E.preventDefault();const N=AT(s);if(!N.valid){u(N.error);return}const T=`${f}/${s}`;await S(T)},[s,n,t,f]),k=R.useCallback(()=>{x(null)},[]),v=R.useCallback(async()=>{const E=`${f}/${s}`;await S(E)},[f,s,n,t,x,u,d]);async function S(E){d(!0),u(null),x(null);try{const N=await Te("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:E})});if(!N.ok){const A=await N.json().catch(()=>({}));if(A.code==="EACCES"){x(E),d(!1);return}throw new Error(A.error||"Failed to create project")}const L=(await N.json()).project;t(),n(`/p/${L.id}`)}catch(N){u(N instanceof Error?N.message:"Failed to create project"),d(!1)}}const y=R.useCallback(()=>{a(""),u(null),t()},[t]),b=s?`${f}/${s}`:"";return l.jsxs(l.Fragment,{children:[l.jsx(kt,{isOpen:e,onClose:y,title:"Create New Project",size:"sm",children:l.jsxs("form",{onSubmit:w,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),l.jsx(Vu,{ref:_,id:"project-name",value:s,onChange:E=>{a(E.target.value),u(null)},placeholder:"my-project",disabled:c,"data-testid":"create-project-name-input",className:"w-full"}),s&&l.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",l.jsx("span",{className:"font-mono",children:b})]}),o&&l.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:o})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{type:"button",variant:"secondary",onClick:y,disabled:c,children:"Cancel"}),l.jsx(Je,{type:"submit",variant:"primary",disabled:c||!s.trim(),"data-testid":"create-project-submit-button",className:"min-w-[100px]",children:c?l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(qs,{className:"h-4 w-4"}),"Creating..."]}):"Create"})]})]})}),m&&l.jsx(HS,{isOpen:!!m,onClose:k,path:m,onRetry:v})]})}const DT={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Sl({size:e="md",className:t=""}){return l.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${DT[e]} ${t}`})}function RT({text:e,...t}){return l.jsxs("div",{className:"text-center",children:[l.jsx(Sl,{...t,className:"mx-auto mb-4"}),e&&l.jsx("div",{className:"text-text-secondary",children:e})]})}function $S({onSelect:e,onClose:t,initialPath:n}){const[s,a]=R.useState(null),[o,u]=R.useState(!0),[c,d]=R.useState(""),[f,p]=R.useState(-1),m=R.useRef(null),x=R.useRef([]),_=R.useCallback(async y=>{u(!0),d(""),p(-1);try{const b=y?`/api/directories?path=${encodeURIComponent(y)}`:"/api/directories",N=await(await Te(b)).json();a(N)}catch(b){console.error("Failed to load directories:",b)}finally{u(!1)}},[]);R.useEffect(()=>{_(n)},[n,_]);const w=((s==null?void 0:s.current)??"").split("/").filter(Boolean).map((y,b,E)=>({name:y,path:"/"+E.slice(0,b+1).join("/")})),k=(s==null?void 0:s.directories.filter(y=>c===""||y.name.toLowerCase().includes(c.toLowerCase())))??[],v=[...s!=null&&s.parent?[{type:"parent",path:s.parent,name:".."}]:[],...k.map(y=>({type:"dir",path:y.path,name:y.name}))];R.useEffect(()=>{p(c?0:-1)},[c,k.length]),R.useEffect(()=>{var y;f>=0&&x.current[f]&&((y=x.current[f])==null||y.scrollIntoView({block:"nearest"}))},[f]);const S=y=>{var b;if(y.key==="ArrowDown")y.preventDefault(),p(E=>Math.min(E+1,v.length-1));else if(y.key==="ArrowUp")y.preventDefault(),p(E=>Math.max(E-1,0));else if(y.key==="Enter"){if(y.preventDefault(),f>=0&&v[f]){const E=v[f];E.type,_(E.path)}}else y.key==="Escape"&&(d(""),(b=m.current)==null||b.focus())};return l.jsxs(kt,{isOpen:!0,onClose:t,title:"Select Folder",size:"lg",children:[s&&l.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 -mx-4 -mt-4 mb-4 border-b border-border",children:l.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[w.map((y,b)=>l.jsxs("span",{className:"flex items-center shrink-0",children:[l.jsx("span",{className:"text-text-muted",children:"/"}),l.jsx("button",{onClick:()=>_(y.path),className:`px-1 ${b===w.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:y.name})]},y.path)),w.length===0&&l.jsx("button",{onClick:()=>_("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),l.jsx("div",{className:"px-4 mb-3",children:l.jsxs("div",{className:"relative",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-text-muted pointer-events-none flex items-center justify-center",children:l.jsx(fp,{})}),l.jsx(Vu,{autoFocus:!0,ref:m,value:c,onChange:y=>d(y.target.value),onKeyDown:S,placeholder:"Filter directories...",className:"w-full pl-9"})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto -mx-4",children:o?l.jsx("div",{className:"p-8 text-center",children:l.jsx(Sl,{size:"sm"})}):v.length===0?l.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:c?"No matching directories":"No subdirectories"}):l.jsx("div",{className:"divide-y divide-border",children:v.map((y,b)=>l.jsxs("button",{ref:E=>{x.current[b]=E},onClick:()=>_(y.path),onDoubleClick:()=>e(y.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${b===f?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[y.type==="parent"?l.jsx(pj,{className:"w-5 h-5 text-text-muted"}):l.jsx(dp,{className:"w-5 h-5"}),l.jsx("span",{className:"flex-1",children:y.name}),b===f&&l.jsx("span",{className:"text-xs text-text-muted",children:"⏎ navigate · dbl-click select"})]},y.path))})}),l.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border mt-4 -mx-4 -mb-4 p-4",children:[(s==null?void 0:s.current)&&l.jsx("button",{onClick:()=>e(s.current),className:"w-full px-4 py-2 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),l.jsx("button",{onClick:t,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})}function OT({isOpen:e,onClose:t}){const[,n]=br(),[s,a]=R.useState(!1),[o,u]=R.useState(null),[c,d]=R.useState(!1),f=Bt(D=>D.projects),p=Bt(D=>D.createProject),m=Bt(D=>D.listProjects),x=Bt(D=>D.deleteProject),[_,w]=R.useState(null),[k,v]=R.useState(null),[S,y]=R.useState(null);R.useEffect(()=>{Te("/api/config").then(D=>D.json()).then(D=>{D.workdir&&u(D.workdir)})},[]),R.useEffect(()=>{e&&m()},[e,m]);const b=D=>{n(`/p/${D}`),t()},E=(D,U)=>{U.stopPropagation(),w(D)},N=()=>{_&&(x(_.id),w(null))},T=async D=>{const U=D.split("/").filter(Boolean).pop()??"",F=await p(U,D);return m(),v(D),L(F)?(y(F.error.path||D),!1):!0};function L(D){return D!=null&&typeof D=="object"&&"error"in D&&D.error!=null&&typeof D.error=="object"&&"code"in D.error&&D.error.code==="EACCES"}const A=R.useCallback(()=>{y(null)},[]),M=R.useCallback(async()=>{if(y(null),k){const D=k.split("/").filter(Boolean).pop()??"",U=await p(D,k);m(),v(k),L(U)&&y(U.error.path||k)}},[k,p,m,y]);return R.useEffect(()=>{if(k){const D=f.find(U=>U.workdir===k);D&&(n(`/p/${D.id}`),t(),v(null))}},[f,k,n,t]),e?l.jsxs(kt,{isOpen:e,onClose:t,title:"Open Project",size:"xl",footer:l.jsx("div",{className:"flex justify-end gap-2",children:l.jsx(Je,{variant:"secondary",onClick:t,children:"Close"})}),children:[l.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 -m-4",children:[l.jsxs("div",{className:"w-full sm:w-1/2 border-b sm:border-b-0 sm:border-r border-border flex flex-col max-h-[40vh] sm:max-h-[50vh]",children:[l.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 shrink-0",children:l.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),l.jsx("div",{className:"flex-1 overflow-y-auto",children:f.length===0?l.jsxs("div",{className:"p-6 text-center text-text-muted text-sm",children:[l.jsx("p",{className:"mb-2",children:"No recent projects"}),l.jsx("p",{className:"text-xs",children:'Click "Create new project" to add one'})]}):l.jsx("div",{className:"divide-y divide-border",children:f.map(D=>l.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[l.jsxs("button",{onClick:()=>b(D.id),className:"flex-1 flex items-center gap-3 text-left",children:[l.jsx(dp,{className:"w-5 h-5 text-accent-primary"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium truncate",children:D.name}),l.jsx("div",{className:"text-xs text-text-muted truncate",children:BS(D.workdir,32)})]})]}),l.jsx("button",{onClick:U=>E(D,U),className:"text-accent-error/70 hover:text-accent-error p-1",title:"Delete project",children:l.jsx(_l,{className:"w-4 h-4"})})]},D.id))})})]}),l.jsx("div",{className:"w-full sm:w-1/2 flex flex-col items-center justify-center p-6 sm:p-8 text-center",children:l.jsxs("div",{className:"flex flex-col gap-3 w-full max-w-sm",children:[l.jsx(Je,{variant:"primary",onClick:()=>d(!0),children:"Select existing project"}),l.jsx(Je,{variant:"secondary",onClick:()=>a(!0),"data-testid":"open-project-create-button",children:"Create new project"})]})})]}),s&&l.jsx(LT,{isOpen:s,onClose:()=>a(!1)}),_&&l.jsx(zS,{isOpen:!0,onClose:()=>w(null),projectName:_.name,onConfirm:N}),c&&l.jsx($S,{initialPath:o??void 0,onSelect:D=>{T(D).then(U=>{U&&d(!1)})},onClose:()=>d(!1)}),S&&l.jsx(HS,{isOpen:!0,onClose:A,path:S,onRetry:M})]}):null}function MT(){const[e,t]=R.useState(!1),[n,s]=R.useState(null),a=we(w=>w.sessions),o=Bt(w=>w.projects),u=Bt(w=>w.loading),c=Bt(w=>w.listProjects),d=we(w=>w.listSessions),f=Bt(w=>w.deleteProject),p=we(w=>w.connectionStatus);R.useEffect(()=>{p==="connected"&&(c(),d())},[p,c,d]);const m=[...o].sort((w,k)=>{const v=a.filter(E=>E.workdir.startsWith(w.workdir)),S=a.filter(E=>E.workdir.startsWith(k.workdir)),y=v.length>0?new Date(v.reduce((E,N)=>new Date(N.updatedAt)>new Date(E.updatedAt)?N:E).updatedAt).getTime():new Date(w.updatedAt).getTime();return(S.length>0?new Date(S.reduce((E,N)=>new Date(N.updatedAt)>new Date(E.updatedAt)?N:E).updatedAt).getTime():new Date(k.updatedAt).getTime())-y}),x=w=>{const k=o.find(v=>v.id===w);return k?a.filter(v=>v.workdir.startsWith(k.workdir)).sort((v,S)=>new Date(S.updatedAt).getTime()-new Date(v.updatedAt).getTime()).slice(0,5):[]},_=()=>{t(!0)};return l.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto bg-primary",children:[l.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[l.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),l.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),l.jsx(Je,{variant:"primary",onClick:_,children:"Open Project"})]}),m.map(w=>{const k=x(w.id);return l.jsx("div",{className:"mb-6 md:mb-8",children:l.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[l.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[l.jsxs(Gn,{href:`/p/${w.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[l.jsx(dp,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),l.jsx("span",{className:"text-text-primary font-semibold",children:w.name})]}),l.jsx(Gn,{href:`/p/${w.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"}),l.jsx("button",{type:"button",onClick:()=>s({id:w.id,name:w.name}),className:"p-1.5 rounded text-text-muted hover:text-accent-error hover:bg-accent-error/10 transition-colors",title:"Delete project",children:l.jsx(_l,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"divide-y divide-border",children:k.length>0?k.map(v=>{const S=o.find(b=>v.workdir.startsWith(b.workdir)),y=S?`/p/${S.id}/s/${v.id}`:"#";return l.jsx(Gn,{href:y,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx("div",{className:"text-sm text-text-muted truncate",children:v.title??v.id.slice(0,8)})})}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l.jsx("span",{className:"text-text-muted text-xs",children:_T(v.updatedAt)}),l.jsxs("span",{className:"text-text-muted text-xs",children:[v.messageCount," msgs"]})]})]})},v.id)}):l.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},w.id)}),m.length===0&&!u&&l.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."}),u&&l.jsx("div",{className:"flex justify-center py-12",children:l.jsx(Sl,{})})]}),e&&l.jsx(OT,{isOpen:e,onClose:()=>t(!1)}),n&&l.jsx(zS,{isOpen:!0,onClose:()=>s(null),projectName:n.name,onConfirm:()=>f(n.id)})]})}function IT(){const[,e]=lp("/p/:projectId/new"),[,t]=br(),n=e==null?void 0:e.projectId,s=we(u=>u.createSession),a=we(u=>u.resetPendingSessionCreate),o=R.useCallback(async()=>{if(!n)return;const u=await s(n);u?(t(`/p/${n}/s/${u.id}`),a()):(t(`/p/${n}`),a())},[n,s,t,a]);return R.useEffect(()=>{o()},[o]),l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Sl,{})})}function PT(){const e=Bt(t=>t.currentProject);return l.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:l.jsxs("div",{className:"max-w-md",children:[l.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),l.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),l.jsxs("div",{className:"flex flex-col gap-3",children:[e&&l.jsx(Gn,{href:`/p/${e.id}/new`,"data-testid":"create-new-session-button",className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),l.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const Vo=e=>Math.round(e*10)/10;function BT(e){return typeof e.totalTime=="number"&&!Number.isNaN(e.totalTime)}function Tm(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function zT(e){return`${e.providerId}::${e.model}`}function HT(e){return`${e.providerName} > ${e.model}`}function Gv(e){let t=0,n=0,s=0,a=0,o=0,u=0;const c=[],d=[];let f=0;for(const[x,_]of e.entries()){const w=_.stats,k=Tm(w);t+=w.totalTime,n+=w.toolTime,s+=w.prefillTokens,a+=w.generationTokens;const v=w.prefillSpeed>0?w.prefillTokens/w.prefillSpeed:0,S=w.generationSpeed>0?w.generationTokens/w.generationSpeed:0;o+=v,u+=S,c.push({messageId:_.id,timestamp:_.timestamp,...k,mode:w.mode,responseIndex:x+1,prefillTokens:w.prefillTokens,generationTokens:w.generationTokens,prefillSpeed:w.prefillSpeed,generationSpeed:w.generationSpeed,totalTime:w.totalTime,aiTime:w.totalTime-w.toolTime,toolTime:w.toolTime});const y=w.llmCalls??[];for(const b of y)f+=1,d.push({messageId:_.id,timestamp:b.timestamp??_.timestamp,providerId:b.providerId,providerName:b.providerName,backend:b.backend,model:b.model,mode:w.mode,responseIndex:x+1,sessionCallIndex:f,callIndex:b.callIndex,promptTokens:b.promptTokens,completionTokens:b.completionTokens,ttft:b.ttft,completionTime:b.completionTime,prefillSpeed:b.prefillSpeed,generationSpeed:b.generationSpeed,totalTime:b.totalTime,...b.temperature!==void 0&&{temperature:b.temperature},...b.topP!==void 0&&{topP:b.topP},...b.topK!==void 0&&{topK:b.topK},...b.maxTokens!==void 0&&{maxTokens:b.maxTokens}})}const p=o>0?Vo(s/o):0,m=u>0?Vo(a/u):0;return{totalTime:Vo(t),aiTime:Vo(t-n),toolTime:Vo(n),prefillTokens:s,generationTokens:a,avgPrefillSpeed:p,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:c,callDataPoints:d}}function $T(e){const t=e.filter(a=>a.stats!==void 0&&a.stats!==null&&BT(a.stats)).sort((a,o)=>new Date(a.timestamp).getTime()-new Date(o.timestamp).getTime());if(t.length===0)return null;const n=new Map;for(const a of t){const o=zT(Tm(a.stats)),u=n.get(o)??[];n.set(o,[...u,a])}const s=Array.from(n.entries()).map(([a,o])=>{const u=Tm(o[0].stats),c=Gv(o);return{...u,key:a,label:HT(u),...c}});return{...Gv(t),modelGroups:s}}function UT(e){return R.useMemo(()=>$T(e),[e])}function US(){var a;const e=we(o=>o.gitStatus),t=we(o=>o.currentSession),[n,s]=R.useState(!0);return R.useEffect(()=>{t!=null&&t.workdir&&s(!1)},[t==null?void 0:t.workdir]),{branch:(e==null?void 0:e.branch)??null,diff:{files:((a=e==null?void 0:e.diff)==null?void 0:a.files)??[],loading:n,error:null}}}function pu(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Wv(e){return Number.isFinite(e)?e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1):"0"}function FT(e){if(!Number.isFinite(e))return"0s";if(e<60)return`${e.toFixed(1)}s`;const t=Math.floor(e/60),n=Math.round(e%60);return`${t}m${n}s`}const qv=["▁","▂","▃","▄","▅","▆","▇","█"];function VT(e,t,n){if(n===t)return 4;const s=(e-t)/(n-t);return Math.min(7,Math.max(0,Math.round(s*7)))}function GT(e,t){if(e===t){const a=Math.max(Math.abs(e)*.05,1);return{minY:e-a,maxY:t+a}}const n=t-e,s=Math.max(n*.1,.1);return{minY:e-s,maxY:t+s}}function WT(e,t){if(e.length===0||t<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const n=[...e].sort((m,x)=>m.x-x.x),s=n[0].x,a=n[n.length-1].x,o=Math.min(...n.map(m=>m.y)),u=Math.max(...n.map(m=>m.y)),{minY:c,maxY:d}=GT(o,u),f=Array.from({length:t},()=>" "),p=new Map;for(const m of n){const x=a===s?0:Math.round((m.x-s)/(a-s)*(t-1)),_=p.get(x)??[];p.set(x,[..._,m.y])}for(const[m,x]of p){const _=Math.max(...x);f[m]=qv[VT(_,c,d)]??qv[0]}return{blocks:f.join(""),minX:s,maxX:a,minY:c,maxY:d}}function Kv(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Yv({data:e,width:t=60,height:n=78,label:s,xLabel:a,yLabel:o,showAxes:u=!0,formatY:c=Kv,formatX:d=Kv}){const f=R.useMemo(()=>{const p=WT(e,t),m=Math.max(t*6,240),x=10,_=8,k=[...e].sort((b,E)=>b.x-E.x).map(b=>{const E=p.maxX===p.minX?m/2:x+(b.x-p.minX)/(p.maxX-p.minX)*(m-x*2),N=p.maxY===p.minY?n/2:_+(p.maxY-b.y)/(p.maxY-p.minY)*(n-_*2);return{...b,cx:E,cy:N,leftPercent:E/m*100,topPercent:N/n*100}}),v=k.map((b,E)=>`${E===0?"M":"L"} ${b.cx.toFixed(1)} ${b.cy.toFixed(1)}`).join(" "),y=[p.maxY,(p.maxY+p.minY)/2,p.minY].map(b=>({value:b,y:p.maxY===p.minY?n/2:_+(p.maxY-b)/(p.maxY-p.minY)*(n-_*2)}));return{...p,chartWidth:m,points:k,path:v,gridLines:y}},[e,n,t]);return e.length===0?l.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&l.jsx("div",{className:"mb-1",children:s}),l.jsx("div",{children:"No data"})]}):l.jsxs("div",{className:"font-mono text-xs",children:[s&&l.jsx("div",{className:"text-text-secondary mb-2",children:s}),l.jsxs("div",{className:"flex gap-3",children:[u&&l.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(p=>l.jsx("span",{children:c(p.value)},`${p.value}-${p.y}`))}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsxs("div",{className:"relative h-[78px]",children:[l.jsxs("svg",{viewBox:`0 0 ${f.chartWidth} ${n}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[f.gridLines.map(p=>l.jsx("line",{x1:"0",x2:f.chartWidth,y1:p.y,y2:p.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${p.y}`)),f.points.map(p=>l.jsx("line",{x1:p.cx,x2:p.cx,y1:n-4,y2:p.cy,stroke:"currentColor",className:"text-border/40"},`guide-${p.cx}-${p.cy}`)),f.points.length>1&&l.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(p=>l.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${p.leftPercent}%`,top:`${p.topPercent}%`},title:`${d(p.x)} -> ${c(p.y)}`,children:l.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:l.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${p.x}-${p.y}`))]})})]}),u&&l.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[l.jsx("span",{className:"w-12"}),l.jsxs("span",{className:"flex-1 flex justify-between",children:[l.jsx("span",{children:d(f.minX)}),l.jsx("span",{children:a}),l.jsx("span",{children:d(f.maxX)})]})]}),o&&u&&l.jsx("div",{className:"text-text-muted mt-1 text-center",children:o})]})}function qT({data:e,prefillLabel:t="Prefill Speed (tok/s) by Response",generationLabel:n="Generation Speed (tok/s) by Response",xLabel:s="response",width:a=60}){const o=e.map(c=>({x:c.x,y:c.ppSpeed})),u=e.map(c=>({x:c.x,y:c.tgSpeed}));return l.jsxs("div",{className:"space-y-5",children:[l.jsx(Yv,{data:o,width:a,label:t,xLabel:s}),l.jsx(Yv,{data:u,width:a,label:n,xLabel:s})]})}function KT(e){const t=new Map;for(const n of e.callDataPoints){const s=t.get(n.messageId)??[];t.set(n.messageId,[...s,n])}return e.dataPoints.map(n=>{const s=[...t.get(n.messageId)??[]].sort((a,o)=>a.callIndex-o.callIndex);return{...n,callCount:s.length,calls:s,isExpandable:s.length>1}})}function YT(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(t=>({x:t.responseIndex,ppSpeed:t.prefillSpeed,tgSpeed:t.generationSpeed}))}}function XT(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(t=>({x:t.promptTokens,ppSpeed:t.prefillSpeed,tgSpeed:t.generationSpeed}))}}function QT(e){return e.callDataPoints.length>0?XT(e):YT(e)}function Pf(e){if(e<60)return`${e.toFixed(1)}s`;const t=Math.floor(e/60),n=e%60;return`${t}m ${n.toFixed(0)}s`}function Ni(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function el(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function JT(e){if(e.length===0)return"0 ctx";const t=Math.min(...e),n=Math.max(...e);return t===n?`${Ni(t)} ctx`:`${Ni(t)}-${Ni(n)} ctx`}function gu(e){return`${el(e)} t/s`}function FS(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function ZT(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(t=>({responseIndex:t.responseIndex,timestamp:t.timestamp,mode:t.mode,prefillTokens:t.prefillTokens,generationTokens:t.generationTokens,prefillSpeed:t.prefillSpeed,generationSpeed:t.generationSpeed,totalTime:t.totalTime,aiTime:t.aiTime,toolTime:t.toolTime})),llmCalls:e.callDataPoints.map(t=>({sessionCallIndex:t.sessionCallIndex,responseIndex:t.responseIndex,callIndex:t.callIndex,timestamp:t.timestamp,mode:t.mode,promptTokens:t.promptTokens,completionTokens:t.completionTokens,ttft:t.ttft,completionTime:t.completionTime,prefillSpeed:t.prefillSpeed,generationSpeed:t.generationSpeed,totalTime:t.totalTime}))}}function eN({isOpen:e,onClose:t,stats:n}){const s=R.useRef(null),[a,o]=R.useState({}),[u,c]=R.useState(()=>{var w;return((w=n.modelGroups[0])==null?void 0:w.key)??""});R.useEffect(()=>{var w;n.modelGroups.some(k=>k.key===u)||c(((w=n.modelGroups[0])==null?void 0:w.key)??"")},[u,n.modelGroups]);const d=R.useMemo(()=>n.modelGroups.find(w=>w.key===u)??n.modelGroups[0],[u,n.modelGroups]),f=R.useMemo(()=>d?KT(d):[],[d]),p=R.useMemo(()=>d?QT(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=R.useCallback(w=>{o(k=>({...k,[w]:!k[w]}))},[]),x=R.useCallback(()=>{if(!d)return;const w=ZT(d);navigator.clipboard.writeText(JSON.stringify(w,null,2)).catch(k=>console.error("Failed to copy:",k))},[d]),_=R.useCallback(async()=>{if(s.current)try{const w=(await J(async()=>{const{default:S}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:S}},[])).default,k=await w(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=k.toDataURL("image/png"),v.click()}catch(w){console.error("Failed to export PNG:",w),x()}},[x]);return l.jsx(kt,{isOpen:e,onClose:t,title:"Session Stats",size:"lg",children:l.jsxs("div",{ref:s,className:"space-y-6",children:[l.jsx("section",{children:l.jsx("div",{className:"flex flex-wrap gap-2",children:n.modelGroups.map(w=>l.jsx("button",{onClick:()=>c(w.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${w.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:w.label,children:w.label},w.key))})}),d&&l.jsxs("section",{children:[l.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[l.jsx(ts,{label:"AI Time",value:Pf(d.aiTime)}),l.jsx(ts,{label:"Total Time",value:Pf(d.totalTime)}),l.jsx(ts,{label:"Tool Time",value:Pf(d.toolTime)}),l.jsx(ts,{label:"Responses",value:d.responseCount.toString()}),l.jsx(ts,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[l.jsx(ts,{label:"Prefill Tokens",value:Ni(d.prefillTokens),subValue:`@ ${el(d.avgPrefillSpeed)} tok/s`}),l.jsx(ts,{label:"Gen Tokens",value:Ni(d.generationTokens),subValue:`@ ${el(d.avgGenerationSpeed)} tok/s`}),l.jsx(ts,{label:"Avg PP Speed",value:`${el(d.avgPrefillSpeed)}`,subValue:"tok/s"}),l.jsx(ts,{label:"Avg TG Speed",value:`${el(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&p.points.length>1&&l.jsxs("section",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:x,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),l.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),l.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:l.jsx(qT,{data:p.points,width:50,prefillLabel:p.prefillLabel,generationLabel:p.generationLabel,xLabel:p.xLabel})})]}),d&&l.jsxs("section",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),l.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:l.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[l.jsxs("colgroup",{children:[l.jsx("col",{className:"w-[7%]"}),l.jsx("col",{className:"w-[14%]"}),l.jsx("col",{className:"w-[10%]"}),l.jsx("col",{className:"w-[14%]"}),l.jsx("col",{className:"w-[14%]"}),l.jsx("col",{className:"w-[14%]"}),l.jsx("col",{className:"w-[11%]"}),l.jsx("col",{className:"w-[2%]"})]}),l.jsx("thead",{children:l.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[l.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),l.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),l.jsx("th",{className:"px-2 py-2"})]})}),l.jsx("tbody",{children:f.map((w,k)=>l.jsxs(R.Fragment,{children:[l.jsx(tN,{row:w,index:k,isExpanded:a[w.messageId]??!1,onToggle:w.isExpandable?()=>m(w.messageId):void 0}),(a[w.messageId]??!1)&&w.calls.map((v,S)=>l.jsx(nN,{dataPoint:v,index:S},`${v.messageId}-${v.callIndex}`))]},w.messageId))})]})})]})]})})}function ts({label:e,value:t,subValue:n}){return l.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[l.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),l.jsx("div",{className:"text-text-primary text-lg font-semibold",children:t}),n&&l.jsx("div",{className:"text-text-muted text-xs",children:n})]})}function tN({row:e,index:t,isExpanded:n,onToggle:s}){const a=e.calls.length>0?JT(e.calls.map(o=>o.promptTokens)):`${Ni(e.prefillTokens)} ctx`;return l.jsxs("tr",{onClick:s,className:`${t%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[l.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),l.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:FS(e.timestamp)}),l.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:a.replace(/ ctx$/,"")}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:gu(e.prefillSpeed)}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:gu(e.generationSpeed)}),l.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),l.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?n?"v":">":""})]})}function nN({dataPoint:e,index:t}){const n=e.temperature!==void 0||e.topP!==void 0||e.topK!==void 0||e.maxTokens!==void 0;return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{className:`${t%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[l.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),l.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:FS(e.timestamp)}),l.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Ni(e.promptTokens)}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:gu(e.prefillSpeed)}),l.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:gu(e.generationSpeed)}),l.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),l.jsx("td",{className:"px-2 py-2"})]}),n&&l.jsx("tr",{className:`${t%2===0?"bg-bg-tertiary/5":"bg-bg-tertiary/[2.5%]"}`,children:l.jsx("td",{colSpan:8,className:"px-6 py-1.5 border-l border-border/60",children:l.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-text-muted",children:[e.temperature!==void 0&&l.jsxs("span",{children:["temp: ",e.temperature.toFixed(2)]}),e.topP!==void 0&&l.jsxs("span",{children:["topP: ",e.topP.toFixed(2)]}),e.topK!==void 0&&l.jsxs("span",{children:["topK: ",e.topK]}),e.maxTokens!==void 0&&l.jsxs("span",{children:["maxTok: ",e.maxTokens]})]})})})]})}const rN={passed:{icon:"✓",color:"text-accent-success"},completed:{icon:"◉",color:"text-purple-400"},failed:{icon:"✗",color:"text-accent-error"},resolved:{icon:"✓",color:"text-accent-success"},dismissed:{icon:"–",color:"text-text-muted"},open:{icon:"○",color:"text-accent-warning"},pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"◌",color:"text-accent-warning"}},sN=["open","in_progress","pending","completed","resolved","dismissed","passed","failed"];function iN(e){return rN[e]??{icon:"○",color:"text-text-muted"}}function VS(e){const t=document.createElement("textarea");return t.innerHTML=e,t.value}const Gu=R.memo(function({status:t,className:n="text-xs leading-tight flex-shrink-0"}){const{icon:s,color:a}=iN(t);return l.jsx("span",{className:`${a} ${n}`,children:s})});function Xv({entries:e,title:t}){const n=R.useMemo(()=>e.reduce((s,a)=>(s[a.status]=(s[a.status]??0)+1,s),{}),[e]);return l.jsxs("h3",{className:"text-sm font-semibold text-text-primary mb-2 flex items-center justify-between",children:[l.jsx("span",{children:t}),Object.keys(n).length>0&&l.jsx("span",{className:"font-normal text-xs flex items-center gap-1.5",children:sN.map(s=>{const a=n[s];return a?l.jsxs("span",{className:"flex items-center gap-0.5",children:[l.jsx(Gu,{status:s}),l.jsx("span",{children:a})]},s):null})})]})}const aN=R.memo(function({entries:t,title:n}){return t.length===0?null:l.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[n&&l.jsx("div",{className:"px-1.5 py-1 border-b border-border bg-secondary",children:l.jsx("span",{className:"text-xs font-medium text-text-muted",children:n})}),l.jsx("div",{className:"bg-primary",children:t.map((s,a)=>l.jsxs("div",{className:`flex items-start gap-1 px-1.5 py-1 ${a>0?"border-t border-border":""}`,children:[l.jsx(Gu,{status:s.status}),l.jsxs("div",{className:"flex-1 min-w-0 text-xs truncate",children:[l.jsxs("span",{className:"text-text-muted",children:["[",s.id,"]"]})," ",VS(s.description)]})]},s.id??a))})]})}),oN="#6b7280";function ll(e,t){var n;return((n=e.find(s=>s.id===t))==null?void 0:n.color)??oN}const ht=qn(e=>{const t=async()=>{await gp("/api/agents",e,!0)};return{defaults:[],userItems:[],projectItems:[],loading:!1,fetchAgents:t,fetchAgent:async n=>{try{const s=await Te(`/api/agents/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await Te(`/api/agents/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createAgent:async(n,s)=>{const a=await Ws("POST","/api/agents",{...n,destination:s});return a.success&&await t(),a},updateAgent:async(n,s)=>{const a=await Ws("PUT",`/api/agents/${n}`,s);return a.success&&await t(),a},deleteAgent:async n=>{try{const s=await Te(`/api/agents/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(u=>u.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async(n,s)=>zu(`/api/agents/${n}/duplicate`,t,s)}}),Ct=qn((e,t)=>({defaults:[],userItems:[],projectItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Te("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Te("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],projectItems:s.projectItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async n=>{try{const s=await Te(`/api/workflows/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await Te(`/api/workflows/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async(n,s)=>{const a=await Ws("POST","/api/workflows",{...n,destination:s});return a.success&&await t().fetchWorkflows(),a},updateWorkflow:async(n,s)=>{const a=await Ws("PUT",`/api/workflows/${n}`,s);return a.success&&await t().fetchWorkflows(),a},deleteWorkflow:async n=>{try{const s=await Te(`/api/workflows/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(u=>u.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async(n,s)=>zu(`/api/workflows/${n}/duplicate`,()=>t().fetchWorkflows(),s)})),lN={pending:"completed",completed:"passed",passed:"failed",failed:"pending"};async function cN(e,t){await Te(`/api/sessions/${e}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:t})})}function Wc({id:e,agents:t}){const n=ll(t,e),s=t.find(a=>a.id===e);return l.jsx("span",{className:"font-medium rounded px-1",style:{backgroundColor:`${n}20`,color:n},children:(s==null?void 0:s.name)??e})}function uN({id:e}){const t=Ct(u=>u.defaults),n=Ct(u=>u.userItems),a=R.useMemo(()=>[...t,...n],[t,n]).find(u=>u.id===e),o=(a==null?void 0:a.color)??"#3b82f6";return l.jsx("span",{className:"font-medium rounded px-1",style:{backgroundColor:`${o}20`,color:o},children:(a==null?void 0:a.name)??e})}function dN({entries:e,sessionId:t}){const[n,s]=R.useState(e),[a,o]=R.useState(!1),[u,c]=R.useState(null),[d,f]=R.useState(""),[p,m]=R.useState(""),[x,_]=R.useState(!1),[w,k]=R.useState(!1),v=ht(H=>H.defaults),S=ht(H=>H.userItems),y=ht(H=>H.projectItems),b=R.useMemo(()=>[...v,...S,...y],[v,S,y]),E=R.useRef(null),N=R.useRef(null);R.useEffect(()=>{s(e)},[e]),R.useEffect(()=>{var H;a&&((H=E.current)==null||H.focus())},[a]),R.useEffect(()=>{var H;u&&((H=N.current)==null||H.focus())},[u]);const T=R.useCallback(H=>{s(H),cN(t,H)},[t]),L=R.useCallback(()=>{var P;const H=d.trim();if(!H)return;const K=String(n.length),X=[...n,{id:K,description:H,status:"pending"}];T(X),f(""),(P=E.current)==null||P.focus()},[n,d,T]),A=R.useCallback(()=>{o(!1),f("")},[]),M=R.useCallback((H,K)=>{c(H),m(K)},[]),D=R.useCallback(()=>{if(!u)return;const H=p.trim(),K=n.map(X=>X.id===u?{...X,description:H||X.description}:X);T(K),c(null)},[u,p,n,T]),U=R.useCallback(H=>{const K=n.map(X=>X.id===H?{...X,status:lN[X.status]??"pending"}:X);T(K)},[n,T]),F=R.useCallback(H=>{T(n.filter(K=>K.id!==H))},[n,T]),B=R.useCallback(()=>{T([]),_(!1)},[T]),Y=R.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),L()),H.key==="Escape"&&A()},[L,A]),W=R.useCallback(H=>{H.key==="Enter"&&D(),H.key==="Escape"&&c(null)},[D]);return l.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[l.jsxs("div",{className:"bg-primary",children:[n.length===0&&!a&&l.jsxs("div",{className:"px-1.5 py-2 text-xs text-text-muted italic text-center",children:["No criteria yet."," ",l.jsx("button",{onClick:()=>k(!0),className:"text-accent-primary hover:underline not-italic cursor-pointer",children:"Learn more"})]}),n.map((H,K)=>{const X=H.status,P=u===H.id;return l.jsxs("div",{className:`flex items-start gap-1 px-1.5 py-1 group ${K>0?"border-t border-border":""}`,children:[l.jsx("button",{onClick:()=>U(H.id),className:"text-xs leading-tight flex-shrink-0 cursor-pointer hover:opacity-70 transition-opacity",title:`Status: ${H.status} (click to cycle)`,children:l.jsx(Gu,{status:X})}),l.jsx("div",{className:"flex-1 min-w-0",children:P?l.jsx("input",{ref:N,value:p,onChange:O=>m(O.target.value),onBlur:D,onKeyDown:W,className:"w-full bg-bg-tertiary text-text-primary text-xs px-1.5 py-0.5 rounded border border-border focus:outline-none focus:border-accent-primary"}):l.jsxs("button",{onClick:()=>M(H.id,H.description),className:"text-xs text-text-primary text-left hover:text-accent-primary transition-colors w-full truncate cursor-pointer",title:"Click to edit",children:["[",H.id,"] ",VS(H.description)]})}),l.jsx("button",{onClick:()=>F(H.id),className:"flex-shrink-0 opacity-0 group-hover:opacity-100 text-text-muted hover:text-accent-error transition-all ml-0.5 cursor-pointer flex items-center self-center",title:"Delete criterion",children:l.jsx(yl,{className:"w-4 h-4"})})]},H.id)})]}),a&&l.jsx("div",{className:"px-1.5 py-1 border-t border-border bg-secondary",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-text-muted text-xs leading-tight flex-shrink-0",children:"○"}),l.jsx("input",{ref:E,value:d,onChange:H=>f(H.target.value),onKeyDown:Y,placeholder:"New criterion...",className:"flex-1 bg-bg-tertiary text-text-primary text-xs px-1.5 py-0.5 rounded border border-border focus:outline-none focus:border-accent-primary placeholder-text-muted"})]})}),l.jsxs("div",{className:"px-1.5 py-1 border-t border-border bg-secondary flex items-center gap-2",children:[a?l.jsxs(l.Fragment,{children:[l.jsxs("button",{onClick:L,className:"flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/70 transition-colors cursor-pointer",title:"Add criterion",children:[l.jsx(qs,{className:"w-3 h-3"}),"Add"]}),l.jsx("button",{onClick:A,className:"flex items-center gap-1 text-xs text-text-muted hover:text-text-primary transition-colors cursor-pointer",title:"Cancel",children:"Cancel"})]}):l.jsxs("button",{onClick:()=>o(!0),className:"flex items-center gap-1 text-xs text-text-muted hover:text-accent-primary transition-colors cursor-pointer",title:"Add criterion",children:[l.jsx(qs,{className:"w-3 h-3"}),"Add"]}),n.length>0&&l.jsxs("button",{onClick:()=>_(!0),className:"flex items-center gap-1 text-xs text-text-muted hover:text-accent-error transition-colors ml-auto cursor-pointer",title:"Clear all criteria",children:[l.jsx(_l,{className:"w-3 h-3"}),"Clear all"]}),l.jsx("button",{onClick:()=>k(!0),className:"flex items-center gap-1 text-xs text-text-muted hover:text-accent-primary transition-colors cursor-pointer",title:"About criteria",children:l.jsx(gS,{className:"w-3 h-3"})})]}),x&&l.jsx("div",{className:"px-1.5 py-1 border-t border-border bg-secondary",children:l.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[l.jsx("span",{className:"text-xs text-accent-error",children:"Clear all criteria?"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{onClick:B,className:"text-xs text-accent-error hover:text-accent-error/70 transition-colors cursor-pointer",children:"Yes"}),l.jsx("button",{onClick:()=>_(!1),className:"text-xs text-text-muted hover:text-text-primary transition-colors cursor-pointer",children:"No"})]})]})}),l.jsx(kt,{isOpen:w,onClose:()=>k(!1),title:"About Acceptance Criteria",size:"md",children:l.jsxs("div",{className:"space-y-3 text-sm text-text-secondary",children:[l.jsx("p",{children:"Each criterion defines a specific requirement that needs to be met."}),l.jsxs("p",{children:["To use this feature, start in ",l.jsx(Wc,{id:"planner",agents:b})," mode and",l.jsxs("strong",{className:"text-text-primary",children:[" ","ask the agent to define acceptance criteria that matches your goal"]}),". Then launch the ",l.jsx(uN,{id:"default"})," builtin workflow to launch the automation part."]}),l.jsx("p",{children:"This workflow will automatically:"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[l.jsxs("li",{children:["Launch the ",l.jsx(Wc,{id:"builder",agents:b}),' agent, that will be forced to continue until it marks all criteria as "completed"']}),l.jsxs("li",{children:["Then launch the ",l.jsx(Wc,{id:"verifier",agents:b})," subagent, that will verify each criterion. If every criterion is fulfilled, then it goes to the next step, otherwise, it gives feedback to the main agent until 100% of the criteria are met."]}),l.jsxs("li",{children:["Launch a ",l.jsx(Wc,{id:"code_reviewer",agents:b})," subagent, that will analyze the code to provide actionable feedback to the main agent."]})]}),l.jsx("div",{className:"bg-bg-tertiary rounded p-3 space-y-1.5",children:l.jsx("p",{children:"This lets smaller models follow complex plans to completion and improves the chances that nothing from your plan is missed."})})]})})]})}function hN({isOpen:e,onClose:t}){const n=Dr(k=>k.config),s=Dr(k=>k.saveConfig),[a,o]=R.useState(""),[u,c]=R.useState(""),[d,f]=R.useState(!1),[p,m]=R.useState(!1),[x,_]=R.useState(!1);R.useEffect(()=>{e&&(o((n==null?void 0:n.command)??""),c((n==null?void 0:n.url)??""),f((n==null?void 0:n.hotReload)??!1),m((n==null?void 0:n.disableInspect)??!1))},[e,n]);const w=async()=>{!a.trim()||!u.trim()||(_(!0),await s({command:a.trim(),url:u.trim(),hotReload:d,disableInspect:p}),_(!1),t())};return l.jsx(kt,{isOpen:e,onClose:t,title:"Dev Server Config",size:"sm",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),l.jsx("input",{className:"input w-full",type:"text",value:a,onChange:k=>o(k.target.value),placeholder:"npm run dev"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),l.jsx("input",{className:"input w-full",type:"text",value:u,onChange:k=>c(k.target.value),placeholder:"http://localhost:3000"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:k=>f(k.target.checked),className:"rounded border-border bg-bg-tertiary"}),l.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"checkbox",id:"disableInspect",checked:p,onChange:k=>m(k.target.checked),className:"rounded border-border bg-bg-tertiary"}),l.jsx("label",{htmlFor:"disableInspect",className:"text-xs text-text-secondary",children:"Disable inspect feedback"})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx("button",{className:"btn btn-secondary",onClick:t,children:"Cancel"}),l.jsx("button",{className:"btn btn-primary",onClick:w,disabled:x||!a.trim()||!u.trim(),children:x?"Saving...":"Save"})]})]})})}const Qv={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},fN={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},Jv={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},mN="text-text-primary";function pN(e){const t=[],n=new RegExp("\x1B\\[([0-9;]+)m","g");let s=0,a="text-text-primary",o;try{for(;(o=n.exec(e))!==null;){if(o.index>s){const f=e.slice(s,o.index);f&&t.push({text:f,className:a})}const u=o[1];if(!u)continue;const c=u.split(";").map(Number);if(c.length===0||c[0]===0){a="text-text-primary";continue}const d=[];for(const f of c)if(f>=30&&f<=37){const p=Qv[f];p&&d.push(p)}else if(f>=40&&f<=47){const p=fN[f];p&&d.push(p)}else if(f>=90&&f<=97){const p=Qv[f];p&&d.push(p)}else if(f in Jv){const p=Jv[f];p&&d.push(p)}else f===39?d.push(mN):f===49&&(a=a.split(" ").filter(p=>!p.startsWith("bg-")).join(" "));d.length>0&&(a=d.join(" ")),s=n.lastIndex}if(s<e.length){const u=e.slice(s);u&&t.push({text:u,className:a})}return t}catch(u){return console.warn("ANSI parsing failed, stripping codes:",u),[{text:gN(e),className:"text-text-primary"}]}}function gN(e){return e.replace(new RegExp("\x1B\\[([0-9;]+)m","g"),"")}function xu(e){const t=pN(e),n=[];return t.forEach((s,a)=>{const o=s.text.split(`
|
|
88
|
-
`);o.forEach((u,c)=>{n.push($s.createElement("span",{key:`${a}-${c}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},u)),c<o.length-1&&n.push($s.createElement("br",{key:`${a}-${c}-br`}))})}),n.length===1?n[0]:n}function GS({logs:e,preRef:t,preClassName:n="text-sm font-mono"}){return l.jsx("pre",{ref:t,className:n,children:e.length===0?l.jsx("span",{className:"text-text-muted",children:"No output yet"}):e.map((s,a)=>l.jsx("span",{className:s.stream==="stderr"?"text-accent-warning":"",children:xu(s.content)},a))})}const WS=R.memo(function({title:t,logs:n,onClose:s,preClassName:a}){const o=R.useRef(null);return R.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[n]),l.jsx(kt,{isOpen:!0,onClose:s,title:t,size:"full",children:l.jsx(GS,{logs:n,preRef:o,preClassName:a})})}),xN=R.memo(function({logs:t,anchorRef:n,isHiding:s,onExpand:a,onClose:o}){const[u,c]=R.useState(null),d=R.useRef(null);return R.useEffect(()=>{var p;const f=(p=n.current)==null?void 0:p.getBoundingClientRect();f&&c({bottom:window.innerHeight-f.bottom,right:window.innerWidth-f.right,width:f.width,height:f.height})},[n]),R.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[t]),u?l.jsxs("div",{className:"relative",children:[l.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:u.bottom,right:u.right,width:u.width*2,maxHeight:u.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:t.map((f,p)=>l.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:xu(f.content)},p))}),l.jsx("button",{onClick:()=>{o(),a()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-text-primary hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:u.bottom+8,right:u.right+8},children:"Expand"})]}):null}),_N=R.memo(function({workdir:t}){const n=Dr(F=>F.setWorkdir),s=Dr(F=>F.status),a=Dr(F=>F.config),o=Dr(F=>F.logs),u=Dr(F=>F.start),c=Dr(F=>F.stop),d=Dr(F=>F.fetchLogs),f=we(F=>F.currentSession),[p,m]=R.useState(!1),[x,_]=R.useState(!1),[w,k]=R.useState(!1),[v,S]=R.useState(!1),y=R.useRef(null),b=R.useRef(null),E=R.useRef(null),N=R.useRef(null),T=R.useRef(null),L=()=>{const F=s==null?void 0:s.inspectProxyPort;if(!F){s!=null&&s.url&&window.open(s.url,"_blank");return}const B=`${window.location.protocol}//${window.location.hostname}:${F}`,Y=window.open(B,"_blank");if(Y){T.current=Y;const W=()=>{var K;!T.current||T.current.closed||(T.current.postMessage({type:"setFoxSessionId",sessionId:(f==null?void 0:f.id)??null},"*"),T.current.postMessage({type:"setFoxSessionTitle",sessionTitle:((K=f==null?void 0:f.metadata)==null?void 0:K.title)??null},"*"),T.current.postMessage({type:"setFoxInspectEnabled",enabled:!(a!=null&&a.disableInspect)},"*"))},H=setInterval(()=>{W(),(!T.current||T.current.closed)&&clearInterval(H)},500);setTimeout(()=>clearInterval(H),5e3)}},A=(s==null?void 0:s.state)??"off",M=a!==null,D=A==="running"||A==="warning";R.useEffect(()=>{n(t??null)},[t,n]),R.useEffect(()=>{D&&d()},[D,d]),R.useEffect(()=>{E.current&&D&&(E.current.scrollTop=E.current.scrollHeight)},[o,D]);const U=()=>{D?c():u()};return l.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),l.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),l.jsx("button",{onClick:()=>m(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:l.jsx(wj,{})})]}),M?l.jsxs(l.Fragment,{children:[A==="running"||A==="warning"?l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("button",{onClick:U,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[l.jsx(_S,{}),"Stop"]}),(s==null?void 0:s.url)&&l.jsxs("button",{onClick:()=>L(),className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",title:s.url,children:[l.jsx(kj,{}),"Open"]})]}):l.jsx("button",{onClick:U,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-text-primary hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&l.jsxs("div",{ref:N,className:"relative",onMouseEnter:()=>{b.current&&clearTimeout(b.current),y.current=setTimeout(()=>{k(!0),S(!1)},500)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),S(!0),b.current=setTimeout(()=>k(!1),150)},children:[l.jsx(GS,{logs:o,preRef:E,preClassName:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border"}),(w||v)&&N.current&&Di.createPortal(l.jsx(xN,{logs:o,anchorRef:N,isHiding:v,onExpand:()=>_(!0),onClose:()=>k(!1)}),document.body)]})]}):l.jsx("button",{onClick:()=>m(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),l.jsx(hN,{isOpen:p,onClose:()=>m(!1)}),x&&l.jsx(WS,{title:"Dev Server Logs",logs:o,onClose:()=>_(!1)})]})}),yN=R.memo(function({sessionId:t}){var _;const n=nl(w=>w.processes),s=nl(w=>w.stopProcess),[a,o]=R.useState(null),[u,c]=R.useState([]),d=n.filter(w=>w.status!=="exited"),f=d.filter(w=>w.status==="running").length;if(n.length===0)return null;const p=w=>{switch(w){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=w=>{const k=nl.getState().logs[w]??[];c(k.map(v=>({content:v.content,stream:v.stream}))),o(w)},x=w=>{t&&s(w,t)};return l.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),l.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),l.jsxs("span",{className:"text-xs text-text-muted",children:["(",f," running)"]})]})}),l.jsx("div",{className:"space-y-2",children:d.map(w=>l.jsx("div",{className:"border border-border rounded p-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${p(w.status)}`}),l.jsx("span",{className:"text-sm text-text-primary truncate",title:w.name,children:w.name}),l.jsxs("span",{className:"text-xs text-text-muted",children:["[",w.status,"]"]})]}),l.jsxs("div",{className:"flex gap-1 ml-2",children:[l.jsx("button",{onClick:()=>m(w.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),l.jsx("button",{onClick:()=>x(w.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},w.id))}),a&&l.jsx(WS,{title:((_=d.find(w=>w.id===a))==null?void 0:_.name)??"",logs:u,onClose:()=>{o(null),c([])}})]})});function vN({isOpen:e,onClose:t,versionInfo:n}){const[s,a]=R.useState("ready"),[o,u]=R.useState("waiting"),[c,d]=R.useState(""),[f,p]=R.useState(n),[m,x]=R.useState(!1),_=R.useRef(!1);R.useEffect(()=>{if(e){if(n){p(n);return}fetch("/api/auto-update/check").then(v=>v.json()).then(v=>{p({current:v.current,latest:v.latest}),x(v.isService??!1)}).catch(()=>{})}},[e]),R.useEffect(()=>{if(!e||s!=="updating")return;const v=setInterval(()=>{d(S=>S.length>=3?"":S+".")},400);return()=>clearInterval(v)},[e,s]);const w=R.useCallback(async()=>{a("updating"),u("waiting"),_.current=!1;const v=(f==null?void 0:f.current)==="1.0.0"&&(f==null?void 0:f.latest)==="1.1.0",S=await Te("/api/auto-update",{method:"POST"}),{isService:y}=await S.json();if(v){setTimeout(()=>{a("reloading"),localStorage.setItem("openfox_updated_to",(f==null?void 0:f.latest)??"unknown"),localStorage.setItem("update_pending","true"),setTimeout(()=>window.location.reload(),1e3)},5e3);return}if(!y){setTimeout(()=>{a("complete")},8e3);return}let b=!1;const E=setInterval(async()=>{try{(await fetch("/api/health")).ok&&_.current&&(b=!0,clearInterval(E),a("reloading"),localStorage.setItem("openfox_updated_to",(f==null?void 0:f.latest)??"unknown"),localStorage.setItem("update_pending","true"),window.location.reload())}catch{_.current=!0}},2e3);setTimeout(()=>{b||u("takingLonger")},6e4),setTimeout(()=>{b||(clearInterval(E),a("failed"))},12e4)},[f==null?void 0:f.current,f==null?void 0:f.latest]);R.useEffect(()=>{e&&(a("ready"),u("waiting"),d(""),_.current=!1)},[e]);const k=s!=="updating";return l.jsxs(kt,{isOpen:e,onClose:k?t:void 0,title:s==="failed"?"Update Failed":s==="complete"?"Update Complete":"New OpenFox Version Available",size:"sm",closeOnBackdropClick:k,showCloseButton:k,children:[l.jsxs("div",{className:"flex flex-col gap-4",children:[f&&l.jsxs("div",{className:"flex justify-between text-sm",children:[l.jsx("span",{className:"text-text-muted",children:"Current version"}),l.jsx("span",{className:"text-text-primary font-mono",children:f.current})]}),f&&l.jsxs("div",{className:"flex justify-between text-sm pb-2",children:[l.jsx("span",{className:"text-text-muted",children:"Latest version"}),l.jsx("span",{className:"text-accent-primary font-mono font-semibold",children:f.latest})]}),s==="updating"&&l.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[l.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),l.jsx("p",{className:"text-xs text-text-muted text-center",children:o==="takingLonger"?"Taking longer than expected…":`Updating${c}`})]}),s==="reloading"&&l.jsxs("div",{className:"flex flex-col gap-2 mt-2",children:[l.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:l.jsx("div",{className:"h-full bg-accent-primary animate-pulse w-full"})}),l.jsxs("p",{className:"text-xs text-text-muted text-center",children:["Update complete, reloading",c]})]}),s==="complete"&&l.jsx("div",{className:"flex flex-col gap-3 mt-2",children:l.jsxs("div",{className:"bg-bg-tertiary rounded px-3 py-2 text-xs text-text-secondary",children:["OpenFox has been updated to v",f==null?void 0:f.latest,". Please relaunch OpenFox to use the new version."]})}),s==="failed"&&l.jsxs("div",{className:"flex flex-col gap-3 mt-2",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-accent-danger/10 border border-accent-danger/30 rounded text-xs",children:[l.jsx("span",{children:"⚠️"}),l.jsx("p",{className:"text-text-secondary",children:"The update timed out. The server may need to be updated manually."})]}),l.jsx("div",{className:"bg-bg-tertiary rounded px-3 py-2 text-xs font-mono text-text-secondary",children:"openfox update"}),l.jsxs("p",{className:"text-xs text-text-muted",children:["Run this command in your terminal to complete the update, then start the service with"," ",l.jsx("span",{className:"font-mono text-text-secondary",children:"openfox service start"}),"."]})]})]}),s==="ready"&&l.jsx("button",{onClick:w,className:"w-full px-3 py-2 text-sm rounded bg-accent-primary hover:brightness-110 transition-all text-white font-medium",children:"Update OpenFox"}),(s==="complete"||s==="failed")&&l.jsx("button",{onClick:t,className:"w-full px-3 py-2 text-sm rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors text-text-primary font-medium mt-2",children:"Close"}),s==="ready"&&m&&l.jsx("div",{className:"flex justify-center mt-2",children:l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-accent-warning/10 border border-accent-warning/30 rounded text-xs",children:[l.jsx("span",{children:"⚠️"}),l.jsx("p",{className:"text-text-secondary",children:"Server will restart to apply this update. Sessions in progress will be interrupted."})]})})]})}function bN({file:e}){const t=BS(e.path,28),n=e.status==="added"?"text-accent-success":e.status==="deleted"?"text-accent-error":"text-accent-primary",s=e.status==="added"?`+${e.additions}`:e.status==="deleted"?`-${e.deletions}`:e.additions>0||e.deletions>0?`+${e.additions}, -${e.deletions}`:"";return l.jsxs("div",{className:"flex items-center justify-between gap-1 py-0.5 text-xs min-w-0",children:[l.jsx("span",{className:`truncate ${n}`,title:e.path,children:t}),s&&l.jsx("span",{className:`shrink-0 font-mono${e.status==="added"?" text-accent-success":e.status==="deleted"?" text-accent-error":" text-text-muted"}`,children:s})]})}function SN(){const{diff:e}=US();return e.loading?l.jsx("div",{className:"mt-3",children:l.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[l.jsx("span",{className:"w-3 h-3 border border-border border-t-accent-primary rounded-full animate-spin"}),l.jsx("span",{children:"Checking changes..."})]})}):e.files.length===0?l.jsx("div",{className:"mt-3",children:l.jsx("p",{className:"text-xs text-text-muted text-center",children:"No changes"})}):l.jsx("div",{className:"mt-3 max-h-[150px] overflow-y-auto",children:l.jsx("div",{className:"pr-1",children:e.files.map((t,n)=>l.jsx(bN,{file:t},n))})})}function Zv({messages:e,workdir:t}){var k,v,S,y;const[n,s]=R.useState(!1),[a,o]=R.useState(!1),[u,c]=R.useState(!1),[d,f]=R.useState(!1),p=UT(e),{branch:m}=US(),x=Ot(b=>b.version),_=we(b=>b.currentSession),w=R.useCallback(async()=>{o(!0);try{const b=await fetch("/api/auto-update/check");if(b.ok){const E=await b.json();c(E.isUpdateAvailable)}}catch{}finally{o(!1)}},[]);return R.useEffect(()=>{w()},[w]),R.useEffect(()=>{if(new URLSearchParams(window.location.search).get("test-update")==="1"){c(!0),f(!0);const E=new URL(window.location.href);E.searchParams.delete("test-update"),window.history.replaceState({},"",E.toString())}},[]),l.jsxs("div",{className:"flex flex-col h-full",children:[p&&l.jsxs("div",{className:"mb-4",children:[l.jsx("button",{onClick:()=>s(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[l.jsx("span",{className:"text-text-secondary",children:FT(p.aiTime)}),l.jsx("span",{className:"w-px h-3 bg-border"}),l.jsx("span",{className:"text-text-secondary",children:Wv(p.avgPrefillSpeed)}),l.jsx("span",{children:"pp"}),l.jsx("span",{className:"w-px h-3 bg-border"}),l.jsx("span",{className:"text-text-secondary",children:Wv(p.avgGenerationSpeed)}),l.jsx("span",{children:"tg"})]})}),l.jsx(eN,{isOpen:n,onClose:()=>s(!1),stats:p})]}),l.jsx("div",{className:"flex flex-col flex-1 overflow-y-auto",children:l.jsxs("div",{className:"mt-4",children:[l.jsx(Xv,{entries:((k=_==null?void 0:_.metadataEntries)==null?void 0:k.criteria)??[],title:"Acceptance Criteria"}),_&&l.jsx(dN,{entries:((v=_==null?void 0:_.metadataEntries)==null?void 0:v.criteria)??[],sessionId:_.id}),_&&(((y=(S=_.metadataEntries)==null?void 0:S.review_findings)==null?void 0:y.length)??0)>0&&l.jsxs("div",{className:"mt-6",children:[l.jsx(Xv,{entries:_.metadataEntries.review_findings,title:"Review Findings"}),l.jsx(aN,{entries:_.metadataEntries.review_findings})]})]})}),m&&l.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[l.jsx(_j,{}),l.jsx("span",{className:"truncate text-text-secondary",title:m,children:m})]}),l.jsx(SN,{}),l.jsx(_N,{workdir:t}),l.jsx(yN,{sessionId:_==null?void 0:_.id}),x&&l.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[l.jsxs("div",{className:"flex items-center justify-center gap-1",children:[l.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",l.jsxs("span",{className:"font-mono",children:["v",x]}),l.jsx("button",{onClick:()=>w(),disabled:a,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors disabled:opacity-50",title:"Check for updates",children:l.jsx(hp,{className:`w-3 h-3 ${a?"animate-spin":""}`})})]}),u&&l.jsx("button",{onClick:()=>f(!0),className:"text-accent-primary hover:underline mt-1",children:"Update OpenFox →"})]}),l.jsx(vN,{isOpen:d,onClose:()=>f(!1),versionInfo:null})]})}function wN({children:e,criteriaSidebarOpen:t=!0,onCriteriaSidebarToggle:n,messages:s}){const a=we(o=>o.currentSession);return l.jsxs("div",{className:"relative h-full overflow-hidden",children:[t&&l.jsx("div",{className:"fixed md:hidden inset-0 bg-secondary/50 z-40",onClick:n}),l.jsxs("div",{className:"flex h-full",children:[l.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden bg-secondary",children:e}),t?l.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-secondary",children:l.jsx(Zv,{messages:s,workdir:a==null?void 0:a.workdir})}):l.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),l.jsx("aside",{className:`
|
|
89
|
-
md:hidden
|
|
90
|
-
p-4 overflow-y-auto bg-secondary
|
|
91
|
-
transition-all duration-300 ease-in-out
|
|
92
|
-
fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
|
|
93
|
-
${t?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
|
|
94
|
-
`,children:l.jsx(Zv,{messages:s,workdir:a==null?void 0:a.workdir})})]})]})}function CN(e,t){return t||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function qS({percent:e,dangerZone:t=!1,size:n="md",className:s=""}){const a=n==="sm"?"w-12":"w-20",o=n==="sm"?"h-1":"h-1.5";return l.jsx("div",{className:`${o} bg-bg-tertiary rounded-full overflow-hidden ${a} ${s}`,children:l.jsx("div",{className:`h-full transition-all duration-300 ${CN(e,t)}`,style:{width:`${Math.min(e,100)}%`}})})}function kN({dangerZone:e,size:t="md"}){return e?l.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function eb(e,t){return t||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function EN(){const e=we(y=>y.contextState),t=we(y=>y.currentSession),n=we(y=>y.compactContext),[s,a]=R.useState(!1),[o,u]=R.useState(!1),[c,d]=R.useState(!1),f=R.useRef(!1);if(R.useEffect(()=>{e!=null&&e.dynamicContextChanged&&!f.current&&u(!1),f.current=(e==null?void 0:e.dynamicContextChanged)??!1},[e==null?void 0:e.dynamicContextChanged]),!e||!t)return null;const{currentTokens:p,maxTokens:m,compactionCount:x,dangerZone:_,dynamicContextChanged:w}=e,k=Math.round(p/m*100),v=t.isRunning,S=()=>{Pt.send("context.applyDynamic",{}),u(!0)};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-secondary",children:l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:eb(k,_),children:[pu(p)," / ",pu(m)]}),l.jsxs("span",{className:eb(k,_),children:["(",k,"%)"]}),l.jsx(qS,{percent:k,dangerZone:_}),l.jsx(kN,{dangerZone:_}),x>0&&l.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[x,"x"]})]}),l.jsx("div",{className:"flex-1 flex justify-end",children:l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>a(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"More options",children:l.jsx(xS,{})}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>a(!1)}),l.jsxs("div",{className:"absolute right-0 top-full mt-1.5 z-50 bg-bg-secondary border border-border rounded-lg shadow-xl py-1 min-w-[160px]",children:[l.jsx("button",{onClick:()=>{v||n(),a(!1)},disabled:v,className:"w-full px-3 py-1.5 text-left text-sm hover:bg-bg-tertiary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:v?"Cannot compact while running":"Compact context",children:l.jsx("span",{className:_?"text-accent-error":"",children:"Compact"})}),w&&l.jsx("button",{onClick:()=>{a(!1),d(!0)},disabled:v,className:"w-full px-3 py-1.5 text-left text-sm hover:bg-bg-tertiary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:v?"Cannot apply while running":"Apply dynamic context",children:l.jsx("span",{className:"text-accent-warning",children:"Update system prompt"})})]})]})]})})]})}),w&&!o&&l.jsx("div",{className:"flex-shrink-0 px-4 py-2 bg-accent-warning/10 border-b border-accent-warning/30",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1 text-sm text-text-secondary",children:[l.jsx("span",{children:"System prompt has changed —"}),l.jsx("button",{onClick:()=>d(!0),className:"underline hover:text-text-primary transition-colors",children:"click here to update it"})]}),l.jsx("button",{onClick:()=>u(!0),className:"flex-shrink-0 p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Dismiss",children:l.jsx(yl,{})})]})}),l.jsxs(kt,{isOpen:c,onClose:()=>d(!1),title:"Update system prompt",size:"sm",children:[l.jsx("p",{className:"text-sm text-text-secondary mb-4",children:"Applying the new system prompt will rebuild the cached prompt, which may cause the next response to take longer while the LLM reprocesses the prefix."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:()=>d(!1),className:"px-3 py-1.5 text-sm rounded bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:"Cancel"}),l.jsx("button",{onClick:()=>{S(),d(!1)},disabled:v,className:"px-3 py-1.5 text-sm rounded bg-accent-primary text-white hover:opacity-90 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:"Update"})]})]})]})}function jN({stats:e,onClose:t}){var n;return l.jsx(kt,{isOpen:!0,onClose:t,title:"Turn Stats",size:"md",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex items-center gap-3",children:l.jsxs("p",{className:"text-xs text-text-muted",children:[e.model," · ",e.mode]})}),l.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[l.jsx(qc,{label:"Total Time",value:`${e.totalTime.toFixed(1)}s`}),l.jsx(qc,{label:"Prefill",value:e.prefillTokens>=1e3?`${(e.prefillTokens/1e3).toFixed(1)}k`:String(e.prefillTokens)}),l.jsx(qc,{label:"Generated",value:e.generationTokens>=1e3?`${(e.generationTokens/1e3).toFixed(1)}k`:String(e.generationTokens)}),l.jsx(qc,{label:"LLM Calls",value:String(((n=e.llmCalls)==null?void 0:n.length)??1)})]}),e.llmCalls&&e.llmCalls.length>0&&l.jsxs("div",{children:[l.jsx("h4",{className:"text-sm font-medium text-text-secondary mb-2",children:"LLM Calls"}),e.llmCalls.map((s,a)=>l.jsxs("div",{className:"bg-bg-tertiary/30 rounded p-3 mb-2",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("span",{className:"text-xs text-text-muted",children:["Call ",a+1]}),l.jsxs("span",{className:"text-xs text-text-muted",children:[s.ttft.toFixed(2),"s TTFT · ",s.completionTime.toFixed(2),"s gen"]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-text-muted",children:"Tokens:"})," ",l.jsxs("span",{className:"text-text-primary",children:[s.promptTokens," → ",s.completionTokens]})]}),l.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[s.temperature!==void 0&&l.jsx(Kc,{label:"temp",value:s.temperature.toFixed(2)}),s.topP!==void 0&&l.jsx(Kc,{label:"topP",value:s.topP.toFixed(2)}),s.topK!==void 0&&l.jsx(Kc,{label:"topK",value:String(s.topK)}),s.maxTokens!==void 0&&l.jsx(Kc,{label:"maxTok",value:String(s.maxTokens)})]})]})]},a))]})]})})}function qc({label:e,value:t}){return l.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[l.jsx("div",{className:"text-xs text-text-muted",children:e}),l.jsx("div",{className:"text-lg font-semibold text-text-primary",children:t})]})}function Kc({label:e,value:t}){return l.jsxs("span",{className:"bg-bg-tertiary px-1.5 py-0.5 rounded text-text-primary",children:[l.jsxs("span",{className:"text-text-muted",children:[e,":"]})," ",t]})}function TN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const NN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LN={};function tb(e,t){return(LN.jsx?AN:NN).test(e)}const DN=/[ \t\n\f\r]/g;function RN(e){return typeof e=="object"?e.type==="text"?nb(e.value):!1:nb(e)}function nb(e){return e.replace(DN,"")===""}let wl=class{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}};wl.prototype.normal={};wl.prototype.property={};wl.prototype.space=void 0;function KS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new wl(n,s,t)}function Nm(e){return e.toLowerCase()}let Rn=class{constructor(t,n){this.attribute=n,this.property=t}};Rn.prototype.attribute="";Rn.prototype.booleanish=!1;Rn.prototype.boolean=!1;Rn.prototype.commaOrSpaceSeparated=!1;Rn.prototype.commaSeparated=!1;Rn.prototype.defined=!1;Rn.prototype.mustUseProperty=!1;Rn.prototype.number=!1;Rn.prototype.overloadedBoolean=!1;Rn.prototype.property="";Rn.prototype.spaceSeparated=!1;Rn.prototype.space=void 0;let ON=0;const Xe=Ri(),Qt=Ri(),Am=Ri(),Ce=Ri(),jt=Ri(),Pa=Ri(),Fn=Ri();function Ri(){return 2**++ON}const Lm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:Qt,commaOrSpaceSeparated:Fn,commaSeparated:Pa,number:Ce,overloadedBoolean:Am,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),Bf=Object.keys(Lm);let bp=class extends Rn{constructor(t,n,s,a){let o=-1;if(super(t,n),rb(this,"space",a),typeof s=="number")for(;++o<Bf.length;){const u=Bf[o];rb(this,Bf[o],(s&Lm[u])===Lm[u])}}};bp.prototype.defined=!0;function rb(e,t,n){n&&(e[t]=n)}function Va(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new bp(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[Nm(s)]=s,n[Nm(o.attribute)]=s}return new wl(t,n,e.space)}const YS=Va({properties:{ariaActiveDescendant:null,ariaAtomic:Qt,ariaAutoComplete:null,ariaBusy:Qt,ariaChecked:Qt,ariaColCount:Ce,ariaColIndex:Ce,ariaColSpan:Ce,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Qt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Qt,ariaFlowTo:jt,ariaGrabbed:Qt,ariaHasPopup:null,ariaHidden:Qt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:Ce,ariaLive:null,ariaModal:Qt,ariaMultiLine:Qt,ariaMultiSelectable:Qt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:Ce,ariaPressed:Qt,ariaReadOnly:Qt,ariaRelevant:null,ariaRequired:Qt,ariaRoleDescription:jt,ariaRowCount:Ce,ariaRowIndex:Ce,ariaRowSpan:Ce,ariaSelected:Qt,ariaSetSize:Ce,ariaSort:null,ariaValueMax:Ce,ariaValueMin:Ce,ariaValueNow:Ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function XS(e,t){return t in e?e[t]:t}function QS(e,t){return XS(e,t.toLowerCase())}const MN=Va({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pa,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:jt,autoFocus:Xe,autoPlay:Xe,blocking:jt,capture:null,charSet:null,checked:Xe,cite:null,className:jt,cols:Ce,colSpan:null,content:null,contentEditable:Qt,controls:Xe,controlsList:jt,coords:Ce|Pa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:Am,draggable:Qt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:jt,height:Ce,hidden:Am,high:Ce,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:jt,itemRef:jt,itemScope:Xe,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:Ce,manifest:null,max:null,maxLength:Ce,media:null,method:null,min:null,minLength:Ce,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xe,optimum:Ce,pattern:null,ping:jt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:jt,required:Xe,reversed:Xe,rows:Ce,rowSpan:Ce,sandbox:jt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:Ce,sizes:null,slot:null,span:Ce,spellCheck:Qt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ce,step:null,style:null,tabIndex:Ce,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:Qt,width:Ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:Ce,borderColor:null,bottomMargin:Ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:Ce,leftMargin:Ce,link:null,longDesc:null,lowSrc:null,marginHeight:Ce,marginWidth:Ce,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:Ce,rules:null,scheme:null,scrolling:Qt,standby:null,summary:null,text:null,topMargin:Ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:Ce,security:null,unselectable:null},space:"html",transform:QS}),IN=Va({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fn,accentHeight:Ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ce,amplitude:Ce,arabicForm:null,ascent:Ce,attributeName:null,attributeType:null,azimuth:Ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ce,by:null,calcMode:null,capHeight:Ce,className:jt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ce,diffuseConstant:Ce,direction:null,display:null,dur:null,divisor:Ce,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ce,enableBackground:null,end:null,event:null,exponent:Ce,externalResourcesRequired:null,fill:null,fillOpacity:Ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pa,g2:Pa,glyphName:Pa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ce,horizOriginX:Ce,horizOriginY:Ce,id:null,ideographic:Ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ce,k:Ce,k1:Ce,k2:Ce,k3:Ce,k4:Ce,kernelMatrix:Fn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ce,overlineThickness:Ce,paintOrder:null,panose1:null,path:null,pathLength:Ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ce,pointsAtY:Ce,pointsAtZ:Ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fn,rev:Fn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fn,requiredFeatures:Fn,requiredFonts:Fn,requiredFormats:Fn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ce,specularExponent:Ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ce,strikethroughThickness:Ce,string:null,stroke:null,strokeDashArray:Fn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ce,strokeOpacity:Ce,strokeWidth:null,style:null,surfaceScale:Ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fn,tabIndex:Ce,tableValues:null,target:null,targetX:Ce,targetY:Ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ce,underlineThickness:Ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ce,values:null,vAlphabetic:Ce,vMathematical:Ce,vectorEffect:null,vHanging:Ce,vIdeographic:Ce,version:null,vertAdvY:Ce,vertOriginX:Ce,vertOriginY:Ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:XS}),JS=Va({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ZS=Va({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:QS}),e1=Va({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),PN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},BN=/[A-Z]/g,sb=/-[a-z]/g,zN=/^data[-\w.:]+$/i;function HN(e,t){const n=Nm(t);let s=t,a=Rn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zN.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(sb,UN);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!sb.test(o)){let u=o.replace(BN,$N);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=bp}return new a(s,t)}function $N(e){return"-"+e.toLowerCase()}function UN(e){return e.charAt(1).toUpperCase()}const FN=KS([YS,MN,JS,ZS,e1],"html"),Sp=KS([YS,IN,JS,ZS,e1],"svg");function VN(e){return e.join(" ").trim()}var ka={},zf,ib;function GN(){if(ib)return zf;ib=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
95
|
-
`,f="/",p="*",m="",x="comment",_="declaration";function w(v,S){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];S=S||{};var y=1,b=1;function E(Y){var W=Y.match(t);W&&(y+=W.length);var H=Y.lastIndexOf(d);b=~H?Y.length-H:b+Y.length}function N(){var Y={line:y,column:b};return function(W){return W.position=new T(Y),M(),W}}function T(Y){this.start=Y,this.end={line:y,column:b},this.source=S.source}T.prototype.content=v;function L(Y){var W=new Error(S.source+":"+y+":"+b+": "+Y);if(W.reason=Y,W.filename=S.source,W.line=y,W.column=b,W.source=v,!S.silent)throw W}function A(Y){var W=Y.exec(v);if(W){var H=W[0];return E(H),v=v.slice(H.length),W}}function M(){A(n)}function D(Y){var W;for(Y=Y||[];W=U();)W!==!1&&Y.push(W);return Y}function U(){var Y=N();if(!(f!=v.charAt(0)||p!=v.charAt(1))){for(var W=2;m!=v.charAt(W)&&(p!=v.charAt(W)||f!=v.charAt(W+1));)++W;if(W+=2,m===v.charAt(W-1))return L("End of comment missing");var H=v.slice(2,W-2);return b+=2,E(H),v=v.slice(W),b+=2,Y({type:x,comment:H})}}function F(){var Y=N(),W=A(s);if(W){if(U(),!A(a))return L("property missing ':'");var H=A(o),K=Y({type:_,property:k(W[0].replace(e,m)),value:H?k(H[0].replace(e,m)):m});return A(u),K}}function B(){var Y=[];D(Y);for(var W;W=F();)W!==!1&&(Y.push(W),D(Y));return Y}return M(),B()}function k(v){return v?v.replace(c,m):m}return zf=w,zf}var ab;function WN(){if(ab)return ka;ab=1;var e=ka&&ka.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ka,"__esModule",{value:!0}),ka.default=n;const t=e(GN());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const u=(0,t.default)(s),c=typeof a=="function";return u.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;c?a(f,p,d):p&&(o=o||{},o[f]=p)}),o}return ka}var Go={},ob;function qN(){if(ob)return Go;ob=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},u=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),o(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(a,c):f=f.replace(s,c),f.replace(t,u))};return Go.camelCase=d,Go}var Wo,lb;function KN(){if(lb)return Wo;lb=1;var e=Wo&&Wo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(WN()),n=qN();function s(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(c,d){c&&d&&(u[(0,n.camelCase)(c,o)]=d)}),u}return s.default=s,Wo=s,Wo}var YN=KN();const XN=Mu(YN),t1=n1("end"),wp=n1("start");function n1(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function QN(e){const t=wp(e),n=t1(e);if(t&&n)return{start:t,end:n}}function rl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cb(e.position):"start"in e||"end"in e?cb(e):"line"in e||"column"in e?Dm(e):""}function Dm(e){return ub(e&&e.line)+":"+ub(e&&e.column)}function cb(e){return Dm(e&&e.start)+"-"+Dm(e&&e.end)}function ub(e){return e&&typeof e=="number"?e:1}class bn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?o.ruleId=s:(o.source=s.slice(0,d),o.ruleId=s.slice(d+1))}if(!o.place&&o.ancestors&&o.ancestors){const d=o.ancestors[o.ancestors.length-1];d&&(o.place=d.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=c?c.line:void 0,this.name=rl(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bn.prototype.file="";bn.prototype.name="";bn.prototype.reason="";bn.prototype.message="";bn.prototype.stack="";bn.prototype.column=void 0;bn.prototype.line=void 0;bn.prototype.ancestors=void 0;bn.prototype.cause=void 0;bn.prototype.fatal=void 0;bn.prototype.place=void 0;bn.prototype.ruleId=void 0;bn.prototype.source=void 0;const Cp={}.hasOwnProperty,JN=new Map,ZN=/[A-Z]/g,eA=new Set(["table","tbody","thead","tfoot","tr"]),tA=new Set(["td","th"]),r1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=uA(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=cA(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Sp:FN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=s1(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function s1(e,t,n){if(t.type==="element")return rA(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return sA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return aA(e,t,n);if(t.type==="mdxjsEsm")return iA(e,t);if(t.type==="root")return oA(e,t,n);if(t.type==="text")return lA(e,t)}function rA(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Sp,e.schema=a),e.ancestors.push(t);const o=a1(e,t.tagName,!1),u=dA(e,t);let c=Ep(e,t);return eA.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!RN(d):!0})),i1(e,u,o,t),kp(u,c),e.ancestors.pop(),e.schema=s,e.create(t,o,u,n)}function sA(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}cl(e,t.position)}function iA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cl(e,t.position)}function aA(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Sp,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:a1(e,t.name,!0),u=hA(e,t),c=Ep(e,t);return i1(e,u,o,t),kp(u,c),e.ancestors.pop(),e.schema=s,e.create(t,o,u,n)}function oA(e,t,n){const s={};return kp(s,Ep(e,t)),e.create(t,e.Fragment,s,n)}function lA(e,t){return t.value}function i1(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function kp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function cA(e,t,n){return s;function s(a,o,u,c){const f=Array.isArray(u.children)?n:t;return c?f(o,u,c):f(o,u)}}function uA(e,t){return n;function n(s,a,o,u){const c=Array.isArray(o.children),d=wp(s);return t(a,o,u,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function dA(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Cp.call(t.properties,a)){const o=fA(e,a,t.properties[a]);if(o){const[u,c]=o;e.tableCellAlignToStyle&&u==="align"&&typeof c=="string"&&tA.has(t.tagName)?s=c:n[u]=c}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function hA(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const u=o.expression;u.type;const c=u.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else cl(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const c=s.value.data.estree.body[0];c.type,o=e.evaluater.evaluateExpression(c.expression)}else cl(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Ep(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:JN;for(;++s<t.children.length;){const o=t.children[s];let u;if(e.passKeys){const d=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(d){const f=a.get(d)||0;u=d+"-"+f,a.set(d,f+1)}}const c=s1(e,o,u);c!==void 0&&n.push(c)}return n}function fA(e,t,n){const s=HN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?TN(n):VN(n)),s.property==="style"){let a=typeof n=="object"?n:mA(e,String(n));return e.stylePropertyNameCase==="css"&&(a=pA(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?PN[s.property]||s.property:s.attribute,n]}}function mA(e,t){try{return XN(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new bn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=r1+"#cannot-parse-style-attribute",a}}function a1(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const c=tb(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}s=u}else s=tb(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Cp.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);cl(e)}function cl(e,t){const n=new bn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=r1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function pA(e){const t={};let n;for(n in e)Cp.call(e,n)&&(t[gA(n)]=e[n]);return t}function gA(e){let t=e.replace(ZN,xA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xA(e){return"-"+e.toLowerCase()}const Hf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},_A={};function jp(e,t){const n=_A,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return o1(e,s,a)}function o1(e,t,n){if(yA(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return db(e.children,t,n)}return Array.isArray(e)?db(e,t,n):""}function db(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=o1(e[a],t,n);return s.join("")}function yA(e){return!!(e&&typeof e=="object")}const hb=document.createElement("i");function Tp(e){const t="&"+e+";";hb.innerHTML=t;const n=hb.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Wn(e,t,n,s){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)u=Array.from(s),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<s.length;)u=s.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function ir(e,t){return e.length>0?(Wn(e,e.length,0,t),e):t}const fb={}.hasOwnProperty;function l1(e){const t={};let n=-1;for(;++n<e.length;)vA(t,e[n]);return t}function vA(e,t){let n;for(n in t){const a=(fb.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){fb.call(a,u)||(a[u]=[]);const c=o[u];bA(a[u],Array.isArray(c)?c:c?[c]:[])}}}function bA(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Wn(e,0,0,s)}function c1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function yr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Cn=Ks(/[A-Za-z]/),vn=Ks(/[\dA-Za-z]/),SA=Ks(/[#-'*+\--9=?A-Z^-~]/);function _u(e){return e!==null&&(e<32||e===127)}const Rm=Ks(/\d/),wA=Ks(/[\dA-Fa-f]/),CA=Ks(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function Et(e){return e!==null&&(e<0||e===32)}function rt(e){return e===-2||e===-1||e===32}const Wu=Ks(new RegExp("\\p{P}|\\p{S}","u")),Ai=Ks(/\s/);function Ks(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ga(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&vn(e.charCodeAt(n+1))&&vn(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(u=String.fromCharCode(o,c),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(s,n),encodeURIComponent(u)),s=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function lt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(d){return rt(d)?(e.enter(n),c(d)):t(d)}function c(d){return rt(d)&&o++<a?(e.consume(d),c):(e.exit(n),t(d))}}const kA={tokenize:EA};function EA(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,t,"linePrefix")}function a(c){return e.enter("paragraph"),o(c)}function o(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,u(c)}function u(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return He(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),u)}}const jA={tokenize:TA},mb={tokenize:NA};function TA(e){const t=this,n=[];let s=0,a,o,u;return c;function c(b){if(s<n.length){const E=n[s];return t.containerState=E[1],e.attempt(E[0].continuation,d,f)(b)}return f(b)}function d(b){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&y();const E=t.events.length;let N=E,T;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){T=t.events[N][1].end;break}S(s);let L=E;for(;L<t.events.length;)t.events[L][1].end={...T},L++;return Wn(t.events,N+1,0,t.events.slice(E)),t.events.length=L,f(b)}return c(b)}function f(b){if(s===n.length){if(!a)return x(b);if(a.currentConstruct&&a.currentConstruct.concrete)return w(b);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mb,p,m)(b)}function p(b){return a&&y(),S(s),x(b)}function m(b){return t.parser.lazy[t.now().line]=s!==n.length,u=t.now().offset,w(b)}function x(b){return t.containerState={},e.attempt(mb,_,w)(b)}function _(b){return s++,n.push([t.currentConstruct,t.containerState]),x(b)}function w(b){if(b===null){a&&y(),S(0),e.consume(b);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(b)}function k(b){if(b===null){v(e.exit("chunkFlow"),!0),S(0),e.consume(b);return}return He(b)?(e.consume(b),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,c):(e.consume(b),k)}function v(b,E){const N=t.sliceStream(b);if(E&&N.push(null),b.previous=o,o&&(o.next=b),o=b,a.defineSkip(b.start),a.write(N),t.parser.lazy[b.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<u&&(!a.events[T][1].end||a.events[T][1].end.offset>u))return;const L=t.events.length;let A=L,M,D;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(M){D=t.events[A][1].end;break}M=!0}for(S(s),T=L;T<t.events.length;)t.events[T][1].end={...D},T++;Wn(t.events,A+1,0,t.events.slice(L)),t.events.length=T}}function S(b){let E=n.length;for(;E-- >b;){const N=n[E];t.containerState=N[1],N[0].exit.call(t,e)}n.length=b}function y(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function NA(e,t,n){return lt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ha(e){if(e===null||Et(e)||Ai(e))return 1;if(Wu(e))return 2}function qu(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const Om={name:"attention",resolveAll:AA,tokenize:LA};function AA(e,t){let n=-1,s,a,o,u,c,d,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},x={...e[n][1].start};pb(m,-d),pb(x,d),u={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},o={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...u.start},end:{...c.end}},e[s][1].end={...u.start},e[n][1].start={...c.end},f=[],e[s][1].end.offset-e[s][1].start.offset&&(f=ir(f,[["enter",e[s][1],t],["exit",e[s][1],t]])),f=ir(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),f=ir(f,qu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),f=ir(f,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=ir(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Wn(e,s-1,n-s+3,f),n=s+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function LA(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ha(s);let o;return u;function u(d){return o=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===o)return e.consume(d),c;const f=e.exit("attentionSequence"),p=Ha(d),m=!p||p===2&&a||n.includes(d),x=!a||a===2&&p||n.includes(s);return f._open=!!(o===42?m:m&&(a||!x)),f._close=!!(o===42?x:x&&(p||!m)),t(d)}}function pb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const DA={name:"autolink",tokenize:RA};function RA(e,t,n){let s=0;return a;function a(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(_){return Cn(_)?(e.consume(_),u):_===64?n(_):f(_)}function u(_){return _===43||_===45||_===46||vn(_)?(s=1,c(_)):f(_)}function c(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||vn(_))&&s++<32?(e.consume(_),c):(s=0,f(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),t):_===null||_===32||_===60||_u(_)?n(_):(e.consume(_),d)}function f(_){return _===64?(e.consume(_),p):SA(_)?(e.consume(_),f):n(_)}function p(_){return vn(_)?m(_):n(_)}function m(_){return _===46?(e.consume(_),s=0,p):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),t):x(_)}function x(_){if((_===45||vn(_))&&s++<63){const w=_===45?x:m;return e.consume(_),w}return n(_)}}const Cl={partial:!0,tokenize:OA};function OA(e,t,n){return s;function s(o){return rt(o)?lt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||He(o)?t(o):n(o)}}const u1={continuation:{tokenize:IA},exit:PA,name:"blockQuote",tokenize:MA};function MA(e,t,n){const s=this;return a;function a(u){if(u===62){const c=s.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return rt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function IA(e,t,n){const s=this;return a;function a(u){return rt(u)?lt(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(u1,t,n)(u)}}function PA(e){e.exit("blockQuote")}const d1={name:"characterEscape",tokenize:BA};function BA(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return CA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const h1={name:"characterReference",tokenize:zA};function zA(e,t,n){const s=this;let a=0,o,u;return c;function c(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,u=vn,p(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=wA,p):(e.enter("characterReferenceValue"),o=7,u=Rm,p(m))}function p(m){if(m===59&&a){const x=e.exit("characterReferenceValue");return u===vn&&!Tp(s.sliceSerialize(x))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&a++<o?(e.consume(m),p):n(m)}}const gb={partial:!0,tokenize:$A},xb={concrete:!0,name:"codeFenced",tokenize:HA};function HA(e,t,n){const s=this,a={partial:!0,tokenize:N};let o=0,u=0,c;return d;function d(T){return f(T)}function f(T){const L=s.events[s.events.length-1];return o=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,c=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===c?(u++,e.consume(T),p):u<3?n(T):(e.exit("codeFencedFenceSequence"),rt(T)?lt(e,m,"whitespace")(T):m(T))}function m(T){return T===null||He(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(gb,k,E)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===null||He(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):rt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,_,"whitespace")(T)):T===96&&T===c?n(T):(e.consume(T),x)}function _(T){return T===null||He(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(T))}function w(T){return T===null||He(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===c?n(T):(e.consume(T),w)}function k(T){return e.attempt(a,E,v)(T)}function v(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),S}function S(T){return o>0&&rt(T)?lt(e,y,"linePrefix",o+1)(T):y(T)}function y(T){return T===null||He(T)?e.check(gb,k,E)(T):(e.enter("codeFlowValue"),b(T))}function b(T){return T===null||He(T)?(e.exit("codeFlowValue"),y(T)):(e.consume(T),b)}function E(T){return e.exit("codeFenced"),t(T)}function N(T,L,A){let M=0;return D;function D(W){return T.enter("lineEnding"),T.consume(W),T.exit("lineEnding"),U}function U(W){return T.enter("codeFencedFence"),rt(W)?lt(T,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):F(W)}function F(W){return W===c?(T.enter("codeFencedFenceSequence"),B(W)):A(W)}function B(W){return W===c?(M++,T.consume(W),B):M>=u?(T.exit("codeFencedFenceSequence"),rt(W)?lt(T,Y,"whitespace")(W):Y(W)):A(W)}function Y(W){return W===null||He(W)?(T.exit("codeFencedFence"),L(W)):A(W)}}}function $A(e,t,n){const s=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}const $f={name:"codeIndented",tokenize:FA},UA={partial:!0,tokenize:VA};function FA(e,t,n){const s=this;return a;function a(f){return e.enter("codeIndented"),lt(e,o,"linePrefix",5)(f)}function o(f){const p=s.events[s.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(f):n(f)}function u(f){return f===null?d(f):He(f)?e.attempt(UA,u,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||He(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),t(f)}}function VA(e,t,n){const s=this;return a;function a(u){return s.parser.lazy[s.now().line]?n(u):He(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):lt(e,o,"linePrefix",5)(u)}function o(u){const c=s.events[s.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):He(u)?a(u):n(u)}}const GA={name:"codeText",previous:qA,resolve:WA,tokenize:KA};function WA(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function qA(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function KA(e,t,n){let s=0,a,o;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),c(m)}function c(m){return m===96?(e.consume(m),s++,c):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(o=e.enter("codeTextSequence"),a=0,p(m)):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||He(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),f)}function p(m){return m===96?(e.consume(m),a++,p):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(o.type="codeTextData",f(m))}}class YA{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&qo(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),qo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),qo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);qo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);qo(this.left,n.reverse())}}}function qo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function f1(e){const t={};let n=-1,s,a,o,u,c,d,f;const p=new YA(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(s=p.get(n),n&&s[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,o=0,o<d.length&&d[o][1].type==="lineEndingBlank"&&(o+=2),o<d.length&&d[o][1].type==="content"))for(;++o<d.length&&d[o][1].type!=="content";)d[o][1].type==="chunkText"&&(d[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,XA(p,n)),n=t[n],f=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(u=p.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(p.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(s[1].end={...p.get(a)[1].start},c=p.slice(a,n),c.unshift(s),p.splice(a,n-a+1,c))}}return Wn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function XA(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let u=n._tokenizer;u||(u=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const c=u.events,d=[],f={};let p,m,x=-1,_=n,w=0,k=0;const v=[k];for(;_;){for(;e.get(++a)[1]!==_;);o.push(a),_._tokenizer||(p=s.sliceStream(_),_.next||p.push(null),m&&u.defineSkip(_.start),_._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(p),_._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=n;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(k=x+1,v.push(k),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(u.events=[],_?(_._tokenizer=void 0,_.previous=void 0):v.pop(),x=v.length;x--;){const S=c.slice(v[x],v[x+1]),y=o.pop();d.push([y,y+S.length-1]),e.splice(y,2,S)}for(d.reverse(),x=-1;++x<d.length;)f[w+d[x][0]]=w+d[x][1],w+=d[x][1]-d[x][0]-1;return f}const QA={resolve:ZA,tokenize:eL},JA={partial:!0,tokenize:tL};function ZA(e){return f1(e),e}function eL(e,t){let n;return s;function s(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(c)}function a(c){return c===null?o(c):He(c)?e.check(JA,u,o)(c):(e.consume(c),a)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function u(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function tL(e,t,n){const s=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),lt(e,o,"linePrefix")}function o(u){if(u===null||He(u))return n(u);const c=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(u):e.interrupt(s.parser.constructs.flow,n,t)(u)}}function m1(e,t,n,s,a,o,u,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(S){return S===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(S),e.exit(o),x):S===null||S===32||S===41||_u(S)?n(S):(e.enter(s),e.enter(u),e.enter(c),e.enter("chunkString",{contentType:"string"}),k(S))}function x(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),_(S))}function _(S){return S===62?(e.exit("chunkString"),e.exit(c),x(S)):S===null||S===60||He(S)?n(S):(e.consume(S),S===92?w:_)}function w(S){return S===60||S===62||S===92?(e.consume(S),_):_(S)}function k(S){return!p&&(S===null||S===41||Et(S))?(e.exit("chunkString"),e.exit(c),e.exit(u),e.exit(s),t(S)):p<f&&S===40?(e.consume(S),p++,k):S===41?(e.consume(S),p--,k):S===null||S===32||S===40||_u(S)?n(S):(e.consume(S),S===92?v:k)}function v(S){return S===40||S===41||S===92?(e.consume(S),k):k(S)}}function p1(e,t,n,s,a,o){const u=this;let c=0,d;return f;function f(_){return e.enter(s),e.enter(a),e.consume(_),e.exit(a),e.enter(o),p}function p(_){return c>999||_===null||_===91||_===93&&!d||_===94&&!c&&"_hiddenFootnoteSupport"in u.parser.constructs?n(_):_===93?(e.exit(o),e.enter(a),e.consume(_),e.exit(a),e.exit(s),t):He(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||He(_)||c++>999?(e.exit("chunkString"),p(_)):(e.consume(_),d||(d=!rt(_)),_===92?x:m)}function x(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function g1(e,t,n,s,a,o){let u;return c;function c(x){return x===34||x===39||x===40?(e.enter(s),e.enter(a),e.consume(x),e.exit(a),u=x===40?41:x,d):n(x)}function d(x){return x===u?(e.enter(a),e.consume(x),e.exit(a),e.exit(s),t):(e.enter(o),f(x))}function f(x){return x===u?(e.exit(o),d(u)):x===null?n(x):He(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),lt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===u||x===null||He(x)?(e.exit("chunkString"),f(x)):(e.consume(x),x===92?m:p)}function m(x){return x===u||x===92?(e.consume(x),p):p(x)}}function sl(e,t){let n;return s;function s(a){return He(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):rt(a)?lt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const nL={name:"definition",tokenize:sL},rL={partial:!0,tokenize:iL};function sL(e,t,n){const s=this;let a;return o;function o(_){return e.enter("definition"),u(_)}function u(_){return p1.call(s,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function c(_){return a=yr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):n(_)}function d(_){return Et(_)?sl(e,f)(_):f(_)}function f(_){return m1(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function p(_){return e.attempt(rL,m,m)(_)}function m(_){return rt(_)?lt(e,x,"whitespace")(_):x(_)}function x(_){return _===null||He(_)?(e.exit("definition"),s.parser.defined.push(a),t(_)):n(_)}}function iL(e,t,n){return s;function s(c){return Et(c)?sl(e,a)(c):n(c)}function a(c){return g1(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return rt(c)?lt(e,u,"whitespace")(c):u(c)}function u(c){return c===null||He(c)?t(c):n(c)}}const aL={name:"hardBreakEscape",tokenize:oL};function oL(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return He(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const lL={name:"headingAtx",resolve:cL,tokenize:uL};function cL(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Wn(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function uL(e,t,n){let s=0;return a;function a(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&s++<6?(e.consume(p),u):p===null||Et(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||He(p)?(e.exit("atxHeading"),t(p)):rt(p)?lt(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||Et(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const dL=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],_b=["pre","script","style","textarea"],hL={concrete:!0,name:"htmlFlow",resolveTo:pL,tokenize:gL},fL={partial:!0,tokenize:_L},mL={partial:!0,tokenize:xL};function pL(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function gL(e,t,n){const s=this;let a,o,u,c,d;return f;function f($){return p($)}function p($){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume($),m}function m($){return $===33?(e.consume($),x):$===47?(e.consume($),o=!0,k):$===63?(e.consume($),a=3,s.interrupt?t:O):Cn($)?(e.consume($),u=String.fromCharCode($),v):n($)}function x($){return $===45?(e.consume($),a=2,_):$===91?(e.consume($),a=5,c=0,w):Cn($)?(e.consume($),a=4,s.interrupt?t:O):n($)}function _($){return $===45?(e.consume($),s.interrupt?t:O):n($)}function w($){const ee="CDATA[";return $===ee.charCodeAt(c++)?(e.consume($),c===ee.length?s.interrupt?t:F:w):n($)}function k($){return Cn($)?(e.consume($),u=String.fromCharCode($),v):n($)}function v($){if($===null||$===47||$===62||Et($)){const ee=$===47,Z=u.toLowerCase();return!ee&&!o&&_b.includes(Z)?(a=1,s.interrupt?t($):F($)):dL.includes(u.toLowerCase())?(a=6,ee?(e.consume($),S):s.interrupt?t($):F($)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n($):o?y($):b($))}return $===45||vn($)?(e.consume($),u+=String.fromCharCode($),v):n($)}function S($){return $===62?(e.consume($),s.interrupt?t:F):n($)}function y($){return rt($)?(e.consume($),y):D($)}function b($){return $===47?(e.consume($),D):$===58||$===95||Cn($)?(e.consume($),E):rt($)?(e.consume($),b):D($)}function E($){return $===45||$===46||$===58||$===95||vn($)?(e.consume($),E):N($)}function N($){return $===61?(e.consume($),T):rt($)?(e.consume($),N):b($)}function T($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),d=$,L):rt($)?(e.consume($),T):A($)}function L($){return $===d?(e.consume($),d=null,M):$===null||He($)?n($):(e.consume($),L)}function A($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Et($)?N($):(e.consume($),A)}function M($){return $===47||$===62||rt($)?b($):n($)}function D($){return $===62?(e.consume($),U):n($)}function U($){return $===null||He($)?F($):rt($)?(e.consume($),U):n($)}function F($){return $===45&&a===2?(e.consume($),H):$===60&&a===1?(e.consume($),K):$===62&&a===4?(e.consume($),z):$===63&&a===3?(e.consume($),O):$===93&&a===5?(e.consume($),P):He($)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(fL,V,B)($)):$===null||He($)?(e.exit("htmlFlowData"),B($)):(e.consume($),F)}function B($){return e.check(mL,Y,V)($)}function Y($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),W}function W($){return $===null||He($)?B($):(e.enter("htmlFlowData"),F($))}function H($){return $===45?(e.consume($),O):F($)}function K($){return $===47?(e.consume($),u="",X):F($)}function X($){if($===62){const ee=u.toLowerCase();return _b.includes(ee)?(e.consume($),z):F($)}return Cn($)&&u.length<8?(e.consume($),u+=String.fromCharCode($),X):F($)}function P($){return $===93?(e.consume($),O):F($)}function O($){return $===62?(e.consume($),z):$===45&&a===2?(e.consume($),O):F($)}function z($){return $===null||He($)?(e.exit("htmlFlowData"),V($)):(e.consume($),z)}function V($){return e.exit("htmlFlow"),t($)}}function xL(e,t,n){const s=this;return a;function a(u){return He(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}function _L(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Cl,t,n)}}const yL={name:"htmlText",tokenize:vL};function vL(e,t,n){const s=this;let a,o,u;return c;function c(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),d}function d(O){return O===33?(e.consume(O),f):O===47?(e.consume(O),N):O===63?(e.consume(O),b):Cn(O)?(e.consume(O),A):n(O)}function f(O){return O===45?(e.consume(O),p):O===91?(e.consume(O),o=0,w):Cn(O)?(e.consume(O),y):n(O)}function p(O){return O===45?(e.consume(O),_):n(O)}function m(O){return O===null?n(O):O===45?(e.consume(O),x):He(O)?(u=m,K(O)):(e.consume(O),m)}function x(O){return O===45?(e.consume(O),_):m(O)}function _(O){return O===62?H(O):O===45?x(O):m(O)}function w(O){const z="CDATA[";return O===z.charCodeAt(o++)?(e.consume(O),o===z.length?k:w):n(O)}function k(O){return O===null?n(O):O===93?(e.consume(O),v):He(O)?(u=k,K(O)):(e.consume(O),k)}function v(O){return O===93?(e.consume(O),S):k(O)}function S(O){return O===62?H(O):O===93?(e.consume(O),S):k(O)}function y(O){return O===null||O===62?H(O):He(O)?(u=y,K(O)):(e.consume(O),y)}function b(O){return O===null?n(O):O===63?(e.consume(O),E):He(O)?(u=b,K(O)):(e.consume(O),b)}function E(O){return O===62?H(O):b(O)}function N(O){return Cn(O)?(e.consume(O),T):n(O)}function T(O){return O===45||vn(O)?(e.consume(O),T):L(O)}function L(O){return He(O)?(u=L,K(O)):rt(O)?(e.consume(O),L):H(O)}function A(O){return O===45||vn(O)?(e.consume(O),A):O===47||O===62||Et(O)?M(O):n(O)}function M(O){return O===47?(e.consume(O),H):O===58||O===95||Cn(O)?(e.consume(O),D):He(O)?(u=M,K(O)):rt(O)?(e.consume(O),M):H(O)}function D(O){return O===45||O===46||O===58||O===95||vn(O)?(e.consume(O),D):U(O)}function U(O){return O===61?(e.consume(O),F):He(O)?(u=U,K(O)):rt(O)?(e.consume(O),U):M(O)}function F(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),a=O,B):He(O)?(u=F,K(O)):rt(O)?(e.consume(O),F):(e.consume(O),Y)}function B(O){return O===a?(e.consume(O),a=void 0,W):O===null?n(O):He(O)?(u=B,K(O)):(e.consume(O),B)}function Y(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||Et(O)?M(O):(e.consume(O),Y)}function W(O){return O===47||O===62||Et(O)?M(O):n(O)}function H(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function K(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),X}function X(O){return rt(O)?lt(e,P,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):P(O)}function P(O){return e.enter("htmlTextData"),u(O)}}const Np={name:"labelEnd",resolveAll:CL,resolveTo:kL,tokenize:EL},bL={tokenize:jL},SL={tokenize:TL},wL={tokenize:NL};function CL(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Wn(e,0,e.length,n),e}function kL(e,t){let n=e.length,s=0,a,o,u,c;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(u=n);const d={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},p={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[u-2][1].start}};return c=[["enter",d,t],["enter",f,t]],c=ir(c,e.slice(o+1,o+s+3)),c=ir(c,[["enter",p,t]]),c=ir(c,qu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,u-3),t)),c=ir(c,[["exit",p,t],e[u-2],e[u-1],["exit",f,t]]),c=ir(c,e.slice(u+1)),c=ir(c,[["exit",d,t]]),Wn(e,o,e.length,c),e}function EL(e,t,n){const s=this;let a=s.events.length,o,u;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return c;function c(x){return o?o._inactive?m(x):(u=s.parser.defined.includes(yr(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):n(x)}function d(x){return x===40?e.attempt(bL,p,u?p:m)(x):x===91?e.attempt(SL,p,u?f:m)(x):u?p(x):m(x)}function f(x){return e.attempt(wL,p,m)(x)}function p(x){return t(x)}function m(x){return o._balanced=!0,n(x)}}function jL(e,t,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Et(m)?sl(e,o)(m):o(m)}function o(m){return m===41?p(m):m1(e,u,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return Et(m)?sl(e,d)(m):p(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?g1(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function f(m){return Et(m)?sl(e,p)(m):p(m)}function p(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function TL(e,t,n){const s=this;return a;function a(c){return p1.call(s,e,o,u,"reference","referenceMarker","referenceString")(c)}function o(c){return s.parser.defined.includes(yr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function u(c){return n(c)}}function NL(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const AL={name:"labelStartImage",resolveAll:Np.resolveAll,tokenize:LL};function LL(e,t,n){const s=this;return a;function a(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),u):n(c)}function u(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const DL={name:"labelStartLink",resolveAll:Np.resolveAll,tokenize:RL};function RL(e,t,n){const s=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const Uf={name:"lineEnding",tokenize:OL};function OL(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),lt(e,t,"linePrefix")}}const cu={name:"thematicBreak",tokenize:ML};function ML(e,t,n){let s=0,a;return o;function o(f){return e.enter("thematicBreak"),u(f)}function u(f){return a=f,c(f)}function c(f){return f===a?(e.enter("thematicBreakSequence"),d(f)):s>=3&&(f===null||He(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===a?(e.consume(f),s++,d):(e.exit("thematicBreakSequence"),rt(f)?lt(e,c,"whitespace")(f):c(f))}}const Dn={continuation:{tokenize:zL},exit:$L,name:"list",tokenize:BL},IL={partial:!0,tokenize:UL},PL={partial:!0,tokenize:HL};function BL(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return c;function c(_){const w=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:Rm(_)){if(s.containerState.type||(s.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(cu,n,f)(_):f(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return n(_)}function d(_){return Rm(_)&&++u<10?(e.consume(_),d):(!s.interrupt||u<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),f(_)):n(_)}function f(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(Cl,s.interrupt?n:p,e.attempt(IL,x,m))}function p(_){return s.containerState.initialBlankLine=!0,o++,x(_)}function m(_){return rt(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),x):n(_)}function x(_){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(_)}}function zL(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Cl,a,o);function a(c){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,lt(e,t,"listItemIndent",s.containerState.size+1)(c)}function o(c){return s.containerState.furtherBlankLines||!rt(c)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,u(c)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(PL,t,u)(c))}function u(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,lt(e,e.attempt(Dn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function HL(e,t,n){const s=this;return lt(e,a,"listItemIndent",s.containerState.size+1);function a(o){const u=s.events[s.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===s.containerState.size?t(o):n(o)}}function $L(e){e.exit(this.containerState.type)}function UL(e,t,n){const s=this;return lt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=s.events[s.events.length-1];return!rt(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const yb={name:"setextUnderline",resolveTo:FL,tokenize:VL};function FL(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=u,e.push(["exit",u,t]),e}function VL(e,t,n){const s=this;let a;return o;function o(f){let p=s.events.length,m;for(;p--;)if(s.events[p][1].type!=="lineEnding"&&s.events[p][1].type!=="linePrefix"&&s.events[p][1].type!=="content"){m=s.events[p][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=f,u(f)):n(f)}function u(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===a?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),rt(f)?lt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||He(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const GL={tokenize:WL};function WL(e){const t=this,n=e.attempt(Cl,s,e.attempt(this.parser.constructs.flowInitial,a,lt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(QA,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const qL={resolveAll:_1()},KL=x1("string"),YL=x1("text");function x1(e){return{resolveAll:_1(e==="text"?XL:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,u,c);return u;function u(p){return f(p)?o(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),o(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const m=a[p];let x=-1;if(m)for(;++x<m.length;){const _=m[x];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function _1(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function XL(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,u=-1,c=0,d;for(;o--;){const f=a[o];if(typeof f=="string"){for(u=f.length;f.charCodeAt(u-1)===32;)c++,u--;if(u)break;u=-1}else if(f===-2)d=!0,c++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:s.start._bufferIndex+u,_index:s.start._index+o,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const QL={42:Dn,43:Dn,45:Dn,48:Dn,49:Dn,50:Dn,51:Dn,52:Dn,53:Dn,54:Dn,55:Dn,56:Dn,57:Dn,62:u1},JL={91:nL},ZL={[-2]:$f,[-1]:$f,32:$f},eD={35:lL,42:cu,45:[yb,cu],60:hL,61:yb,95:cu,96:xb,126:xb},tD={38:h1,92:d1},nD={[-5]:Uf,[-4]:Uf,[-3]:Uf,33:AL,38:h1,42:Om,60:[DA,yL],91:DL,92:[aL,d1],93:Np,95:Om,96:GA},rD={null:[Om,qL]},sD={null:[42,95]},iD={null:[]},aD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:sD,contentInitial:JL,disable:iD,document:QL,flow:eD,flowInitial:ZL,insideSpan:rD,string:tD,text:nD},Symbol.toStringTag,{value:"Module"}));function oD(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let u=[],c=[];const d={attempt:L(N),check:L(T),consume:y,enter:b,exit:E,interrupt:L(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:k,events:[],now:w,parser:e,previous:null,sliceSerialize:x,sliceStream:_,write:m};let p=t.tokenize.call(f,d);return t.resolveAll&&o.push(t),f;function m(U){return u=ir(u,U),v(),u[u.length-1]!==null?[]:(A(t,0),f.events=qu(o,f.events,f),f.events)}function x(U,F){return cD(_(U),F)}function _(U){return lD(u,U)}function w(){const{_bufferIndex:U,_index:F,line:B,column:Y,offset:W}=s;return{_bufferIndex:U,_index:F,line:B,column:Y,offset:W}}function k(U){a[U.line]=U.column,D()}function v(){let U;for(;s._index<u.length;){const F=u[s._index];if(typeof F=="string")for(U=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===U&&s._bufferIndex<F.length;)S(F.charCodeAt(s._bufferIndex));else S(F)}}function S(U){p=p(U)}function y(U){He(U)?(s.line++,s.column=1,s.offset+=U===-3?2:1,D()):U!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===u[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=U}function b(U,F){const B=F||{};return B.type=U,B.start=w(),f.events.push(["enter",B,f]),c.push(B),B}function E(U){const F=c.pop();return F.end=w(),f.events.push(["exit",F,f]),F}function N(U,F){A(U,F.from)}function T(U,F){F.restore()}function L(U,F){return B;function B(Y,W,H){let K,X,P,O;return Array.isArray(Y)?V(Y):"tokenize"in Y?V([Y]):z(Y);function z(re){return Q;function Q(G){const te=G!==null&&re[G],se=G!==null&&re.null,_e=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(se)?se:se?[se]:[]];return V(_e)(G)}}function V(re){return K=re,X=0,re.length===0?H:$(re[X])}function $(re){return Q;function Q(G){return O=M(),P=re,re.partial||(f.currentConstruct=re),re.name&&f.parser.constructs.disable.null.includes(re.name)?Z():re.tokenize.call(F?Object.assign(Object.create(f),F):f,d,ee,Z)(G)}}function ee(re){return U(P,O),W}function Z(re){return O.restore(),++X<K.length?$(K[X]):H}}}function A(U,F){U.resolveAll&&!o.includes(U)&&o.push(U),U.resolve&&Wn(f.events,F,f.events.length-F,U.resolve(f.events.slice(F),f)),U.resolveTo&&(f.events=U.resolveTo(f.events,f))}function M(){const U=w(),F=f.previous,B=f.currentConstruct,Y=f.events.length,W=Array.from(c);return{from:Y,restore:H};function H(){s=U,f.previous=F,f.currentConstruct=B,f.events.length=Y,c=W,D()}}function D(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function lD(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(s,o)];else{if(u=e.slice(n,a),s>-1){const c=u[0];typeof c=="string"?u[0]=c.slice(s):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function cD(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
96
|
-
`;break}case-3:{u=`\r
|
|
97
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,s.push(u)}return s.join("")}function uD(e){const s={constructs:l1([aD,...(e||{}).extensions||[]]),content:a(kA),defined:[],document:a(jA),flow:a(GL),lazy:{},string:a(KL),text:a(YL)};return s;function a(o){return u;function u(c){return oD(s,o,c)}}}function dD(e){for(;!f1(e););return e}const vb=/[\0\t\n\r]/g;function hD(){let e=1,t="",n=!0,s;return a;function a(o,u,c){const d=[];let f,p,m,x,_;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),m=0,t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(vb.lastIndex=m,f=vb.exec(o),x=f&&f.index!==void 0?f.index:o.length,_=o.charCodeAt(x),!f){t=o.slice(m);break}if(_===10&&m===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<x&&(d.push(o.slice(m,x)),e+=x-m),_){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}m=x+1}return c&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const fD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mD(e){return e.replace(fD,pD)}function pD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return c1(n.slice(o?2:1),o?16:10)}return Tp(n)||e}const y1={}.hasOwnProperty;function gD(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),xD(n)(dD(uD(n).document().write(hD()(e,t,!0))))}function xD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Se),autolinkProtocol:M,autolinkEmail:M,atxHeading:o(Me),blockQuote:o(se),characterEscape:M,characterReference:M,codeFenced:o(_e),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(_e,u),codeText:o(ye,u),codeTextData:M,data:M,codeFlowValue:M,definition:o(Ae),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(De),hardBreakEscape:o($e),hardBreakTrailing:o($e),htmlFlow:o(de,u),htmlFlowData:M,htmlText:o(de,u),htmlTextData:M,image:o(Ie),label:u,link:o(Se),listItem:o(je),listItemValue:x,listOrdered:o(fe,m),listUnordered:o(fe),paragraph:o(ot),reference:$,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(Me),strong:o(Ut),thematicBreak:o(pn)},exit:{atxHeading:d(),atxHeadingSequence:N,autolink:d(),autolinkEmail:te,autolinkProtocol:G,blockQuote:d(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:re,characterReference:Q,codeFenced:d(v),codeFencedFence:k,codeFencedFenceInfo:_,codeFencedFenceMeta:w,codeFlowValue:D,codeIndented:d(S),codeText:d(W),codeTextData:D,data:D,definition:d(),definitionDestinationString:E,definitionLabelString:y,definitionTitleString:b,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d(B),htmlFlowData:D,htmlText:d(Y),htmlTextData:D,image:d(K),label:P,labelText:X,lineEnding:U,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ee,resourceDestinationString:O,resourceTitleString:z,resource:V,setextHeading:d(A),setextHeadingLineSequence:L,setextHeadingText:T,strong:d(),thematicBreak:d()}};v1(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(me){let Ee={type:"root",children:[]};const Oe={stack:[Ee],tokenStack:[],config:t,enter:c,exit:f,buffer:u,resume:p,data:n},Fe=[];let Ke=-1;for(;++Ke<me.length;)if(me[Ke][1].type==="listOrdered"||me[Ke][1].type==="listUnordered")if(me[Ke][0]==="enter")Fe.push(Ke);else{const At=Fe.pop();Ke=a(me,At,Ke)}for(Ke=-1;++Ke<me.length;){const At=t[me[Ke][0]];y1.call(At,me[Ke][1].type)&&At[me[Ke][1].type].call(Object.assign({sliceSerialize:me[Ke][2].sliceSerialize},Oe),me[Ke][1])}if(Oe.tokenStack.length>0){const At=Oe.tokenStack[Oe.tokenStack.length-1];(At[1]||bb).call(Oe,void 0,At[0])}for(Ee.position={start:Is(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:Is(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke<t.transforms.length;)Ee=t.transforms[Ke](Ee)||Ee;return Ee}function a(me,Ee,Oe){let Fe=Ee-1,Ke=-1,At=!1,et,Lt,ft,gn;for(;++Fe<=Oe;){const pt=me[Fe];switch(pt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pt[0]==="enter"?Ke++:Ke--,gn=void 0;break}case"lineEndingBlank":{pt[0]==="enter"&&(et&&!gn&&!Ke&&!ft&&(ft=Fe),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=void 0}if(!Ke&&pt[0]==="enter"&&pt[1].type==="listItemPrefix"||Ke===-1&&pt[0]==="exit"&&(pt[1].type==="listUnordered"||pt[1].type==="listOrdered")){if(et){let cr=Fe;for(Lt=void 0;cr--;){const Mn=me[cr];if(Mn[1].type==="lineEnding"||Mn[1].type==="lineEndingBlank"){if(Mn[0]==="exit")continue;Lt&&(me[Lt][1].type="lineEndingBlank",At=!0),Mn[1].type="lineEnding",Lt=cr}else if(!(Mn[1].type==="linePrefix"||Mn[1].type==="blockQuotePrefix"||Mn[1].type==="blockQuotePrefixWhitespace"||Mn[1].type==="blockQuoteMarker"||Mn[1].type==="listItemIndent"))break}ft&&(!Lt||ft<Lt)&&(et._spread=!0),et.end=Object.assign({},Lt?me[Lt][1].start:pt[1].end),me.splice(Lt||Fe,0,["exit",et,pt[2]]),Fe++,Oe++}if(pt[1].type==="listItemPrefix"){const cr={type:"listItem",_spread:!1,start:Object.assign({},pt[1].start),end:void 0};et=cr,me.splice(Fe,0,["enter",cr,pt[2]]),Fe++,Oe++,ft=void 0,gn=!0}}}return me[Ee][1]._spread=At,Oe}function o(me,Ee){return Oe;function Oe(Fe){c.call(this,me(Fe),Fe),Ee&&Ee.call(this,Fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function c(me,Ee,Oe){this.stack[this.stack.length-1].children.push(me),this.stack.push(me),this.tokenStack.push([Ee,Oe||void 0]),me.position={start:Is(Ee.start),end:void 0}}function d(me){return Ee;function Ee(Oe){me&&me.call(this,Oe),f.call(this,Oe)}}function f(me,Ee){const Oe=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==me.type&&(Ee?Ee.call(this,me,Fe[0]):(Fe[1]||bb).call(this,me,Fe[0]));else throw new Error("Cannot close `"+me.type+"` ("+rl({start:me.start,end:me.end})+"): it’s not open");Oe.position.end=Is(me.end)}function p(){return jp(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(me){if(this.data.expectingFirstListItemValue){const Ee=this.stack[this.stack.length-2];Ee.start=Number.parseInt(this.sliceSerialize(me),10),this.data.expectingFirstListItemValue=void 0}}function _(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.lang=me}function w(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.meta=me}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me.replace(/(\r?\n|\r)$/g,"")}function y(me){const Ee=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=Ee,Oe.identifier=yr(this.sliceSerialize(me)).toLowerCase()}function b(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=me}function E(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=me}function N(me){const Ee=this.stack[this.stack.length-1];if(!Ee.depth){const Oe=this.sliceSerialize(me).length;Ee.depth=Oe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function L(me){const Ee=this.stack[this.stack.length-1];Ee.depth=this.sliceSerialize(me).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function M(me){const Oe=this.stack[this.stack.length-1].children;let Fe=Oe[Oe.length-1];(!Fe||Fe.type!=="text")&&(Fe=St(),Fe.position={start:Is(me.start),end:void 0},Oe.push(Fe)),this.stack.push(Fe)}function D(me){const Ee=this.stack.pop();Ee.value+=this.sliceSerialize(me),Ee.position.end=Is(me.end)}function U(me){const Ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Oe=Ee.children[Ee.children.length-1];Oe.position.end=Is(me.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ee.type)&&(M.call(this,me),D.call(this,me))}function F(){this.data.atHardBreak=!0}function B(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function Y(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function W(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.value=me}function H(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Ee,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function K(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Ee=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Ee,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function X(me){const Ee=this.sliceSerialize(me),Oe=this.stack[this.stack.length-2];Oe.label=mD(Ee),Oe.identifier=yr(Ee).toLowerCase()}function P(){const me=this.stack[this.stack.length-1],Ee=this.resume(),Oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Oe.type==="link"){const Fe=me.children;Oe.children=Fe}else Oe.alt=Ee}function O(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.url=me}function z(){const me=this.resume(),Ee=this.stack[this.stack.length-1];Ee.title=me}function V(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function ee(me){const Ee=this.resume(),Oe=this.stack[this.stack.length-1];Oe.label=Ee,Oe.identifier=yr(this.sliceSerialize(me)).toLowerCase(),this.data.referenceType="full"}function Z(me){this.data.characterReferenceType=me.type}function re(me){const Ee=this.sliceSerialize(me),Oe=this.data.characterReferenceType;let Fe;Oe?(Fe=c1(Ee,Oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=Tp(Ee);const Ke=this.stack[this.stack.length-1];Ke.value+=Fe}function Q(me){const Ee=this.stack.pop();Ee.position.end=Is(me.end)}function G(me){D.call(this,me);const Ee=this.stack[this.stack.length-1];Ee.url=this.sliceSerialize(me)}function te(me){D.call(this,me);const Ee=this.stack[this.stack.length-1];Ee.url="mailto:"+this.sliceSerialize(me)}function se(){return{type:"blockquote",children:[]}}function _e(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function Ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function $e(){return{type:"break"}}function de(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function Se(){return{type:"link",title:null,url:"",children:[]}}function fe(me){return{type:"list",ordered:me.type==="listOrdered",start:null,spread:me._spread,children:[]}}function je(me){return{type:"listItem",spread:me._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function Ut(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function pn(){return{type:"thematicBreak"}}}function Is(e){return{line:e.line,column:e.column,offset:e.offset}}function v1(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?v1(e,s):_D(e,s)}}function _D(e,t){let n;for(n in t)if(y1.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function bb(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+rl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+rl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+rl({start:t.start,end:t.end})+") is still open")}function yD(e){const t=this;t.parser=n;function n(s){return gD(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function vD(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function bD(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
98
|
-
`}]}function SD(e,t){const n=t.value?t.value+`
|
|
99
|
-
`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function wD(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CD(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kD(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Ga(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let u,c=e.footnoteCounts.get(s);c===void 0?(c=0,e.footnoteOrder.push(s),u=e.footnoteOrder.length):u=o+1,c+=1,e.footnoteCounts.set(s,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function ED(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jD(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function b1(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=s:a.push({type:"text",value:s}),a}function TD(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return b1(e,t);const a={src:Ga(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function ND(e,t){const n={src:Ga(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function AD(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function LD(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return b1(e,t);const a={href:Ga(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function DD(e,t){const n={href:Ga(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function RD(e,t,n){const s=e.all(t),a=n?OD(n):S1(t),o={},u=[];if(typeof t.checked=="boolean"){const p=s[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<s.length;){const p=s[c];(a||c!==0||p.type!=="element"||p.tagName!=="p")&&u.push({type:"text",value:`
|
|
100
|
-
`}),p.type==="element"&&p.tagName==="p"&&!a?u.push(...p.children):u.push(p)}const d=s[s.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&u.push({type:"text",value:`
|
|
101
|
-
`});const f={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,f),e.applyData(t,f)}function OD(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=S1(n[s])}return t}function S1(e){const t=e.spread;return t??e.children.length>1}function MD(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const u=s[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function ID(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PD(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function BD(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zD(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],u),a.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=wp(t.children[1]),d=t1(t.children[t.children.length-1]);c&&d&&(u.position={start:c,end:d}),a.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function HD(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,c=u?u.length:t.children.length;let d=-1;const f=[];for(;++d<c;){const m=t.children[d],x={},_=u?u[d]:void 0;_&&(x.align=_);let w={type:"element",tagName:o,properties:x,children:[]};m&&(w.children=e.all(m),e.patch(m,w),w=e.applyData(m,w)),f.push(w)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function $D(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Sb=9,wb=32;function UD(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(Cb(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(Cb(t.slice(a),a>0,!1)),o.join("")}function Cb(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===Sb||o===wb;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===Sb||o===wb;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function FD(e,t){const n={type:"text",value:UD(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function VD(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const GD={blockquote:vD,break:bD,code:SD,delete:wD,emphasis:CD,footnoteReference:kD,heading:ED,html:jD,imageReference:TD,image:ND,inlineCode:AD,linkReference:LD,link:DD,listItem:RD,list:MD,paragraph:ID,root:PD,strong:BD,table:zD,tableCell:$D,tableRow:HD,text:FD,thematicBreak:VD,toml:Yc,yaml:Yc,definition:Yc,footnoteDefinition:Yc};function Yc(){}const w1=-1,Ku=0,il=1,yu=2,Ap=3,Lp=4,Dp=5,Rp=6,C1=7,k1=8,kb=typeof self=="object"?self:globalThis,WD=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,u]=t[a];switch(o){case Ku:case w1:return n(u,a);case il:{const c=n([],a);for(const d of u)c.push(s(d));return c}case yu:{const c=n({},a);for(const[d,f]of u)c[s(d)]=s(f);return c}case Ap:return n(new Date(u),a);case Lp:{const{source:c,flags:d}=u;return n(new RegExp(c,d),a)}case Dp:{const c=n(new Map,a);for(const[d,f]of u)c.set(s(d),s(f));return c}case Rp:{const c=n(new Set,a);for(const d of u)c.add(s(d));return c}case C1:{const{name:c,message:d}=u;return n(new kb[c](d),a)}case k1:return n(BigInt(u),a);case"BigInt":return n(Object(BigInt(u)),a);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:c}=new Uint8Array(u);return n(new DataView(c),u)}}return n(new kb[o](u),a)};return s},Eb=e=>WD(new Map,e)(0),Ea="",{toString:qD}={},{keys:KD}=Object,Ko=e=>{const t=typeof e;if(t!=="object"||!e)return[Ku,t];const n=qD.call(e).slice(8,-1);switch(n){case"Array":return[il,Ea];case"Object":return[yu,Ea];case"Date":return[Ap,Ea];case"RegExp":return[Lp,Ea];case"Map":return[Dp,Ea];case"Set":return[Rp,Ea];case"DataView":return[il,n]}return n.includes("Array")?[il,n]:n.includes("Error")?[C1,n]:[yu,n]},Xc=([e,t])=>e===Ku&&(t==="function"||t==="symbol"),YD=(e,t,n,s)=>{const a=(u,c)=>{const d=s.push(u)-1;return n.set(c,d),d},o=u=>{if(n.has(u))return n.get(u);let[c,d]=Ko(u);switch(c){case Ku:{let p=u;switch(d){case"bigint":c=k1,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return a([w1],u)}return a([c,p],u)}case il:{if(d){let x=u;return d==="DataView"?x=new Uint8Array(u.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(u)),a([d,[...x]],u)}const p=[],m=a([c,p],u);for(const x of u)p.push(o(x));return m}case yu:{if(d)switch(d){case"BigInt":return a([d,u.toString()],u);case"Boolean":case"Number":case"String":return a([d,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const p=[],m=a([c,p],u);for(const x of KD(u))(e||!Xc(Ko(u[x])))&&p.push([o(x),o(u[x])]);return m}case Ap:return a([c,u.toISOString()],u);case Lp:{const{source:p,flags:m}=u;return a([c,{source:p,flags:m}],u)}case Dp:{const p=[],m=a([c,p],u);for(const[x,_]of u)(e||!(Xc(Ko(x))||Xc(Ko(_))))&&p.push([o(x),o(_)]);return m}case Rp:{const p=[],m=a([c,p],u);for(const x of u)(e||!Xc(Ko(x)))&&p.push(o(x));return m}}const{message:f}=u;return a([c,{name:d,message:f}],u)};return o},jb=(e,{json:t,lossy:n}={})=>{const s=[];return YD(!(t||n),!!t,new Map,s)(e),s},vu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Eb(jb(e,t)):structuredClone(e):(e,t)=>Eb(jb(e,t));function XD(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function QD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function JD(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||XD,s=e.options.footnoteBackLabel||QD,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),m=String(f.identifier).toUpperCase(),x=Ga(m.toLowerCase());let _=0;const w=[],k=e.footnoteCounts.get(m);for(;k!==void 0&&++_<=k;){w.length>0&&w.push({type:"text",value:" "});let y=typeof n=="string"?n:n(d,_);typeof y=="string"&&(y={type:"text",value:y}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,_),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const v=p[p.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const y=v.children[v.children.length-1];y&&y.type==="text"?y.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...w)}else p.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(p,!0)};e.patch(f,S),c.push(S)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...vu(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
102
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
103
|
-
`}]}}const Yu=(function(e){if(e==null)return nR;if(typeof e=="function")return Xu(e);if(typeof e=="object")return Array.isArray(e)?ZD(e):eR(e);if(typeof e=="string")return tR(e);throw new Error("Expected function, string, or object as test")});function ZD(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Yu(e[n]);return Xu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function eR(e){const t=e;return Xu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function tR(e){return Xu(t);function t(n){return n&&n.type===e}}function Xu(e){return t;function t(n,s,a){return!!(rR(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function nR(){return!0}function rR(e){return e!==null&&typeof e=="object"&&"type"in e}const E1=[],sR=!0,Mm=!1,iR="skip";function j1(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=Yu(a),u=s?-1:1;c(e,void 0,[])();function c(d,f,p){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const _=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(_?"<"+_+">":""))+")"})}return x;function x(){let _=E1,w,k,v;if((!t||o(d,f,p[p.length-1]||void 0))&&(_=aR(n(d,p)),_[0]===Mm))return _;if("children"in d&&d.children){const S=d;if(S.children&&_[0]!==iR)for(k=(s?S.children.length:-1)+u,v=p.concat(S);k>-1&&k<S.children.length;){const y=S.children[k];if(w=c(y,k,v)(),w[0]===Mm)return w;k=typeof w[1]=="number"?w[1]:k+u}}return _}}}function aR(e){return Array.isArray(e)?e:typeof e=="number"?[sR,e]:e==null?E1:[e]}function Op(e,t,n,s){let a,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,a=n):(o=t,u=n,a=s),j1(e,o,c,a);function c(d,f){const p=f[f.length-1],m=p?p.children.indexOf(d):void 0;return u(d,m,p)}}const Im={}.hasOwnProperty,oR={};function lR(e,t){const n=t||oR,s=new Map,a=new Map,o=new Map,u={...GD,...n.handlers},c={all:f,applyData:uR,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:u,one:d,options:n,patch:cR,wrap:hR};return Op(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?s:a,x=String(p.identifier).toUpperCase();m.has(x)||m.set(x,p)}}),c;function d(p,m){const x=p.type,_=c.handlers[x];if(Im.call(c.handlers,x)&&_)return _(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in p){const{children:k,...v}=p,S=vu(v);return S.children=c.all(p),S}return vu(p)}return(c.options.unknownHandler||dR)(c,p,m)}function f(p){const m=[];if("children"in p){const x=p.children;let _=-1;for(;++_<x.length;){const w=c.one(x[_],p);if(w){if(_&&x[_-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Tb(w.value)),!Array.isArray(w)&&w.type==="element")){const k=w.children[0];k&&k.type==="text"&&(k.value=Tb(k.value))}Array.isArray(w)?m.push(...w):m.push(w)}}}return m}}function cR(e,t){e.position&&(t.position=QN(e))}function uR(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const u="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,vu(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function dR(e,t){const n=t.data||{},s="value"in t&&!(Im.call(n,"hProperties")||Im.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function hR(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
104
|
-
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
105
|
-
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
106
|
-
`}),n}function Tb(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Nb(e,t){const n=lR(e,t),s=n.one(e,void 0),a=JD(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
|
|
107
|
-
`},a),o}function fR(e,t){return e&&"run"in e?async function(n,s){const a=Nb(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Nb(n,{file:s,...e||t})}}function Ab(e){if(e)throw e}var Ff,Lb;function mR(){if(Lb)return Ff;Lb=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},o=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!m)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},u=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},c=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(s)return s(f,p).value}else return;return f[p]};return Ff=function d(){var f,p,m,x,_,w,k=arguments[0],v=1,S=arguments.length,y=!1;for(typeof k=="boolean"&&(y=k,k=arguments[1]||{},v=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});v<S;++v)if(f=arguments[v],f!=null)for(p in f)m=c(k,p),x=c(f,p),k!==x&&(y&&x&&(o(x)||(_=a(x)))?(_?(_=!1,w=m&&a(m)?m:[]):w=m&&o(m)?m:{},u(k,{name:p,newValue:d(y,w,x)})):typeof x<"u"&&u(k,{name:p,newValue:x}));return k},Ff}var pR=mR();const Vf=Mu(pR);function Pm(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function gR(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);c(null,...a);function c(d,...f){const p=e[++o];let m=-1;if(d){u(d);return}for(;++m<a.length;)(f[m]===null||f[m]===void 0)&&(f[m]=a[m]);a=f,p?xR(p,c)(...f):u(null,...f)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function xR(e,t){let n;return s;function s(...u){const c=e.length>u.length;let d;c&&u.push(a);try{d=e.apply(this,u)}catch(f){const p=f;if(c&&n)throw p;return a(p)}c||(d&&d.then&&typeof d.then=="function"?d.then(o,a):d instanceof Error?a(d):o(d))}function a(u,...c){n||(n=!0,t(u,...c))}function o(u){a(null,u)}}const Lr={basename:_R,dirname:yR,extname:vR,join:bR,sep:"/"};function _R(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kl(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let u=-1,c=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else u<0&&(o=!0,u=a+1),c>-1&&(e.codePointAt(a)===t.codePointAt(c--)?c<0&&(s=a):(c=-1,s=u));return n===s?s=u:s<0&&(s=e.length),e.slice(n,s)}function yR(e){if(kl(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function vR(e){kl(e);let t=e.length,n=-1,s=0,a=-1,o=0,u;for(;t--;){const c=e.codePointAt(t);if(c===47){if(u){s=t+1;break}continue}n<0&&(u=!0,n=t+1),c===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function bR(...e){let t=-1,n;for(;++t<e.length;)kl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":SR(n)}function SR(e){kl(e);const t=e.codePointAt(0)===47;let n=wR(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function wR(e,t){let n="",s=0,a=-1,o=0,u=-1,c,d;for(;++u<=e.length;){if(u<e.length)c=e.codePointAt(u);else{if(c===47)break;c=47}if(c===47){if(!(a===u-1||o===1))if(a!==u-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),a=u,o=0;continue}}else if(n.length>0){n="",s=0,a=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,u):n=e.slice(a+1,u),s=u-a-1;a=u,o=0}else c===46&&o>-1?o++:o=-1}return n}function kl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const CR={cwd:kR};function kR(){return"/"}function Bm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ER(e){if(typeof e=="string")e=new URL(e);else if(!Bm(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return jR(e)}function jR(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Gf=["history","path","basename","stem","extname","dirname"];class T1{constructor(t){let n;t?Bm(t)?n={path:t}:typeof t=="string"||TR(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":CR.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Gf.length;){const o=Gf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)Gf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Lr.basename(this.path):void 0}set basename(t){qf(t,"basename"),Wf(t,"basename"),this.path=Lr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Lr.dirname(this.path):void 0}set dirname(t){Db(this.basename,"dirname"),this.path=Lr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Lr.extname(this.path):void 0}set extname(t){if(Wf(t,"extname"),Db(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Lr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bm(t)&&(t=ER(t)),qf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Lr.basename(this.path,this.extname):void 0}set stem(t){qf(t,"stem"),Wf(t,"stem"),this.path=Lr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new bn(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Wf(e,t){if(e&&e.includes(Lr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Lr.sep+"`")}function qf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Db(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function TR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NR=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),AR={}.hasOwnProperty;class Mp extends NR{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=gR()}copy(){const t=new Mp;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Vf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Xf("data",this.frozen),this.namespace[t]=n,this):AR.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Xf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qc(t),s=this.parser||this.Parser;return Kf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Kf("process",this.parser||this.Parser),Yf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,u){const c=Qc(t),d=s.parse(c);s.run(d,c,function(p,m,x){if(p||!m||!x)return f(p);const _=m,w=s.stringify(_,x);RR(w)?x.value=w:x.result=w,f(p,x)});function f(p,m){p||!m?u(p):o?o(m):n(void 0,m)}}}processSync(t){let n=!1,s;return this.freeze(),Kf("processSync",this.parser||this.Parser),Yf("processSync",this.compiler||this.Compiler),this.process(t,a),Ob("processSync","process",n),s;function a(o,u){n=!0,Ab(o),s=u}}run(t,n,s){Rb(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(u,c){const d=Qc(n);a.run(t,d,f);function f(p,m,x){const _=m||t;p?c(p):u?u(_):s(void 0,_,x)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),Ob("runSync","run",s),a;function o(u,c){Ab(u),a=c,s=!0}}stringify(t,n){this.freeze();const s=Qc(n),a=this.compiler||this.Compiler;return Yf("stringify",a),Rb(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Xf("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...m]=f;d(p,m)}else u(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function u(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(a.settings=Vf(!0,a.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const m=f[p];o(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let m=-1,x=-1;for(;++m<s.length;)if(s[m][0]===f){x=m;break}if(x===-1)s.push([f,...p]);else if(p.length>0){let[_,...w]=p;const k=s[x][1];Pm(k)&&Pm(_)&&(_=Vf(!0,k,_)),s[x]=[f,_,...w]}}}}const LR=new Mp().freeze();function Kf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Rb(e){if(!Pm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ob(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qc(e){return DR(e)?e:new T1(e)}function DR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function RR(e){return typeof e=="string"||OR(e)}function OR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const MR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Mb=[],Ib={allowDangerousHtml:!0},IR=/^(https?|ircs?|mailto|xmpp)$/i,PR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function BR(e){const t=zR(e),n=HR(e);return $R(t.runSync(t.parse(n),n),e)}function zR(e){const t=e.rehypePlugins||Mb,n=e.remarkPlugins||Mb,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ib}:Ib;return LR().use(yD).use(n).use(fR,s).use(t)}function HR(e){const t=e.children||"",n=new T1;return typeof t=="string"&&(n.value=t),n}function $R(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,u=t.skipHtml,c=t.unwrapDisallowed,d=t.urlTransform||UR;for(const p of PR)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+MR+p.id,void 0);return Op(e,f),nA(e,{Fragment:l.Fragment,components:a,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function f(p,m,x){if(p.type==="raw"&&x&&typeof m=="number")return u?x.children.splice(m,1):x.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let _;for(_ in Hf)if(Object.hasOwn(Hf,_)&&Object.hasOwn(p.properties,_)){const w=p.properties[_],k=Hf[_];(k===null||k.includes(p.tagName))&&(p.properties[_]=d(String(w||""),_,p))}}if(p.type==="element"){let _=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(p,m,x)),_&&x&&typeof m=="number")return c&&p.children?x.children.splice(m,1,...p.children):x.children.splice(m,1),m}}}function UR(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||IR.test(e.slice(0,t))?e:""}function Pb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function FR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function VR(e,t,n){const a=Yu((n||{}).ignore||[]),o=GR(t);let u=-1;for(;++u<o.length;)j1(e,"text",c);function c(f,p){let m=-1,x;for(;++m<p.length;){const _=p[m],w=x?x.children:void 0;if(a(_,w?w.indexOf(_):void 0,x))return;x=_}if(x)return d(f,p)}function d(f,p){const m=p[p.length-1],x=o[u][0],_=o[u][1];let w=0;const v=m.children.indexOf(f);let S=!1,y=[];x.lastIndex=0;let b=x.exec(f.value);for(;b;){const E=b.index,N={index:b.index,input:b.input,stack:[...p,f]};let T=_(...b,N);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?x.lastIndex=E+1:(w!==E&&y.push({type:"text",value:f.value.slice(w,E)}),Array.isArray(T)?y.push(...T):T&&y.push(T),w=E+b[0].length,S=!0),!x.global)break;b=x.exec(f.value)}return S?(w<f.value.length&&y.push({type:"text",value:f.value.slice(w)}),m.children.splice(v,1,...y)):y=[f],v+y.length}}function GR(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([WR(a[0]),qR(a[1])])}return t}function WR(e){return typeof e=="string"?new RegExp(FR(e),"g"):e}function qR(e){return typeof e=="function"?e:function(){return e}}const Qf="phrasing",Jf=["autolink","link","image","label"];function KR(){return{transforms:[t3],enter:{literalAutolink:XR,literalAutolinkEmail:Zf,literalAutolinkHttp:Zf,literalAutolinkWww:Zf},exit:{literalAutolink:e3,literalAutolinkEmail:ZR,literalAutolinkHttp:QR,literalAutolinkWww:JR}}}function YR(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qf,notInConstruct:Jf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qf,notInConstruct:Jf},{character:":",before:"[ps]",after:"\\/",inConstruct:Qf,notInConstruct:Jf}]}}function XR(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Zf(e){this.config.enter.autolinkProtocol.call(this,e)}function QR(e){this.config.exit.autolinkProtocol.call(this,e)}function JR(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function ZR(e){this.config.exit.autolinkEmail.call(this,e)}function e3(e){this.exit(e)}function t3(e){VR(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,n3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),r3]],{ignore:["link","linkReference"]})}function n3(e,t,n,s,a){let o="";if(!N1(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!s3(n)))return!1;const u=i3(n+s);if(!u[0])return!1;const c={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[c,{type:"text",value:u[1]}]:c}function r3(e,t,n,s){return!N1(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function s3(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function i3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=Pb(e,"(");let o=Pb(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function N1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ai(n)||Wu(n))&&(!t||n!==47)}A1.peek=m3;function a3(){this.buffer()}function o3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function l3(){this.buffer()}function c3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function u3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function d3(e){this.exit(e)}function h3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function f3(e){this.exit(e)}function m3(){return"["}function A1(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const u=n.enter("footnoteReference"),c=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),u(),o+=a.move("]"),o}function p3(){return{enter:{gfmFootnoteCallString:a3,gfmFootnoteCall:o3,gfmFootnoteDefinitionLabelString:l3,gfmFootnoteDefinition:c3},exit:{gfmFootnoteCallString:u3,gfmFootnoteCall:d3,gfmFootnoteDefinitionLabelString:h3,gfmFootnoteDefinition:f3}}}function g3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:A1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,u){const c=o.createTracker(u);let d=c.move("[^");const f=o.enter("footnoteDefinition"),p=o.enter("label");return d+=c.move(o.safe(o.associationId(s),{before:d,after:"]"})),p(),d+=c.move("]:"),s.children&&s.children.length>0&&(c.shift(4),d+=c.move((t?`
|
|
108
|
-
`:" ")+o.indentLines(o.containerFlow(s,c.current()),t?L1:x3))),f(),d}}function x3(e,t,n){return t===0?e:L1(e,t,n)}function L1(e,t,n){return(n?"":" ")+e}const _3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];D1.peek=w3;function y3(){return{canContainEols:["delete"],enter:{strikethrough:b3},exit:{strikethrough:S3}}}function v3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_3}],handlers:{delete:D1}}}function b3(e){this.enter({type:"delete",children:[]},e)}function S3(e){this.exit(e)}function D1(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let u=a.move("~~");return u+=n.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),o(),u}function w3(){return"~"}function C3(e){return e.length}function k3(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||C3,o=[],u=[],c=[],d=[];let f=0,p=-1;for(;++p<e.length;){const k=[],v=[];let S=-1;for(e[p].length>f&&(f=e[p].length);++S<e[p].length;){const y=E3(e[p][S]);if(n.alignDelimiters!==!1){const b=a(y);v[S]=b,(d[S]===void 0||b>d[S])&&(d[S]=b)}k.push(y)}u[p]=k,c[p]=v}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)o[m]=Bb(s[m]);else{const k=Bb(s);for(;++m<f;)o[m]=k}m=-1;const x=[],_=[];for(;++m<f;){const k=o[m];let v="",S="";k===99?(v=":",S=":"):k===108?v=":":k===114&&(S=":");let y=n.alignDelimiters===!1?1:Math.max(1,d[m]-v.length-S.length);const b=v+"-".repeat(y)+S;n.alignDelimiters!==!1&&(y=v.length+y+S.length,y>d[m]&&(d[m]=y),_[m]=y),x[m]=b}u.splice(1,0,x),c.splice(1,0,_),p=-1;const w=[];for(;++p<u.length;){const k=u[p],v=c[p];m=-1;const S=[];for(;++m<f;){const y=k[m]||"";let b="",E="";if(n.alignDelimiters!==!1){const N=d[m]-(v[m]||0),T=o[m];T===114?b=" ".repeat(N):T===99?N%2?(b=" ".repeat(N/2+.5),E=" ".repeat(N/2-.5)):(b=" ".repeat(N/2),E=b):E=" ".repeat(N)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(b),S.push(y),n.alignDelimiters!==!1&&S.push(E),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||m!==f-1)&&S.push("|")}w.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return w.join(`
|
|
109
|
-
`)}function E3(e){return e==null?"":String(e)}function Bb(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function j3(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),T3);return a(),u}function T3(e,t,n){return">"+(n?"":" ")+e}function N3(e,t){return zb(e,t.inConstruct,!0)&&!zb(e,t.notInConstruct,!1)}function zb(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Hb(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
110
|
-
`&&N3(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
111
|
-
`}function A3(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>u&&(u=o):o=1,a=s+t.length,s=n.indexOf(t,a);return u}function L3(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function D3(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function R3(e,t,n,s){const a=D3(n),o=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(L3(e,n)){const m=n.enter("codeIndented"),x=n.indentLines(o,O3);return m(),x}const c=n.createTracker(s),d=a.repeat(Math.max(A3(o,a)+1,3)),f=n.enter("codeFenced");let p=c.move(d);if(e.lang){const m=n.enter(`codeFencedLang${u}`);p+=c.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...c.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${u}`);p+=c.move(" "),p+=c.move(n.safe(e.meta,{before:p,after:`
|
|
112
|
-
`,encode:["`"],...c.current()})),m()}return p+=c.move(`
|
|
113
|
-
`),o&&(p+=c.move(o+`
|
|
114
|
-
`)),p+=c.move(d),f(),p}function O3(e,t,n){return(n?"":" ")+e}function Ip(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function M3(e,t,n,s){const a=Ip(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("definition");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("[");return f+=d.move(n.safe(n.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":`
|
|
115
|
-
`,...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),u(),f}function I3(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ul(e){return"&#x"+e.toString(16).toUpperCase()+";"}function bu(e,t,n){const s=Ha(e),a=Ha(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}R1.peek=P3;function R1(e,t,n,s){const a=I3(n),o=n.enter("emphasis"),u=n.createTracker(s),c=u.move(a);let d=u.move(n.containerPhrasing(e,{after:a,before:c,...u.current()}));const f=d.charCodeAt(0),p=bu(s.before.charCodeAt(s.before.length-1),f,a);p.inside&&(d=ul(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=bu(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+ul(m));const _=u.move(a);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},c+d+_}function P3(e,t,n){return n.options.emphasis||"*"}function B3(e,t){let n=!1;return Op(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Mm}),!!((!e.depth||e.depth<3)&&jp(e)&&(t.options.setext||n))}function z3(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(B3(e,n)){const p=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(e,{...o.current(),before:`
|
|
116
|
-
`,after:`
|
|
117
|
-
`});return m(),p(),x+`
|
|
118
|
-
`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
119
|
-
`))+1))}const u="#".repeat(a),c=n.enter("headingAtx"),d=n.enter("phrasing");o.move(u+" ");let f=n.containerPhrasing(e,{before:"# ",after:`
|
|
120
|
-
`,...o.current()});return/^[\t ]/.test(f)&&(f=ul(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,n.options.closeAtx&&(f+=" "+u),d(),c(),f}O1.peek=H3;function O1(e){return e.value||""}function H3(){return"<"}M1.peek=$3;function M1(e,t,n,s){const a=Ip(n),o=a==='"'?"Quote":"Apostrophe",u=n.enter("image");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("![");return f+=d.move(n.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),c(),e.title&&(c=n.enter(`title${o}`),f+=d.move(" "+a),f+=d.move(n.safe(e.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),f+=d.move(")"),u(),f}function $3(){return"!"}I1.peek=U3;function I1(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const c=n.createTracker(s);let d=c.move("![");const f=n.safe(e.alt,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return u(),n.stack=p,o(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function U3(){return"!"}P1.peek=F3;function P1(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const u=n.unsafe[o],c=n.compilePattern(u);let d;if(u.atBreak)for(;d=c.exec(s);){let f=d.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(d.index+1)}}return a+s+a}function F3(){return"`"}function B1(e,t){const n=jp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}z1.peek=V3;function z1(e,t,n,s){const a=Ip(n),o=a==='"'?"Quote":"Apostrophe",u=n.createTracker(s);let c,d;if(B1(e,n)){const p=n.stack;n.stack=[],c=n.enter("autolink");let m=u.move("<");return m+=u.move(n.containerPhrasing(e,{before:m,after:">",...u.current()})),m+=u.move(">"),c(),n.stack=p,m}c=n.enter("link"),d=n.enter("label");let f=u.move("[");return f+=u.move(n.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(d=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),d(),e.title&&(d=n.enter(`title${o}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),d()),f+=u.move(")"),c(),f}function V3(e,t,n){return B1(e,n)?"<":"["}H1.peek=G3;function H1(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const c=n.createTracker(s);let d=c.move("[");const f=n.containerPhrasing(e,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:d,after:"]",...c.current()});return u(),n.stack=p,o(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function G3(){return"["}function Pp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function W3(e){const t=Pp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function q3(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function $1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function K3(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?q3(n):Pp(n);const c=e.ordered?u==="."?")":".":W3(n);let d=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),$1(n)===u&&p){let m=-1;for(;++m<e.children.length;){const x=e.children[m];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(u=c),n.bulletCurrent=u;const f=n.containerFlow(e,s);return n.bulletLastUsed=u,n.bulletCurrent=o,a(),f}function Y3(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function X3(e,t,n,s){const a=Y3(n);let o=n.bulletCurrent||Pp(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const c=n.createTracker(s);c.move(o+" ".repeat(u-o.length)),c.shift(u);const d=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,c.current()),p);return d(),f;function p(m,x,_){return x?(_?"":" ".repeat(u))+m:(_?o:o+" ".repeat(u-o.length))+m}}function Q3(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,s);return o(),a(),u}const J3=Yu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Z3(e,t,n,s){return(e.children.some(function(u){return J3(u)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function e5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}U1.peek=t5;function U1(e,t,n,s){const a=e5(n),o=n.enter("strong"),u=n.createTracker(s),c=u.move(a+a);let d=u.move(n.containerPhrasing(e,{after:a,before:c,...u.current()}));const f=d.charCodeAt(0),p=bu(s.before.charCodeAt(s.before.length-1),f,a);p.inside&&(d=ul(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=bu(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+ul(m));const _=u.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:x.outside,before:p.outside},c+d+_}function t5(e,t,n){return n.options.strong||"*"}function n5(e,t,n,s){return n.safe(e.value,s)}function r5(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function s5(e,t,n){const s=($1(n)+(n.options.ruleSpaces?" ":"")).repeat(r5(n));return n.options.ruleSpaces?s.slice(0,-1):s}const F1={blockquote:j3,break:Hb,code:R3,definition:M3,emphasis:R1,hardBreak:Hb,heading:z3,html:O1,image:M1,imageReference:I1,inlineCode:P1,link:z1,linkReference:H1,list:K3,listItem:X3,paragraph:Q3,root:Z3,strong:U1,text:n5,thematicBreak:s5};function i5(){return{enter:{table:a5,tableData:$b,tableHeader:$b,tableRow:l5},exit:{codeText:c5,table:o5,tableData:em,tableHeader:em,tableRow:em}}}function a5(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function o5(e){this.exit(e),this.data.inTable=void 0}function l5(e){this.enter({type:"tableRow",children:[]},e)}function em(e){this.exit(e)}function $b(e){this.enter({type:"tableCell",children:[]},e)}function c5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,u5));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function u5(e,t){return t==="|"?t:e}function d5(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
121
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:u,tableCell:d,tableRow:c}};function u(_,w,k,v){return f(p(_,k,v),_.align)}function c(_,w,k,v){const S=m(_,k,v),y=f([S]);return y.slice(0,y.indexOf(`
|
|
122
|
-
`))}function d(_,w,k,v){const S=k.enter("tableCell"),y=k.enter("phrasing"),b=k.containerPhrasing(_,{...v,before:o,after:o});return y(),S(),b}function f(_,w){return k3(_,{align:w,alignDelimiters:s,padding:n,stringLength:a})}function p(_,w,k){const v=_.children;let S=-1;const y=[],b=w.enter("table");for(;++S<v.length;)y[S]=m(v[S],w,k);return b(),y}function m(_,w,k){const v=_.children;let S=-1;const y=[],b=w.enter("tableRow");for(;++S<v.length;)y[S]=d(v[S],_,w,k);return b(),y}function x(_,w,k){let v=F1.inlineCode(_,w,k);return k.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function h5(){return{exit:{taskListCheckValueChecked:Ub,taskListCheckValueUnchecked:Ub,paragraph:m5}}}function f5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:p5}}}function Ub(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function m5(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,u;for(;++o<a.length;){const c=a[o];if(c.type==="paragraph"){u=c;break}}u===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function p5(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",c=n.createTracker(s);o&&c.move(u);let d=F1.listItem(e,t,n,{...s,...c.current()});return o&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(p){return p+u}}function g5(){return[KR(),p3(),y3(),i5(),h5()]}function x5(e){return{extensions:[YR(),g3(e),v3(),d5(e),f5()]}}const _5={tokenize:C5,partial:!0},V1={tokenize:k5,partial:!0},G1={tokenize:E5,partial:!0},W1={tokenize:j5,partial:!0},y5={tokenize:T5,partial:!0},q1={name:"wwwAutolink",tokenize:S5,previous:Y1},K1={name:"protocolAutolink",tokenize:w5,previous:X1},ds={name:"emailAutolink",tokenize:b5,previous:Q1},Ir={};function v5(){return{text:Ir}}let mi=48;for(;mi<123;)Ir[mi]=ds,mi++,mi===58?mi=65:mi===91&&(mi=97);Ir[43]=ds;Ir[45]=ds;Ir[46]=ds;Ir[95]=ds;Ir[72]=[ds,K1];Ir[104]=[ds,K1];Ir[87]=[ds,q1];Ir[119]=[ds,q1];function b5(e,t,n){const s=this;let a,o;return u;function u(m){return!zm(m)||!Q1.call(s,s.previous)||Bp(s.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return zm(m)?(e.consume(m),c):m===64?(e.consume(m),d):n(m)}function d(m){return m===46?e.check(y5,p,f)(m):m===45||m===95||vn(m)?(o=!0,e.consume(m),d):p(m)}function f(m){return e.consume(m),a=!0,d}function p(m){return o&&a&&Cn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function S5(e,t,n){const s=this;return a;function a(u){return u!==87&&u!==119||!Y1.call(s,s.previous)||Bp(s.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_5,e.attempt(V1,e.attempt(G1,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function w5(e,t,n){const s=this;let a="",o=!1;return u;function u(m){return(m===72||m===104)&&X1.call(s,s.previous)&&!Bp(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),c):n(m)}function c(m){if(Cn(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const x=a.toLowerCase();if(x==="http"||x==="https")return e.consume(m),d}return n(m)}function d(m){return m===47?(e.consume(m),o?f:(o=!0,d)):n(m)}function f(m){return m===null||_u(m)||Et(m)||Ai(m)||Wu(m)?n(m):e.attempt(V1,e.attempt(G1,p),n)(m)}function p(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function C5(e,t,n){let s=0;return a;function a(u){return(u===87||u===119)&&s<3?(s++,e.consume(u),a):u===46&&s===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function k5(e,t,n){let s,a,o;return u;function u(f){return f===46||f===95?e.check(W1,d,c)(f):f===null||Et(f)||Ai(f)||f!==45&&Wu(f)?d(f):(o=!0,e.consume(f),u)}function c(f){return f===95?s=!0:(a=s,s=void 0),e.consume(f),u}function d(f){return a||s||!o?n(f):t(f)}}function E5(e,t){let n=0,s=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&s<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(W1,t,o)(u):u===null||Et(u)||Ai(u)?t(u):(e.consume(u),a)}function o(u){return u===41&&s++,e.consume(u),a}}function j5(e,t,n){return s;function s(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),s):c===38?(e.consume(c),o):c===93?(e.consume(c),a):c===60||c===null||Et(c)||Ai(c)?t(c):n(c)}function a(c){return c===null||c===40||c===91||Et(c)||Ai(c)?t(c):s(c)}function o(c){return Cn(c)?u(c):n(c)}function u(c){return c===59?(e.consume(c),s):Cn(c)?(e.consume(c),u):n(c)}}function T5(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return vn(o)?n(o):t(o)}}function Y1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Et(e)}function X1(e){return!Cn(e)}function Q1(e){return!(e===47||zm(e))}function zm(e){return e===43||e===45||e===46||e===95||vn(e)}function Bp(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const N5={tokenize:P5,partial:!0};function A5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:O5,continuation:{tokenize:M5},exit:I5}},text:{91:{name:"gfmFootnoteCall",tokenize:R5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:L5,resolveTo:D5}}}}function L5(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u;for(;a--;){const d=s.events[a][1];if(d.type==="labelImage"){u=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!u||!u._balanced)return n(d);const f=yr(s.sliceSerialize({start:u.end,end:s.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),t(d))}}function D5(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...c),e}function R5(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,u;return c;function c(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(m){if(o>999||m===93&&!u||m===null||m===91||Et(m))return n(m);if(m===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return a.includes(yr(s.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Et(m)||(u=!0),o++,e.consume(m),m===92?p:f}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,f):f(m)}}function O5(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,u=0,c;return d;function d(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(w)}function p(w){if(u>999||w===93&&!c||w===null||w===91||Et(w))return n(w);if(w===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=yr(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Et(w)||(c=!0),u++,e.consume(w),w===92?m:p}function m(w){return w===91||w===92||w===93?(e.consume(w),u++,p):p(w)}function x(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(o)||a.push(o),lt(e,_,"gfmFootnoteDefinitionWhitespace")):n(w)}function _(w){return t(w)}}function M5(e,t,n){return e.check(Cl,t,e.attempt(N5,t,n))}function I5(e){e.exit("gfmFootnoteDefinition")}function P5(e,t,n){const s=this;return lt(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const u=s.events[s.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function B5(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(u,c){let d=-1;for(;++d<u.length;)if(u[d][0]==="enter"&&u[d][1].type==="strikethroughSequenceTemporary"&&u[d][1]._close){let f=d;for(;f--;)if(u[f][0]==="exit"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._open&&u[d][1].end.offset-u[d][1].start.offset===u[f][1].end.offset-u[f][1].start.offset){u[d][1].type="strikethroughSequence",u[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},u[f][1].start),end:Object.assign({},u[d][1].end)},m={type:"strikethroughText",start:Object.assign({},u[f][1].end),end:Object.assign({},u[d][1].start)},x=[["enter",p,c],["enter",u[f][1],c],["exit",u[f][1],c],["enter",m,c]],_=c.parser.constructs.insideSpan.null;_&&Wn(x,x.length,0,qu(_,u.slice(f+1,d),c)),Wn(x,x.length,0,[["exit",m,c],["enter",u[d][1],c],["exit",u[d][1],c],["exit",p,c]]),Wn(u,f-1,d-f+3,x),d=f+x.length-2;break}}for(d=-1;++d<u.length;)u[d][1].type==="strikethroughSequenceTemporary"&&(u[d][1].type="data");return u}function o(u,c,d){const f=this.previous,p=this.events;let m=0;return x;function x(w){return f===126&&p[p.length-1][1].type!=="characterEscape"?d(w):(u.enter("strikethroughSequenceTemporary"),_(w))}function _(w){const k=Ha(f);if(w===126)return m>1?d(w):(u.consume(w),m++,_);if(m<2&&!n)return d(w);const v=u.exit("strikethroughSequenceTemporary"),S=Ha(w);return v._open=!S||S===2&&!!k,v._close=!k||k===2&&!!S,c(w)}}}class z5{constructor(){this.map=[]}add(t,n,s){H5(this,t,n,s)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function H5(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function $5(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function U5(){return{flow:{null:{name:"table",tokenize:F5,resolveAll:V5}}}}function F5(e,t,n){const s=this;let a=0,o=0,u;return c;function c(D){let U=s.events.length-1;for(;U>-1;){const Y=s.events[U][1].type;if(Y==="lineEnding"||Y==="linePrefix")U--;else break}const F=U>-1?s.events[U][1].type:null,B=F==="tableHead"||F==="tableRow"?T:d;return B===T&&s.parser.lazy[s.now().line]?n(D):B(D)}function d(D){return e.enter("tableHead"),e.enter("tableRow"),f(D)}function f(D){return D===124||(u=!0,o+=1),p(D)}function p(D){return D===null?n(D):He(D)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),_):n(D):rt(D)?lt(e,p,"whitespace")(D):(o+=1,u&&(u=!1,a+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),m(D)))}function m(D){return D===null||D===124||Et(D)?(e.exit("data"),p(D)):(e.consume(D),D===92?x:m)}function x(D){return D===92||D===124?(e.consume(D),m):m(D)}function _(D){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(D):(e.enter("tableDelimiterRow"),u=!1,rt(D)?lt(e,w,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):w(D))}function w(D){return D===45||D===58?v(D):D===124?(u=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),k):N(D)}function k(D){return rt(D)?lt(e,v,"whitespace")(D):v(D)}function v(D){return D===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),S):D===45?(o+=1,S(D)):D===null||He(D)?E(D):N(D)}function S(D){return D===45?(e.enter("tableDelimiterFiller"),y(D)):N(D)}function y(D){return D===45?(e.consume(D),y):D===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(D))}function b(D){return rt(D)?lt(e,E,"whitespace")(D):E(D)}function E(D){return D===124?w(D):D===null||He(D)?!u||a!==o?N(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):N(D)}function N(D){return n(D)}function T(D){return e.enter("tableRow"),L(D)}function L(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),L):D===null||He(D)?(e.exit("tableRow"),t(D)):rt(D)?lt(e,L,"whitespace")(D):(e.enter("data"),A(D))}function A(D){return D===null||D===124||Et(D)?(e.exit("data"),L(D)):(e.consume(D),D===92?M:A)}function M(D){return D===92||D===124?(e.consume(D),A):A(D)}}function V5(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,f,p,m;const x=new z5;for(;++n<e.length;){const _=e[n],w=_[1];_[0]==="enter"?w.type==="tableHead"?(c=!1,d!==0&&(Fb(x,t,d,f,p),p=void 0,d=0),f={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(n,0,[["enter",f,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(s=!0,m=void 0,o=[0,0,0,0],u=[0,n+1,0,0],c&&(c=!1,p={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(n,0,[["enter",p,t]])),a=w.type==="tableDelimiterRow"?2:p?3:1):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(s=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],m=Jc(x,t,o,a,void 0,m),o=[0,0,0,0]),u[2]=n)):w.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(u[0]=u[1],m=Jc(x,t,o,a,void 0,m)),o=u,u=[o[1],n,0,0])):w.type==="tableHead"?(c=!0,d=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(d=n,o[1]!==0?(u[0]=u[1],m=Jc(x,t,o,a,n,m)):u[1]!==0&&(m=Jc(x,t,u,a,n,m)),a=0):a&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(u[3]=n)}for(d!==0&&Fb(x,t,d,f,p),x.consume(t.events),n=-1;++n<t.events.length;){const _=t.events[n];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=$5(t.events,n))}return e}function Jc(e,t,n,s,a,o){const u=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Ra(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const d=Ra(t.events,n[1]);if(o={type:u,start:Object.assign({},d),end:Object.assign({},d)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=Ra(t.events,n[2]),p=Ra(t.events,n[3]),m={type:c,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",m,t]]),s!==2){const x=t.events[n[2]],_=t.events[n[3]];if(x[1].end=Object.assign({},_[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,k=n[3]-n[2]-1;e.add(w,k,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return a!==void 0&&(o.end=Object.assign({},Ra(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Fb(e,t,n,s,a){const o=[],u=Ra(t.events,n);a&&(a.end=Object.assign({},u),o.push(["exit",a,t])),s.end=Object.assign({},u),o.push(["exit",s,t]),e.add(n+1,0,o)}function Ra(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const G5={name:"tasklistCheck",tokenize:q5};function W5(){return{text:{91:G5}}}function q5(e,t,n){const s=this;return a;function a(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),o)}function o(d){return Et(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),u):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),u):n(d)}function u(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(d)}function c(d){return He(d)?t(d):rt(d)?e.check({tokenize:K5},t,n)(d):n(d)}}function K5(e,t,n){return lt(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function Y5(e){return l1([v5(),A5(),B5(e),U5(),W5()])}const X5={};function Q5(e){const t=this,n=e||X5,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),u=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(Y5(n)),o.push(g5()),u.push(x5(n))}var Hm=Object.defineProperty,J5=Object.getOwnPropertyDescriptor,Z5=Object.getOwnPropertyNames,eO=Object.prototype.hasOwnProperty,zp=(e,t)=>{let n={};for(var s in e)Hm(n,s,{get:e[s],enumerable:!0});return Hm(n,Symbol.toStringTag,{value:"Module"}),n},tO=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Z5(t),o=0,u=a.length,c;o<u;o++)c=a[o],!eO.call(e,c)&&c!==n&&Hm(e,c,{get:(d=>t[d]).bind(null,c),enumerable:!(s=J5(t,c))||s.enumerable});return e},J1=(e,t,n)=>(tO(e,t,"default"),n);const Qu=[{id:"abap",name:"ABAP",import:(()=>J(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>J(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>J(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>J(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>J(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>J(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>J(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>J(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>J(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>J(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>J(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>J(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>J(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>J(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>J(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>J(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>J(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>J(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>J(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>J(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>J(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>J(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>J(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>J(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>J(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>J(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>J(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>J(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>J(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>J(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>J(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>J(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>J(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>J(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>J(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>J(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>J(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>J(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>J(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>J(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>J(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>J(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>J(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>J(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>J(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>J(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>J(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>J(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>J(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>J(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>J(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>J(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>J(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>J(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>J(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>J(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>J(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>J(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>J(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>J(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>J(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>J(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>J(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>J(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>J(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>J(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>J(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>J(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>J(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>J(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>J(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>J(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>J(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>J(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>J(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>J(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>J(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>J(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>J(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>J(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>J(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>J(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>J(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>J(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>J(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>J(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>J(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>J(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>J(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>J(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>J(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>J(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>J(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>J(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>J(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>J(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>J(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>J(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>J(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>J(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>J(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>J(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>J(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>J(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>J(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>J(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>J(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>J(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>J(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>J(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>J(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>J(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>J(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>J(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>J(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>J(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>J(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>J(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>J(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>J(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>J(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>J(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>J(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>J(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>J(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>J(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>J(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>J(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>J(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>J(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>J(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>J(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>J(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>J(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>J(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>J(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>J(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>J(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>J(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>J(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>J(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>J(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>J(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>J(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>J(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>J(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>J(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>J(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>J(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>J(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>J(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>J(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>J(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>J(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>J(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>J(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>J(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>J(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>J(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>J(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>J(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>J(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>J(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>J(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>J(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>J(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>J(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>J(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>J(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>J(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>J(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>J(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>J(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>J(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>J(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>J(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>J(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>J(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>J(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>J(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>J(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>J(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>J(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>J(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>J(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>J(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>J(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>J(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>J(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>J(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>J(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>J(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>J(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>J(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>J(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>J(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>J(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>J(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>J(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>J(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>J(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>J(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>J(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>J(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>J(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>J(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>J(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>J(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>J(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>J(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>J(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>J(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>J(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>J(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>J(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>J(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>J(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>J(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>J(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>J(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>J(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>J(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>J(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>J(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>J(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>J(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>J(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>J(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>J(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>J(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>J(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>J(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>J(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>J(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>J(()=>import("./zig-VOosw3JB.js"),[]))}],Hp=Object.fromEntries(Qu.map(e=>[e.id,e.import])),$p=Object.fromEntries(Qu.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),Up={...Hp,...$p},Fp=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>J(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>J(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>J(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>J(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>J(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>J(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>J(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>J(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>J(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>J(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>J(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>J(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>J(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>J(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>J(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>J(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>J(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>J(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>J(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>J(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>J(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>J(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>J(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>J(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>J(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>J(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>J(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>J(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>J(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>J(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>J(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>J(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>J(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>J(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>J(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>J(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>J(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>J(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>J(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>J(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>J(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>J(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>J(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>J(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>J(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>J(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>J(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>J(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>J(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>J(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>J(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>J(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>J(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>J(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>J(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>J(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>J(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>J(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>J(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>J(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>J(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>J(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>J(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>J(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>J(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],Vp=Object.fromEntries(Fp.map(e=>[e.id,e.import]));var Gp=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function nO(){return 2147483648}function rO(){return typeof performance<"u"?performance.now():Date.now()}const sO=(e,t)=>e+(t-e%t)%t;async function iO(e){let t,n;const s={};function a(_){n=_,s.HEAPU8=new Uint8Array(_),s.HEAPU32=new Uint32Array(_)}function o(_,w,k){s.HEAPU8.copyWithin(_,w,w+k)}function u(_){try{return t.grow(_-n.byteLength+65535>>>16),a(t.buffer),1}catch{}}function c(_){const w=s.HEAPU8.length;_=_>>>0;const k=nO();if(_>k)return!1;for(let v=1;v<=4;v*=2){let S=w*(1+.2/v);S=Math.min(S,_+100663296);const y=Math.min(k,sO(Math.max(_,S),65536));if(u(y))return!0}return!1}const d=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function f(_,w,k=1024){const v=w+k;let S=w;for(;_[S]&&!(S>=v);)++S;if(S-w>16&&_.buffer&&d)return d.decode(_.subarray(w,S));let y="";for(;w<S;){let b=_[w++];if(!(b&128)){y+=String.fromCharCode(b);continue}const E=_[w++]&63;if((b&224)===192){y+=String.fromCharCode((b&31)<<6|E);continue}const N=_[w++]&63;if((b&240)===224?b=(b&15)<<12|E<<6|N:b=(b&7)<<18|E<<12|N<<6|_[w++]&63,b<65536)y+=String.fromCharCode(b);else{const T=b-65536;y+=String.fromCharCode(55296|T>>10,56320|T&1023)}}return y}function p(_,w){return _?f(s.HEAPU8,_,w):""}const m={emscripten_get_now:rO,emscripten_memcpy_big:o,emscripten_resize_heap:c,fd_write:()=>0};async function x(){const w=await e({env:m,wasi_snapshot_preview1:m});t=w.memory,a(t.buffer),Object.assign(s,w),s.UTF8ToString=p}return await x(),s}var aO=Object.defineProperty,oO=(e,t,n)=>t in e?aO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tn=(e,t,n)=>oO(e,typeof t!="symbol"?t+"":t,n);let ln=null;function lO(e){throw new Gp(e.UTF8ToString(e.getLastOnigError()))}class Ju{constructor(t){tn(this,"utf16Length"),tn(this,"utf8Length"),tn(this,"utf16Value"),tn(this,"utf8Value"),tn(this,"utf16OffsetToUtf8"),tn(this,"utf8OffsetToUtf16");const n=t.length,s=Ju._utf8ByteLength(t),a=s!==n,o=a?new Uint32Array(n+1):null;a&&(o[n]=s);const u=a?new Uint32Array(s+1):null;a&&(u[s]=n);const c=new Uint8Array(s);let d=0;for(let f=0;f<n;f++){const p=t.charCodeAt(f);let m=p,x=!1;if(p>=55296&&p<=56319&&f+1<n){const _=t.charCodeAt(f+1);_>=56320&&_<=57343&&(m=(p-55296<<10)+65536|_-56320,x=!0)}a&&(o[f]=d,x&&(o[f+1]=d),m<=127?u[d+0]=f:m<=2047?(u[d+0]=f,u[d+1]=f):m<=65535?(u[d+0]=f,u[d+1]=f,u[d+2]=f):(u[d+0]=f,u[d+1]=f,u[d+2]=f,u[d+3]=f)),m<=127?c[d++]=m:m<=2047?(c[d++]=192|(m&1984)>>>6,c[d++]=128|(m&63)>>>0):m<=65535?(c[d++]=224|(m&61440)>>>12,c[d++]=128|(m&4032)>>>6,c[d++]=128|(m&63)>>>0):(c[d++]=240|(m&1835008)>>>18,c[d++]=128|(m&258048)>>>12,c[d++]=128|(m&4032)>>>6,c[d++]=128|(m&63)>>>0),x&&f++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=c,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=u}static _utf8ByteLength(t){let n=0;for(let s=0,a=t.length;s<a;s++){const o=t.charCodeAt(s);let u=o,c=!1;if(o>=55296&&o<=56319&&s+1<a){const d=t.charCodeAt(s+1);d>=56320&&d<=57343&&(u=(o-55296<<10)+65536|d-56320,c=!0)}u<=127?n+=1:u<=2047?n+=2:u<=65535?n+=3:n+=4,c&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Zu=class Nr{constructor(t){if(tn(this,"id",++Nr.LAST_ID),tn(this,"_onigBinding"),tn(this,"content"),tn(this,"utf16Length"),tn(this,"utf8Length"),tn(this,"utf16OffsetToUtf8"),tn(this,"utf8OffsetToUtf16"),tn(this,"ptr"),!ln)throw new Gp("Must invoke loadWasm first.");this._onigBinding=ln,this.content=t;const n=new Ju(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Nr._sharedPtrInUse?(Nr._sharedPtr||(Nr._sharedPtr=ln.omalloc(1e4)),Nr._sharedPtrInUse=!0,ln.HEAPU8.set(n.utf8Value,Nr._sharedPtr),this.ptr=Nr._sharedPtr):this.ptr=n.createString(ln)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Nr._sharedPtr?Nr._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};tn(Zu,"LAST_ID",0);tn(Zu,"_sharedPtr",0);tn(Zu,"_sharedPtrInUse",!1);let Z1=Zu;class cO{constructor(t){if(tn(this,"_onigBinding"),tn(this,"_ptr"),!ln)throw new Gp("Must invoke loadWasm first.");const n=[],s=[];for(let c=0,d=t.length;c<d;c++){const f=new Ju(t[c]);n[c]=f.createString(ln),s[c]=f.utf8Length}const a=ln.omalloc(4*t.length);ln.HEAPU32.set(n,a/4);const o=ln.omalloc(4*t.length);ln.HEAPU32.set(s,o/4);const u=ln.createOnigScanner(a,o,t.length);for(let c=0,d=t.length;c<d;c++)ln.ofree(n[c]);ln.ofree(o),ln.ofree(a),u===0&&lO(ln),this._onigBinding=ln,this._ptr=u}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let a=0;if(typeof s=="number"&&(a=s),typeof t=="string"){t=new Z1(t);const o=this._findNextMatchSync(t,n,!1,a);return t.dispose(),o}return this._findNextMatchSync(t,n,!1,a)}_findNextMatchSync(t,n,s,a){const o=this._onigBinding,u=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),a);if(u===0)return null;const c=o.HEAPU32;let d=u/4;const f=c[d++],p=c[d++],m=[];for(let x=0;x<p;x++){const _=t.convertUtf8OffsetToUtf16(c[d++]),w=t.convertUtf8OffsetToUtf16(c[d++]);m[x]={start:_,end:w,length:w-_}}return{index:f,captureIndices:m}}}function uO(e){return typeof e.instantiator=="function"}function dO(e){return typeof e.default=="function"}function hO(e){return typeof e.data<"u"}function fO(e){return typeof Response<"u"&&e instanceof Response}function mO(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let Zc;function Wp(e){if(Zc)return Zc;async function t(){ln=await iO(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),uO(s)?s=await s.instantiator(n):dO(s)?s=await s.default(n):(hO(s)&&(s=s.data),fO(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await pO(s)(n):s=await gO(s)(n):mO(s)?s=await tm(s)(n):s instanceof WebAssembly.Module?s=await tm(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await tm(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return Zc=t(),Zc}function tm(e){return t=>WebAssembly.instantiate(e,t)}function pO(e){return t=>WebAssembly.instantiateStreaming(e,t)}function gO(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let ew;function xO(e){ew=e}function _O(){return ew}async function tw(e){return e&&await Wp(e),{createScanner(t){return new cO(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Z1(t)}}}const yO=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:tw,getDefaultWasmLoader:_O,loadWasm:Wp,setDefaultWasmLoader:xO},Symbol.toStringTag,{value:"Module"}));var nw=zp({});J1(nw,yO);var Nt=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function vO(e){return qp(e)}function qp(e){return Array.isArray(e)?bO(e):e instanceof RegExp?e:typeof e=="object"?SO(e):e}function bO(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=qp(e[n]);return t}function SO(e){let t={};for(let n in e)t[n]=qp(e[n]);return t}function rw(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function sw(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?sw(e.substring(0,e.length-1)):e.substr(~t+1)}var nm=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,eu=class{static hasCaptures(e){return e===null?!1:(nm.lastIndex=0,nm.test(e))}static replaceCaptures(e,t,n){return e.replace(nm,(s,a,o,u)=>{let c=n[parseInt(a||o,10)];if(c){let d=t.substring(c.start,c.end);for(;d[0]===".";)d=d.substring(1);switch(u){case"downcase":return d.toLowerCase();case"upcase":return d.toUpperCase();default:return d}}else return s})}};function iw(e,t){return e<t?-1:e>t?1:0}function aw(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let a=0;a<n;a++){let o=iw(e[a],t[a]);if(o!==0)return o}return 0}return n-s}function Vb(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function ow(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var lw=class{constructor(e){he(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Su=class{constructor(e,t,n){he(this,"_cachedMatchRoot",new lw(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(kO(e),t)}static createFromParsedTheme(e,t){return jO(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(a=>wO(e.parent,a.parentScopes));return s?new cw(s.fontStyle,s.foreground,s.background):null}},rm=class uu{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new uu(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new uu(n,t[s]);return n}push(t){return new uu(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function wO(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],a=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],a=!0}for(;e&&!CO(e.scopeName,s);){if(a)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function CO(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var cw=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function kO(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let a=0,o=t.length;a<o;a++){let u=t[a];if(!u.settings)continue;let c;if(typeof u.scope=="string"){let m=u.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),c=m.split(",")}else Array.isArray(u.scope)?c=u.scope:c=[""];let d=-1;if(typeof u.settings.fontStyle=="string"){d=0;let m=u.settings.fontStyle.split(" ");for(let x=0,_=m.length;x<_;x++)switch(m[x]){case"italic":d=d|1;break;case"bold":d=d|2;break;case"underline":d=d|4;break;case"strikethrough":d=d|8;break}}let f=null;typeof u.settings.foreground=="string"&&Vb(u.settings.foreground)&&(f=u.settings.foreground);let p=null;typeof u.settings.background=="string"&&Vb(u.settings.background)&&(p=u.settings.background);for(let m=0,x=c.length;m<x;m++){let w=c[m].trim().split(" "),k=w[w.length-1],v=null;w.length>1&&(v=w.slice(0,w.length-1),v.reverse()),n[s++]=new EO(k,v,a,d,f,p)}}return n}var EO=class{constructor(e,t,n,s,a,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=a,this.background=o}},yn=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(yn||{});function jO(e,t){e.sort((d,f)=>{let p=iw(d.scope,f.scope);return p!==0||(p=aw(d.parentScopes,f.parentScopes),p!==0)?p:d.index-f.index});let n=0,s="#000000",a="#ffffff";for(;e.length>=1&&e[0].scope==="";){let d=e.shift();d.fontStyle!==-1&&(n=d.fontStyle),d.foreground!==null&&(s=d.foreground),d.background!==null&&(a=d.background)}let o=new TO(t),u=new cw(n,o.getId(s),o.getId(a)),c=new AO(new $m(0,null,-1,0,0),[]);for(let d=0,f=e.length;d<f;d++){let p=e[d];c.insert(0,p.scope,p.parentScopes,p.fontStyle,o.getId(p.foreground),o.getId(p.background))}return new Su(o,u,c)}var TO=class{constructor(e){he(this,"_isFrozen");he(this,"_lastColorId");he(this,"_id2color");he(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},NO=Object.freeze([]),$m=class uw{constructor(t,n,s,a,o){he(this,"scopeDepth");he(this,"parentScopes");he(this,"fontStyle");he(this,"foreground");he(this,"background");this.scopeDepth=t,this.parentScopes=n||NO,this.fontStyle=s,this.foreground=a,this.background=o}clone(){return new uw(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,a=t.length;s<a;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,a){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),a!==0&&(this.background=a)}},AO=class Um{constructor(t,n=[],s={}){he(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,a=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[a]===">"&&a++,!(s>=t.parentScopes.length||a>=n.parentScopes.length);){const o=n.parentScopes[a].length-t.parentScopes[s].length;if(o!==0)return o;s++,a++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),a,o;if(s===-1?(a=t,o=""):(a=t.substring(0,s),o=t.substring(s+1)),this._children.hasOwnProperty(a))return this._children[a].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Um._cmpBySpecificity),n}insert(t,n,s,a,o,u){if(n===""){this._doInsertHere(t,s,a,o,u);return}let c=n.indexOf("."),d,f;c===-1?(d=n,f=""):(d=n.substring(0,c),f=n.substring(c+1));let p;this._children.hasOwnProperty(d)?p=this._children[d]:(p=new Um(this._mainRule.clone(),$m.cloneArr(this._rulesWithParentScopes)),this._children[d]=p),p.insert(t+1,f,s,a,o,u)}_doInsertHere(t,n,s,a,o){if(n===null){this._mainRule.acceptOverwrite(t,s,a,o);return}for(let u=0,c=this._rulesWithParentScopes.length;u<c;u++){let d=this._rulesWithParentScopes[u];if(aw(d.parentScopes,n)===0){d.acceptOverwrite(t,s,a,o);return}}s===-1&&(s=this._mainRule.fontStyle),a===0&&(a=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new $m(t,n,s,a,o))}},$a=class sr{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=sr.getLanguageId(t),s=sr.getTokenType(t),a=sr.getFontStyle(t),o=sr.getForeground(t),u=sr.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:a,foreground:o,background:u})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,a,o,u,c){let d=sr.getLanguageId(t),f=sr.getTokenType(t),p=sr.containsBalancedBrackets(t)?1:0,m=sr.getFontStyle(t),x=sr.getForeground(t),_=sr.getBackground(t);return n!==0&&(d=n),s!==8&&(f=s),a!==null&&(p=a?1:0),o!==-1&&(m=o),u!==0&&(x=u),c!==0&&(_=c),(d<<0|f<<8|p<<10|m<<11|x<<15|_<<24)>>>0}};function wu(e,t){const n=[],s=LO(e);let a=s.next();for(;a!==null;){let d=0;if(a.length===2&&a.charAt(1)===":"){switch(a.charAt(0)){case"R":d=1;break;case"L":d=-1;break;default:console.log(`Unknown priority ${a} in scope selector`)}a=s.next()}let f=u();if(n.push({matcher:f,priority:d}),a!==",")break;a=s.next()}return n;function o(){if(a==="-"){a=s.next();const d=o();return f=>!!d&&!d(f)}if(a==="("){a=s.next();const d=c();return a===")"&&(a=s.next()),d}if(Gb(a)){const d=[];do d.push(a),a=s.next();while(Gb(a));return f=>t(d,f)}return null}function u(){const d=[];let f=o();for(;f;)d.push(f),f=o();return p=>d.every(m=>m(p))}function c(){const d=[];let f=u();for(;f&&(d.push(f),a==="|"||a===",");){do a=s.next();while(a==="|"||a===",");f=u()}return p=>d.some(m=>m(p))}}function Gb(e){return!!e&&!!e.match(/[\w\.:]+/)}function LO(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function dw(e){typeof e.dispose=="function"&&e.dispose()}var dl=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},DO=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},RO=class{constructor(){he(this,"_references",[]);he(this,"_seenReferenceKeys",new Set);he(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},OO=class{constructor(e,t){he(this,"seenFullScopeRequests",new Set);he(this,"seenPartialScopeRequests",new Set);he(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new dl(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new RO;for(const n of e)MO(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof dl){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function MO(e,t,n,s){const a=n.lookup(e.scopeName);if(!a){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof dl?du({baseGrammar:o,selfGrammar:a},s):Fm(e.ruleName,{baseGrammar:o,selfGrammar:a,repository:a.repository},s);const u=n.injections(e.scopeName);if(u)for(const c of u)s.add(new dl(c))}function Fm(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];Cu([s],t,n)}}function du(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Cu(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Cu(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Cu(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const a=s.repository?rw({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&Cu(s.patterns,{...t,repository:a},n);const o=s.include;if(!o)continue;const u=hw(o);switch(u.kind){case 0:du({...t,selfGrammar:t.baseGrammar},n);break;case 1:du(t,n);break;case 2:Fm(u.ruleName,{...t,repository:a},n);break;case 3:case 4:const c=u.scopeName===t.selfGrammar.scopeName?t.selfGrammar:u.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(c){const d={baseGrammar:t.baseGrammar,selfGrammar:c,repository:a};u.kind===4?Fm(u.ruleName,d,n):du(d,n)}else u.kind===4?n.add(new DO(u.scopeName,u.ruleName)):n.add(new dl(u.scopeName));break}}}var IO=class{constructor(){he(this,"kind",0)}},PO=class{constructor(){he(this,"kind",1)}},BO=class{constructor(e){he(this,"kind",2);this.ruleName=e}},zO=class{constructor(e){he(this,"kind",3);this.scopeName=e}},HO=class{constructor(e,t){he(this,"kind",4);this.scopeName=e,this.ruleName=t}};function hw(e){if(e==="$base")return new IO;if(e==="$self")return new PO;const t=e.indexOf("#");if(t===-1)return new zO(e);if(t===0)return new BO(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new HO(n,s)}}var $O=/\\(\d+)/,Wb=/\\(\d+)/g,UO=-1,fw=-2;var El=class{constructor(e,t,n,s){he(this,"$location");he(this,"id");he(this,"_nameIsCapturing");he(this,"_name");he(this,"_contentNameIsCapturing");he(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=eu.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=eu.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${sw(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:eu.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:eu.replaceCaptures(this._contentName,e,t)}},FO=class extends El{constructor(t,n,s,a,o){super(t,n,s,a);he(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,a){throw new Error("Not supported!")}},VO=class extends El{constructor(t,n,s,a,o){super(t,n,s,null);he(this,"_match");he(this,"captures");he(this,"_cachedCompiledPatterns");this._match=new hl(a,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fl,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qb=class extends El{constructor(t,n,s,a,o){super(t,n,s,a);he(this,"hasMissingPatterns");he(this,"patterns");he(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fl,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Vm=class extends El{constructor(t,n,s,a,o,u,c,d,f,p){super(t,n,s,a);he(this,"_begin");he(this,"beginCaptures");he(this,"_end");he(this,"endHasBackReferences");he(this,"endCaptures");he(this,"applyEndPatternLast");he(this,"hasMissingPatterns");he(this,"patterns");he(this,"_cachedCompiledPatterns");this._begin=new hl(o,this.id),this.beginCaptures=u,this._end=new hl(c||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=d,this.applyEndPatternLast=f||!1,this.patterns=p.patterns,this.hasMissingPatterns=p.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,a)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fl;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},ku=class extends El{constructor(t,n,s,a,o,u,c,d,f){super(t,n,s,a);he(this,"_begin");he(this,"beginCaptures");he(this,"whileCaptures");he(this,"_while");he(this,"whileHasBackReferences");he(this,"hasMissingPatterns");he(this,"patterns");he(this,"_cachedCompiledPatterns");he(this,"_cachedCompiledWhilePatterns");this._begin=new hl(o,this.id),this.beginCaptures=u,this.whileCaptures=d,this._while=new hl(c,fw),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,a){return this._getCachedCompiledPatterns(t).compileAG(t,s,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fl;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,a){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,a)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new fl,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},mw=class _n{static createCaptureRule(t,n,s,a,o){return t.registerRule(u=>new FO(n,u,s,a,o))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(a=>{if(t.id=a,t.match)return new VO(t.$vscodeTextmateLocation,t.id,t.name,t.match,_n._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=rw({},s,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qb(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,_n._compilePatterns(o,n,s))}return t.while?new ku(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,_n._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,_n._compileCaptures(t.whileCaptures||t.captures,n,s),_n._compilePatterns(t.patterns,n,s)):new Vm(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,_n._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,_n._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,_n._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let a=[];if(t){let o=0;for(const u in t){if(u==="$vscodeTextmateLocation")continue;const c=parseInt(u,10);c>o&&(o=c)}for(let u=0;u<=o;u++)a[u]=null;for(const u in t){if(u==="$vscodeTextmateLocation")continue;const c=parseInt(u,10);let d=0;t[u].patterns&&(d=_n.getCompiledRuleId(t[u],n,s)),a[c]=_n.createCaptureRule(n,t[u].$vscodeTextmateLocation,t[u].name,t[u].contentName,d)}}return a}static _compilePatterns(t,n,s){let a=[];if(t)for(let o=0,u=t.length;o<u;o++){const c=t[o];let d=-1;if(c.include){const f=hw(c.include);switch(f.kind){case 0:case 1:d=_n.getCompiledRuleId(s[c.include],n,s);break;case 2:let p=s[f.ruleName];p&&(d=_n.getCompiledRuleId(p,n,s));break;case 3:case 4:const m=f.scopeName,x=f.kind===4?f.ruleName:null,_=n.getExternalGrammar(m,s);if(_)if(x){let w=_.repository[x];w&&(d=_n.getCompiledRuleId(w,n,_.repository))}else d=_n.getCompiledRuleId(_.repository.$self,n,_.repository);break}}else d=_n.getCompiledRuleId(c,n,s);if(d!==-1){const f=n.getRule(d);let p=!1;if((f instanceof qb||f instanceof Vm||f instanceof ku)&&f.hasMissingPatterns&&f.patterns.length===0&&(p=!0),p)continue;a.push(d)}}return{patterns:a,hasMissingPatterns:(t?t.length:0)!==a.length}}},hl=class pw{constructor(t,n){he(this,"source");he(this,"ruleId");he(this,"hasAnchor");he(this,"hasBackReferences");he(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let a=0,o=[],u=!1;for(let c=0;c<s;c++)if(t.charAt(c)==="\\"&&c+1<s){const f=t.charAt(c+1);f==="z"?(o.push(t.substring(a,c)),o.push("$(?!\\n)(?<!\\n)"),a=c+2):(f==="A"||f==="G")&&(u=!0),c++}this.hasAnchor=u,a===0?this.source=t:(o.push(t.substring(a,s)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=$O.test(this.source):this.hasBackReferences=!1}clone(){return new pw(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(a=>t.substring(a.start,a.end));return Wb.lastIndex=0,this.source.replace(Wb,(a,o)=>ow(s[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],a=[],o,u,c,d;for(o=0,u=this.source.length;o<u;o++)c=this.source.charAt(o),t[o]=c,n[o]=c,s[o]=c,a[o]=c,c==="\\"&&o+1<u&&(d=this.source.charAt(o+1),d==="A"?(t[o+1]="",n[o+1]="",s[o+1]="A",a[o+1]="A"):d==="G"?(t[o+1]="",n[o+1]="G",s[o+1]="",a[o+1]="G"):(t[o+1]=d,n[o+1]=d,s[o+1]=d,a[o+1]=d),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:a.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},fl=class{constructor(){he(this,"_items");he(this,"_hasAnchors");he(this,"_cached");he(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Kb(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(a=>a.resolveAnchors(t,n));return new Kb(e,s,this._items.map(a=>a.ruleId))}},Kb=class{constructor(e,t,n){he(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
123
|
-
`)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},sm=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ls,GO=(ls=class{constructor(t,n){he(this,"_defaultAttributes");he(this,"_embeddedLanguagesMatcher");he(this,"_getBasicScopeAttributes",new lw(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new sm(n,s)}));this._defaultAttributes=new sm(t,8),this._embeddedLanguagesMatcher=new WO(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?ls._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(ls.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},he(ls,"_NULL_SCOPE_METADATA",new sm(0,0)),he(ls,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),ls),WO=class{constructor(e){he(this,"values");he(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>ow(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Yb=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function gw(e,t,n,s,a,o,u,c){const d=t.content.length;let f=!1,p=-1;if(u){const _=qO(e,t,n,s,a,o);a=_.stack,s=_.linePos,n=_.isFirstLine,p=_.anchorPosition}const m=Date.now();for(;!f;){if(c!==0&&Date.now()-m>c)return new Yb(a,!0);x()}return new Yb(a,!1);function x(){const _=KO(e,t,n,s,a,p);if(!_){o.produce(a,d),f=!0;return}const w=_.captureIndices,k=_.matchedRuleId,v=w&&w.length>0?w[0].end>s:!1;if(k===UO){const S=a.getRule(e);o.produce(a,w[0].start),a=a.withContentNameScopesList(a.nameScopesList),tl(e,t,n,a,o,S.endCaptures,w),o.produce(a,w[0].end);const y=a;if(a=a.parent,p=y.getAnchorPos(),!v&&y.getEnterPos()===s){a=y,o.produce(a,d),f=!0;return}}else{const S=e.getRule(k);o.produce(a,w[0].start);const y=a,b=S.getName(t.content,w),E=a.contentNameScopesList.pushAttributed(b,e);if(a=a.push(k,s,p,w[0].end===d,null,E,E),S instanceof Vm){const N=S;tl(e,t,n,a,o,N.beginCaptures,w),o.produce(a,w[0].end),p=w[0].end;const T=N.getContentName(t.content,w),L=E.pushAttributed(T,e);if(a=a.withContentNameScopesList(L),N.endHasBackReferences&&(a=a.withEndRule(N.getEndWithResolvedBackReferences(t.content,w))),!v&&y.hasSameRuleAs(a)){a=a.pop(),o.produce(a,d),f=!0;return}}else if(S instanceof ku){const N=S;tl(e,t,n,a,o,N.beginCaptures,w),o.produce(a,w[0].end),p=w[0].end;const T=N.getContentName(t.content,w),L=E.pushAttributed(T,e);if(a=a.withContentNameScopesList(L),N.whileHasBackReferences&&(a=a.withEndRule(N.getWhileWithResolvedBackReferences(t.content,w))),!v&&y.hasSameRuleAs(a)){a=a.pop(),o.produce(a,d),f=!0;return}}else if(tl(e,t,n,a,o,S.captures,w),o.produce(a,w[0].end),a=a.pop(),!v){a=a.safePop(),o.produce(a,d),f=!0;return}}w[0].end>s&&(s=w[0].end,n=!1)}}function qO(e,t,n,s,a,o){let u=a.beginRuleCapturedEOL?0:-1;const c=[];for(let d=a;d;d=d.pop()){const f=d.getRule(e);f instanceof ku&&c.push({rule:f,stack:d})}for(let d=c.pop();d;d=c.pop()){const{ruleScanner:f,findOptions:p}=QO(d.rule,e,d.stack.endRule,n,s===u),m=f.findNextMatchSync(t,s,p);if(m){if(m.ruleId!==fw){a=d.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(o.produce(d.stack,m.captureIndices[0].start),tl(e,t,n,d.stack,o,d.rule.whileCaptures,m.captureIndices),o.produce(d.stack,m.captureIndices[0].end),u=m.captureIndices[0].end,m.captureIndices[0].end>s&&(s=m.captureIndices[0].end,n=!1))}else{a=d.stack.pop();break}}return{stack:a,linePos:s,anchorPosition:u,isFirstLine:n}}function KO(e,t,n,s,a,o){const u=YO(e,t,n,s,a,o),c=e.getInjections();if(c.length===0)return u;const d=XO(c,e,t,n,s,a,o);if(!d)return u;if(!u)return d;const f=u.captureIndices[0].start,p=d.captureIndices[0].start;return p<f||d.priorityMatch&&p===f?d:u}function YO(e,t,n,s,a,o){const u=a.getRule(e),{ruleScanner:c,findOptions:d}=xw(u,e,a.endRule,n,s===o),f=c.findNextMatchSync(t,s,d);return f?{captureIndices:f.captureIndices,matchedRuleId:f.ruleId}:null}function XO(e,t,n,s,a,o,u){let c=Number.MAX_VALUE,d=null,f,p=0;const m=o.contentNameScopesList.getScopeNames();for(let x=0,_=e.length;x<_;x++){const w=e[x];if(!w.matcher(m))continue;const k=t.getRule(w.ruleId),{ruleScanner:v,findOptions:S}=xw(k,t,null,s,a===u),y=v.findNextMatchSync(n,a,S);if(!y)continue;const b=y.captureIndices[0].start;if(!(b>=c)&&(c=b,d=y.captureIndices,f=y.ruleId,p=w.priority,c===a))break}return d?{priorityMatch:p===-1,captureIndices:d,matchedRuleId:f}:null}function xw(e,t,n,s,a){return{ruleScanner:e.compileAG(t,n,s,a),findOptions:0}}function QO(e,t,n,s,a){return{ruleScanner:e.compileWhileAG(t,n,s,a),findOptions:0}}function tl(e,t,n,s,a,o,u){if(o.length===0)return;const c=t.content,d=Math.min(o.length,u.length),f=[],p=u[0].end;for(let m=0;m<d;m++){const x=o[m];if(x===null)continue;const _=u[m];if(_.length===0)continue;if(_.start>p)break;for(;f.length>0&&f[f.length-1].endPos<=_.start;)a.produceFromScopes(f[f.length-1].scopes,f[f.length-1].endPos),f.pop();if(f.length>0?a.produceFromScopes(f[f.length-1].scopes,_.start):a.produce(s,_.start),x.retokenizeCapturedWithRuleId){const k=x.getName(c,u),v=s.contentNameScopesList.pushAttributed(k,e),S=x.getContentName(c,u),y=v.pushAttributed(S,e),b=s.push(x.retokenizeCapturedWithRuleId,_.start,-1,!1,null,v,y),E=e.createOnigString(c.substring(0,_.end));gw(e,E,n&&_.start===0,_.start,b,a,!1,0),dw(E);continue}const w=x.getName(c,u);if(w!==null){const v=(f.length>0?f[f.length-1].scopes:s.contentNameScopesList).pushAttributed(w,e);f.push(new JO(v,_.end))}}for(;f.length>0;)a.produceFromScopes(f[f.length-1].scopes,f[f.length-1].endPos),f.pop()}var JO=class{constructor(e,t){he(this,"scopes");he(this,"endPos");this.scopes=e,this.endPos=t}};function ZO(e,t,n,s,a,o,u,c){return new t4(e,t,n,s,a,o,u,c)}function Xb(e,t,n,s,a){const o=wu(t,Eu),u=mw.getCompiledRuleId(n,s,a.repository);for(const c of o)e.push({debugSelector:t,matcher:c.matcher,ruleId:u,grammar:a,priority:c.priority})}function Eu(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let a=n;a<t.length;a++)if(e4(t[a],s))return n=a+1,!0;return!1})}function e4(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var t4=class{constructor(e,t,n,s,a,o,u,c){he(this,"_rootId");he(this,"_lastRuleId");he(this,"_ruleId2desc");he(this,"_includedGrammars");he(this,"_grammarRepository");he(this,"_grammar");he(this,"_injections");he(this,"_basicScopeAttributesProvider");he(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=c,this._basicScopeAttributesProvider=new GO(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=u,this._grammar=Qb(t,null),this._injections=null,this._tokenTypeMatchers=[],a)for(const d of Object.keys(a)){const f=wu(d,Eu);for(const p of f)this._tokenTypeMatchers.push({matcher:p.matcher,type:a[d]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:a=>a===this._rootScopeName?this._grammar:this.getExternalGrammar(a),injections:a=>this._grammarRepository.injections(a)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const a=s.injections;if(a)for(let u in a)Xb(t,u,a[u],this,s);const o=this._grammarRepository.injections(n);o&&o.forEach(u=>{const c=this.getExternalGrammar(u);if(c){const d=c.injectionSelector;d&&Xb(t,d,c,this,c)}})}return t.sort((a,o)=>a.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Qb(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=mw.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let a;if(!t||t===Gm.NULL){a=!0;const f=this._basicScopeAttributesProvider.getDefaultAttributes(),p=this.themeProvider.getDefaults(),m=$a.set(0,f.languageId,f.tokenType,null,p.fontStyle,p.foregroundId,p.backgroundId),x=this.getRule(this._rootId).getName(null,null);let _;x?_=al.createRootAndLookUpScopeName(x,m,this):_=al.createRoot("unknown",m),t=new Gm(null,this._rootId,-1,-1,!1,null,_,_)}else a=!1,t.reset();e=e+`
|
|
124
|
-
`;const o=this.createOnigString(e),u=o.content.length,c=new r4(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),d=gw(this,o,a,0,t,c,!0,s);return dw(o),{lineLength:u,lineTokens:c,ruleStack:d.stack,stoppedEarly:d.stoppedEarly}}};function Qb(e,t){return e=vO(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var al=class Ar{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,a=(t==null?void 0:t.scopePath)??null;for(const o of n)a=rm.push(a,o.scopeNames),s=new Ar(s,a,o.encodedTokenAttributes);return s}static createRoot(t,n){return new Ar(null,new rm(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const a=s.getMetadataForScope(t),o=new rm(null,t),u=s.themeProvider.themeMatch(o),c=Ar.mergeAttributes(n,a,u);return new Ar(null,o,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Ar.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let a=-1,o=0,u=0;return s!==null&&(a=s.fontStyle,o=s.foregroundId,u=s.backgroundId),$a.set(t,n.languageId,n.tokenType,null,a,o,u)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Ar._pushAttributed(this,t,n);const s=t.split(/ /g);let a=this;for(const o of s)a=Ar._pushAttributed(a,o,n);return a}static _pushAttributed(t,n,s){const a=s.getMetadataForScope(n),o=t.scopePath.push(n),u=s.themeProvider.themeMatch(o),c=Ar.mergeAttributes(t.tokenAttributes,a,u);return new Ar(t,o,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var a;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((a=s.parent)==null?void 0:a.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},ar,Gm=(ar=class{constructor(t,n,s,a,o,u,c,d){he(this,"_stackElementBrand");he(this,"_enterPos");he(this,"_anchorPos");he(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=u,this.nameScopesList=c,this.contentNameScopesList=d,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=a}equals(t){return t===null?!1:ar._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?al.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ar._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,a,o,u,c){return new ar(this,t,n,s,a,o,u,c)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,a;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(a=this.contentNameScopesList)==null?void 0:a.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ar(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=al.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ar(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,al.fromExtension(s,n.contentNameScopesList))}},he(ar,"NULL",new ar(null,0,0,0,!1,null,null,null)),ar),n4=class{constructor(e,t){he(this,"balancedBracketScopes");he(this,"unbalancedBracketScopes");he(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):wu(n,Eu).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>wu(n,Eu).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},r4=class{constructor(e,t,n,s){he(this,"_emitBinaryTokens");he(this,"_lineText");he(this,"_tokens");he(this,"_binaryTokens");he(this,"_lastTokenEndIndex");he(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let a=(e==null?void 0:e.tokenAttributes)??0,o=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const u=(e==null?void 0:e.getScopeNames())??[];for(const c of this._tokenTypeOverrides)c.matcher(u)&&(a=$a.set(a,0,c.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(u))}if(o&&(a=$a.set(a,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,a=this._binaryTokens.length;s<a;s++)n[s]=this._binaryTokens[s];return n}},s4=class{constructor(e,t){he(this,"_grammars",new Map);he(this,"_rawGrammars",new Map);he(this,"_injectionGrammars",new Map);he(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,a){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,ZO(e,o,t,n,s,a,this,this._onigLib))}return this._grammars.get(e)}},i4=class{constructor(t){he(this,"_options");he(this,"_syncRegistry");he(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new s4(Su.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Su.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new n4(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,a,o){const u=new OO(this._syncRegistry,t);for(;u.Q.length>0;)u.Q.map(c=>this._loadSingleGrammar(c.scopeName)),u.processQueue();return this._grammarForScopeName(t,n,s,a,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,a=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,a)}_grammarForScopeName(t,n=0,s=null,a=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,s,a,o)}},Wm=Gm.NULL;function ju(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[a,o]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof o=="string"?n[a]=o:a===s&&Object.assign(n,o);return n}function Vs(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function a4(e){return Array.isArray(e)?e:[e]}async function _w(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function ed(e){return!e||["plaintext","txt","text","plain"].includes(e)}function yw(e){return e==="ansi"||ed(e)}function td(e){return e==="none"}function vw(e){return td(e)}const o4=/(\r?\n)/g;function nd(e,t=!1){var o;if(e.length===0)return[["",0]];const n=e.split(o4);let s=0;const a=[];for(let u=0;u<n.length;u+=2){const c=t?n[u]+(n[u+1]||""):n[u];a.push([c,s]),s+=n[u].length,s+=((o=n[u+1])==null?void 0:o.length)||0}return a}const Jb={light:"#333333",dark:"#bbbbbb"},Zb={light:"#fffffe",dark:"#1e1e1e"},e0="__shiki_resolved";function Kp(e){var c,d,f,p,m;if(e!=null&&e[e0])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const x=t.settings?t.settings.find(_=>!_.name&&!_.scope):void 0;(c=x==null?void 0:x.settings)!=null&&c.foreground&&(s=x.settings.foreground),(d=x==null?void 0:x.settings)!=null&&d.background&&(n=x.settings.background),!s&&((f=t==null?void 0:t.colors)!=null&&f["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((p=t==null?void 0:t.colors)!=null&&p["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?Jb.light:Jb.dark),n||(n=t.type==="light"?Zb.light:Zb.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let a=0;const o=new Map;function u(x){var w;if(o.has(x))return o.get(x);a+=1;const _=`#${a.toString(16).padStart(8,"0").toLowerCase()}`;return(w=t.colorReplacements)!=null&&w[`#${_}`]?u(x):(o.set(x,_),_)}t.settings=t.settings.map(x=>{var v,S;const _=((v=x.settings)==null?void 0:v.foreground)&&!x.settings.foreground.startsWith("#"),w=((S=x.settings)==null?void 0:S.background)&&!x.settings.background.startsWith("#");if(!_&&!w)return x;const k={...x,settings:{...x.settings}};if(_){const y=u(x.settings.foreground);t.colorReplacements[y]=x.settings.foreground,k.settings.foreground=y}if(w){const y=u(x.settings.background);t.colorReplacements[y]=x.settings.background,k.settings.background=y}return k});for(const x of Object.keys(t.colors||{}))if((x==="editor.foreground"||x==="editor.background"||x.startsWith("terminal.ansi"))&&!((m=t.colors[x])!=null&&m.startsWith("#"))){const _=u(t.colors[x]);t.colorReplacements[_]=t.colors[x],t.colors[x]=_}return Object.defineProperty(t,e0,{enumerable:!1,writable:!1,value:!0}),t}async function bw(e){return[...new Set((await Promise.all(e.filter(t=>!yw(t)).map(async t=>await _w(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Sw(e){return(await Promise.all(e.map(async t=>vw(t)?null:Kp(await _w(t))))).filter(t=>!!t)}function ww(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Nt(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var l4=class extends i4{constructor(t,n,s,a={}){super(t);he(this,"_resolver");he(this,"_themes");he(this,"_langs");he(this,"_alias");he(this,"_resolvedThemes",new Map);he(this,"_resolvedGrammars",new Map);he(this,"_langMap",new Map);he(this,"_langGraph",new Map);he(this,"_textmateThemeCache",new WeakMap);he(this,"_loadedThemesCache",null);he(this,"_loadedLanguagesCache",null);this._resolver=t,this._themes=n,this._langs=s,this._alias=a,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){const n=Kp(t);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let n=this._textmateThemeCache.get(t);n||(n=Su.createFromRawTheme(t),this._textmateThemeCache.set(t,n)),this._syncRegistry.setTheme(n)}getGrammar(t){return t=ww(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){var o,u,c,d;if(this.getGrammar(t.name))return;const n=new Set([...this._langMap.values()].filter(f=>{var p;return(p=f.embeddedLangsLazy)==null?void 0:p.includes(t.name)}));this._resolver.addLanguage(t);const s={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);const a=this.loadGrammarWithConfiguration(t.scopeName,1,s);if(a.name=t.name,this._resolvedGrammars.set(t.name,a),t.aliases&&t.aliases.forEach(f=>{this._alias[f]=t.name}),this._loadedLanguagesCache=null,n.size)for(const f of n)this._resolvedGrammars.delete(f.name),this._loadedLanguagesCache=null,(u=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||u.delete(f.scopeName),(d=(c=this._syncRegistry)==null?void 0:c._grammars)==null||d.delete(f.scopeName),this.loadLanguage(this._langMap.get(f.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(const a of t)this.resolveEmbeddedLanguages(a);const n=[...this._langGraph.entries()],s=n.filter(([a,o])=>!o);if(s.length){const a=n.filter(([o,u])=>{var c;return u?(c=u.embeddedLanguages||u.embeddedLangs)==null?void 0:c.some(d=>s.map(([f])=>f).includes(d)):!1}).filter(o=>!s.includes(o));throw new Nt(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${a.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[a,o]of n)this._resolver.addLanguage(o);for(const[a,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);const n=t.embeddedLanguages??t.embeddedLangs;if(n)for(const s of n)this._langGraph.set(s,this._langMap.get(s))}},c4=class{constructor(e,t){he(this,"_langs",new Map);he(this,"_scopeToLang",new Map);he(this,"_injections",new Map);he(this,"_onigLib");this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const a=t.slice(0,s).join(".");n=[...n,...this._injections.get(a)||[]]}return n}};let Yo=0;function u4(e){Yo+=1,e.warnings!==!1&&Yo>=10&&Yo%10===0&&console.warn(`[Shiki] ${Yo} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Nt("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(Kp),a=new l4(new c4(e.engine,n),s,n,e.langAlias);let o;function u(y){return ww(y,e.langAlias)}function c(y){v();const b=a.getGrammar(typeof y=="string"?y:y.name);if(!b)throw new Nt(`Language \`${y}\` not found, you may need to load it first`);return b}function d(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const b=a.getTheme(y);if(!b)throw new Nt(`Theme \`${y}\` not found, you may need to load it first`);return b}function f(y){v();const b=d(y);return o!==y&&(a.setTheme(b),o=y),{theme:b,colorMap:a.getColorMap()}}function p(){return v(),a.getLoadedThemes()}function m(){return v(),a.getLoadedLanguages()}function x(...y){v(),a.loadLanguages(y.flat(1))}async function _(...y){return x(await bw(y))}function w(...y){v();for(const b of y.flat(1))a.loadTheme(b)}async function k(...y){return v(),w(await Sw(y))}function v(){if(t)throw new Nt("Shiki instance has been disposed")}function S(){t||(t=!0,a.dispose(),Yo-=1)}return{setTheme:f,getTheme:d,getLanguage:c,getLoadedThemes:p,getLoadedLanguages:m,resolveLangAlias:u,loadLanguage:_,loadLanguageSync:x,loadTheme:k,loadThemeSync:w,dispose:S,[Symbol.dispose]:S}}async function d4(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([Sw(e.themes||[]),bw(e.langs||[]),e.engine]);return u4({...e,themes:t,langs:n,engine:s})}const Cw=new WeakMap;function rd(e,t){Cw.set(e,t)}function ml(e){return Cw.get(e)}var sd=class kw{constructor(...t){he(this,"_stacks",{});he(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,a]=t;this.lang=s,this._stacks={[a]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new kw(Object.fromEntries(a4(n).map(s=>[s,Wm])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return h4(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function h4(e){const t=[],n=new Set;function s(a){var u;if(n.has(a))return;n.add(a);const o=(u=a==null?void 0:a.nameScopesList)==null?void 0:u.scopeName;o&&t.push(o),a.parent&&s(a.parent)}return s(e),t}function f4(e,t){if(!(e instanceof sd))throw new Nt("Invalid grammar state");return e.getInternalStack(t)}const m4=/,/,p4=/ /;function Ew(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n;if(ed(e.resolveLangAlias(n.lang||"text"))||td(s))return nd(t).map(c=>[{content:c[0],offset:c[1]}]);const{theme:a,colorMap:o}=e.setTheme(s),u=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==u.name)throw new Nt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${u.name}"`);if(!n.grammarState.themes.includes(a.name))throw new Nt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return x4(t,u,a,o,n)}function g4(...e){if(e.length===2)return ml(e[1]);const[t,n,s={}]=e,{lang:a="text",theme:o=t.getLoadedThemes()[0]}=s;if(ed(a)||td(o))throw new Nt("Plain language does not have grammar state");if(a==="ansi")throw new Nt("ANSI language does not have grammar state");const{theme:u,colorMap:c}=t.setTheme(o),d=t.getLanguage(a);return new sd(Yp(n,d,u,c,s).stateStack,d.name,u.name)}function x4(e,t,n,s,a){const o=Yp(e,t,n,s,a),u=new sd(o.stateStack,t.name,n.name);return rd(o.tokens,u),o.tokens}function Yp(e,t,n,s,a){const o=ju(n,a),{tokenizeMaxLineLength:u=0,tokenizeTimeLimit:c=500}=a,d=nd(e);let f=a.grammarState?f4(a.grammarState,n.name)??Wm:a.grammarContextCode!=null?Yp(a.grammarContextCode,t,n,s,{...a,grammarState:void 0,grammarContextCode:void 0}).stateStack:Wm,p=[];const m=[];for(let x=0,_=d.length;x<_;x++){const[w,k]=d[x];if(w===""){p=[],m.push([]);continue}if(u>0&&w.length>=u){p=[],m.push([{content:w,offset:k,color:"",fontStyle:0}]);continue}let v,S,y;a.includeExplanation&&(v=t.tokenizeLine(w,f,c),S=v.tokens,y=0);const b=t.tokenizeLine2(w,f,c),E=b.tokens.length/2;for(let N=0;N<E;N++){const T=b.tokens[2*N],L=N+1<E?b.tokens[2*N+2]:w.length;if(T===L)continue;const A=b.tokens[2*N+1],M=Vs(s[$a.getForeground(A)],o),D=$a.getFontStyle(A),U={content:w.substring(T,L),offset:k+T,color:M,fontStyle:D};if(a.includeExplanation){const F=[];if(a.includeExplanation!=="scopeName")for(const Y of n.settings){let W;switch(typeof Y.scope){case"string":W=Y.scope.split(m4).map(H=>H.trim());break;case"object":W=Y.scope;break;default:continue}F.push({settings:Y,selectors:W.map(H=>H.split(p4))})}U.explanation=[];let B=0;for(;T+B<L;){const Y=S[y],W=w.substring(Y.startIndex,Y.endIndex);B+=W.length,U.explanation.push({content:W,scopes:a.includeExplanation==="scopeName"?_4(Y.scopes):y4(F,Y.scopes)}),y+=1}}p.push(U)}m.push(p),p=[],f=b.ruleStack}return{tokens:m,stateStack:f}}function _4(e){return e.map(t=>({scopeName:t}))}function y4(e,t){const n=[];for(let s=0,a=t.length;s<a;s++){const o=t[s];n[s]={scopeName:o,themeMatches:b4(e,o,t.slice(0,s))}}return n}function t0(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function v4(e,t,n){if(!t0(e.at(-1),t))return!1;let s=e.length-2,a=n.length-1;for(;s>=0&&a>=0;)t0(e[s],n[a])&&(s-=1),a-=1;return s===-1}function b4(e,t,n){const s=[];for(const{selectors:a,settings:o}of e)for(const u of a)if(v4(u,t,n)){s.push(o);break}return s}function jw(e,t,n,s=Ew){const a=Object.entries(n.themes).filter(f=>f[1]).map(f=>({color:f[0],theme:f[1]})),o=a.map(f=>{const p=s(e,t,{...n,theme:f.theme});return{tokens:p,state:ml(p),theme:typeof f.theme=="string"?f.theme:f.theme.name}}),u=S4(...o.map(f=>f.tokens)),c=u[0].map((f,p)=>f.map((m,x)=>{const _={content:m.content,variants:{},offset:m.offset};return"includeExplanation"in n&&n.includeExplanation&&(_.explanation=m.explanation),u.forEach((w,k)=>{const{content:v,explanation:S,offset:y,...b}=w[p][x];_.variants[a[k].color]=b}),_})),d=o[0].state?new sd(Object.fromEntries(o.map(f=>{var p;return[f.theme,(p=f.state)==null?void 0:p.getInternalStack(f.theme)]})),o[0].state.lang):void 0;return d&&rd(c,d),c}function S4(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const a=e.map(d=>d[s]),o=t.map(()=>[]);t.forEach((d,f)=>d.push(o[f]));const u=a.map(()=>0),c=a.map(d=>d[0]);for(;c.every(d=>d);){const d=Math.min(...c.map(f=>f.content.length));for(let f=0;f<n;f++){const p=c[f];p.content.length===d?(o[f].push(p),u[f]+=1,c[f]=a[f][u[f]]):(o[f].push({...p,content:p.content.slice(0,d)}),c[f]={...p,content:p.content.slice(d),offset:p.offset+d})}}}return t}const w4=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class jl{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}jl.prototype.normal={};jl.prototype.property={};jl.prototype.space=void 0;function Tw(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new jl(n,s,t)}function qm(e){return e.toLowerCase()}class On{constructor(t,n){this.attribute=n,this.property=t}}On.prototype.attribute="";On.prototype.booleanish=!1;On.prototype.boolean=!1;On.prototype.commaOrSpaceSeparated=!1;On.prototype.commaSeparated=!1;On.prototype.defined=!1;On.prototype.mustUseProperty=!1;On.prototype.number=!1;On.prototype.overloadedBoolean=!1;On.prototype.property="";On.prototype.spaceSeparated=!1;On.prototype.space=void 0;let C4=0;const Qe=Oi(),Jt=Oi(),Km=Oi(),ke=Oi(),Tt=Oi(),Ba=Oi(),Vn=Oi();function Oi(){return 2**++C4}const Ym=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:Jt,commaOrSpaceSeparated:Vn,commaSeparated:Ba,number:ke,overloadedBoolean:Km,spaceSeparated:Tt},Symbol.toStringTag,{value:"Module"})),im=Object.keys(Ym);class Xp extends On{constructor(t,n,s,a){let o=-1;if(super(t,n),n0(this,"space",a),typeof s=="number")for(;++o<im.length;){const u=im[o];n0(this,im[o],(s&Ym[u])===Ym[u])}}}Xp.prototype.defined=!0;function n0(e,t,n){n&&(e[t]=n)}function Wa(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Xp(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[qm(s)]=s,n[qm(o.attribute)]=s}return new jl(t,n,e.space)}const Nw=Wa({properties:{ariaActiveDescendant:null,ariaAtomic:Jt,ariaAutoComplete:null,ariaBusy:Jt,ariaChecked:Jt,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Tt,ariaCurrent:null,ariaDescribedBy:Tt,ariaDetails:null,ariaDisabled:Jt,ariaDropEffect:Tt,ariaErrorMessage:null,ariaExpanded:Jt,ariaFlowTo:Tt,ariaGrabbed:Jt,ariaHasPopup:null,ariaHidden:Jt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tt,ariaLevel:ke,ariaLive:null,ariaModal:Jt,ariaMultiLine:Jt,ariaMultiSelectable:Jt,ariaOrientation:null,ariaOwns:Tt,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Jt,ariaReadOnly:Jt,ariaRelevant:null,ariaRequired:Jt,ariaRoleDescription:Tt,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Jt,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Aw(e,t){return t in e?e[t]:t}function Lw(e,t){return Aw(e,t.toLowerCase())}const k4=Wa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ba,acceptCharset:Tt,accessKey:Tt,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:Tt,autoFocus:Qe,autoPlay:Qe,blocking:Tt,capture:null,charSet:null,checked:Qe,cite:null,className:Tt,cols:ke,colSpan:null,content:null,contentEditable:Jt,controls:Qe,controlsList:Tt,coords:ke|Ba,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:Km,draggable:Jt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:Tt,height:ke,hidden:Km,high:ke,href:null,hrefLang:null,htmlFor:Tt,httpEquiv:Tt,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:Tt,itemRef:Tt,itemScope:Qe,itemType:Tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Qe,optimum:ke,pattern:null,ping:Tt,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:Tt,required:Qe,reversed:Qe,rows:ke,rowSpan:ke,sandbox:Tt,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Jt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:Qe,useMap:null,value:Jt,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tt,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Jt,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Qe,disableRemotePlayback:Qe,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:Lw}),E4=Wa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vn,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:Qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ba,g2:Ba,glyphName:Ba,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:Vn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vn,rev:Vn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vn,requiredFeatures:Vn,requiredFonts:Vn,requiredFormats:Vn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:Vn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vn,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Aw}),Dw=Wa({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Rw=Wa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Lw}),Ow=Wa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),j4=/[A-Z]/g,r0=/-[a-z]/g,T4=/^data[-\w.:]+$/i;function N4(e,t){const n=qm(t);let s=t,a=On;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&T4.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(r0,L4);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!r0.test(o)){let u=o.replace(j4,A4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Xp}return new a(s,t)}function A4(e){return"-"+e.toLowerCase()}function L4(e){return e.charAt(1).toUpperCase()}const D4=Tw([Nw,k4,Dw,Rw,Ow],"html"),Mw=Tw([Nw,E4,Dw,Rw,Ow],"svg"),s0={}.hasOwnProperty;function R4(e,t){const n=t||{};function s(a,...o){let u=s.invalid;const c=s.handlers;if(a&&s0.call(a,e)){const d=String(a[e]);u=s0.call(c,d)?c[d]:s.unknown}if(u)return u.call(this,a,...o)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}const O4=/["&'<>`]/g,M4=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,I4=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,P4=/[|\\{}()[\]^$+*?.]/g,i0=new WeakMap;function B4(e,t){if(e=e.replace(t.subset?z4(t.subset):O4,s),t.subset||t.escapeOnly)return e;return e.replace(M4,n).replace(I4,s);function n(a,o,u){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,u.charCodeAt(o+2),t)}function s(a,o,u){return t.format(a.charCodeAt(0),u.charCodeAt(o+1),t)}}function z4(e){let t=i0.get(e);return t||(t=H4(e),i0.set(e,t)),t}function H4(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(P4,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const $4=/[\dA-Fa-f]/;function U4(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!$4.test(String.fromCharCode(t))?s:s+";"}const F4=/\d/;function V4(e,t,n){const s="&#"+String(e);return n&&t&&!F4.test(String.fromCharCode(t))?s:s+";"}const G4=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],am={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},W4=["cent","copy","divide","gt","lt","not","para","times"],Iw={}.hasOwnProperty,Xm={};let tu;for(tu in am)Iw.call(am,tu)&&(Xm[am[tu]]=tu);const q4=/[^\dA-Za-z]/;function K4(e,t,n,s){const a=String.fromCharCode(e);if(Iw.call(Xm,a)){const o=Xm[a],u="&"+o;return n&&G4.includes(o)&&!W4.includes(o)&&(!s||t&&t!==61&&q4.test(String.fromCharCode(t)))?u:u+";"}return""}function Y4(e,t,n){let s=U4(e,t,n.omitOptionalSemicolons),a;if((n.useNamedReferences||n.useShortestReferences)&&(a=K4(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!a)&&n.useShortestReferences){const o=V4(e,t,n.omitOptionalSemicolons);o.length<s.length&&(s=o)}return a&&(!n.useShortestReferences||a.length<s.length)?a:s}function za(e,t){return B4(e,Object.assign({format:Y4},t))}const X4=/^>|^->|<!--|-->|--!>|<!-$/g,Q4=[">"],J4=["<",">"];function Z4(e,t,n,s){return s.settings.bogusComments?"<?"+za(e.value,Object.assign({},s.settings.characterReferences,{subset:Q4}))+">":"<!--"+e.value.replace(X4,a)+"-->";function a(o){return za(o,Object.assign({},s.settings.characterReferences,{subset:J4}))}}function eM(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}function a0(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}function tM(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function nM(e){return e.join(" ").trim()}const rM=/[ \t\n\f\r]/g;function Qp(e){return typeof e=="object"?e.type==="text"?o0(e.value):!1:o0(e)}function o0(e){return e.replace(rM,"")===""}const sn=Bw(1),Pw=Bw(-1),sM=[];function Bw(e){return t;function t(n,s,a){const o=n?n.children:sM;let u=(s||0)+e,c=o[u];if(!a)for(;c&&Qp(c);)u+=e,c=o[u];return c}}const iM={}.hasOwnProperty;function zw(e){return t;function t(n,s,a){return iM.call(e,n.tagName)&&e[n.tagName](n,s,a)}}const Jp=zw({body:oM,caption:om,colgroup:om,dd:dM,dt:uM,head:om,html:aM,li:cM,optgroup:hM,option:fM,p:lM,rp:l0,rt:l0,tbody:pM,td:c0,tfoot:gM,th:c0,thead:mM,tr:xM});function om(e,t,n){const s=sn(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&Qp(s.value.charAt(0)))}function aM(e,t,n){const s=sn(n,t);return!s||s.type!=="comment"}function oM(e,t,n){const s=sn(n,t);return!s||s.type!=="comment"}function lM(e,t,n){const s=sn(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function cM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&s.tagName==="li"}function uM(e,t,n){const s=sn(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function dM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function l0(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function hM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function fM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function mM(e,t,n){const s=sn(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function pM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function gM(e,t,n){return!sn(n,t)}function xM(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function c0(e,t,n){const s=sn(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const _M=zw({body:bM,colgroup:SM,head:vM,html:yM,tbody:wM});function yM(e){const t=sn(e,-1);return!t||t.type!=="comment"}function vM(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function bM(e){const t=sn(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Qp(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function SM(e,t,n){const s=Pw(n,t),a=sn(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Jp(s,n.children.indexOf(s),n)?!1:!!(a&&a.type==="element"&&a.tagName==="col")}function wM(e,t,n){const s=Pw(n,t),a=sn(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Jp(s,n.children.indexOf(s),n)?!1:!!(a&&a.type==="element"&&a.tagName==="tr")}const nu={name:[[`
|
|
125
|
-
\f\r &/=>`.split(""),`
|
|
126
|
-
\f\r "&'/=>\``.split("")],[`\0
|
|
127
|
-
\f\r "&'/<=>`.split(""),`\0
|
|
128
|
-
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
129
|
-
\f\r &>`.split(""),`\0
|
|
130
|
-
\f\r "&'<=>\``.split("")],[`\0
|
|
131
|
-
\f\r "&'<=>\``.split(""),`\0
|
|
132
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function CM(e,t,n,s){const a=s.schema,o=a.space==="svg"?!1:s.settings.omitOptionalTags;let u=a.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const c=[];let d;a.space==="html"&&e.tagName==="svg"&&(s.schema=Mw);const f=kM(s,e.properties),p=s.all(a.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=a,p&&(u=!1),(f||!o||!_M(e,t,n))&&(c.push("<",e.tagName,f?" "+f:""),u&&(a.space==="svg"||s.settings.closeSelfClosing)&&(d=f.charAt(f.length-1),(!s.settings.tightSelfClosing||d==="/"||d&&d!=='"'&&d!=="'")&&c.push(" "),c.push("/")),c.push(">")),c.push(p),!u&&(!o||!Jp(e,t,n))&&c.push("</"+e.tagName+">"),c.join("")}function kM(e,t){const n=[];let s=-1,a;if(t){for(a in t)if(t[a]!==null&&t[a]!==void 0){const o=EM(e,a,t[a]);o&&n.push(o)}}for(;++s<n.length;){const o=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&o!=='"'&&o!=="'"&&(n[s]+=" ")}return n.join("")}function EM(e,t,n){const s=N4(e.schema,t),a=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let u=e.quote,c;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const d=za(s.attribute,Object.assign({},e.settings.characterReferences,{subset:nu.name[a][o]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?tM:nM)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?d:(e.settings.preferUnquoted&&(c=za(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:nu.unquoted[a][o]}))),c!==n&&(e.settings.quoteSmart&&a0(n,u)>a0(n,e.alternative)&&(u=e.alternative),c=u+za(n,Object.assign({},e.settings.characterReferences,{subset:(u==="'"?nu.single:nu.double)[a][o],attribute:!0}))+u),d+(c&&"="+c))}const jM=["<","&"];function Hw(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:za(e.value,Object.assign({},s.settings.characterReferences,{subset:jM}))}function TM(e,t,n,s){return s.settings.allowDangerousHtml?e.value:Hw(e,t,n,s)}function NM(e,t,n,s){return s.all(e)}const AM=R4("type",{invalid:LM,unknown:DM,handlers:{comment:Z4,doctype:eM,element:CM,raw:TM,root:NM,text:Hw}});function LM(e){throw new Error("Expected node, not `"+e+"`")}function DM(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const RM={},OM={},MM=[];function IM(e,t){const n=t||RM,s=n.quote||'"',a=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:PM,all:BM,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||w4,characterReferences:n.characterReferences||OM,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Mw:D4,quote:s,alternative:a}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function PM(e,t,n){return AM(e,t,n,this)}function BM(e){const t=[],n=e&&e.children||MM;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}const u0=/\s+/g;function $w(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(u0)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(u0);for(const a of n)a&&!e.properties.class.includes(a)&&e.properties.class.push(a);return e}const zM=/:?lang=["']([^"']+)["']/g,HM=/(?:```|~~~)([\w-]+)/g,$M=/\\begin\{([\w-]+)\}/g,UM=/<script\s+(?:type|lang)=["']([^"']+)["']/gi;function FM(e){const t=nd(e,!0).map(([a])=>a);function n(a){if(a===e.length)return{line:t.length-1,character:t.at(-1).length};let o=a,u=0;for(const c of t){if(o<c.length)break;o-=c.length,u++}return{line:u,character:o}}function s(a,o){let u=0;for(let c=0;c<a;c++)u+=t[c].length;return u+=o,u}return{lines:t,indexToPos:n,posToIndex:s}}function VM(e,t,n){const s=new Set;for(const o of e.matchAll(zM)){const u=o[1].toLowerCase().trim();u&&s.add(u)}for(const o of e.matchAll(HM)){const u=o[1].toLowerCase().trim();u&&s.add(u)}for(const o of e.matchAll($M)){const u=o[1].toLowerCase().trim();u&&s.add(u)}for(const o of e.matchAll(UM)){const u=o[1].toLowerCase().trim(),c=u.includes("/")?u.split("/").pop():u;c&&s.add(c)}if(!n)return[...s];const a=n.getBundledLanguages();return[...s].filter(o=>o&&a[o])}const GM=["color","background-color"];function WM(e,t){let n=0;const s=[];for(const a of t)a>n&&s.push({...e,content:e.content.slice(n,a),offset:e.offset+n}),n=a;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function qM(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((s,a)=>s-a);return n.length?e.map(s=>s.flatMap(a=>{const o=n.filter(u=>a.offset<u&&u<a.offset+a.content.length).map(u=>u-a.offset).sort((u,c)=>u-c);return o.length?WM(a,o):a})):e}function KM(e,t,n,s,a="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},u=t.map(p=>Tu(e.variants[p])),c=new Set(u.flatMap(p=>Object.keys(p))),d={},f=(p,m)=>{const x=m==="color"?"":m==="background-color"?"-bg":`-${m}`;return n+t[p]+(m==="color"?"":x)};return u.forEach((p,m)=>{for(const x of c){const _=p[x]||"inherit";if(m===0&&s&&GM.includes(x))if(s==="light-dark()"&&u.length>1){const w=t.findIndex(v=>v==="light"),k=t.findIndex(v=>v==="dark");if(w===-1||k===-1)throw new Nt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');d[x]=`light-dark(${u[w][x]||"inherit"}, ${u[k][x]||"inherit"})`,a==="css-vars"&&(d[f(m,x)]=_)}else d[x]=_;else a==="css-vars"&&(d[f(m,x)]=_)}}),o.htmlStyle=d,o}function Tu(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&yn.Italic&&(t["font-style"]="italic"),e.fontStyle&yn.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&yn.Underline&&n.push("underline"),e.fontStyle&yn.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Qm(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function YM(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let o=function(c){if(typeof c=="number"){if(c<0||c>n.source.length)throw new Nt(`Invalid decoration offset: ${c}. Code length: ${n.source.length}`);return{...a.indexToPos(c),offset:c}}else{const d=a.lines[c.line];if(d===void 0)throw new Nt(`Invalid decoration position ${JSON.stringify(c)}. Lines length: ${a.lines.length}`);let f=c.character;if(f<0&&(f=d.length+f),f<0||f>d.length)throw new Nt(`Invalid decoration position ${JSON.stringify(c)}. Line ${c.line} length: ${d.length}`);return{...c,character:f,offset:a.posToIndex(c.line,f)}}};var s=o;const a=FM(n.source),u=(n.options.decorations||[]).map(c=>({...c,start:o(c.start),end:o(c.end)}));XM(u),e.set(n.meta,{decorations:u,converter:a,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var s;if((s=this.options.decorations)!=null&&s.length)return qM(n,t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]))},code(n){var p;if(!((p=this.options.decorations)!=null&&p.length))return;const s=t(this),a=[...n.children].filter(m=>m.type==="element"&&m.tagName==="span");if(a.length!==s.converter.lines.length)throw new Nt(`Number of lines in code element (${a.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function o(m,x,_,w){const k=a[m];let v="",S=-1,y=-1;if(x===0&&(S=0),_===0&&(y=0),_===Number.POSITIVE_INFINITY&&(y=k.children.length),S===-1||y===-1)for(let E=0;E<k.children.length;E++)v+=Uw(k.children[E]),S===-1&&v.length===x&&(S=E+1),y===-1&&v.length===_&&(y=E+1);if(S===-1)throw new Nt(`Failed to find start index for decoration ${JSON.stringify(w.start)}`);if(y===-1)throw new Nt(`Failed to find end index for decoration ${JSON.stringify(w.end)}`);const b=k.children.slice(S,y);if(!w.alwaysWrap&&b.length===k.children.length)c(k,w,"line");else if(!w.alwaysWrap&&b.length===1&&b[0].type==="element")c(b[0],w,"token");else{const E={type:"element",tagName:"span",properties:{},children:b};c(E,w,"wrapper"),k.children.splice(S,b.length,E)}}function u(m,x){a[m]=c(a[m],x,"line")}function c(m,x,_){var v;const w=x.properties||{},k=x.transform||(S=>S);return m.tagName=x.tagName||"span",m.properties={...m.properties,...w,class:m.properties.class},(v=x.properties)!=null&&v.class&&$w(m,x.properties.class),m=k(m,_)||m,m}const d=[],f=s.decorations.sort((m,x)=>x.start.offset-m.start.offset||m.end.offset-x.end.offset);for(const m of f){const{start:x,end:_}=m;if(x.line===_.line)o(x.line,x.character,_.character,m);else if(x.line<_.line){o(x.line,x.character,Number.POSITIVE_INFINITY,m);for(let w=x.line+1;w<_.line;w++)d.unshift(()=>u(w,m));o(_.line,0,_.character,m)}}d.forEach(m=>m())}}}function XM(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Nt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const a=e[s],o=n.start.offset<=a.start.offset&&a.start.offset<n.end.offset,u=n.start.offset<a.end.offset&&a.end.offset<=n.end.offset,c=a.start.offset<=n.start.offset&&n.start.offset<a.end.offset,d=a.start.offset<n.end.offset&&n.end.offset<=a.end.offset;if(o||u||c||d){if(o&&u||c&&d||c&&n.start.offset===n.end.offset||u&&a.start.offset===a.end.offset)continue;throw new Nt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(a.start)} intersect.`)}}}}function Uw(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Uw).join(""):""}const QM=[YM()];function Nu(e){const t=JM(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...QM]}function JM(e){const t=[],n=[],s=[];for(const a of e)switch(a.enforce){case"pre":t.push(a);break;case"post":n.push(a);break;default:s.push(a)}return{pre:t,post:n,normal:s}}var Ci=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],lm={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ZM(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const s=e.indexOf("m",n);if(s!==-1)return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function d0(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function eI(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)lm[s]&&t.push({type:"setDecoration",value:lm[s]});else if(s<=29){const a=lm[s-20];a&&(t.push({type:"resetDecoration",value:a}),a==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Ci[s-30]}});else if(s===38){const a=d0(e);a&&t.push({type:"setForegroundColor",value:a})}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Ci[s-40]}});else if(s===48){const a=d0(e);a&&t.push({type:"setBackgroundColor",value:a})}else s===49?t.push({type:"resetBackgroundColor"}):s===53?t.push({type:"setDecoration",value:"overline"}):s===55?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Ci[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Ci[s-100+8]}})}return t}function tI(){let e=null,t=null,n=new Set;return{parse(s){const a=[];let o=0;do{const u=ZM(s,o),c=u.sequence?s.substring(o,u.startPosition):s.substring(o);if(c.length>0&&a.push({value:c,foreground:e,background:t,decorations:new Set(n)}),u.sequence){const d=eI(u.sequence);for(const f of d)f.type==="resetAll"?(e=null,t=null,n.clear()):f.type==="resetForegroundColor"?e=null:f.type==="resetBackgroundColor"?t=null:f.type==="resetDecoration"&&n.delete(f.value);for(const f of d)f.type==="setForegroundColor"?e=f.value:f.type==="setBackgroundColor"?t=f.value:f.type==="setDecoration"&&n.add(f.value)}o=u.position}while(o<s.length);return a}}}var nI={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function rI(e=nI){function t(c){return e[c]}function n(c){return`#${c.map(d=>Math.max(0,Math.min(d,255)).toString(16).padStart(2,"0")).join("")}`}let s;function a(){if(s)return s;s=[];for(let f=0;f<Ci.length;f++)s.push(t(Ci[f]));let c=[0,95,135,175,215,255];for(let f=0;f<6;f++)for(let p=0;p<6;p++)for(let m=0;m<6;m++)s.push(n([c[f],c[p],c[m]]));let d=8;for(let f=0;f<24;f++,d+=10)s.push(n([d,d,d]));return s}function o(c){return a()[c]}function u(c){switch(c.type){case"named":return t(c.name);case"rgb":return n(c.rgb);case"table":return o(c.index)}}return{value:u}}const sI=/#([0-9a-f]{3,8})/i,iI=/var\((--[\w-]+-ansi-[\w-]+)\)/,aI={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function oI(e,t,n){const s=ju(e,n),a=nd(t),o=rI(Object.fromEntries(Ci.map(c=>{var f;const d=`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`;return[c,((f=e.colors)==null?void 0:f[d])||aI[c]]}))),u=tI();return a.map(c=>u.parse(c[0]).map(d=>{let f,p;d.decorations.has("reverse")?(f=d.background?o.value(d.background):e.bg,p=d.foreground?o.value(d.foreground):e.fg):(f=d.foreground?o.value(d.foreground):e.fg,p=d.background?o.value(d.background):void 0),f=Vs(f,s),p=Vs(p,s),d.decorations.has("dim")&&(f=lI(f));let m=yn.None;return d.decorations.has("bold")&&(m|=yn.Bold),d.decorations.has("italic")&&(m|=yn.Italic),d.decorations.has("underline")&&(m|=yn.Underline),d.decorations.has("strikethrough")&&(m|=yn.Strikethrough),{content:d.value,offset:c[1],color:f,bgColor:p,fontStyle:m}}))}function lI(e){const t=e.match(sI);if(t){const s=t[1];if(s.length===8){const a=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${a}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const a=s[0],o=s[1],u=s[2],c=s[3];return`#${a}${a}${o}${o}${u}${u}${Math.round(Number.parseInt(`${c}${c}`,16)/2).toString(16).padStart(2,"0")}`}else if(s.length===3){const a=s[0],o=s[1],u=s[2];return`#${a}${a}${o}${o}${u}${u}80`}}}const n=e.match(iI);return n?`var(${n[1]}-dim)`:e}function Jm(e,t,n={}){const s=e.resolveLangAlias(n.lang||"text"),{theme:a=e.getLoadedThemes()[0]}=n;if(!ed(s)&&!td(a)&&s==="ansi"){const{theme:o}=e.setTheme(a);return oI(o,t,n)}return Ew(e,t,n)}function Au(e,t,n){let s,a,o,u,c,d;if("themes"in n){const{defaultColor:f="light",cssVariablePrefix:p="--shiki-",colorsRendering:m="css-vars"}=n,x=Object.entries(n.themes).filter(S=>S[1]).map(S=>({color:S[0],theme:S[1]})).sort((S,y)=>S.color===f?-1:y.color===f?1:0);if(x.length===0)throw new Nt("`themes` option must not be empty");const _=jw(e,t,n,Jm);if(d=ml(_),f&&f!=="light-dark()"&&!x.some(S=>S.color===f))throw new Nt(`\`themes\` option must contain the defaultColor key \`${f}\``);const w=x.map(S=>e.getTheme(S.theme)),k=x.map(S=>S.color);o=_.map(S=>S.map(y=>KM(y,k,p,f,m))),d&&rd(o,d);const v=x.map(S=>ju(S.theme,n));a=h0(x,w,v,p,f,"fg",m),s=h0(x,w,v,p,f,"bg",m),u=`shiki-themes ${w.map(S=>S.name).join(" ")}`,c=f?void 0:[a,s].join(";")}else if("theme"in n){const f=ju(n.theme,n);o=Jm(e,t,n);const p=e.getTheme(n.theme);s=Vs(p.bg,f),a=Vs(p.fg,f),u=p.name,d=ml(o)}else throw new Nt("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:a,bg:s,themeName:u,rootStyle:c,grammarState:d}}function h0(e,t,n,s,a,o,u){return e.map((c,d)=>{const f=Vs(t[d][o],n[d])||"inherit",p=`${s+c.color}${o==="bg"?"-bg":""}:${f}`;if(d===0&&a){if(a==="light-dark()"&&e.length>1){const m=e.findIndex(_=>_.color==="light"),x=e.findIndex(_=>_.color==="dark");if(m===-1||x===-1)throw new Nt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Vs(t[m][o],n[m])||"inherit"}, ${Vs(t[x][o],n[x])||"inherit"});${p}`}return f}return u==="css-vars"?p:null}).filter(c=>!!c).join(";")}const Fw=/^\s+$/,cI=/^(\s*)(.*?)(\s*)$/;function Lu(e,t,n,s={meta:{},options:n,codeToHast:(a,o)=>Lu(e,a,o),codeToTokens:(a,o)=>Au(e,a,o)}){var w,k;let a=t;for(const v of Nu(n))a=((w=v.preprocess)==null?void 0:w.call(s,a,n))||a;let{tokens:o,fg:u,bg:c,themeName:d,rootStyle:f,grammarState:p}=Au(e,a,n);const{mergeWhitespaces:m=!0,mergeSameStyleTokens:x=!1}=n;m===!0?o=dI(o):m==="never"&&(o=hI(o)),x&&(o=fI(o));const _={...s,get source(){return a}};for(const v of Nu(n))o=((k=v.tokens)==null?void 0:k.call(_,o))||o;return uI(o,{...n,fg:u,bg:c,themeName:d,rootStyle:n.rootStyle===!1?!1:n.rootStyle??f},_,p)}function uI(e,t,n,s=ml(e)){var k,v,S,y;const a=Nu(t),o=[],u={type:"root",children:[]},{structure:c="classic",tabindex:d="0"}=t,f={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?f.style=t.rootStyle:f.style=`background-color:${t.bg};color:${t.fg}`),d!==!1&&d!=null&&(f.tabindex=d.toString());for(const[b,E]of Object.entries(t.meta||{}))b.startsWith("_")||(f[b]=E);let p={type:"element",tagName:"pre",properties:f,children:[],data:t.data},m={type:"element",tagName:"code",properties:{},children:o};const x=[],_={...n,structure:c,addClassToHast:$w,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return u},get pre(){return p},get code(){return m},get lines(){return x}};if(e.forEach((b,E)=>{var L,A;E&&(c==="inline"?u.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&o.push({type:"text",value:`
|
|
133
|
-
`}));let N={type:"element",tagName:"span",properties:{class:"line"},children:[]},T=0;for(const M of b){let D={type:"element",tagName:"span",properties:{...M.htmlAttrs},children:[{type:"text",value:M.content}]};const U=Qm(M.htmlStyle||Tu(M));U&&(D.properties.style=U);for(const F of a)D=((L=F==null?void 0:F.span)==null?void 0:L.call(_,D,E+1,T,N,M))||D;c==="inline"?u.children.push(D):c==="classic"&&N.children.push(D),T+=M.content.length}if(c==="classic"){for(const M of a)N=((A=M==null?void 0:M.line)==null?void 0:A.call(_,N,E+1))||N;x.push(N),o.push(N)}else c==="inline"&&x.push(N)}),c==="classic"){for(const b of a)m=((k=b==null?void 0:b.code)==null?void 0:k.call(_,m))||m;p.children.push(m);for(const b of a)p=((v=b==null?void 0:b.pre)==null?void 0:v.call(_,p))||p;u.children.push(p)}else if(c==="inline"){const b=[];let E={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const T of u.children)T.type==="element"&&T.tagName==="br"?(b.push(E),E={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(T.type==="element"||T.type==="text")&&E.children.push(T);b.push(E);let N={type:"element",tagName:"code",properties:{},children:b};for(const T of a)N=((S=T==null?void 0:T.code)==null?void 0:S.call(_,N))||N;u.children=[];for(let T=0;T<N.children.length;T++){T>0&&u.children.push({type:"element",tagName:"br",properties:{},children:[]});const L=N.children[T];L.type==="element"&&u.children.push(...L.children)}}let w=u;for(const b of a)w=((y=b==null?void 0:b.root)==null?void 0:y.call(_,w))||w;return s&&rd(w,s),w}function dI(e){return e.map(t=>{const n=[];let s="",a;return t.forEach((o,u)=>{const c=!(o.fontStyle&&(o.fontStyle&yn.Underline||o.fontStyle&yn.Strikethrough));c&&Fw.test(o.content)&&t[u+1]?(a===void 0&&(a=o.offset),s+=o.content):s?(c?n.push({...o,offset:a,content:s+o.content}):n.push({content:s,offset:a},o),a=void 0,s=""):n.push(o)}),n})}function hI(e){return e.map(t=>t.flatMap(n=>{if(Fw.test(n.content))return n;const s=n.content.match(cI);if(!s)return n;const[,a,o,u]=s;if(!a&&!u)return n;const c=[{...n,offset:n.offset+a.length,content:o}];return a&&c.unshift({content:a,offset:n.offset}),u&&c.push({content:u,offset:n.offset+a.length+o.length}),c}))}function fI(e){return e.map(t=>{const n=[];for(const s of t){if(n.length===0){n.push({...s});continue}const a=n.at(-1),o=Qm(a.htmlStyle||Tu(a)),u=Qm(s.htmlStyle||Tu(s)),c=a.fontStyle&&(a.fontStyle&yn.Underline||a.fontStyle&yn.Strikethrough),d=s.fontStyle&&(s.fontStyle&yn.Underline||s.fontStyle&yn.Strikethrough);!c&&!d&&o===u?a.content+=s.content:n.push({...s})}return n})}const mI=IM;function pI(e,t,n){var o;const s={meta:{},options:n,codeToHast:(u,c)=>Lu(e,u,c),codeToTokens:(u,c)=>Au(e,u,c)};let a=mI(Lu(e,t,n,s));for(const u of Nu(n))a=((o=u.postprocess)==null?void 0:o.call(s,a,n))||a;return a}async function gI(e){const t=await d4(e);return{getLastGrammarState:(...n)=>g4(t,...n),codeToTokensBase:(n,s)=>Jm(t,n,s),codeToTokensWithThemes:(n,s)=>jw(t,n,s),codeToTokens:(n,s)=>Au(t,n,s),codeToHast:(n,s)=>Lu(t,n,s),codeToHtml:(n,s)=>pI(t,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function xI(e){const t=e.langs,n=e.themes,s=e.engine;async function a(o){function u(m){var x;if(typeof m=="string"){if(m=((x=o.langAlias)==null?void 0:x[m])||m,yw(m))return[];const _=t[m];if(!_)throw new Nt(`Language \`${m}\` is not included in this bundle. You may want to load it from external source.`);return _}return m}function c(m){if(vw(m))return"none";if(typeof m=="string"){const x=n[m];if(!x)throw new Nt(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return x}return m}const d=(o.themes??[]).map(m=>c(m)),f=(o.langs??[]).map(m=>u(m)),p=await gI({engine:o.engine??s(),...o,themes:d,langs:f});return{...p,loadLanguage(...m){return p.loadLanguage(...m.map(u))},loadTheme(...m){return p.loadTheme(...m.map(c))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return a}function _I(e){let t;async function n(s={}){if(t){const a=await t;return await Promise.all([a.loadTheme(...s.themes||[]),a.loadLanguage(...s.langs||[])]),a}else{t=e({...s,themes:[],langs:[]});const a=await t;return await Promise.all([a.loadTheme(...s.themes||[]),a.loadLanguage(...s.langs||[])]),a}}return n}function yI(e,t){const n=_I(e);async function s(a,o){var d;const u=await n({langs:[o.lang],themes:"theme"in o?[o.theme]:Object.values(o.themes)}),c=await((d=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:d.call(t,a,o.lang,u));return c&&await u.loadLanguage(...c),u}return{getSingletonHighlighter(a){return n(a)},async codeToHtml(a,o){return(await s(a,o)).codeToHtml(a,o)},async codeToHast(a,o){return(await s(a,o)).codeToHast(a,o)},async codeToTokens(a,o){return(await s(a,o)).codeToTokens(a,o)},async codeToTokensBase(a,o){return(await s(a,o)).codeToTokensBase(a,o)},async codeToTokensWithThemes(a,o){return(await s(a,o)).codeToTokensWithThemes(a,o)},async getLastGrammarState(a,o){return(await n({langs:[o.lang],themes:[o.theme]})).getLastGrammarState(a,o)}}}var vI=zp({bundledLanguages:()=>Up,bundledLanguagesAlias:()=>$p,bundledLanguagesBase:()=>Hp,bundledLanguagesInfo:()=>Qu,bundledThemes:()=>Vp,bundledThemesInfo:()=>Fp,codeToHast:()=>Gw,codeToHtml:()=>Vw,codeToTokens:()=>Ww,codeToTokensBase:()=>qw,codeToTokensWithThemes:()=>Kw,createHighlighter:()=>id,getLastGrammarState:()=>Xw,getSingletonHighlighter:()=>Yw});const id=xI({langs:Up,themes:Vp,engine:()=>(0,nw.createOnigurumaEngine)(J(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:Vw,codeToHast:Gw,codeToTokens:Ww,codeToTokensBase:qw,codeToTokensWithThemes:Kw,getSingletonHighlighter:Yw,getLastGrammarState:Xw}=yI(id,{guessEmbeddedLanguages:VM}),f0=4294967295;var bI=class{constructor(e,t={}){he(this,"patterns");he(this,"options");he(this,"regexps");this.patterns=e,this.options=t;const{forgiving:n=!1,cache:s,regexConstructor:a}=t;if(!a)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const u=s==null?void 0:s.get(o);if(u){if(u instanceof RegExp)return u;if(n)return null;throw u}try{const c=a(o);return s==null||s.set(o,c),c}catch(c){if(s==null||s.set(o,c),n)return null;throw c}})}findNextMatchSync(e,t,n){const s=typeof e=="string"?e:e.content,a=[];function o(u,c,d=0){return{index:u,captureIndices:c.indices.map(f=>f==null?{start:f0,end:f0,length:0}:{start:f[0]+d,end:f[1]+d,length:f[1]-f[0]})}}for(let u=0;u<this.regexps.length;u++){const c=this.regexps[u];if(c)try{c.lastIndex=t;const d=c.exec(s);if(!d)continue;if(d.index===t)return o(u,d,0);a.push([u,d,0])}catch(d){if(this.options.forgiving)continue;throw d}}if(a.length){const u=Math.min(...a.map(c=>c[1].index));for(const[c,d,f]of a)if(d.index===u)return o(c,d,f)}return null}};function qa(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function SI(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const Zp=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),cn=String.raw;function Ka(e,t){if(e==null)throw new Error(t??"Value expected");return e}const Qw=cn`\[\^?`,Jw=`c.? | C(?:-.?)?|${cn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${cn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${cn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${cn`o\{[^\}]*\}?`}|${cn`\d{1,3}`}`,eg=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ru=new RegExp(cn`
|
|
134
|
-
\\ (?:
|
|
135
|
-
${Jw}
|
|
136
|
-
| [gk]<[^>]*>?
|
|
137
|
-
| [gk]'[^']*'?
|
|
138
|
-
| .
|
|
139
|
-
)
|
|
140
|
-
| \( (?:
|
|
141
|
-
\? (?:
|
|
142
|
-
[:=!>({]
|
|
143
|
-
| <[=!]
|
|
144
|
-
| <[^>]*>
|
|
145
|
-
| '[^']*'
|
|
146
|
-
| ~\|?
|
|
147
|
-
| #(?:[^)\\]|\\.?)*
|
|
148
|
-
| [^:)]*[:)]
|
|
149
|
-
)?
|
|
150
|
-
| \*[^\)]*\)?
|
|
151
|
-
)?
|
|
152
|
-
| (?:${eg.source})+
|
|
153
|
-
| ${Qw}
|
|
154
|
-
| .
|
|
155
|
-
`.replace(/\s+/g,""),"gsu"),cm=new RegExp(cn`
|
|
156
|
-
\\ (?:
|
|
157
|
-
${Jw}
|
|
158
|
-
| .
|
|
159
|
-
)
|
|
160
|
-
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
161
|
-
| ${Qw}
|
|
162
|
-
| &&
|
|
163
|
-
| .
|
|
164
|
-
`.replace(/\s+/g,""),"gsu");function wI(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const s=UI(n.flags),a=[s.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return a.at(-1)},numOpenGroups:0,popModX(){a.pop()},pushModX(m){a.push(m)},replaceCurrentModX(m){a[a.length-1]=m},singleline:n.rules.singleline};let u=[],c;for(ru.lastIndex=0;c=ru.exec(e);){const m=CI(o,e,c[0],ru.lastIndex);m.tokens?u.push(...m.tokens):m.token&&u.push(m.token),m.lastIndex!==void 0&&(ru.lastIndex=m.lastIndex)}const d=[];let f=0;u.filter(m=>m.type==="GroupOpen").forEach(m=>{m.kind==="capturing"?m.number=++f:m.raw==="("&&d.push(m)}),f||d.forEach((m,x)=>{m.kind="capturing",m.number=x+1});const p=f||d.length;return{tokens:u.map(m=>m.type==="EscapedNumber"?VI(m,p):m).flat(),flags:s}}function CI(e,t,n,s){const[a,o]=n;if(n==="["||n==="[^"){const u=kI(t,n,s);return{tokens:u.tokens,lastIndex:u.lastIndex}}if(a==="\\"){if("AbBGyYzZ".includes(o))return{token:m0(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:MI(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:eC(n)}}if(o==="K")return{token:tC("keep",n)};if(o==="N"||o==="R")return{token:ki("newline",n,{negate:o==="N"})};if(o==="O")return{token:ki("any",n)};if(o==="X")return{token:ki("text_segment",n)};const u=Zw(n,{inCharClass:!1});return Array.isArray(u)?{tokens:u}:{token:u}}if(a==="("){if(o==="*")return{token:zI(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:BI(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:Oa("group",n)};if(n==="(?>")return{token:Oa("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:Oa(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:Oa("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:Oa("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:DI(n)}}if(e.getCurrentModX()){if(n==="#"){const u=t.indexOf(`
|
|
165
|
-
`,s);return{lastIndex:u===-1?t.length:u}}if(/^\s$/.test(n)){const u=/\s+/y;return u.lastIndex=s,{lastIndex:u.exec(t)?u.lastIndex:s}}}if(n===".")return{token:ki("dot",n)};if(n==="^"||n==="$"){const u=e.singleline?{"^":cn`\A`,$:cn`\Z`}[n]:n;return{token:m0(u,n)}}return n==="|"?{token:jI(n)}:eg.test(n)?{tokens:GI(n)}:{token:cs(qa(n),n)}}function kI(e,t,n){const s=[p0(t[1]==="^",t)];let a=1,o;for(cm.lastIndex=n;o=cm.exec(e);){const u=o[0];if(u[0]==="["&&u[1]!==":")a++,s.push(p0(u[1]==="^",u));else if(u==="]"){if(s.at(-1).type==="CharacterClassOpen")s.push(cs(93,u));else if(a--,s.push(TI(u)),!a)break}else{const c=EI(u);Array.isArray(c)?s.push(...c):s.push(c)}}return{tokens:s,lastIndex:cm.lastIndex||e.length}}function EI(e){if(e[0]==="\\")return Zw(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Zp.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return ki("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?NI(e):e==="&&"?AI(e):cs(qa(e),e)}function Zw(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return PI(e);if("dDhHsSwW".includes(n))return HI(e);if(e.startsWith(cn`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return $I(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const s=e.split(/\\x/).slice(1).map(u=>parseInt(u,16)),a=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(s)),o=new TextEncoder;return[...a].map(u=>{const c=[...o.encode(u)].map(d=>`\\x${d.toString(16)}`).join("");return cs(qa(u),c)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return cs(FI(e),e);if(g0.has(n))return cs(g0.get(n),e);if(/\d/.test(n))return LI(t,e);if(e==="\\")throw new Error(cn`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return cs(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function jI(e){return{type:"Alternator",raw:e}}function m0(e,t){return{type:"Assertion",kind:e,raw:t}}function eC(e){return{type:"Backreference",raw:e}}function cs(e,t){return{type:"Character",value:e,raw:t}}function TI(e){return{type:"CharacterClassClose",raw:e}}function NI(e){return{type:"CharacterClassHyphen",raw:e}}function AI(e){return{type:"CharacterClassIntersector",raw:e}}function p0(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function ki(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function tC(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Ka(n.flags),raw:t}}function LI(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function DI(e){return{type:"GroupClose",raw:e}}function Oa(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function RI(e,t,n,s){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:s}}function OI(e,t,n,s){return{type:"Quantifier",kind:e,min:t,max:n,raw:s}}function MI(e){return{type:"Subroutine",raw:e}}const II=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),g0=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function PI(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return cs(qa(t.toUpperCase())-64,e)}function BI(e,t){let{on:n,off:s}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;s??(s="");const a=(t.getCurrentModX()||n.includes("x"))&&!s.includes("x"),o=_0(n),u=_0(s),c={};if(o&&(c.enable=o),u&&(c.disable=u),e.endsWith(")"))return t.replaceCurrentModX(a),tC("flags",e,{flags:c});if(e.endsWith(":"))return t.pushModX(a),t.numOpenGroups++,Oa("group",e,{...(o||u)&&{flags:c}});throw new Error(`Unexpected flag modifier "${e}"`)}function zI(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:s,args:a}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(s==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=a?a.split(",").filter(p=>p!=="").map(p=>/^[+-]?\d+$/.test(p)?+p:p):[],[u,c,d]=o,f=II.has(n)?n.toLowerCase():"custom";switch(f){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof u=="string")throw new Error(`Named callout argument must be a number "${u}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof u=="string"&&!/^[A-Za-z_]\w*$/.test(u))throw new Error(`Named callout argument one must be a tag or number "${u}"`);if(o.length===2&&(typeof c=="number"||!/^[<>X]$/.test(c)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${c}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof u=="number"||!/^[<>X]$/.test(u)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${u}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof u=="string"&&!/^[A-Za-z_]\w*$/.test(u))throw new Error(`Named callout argument one must be a tag or number "${u}"`);if(typeof c=="number"||!/^(?:[<>!=]=|[<>])$/.test(c))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${c}"`);if(typeof d=="string"&&!/^[A-Za-z_]\w*$/.test(d))throw new Error(`Named callout argument three must be a tag or number "${d}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${f}"`)}return RI(f,s??null,(a==null?void 0:a.split(","))??null,e)}function x0(e){let t=null,n,s;if(e[0]==="{"){const{minStr:a,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,u=1e5;if(+a>u||o&&+o>u)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+a,s=o===void 0?+a:o===""?1/0:+o,n>s&&(t="possessive",[n,s]=[s,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,s=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return OI(t,n,s,e)}function HI(e){const t=e[1].toLowerCase();return ki({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function $I(e){const{p:t,neg:n,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return ki("property",e,{value:s,negate:t==="P"&&!n||t==="p"&&!!n})}function _0(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function UI(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const s=e[n];if(!"imxDPSWy".includes(s))throw new Error(`Invalid flag "${s}"`);if(s==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[s]]=!0}return t}function FI(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function VI(e,t){const{raw:n,inCharClass:s}=e,a=n.slice(1);if(!s&&(a!=="0"&&a.length===1||a[0]!=="0"&&+a<=t))return[eC(n)];const o=[],u=a.match(/^[0-7]+|\d/g);for(let c=0;c<u.length;c++){const d=u[c];let f;if(c===0&&d!=="8"&&d!=="9"){if(f=parseInt(d,8),f>127)throw new Error(cn`Octal encoded byte above 177 unsupported "${n}"`)}else f=qa(d);o.push(cs(f,(c===0?"\\":"")+d))}return o}function GI(e){const t=[],n=new RegExp(eg,"gy");let s;for(;s=n.exec(e);){const a=s[0];if(a[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(a);if(o){const{min:u,max:c}=o.groups;if(+u>+c&&a.endsWith("?")){n.lastIndex--,t.push(x0(a.slice(0,-1)));continue}}}t.push(x0(a))}return t}function nC(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(s=>t[s]===n[s])}function WI(e){return qI.has(e.type)}const qI=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function rC(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},s=wI(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),a=(x,_)=>{const w=s.tokens[o.nextIndex];switch(o.parent=x,o.nextIndex++,w.type){case"Alternator":return Li();case"Assertion":return KI(w);case"Backreference":return YI(w,o);case"Character":return ad(w.value,{useLastValid:!!_.isCheckingRangeEnd});case"CharacterClassHyphen":return XI(w,o,_);case"CharacterClassOpen":return QI(w,o,_);case"CharacterSet":return JI(w,o);case"Directive":return sP(w.kind,{flags:w.flags});case"GroupOpen":return ZI(w,o,_);case"NamedCallout":return aP(w.kind,w.tag,w.arguments);case"Quantifier":return eP(w,o);case"Subroutine":return tP(w,o);default:throw new Error(`Unexpected token type "${w.type}"`)}},o={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:s.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:a},u=lP(iP(s.flags));let c=u.body[0];for(;o.nextIndex<s.tokens.length;){const x=a(c,{});x.type==="Alternative"?(u.body.push(x),c=x):c.body.push(x)}const{capturingGroups:d,hasNumberedRef:f,namedGroupsByName:p,subroutines:m}=o;if(f&&p.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:x}of m)if(typeof x=="number"){if(x>d.length)throw new Error("Subroutine uses a group number that's not defined");x&&(d[x-1].isSubroutined=!0)}else if(p.has(x)){if(p.get(x).length>1)throw new Error(cn`Subroutine uses a duplicate group name "\g<${x}>"`);p.get(x)[0].isSubroutined=!0}else throw new Error(cn`Subroutine uses a group name that's not defined "\g<${x}>"`);return u}function KI({kind:e}){return Zm(Ka({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===cn`\B`||e===cn`\Y`})}function YI({raw:e},t){const n=/^\\k[<']/.test(e),s=n?e.slice(3,-1):e.slice(1),a=(o,u=!1)=>{const c=t.capturingGroups.length;let d=!1;if(o>c)if(t.skipBackrefValidation)d=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,ep(u?c+1-o:o,{orphan:d})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(o)return a(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(s))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(s))throw new Error(`Group name not defined to the left "${e}"`);return ep(s)}return a(+s)}function XI(e,t,n){const{tokens:s,walk:a}=t,o=t.parent,u=o.body.at(-1),c=s[t.nextIndex];if(!n.isCheckingRangeEnd&&u&&u.type!=="CharacterClass"&&u.type!=="CharacterClassRange"&&c&&c.type!=="CharacterClassOpen"&&c.type!=="CharacterClassClose"&&c.type!=="CharacterClassIntersector"){const d=a(o,{...n,isCheckingRangeEnd:!0});if(u.type==="Character"&&d.type==="Character")return o.body.pop(),rP(u,d);throw new Error("Invalid character class range")}return ad(qa("-"))}function QI({negate:e},t,n){const{tokens:s,walk:a}=t,o=[hu()],u=s[t.nextIndex];let c=b0(u);for(;c.type!=="CharacterClassClose";){if(c.type==="CharacterClassIntersector")o.push(hu()),t.nextIndex++;else{const f=o.at(-1);f.body.push(a(f,n))}c=b0(s[t.nextIndex],u)}const d=hu({negate:e});return o.length===1?d.body=o[0].body:(d.kind="intersection",d.body=o.map(f=>f.body.length===1?f.body[0]:f)),t.nextIndex++,d}function JI({kind:e,negate:t,value:n},s){const{normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:u}=s;if(e==="property"){const c=od(n);if(Zp.has(c)&&!(u!=null&&u.has(c)))e="posix",n=c;else return Ma(n,{negate:t,normalizeUnknownPropertyNames:a,skipPropertyNameValidation:o,unicodePropertyMap:u})}return e==="posix"?oP(n,{negate:t}):tp(e,{negate:t})}function ZI(e,t,n){const{tokens:s,capturingGroups:a,namedGroupsByName:o,skipLookbehindValidation:u,walk:c}=t,d=cP(e),f=d.type==="AbsenceFunction",p=v0(d),m=p&&d.negate;if(d.type==="CapturingGroup"&&(a.push(d),d.name&&SI(o,d.name,[]).push(d)),f&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let x=S0(s[t.nextIndex]);for(;x.type!=="GroupClose";){if(x.type==="Alternator")d.body.push(Li()),t.nextIndex++;else{const _=d.body.at(-1),w=c(_,{...n,isInAbsenceFunction:n.isInAbsenceFunction||f,isInLookbehind:n.isInLookbehind||p,isInNegLookbehind:n.isInNegLookbehind||m});if(_.body.push(w),(p||n.isInLookbehind)&&!u){const k="Lookbehind includes a pattern not allowed by Oniguruma";if(m||n.isInNegLookbehind){if(y0(w)||w.type==="CapturingGroup")throw new Error(k)}else if(y0(w)||v0(w)&&w.negate)throw new Error(k)}}x=S0(s[t.nextIndex])}return t.nextIndex++,d}function eP({kind:e,min:t,max:n},s){const a=s.parent,o=a.body.at(-1);if(!o||!WI(o))throw new Error("Quantifier requires a repeatable token");const u=iC(e,t,n,o);return a.body.pop(),u}function tP({raw:e},t){const{capturingGroups:n,subroutines:s}=t;let a=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(a);if(o){const c=+o.groups.num,d=n.length;if(t.hasNumberedRef=!0,a={"":c,"+":d+c,"-":d+1-c}[o.groups.sign],a<1)throw new Error("Invalid subroutine number")}else a==="0"&&(a=0);const u=aC(a);return s.push(u),u}function nP(e,t){return{type:"AbsenceFunction",kind:e,body:Tl(t==null?void 0:t.body)}}function Li(e){return{type:"Alternative",body:oC(e==null?void 0:e.body)}}function Zm(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!(t!=null&&t.negate)),n}function ep(e,t){const n=!!(t!=null&&t.orphan);return{type:"Backreference",ref:e,...n&&{orphan:n}}}function sC(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!uP(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Tl(t==null?void 0:t.body)}}function ad(e,t){const n={useLastValid:!1,...t};if(e>1114111){const s=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${s}}"`):new Error(`Invalid code point out of range in JS "\\x{${s}}"`)}return{type:"Character",value:e}}function hu(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:oC(e==null?void 0:e.body)}}function rP(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function tp(e,t){const n=!!(t!=null&&t.negate),s={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(s.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(s.variableLength=!0),s}function sP(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:Ka(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function iP(e){return{type:"Flags",...e}}function _r(e){const t=e==null?void 0:e.atomic,n=e==null?void 0:e.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:Tl(e==null?void 0:e.body)}}function Si(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Tl(e==null?void 0:e.body)}}function aP(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function oP(e,t){const n=!!(t!=null&&t.negate);if(!Zp.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function iC(e,t,n,s){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:s}}function lP(e,t){return{type:"Regex",body:Tl(t==null?void 0:t.body),flags:e}}function aC(e){return{type:"Subroutine",ref:e}}function Ma(e,t){var a;const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let s=(a=n.unicodePropertyMap)==null?void 0:a.get(od(e));if(!s){if(n.normalizeUnknownPropertyNames)s=dP(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(cn`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:s??e,negate:n.negate}}function cP({flags:e,kind:t,name:n,negate:s,number:a}){switch(t){case"absence_repeater":return nP("repeater");case"atomic":return _r({atomic:!0});case"capturing":return sC(a,{name:n});case"group":return _r({flags:e});case"lookahead":case"lookbehind":return Si({behind:t==="lookbehind",negate:s});default:throw new Error(`Unexpected group kind "${t}"`)}}function Tl(e){if(e===void 0)e=[Li()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function oC(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function y0(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function v0(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function uP(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function dP(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function od(e){return e.replace(/[- _]+/g,"").toLowerCase()}function b0(e,t){const n=t;return Ka(e,`Unclosed character class${(n==null?void 0:n.type)==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function S0(e){return Ka(e,"Unclosed group")}function ol(e,t,n=null){function s(o,u){for(let c=0;c<o.length;c++){const d=a(o[c],u,c,o);c=Math.max(-1,c+d)}}function a(o,u=null,c=null,d=null){var S,y;let f=0,p=!1;const m={node:o,parent:u,key:c,container:d,root:e,remove(){su(d).splice(Math.max(0,ja(c)+f),1),f--,p=!0},removeAllNextSiblings(){return su(d).splice(ja(c)+1)},removeAllPrevSiblings(){const b=ja(c)+f;return f-=b,su(d).splice(0,Math.max(0,b))},replaceWith(b,E={}){const N=!!E.traverse;d?d[Math.max(0,ja(c)+f)]=b:Ka(u,"Can't replace root node")[c]=b,N&&a(b,u,c,d),p=!0},replaceWithMultiple(b,E={}){const N=!!E.traverse;if(su(d).splice(Math.max(0,ja(c)+f),1,...b),f+=b.length-1,N){let T=0;for(let L=0;L<b.length;L++)T+=a(b[L],u,ja(c)+L+T,d)}p=!0},skip(){p=!0}},{type:x}=o,_=t["*"],w=t[x],k=typeof _=="function"?_:_==null?void 0:_.enter,v=typeof w=="function"?w:w==null?void 0:w.enter;if(k==null||k(m,n),v==null||v(m,n),!p)switch(x){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":s(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":a(o.min,o,"min"),a(o.max,o,"max");break;case"Quantifier":a(o.body,o,"body");break;case"Regex":s(o.body,o),a(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${x}"`)}return(S=w==null?void 0:w.exit)==null||S.call(w,m,n),(y=_==null?void 0:_.exit)==null||y.call(_,m,n),f}return a(e),e}function su(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function ja(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const hP=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function fP(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function mP(e,t,n,s){return e.slice(0,t)+s+e.slice(t+n.length)}const lr=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function tg(e,t,n,s){const a=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let u=0,c="";for(const d of e.matchAll(a)){const{0:f,groups:{$skip:p}}=d;if(!p&&(!s||s===lr.DEFAULT==!u)){n instanceof Function?c+=n(d,{context:u?lr.CHAR_CLASS:lr.DEFAULT,negated:o[o.length-1]}):c+=n;continue}f[0]==="["?(u++,o.push(f[1]==="^")):f==="]"&&u&&(u--,o.pop()),c+=f}return c}function lC(e,t,n,s){tg(e,t,n,s)}function pP(e,t,n=0,s){if(!new RegExp(t,"su").test(e))return null;const a=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");a.lastIndex=n;let o=0,u;for(;u=a.exec(e);){const{0:c,groups:{$skip:d}}=u;if(!d&&(!s||s===lr.DEFAULT==!o))return u;c==="["?o++:c==="]"&&o&&o--,a.lastIndex==u.index&&a.lastIndex++}return null}function iu(e,t,n){return!!pP(e,t,0,n)}function gP(e,t){const n=/\\?./gsu;n.lastIndex=t;let s=e.length,a=0,o=1,u;for(;u=n.exec(e);){const[c]=u;if(c==="[")a++;else if(a)c==="]"&&a--;else if(c==="(")o++;else if(c===")"&&(o--,!o)){s=u.index;break}}return e.slice(t,s)}const w0=new RegExp(String.raw`(?<noncapturingStart>${hP})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function xP(e,t){const n=(t==null?void 0:t.hiddenCaptures)??[];let s=(t==null?void 0:t.captureTransfers)??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};const a="(?>",o="(?:(?=(",u=[0],c=[];let d=0,f=0,p=NaN,m;do{m=!1;let x=0,_=0,w=!1,k;for(w0.lastIndex=Number.isNaN(p)?0:p+o.length;k=w0.exec(e);){const{0:v,index:S,groups:{capturingStart:y,noncapturingStart:b}}=k;if(v==="[")x++;else if(x)v==="]"&&x--;else if(v===a&&!w)p=S,w=!0;else if(w&&b)_++;else if(y)w?_++:(d++,u.push(d+f));else if(v===")"&&w){if(!_){f++;const E=d+f;if(e=`${e.slice(0,p)}${o}${e.slice(p+a.length,S)}))<$$${E}>)${e.slice(S+1)}`,m=!0,c.push(E),fP(n,E),s.size){const N=new Map;s.forEach((T,L)=>{N.set(L>=E?L+1:L,T.map(A=>A>=E?A+1:A))}),s=N}break}_--}}}while(m);return n.push(...c),e=tg(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:x,groups:{backrefNum:_,wrappedBackrefNum:w}})=>{if(_){const k=+_;if(k>u.length-1)throw new Error(`Backref "${x}" greater than number of captures`);return`\\${u[k]}`}return`\\${w}`},lr.DEFAULT),{pattern:e,captureTransfers:s,hiddenCaptures:n}}const cC=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,um=new RegExp(String.raw`
|
|
166
|
-
\\(?: \d+
|
|
167
|
-
| c[A-Za-z]
|
|
168
|
-
| [gk]<[^>]+>
|
|
169
|
-
| [pPu]\{[^\}]+\}
|
|
170
|
-
| u[A-Fa-f\d]{4}
|
|
171
|
-
| x[A-Fa-f\d]{2}
|
|
172
|
-
)
|
|
173
|
-
| \((?: \? (?: [:=!>]
|
|
174
|
-
| <(?:[=!]|[^>]+>)
|
|
175
|
-
| [A-Za-z\-]+:
|
|
176
|
-
| \(DEFINE\)
|
|
177
|
-
))?
|
|
178
|
-
| (?<qBase>${cC})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
179
|
-
| \\?.
|
|
180
|
-
`.replace(/\s+/g,""),"gsu");function _P(e){if(!new RegExp(`${cC}\\+`).test(e))return{pattern:e};const t=[];let n=null,s=null,a="",o=0,u;for(um.lastIndex=0;u=um.exec(e);){const{0:c,index:d,groups:{qBase:f,qMod:p,invalidQ:m}}=u;if(c==="[")o||(s=d),o++;else if(c==="]")o?o--:s=null;else if(!o)if(p==="+"&&a&&!a.startsWith("(")){if(m)throw new Error(`Invalid quantifier "${c}"`);let x=-1;if(/^\{\d+\}$/.test(f))e=mP(e,d+f.length,p,"");else{if(a===")"||a==="]"){const _=a===")"?n:s;if(_===null)throw new Error(`Invalid unmatched "${a}"`);e=`${e.slice(0,_)}(?>${e.slice(_,d)}${f})${e.slice(d+c.length)}`}else e=`${e.slice(0,d-a.length)}(?>${a}${f})${e.slice(d+c.length)}`;x+=4}um.lastIndex+=x}else c[0]==="("?t.push(d):c===")"&&(n=t.length?t.pop():null);a=c}return{pattern:e}}const or=String.raw,yP=or`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,np=or`\(\?R=(?<rDepth>[^\)]+)\)|${yP}`,ld=or`\(\?<(?![=!])(?<captureName>[^>]+)>`,uC=or`${ld}|(?<unnamed>\()(?!\?)`,pi=new RegExp(or`${ld}|${np}|\(\?|\\?.`,"gsu"),dm="Cannot use multiple overlapping recursions";function vP(e,t){const{hiddenCaptures:n,mode:s}={hiddenCaptures:[],mode:"plugin",...t};let a=(t==null?void 0:t.captureTransfers)??new Map;if(!new RegExp(np,"su").test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};if(s==="plugin"&&iu(e,or`\(\?\(DEFINE\)`,lr.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],u=iu(e,or`\\[1-9]`,lr.DEFAULT),c=new Map,d=[];let f=!1,p=0,m=0,x;for(pi.lastIndex=0;x=pi.exec(e);){const{0:_,groups:{captureName:w,rDepth:k,gRNameOrNum:v,gRDepth:S}}=x;if(_==="[")p++;else if(p)_==="]"&&p--;else if(k){if(C0(k),f)throw new Error(dm);if(u)throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=e.slice(0,x.index),b=e.slice(pi.lastIndex);if(iu(b,np,lr.DEFAULT))throw new Error(dm);const E=+k-1;e=k0(y,b,E,!1,n,o,m),a=j0(a,y,E,o.length,0,m);break}else if(v){C0(S);let y=!1;for(const F of d)if(F.name===v||F.num===+v){if(y=!0,F.hasRecursedWithin)throw new Error(dm);break}if(!y)throw new Error(or`Recursive \g cannot be used outside the referenced group "${s==="external"?v:or`\g<${v}&R=${S}>`}"`);const b=c.get(v),E=gP(e,b);if(u&&iu(E,or`${ld}|\((?!\?)`,lr.DEFAULT))throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const N=e.slice(b,x.index),T=E.slice(N.length+_.length),L=o.length,A=+S-1,M=k0(N,T,A,!0,n,o,m);a=j0(a,N,A,o.length-L,L,m);const D=e.slice(0,b),U=e.slice(b+E.length);e=`${D}${M}${U}`,pi.lastIndex+=M.length-_.length-N.length-T.length,d.forEach(F=>F.hasRecursedWithin=!0),f=!0}else if(w)m++,c.set(String(m),pi.lastIndex),c.set(w,pi.lastIndex),d.push({num:m,name:w});else if(_[0]==="("){const y=_==="(";y&&(m++,c.set(String(m),pi.lastIndex)),d.push(y?{num:m}:{})}else _===")"&&d.pop()}return n.push(...o),{pattern:e,captureTransfers:a,hiddenCaptures:n}}function C0(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function k0(e,t,n,s,a,o,u){const c=new Set;s&&lC(e+t,ld,({groups:{captureName:f}})=>{c.add(f)},lr.DEFAULT);const d=[n,s?c:null,a,o,u];return`${e}${E0(`(?:${e}`,"forward",...d)}(?:)${E0(`${t})`,"backward",...d)}${t}`}function E0(e,t,n,s,a,o,u){const d=p=>t==="forward"?p+2:n-p+2-1;let f="";for(let p=0;p<n;p++){const m=d(p);f+=tg(e,or`${uC}|\\k<(?<backref>[^>]+)>`,({0:x,groups:{captureName:_,unnamed:w,backref:k}})=>{if(k&&s&&!s.has(k))return x;const v=`_$${m}`;if(w||_){const S=u+o.length+1;return o.push(S),bP(a,S),w?x:`(?<${_}${v}>`}return or`\k<${k}${v}>`},lr.DEFAULT)}return f}function bP(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function j0(e,t,n,s,a,o){if(e.size&&s){let u=0;lC(t,uC,()=>u++,lr.DEFAULT);const c=o-u+a,d=new Map;return e.forEach((f,p)=>{const m=(s-u*n)/n,x=u*n,_=p>c+u?p+s:p,w=[];for(const k of f)if(k<=c)w.push(k);else if(k>c+u+m)w.push(k+s);else if(k<=c+u)for(let v=0;v<=n;v++)w.push(k+u*v);else for(let v=0;v<=n;v++)w.push(k+x+m*v);d.set(_,w)}),d}return e}var nn=String.fromCodePoint,We=String.raw,vr={},cd=globalThis.RegExp;vr.flagGroups=(()=>{try{new cd("(?i:)")}catch{return!1}return!0})();vr.unicodeSets=(()=>{try{new cd("[[]]","v")}catch{return!1}return!0})();vr.bugFlagVLiteralHyphenIsRange=vr.unicodeSets?(()=>{try{new cd(We`[\d\-a]`,"v")}catch{return!0}return!1})():!1;vr.bugNestedClassIgnoresNegation=vr.unicodeSets&&new cd("[[^a]]","v").test("a");function Du(e,{enable:t,disable:n}){return{dotAll:!(n!=null&&n.dotAll)&&!!(t!=null&&t.dotAll||e.dotAll),ignoreCase:!(n!=null&&n.ignoreCase)&&!!(t!=null&&t.ignoreCase||e.ignoreCase)}}function pl(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function rp(e,t){return T0[e]>=T0[t]}function SP(e,t){if(e==null)throw new Error(t??"Value expected");return e}var T0={ES2025:2025,ES2024:2024,ES2018:2018},wP={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function dC(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!wP[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=vr.flagGroups?"ES2025":vr.unicodeSets?"ES2024":"ES2018"),t}var CP="[ -\r ]",kP=new Set([nn(304),nn(305)]),ns=We`[\p{L}\p{M}\p{N}\p{Pc}]`;function hC(e){if(kP.has(e))return[e];const t=new Set,n=e.toLowerCase(),s=n.toUpperCase(),a=TP.get(n),o=EP.get(n),u=jP.get(n);return[...s].length===1&&t.add(s),u&&t.add(u),a&&t.add(a),t.add(n),o&&t.add(o),[...t]}var ng=new Map(`C Other
|
|
181
|
-
Cc Control cntrl
|
|
182
|
-
Cf Format
|
|
183
|
-
Cn Unassigned
|
|
184
|
-
Co Private_Use
|
|
185
|
-
Cs Surrogate
|
|
186
|
-
L Letter
|
|
187
|
-
LC Cased_Letter
|
|
188
|
-
Ll Lowercase_Letter
|
|
189
|
-
Lm Modifier_Letter
|
|
190
|
-
Lo Other_Letter
|
|
191
|
-
Lt Titlecase_Letter
|
|
192
|
-
Lu Uppercase_Letter
|
|
193
|
-
M Mark Combining_Mark
|
|
194
|
-
Mc Spacing_Mark
|
|
195
|
-
Me Enclosing_Mark
|
|
196
|
-
Mn Nonspacing_Mark
|
|
197
|
-
N Number
|
|
198
|
-
Nd Decimal_Number digit
|
|
199
|
-
Nl Letter_Number
|
|
200
|
-
No Other_Number
|
|
201
|
-
P Punctuation punct
|
|
202
|
-
Pc Connector_Punctuation
|
|
203
|
-
Pd Dash_Punctuation
|
|
204
|
-
Pe Close_Punctuation
|
|
205
|
-
Pf Final_Punctuation
|
|
206
|
-
Pi Initial_Punctuation
|
|
207
|
-
Po Other_Punctuation
|
|
208
|
-
Ps Open_Punctuation
|
|
209
|
-
S Symbol
|
|
210
|
-
Sc Currency_Symbol
|
|
211
|
-
Sk Modifier_Symbol
|
|
212
|
-
Sm Math_Symbol
|
|
213
|
-
So Other_Symbol
|
|
214
|
-
Z Separator
|
|
215
|
-
Zl Line_Separator
|
|
216
|
-
Zp Paragraph_Separator
|
|
217
|
-
Zs Space_Separator
|
|
218
|
-
ASCII
|
|
219
|
-
ASCII_Hex_Digit AHex
|
|
220
|
-
Alphabetic Alpha
|
|
221
|
-
Any
|
|
222
|
-
Assigned
|
|
223
|
-
Bidi_Control Bidi_C
|
|
224
|
-
Bidi_Mirrored Bidi_M
|
|
225
|
-
Case_Ignorable CI
|
|
226
|
-
Cased
|
|
227
|
-
Changes_When_Casefolded CWCF
|
|
228
|
-
Changes_When_Casemapped CWCM
|
|
229
|
-
Changes_When_Lowercased CWL
|
|
230
|
-
Changes_When_NFKC_Casefolded CWKCF
|
|
231
|
-
Changes_When_Titlecased CWT
|
|
232
|
-
Changes_When_Uppercased CWU
|
|
233
|
-
Dash
|
|
234
|
-
Default_Ignorable_Code_Point DI
|
|
235
|
-
Deprecated Dep
|
|
236
|
-
Diacritic Dia
|
|
237
|
-
Emoji
|
|
238
|
-
Emoji_Component EComp
|
|
239
|
-
Emoji_Modifier EMod
|
|
240
|
-
Emoji_Modifier_Base EBase
|
|
241
|
-
Emoji_Presentation EPres
|
|
242
|
-
Extended_Pictographic ExtPict
|
|
243
|
-
Extender Ext
|
|
244
|
-
Grapheme_Base Gr_Base
|
|
245
|
-
Grapheme_Extend Gr_Ext
|
|
246
|
-
Hex_Digit Hex
|
|
247
|
-
IDS_Binary_Operator IDSB
|
|
248
|
-
IDS_Trinary_Operator IDST
|
|
249
|
-
ID_Continue IDC
|
|
250
|
-
ID_Start IDS
|
|
251
|
-
Ideographic Ideo
|
|
252
|
-
Join_Control Join_C
|
|
253
|
-
Logical_Order_Exception LOE
|
|
254
|
-
Lowercase Lower
|
|
255
|
-
Math
|
|
256
|
-
Noncharacter_Code_Point NChar
|
|
257
|
-
Pattern_Syntax Pat_Syn
|
|
258
|
-
Pattern_White_Space Pat_WS
|
|
259
|
-
Quotation_Mark QMark
|
|
260
|
-
Radical
|
|
261
|
-
Regional_Indicator RI
|
|
262
|
-
Sentence_Terminal STerm
|
|
263
|
-
Soft_Dotted SD
|
|
264
|
-
Terminal_Punctuation Term
|
|
265
|
-
Unified_Ideograph UIdeo
|
|
266
|
-
Uppercase Upper
|
|
267
|
-
Variation_Selector VS
|
|
268
|
-
White_Space space
|
|
269
|
-
XID_Continue XIDC
|
|
270
|
-
XID_Start XIDS`.split(/\s/).map(e=>[od(e),e])),EP=new Map([["s",nn(383)],[nn(383),"s"]]),jP=new Map([[nn(223),nn(7838)],[nn(107),nn(8490)],[nn(229),nn(8491)],[nn(969),nn(8486)]]),TP=new Map([Ps(453),Ps(456),Ps(459),Ps(498),...hm(8072,8079),...hm(8088,8095),...hm(8104,8111),Ps(8124),Ps(8140),Ps(8188)]),NP=new Map([["alnum",We`[\p{Alpha}\p{Nd}]`],["alpha",We`\p{Alpha}`],["ascii",We`\p{ASCII}`],["blank",We`[\p{Zs}\t]`],["cntrl",We`\p{Cc}`],["digit",We`\p{Nd}`],["graph",We`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",We`\p{Lower}`],["print",We`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",We`[\p{P}\p{S}]`],["space",We`\p{space}`],["upper",We`\p{Upper}`],["word",We`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",We`\p{AHex}`]]);function AP(e,t){const n=[];for(let s=e;s<=t;s++)n.push(s);return n}function Ps(e){const t=nn(e);return[t.toLowerCase(),t]}function hm(e,t){return AP(e,t).map(n=>Ps(n))}var fC=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function LP(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};mC(e);const s={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:rp(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};ol(e,DP,s);const a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:s.subroutineRefMap};ol(e,RP,o);const u={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return ol(e,OP,u),e._originMap=o.groupOriginByCopy,e._strategy=s.strategy,e}var DP={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:s,kind:a}=e;if(a==="repeater"){const o=_r();o.body[0].body.push(Si({negate:!0,body:s}),Ma("Any"));const u=_r();u.body[0].body.push(iC("greedy",0,1/0,o)),n(Wt(u,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:s}){const a=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const u=t.body[o];pl(s,u,[]).push(...a)}},exit({node:e},{flagDirectivesByAlt:t}){var n;if((n=t.get(e))!=null&&n.length){const s=gC(t.get(e));if(s){const a=_r({flags:s});a.body[0].body=e.body,e.body=[Wt(a,e)]}}}},Assertion({node:e,parent:t,key:n,container:s,root:a,remove:o,replaceWith:u},c){const{kind:d,negate:f}=e,{asciiWordBoundaries:p,avoidSubclass:m,supportedGNodes:x,wordIsAscii:_}=c;if(d==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${f?"Y":"y"}"`);if(d==="line_end")u(Wt(Si({body:[Li({body:[Zm("string_end")]}),Li({body:[ad(10)]})]}),t));else if(d==="line_start")u(Wt(rs(We`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(d==="search_start")if(x.has(e))a.flags.sticky=!0,o();else{const w=s[n-1];if(w&&HP(w))u(Wt(Si({negate:!0}),t));else{if(m)throw new Error(We`Uses "\G" in a way that requires a subclass`);u(Bs(Zm("string_start"),t)),c.strategy="clip_search"}}else if(!(d==="string_end"||d==="string_start"))if(d==="string_end_newline")u(Wt(rs(We`(?=\n?\z)`),t));else if(d==="word_boundary"){if(!_&&!p){const w=`(?:(?<=${ns})(?!${ns})|(?<!${ns})(?=${ns}))`,k=`(?:(?<=${ns})(?=${ns})|(?<!${ns})(?!${ns}))`;u(Wt(rs(f?k:w),t))}}else throw new Error(`Unexpected assertion kind "${d}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!mm(n)&&(n=fm(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:s}=e;s&&!mm(s)&&(s=fm(s,t),e.name=s),n.set(e.number,e),s&&n.set(s,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const s=hu({body:[e]});n(Wt(s,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:s,minTargetEs2024:a,digitIsAscii:o,spaceIsAscii:u,wordIsAscii:c}){const{kind:d,negate:f,value:p}=e;if(o&&(d==="digit"||p==="digit")){n(Bs(tp("digit",{negate:f}),t));return}if(u&&(d==="space"||p==="space")){n(Wt(pm(rs(CP),f),t));return}if(c&&(d==="word"||p==="word")){n(Bs(tp("word",{negate:f}),t));return}if(d==="any")n(Bs(Ma("Any"),t));else if(d==="digit")n(Bs(Ma("Nd",{negate:f}),t));else if(d!=="dot")if(d==="text_segment"){if(s==="strict")throw new Error(We`Use of "\X" requires non-strict accuracy`);const m="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",x=We`\p{RI}{2}|${m}(?:\u200D${m})*`;n(Wt(rs(We`(?>\r\n|${a?We`\p{RGI_Emoji}`:x}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(d==="hex")n(Bs(Ma("AHex",{negate:f}),t));else if(d==="newline")n(Wt(rs(f?`[^
|
|
271
|
-
]`:`(?>\r
|
|
272
|
-
?|[
|
|
273
|
-
\v\f
\u2028\u2029])`),t));else if(d==="posix")if(!a&&(p==="graph"||p==="print")){if(s==="strict")throw new Error(`POSIX class "${p}" requires min target ES2024 or non-strict accuracy`);let m={graph:"!-~",print:" -~"}[p];f&&(m=`\0-${nn(m.codePointAt(0)-1)}${nn(m.codePointAt(2)+1)}-`),n(Wt(rs(`[${m}]`),t))}else n(Wt(pm(rs(NP.get(p)),f),t));else if(d==="property")ng.has(od(p))||(e.key="sc");else if(d==="space")n(Bs(Ma("space",{negate:f}),t));else if(d==="word")n(Wt(pm(rs(ns),f),t));else throw new Error(`Unexpected character set kind "${d}"`)},Directive({node:e,parent:t,root:n,remove:s,replaceWith:a,removeAllPrevSiblings:o,removeAllNextSiblings:u}){const{kind:c,flags:d}=e;if(c==="flags")if(!d.enable&&!d.disable)s();else{const f=_r({flags:d});f.body[0].body=u(),a(Wt(f,t),{traverse:!0})}else if(c==="keep"){const f=n.body[0],m=n.body.length===1&&nC(f,{type:"Group"})&&f.body[0].body.length===1?f.body[0]:n;if(t.parent!==m||m.body.length>1)throw new Error(We`Uses "\K" in a way that's unsupported`);const x=Si({behind:!0});x.body[0].body=o(),a(Wt(x,t))}else throw new Error(`Unexpected directive kind "${c}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t!=null&&t.extended&&delete t.extended,n!=null&&n.extended&&delete n.extended,t!=null&&t.dotAll&&(n!=null&&n.dotAll)&&delete t.dotAll,t!=null&&t.ignoreCase&&(n!=null&&n.ignoreCase)&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:s}=e;if(s==="fail")n(Wt(Si({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${s.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=_r();t.body[0].body.push(e.body),e.body=Wt(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let s=!1,a=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const u=_C(o.body);u?(s=!0,Array.isArray(u)?n.push(...u):n.push(u)):a=!0}s&&!a&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:s}){if(t==="strict"&&n&&s)throw new Error(We`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!mm(n)&&(n=fm(n,t),e.ref=n)}},RP={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:s,ref:a}=e;s||n.set(e,[...t.get(a).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:s},{groupOriginByCopy:a,groupsByName:o,multiplexCapturesToLeftByRef:u,openRefs:c,reffedNodesByReferencer:d}){const f=a.get(e);if(f&&c.has(e.number)){const m=Bs(N0(e.number),t);d.set(m,c.get(e.number)),n(m);return}c.set(e.number,e),u.set(e.number,[]),e.name&&pl(u,e.name,[]);const p=u.get(e.name??e.number);for(let m=0;m<p.length;m++){const x=p[m];if(f===x.node||f&&f===x.origin||e===x.origin){p.splice(m,1);break}}if(u.get(e.number).push({node:e,origin:f}),e.name&&u.get(e.name).push({node:e,origin:f}),e.name){const m=pl(o,e.name,new Map);let x=!1;if(f)x=!0;else for(const _ of m.values())if(!_.hasDuplicateNameToRemove){x=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:x})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=Du(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},s){const{isRecursive:a,ref:o}=e;if(a){let p=t;for(;(p=p.parent)&&!(p.type==="CapturingGroup"&&(p.name===o||p.number===o)););s.reffedNodesByReferencer.set(e,p);return}const u=s.subroutineRefMap.get(o),c=o===0,d=c?N0(0):pC(u,s.groupOriginByCopy,null);let f=d;if(!c){const p=gC(PP(u,x=>x.type==="Group"&&!!x.flags)),m=p?Du(s.globalFlags,p):s.globalFlags;MP(m,s.currentFlags)||(f=_r({flags:BP(m)}),f.body[0].body.push(d))}n(Wt(f,t),{traverse:!c})}},OP={Backreference({node:e,parent:t,replaceWith:n},s){if(e.orphan){s.highestOrphanBackref=Math.max(s.highestOrphanBackref,e.ref);return}const o=s.reffedNodesByReferencer.get(e).filter(u=>IP(u,e));if(!o.length)n(Wt(Si({negate:!0}),t));else if(o.length>1){const u=_r({atomic:!0,body:o.reverse().map(c=>Li({body:[ep(c.number)]}))});n(Wt(u,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let s=0;s<n;s++){const a=sC();e.body.at(-1).body.push(a)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function mC(e){ol(e,{"*"({node:t,parent:n}){t.parent=n}})}function MP(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function IP(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const s=xC(n.parent);for(const a of s){if(a===n)break;if(a===e||yC(a,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function pC(e,t,n,s){const a=Array.isArray(e)?[]:{};for(const[o,u]of Object.entries(e))o==="parent"?a.parent=Array.isArray(n)?s:n:u&&typeof u=="object"?a[o]=pC(u,t,a,n):(o==="type"&&u==="CapturingGroup"&&t.set(a,t.get(e)??e),a[o]=u);return a}function N0(e){const t=aC(e);return t.isRecursive=!0,t}function PP(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function fm(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function gC(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:s})=>{t.forEach(a=>{var o,u;(o=s.enable)!=null&&o[a]&&(delete n.disable[a],n.enable[a]=!0),(u=s.disable)!=null&&u[a]&&(n.disable[a]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function BP({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function xC(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function _C(e){const t=e.find(n=>n.kind==="search_start"||$P(n,{negate:!1})||!zP(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const s of t.body){const a=_C(s.body);if(!a)return null;Array.isArray(a)?n.push(...a):n.push(a)}return n}return null}function yC(e,t){const n=xC(e)??[];for(const s of n)if(s===t||yC(s,t))return!0;return!1}function zP({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function HP(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function $P(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&nC(e.body[0],{type:"Assertion",kind:"search_start"})}function mm(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function rs(e,t){const s=rC(e,{...t,unicodePropertyMap:ng}).body;return s.length>1||s[0].body.length>1?_r({body:s}):s[0].body[0]}function pm(e,t){return e.negate=t,e}function Bs(e,t){return e.parent=t,e}function Wt(e,t){return mC(e),e.parent=t,e}function UP(e,t){const n=dC(t),s=rp(n.target,"ES2024"),a=rp(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let u=null,c=null;if(!a){const _=[e.flags.ignoreCase];ol(e,FP,{getCurrentModI:()=>_.at(-1),popModI(){_.pop()},pushModI(w){_.push(w)},setHasCasedChar(){_.at(-1)?u=!0:c=!0}})}const d={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||u)&&!c)};let f=e;const p={accuracy:n.accuracy,appliedGlobalFlags:d,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:f,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!a&&u&&c),useFlagMods:a,useFlagV:s,verbose:n.verbose};function m(_){return p.lastNode=f,f=_,SP(VP[_.type],`Unexpected node type "${_.type}"`)(_,p,m)}const x={pattern:e.body.map(m).join("|"),flags:m(e.flags),options:{...e.options}};return s||(delete x.options.force.v,x.options.disable.v=!0,x.options.unicodeSetsPlugin=null),x._captureTransfers=new Map,x._hiddenCaptures=[],p.captureMap.forEach((_,w)=>{_.hidden&&x._hiddenCaptures.push(w),_.transferTo&&pl(x._captureTransfers,_.transferTo,[]).push(w)}),x}var FP={"*":{enter({node:e},t){if(L0(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Du({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){L0(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){rg(nn(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),vC(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&fC.has(e.value)&&t.setHasCasedChar()}},VP={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?We`\B`:We`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:s,name:a,number:o}=e,u={ignoreCase:t.currentFlags.ignoreCase},c=t.originMap.get(e);return c&&(u.hidden=!0,o>c.number&&(u.transferTo=c.number)),t.captureMap.set(o,u),`(${a?`?<${a}>`:""}${s.map(n).join("|")})`},Character({value:e},t){const n=nn(e),s=Ta(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==n)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&rg(n)){const a=hC(n);return t.inCharClass?a.join(""):a.length>1?`[${a.join("")}]`:a[0]}return n},CharacterClass(e,t,n){const{kind:s,negate:a,parent:o}=e;let{body:u}=e;if(s==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");vr.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&u.some(D0)&&(u=[ad(45),...u.filter(f=>!D0(f))]);const c=()=>`[${a?"^":""}${u.map(n).join(s==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||vr.bugNestedClassIgnoresNegation)&&!a){const p=u.filter(m=>m.type==="CharacterClass"&&m.kind==="union"&&m.negate);if(p.length){const m=_r(),x=m.body[0];return m.parent=o,x.parent=m,u=u.filter(_=>!p.includes(_)),e.body=u,u.length?(e.parent=x,x.body.push(e)):m.body.pop(),p.forEach(_=>{const w=Li({body:[_]});_.parent=w,w.parent=m,m.body.push(w)}),n(m)}}t.inCharClass=!0;const f=c();return t.inCharClass=!1,f}const d=u[0];if(s==="union"&&!a&&d&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(vr.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&u.length===1&&d.type!=="CharacterClassRange"))return u.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return c()},CharacterClassRange(e,t){const n=e.min.value,s=e.max.value,a={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=Ta(n,a),u=Ta(s,a),c=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const d=vC(e);YP(d).forEach(p=>{c.add(Array.isArray(p)?`${Ta(p[0],a)}-${Ta(p[1],a)}`:Ta(p,a))})}return`${o}-${u}${[...c].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:s},a){if(e==="dot")return a.currentFlags.dotAll?a.appliedGlobalFlags.dotAll||a.useFlagMods?".":"[^]":We`[^\n]`;if(e==="digit")return t?We`\D`:We`\d`;if(e==="property"){if(a.useAppliedIgnoreCase&&a.currentFlags.ignoreCase&&fC.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?We`\P`:We`\p`}{${s?`${s}=`:""}${n}}`}if(e==="word")return t?We`\W`:We`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:s},a,o){const u=a.currentFlags;n&&(a.currentFlags=Du(u,n));const c=t.map(o).join("|"),d=!a.verbose&&t.length===1&&s.type!=="Quantifier"&&!e&&(!a.useFlagMods||!n)?c:`(?${XP(e,n,a.useFlagMods)}${c})`;return a.currentFlags=u,d},LookaroundAssertion({body:e,kind:t,negate:n},s,a){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(a).join("|")})`},Quantifier(e,t,n){return n(e.body)+QP(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const s=n.recursionLimit;return t===0?`(?R=${s})`:We`\g<${t}&R=${s}>`}},GP=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),WP=new Set(["-","\\","]","^","["]),qP=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),A0=new Map([[9,We`\t`],[10,We`\n`],[11,We`\v`],[12,We`\f`],[13,We`\r`],[8232,We`\u2028`],[8233,We`\u2029`],[65279,We`\uFEFF`]]),KP=new RegExp("^\\p{Cased}$","u");function rg(e){return KP.test(e)}function vC(e,t){const n=!!(t!=null&&t.firstOnly),s=e.min.value,a=e.max.value,o=[];if(s<65&&(a===65535||a>=131071)||s===65536&&a>=131071)return o;for(let u=s;u<=a;u++){const c=nn(u);if(!rg(c))continue;const d=hC(c).filter(f=>{const p=f.codePointAt(0);return p<s||p>a});if(d.length&&(o.push(...d),n))break}return o}function Ta(e,{escDigit:t,inCharClass:n,useFlagV:s}){if(A0.has(e))return A0.get(e);if(e<32||e>126&&e<160||e>262143||t&&JP(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const a=n?s?qP:WP:GP,o=nn(e);return(a.has(o)?"\\":"")+o}function YP(e){const t=e.map(a=>a.codePointAt(0)).sort((a,o)=>a-o),n=[];let s=null;for(let a=0;a<t.length;a++)t[a+1]===t[a]+1?s??(s=t[a]):s===null?n.push(t[a]):(n.push([s,t[a]]),s=null);return n}function XP(e,t,n){if(e)return">";let s="";if(t&&n){const{enable:a,disable:o}=t;s=(a!=null&&a.ignoreCase?"i":"")+(a!=null&&a.dotAll?"s":"")+(o?"-":"")+(o!=null&&o.ignoreCase?"i":"")+(o!=null&&o.dotAll?"s":"")}return`${s}:`}function QP({kind:e,max:t,min:n}){let s;return!n&&t===1?s="?":!n&&t===1/0?s="*":n===1&&t===1/0?s="+":n===t?s=`{${n}}`:s=`{${n},${t===1/0?"":t}}`,s+{greedy:"",lazy:"?",possessive:"+"}[e]}function L0({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function JP(e){return e>47&&e<58}function D0({type:e,value:t}){return e==="Character"&&t===45}var zs,os,Ei,Hs,ji,gl,sp,Gs,ZP=(Gs=class extends RegExp{constructor(n,s,a){var t=(...c7)=>(super(...c7),fi(this,gl),fi(this,zs,new Map),fi(this,os,null),fi(this,Ei),fi(this,Hs,null),fi(this,ji,null),he(this,"rawOptions",{}),this);const o=!!(a!=null&&a.lazyCompile);if(n instanceof RegExp){if(a)throw new Error("Cannot provide options when copying a regexp");const u=n;t(u,s),mr(this,Ei,u.source),u instanceof Gs&&(mr(this,zs,wn(u,zs)),mr(this,Hs,wn(u,Hs)),mr(this,ji,wn(u,ji)),this.rawOptions=u.rawOptions)}else{const u={hiddenCaptures:[],strategy:null,transfers:[],...a};t(o?"":n,s),mr(this,Ei,n),mr(this,zs,t6(u.hiddenCaptures,u.transfers)),mr(this,ji,u.strategy),this.rawOptions=a??{}}o||mr(this,os,this)}get source(){return wn(this,Ei)||"(?:)"}exec(n){if(!wn(this,os)){const{lazyCompile:o,...u}=this.rawOptions;mr(this,os,new Gs(wn(this,Ei),this.flags,u))}const s=this.global||this.sticky,a=this.lastIndex;if(wn(this,ji)==="clip_search"&&s&&a){this.lastIndex=0;const o=Sf(this,gl,sp).call(this,n.slice(a));return o&&(e6(o,a,n,this.hasIndices),this.lastIndex+=a),o}return Sf(this,gl,sp).call(this,n)}},zs=new WeakMap,os=new WeakMap,Ei=new WeakMap,Hs=new WeakMap,ji=new WeakMap,gl=new WeakSet,sp=function(n){wn(this,os).lastIndex=this.lastIndex;const s=Zy(Gs.prototype,this,"exec").call(wn(this,os),n);if(this.lastIndex=wn(this,os).lastIndex,!s||!wn(this,zs).size)return s;const a=[...s];s.length=1;let o;this.hasIndices&&(o=[...s.indices],s.indices.length=1);const u=[0];for(let c=1;c<a.length;c++){const{hidden:d,transferTo:f}=wn(this,zs).get(c)??{};if(d?u.push(null):(u.push(s.length),s.push(a[c]),this.hasIndices&&s.indices.push(o[c])),f&&a[c]!==void 0){const p=u[f];if(!p)throw new Error(`Invalid capture transfer to "${p}"`);if(s[p]=a[c],this.hasIndices&&(s.indices[p]=o[c]),s.groups){wn(this,Hs)||mr(this,Hs,n6(this.source));const m=wn(this,Hs).get(f);m&&(s.groups[m]=a[c],this.hasIndices&&(s.indices.groups[m]=o[c]))}}}return s},Gs);function e6(e,t,n,s){if(e.index+=t,e.input=n,s){const a=e.indices;for(let u=0;u<a.length;u++){const c=a[u];c&&(a[u]=[c[0]+t,c[1]+t])}const o=a.groups;o&&Object.keys(o).forEach(u=>{const c=o[u];c&&(o[u]=[c[0]+t,c[1]+t])})}}function t6(e,t){const n=new Map;for(const s of e)n.set(s,{hidden:!0});for(const[s,a]of t)for(const o of a)pl(n,o,{}).transferTo=s;return n}function n6(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let s=0,a=0,o;for(;o=t.exec(e);){const{0:u,groups:{capture:c,name:d}}=o;u==="["?s++:s?u==="]"&&s--:c&&(a++,d&&n.set(a,d))}return n}function r6(e,t){const n=s6(e,t);return n.options?new ZP(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function s6(e,t){const n=dC(t),s=rC(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:ng}),a=LP(s,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=UP(a,n),u=vP(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),c=_P(u.pattern),d=xP(c.pattern,{captureTransfers:u.captureTransfers,hiddenCaptures:u.hiddenCaptures}),f={pattern:d.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const p=d.hiddenCaptures.sort((w,k)=>w-k),m=Array.from(d.captureTransfers),x=a._strategy,_=f.pattern.length>=n.lazyCompileLength;(p.length||m.length||x||_)&&(f.options={...p.length&&{hiddenCaptures:p},...m.length&&{transfers:m},...x&&{strategy:x},..._&&{lazyCompile:_}})}return f}function bC(e,t){return r6(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function i6(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||(t.regexConstructor=n=>bC(n,{target:t.target})),{createScanner(n){return new bI(n,t)},createString(n){return{content:n}}}}J1(zp({bundledLanguages:()=>Up,bundledLanguagesAlias:()=>$p,bundledLanguagesBase:()=>Hp,bundledLanguagesInfo:()=>Qu,bundledThemes:()=>Vp,bundledThemesInfo:()=>Fp,codeToHast:()=>Gw,codeToHtml:()=>Vw,codeToTokens:()=>Ww,codeToTokensBase:()=>qw,codeToTokensWithThemes:()=>Kw,createHighlighter:()=>id,createJavaScriptRegexEngine:()=>i6,createOnigurumaEngine:()=>tw,defaultJavaScriptRegexConstructor:()=>bC,getLastGrammarState:()=>Xw,getSingletonHighlighter:()=>Yw,loadWasm:()=>Wp}),vI);let gm=null;const a6=["typescript","javascript","tsx","jsx","python","bash","json","css","html","sql","yaml","markdown","diff","rust","go","java","c","cpp","ruby","toml","scss","graphql","docker","powershell"],o6=["github-dark-default","vitesse-light","monokai","dracula","nord"],l6={dark:"github-dark-default",light:"vitesse-light",monokai:"monokai",dracula:"dracula",nord:"nord"};function c6(){return{name:"line-numbers",line(e,t){e.properties["data-line"]=String(t+1)}}}async function u6(){return gm||(gm=id({themes:o6,langs:a6})),gm}const Xo=new Map,d6=50;function h6(e,t,n){return`${e}|${t}|${n}`}async function SC(e,t,n="github-dark-default"){const s=h6(e,t,n),a=Xo.get(s);if(a)return a;const u=(await u6()).codeToHtml(e,{lang:t,theme:n,transformers:[c6()]});if(Xo.size>=d6){const c=Xo.keys().next().value;c&&Xo.delete(c)}return Xo.set(s,u),u}const f6={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",toml:"toml",ini:"ini",conf:"ini",dockerfile:"docker",makefile:"makefile",cmake:"cmake",graphql:"graphql",gql:"graphql",vue:"vue",svelte:"svelte"};function ud(e){var a;if(!e)return"text";const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"docker";if(n==="makefile")return"makefile";if(n==="cmakelists.txt")return"cmake";const s=(a=t.split(".").pop())==null?void 0:a.toLowerCase();return s?f6[s]??"text":"text"}function wC(){const e=$t(n=>n.currentPreset);return $t(n=>n.isCustom)?"github-dark-default":l6[e]??"github-dark-default"}function CC(e=2e3){const[t,n]=R.useState(!1),s=R.useCallback(async a=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a);else{const o=document.createElement("textarea");o.value=a,o.style.position="fixed",o.style.left="-9999px",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}n(!0),setTimeout(()=>n(!1),e)}catch(o){console.error("Failed to copy:",o)}},[e]);return{copied:t,copy:s}}const m6=R.memo(function({language:t,codeString:n,showSyntaxHighlighting:s}){const{copied:a,copy:o}=CC(),[u,c]=R.useState(null),d=wC(),f=R.useRef(n);return R.useEffect(()=>{s&&(f.current=n,SC(n,t,d).then(p=>{f.current===n&&c(p)}))},[n,t,d,s]),l.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[l.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[l.jsx("span",{children:t}),l.jsx("button",{type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),o(n)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:a?l.jsx(Or,{}):l.jsx(cp,{})})]}),s&&u?l.jsx("div",{className:"min-w-0",dangerouslySetInnerHTML:{__html:u}}):l.jsx("div",{className:"overflow-x-auto",children:l.jsx("pre",{className:"my-0 px-4 py-3 overflow-x-auto font-mono text-sm whitespace-pre-wrap break-word",children:l.jsx("code",{className:`language-${t}`,children:n})})})]})});function p6(e,t){const n=e?"text-text-muted":"text-sky-400",s=e?"text-text-secondary":"text-amber-400";return{code({className:a,children:o,...u}){const c=/language-(\w+)/.exec(a||"");if(!c&&!String(o).includes(`
|
|
274
|
-
`)){const m=e?"text-text-muted":"text-accent-secondary";return l.jsx("code",{className:`bg-bg-tertiary px-1 py-0.5 rounded ${m} font-mono text-xs`,...u,children:o})}const f=(c==null?void 0:c[1])||"text",p=String(o).replace(/\n$/,"");return l.jsx(m6,{language:f,codeString:p,showSyntaxHighlighting:t})},p({children:a}){const o=e?"text-text-muted":"text-text-primary";return l.jsx("p",{className:`${o} mb-1.5 last:mb-0 leading-tight`,children:a})},ul({children:a}){return l.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:a})},ol({children:a}){return l.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:a})},li({children:a}){const o=e?"text-text-muted":"text-text-primary";return l.jsx("li",{className:`${o} text-sm list-item`,children:a})},h1({children:a}){return l.jsx("h1",{className:`text-base font-bold mb-1.5 mt-2 first:mt-0 ${n}`,children:a})},h2({children:a}){return l.jsx("h2",{className:`text-sm font-bold mb-1.5 mt-2 first:mt-0 ${n}`,children:a})},h3({children:a}){return l.jsx("h3",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${n}`,children:a})},h4({children:a}){return l.jsx("h4",{className:`text-sm font-bold mb-1.5 mt-1.5 first:mt-0 ${n}`,children:a})},strong({children:a}){return l.jsx("strong",{className:`font-bold ${s}`,children:a})},em({children:a}){return l.jsx("em",{className:e?"italic text-text-secondary":"italic",children:a})},a({href:a,children:o}){return l.jsx("a",{href:a,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:o})},blockquote({children:a}){const o=e?"text-text-muted":"text-text-secondary";return l.jsx("blockquote",{className:`border-l-2 border-accent-primary pl-2 my-1.5 ${o} italic text-sm`,children:a})},table({children:a}){return l.jsx("div",{className:"overflow-x-auto my-1.5",children:l.jsx("table",{className:"min-w-full border border-border",children:a})})},th({children:a}){return l.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:a})},td({children:a}){return l.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:a})},hr(){return l.jsx("hr",{className:"border-border my-2"})},input({checked:a,...o}){return l.jsx("input",{type:"checkbox",checked:a,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...o})}}}const us=R.memo(function({content:t,className:n="",muted:s=!1}){const{showSyntaxHighlighting:a}=Pu(),o=R.useMemo(()=>{let c=g6(t);return c=x6(c),c},[t]),u=R.useMemo(()=>p6(s,a),[s,a]);return l.jsx("div",{className:`markdown-content [&_li>p]:inline ${n}`,children:l.jsx(BR,{remarkPlugins:[Q5],components:u,children:o})})});function g6(e){let t=e.replace(/^(\s*)•\s/gm,"$1- ");return t=t.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),t=t.replace(/^\|\s*$/gm,""),t=t.replace(/^\d+:\s/gm,""),t}function x6(e){const t=/```/g,n=e.match(t);if(((n==null?void 0:n.length)??0)%2===1){const a=e.lastIndexOf("```");return e.slice(a+3).includes(`
|
|
275
|
-
`),e+"\n```"}return e}const _6=R.memo(function({content:t,variant:n="default"}){return n==="labeled"?l.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[l.jsx("span",{className:"text-purple-400",children:"thinking:"}),l.jsx("div",{className:"ml-1.5 mt-0.5",children:l.jsx(us,{content:t})})]}):l.jsx("div",{className:"text-text-muted text-sm italic bg-secondary rounded p-1.5 feed-item",children:l.jsx(us,{content:t,muted:!0})})});function kC({tool:e,className:t="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?l.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}):e==="run_command"||e==="bash"?l.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}):l.jsx("svg",{className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}const Ua=R.memo(function({code:t,language:n,variant:s,showLineNumbers:a=!1,startLine:o=1}){const[u,c]=R.useState(null),d=wC(),f=R.useRef(t);if(R.useEffect(()=>{f.current=t,SC(t,n,d).then(m=>{f.current===t&&c(m)})},[t,n,d]),!u){const m=s==="inline"?"span":s==="block-nowrap"?"div":"pre";return l.jsx(m,{className:"language-",children:l.jsx("code",{className:"language-",children:t})})}if(s==="inline")return l.jsx("span",{dangerouslySetInnerHTML:{__html:u}});const p=a?"":"shiki-plain";return l.jsx("div",{className:p,style:{"--shiki-start":o},dangerouslySetInnerHTML:{__html:u}})});function EC({src:e,alt:t,isOpen:n,onClose:s}){return n?l.jsx(kt,{isOpen:n,onClose:s,title:"",size:"full",children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("img",{src:e,alt:t,className:"max-w-full max-h-[80vh] object-contain rounded-lg shadow-2xl"})})}):null}const Ru=R.memo(function({type:t,children:n}){const s=t==="removed"?"diff-removed-bg diff-removed-border":"diff-added-bg diff-added-border",a=t==="removed"?"line-through decoration-red-400/30":"";return l.jsx("div",{className:`border-l-[3px] ${s}`,children:l.jsx("div",{className:`min-w-0 py-3 ${a}`,children:l.jsx("div",{className:"shiki-compact shiki-transparent-bg",children:n})})})}),y6=R.memo(function({oldString:t,newString:n,filePath:s}){const a=R.useMemo(()=>ud(s),[s]),o=t.length>0,u=n.length>0;return!o&&!u?l.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):l.jsxs("div",{className:"rounded overflow-hidden border border-border",children:[o&&l.jsx(Ru,{type:"removed",children:l.jsx(Ua,{code:t,language:a,variant:"block",showLineNumbers:!0})}),u&&l.jsx(Ru,{type:"added",children:l.jsx(Ua,{code:n,language:a,variant:"block",showLineNumbers:!0})})]})}),v6=R.memo(function({content:t,filePath:n}){const s=R.useMemo(()=>ud(n),[n]);return l.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:l.jsx(Ru,{type:"added",children:l.jsx(Ua,{code:t,language:s,variant:"block",showLineNumbers:!0})})})}),b6=R.memo(function({regions:t,filePath:n}){const s=R.useMemo(()=>ud(n),[n]);return t.length===0?l.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):l.jsx("div",{className:"space-y-2",children:t.map((a,o)=>l.jsx(w6,{region:a,language:s},o))})});function S6(e){const t=[];function n(s,a,o){const u=t[t.length-1];u&&u.type===s&&u.startLine+u.lines.length===a?u.lines.push(o):t.push({type:s,startLine:a,lines:[o]})}for(const s of e.beforeContext)n("context",s.lineNumber,s.content);for(const s of e.edits){const a=s.oldContent.split(`
|
|
276
|
-
`);for(let u=0;u<a.length;u++)n("removed",s.startLine+u,a[u]);const o=s.newContent.split(`
|
|
277
|
-
`);for(let u=0;u<o.length;u++)n("added",s.startLine+u,o[u])}for(const s of e.afterContext)n("context",s.lineNumber,s.content);return t}const w6=R.memo(function({region:t,language:n}){const s=S6(t);return l.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((a,o)=>l.jsx(C6,{section:a,language:n},o))})}),C6=R.memo(function({section:t,language:n}){const s=t.lines.join(`
|
|
278
|
-
`);return t.type==="context"?l.jsx("div",{children:l.jsx("div",{className:"min-w-0 py-3",children:l.jsx("div",{className:"shiki-compact shiki-transparent-bg",children:l.jsx(Ua,{code:s,language:n,variant:"block",showLineNumbers:!0,startLine:t.startLine})})})}):l.jsx(Ru,{type:t.type,children:l.jsx(Ua,{code:s,language:n,variant:"block",showLineNumbers:!0,startLine:t.startLine})})});function R0(e){return e.split(`
|
|
279
|
-
`).filter(t=>!t.startsWith(`
|
|
280
|
-
[`)&&!t.startsWith("[")).map(t=>t.replace(/^\d+: /,"")).join(`
|
|
281
|
-
`)}const k6=R.memo(function({result:t,metadata:n,filePath:s,heightExpanded:a=!1}){const[o,u]=R.useState(!1),c=R.useMemo(()=>ud(s),[s]),d=n==null?void 0:n.mimeType,f=n==null?void 0:n.base64Data;if(d!=null&&d.startsWith("image/")&&f){const k=`data:${d};base64,${f}`;return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>u(!0),children:l.jsx("img",{src:k,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),l.jsx(EC,{src:k,alt:s,isOpen:o,onClose:()=>u(!1)})]})}if(!t)return l.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const p=t;if(c==="markdown"){const k=R0(p);return l.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} overflow-y-auto p-2`,children:l.jsx(us,{content:k})})}const m=R0(p),x=p.split(`
|
|
282
|
-
`)[0],_=x==null?void 0:x.match(/^(\d+): /),w=_?parseInt(_[1],10):1;return l.jsx("div",{className:`rounded overflow-hidden border border-border ${a?"":"max-h-[45vh]"} overflow-y-auto`,children:l.jsx(Ua,{code:m,language:c,variant:"block",showLineNumbers:!0,startLine:w})})}),E6={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},O0=R.memo(function({diagnostics:t}){if(t.length===0)return null;const n=t.filter(o=>o.severity==="error"),s=t.filter(o=>o.severity==="warning"),a=t.filter(o=>o.severity==="info"||o.severity==="hint");return l.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[l.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[l.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),n.length>0&&l.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[n.length," error",n.length!==1?"s":""]}),s.length>0&&l.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),a.length>0&&l.jsxs("span",{className:"text-xs text-text-muted",children:[a.length," info"]})]}),l.jsx("div",{className:"max-h-48 overflow-y-auto",children:t.map((o,u)=>{const c=E6[o.severity];return l.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${c.bg} border-b border-border last:border-b-0`,children:[l.jsx("span",{className:`${c.color} text-xs flex-shrink-0 w-4 text-center`,children:c.icon}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",o.range.start.line+1,":",o.range.start.character+1]}),o.code&&l.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",o.code,"]"]})]}),l.jsx("div",{className:"text-xs text-text-primary break-words",children:o.message})]})]},u)})})]})}),j6=R.memo(function({command:t,timeout:n,startedAt:s,streamingOutput:a,status:o,result:u,error:c,durationMs:d}){const f=R.useRef(null),[p,m]=R.useState(0);R.useEffect(()=>{f.current&&o==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[a,o]),R.useEffect(()=>{if(o!=="pending"||!s)return;const k=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(k)},[o,s]);const x=n/1e3,_=o==="pending"?p/1e3:(d??0)/1e3,w=o==="pending"?(a==null?void 0:a.map(k=>k.content).join(""))??"":u??"";return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[l.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),l.jsx("code",{className:"text-text-primary break-all",children:t})]}),l.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[o==="pending"&&l.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),o==="interrupted"&&l.jsx("span",{className:"text-red-400",children:"interrupted"}),l.jsxs("span",{className:o==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",x,"s"]})]})]}),o==="pending"&&l.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:l.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,p/n*100)}%`}})}),(w||o==="pending")&&l.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${o==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:o==="pending"&&a?a.map((k,v)=>l.jsx("span",{className:k.stream==="stderr"?"text-accent-warning":"",children:xu(k.content)},v)):xu(w)}),o==="error"&&c&&l.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:c}),o!=="pending"&&d!==void 0&&l.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function T6(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"git_no_verify":return{title:"Git --no-verify",description:"Bypassing git hooks/pre-commit checks"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function N6({confirmation:e}){const t=we(m=>m.confirmPath),n=we(m=>m.currentSession),s=we(m=>m.switchDangerLevel),{title:a,description:o}=T6(e.reason),u=e.reason==="sensitive_file"||e.reason==="both",c=u?"border-red-500/50":"border-amber-500/50",d=u?"bg-red-500/10":"bg-amber-500/10",f=e.reason==="git_no_verify",p=()=>{n!=null&&n.id&&s("dangerous"),t(e.callId,!0,!1)};return l.jsxs("div",{className:`border ${c} ${d} rounded p-3 my-2`,children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(km,{}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:`text-sm font-medium ${u?"text-red-400":"text-amber-400"}`,children:a}),l.jsx("div",{className:"text-xs text-text-muted",children:o})]})]}),l.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[l.jsx("span",{className:"font-medium",children:e.tool})," wants to access:"]}),l.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:l.jsx("ul",{className:"space-y-0.5",children:e.paths.map((m,x)=>l.jsx("li",{className:`text-xs font-mono ${u?"text-red-300":"text-amber-300"} break-all`,children:m},x))})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>t(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),l.jsx("button",{onClick:()=>t(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-text-primary transition-colors",children:"Allow"}),l.jsx("button",{onClick:p,className:`flex-1 px-3 py-1.5 text-xs font-medium rounded transition-colors ${f?"hidden":"bg-red-600 hover:bg-red-700 text-white"}`,title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function A6(e,t){if(e==="read_file"){const s=String(t.path??""),a=t.offset,o=t.limit,u=[];return a!==void 0&&a!==1&&u.push(`offset=${a}`),o!==void 0&&u.push(`limit=${o}`),u.length>0?`${s} [${u.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(t.path??"");if(e==="run_command"||e==="bash")return String(t.command??"");if(e==="return_value"){const s=String(t.content??"");return s.length>60?s.slice(0,60)+"...":s}const n=JSON.stringify(t);return n.length>50?n.slice(0,50)+"...":n}function M0(e,t,n){return A6(e,t)}function L6(e){return JSON.stringify(e,null,2)}const D6={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},R6=R.memo(function({tool:t,args:n,status:s,variant:a="compact",forceCompact:o,result:u,error:c,durationMs:d,diagnostics:f,editContext:p,startedAt:m,streamingOutput:x,metadata:_,callId:w}){var U;const k=t==="edit_file"||t==="write_file",v=t==="run_command"&&s==="pending",S=t==="read_file",b=o?!1:k||v||t==="return_value",[E,N]=R.useState(b),T=D6[s],L=rn(F=>F.settings[Be.DISPLAY_SHOW_OPEN_IN_EDITOR])==="true",A=t==="edit_file"?(U=p==null?void 0:p.regions[0])==null?void 0:U.startLine:t==="read_file"?(()=>{const F=u==null?void 0:u.split(`
|
|
283
|
-
`)[0],B=F==null?void 0:F.match(/^(\d+): /);return B?parseInt(B[1],10):void 0})():void 0,M=we(F=>F.pendingPathConfirmations),D=s==="pending"&&w?M.find(F=>F.callId===w)??null:null;return a==="compact"?l.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-secondary rounded px-2 py-1.5",children:[l.jsx(kC,{tool:t}),l.jsx("span",{className:"text-accent-primary font-medium",children:t}),l.jsx("span",{className:"text-text-muted truncate flex-1",children:M0(t,n)}),l.jsx("span",{className:`${T.color} ${T.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):l.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[l.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-secondary hover:bg-secondary/80 text-left",onClick:()=>N(!E),children:[l.jsx("span",{className:`${T.color} ${T.animate?"animate-pulse":""}`,children:T.icon}),l.jsx("span",{className:"font-mono text-accent-primary text-sm",children:t}),l.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:M0(t,n)}),l.jsx("span",{className:"text-text-muted text-xs",children:E?"▼":"▶"})]}),D&&l.jsx(N6,{confirmation:D}),(E||S)&&l.jsxs("div",{className:"p-2 bg-primary border-t border-border space-y-2 min-w-0",children:[t==="run_command"&&l.jsx(j6,{command:String(n.command??""),timeout:n.timeout??12e4,startedAt:m,streamingOutput:x,status:s,result:u,error:c,durationMs:d}),t==="edit_file"&&s==="success"&&l.jsxs(l.Fragment,{children:[p&&p.regions.length>0?l.jsx(b6,{regions:p.regions,filePath:String(n.path??"")}):l.jsx(y6,{oldString:String(n.old_string??""),newString:String(n.new_string??""),filePath:String(n.path??"")}),f&&f.length>0&&l.jsx(O0,{diagnostics:f})]}),t==="write_file"&&s==="success"&&l.jsxs(l.Fragment,{children:[l.jsx(v6,{content:String(n.content??""),filePath:String(n.path??"")}),f&&f.length>0&&l.jsx(O0,{diagnostics:f})]}),t==="read_file"&&s==="success"&&l.jsx(k6,{result:u,metadata:_,filePath:String(n.path??""),heightExpanded:E}),t==="return_value"&&(()=>{const F=(x==null?void 0:x.map(Y=>Y.content).join(""))??"",B=s==="pending"&&F?F:String(n.content??"");return l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),l.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:l.jsx(us,{content:B})})]})})(),t!=="edit_file"&&t!=="write_file"&&t!=="run_command"&&t!=="read_file"&&t!=="return_value"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),l.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:L6(n)})]}),s==="success"&&u!==void 0&&l.jsxs("div",{children:[l.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",d!==void 0&&` (${d}ms)`,":"]}),l.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:u||"No output"})]})]}),s==="success"&&(t==="edit_file"||t==="write_file"||t==="read_file")&&d!==void 0&&l.jsxs("div",{className:"text-[10px] text-text-muted flex items-center gap-2",children:[l.jsxs("span",{children:["Completed in ",d,"ms"]}),L&&(t==="read_file"||t==="write_file"||t==="edit_file")&&String(n.path??"")&&l.jsx("a",{href:`vscode://file/${String(n.path)}${A?`:${A}`:""}`,className:"text-accent-primary hover:underline ml-auto",children:"Open in VSCode"})]}),s==="error"&&c&&t!=="run_command"&&l.jsxs("div",{children:[l.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),l.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:c})]})]})]})}),O6={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",session_metadata:"Managing",todo_write:"Updating tasks"},M6={criteria:"criteria",review_findings:"review findings",todos:"tasks"};function I6(e,t){const n=O6[e];if(!n)return`Preparing ${e}`;if(e==="session_metadata"&&t)try{const a=JSON.parse(t).key;if(a){const o=M6[a]??a;return`${n} ${o}`}}catch{}return n}function P6(e){try{const t=e.replace(/\s*\}\s*$/,""),n=JSON.parse(t);if(typeof n.command=="string")return n.command}catch{const t=e.match(/"command"\s*:\s*"([^"]*)/);if(t&&t[1])return t[1]}return null}const B6=R.memo(function({name:t,arguments:n}){let a=I6(t,n)+"...";if(t==="run_command"&&n){const o=P6(n);o&&(a=o)}return l.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:l.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[l.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),l.jsx(kC,{tool:t}),l.jsx("span",{className:"font-mono text-accent-primary text-sm",children:t}),t==="run_command"&&n?l.jsx("code",{className:"text-text-muted text-xs flex-1 truncate",children:a}):l.jsx("span",{className:"text-text-muted text-xs flex-1",children:a})]})})}),z6={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},H6=R.memo(function({todos:t}){return Array.isArray(t)?t.length===0?l.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):l.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[l.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:l.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),l.jsx("div",{children:t.map((n,s)=>{const a=z6[n.status];return l.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[l.jsx("span",{className:`${(a==null?void 0:a.color)??"text-text-muted"} ${a!=null&&a.animate?"animate-pulse":""} text-sm leading-tight`,children:(a==null?void 0:a.icon)??"○"}),l.jsx("span",{className:`text-sm leading-tight ${n.status==="completed"?"text-text-muted":"text-text-primary"}`,children:n.content})]},s)})})]}):l.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),I0={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"},list:{icon:"○",color:"text-text-muted"},schema:{icon:"○",color:"text-text-muted"}},jC=R.memo(function({toolCalls:t,criteria:n}){if(t.length===0)return null;const s=new Map((n==null?void 0:n.map(d=>[d.id,d]))??[]),a=t.find(d=>{var f,p;return d.arguments.action==="get"&&((f=d.result)==null?void 0:f.success)&&((p=d.result)==null?void 0:p.output)}),o=t.some(d=>d.name==="session_metadata"),u={criteria:"Acceptance Criteria",review_findings:"Review Findings",todos:"Tasks"},c=(()=>{if(!o)return"Acceptance Criteria";const d=new Set(t.map(f=>f.arguments.key).filter(Boolean));if(d.size===1){const f=d.values().next().value;return f?u[f]??f:"Session Data"}return"Session Data"})();return l.jsxs("div",{className:"my-1 rounded border border-border bg-secondary overflow-hidden",children:[l.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-secondary",children:l.jsx("span",{className:"text-xs font-medium text-text-muted",children:c})}),l.jsx("div",{className:"bg-primary",children:a?(()=>{const d=a.result.output;if(d==="No criteria defined yet.")return l.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[l.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),l.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(d).map((p,m)=>l.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${m>0?"border-t border-border":""}`,children:[l.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(us,{content:`[${p.id}] ${p.description}`})})]},p.id??m))}catch{return t.map((f,p)=>l.jsx(P0,{tc:f,index:p,criteriaMap:s},f.id??p))}})():t.map((d,f)=>l.jsx(P0,{tc:d,index:f,criteriaMap:s},d.id??f))})]})});function P0({tc:e,index:t,criteriaMap:n}){const s=e.arguments.action,a=e.arguments,o=e.name==="session_metadata",u=s==="remove",c=a.id,d=a.description,f=c?n.get(c):void 0,p=d??(f==null?void 0:f.description)??(u&&c?`[${c}]`:"Criterion updated"),m=a.reason,x=s==="fail";return l.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${t>0?"border-t border-border":""}`,children:[o?l.jsx(Gu,{status:a.status,className:"text-sm leading-tight flex-shrink-0"}):(()=>{const _=s&&I0[s]?I0[s]:{icon:"○",color:"text-text-muted"};return l.jsx("span",{className:`${_.color} text-sm leading-tight flex-shrink-0`,children:_.icon})})(),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:u?"line-through text-text-muted":"",children:l.jsx(us,{content:p})}),m&&l.jsxs("div",{className:`mt-1 text-sm ${x?"text-accent-error":"text-text-muted"}`,children:[l.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function $6(e){return e==="criterion"||e==="session_metadata"}function U6(e){const t=[];let n=[];const s=()=>{n.length>0&&(t.push({type:"criteria_group",toolCalls:n}),n=[])};for(const a of e)a.type==="tool_call"&&$6(a.toolCall.name)?n.push(a.toolCall):(s(),t.push(a));return s(),t}function F6(e,t){if(e.segments&&e.segments.length>0)return V6(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,t);const n=[];if(e.thinkingContent&&n.push({type:"thinking",content:e.thinkingContent}),e.content&&n.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)n.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)n.push({type:"preparing_tool_call",preparing:s});return t&&e.stats&&n.push({type:"stats",stats:e.stats}),n}function V6(e,t,n,s,a){const o=[],u=new Map(t.map(c=>[c.id,c]));for(const c of e)switch(c.type){case"text":o.push({type:"text",content:c.content});break;case"thinking":c.content&&c.content.trim().length>0&&o.push({type:"thinking",content:c.content});break;case"tool_call":{const d=u.get(c.toolCallId);d&&o.push({type:"tool_call",toolCall:d});break}}for(const c of n)o.push({type:"preparing_tool_call",preparing:c});return a&&s&&o.push({type:"stats",stats:s}),o}const sg=R.memo(function({message:t,showStats:n=!0,showThinking:s=!0,showVerboseToolOutput:a=!0}){const o=we(x=>{var _,w;return(w=(_=x.currentSession)==null?void 0:_.metadataEntries)==null?void 0:w.criteria}),u=ht(x=>x.defaults),c=ht(x=>x.userItems),d=[...u,...c],f=F6(t,n),p=s?f:f.filter(x=>x.type!=="thinking"),m=U6(p);return m.length===0?null:l.jsx("div",{className:"feed-item",children:l.jsxs("div",{className:"min-w-0",children:[m.map((x,_)=>{var w,k;switch(x.type){case"thinking":return l.jsx(_6,{content:x.content},_);case"text":return l.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:l.jsx(us,{content:x.content})},_);case"preparing_tool_call":return l.jsx(B6,{name:x.preparing.name,arguments:x.preparing.arguments},`preparing-${x.preparing.index}`);case"tool_call":{const v=x.toolCall,S=v.result;if(v.name==="todo_write"){const E=v.arguments.todos,N=Array.isArray(E)?E:[];return l.jsx(H6,{todos:N},_)}const y=(w=S==null?void 0:S.output)==null?void 0:w.includes("[interrupted by user]"),b=S?y?"interrupted":S.success?"success":"error":"pending";return l.jsx(R6,{tool:v.name,args:v.arguments,status:b,variant:"expandable",forceCompact:!a,result:S==null?void 0:S.output,error:S==null?void 0:S.error,durationMs:S==null?void 0:S.durationMs,diagnostics:S==null?void 0:S.diagnostics,editContext:S==null?void 0:S.editContext,startedAt:v.startedAt,streamingOutput:v.streamingOutput,metadata:S==null?void 0:S.metadata,callId:v.id},_)}case"criteria_group":return l.jsx(jC,{toolCalls:x.toolCalls,criteria:o},_);case"stats":{const v=x.stats;if(!v||"error"in v)return null;const S=((k=v.model.split("/").pop())==null?void 0:k.split("-").slice(0,2).join("-"))??v.model,y=ll(d,v.mode),b=N=>N>=1e3?`${(N/1e3).toFixed(1)}k`:N.toString(),E=N=>N>=1e3?`${(N/1e3).toFixed(1)}k`:N.toFixed(1);return l.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[l.jsx("span",{className:"flex-1 h-px bg-border"}),l.jsx("span",{className:"text-text-secondary",children:S}),l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsx("span",{style:{color:y},children:v.mode}),l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsxs("span",{children:[v.totalTime.toFixed(1),"s"]}),v.toolTime>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsxs("span",{children:[v.toolTime.toFixed(1),"s tools"]})]}),l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsxs("span",{children:[b(v.prefillTokens)," @ ",E(v.prefillSpeed)," pp"]}),l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsxs("span",{children:[b(v.generationTokens)," @ ",E(v.generationSpeed)," tg"]}),l.jsx("span",{className:"text-text-muted",children:"·"}),l.jsx("button",{type:"button",className:"text-text-muted hover:text-text-secondary transition-colors",title:"View detailed stats",onClick:()=>{const N=new CustomEvent("open-turn-stats",{detail:{stats:v}});window.dispatchEvent(N)},children:l.jsx(gS,{className:"w-3 h-3"})}),l.jsx("span",{className:"flex-1 h-px bg-border"})]},_)}}}),t.partial&&l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[l.jsx(km,{}),l.jsx("span",{children:"Aborted"})]}),t.completeReason==="truncated"&&l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-amber-400/80 mt-1",children:[l.jsx(km,{}),l.jsx("span",{children:"Response was truncated — the model ran out of output tokens."})]})]})})});function Ou(e,t){const n=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);return`rgba(${n},${s},${a},${t})`}function G6(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=Math.round(e%60);return n>0?`${t}m ${n}s`:`${t}m`}function W6(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const q6=R.memo(function({data:t}){var u;const n=Ct(c=>c.defaults),s=Ct(c=>c.userItems),o=((u=[...n,...s].find(c=>c.id===t.workflowId))==null?void 0:u.color)??t.workflowColor??"#8b949e";return l.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Ou(o,.3),backgroundColor:Ou(o,.08)},children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx(Dj,{color:o}),l.jsx("span",{className:"text-sm font-medium",style:{color:o},children:t.workflowName??"Task Completed"})]}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[l.jsx(Qo,{label:"Iterations",value:String(t.iterations)}),l.jsx(Qo,{label:"Total time",value:G6(t.totalTimeSeconds)}),l.jsx(Qo,{label:"Tool calls",value:String(t.totalToolCalls)}),l.jsx(Qo,{label:"Tokens",value:W6(t.totalTokensGenerated)}),l.jsx(Qo,{label:"Speed",value:t.avgGenerationSpeed>0?`${t.avgGenerationSpeed} tok/s`:"-"})]})]})});function Qo({label:e,value:t}){return l.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[l.jsx("div",{className:"text-sm text-text-muted",children:e}),l.jsx("div",{className:"text-sm text-text-primary font-medium",children:t})]})}const K6=R.memo(function({data:t}){var u;const n=Ct(c=>c.defaults),s=Ct(c=>c.userItems),o=((u=[...n,...s].find(c=>c.id===t.workflowId))==null?void 0:u.color)??t.workflowColor??"#6b7280";return l.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Ou(o,.3),backgroundColor:Ou(o,.08)},children:[l.jsx(Ej,{className:"w-3 h-3 shrink-0",color:o}),l.jsx("span",{className:"text-sm font-medium",style:{color:o},children:t.workflowName}),l.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function Y6({attachments:e,messageId:t}){const[n,s]=R.useState(null),a=we(p=>p.visionFallbackByMessage),o=we(p=>p.messages),u=R.useMemo(()=>{const p=o.findIndex(m=>m.id===t);if(p===-1)return null;for(let m=p+1;m<o.length;m++){const x=o[m];if(x&&x.role==="assistant")return x.id}return null},[o,t]),c=p=>{s(p)},d=()=>{s(null)},f=p=>{const m=`${t}-${p}`;if(a[m])return a[m];if(u){const x=`${u}-${p}`;return a[x]}return null};return e.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(p=>{const m=f(p.id);return l.jsxs("div",{className:"relative inline-block",children:[l.jsxs("button",{onClick:()=>c(p.data),className:"group relative inline-block",title:p.filename,disabled:(m==null?void 0:m.type)==="start",children:[l.jsx("img",{src:p.data,alt:p.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&l.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:l.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&l.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},p.id)})}),n&&l.jsx(EC,{src:n,alt:"Attached image",isOpen:!0,onClose:d})]})}function X6({content:e,align:t="right",messageIndex:n,sessionId:s}){const[a,o]=R.useState(!1),[u,c]=R.useState(!1),[d,f]=R.useState("left"),p=R.useRef(null),m=R.useRef(null),x=we(S=>S.loadSession),_=t==="right",w=()=>{if(!m.current)return"left";const S=m.current.getBoundingClientRect(),y=window.innerWidth-S.right,b=S.left,E=160,N=y>=E,T=b>=E;return T&&N||T?"left":N?"right":b>=y?"left":"right"};R.useEffect(()=>{const S=y=>{p.current&&!p.current.contains(y.target)&&o(!1)};return a&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[a]);const k=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const S=document.createElement("textarea");S.value=e,S.style.position="fixed",S.style.left="-999999px",document.body.appendChild(S),S.select(),document.execCommand("copy"),document.body.removeChild(S)}c(!0),o(!1),window.setTimeout(()=>c(!1),1500)}catch(S){console.error("Failed to copy:",S)}},v=async()=>{!s||n===void 0||(o(!1),await p2(s,n),x(s))};return l.jsx(l.Fragment,{children:l.jsxs("div",{className:`flex items-start gap-1.5 ${_?"":"order-first"}`,children:[u&&l.jsx(Or,{className:"w-4 h-4 text-accent-success"}),l.jsxs("div",{ref:p,className:"relative",children:[l.jsx("button",{ref:m,onClick:()=>{a||f(w()),o(!a)},className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:l.jsx(up,{})}),a&&l.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${d==="right"?"left-0":"right-0"}`,children:[l.jsxs("button",{onClick:k,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[l.jsx(cp,{className:"w-4 h-4"}),"Copy"]}),s&&n!==void 0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t border-border my-1"}),l.jsxs("button",{onClick:v,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[l.jsx(hp,{className:"w-4 h-4"}),"Replay"]})]})]})]})]})})}function Q6({message:e}){const[t,n]=R.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,a=(s==null?void 0:s.color)??"#6b7280",o=(s==null?void 0:s.name)??"Agent",u=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[u]??"injected",f=u==="workflow"||u==="subagent";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[l.jsx("span",{className:"flex-1 h-px bg-border"}),l.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${f?"":"cursor-pointer"}`,style:{backgroundColor:a},onClick:()=>!f&&n(!0)}),l.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:a},onClick:()=>!f&&n(!0),children:o}),l.jsx("span",{children:"·"}),l.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&n(!0),children:d}),l.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&l.jsx("div",{className:"flex justify-center feed-item mb-4",children:l.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${a}`},children:l.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),l.jsx(kt,{isOpen:t,onClose:()=>n(!1),title:`${o} Prompt`,size:"lg",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:a}}),l.jsx("span",{className:"text-sm text-text-primary font-medium",children:o}),l.jsxs("span",{className:"text-xs text-text-muted",children:["(",u,")"]})]}),l.jsx("div",{className:"h-full min-h-96",children:l.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function J6({message:e,messageIndex:t,sessionId:n}){const s=e.messageKind==="auto-prompt",a=e.messageKind==="command",o=e.isSystemGenerated;return l.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!o&&l.jsx(X6,{content:e.content,align:"right",messageIndex:t,sessionId:n}),l.jsxs("div",{className:`max-w-[75%] rounded p-2 ${o?a?"bg-teal-500/10 border border-teal-500/30":s?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-text-primary"}`,children:[o&&l.jsx("span",{className:`text-[10px] block mb-0.5 ${a?"text-teal-400":s?"text-slate-400":"text-amber-400"}`,children:a?"Command":s?"Auto":"System"}),l.jsx("div",{className:`whitespace-pre-wrap text-sm ${o?`${a?"text-teal-200":s?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&l.jsx(Y6,{attachments:e.attachments,messageId:e.id})]})]})}const TC=R.memo(function({message:t,isLastAssistantMessage:n=!1,messageIndex:s,sessionId:a}){const o=t.role==="user",u=t.role==="assistant",c=t.role==="system",d=t.role==="tool";if(u)return l.jsx(sg,{message:t,showStats:n});if(c&&t.isCompacted)return l.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[l.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),l.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:t.content.replace(`[COMPACTED HISTORY]
|
|
284
|
-
`,"")})]});if(d)return l.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[l.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",t.toolName]}),l.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[t.content.slice(0,500),t.content.length>500&&"..."]})]});if(t.messageKind==="workflow-started")try{const f=JSON.parse(t.content);return l.jsx(K6,{data:f})}catch{}if(t.messageKind==="task-completed")try{const f=JSON.parse(t.content);return l.jsx(q6,{data:f})}catch{}return t.messageKind==="context-reset"?l.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[l.jsx("div",{className:"flex-1 border-t border-border"}),l.jsx("span",{children:t.content}),l.jsx("div",{className:"flex-1 border-t border-border"})]}):t.messageKind==="auto-prompt"&&t.isSystemGenerated?l.jsx(Q6,{message:t}):t.messageKind==="correction"&&t.isSystemGenerated?l.jsx("div",{className:"flex justify-end feed-item",children:l.jsxs("div",{className:"max-w-[75%] rounded p-2 bg-amber-500/10 border border-amber-500/30",children:[l.jsx("span",{className:"text-[10px] block mb-0.5 text-amber-400",children:"System"}),l.jsx("div",{className:"whitespace-pre-wrap text-sm text-amber-200 italic",children:t.content})]})}):o?l.jsx(J6,{message:t,messageIndex:s,sessionId:a}):l.jsx("div",{className:"flex justify-start feed-item",children:l.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:l.jsx(us,{content:t.content})})})}),NC=(e,t)=>{const n=R.useRef(!0),s=R.useRef(null),[a,o]=R.useState(!0),u=()=>{const c=e.current;c&&(c.scrollTop=c.scrollHeight)};return R.useEffect(()=>{const c=e.current;if(!c)return;const d=_=>{if(_.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{c.scrollHeight-c.scrollTop-c.offsetHeight<100&&(n.current=!0,o(!0))}));return}n.current=!1,o(!1)},f=_=>{_.touches[0]&&(s.current=_.touches[0].clientY)},p=_=>{if(s.current===null)return;const w=_.touches[0];if(!w)return;if(w.clientY-s.current>0){n.current=!1,o(!1);return}requestAnimationFrame(()=>requestAnimationFrame(()=>{c.scrollHeight-c.scrollTop-c.offsetHeight<100&&(n.current=!0,o(!0))}))},m=new MutationObserver(()=>{n.current&&requestAnimationFrame(u)}),x=setInterval(()=>{n.current&&u()},1e3);return c.addEventListener("wheel",d,{passive:!0}),c.addEventListener("touchstart",f,{passive:!0}),c.addEventListener("touchmove",p,{passive:!0}),m.observe(c,{childList:!0,subtree:!0,characterData:!0}),()=>{c.removeEventListener("wheel",d),c.removeEventListener("touchstart",f),c.removeEventListener("touchmove",p),m.disconnect(),clearInterval(x)}},[t==null?void 0:t.id]),{force_scroll_to_bottom:()=>{n.current=!0,o(!0),u()},isAutoScrollActive:a,setAutoScroll:c=>{n.current=c,o(c),c&&u()}}},Z6={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function eB(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function B0(e,t){return t||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function tB({contextState:e}){const{currentTokens:t,maxTokens:n,compactionCount:s,dangerZone:a}=e,o=Math.round(t/n*100);return l.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[l.jsxs("span",{className:B0(o,a),children:[pu(t),"/",pu(n)]}),l.jsxs("span",{className:B0(o,a),children:["(",o,"%)"]}),l.jsx(qS,{percent:o,dangerZone:a,size:"sm"}),a&&l.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&l.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const nB=R.memo(function({messages:t,subAgentType:n,subAgentId:s,isStreaming:a}){const o=R.useRef(null),u=R.useRef(null),[c,d]=R.useState(!1),f=ht(L=>L.defaults),p=ht(L=>L.userItems),m=[...f,...p],x=we(L=>L.subAgentContextStates[s]),{showThinking:_,showVerboseToolOutput:w}=Pu(),{isAutoScrollActive:k,setAutoScroll:v}=NC(u,null);R.useEffect(()=>{a||v(!0)},[a]);const S=R.useCallback(()=>{const L=!c;d(L),L&&setTimeout(()=>{var A;(A=o.current)==null||A.scrollIntoView({block:"start",behavior:"smooth"})},220)},[c]),y=m.find(L=>L.id===n),b=(y==null?void 0:y.name)??Z6[n]??n,E=ll(m,n),N=eB(E),T=t.filter(L=>L.role!=="tool");return l.jsxs("div",{ref:o,className:"feed-item border border-border rounded overflow-hidden bg-secondary",children:[l.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:N,children:[l.jsx("span",{className:"text-xs font-medium",children:b}),l.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:x&&l.jsx(tB,{contextState:x})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>v(!k),children:[l.jsx("span",{className:`w-1 h-1 rounded-full ${k?"bg-accent-success":"border border-text-muted"}`}),"live"]}),l.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:S,children:[c?"▼":"▶"," Expand"]})]})]}),l.jsx("div",{ref:u,className:`${c?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:T.map(L=>L.role==="assistant"?l.jsx(sg,{message:L,showStats:!0,showThinking:_,showVerboseToolOutput:w},L.id):l.jsx(TC,{message:L,isLastAssistantMessage:!1},L.id))})]})});function AC(e,t,n=!0){R.useEffect(()=>{if(!n)return;const s=a=>{var o;(o=e.current)!=null&&o.contains(a.target)||t()};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[e,t,n])}const rB=[],sB=R.memo(function({displayItems:t,scrollContainerRef:n,highlightedMessageId:s}){const a=we(M=>{var D,U;return((U=(D=M.currentSession)==null?void 0:D.metadataEntries)==null?void 0:U.criteria)??rB}),o=we(M=>{var D;return(D=M.currentSession)==null?void 0:D.id}),u=we(M=>{var D;return(D=M.currentSession)==null?void 0:D.mode}),c=we(M=>{var D;return(D=M.currentSession)==null?void 0:D.phase}),d=we(M=>M.error),f=we(M=>M.clearError),p=we(M=>M.acceptAndBuild),m=Hu(),{showThinking:x,showVerboseToolOutput:_,showStats:w,showAgentDefinitions:k,showWorkflowBars:v}=Pu(),S=Ct(M=>M.defaults),y=Ct(M=>M.userItems),b=[...S,...y],E=u==="planner",N=a.length>0,T=c==="done",L=t.some(M=>M.type==="message"&&M.message.role==="assistant"),A=E&&N&&!m&&L&&!T;return l.jsxs("div",{ref:n,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative bg-primary",children:[l.jsx("div",{className:"pt-4",children:t.map((M,D)=>{if(M.type==="context-divider")return l.jsxs("div",{"data-item-index":D,className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[l.jsx("div",{className:"flex-1 border-t border-border"}),l.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),l.jsx("div",{className:"flex-1 border-t border-border"})]},D);if(M.type==="subagent"){const Y=M.messages.some(W=>W.isStreaming);return l.jsx("div",{"data-item-index":D,className:"px-2 md:px-4",children:l.jsx(nB,{messages:M.messages,subAgentType:M.subAgentType,subAgentId:M.subAgentId,isStreaming:Y})},D)}if(M.type==="criteria-batch")return l.jsx("div",{"data-item-index":D,className:"feed-item px-2 md:px-4",children:l.jsx(jC,{toolCalls:M.toolCalls,criteria:a})},D);const U=M.message;if(U.role==="assistant")return l.jsx("div",{"data-item-index":D,className:"px-2 md:px-4",children:l.jsx(sg,{message:U,showStats:w,showThinking:x,showVerboseToolOutput:_})},D);const F=!k&&U.messageKind==="auto-prompt",B=!v&&(U.messageKind==="workflow-started"||U.messageKind==="task-completed");return F||B?null:l.jsx("div",{"data-item-index":D,className:"px-2 md:px-4",children:l.jsx("div",{"data-message-id":U.id,className:s===U.id?"rounded animate-highlight-fade":void 0,children:l.jsx(TC,{message:U,messageIndex:D,sessionId:o,isLastAssistantMessage:!1})})},D)})}),l.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[d&&l.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-red-400 text-sm font-medium",children:d.code}),l.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:d.message})]}),l.jsx(bl,{onClick:f,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),A&&l.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:b.map(M=>{const D=M.color??"#3b82f6",U=parseInt(D.slice(1,3),16),F=parseInt(D.slice(3,5),16),B=parseInt(D.slice(5,7),16),Y=`rgba(${U},${F},${B},0.12)`,W=`rgba(${U},${F},${B},0.22)`,H=`rgba(${U},${F},${B},0.25)`;return l.jsx(iB,{workflowName:M.name,color:D,bg:Y,bgHover:W,border:H,subGroups:M.subGroups,onLaunch:K=>p(M.id,void 0,void 0,K)},M.id)})})]})]})});function iB({workflowName:e,color:t,bg:n,bgHover:s,border:a,subGroups:o,onLaunch:u}){const[c,d]=R.useState(!1),f=R.useRef(null);return AC(f,()=>d(!1),c),l.jsxs("div",{className:"relative flex",children:[l.jsxs("button",{onClick:()=>u(),"data-testid":"workflow-run-button",className:"px-4 py-1.5 rounded-l text-sm font-medium transition-colors",style:{backgroundColor:n,color:t,border:`1px solid ${a}`,borderRight:"none"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=s},onMouseLeave:p=>{p.currentTarget.style.backgroundColor=n},children:["▶ ",e]}),o&&o.length>0&&l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>d(!c),className:"px-1.5 py-1.5 rounded-r text-sm font-medium transition-colors",style:{backgroundColor:n,color:t,border:`1px solid ${a}`},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=s},onMouseLeave:p=>{p.currentTarget.style.backgroundColor=n},children:"⋮"}),c&&l.jsxs("div",{className:"absolute top-full right-0 mt-1 w-40 bg-bg-secondary border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[l.jsx("button",{onClick:()=>{u(),d(!1)},className:"w-full text-left px-3 py-2 text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:"Full workflow"}),l.jsx("div",{className:"border-t border-border/50"}),o.map(p=>l.jsx("button",{onClick:()=>{u(p),d(!1)},className:"w-full text-left px-3 py-2 text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:p},p))]})]})]})}function aB({question:e}){const t=we(u=>u.answerQuestion),[n,s]=R.useState(""),a=()=>{t(e.callId,n)},o=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),a())};return l.jsx(kt,{isOpen:!0,onClose:()=>{},size:"sm",closeOnBackdropClick:!1,closeOnEscape:!1,showCloseButton:!1,children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-sm text-text-primary",children:e.question}),l.jsx("textarea",{value:n,onChange:u=>s(u.target.value),onKeyDown:o,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{variant:"secondary",size:"sm",onClick:()=>t(e.callId,""),children:"Skip"}),l.jsx(Je,{variant:"primary",size:"sm",onClick:a,children:"Send Answer"})]})]})})}function oB(){const e=we(s=>s.connectionStatus),t=we(s=>s.reconnect);if(e==="connected")return null;const n=e==="reconnecting";return l.jsxs("div",{className:`
|
|
285
|
-
flex items-center justify-between px-4 py-2
|
|
286
|
-
text-sm font-medium
|
|
287
|
-
${n?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
|
|
288
|
-
`,children:[l.jsx("div",{className:"flex items-center gap-2",children:n?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"flex gap-1",children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),l.jsx("span",{children:"Reconnecting to server..."})]}):l.jsxs(l.Fragment,{children:[l.jsx(Oj,{}),l.jsx("span",{children:"Connection lost"})]})}),l.jsx("button",{onClick:()=>t(),disabled:n,className:`
|
|
289
|
-
px-3 py-1 rounded text-xs font-medium
|
|
290
|
-
transition-colors
|
|
291
|
-
${n?"bg-amber-500/20 text-amber-400 cursor-not-allowed opacity-50":"bg-red-500/20 text-red-300 hover:bg-red-500/30 hover:text-red-200"}
|
|
292
|
-
`,children:n?"Reconnecting...":"Reconnect"})]})}const en=qn((e,t)=>({defaults:[],userItems:[],projectItems:[],loading:!1,fetchCommands:async()=>{await gp("/api/commands",e,!0)},fetchCommand:async n=>{try{const s=await Te(`/api/commands/${n}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async n=>{try{const s=await Te(`/api/commands/defaults/${n}`);return s.ok?await s.json():null}catch{return null}},createCommand:async(n,s)=>{const a=await Ws("POST","/api/commands",{...n,destination:s});return a.success&&await t().fetchCommands(),a},updateCommand:async(n,s)=>{const a=await Ws("PUT",`/api/commands/${n}`,s);return a.success&&await t().fetchCommands(),a},deleteCommand:async n=>{try{const s=await Te(`/api/commands/${n}`,{method:"DELETE"}),a=await s.json();return s.ok?(e(o=>({userItems:o.userItems.filter(u=>u.id!==n)})),{success:!0}):{success:!1,error:a.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async(n,s)=>zu(`/api/commands/${n}/duplicate`,()=>t().fetchCommands(),s)}));function lB(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function cB({onClick:e}){return l.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:l.jsx(fu,{})})}function LC({isOpen:e,onClose:t,initialEditId:n}){const s=en(fe=>fe.defaults),a=en(fe=>fe.userItems),o=en(fe=>fe.projectItems),u=en(fe=>fe.loading),c=en(fe=>fe.fetchCommands),d=en(fe=>fe.fetchCommand),f=en(fe=>fe.fetchDefaultContent),p=en(fe=>fe.createCommand),m=en(fe=>fe.updateCommand),x=en(fe=>fe.deleteCommand),[_,w]=R.useState(null),[k,v]=R.useState(null),{view:S,editingId:y,formError:b,saving:E,formData:N,setView:T,setEditingId:L,setFormError:A,setFormData:M,setSaving:D}=AS(),{requestDelete:U,clearConfirm:F,isConfirming:B}=xp(),Y=R.useRef(!1),W=ht(fe=>fe.defaults),H=ht(fe=>fe.userItems),K=ht(fe=>fe.fetchAgents),P=[...W,...H].filter(fe=>!fe.subagent),O=R.useRef(c),z=R.useRef(K),V=R.useRef(d),$=R.useRef(f),ee=R.useRef(n),Z=R.useRef(T),re=R.useRef(L),Q=R.useRef(A),G=R.useRef(F);R.useEffect(()=>{O.current=c,z.current=K,V.current=d,$.current=f,ee.current=n,Z.current=T,re.current=L,Q.current=A,G.current=F}),R.useEffect(()=>{if(e)if(O.current(),z.current(),Y.current||(G.current(),Y.current=!0),ee.current){const fe=s.some(je=>je.id===ee.current);Z.current("edit"),re.current(ee.current),Q.current(""),fe?$.current(ee.current).then(je=>{je&&M({name:je.metadata.name+" (copy)",id:`${ee.current}-copy-${Date.now()}`,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!0,destination:"user"})}):V.current(ee.current).then(je=>{je&&M({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1,destination:"user"})})}else Z.current("list"),re.current(null);else Y.current=!1},[e]);const te=async fe=>{w(fe);const je=await f(fe);v((je==null?void 0:je.prompt)??null)},se=async fe=>{if(s.some(ot=>ot.id===fe)){const ot=await f(fe);ot&&(L(null),M({name:`${ot.metadata.name} (copy)`,id:`${fe}-copy-${Date.now()}`,prompt:ot.prompt,agentMode:ot.metadata.agentMode??"",isDefault:!0,destination:"user"}),A(""),T("edit"))}else{const ot=await d(fe);ot&&(L(null),M({name:`${ot.metadata.name} (copy)`,id:`${fe}-copy-${Date.now()}`,prompt:ot.prompt,agentMode:ot.metadata.agentMode??"",isDefault:!1,destination:"user"}),A(""),T("edit"))}},_e=()=>{M({name:"",id:"",prompt:"",agentMode:"",isDefault:!1,destination:"user"}),L(null),T("edit")},ye=async fe=>{const je=await d(fe);je&&(L(fe),M({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1,destination:"user"}),A(""),T("edit"))},Ae=async fe=>{await x(fe),F()},De=async()=>{const fe=y??N.id;if(!fe||!N.name||!N.prompt){A("Name and message are required.");return}D(!0),A("");const je={metadata:{id:fe,name:N.name,...N.agentMode?{agentMode:N.agentMode}:{}},prompt:N.prompt},ot=y?await m(y,je):await p(je,N.destination);if(D(!1),!ot.success){A(ot.error??"Failed to save command.");return}n?t():T("list")},Me=()=>{n?t():(T("list"),w(null),v(null))},$e=fe=>{M(je=>({...je,name:fe})),(!y||N.isDefault)&&M(je=>({...je,id:lB(fe)}))},de=()=>{w(null),v(null),T("list")},Ie=()=>{_&&(w(null),T("edit"),L(_),f(_).then(fe=>{fe&&M({name:`${fe.metadata.name} (copy)`,id:`${_}-copy-${Date.now()}`,prompt:fe.prompt,agentMode:fe.metadata.agentMode??"",isDefault:!0,destination:"user"})}))};if(_){const fe=s.find(je=>je.id===_);return l.jsx(kt,{isOpen:e,onClose:de,title:`Default: ${(fe==null?void 0:fe.name)??_}`,size:"xl",children:l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"space-y-3 mb-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[l.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),l.jsx("span",{className:"font-mono",children:_})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),l.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:fe==null?void 0:fe.name})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),l.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(fe==null?void 0:fe.agentMode)||"None"})]})]}),l.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),l.jsx("textarea",{value:k??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[l.jsx(Je,{variant:"secondary",onClick:de,children:"Close"}),l.jsx(Je,{variant:"primary",onClick:Ie,children:"Duplicate & Customize"})]})]})})}if(S==="edit")return l.jsx(kt,{isOpen:e,onClose:Me,title:y?"Edit Command":"New Command",size:"xl",children:l.jsxs("div",{className:"flex flex-col h-full",children:[b&&l.jsx(vp,{message:b}),l.jsxs("div",{className:"space-y-3 mb-3",children:[l.jsx(NS,{name:N.name,id:N.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!y&&!N.isDefault,onNameChange:$e,onIdChange:fe=>M(je=>({...je,id:fe}))}),l.jsxs("div",{children:[l.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",l.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),l.jsxs("select",{value:N.agentMode,onChange:fe=>M(je=>({...je,agentMode:fe.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[l.jsx("option",{value:"",children:"None (keep current mode)"}),P.map(fe=>l.jsx("option",{value:fe.id,children:fe.name},fe.id))]})]}),!y&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("label",{className:"text-xs text-text-secondary",children:"Save to:"}),l.jsxs("select",{value:N.destination,onChange:fe=>M(je=>({...je,destination:fe.target.value})),className:"px-2 py-1 bg-bg-tertiary border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[l.jsx("option",{value:"user",children:"Global config"}),l.jsx("option",{value:"project",children:"Project (.openfox/)"})]})]})]}),l.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),l.jsx("textarea",{value:N.prompt,onChange:fe=>M(je=>({...je,prompt:fe.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[l.jsx(Je,{variant:"secondary",onClick:Me,children:"Cancel"}),l.jsx(Je,{variant:"primary",onClick:De,disabled:E||!N.name||!N.prompt,children:E?"Saving...":"Save"})]})]})});const Se=fe=>fe.map(je=>l.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[l.jsx("div",{className:"min-w-0 flex-1 mr-3",children:l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-text-primary text-sm font-medium",children:je.name})})}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.jsx(Fs,{onClick:()=>ye(je.id)}),l.jsx(mu,{onClick:()=>se(je.id)}),B(je.id,"delete")?l.jsx(_p,{onConfirm:()=>Ae(je.id),onCancel:F}):l.jsx(yp,{onClick:()=>U(je.id)})]})]},je.id));return l.jsxs(kt,{isOpen:e,onClose:t,title:"Commands",size:"lg",children:[l.jsx(ES,{description:"Commands are pre-defined messages you can send with a single click.",onNew:_e}),l.jsxs(TS,{loading:u,hasItems:s.length>0||a.length>0||o.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),l.jsx("div",{className:"space-y-2",children:s.map(fe=>l.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[l.jsx("div",{className:"min-w-0 flex-1 mr-3",children:l.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name})}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.jsx(cB,{onClick:()=>te(fe.id)}),l.jsx(mu,{onClick:()=>se(fe.id)})]})]},fe.id))})]}),a.length>0&&l.jsx(kS,{children:Se(a)}),o.length>0&&l.jsxs("div",{className:"mt-4",children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Project"}),l.jsx("div",{className:"space-y-2",children:Se(o)})]})]})]})}const gi=150,ss=54,au=80,pr=30,Na=70,z0=100,xi=50,ou=50,H0=4,DC={step_result:"Result",metadata_all_match:"Metadata match",metadata_all_in:"Metadata in",always:"otherwise"},RC=[{value:"step_result",label:"Step result is..."},{value:"metadata_all_match",label:"Metadata all match (key=value)"},{value:"metadata_all_in",label:"Metadata all in list"},{value:"always",label:"Always (fallback)"}],uB=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}];function ig(e,t){if(e.type==="agent"){const n=t.find(s=>s.id===e.agentId);return{name:(n==null?void 0:n.name)??(e.agentId||"Agent"),color:(n==null?void 0:n.color)||"#3b82f6"}}if(e.type==="sub_agent"){const n=t.find(s=>s.id===e.subAgentType);return{name:(n==null?void 0:n.name)??(e.subAgentType||"Sub-Agent"),color:(n==null?void 0:n.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function dB(e,t,n,s){const a=ou+xi+gi+z0+gi+xi+ou,o=a/2,u=ou+xi+gi/2,c=ou+xi+gi+z0+gi/2,d=[],f=[],p=new Map,m=e.filter(W=>W.type==="agent"||W.type==="shell"),x=e.filter(W=>W.type==="sub_agent"),_=x.length>0,w=_?u:o,k=m.length>0?c:o,v=xi+pr/2;d.push({id:"$start",type:"terminal",label:"Start",cx:w,cy:v,w:au,h:pr}),p.set("$start",{cx:w,cy:v,w:au,h:pr});const S=W=>{d.push({id:"$done",type:"terminal",label:"Done",cx:w,cy:W,w:au,h:pr}),p.set("$done",{cx:w,cy:W,w:au,h:pr})};if(e.length===0){const W=v+pr/2+Na*2+pr/2;return S(W),{nodes:d,edges:f,width:a,height:W+pr/2+xi,posMap:p}}const y=v+pr/2+Na,b=(W,H)=>{W.forEach((K,X)=>{const P=y+X*(ss+Na)+ss/2,{name:O,color:z}=ig(K,s);d.push({id:K.id,type:"step",label:O,color:z,cx:H,cy:P,w:gi,h:ss}),p.set(K.id,{cx:H,cy:P,w:gi,h:ss})})};b(m,w),b(x,k);const E=m.length>0?y+(m.length-1)*(ss+Na)+ss/2:v,N=_?y+(x.length-1)*(ss+Na)+ss/2:v,T=Math.max(E,N)+ss/2+Na+pr/2;S(T);const L=[];t&&p.has(t)&&L.push({from:"$start",to:t,label:n,edgeKey:"start",direction:"down",backEdgeIndex:0});let A=0;for(const W of e)W.transitions.forEach((H,K)=>{var $;if(!H.goto||!p.has(H.goto))return;const X=p.get(W.id),P=p.get(H.goto),O=H.when.type==="step_result"?`${H.when.result}`:H.when.type==="metadata_all_match"?`${H.when.key??"?"}=${H.when.value??"?"}`:H.when.type==="metadata_all_in"?`${H.when.key??"?"} in [${(($=H.when.values)==null?void 0:$.join(","))??"?"}]`:DC[H.when.type]??H.when.type,z=W.id===H.goto;let V;z?V="back":P.cy>X.cy+1?V="down":P.cy<X.cy-1?V="back":V="same",L.push({from:W.id,to:H.goto,label:O,edgeKey:`${W.id}:${K}`,direction:V,backEdgeIndex:V==="back"?A++:0})});const M=new Map,D=new Map,U=new Map,F=new Map;for(const W of L)W.direction==="down"&&(M.set(W.from,(M.get(W.from)??0)+1),D.set(W.to,(D.get(W.to)??0)+1));const B=new Map,Y=new Map;for(const W of L){if(W.direction!=="same")continue;const H=[W.from,W.to].sort().join("|");B.set(H,(B.get(H)??0)+1)}for(const W of L){if(W.direction==="back"||W.direction==="same"){let V=0;if(W.direction==="same"){const $=[W.from,W.to].sort().join("|");V=Y.get($)??0,Y.set($,V+1)}f.push({...W,fromPort:0,toPort:0,sameEdgeIndex:V});continue}const H=M.get(W.from)??1,K=D.get(W.to)??1,X=U.get(W.from)??0,P=F.get(W.to)??0;U.set(W.from,X+1),F.set(W.to,P+1);const O=H===1?0:-.6+1.2*X/(H-1),z=K===1?0:-.6+1.2*P/(K-1);f.push({...W,fromPort:O,toPort:z,sameEdgeIndex:0})}return{nodes:d,edges:f,width:a,height:T+pr/2+xi,posMap:p}}function hB({steps:e,entryStep:t,selectedNodeId:n,selectedEdgeKey:s,startConditionLabel:a,agentTypes:o,isReadOnly:u,onSelectNode:c,onSelectEdge:d,onRemoveStep:f,onCreateTransition:p,onReconnectTo:m,onReconnectFrom:x,onDeleteTransition:_}){const w=R.useRef(null),k=R.useRef(!1),[v,S]=R.useState(null),[y,b]=R.useState(null),[E,N]=R.useState(null),{nodes:T,edges:L,width:A,height:M,posMap:D}=R.useMemo(()=>dB(e,t,a,o),[e,t,a,o]),U=R.useCallback(Z=>{var se;const re=w.current;if(!re)return{x:0,y:0};const Q=re.createSVGPoint();Q.x=Z.clientX,Q.y=Z.clientY;const G=(se=re.getScreenCTM())==null?void 0:se.inverse();if(!G)return{x:0,y:0};const te=Q.matrixTransform(G);return{x:te.x,y:te.y}},[]),F=R.useCallback(Z=>!Z||!y||Z==="$start"?!1:y.type==="reconnect-from"?Z!=="$done":!0,[y]),B=R.useCallback((Z,re)=>{if(u)return;Z.stopPropagation(),Z.preventDefault();const Q=U(Z);b({type:"new",fromNodeId:re,mouseX:Q.x,mouseY:Q.y})},[U,u]),Y=R.useCallback((Z,re)=>{if(u)return;Z.stopPropagation(),Z.preventDefault();const Q=U(Z);b({type:"reconnect-to",fromNodeId:re.from,edgeKey:re.edgeKey,mouseX:Q.x,mouseY:Q.y})},[U,u]),W=R.useCallback((Z,re)=>{if(u)return;Z.stopPropagation(),Z.preventDefault();const Q=U(Z);b({type:"reconnect-from",fromNodeId:re.from,fixedTargetId:re.to,edgeKey:re.edgeKey,mouseX:Q.x,mouseY:Q.y})},[U,u]),H=R.useCallback(Z=>{if(!y)return;const re=U(Z);b(Q=>Q?{...Q,mouseX:re.x,mouseY:re.y}:null)},[y,U]),K=R.useCallback(()=>{y&&(k.current=!0,E&&F(E)&&(y.type==="new"?p(y.fromNodeId,E):y.type==="reconnect-to"?m(y.edgeKey,E):y.type==="reconnect-from"&&x(y.edgeKey,E)),b(null),N(null))},[y,E,F,p,m,x]),X=R.useCallback(()=>{if(k.current){k.current=!1;return}c(null),d(null)},[c,d]);R.useEffect(()=>{if(u)return;const Z=re=>{re.target instanceof HTMLInputElement||re.target instanceof HTMLTextAreaElement||re.target instanceof HTMLSelectElement||(re.key==="Delete"||re.key==="Backspace")&&s&&s!=="start"&&(re.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[u,s,_,d]);const P=Z=>{const re=D.get(Z.from),Q=D.get(Z.to);if(!re||!Q)return null;let G,te,se,_e="middle",ye,Ae;if(Z.direction==="down"){const De=re.cx+Z.fromPort*(re.w/2-10),Me=re.cy+re.h/2,$e=Q.cx+Z.toPort*(Q.w/2-10),de=Q.cy-Q.h/2,Ie=de-Me,Se=$e-De;G=`M ${De} ${Me} C ${De} ${Me+Ie*.4}, ${$e-Se*.2} ${de-Ie*.1}, ${$e} ${de}`,te=De+($e-De)*.5,se=Me+Ie*.6,ye={x:De,y:Me},Ae={x:$e,y:de}}else if(Z.direction==="back"){const De=Z.from===Z.to,Me=re.cx>=A/2,$e=Z.backEdgeIndex*16,de=Me?A-20-$e:20+$e;if(De){const Ie=re.cx>=A/2,Se=30+Z.backEdgeIndex*14,fe=re.cy-re.h/2,je=Ie?re.cx+re.w/2:re.cx-re.w/2,ot=Ie?je+Se:je-Se,Ut=re.cx+(Ie?re.w/4:-re.w/4),St=fe-20-Z.backEdgeIndex*10;G=`M ${je} ${re.cy} C ${ot} ${re.cy}, ${ot} ${St}, ${Ut} ${fe}`,te=ot+10,se=St+4,_e="middle",ye={x:je,y:re.cy},Ae={x:Ut,y:fe}}else{const Ie=Me?re.cx+re.w/2:re.cx-re.w/2,Se=Q.cx+(Me?Q.w/4:-Q.w/4),fe=Math.min(re.cy,Q.cy)-Q.h/2-18-Z.backEdgeIndex*14;G=`M ${Ie} ${re.cy} L ${de} ${re.cy} L ${de} ${fe} L ${Se} ${fe} L ${Se} ${Q.cy-Q.h/2}`,te=de,se=(re.cy+fe)/2,_e=Me?"start":"end",ye={x:Ie,y:re.cy},Ae={x:Se,y:Q.cy-Q.h/2}}}else{const De=Q.cx>re.cx,Me=Z.sameEdgeIndex===0?-12:12,$e=De?re.cx+re.w/2:re.cx-re.w/2,de=De?Q.cx-Q.w/2:Q.cx+Q.w/2,Ie=re.cy+Me,Se=Q.cy+Me,fe=($e+de)/2;G=`M ${$e} ${Ie} C ${fe} ${Ie}, ${fe} ${Se}, ${de} ${Se}`,te=fe,se=(Ie+Se)/2-6,ye={x:$e,y:Ie},Ae={x:de,y:Se}}return{path:G,labelX:te,labelY:se,labelAnchor:_e,fromPt:ye,toPt:Ae}},O=(Z,re)=>{const Q=P(Z);if(!Q)return null;const{path:G,labelX:te,labelY:se,labelAnchor:_e}=Q,ye=s===Z.edgeKey,Ae=Z.label&&Z.label!=="otherwise";return l.jsxs("g",{children:[l.jsx("path",{d:G,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:De=>{De.stopPropagation(),u||d(ye?null:Z.edgeKey)}}),l.jsx("path",{d:G,fill:"none",stroke:ye?"#58a6ff":"#484f58",strokeWidth:ye?2.2:1.2,markerEnd:ye?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Ae&&l.jsx("text",{x:te+(_e==="start"?5:_e==="end"?-5:0),y:se+3,textAnchor:_e,className:"text-[8px]",fill:ye?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Z.label})]},re)},z=()=>{if(!s||y)return null;const Z=L.find(se=>se.edgeKey===s);if(!Z)return null;const re=P(Z);if(!re)return null;const{fromPt:Q,toPt:G}=re,te=6;return l.jsxs(l.Fragment,{children:[Z.edgeKey!=="start"&&l.jsx("circle",{cx:Q.x,cy:Q.y,r:te,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>W(se,Z)}),l.jsx("circle",{cx:G.x,cy:G.y,r:te,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:se=>Y(se,Z)})]})},V=()=>{if(!y)return null;let Z,re,Q,G;if(y.type==="reconnect-from"){const _e=D.get(y.fixedTargetId);if(!_e)return null;Z=y.mouseX,re=y.mouseY,Q=_e.cx,G=_e.cy-_e.h/2}else{const _e=D.get(y.fromNodeId);if(!_e)return null;Z=_e.cx,re=_e.cy+_e.h/2,Q=y.mouseX,G=y.mouseY}const te=G-re,se=Math.abs(te)>10?`M ${Z} ${re} C ${Z} ${re+te*.4}, ${Q} ${G-te*.4}, ${Q} ${G}`:`M ${Z} ${re} L ${Q} ${G}`;return l.jsx("path",{d:se,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},$=Z=>{const re=Z.cy+Z.h/2,Q=(y==null?void 0:y.fromNodeId)===Z.id;return l.jsx("circle",{cx:Z.cx,cy:re,r:H0,fill:Q?"#58a6ff":"#1c2128",stroke:Q?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Q?1:.5,className:"cursor-crosshair",onMouseDown:G=>B(G,Z.id)})},ee=Z=>{const re=Z.cy-Z.h/2,Q=y&&E===Z.id&&F(Z.id);return l.jsx("circle",{cx:Z.cx,cy:re,r:H0,fill:Q?"#3fb950":"#1c2128",stroke:Q?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Q?1:.5})};return l.jsxs("svg",{ref:w,viewBox:`0 0 ${A} ${M}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:H,onMouseUp:K,onClick:X,children:[l.jsxs("defs",{children:[l.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:l.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),l.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:l.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),L.map((Z,re)=>O(Z,re)),T.map(Z=>{const re=n===Z.id,Q=Z.cx-Z.w/2,G=Z.cy-Z.h/2,te=v===Z.id,se=y&&E===Z.id&&F(Z.id);if(Z.type==="terminal"){const ye=Z.id==="$start",Ae=ye?"#58a6ff":"#3fb950",De=ye,Me=!ye;return l.jsxs("g",{onClick:$e=>{$e.stopPropagation(),ye&&!u&&d("start")},className:ye&&!u?"cursor-pointer":void 0,children:[se&&l.jsx("rect",{x:Q-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ye&&s==="start"&&l.jsx("rect",{x:Q-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),l.jsx("rect",{x:Q,y:G,width:Z.w,height:Z.h,rx:Z.h/2,fill:Ae,fillOpacity:.08,stroke:Ae,strokeOpacity:.4,strokeWidth:1.5}),l.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:Ae,className:"text-[10px] font-medium",pointerEvents:"none",children:Z.label}),De&&$(Z),Me&&ee(Z)]},Z.id)}const _e=Z.color??"#6b7280";return l.jsxs("g",{onClick:ye=>{ye.stopPropagation(),u||c(re?null:Z.id)},onMouseEnter:()=>S(Z.id),onMouseLeave:()=>S(null),className:u?void 0:"cursor-pointer",children:[se&&l.jsx("rect",{x:Q-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),re&&l.jsx("rect",{x:Q-3,y:G-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),l.jsx("rect",{x:Q,y:G,width:Z.w,height:Z.h,rx:10,fill:_e,fillOpacity:.08,stroke:_e,strokeOpacity:.6,strokeWidth:re?2:1.5}),l.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Z.label}),!u&&$(Z),!u&&ee(Z),te&&!y&&!u&&l.jsxs("g",{onClick:ye=>{ye.stopPropagation(),f(Z.id)},className:"cursor-pointer",children:[l.jsx("circle",{cx:Q+Z.w-2,cy:G+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),l.jsx("line",{x1:Q+Z.w-5,y1:G-1,x2:Q+Z.w+1,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),l.jsx("line",{x1:Q+Z.w+1,y1:G-1,x2:Q+Z.w-5,y2:G+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Z.id)}),y&&T.map(Z=>F(Z.id)?l.jsx("rect",{x:Z.cx-Z.w/2-8,y:Z.cy-Z.h/2-8,width:Z.w+16,height:Z.h+16,fill:"transparent",rx:12,onMouseEnter:()=>N(Z.id),onMouseLeave:()=>N(null),onMouseUp:re=>{re.stopPropagation(),K()}},`drop-${Z.id}`):null),V(),z()]})}function fB({name:e,id:t,color:n,description:s,isBuiltIn:a,actions:o}){return l.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:n}}),l.jsx("span",{className:"text-text-primary text-sm font-medium",children:e}),l.jsx("span",{className:"text-text-muted text-xs font-mono",children:t}),a&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),s&&l.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:s})]}),l.jsx("div",{className:"flex items-center gap-1 flex-shrink-0 ml-3",children:o})]})}function $0({title:e,items:t,renderActions:n}){return t.length===0?null:l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),l.jsx("div",{className:"space-y-2",children:t.map(s=>l.jsx(fB,{name:s.name,id:s.id,color:s.color??"#3b82f6",description:s.description,actions:n(s)},s.id))})]})}const Aa="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",xm="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",is="block text-[11px] text-text-secondary mb-0.5";function _m({variables:e,onInsert:t}){return e.length===0?null:l.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(n=>l.jsx("button",{type:"button",onClick:()=>t(n.name),title:n.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${n.name}}}`},n.name))})}function mB({step:e,isEntry:t,agentTypes:n,transitionCount:s,templateVariables:a,onUpdate:o,onRemove:u,onSetEntry:c}){const{color:d,name:f}=ig(e,n);return l.jsxs("div",{className:"space-y-3 text-sm",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:f}),t&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[!t&&l.jsx("button",{onClick:c,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),l.jsx("button",{onClick:u,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Type"}),l.jsx("select",{value:e.type,onChange:p=>{const m=p.target.value,x=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=n.find(w=>!w.subagent);o({...e,type:m,phase:x,agentId:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=n.find(w=>w.subagent);o({...e,type:m,phase:x,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else o({...e,type:m,phase:x,name:"Shell"})},className:xm,children:uB.map(p=>l.jsx("option",{value:p.value,children:p.label},p.value))})]}),e.type==="agent"&&l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Agent Type"}),l.jsx("select",{value:e.agentId??"builder",onChange:p=>{const m=n.find(x=>x.id===p.target.value);o({...e,agentId:p.target.value,name:(m==null?void 0:m.name)??p.target.value})},className:xm,children:n.filter(p=>!p.subagent).map(p=>l.jsx("option",{value:p.id,children:p.name},p.id))})]}),e.type==="sub_agent"&&l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Sub-Agent Type"}),l.jsxs("select",{value:e.subAgentType??"",onChange:p=>{const m=n.find(x=>x.id===p.target.value);o({...e,subAgentType:p.target.value,name:(m==null?void 0:m.name)??p.target.value})},className:xm,children:[l.jsx("option",{value:"",children:"— select —"}),n.filter(p=>p.subagent).map(p=>l.jsx("option",{value:p.id,children:p.name},p.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Prompt"}),l.jsx("textarea",{value:e.prompt??"",onChange:p=>o({...e,prompt:p.target.value||void 0}),rows:6,className:`${Aa} resize-y text-xs`,placeholder:"Injected on first entry..."}),l.jsx(_m,{variables:a,onInsert:p=>o({...e,prompt:(e.prompt??"")+`{{${p}}}`})})]}),l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Nudge Prompt"}),l.jsx("textarea",{value:e.nudgePrompt??"",onChange:p=>o({...e,nudgePrompt:p.target.value||void 0}),rows:6,className:`${Aa} resize-y text-xs`,placeholder:"Injected on re-entry..."}),l.jsx(_m,{variables:a,onInsert:p=>o({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${p}}}`})})]})]}),e.type==="shell"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Command"}),l.jsx("textarea",{value:e.command??"",onChange:p=>o({...e,command:p.target.value}),rows:3,className:`${Aa} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),l.jsx(_m,{variables:a,onInsert:p=>o({...e,command:(e.command??"")+`{{${p}}}`})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Timeout (ms)"}),l.jsx("input",{type:"number",value:e.timeout??6e4,onChange:p=>o({...e,timeout:Number(p.target.value)}),className:`${Aa} font-mono text-xs`})]}),l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Success Codes"}),l.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:p=>o({...e,successExitCodes:p.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Aa} font-mono text-xs`})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:is,children:"Sub-group"}),l.jsx("input",{value:e.subGroup??"",onChange:p=>o({...e,subGroup:p.target.value||void 0}),placeholder:"e.g. build, verify, review",className:Aa})]}),l.jsx("div",{className:"pt-1 border-t border-border/50",children:l.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const La="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",U0="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",_i="block text-[11px] text-text-secondary mb-0.5";function pB({fromLabel:e,toLabel:t,condition:n,subGroup:s,fromStep:a,agentTypes:o,transitionIndex:u,totalTransitions:c,onUpdateCondition:d,onUpdateSubGroup:f,onDelete:p,onMoveUp:m,onMoveDown:x}){var k;const _=a&&(a.type==="sub_agent"||a.type==="agent")?o.find(v=>v.id===(a.type==="sub_agent"?a.subAgentType:a.agentId)):void 0,w=(_==null?void 0:_.results)&&_.results.length>0;return l.jsxs("div",{className:"space-y-3 text-sm",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:["#",u+1]}),c>1&&l.jsxs("div",{className:"flex items-center gap-0.5",children:[l.jsx("button",{onClick:m,disabled:u===0,className:"p-0.5 rounded text-text-muted hover:text-text-primary disabled:opacity-20 disabled:cursor-not-allowed",title:"Move up (higher priority)",children:l.jsx(Mr,{className:"w-3 h-3",rotate:180})}),l.jsx("button",{onClick:x,disabled:u===c-1,className:"p-0.5 rounded text-text-muted hover:text-text-primary disabled:opacity-20 disabled:cursor-not-allowed",title:"Move down (lower priority)",children:l.jsx(Mr,{className:"w-3 h-3"})})]})]}),l.jsx("button",{onClick:p,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),l.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[l.jsx("span",{className:"font-medium text-text-primary",children:e}),l.jsx(pS,{}),l.jsx("span",{className:"font-medium text-text-primary",children:t})]}),l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Condition"}),l.jsx("select",{value:n.type,onChange:v=>{d(v.target.value==="step_result"?{type:"step_result",result:"success"}:{type:v.target.value})},className:U0,children:RC.map(v=>l.jsx("option",{value:v.value,children:v.label},v.value))})]}),n.type==="step_result"&&l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Result"}),w?l.jsx("select",{value:n.result??_.results[0],onChange:v=>{d({type:"step_result",result:v.target.value})},className:U0,children:_.results.map(v=>l.jsx("option",{value:v,children:v},v))}):l.jsx("input",{type:"text",value:n.result??"success",onChange:v=>d({type:"step_result",result:v.target.value}),placeholder:"e.g. success, passed, failed",className:La})]}),(n.type==="metadata_all_match"||n.type==="metadata_all_in")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Metadata Key"}),l.jsx("input",{type:"text",value:n.key??"",onChange:v=>d({...n,key:v.target.value}),placeholder:"e.g. criteria, todos, review_findings",className:La})]}),l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Field"}),l.jsx("input",{type:"text",value:n.field??"",onChange:v=>d({...n,field:v.target.value}),placeholder:"e.g. status",className:La})]}),n.type==="metadata_all_match"?l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Value"}),l.jsx("input",{type:"text",value:n.value??"",onChange:v=>d({...n,value:v.target.value}),placeholder:"e.g. passed, resolved",className:La})]}):l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Values (comma-separated)"}),l.jsx("input",{type:"text",value:((k=n.values)==null?void 0:k.join(", "))??"",onChange:v=>d({...n,values:v.target.value.split(",").map(S=>S.trim()).filter(Boolean)}),placeholder:"e.g. resolved, dismissed",className:La})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:_i,children:"Sub-group"}),l.jsx("input",{type:"text",value:s??"",onChange:v=>f(v.target.value||void 0),placeholder:"e.g. build, verify",className:La})]}),l.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Order determines evaluation priority. Press Delete to remove."})]})}function gB(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function xB(e){let t=1;for(;e.some(n=>n.id===`s${t}`);)t++;return`s${t}`}const as="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",F0="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",gr="block text-[11px] text-text-secondary mb-0.5",V0=[];function OC({isOpen:e,onClose:t,initialEditId:n}){var zi,hs;const s=Ct(xe=>xe.defaults),a=Ct(xe=>xe.userItems),o=Ct(xe=>xe.loading),u=Ct(xe=>xe.templateVariables),c=Ct(xe=>xe.fetchWorkflows),d=Ct(xe=>xe.fetchWorkflow),f=Ct(xe=>xe.fetchDefaultContent),p=Ct(xe=>xe.fetchTemplateVariables),m=Ct(xe=>xe.createWorkflow),x=Ct(xe=>xe.updateWorkflow),_=Ct(xe=>xe.deleteWorkflow),{requestDelete:w,clearConfirm:k,isConfirming:v}=xp(),[S,y]=R.useState("list"),[b,E]=R.useState(null),[N,T]=R.useState(!1),[L,A]=R.useState(null),[M,D]=R.useState(null),[U,F]=R.useState(""),[B,Y]=R.useState(""),[W,H]=R.useState(""),[K,X]=R.useState("1.0.0"),[P,O]=R.useState("#3b82f6"),[z,V]=R.useState(""),[$,ee]=R.useState(50),[Z,re]=R.useState(V0),[Q,G]=R.useState({type:"always"}),[te,se]=R.useState(""),[_e,ye]=R.useState(!1),Ae=ht(xe=>xe.defaults),De=ht(xe=>xe.userItems),Me=ht(xe=>xe.projectItems),$e=R.useMemo(()=>[...Ae,...De,...Me],[Ae,De,Me]),de=ht(xe=>xe.fetchAgents),[Ie]=R.useState(null);R.useEffect(()=>{e&&(c(),p(),de(),A(null),D(null),n?s.some(ge=>ge.id===n)?f(n).then(ge=>{ge&&Se({...ge,metadata:{...ge.metadata,name:ge.metadata.name+" (copy)",id:`${n}-copy-${Date.now()}`}},{editingId:null,isReadOnly:!1})}):d(n).then(ge=>{ge&&Se(ge,{editingId:n,isReadOnly:!1})}):(y("list"),E(null),T(!1)))},[e,c,d,f,p,n]);const Se=(xe,ge)=>{F(xe.metadata.name),Y(xe.metadata.id),H(xe.metadata.description),X(xe.metadata.version),O(xe.metadata.color??"#3b82f6"),V(xe.entryStep),ee(xe.settings.maxIterations),re(xe.steps),G(xe.startCondition??{type:"always"}),se(""),(ge==null?void 0:ge.editingId)!==void 0&&E(ge.editingId),(ge==null?void 0:ge.isReadOnly)!==void 0&&T(ge.isReadOnly),(ge==null?void 0:ge.selectedNodeKey)!==void 0&&A(null),(ge==null?void 0:ge.selectedEdgeKey)!==void 0&&D(null),y("edit")},fe=async xe=>{const ge=await d(xe);ge&&Se(ge,{editingId:xe,isReadOnly:!1,selectedNodeKey:null,selectedEdgeKey:null})},je=async()=>{var Ze;const xe=b??B;if(!xe||!U)return se("Name is required."),!1;if(Z.length===0)return se("Add at least one step."),!1;let ge=z;if(!ge||!Z.some(Ge=>Ge.id===ge)){if(ge=((Ze=Z.find(Ge=>Ge.id))==null?void 0:Ze.id)??"",!ge)return se("All steps need an ID."),!1;V(ge)}ye(!0),se("");const Ne={metadata:{id:xe,name:U,description:W,version:K||"1.0.0",color:P},entryStep:ge,settings:{maxIterations:$},steps:Z,startCondition:Q},ze=b?await x(b,Ne):await m(Ne);return ye(!1),ze.success?(b||E(xe),!0):(se(ze.error??"Failed to save."),!1)},ot=async()=>{await je()},Ut=async()=>{await je()&&(n?t():y("list"))},St=()=>{n?t():y("list")},pn=xe=>{F(xe),b||Y(gB(xe))},me=async xe=>s.some(Ne=>Ne.id===xe)?await f(xe):await d(xe),Ee=async xe=>{const ge=await me(xe);ge&&Se(ge,{editingId:xe,isReadOnly:!0})},Oe=async xe=>{const ge=await me(xe);ge&&Se({...ge,metadata:{...ge.metadata,name:ge.metadata.name+" (copy)",id:`${xe}-copy-${Date.now()}`}},{editingId:null,isReadOnly:!1})},Fe=()=>{E(null),F(""),Y(""),H(""),X("1.0.0"),O("#3b82f6"),V(""),ee(50),re(structuredClone(V0)),G({type:"always"}),se(""),A(null),D(null),T(!1),y("edit")},Ke=async xe=>{await _(xe),k()},At=R.useCallback(xe=>{A(xe),D(null)},[]),et=R.useCallback(xe=>{D(xe),A(null)},[]),Lt=L!==null?Number(L):-1,ft=Lt>=0?Z[Lt]??null:null,gn=R.useCallback(xe=>{re(ge=>ge.map((Ne,ze)=>ze===Lt?xe:Ne))},[Lt]),pt=Q.type==="step_result"?`${Q.result}`:Q.type==="metadata_all_match"?`${Q.key??"?"}=${Q.value??"?"}`:Q.type==="metadata_all_in"?`${Q.key??"?"} in [${((zi=Q.values)==null?void 0:zi.join(","))??"?"}]`:DC[Q.type]??Q.type,cr=()=>{const xe=Z.length,ge=xB(Z),Ne=$e.find(ze=>!ze.subagent);re([...Z,{id:ge,name:(Ne==null?void 0:Ne.name)??"Agent",type:"agent",phase:"build",agentId:(Ne==null?void 0:Ne.id)??"builder",transitions:[]}]),z||V(ge),At(String(xe))},Mn=R.useCallback((xe,ge)=>{xe==="$start"?(V(ge),et("start")):re(Ne=>{const ze=Ne.find(Ge=>Ge.id===xe),Ze=ze?ze.transitions.length:0;return et(`${xe}:${Ze}`),Ne.map(Ge=>Ge.id===xe?{...Ge,transitions:[...Ge.transitions,{when:{type:"always"},goto:ge}]}:Ge)})},[et]),Mi=xe=>{if(xe==="start")return null;const ge=xe.lastIndexOf(":"),Ne=xe.slice(0,ge),ze=parseInt(xe.slice(ge+1));return{stepId:Ne,transIdx:ze}},ur=R.useCallback((xe,ge)=>{const Ne=Mi(xe);Ne&&re(ze=>ze.map(Ze=>Ze.id===Ne.stepId?{...Ze,transitions:Ze.transitions.map((Ge,ct)=>ct===Ne.transIdx?ge(Ge):Ge)}:Ze))},[]),Ii=R.useCallback((xe,ge)=>{if(xe==="start"){V(ge);return}ur(xe,Ne=>({...Ne,goto:ge}))},[ur]),Pi=R.useCallback((xe,ge)=>{const Ne=Mi(xe);Ne&&(re(ze=>{const Ze=ze.find(ct=>ct.id===Ne.stepId);if(!Ze)return ze;const Ge=Ze.transitions[Ne.transIdx];return Ge?ze.map(ct=>ct.id===Ne.stepId?{...ct,transitions:ct.transitions.filter((un,Mt)=>Mt!==Ne.transIdx)}:ct.id===ge?{...ct,transitions:[...ct.transitions,Ge]}:ct):ze}),D(null))},[]),Sr=R.useCallback(xe=>{if(xe==="start"){V(""),D(null);return}const ge=Mi(xe);ge&&(re(Ne=>Ne.map(ze=>ze.id===ge.stepId?{...ze,transitions:ze.transitions.filter((Ze,Ge)=>Ge!==ge.transIdx)}:ze)),D(null))},[]),Bi=R.useCallback((xe,ge)=>{if(xe==="start"){G(ge);return}ur(xe,Ne=>({...Ne,when:ge}))},[ur]),Ys=R.useCallback((xe,ge)=>{xe!=="start"&&ur(xe,Ne=>({...Ne,subGroup:ge||void 0}))},[ur]),Ya=xe=>ig(xe,$e).name,Nl=()=>{if(!M)return null;if(M==="start"){const un=Z.find(Mt=>Mt.id===z);return{type:"start",fromLabel:"Start",toLabel:un?Ya(un):"(none)",condition:Q}}const xe=M.lastIndexOf(":"),ge=M.slice(0,xe),Ne=parseInt(M.slice(xe+1)),ze=Z.find(un=>un.id===ge);if(!ze)return null;const Ze=ze.transitions[Ne];if(!Ze)return null;const Ge=Z.find(un=>un.id===Ze.goto),ct=Ze.goto==="$done"?"Done":Ge?Ya(Ge):Ze.goto;return{type:"step",fromLabel:Ya(ze),toLabel:ct,condition:Ze.when,subGroup:Ze.subGroup}};if(S==="edit"){const xe=Nl();return l.jsxs(kt,{isOpen:e,onClose:St,title:N?U:b?"Edit Workflow":"New Workflow",size:"full",children:[te&&l.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:te}),l.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[l.jsxs("div",{className:"min-w-[140px]",children:[l.jsx("label",{className:gr,children:"Name"}),l.jsx("input",{value:U,onChange:ge=>pn(ge.target.value),placeholder:"Workflow name",className:`${as} ${N?"opacity-50":""}`,readOnly:N})]}),l.jsxs("div",{className:"min-w-[100px]",children:[l.jsx("label",{className:gr,children:"ID"}),l.jsx("input",{value:B,readOnly:!0,className:`${as} font-mono opacity-50`})]}),l.jsxs("div",{className:"flex-1 min-w-[140px]",children:[l.jsx("label",{className:gr,children:"Description"}),l.jsx("input",{value:W,onChange:ge=>!N&&H(ge.target.value),readOnly:N,placeholder:"What does this workflow do?",className:`${as} ${N?"opacity-50":""}`})]}),l.jsxs("div",{className:"w-20",children:[l.jsx("label",{className:gr,children:"Max Iter."}),l.jsx("input",{type:"number",value:$,onChange:ge=>!N&&ee(Number(ge.target.value)),readOnly:N,className:`${as} font-mono ${N?"opacity-50":""}`})]}),l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Color"}),l.jsx("input",{type:"color",value:P,onChange:ge=>!N&&O(ge.target.value),disabled:N,className:`w-8 h-8 rounded border border-border bg-transparent ${N?"opacity-50":"cursor-pointer"}`})]})]}),l.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[l.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[l.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!N&&l.jsx("button",{onClick:cr,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),l.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[l.jsx(hB,{steps:Z,entryStep:z,selectedNodeId:(ft==null?void 0:ft.id)??null,selectedEdgeKey:M,startConditionLabel:pt,agentTypes:$e,isReadOnly:N,onSelectNode:ge=>{if(ge===null){At(null);return}const Ne=Z.findIndex(ze=>ze.id===ge);At(Ne>=0?String(Ne):null)},onSelectEdge:et,onRemoveStep:ge=>{var ze;const Ne=Z.findIndex(Ze=>Ze.id===ge);if(re(Ze=>Ze.filter(Ge=>Ge.id!==ge)),Lt===Ne&&At(null),z===ge){const Ze=Z.filter(Ge=>Ge.id!==ge);V(((ze=Ze[0])==null?void 0:ze.id)??"")}},onCreateTransition:Mn,onReconnectTo:Ii,onReconnectFrom:Pi,onDeleteTransition:Sr}),Z.length===0&&l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[l.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),l.jsx("button",{onClick:cr,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),l.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[l.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:l.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),l.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:N&&(xe||ft)?l.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):xe?xe.type==="start"?l.jsxs("div",{className:"space-y-3 text-sm",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),z&&l.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[l.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),l.jsx(pS,{}),l.jsx("span",{className:"text-text-primary font-medium",children:xe.toLabel})]}),l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Activation Condition"}),l.jsx("select",{value:Q.type,onChange:ge=>G(ge.target.value==="step_result"?{type:"step_result",result:"success"}:ge.target.value==="metadata_all_match"?{type:"metadata_all_match",key:"",field:"",value:""}:ge.target.value==="metadata_all_in"?{type:"metadata_all_in",key:"",field:"",values:[]}:{type:ge.target.value}),className:F0,children:RC.map(ge=>l.jsx("option",{value:ge.value,children:ge.label},ge.value))})]}),Q.type==="step_result"&&l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Result"}),z&&(()=>{const ge=Z.find(Ge=>Ge.id===z),Ne=ge&&(ge.type==="sub_agent"||ge.type==="agent")?$e.find(Ge=>Ge.id===(ge.type==="sub_agent"?ge.subAgentType:ge.agentId)):void 0,ze=(Ne==null?void 0:Ne.results)&&Ne.results.length>0,Ze=(Ne==null?void 0:Ne.results)??[];return ze?l.jsx("select",{value:Q.result??Ze[0],onChange:Ge=>G({type:"step_result",result:Ge.target.value}),className:F0,children:Ze.map(Ge=>l.jsx("option",{value:Ge,children:Ge},Ge))}):l.jsx("input",{type:"text",value:Q.result??"success",onChange:Ge=>G({type:"step_result",result:Ge.target.value}),placeholder:"e.g. success, passed, failed",className:as})})()]}),(Q.type==="metadata_all_match"||Q.type==="metadata_all_in")&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Metadata Key"}),l.jsx("input",{type:"text",value:Q.key??"",onChange:ge=>G({...Q,key:ge.target.value}),placeholder:"e.g. criteria, todos, review_findings",className:as})]}),l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Field"}),l.jsx("input",{type:"text",value:Q.field??"",onChange:ge=>G({...Q,field:ge.target.value}),placeholder:"e.g. status",className:as})]}),Q.type==="metadata_all_match"?l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Value"}),l.jsx("input",{type:"text",value:Q.value??"",onChange:ge=>G({...Q,value:ge.target.value}),placeholder:"e.g. passed, resolved",className:as})]}):l.jsxs("div",{children:[l.jsx("label",{className:gr,children:"Values (comma-separated)"}),l.jsx("input",{type:"text",value:((hs=Q.values)==null?void 0:hs.join(", "))??"",onChange:ge=>G({...Q,values:ge.target.value.split(",").map(Ne=>Ne.trim()).filter(Boolean)}),placeholder:"e.g. resolved, dismissed",className:as})]})]}),l.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):(()=>{const ge=Mi(M),Ne=ge==null?void 0:ge.stepId,ze=(ge==null?void 0:ge.transIdx)??0,Ze=Ne?Z.find(ct=>ct.id===Ne):void 0,Ge=(Ze==null?void 0:Ze.transitions.length)??0;return l.jsx(pB,{fromLabel:xe.fromLabel,toLabel:xe.toLabel,condition:xe.condition,subGroup:"subGroup"in xe?xe.subGroup:void 0,fromStep:xe.type==="step"?Z.find(ct=>ct.id===xe.fromLabel):void 0,agentTypes:$e,transitionIndex:ze,totalTransitions:Ge,onUpdateCondition:ct=>Bi(M,ct),onUpdateSubGroup:ct=>Ys(M,ct),onDelete:()=>Sr(M),onMoveUp:()=>{re(ct=>{const un=ct.find(gt=>gt.id===Ne);if(!un||ze===0)return ct;const Mt=[...un.transitions];return[Mt[ze-1],Mt[ze]]=[Mt[ze],Mt[ze-1]],ct.map(gt=>gt.id===Ne?{...gt,transitions:Mt}:gt)}),D(`${Ne}:${ze-1}`)},onMoveDown:()=>{re(ct=>{const un=ct.find(gt=>gt.id===Ne);if(!un||ze===un.transitions.length-1)return ct;const Mt=[...un.transitions];return[Mt[ze],Mt[ze+1]]=[Mt[ze+1],Mt[ze]],ct.map(gt=>gt.id===Ne?{...gt,transitions:Mt}:gt)}),D(`${Ne}:${ze+1}`)}})})():ft?l.jsx(mB,{step:ft,isEntry:ft.id===z,agentTypes:$e,transitionCount:ft.transitions.length,templateVariables:u,onUpdate:gn,onRemove:()=>{var ge;if(ft&&(re(Z.filter((Ne,ze)=>ze!==Lt)),At(null),z===ft.id)){const Ne=Z.filter((ze,Ze)=>Ze!==Lt);V(((ge=Ne[0])==null?void 0:ge.id)??"")}},onSetEntry:()=>V(ft.id)}):l.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",l.jsx("br",{}),"Drag from a port to connect."]})})]})]}),l.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[l.jsx(Je,{variant:"secondary",onClick:St,children:"Close"}),N?l.jsx(Je,{variant:"primary",onClick:()=>{F(U+" (copy)"),Y(`${b}-copy-${Date.now()}`),E(null),T(!1)},children:"Duplicate & Customize"}):l.jsxs(l.Fragment,{children:[l.jsx(Je,{variant:"primary",onClick:ot,children:"Save"}),l.jsx(Je,{variant:"primary",onClick:Ut,children:"Save & Close"})]})]})]})}return l.jsx(kt,{isOpen:e,onClose:t,title:"Workflows",size:"lg",children:l.jsx(CS,{description:"Workflows define multi-step agentic processes with branching transitions.",onNew:Fe,loading:o,hasItems:s.length>0||a.length>0,children:l.jsxs("div",{className:"space-y-4",children:[l.jsx($0,{title:"Built-in",items:s,renderActions:xe=>l.jsx(l.Fragment,{children:l.jsx(Fs,{onClick:()=>Oe(xe.id),children:l.jsx(fu,{})})})}),l.jsx($0,{title:"Custom",items:a,renderActions:xe=>l.jsxs(l.Fragment,{children:[l.jsx(Fs,{onClick:()=>Ee(xe.id),children:l.jsx(fu,{})}),l.jsx(Fs,{onClick:()=>fe(xe.id),children:l.jsx("span",{className:"text-[10px]",children:"Edit"})}),l.jsx(mu,{onClick:()=>Oe(xe.id)}),v(xe.id,"delete")?l.jsx(_p,{onConfirm:()=>Ke(xe.id),onCancel:k}):l.jsx(yp,{onClick:()=>w(xe.id)})]})})]})})})}function MC(e,t){if(!t)return!0;const n=t.toLowerCase().split(/\s+/),s=e.toLowerCase().split(/\s+/);return n.every(a=>{for(const o of s){let u=0;for(let c=0;c<o.length&&u<a.length;c++)o[c]===a[u]&&u++;if(u===a.length)return!0}return!1})}function IC(e,t,n,s,a){switch(e.key){case"ArrowDown":e.preventDefault(),n(o=>Math.min(o+1,t));break;case"ArrowUp":e.preventDefault(),n(o=>Math.max(o-1,0));break;case"Enter":e.preventDefault(),s();break;case"Escape":e.preventDefault(),a();break}}function _B(e){const t=e.match(/^\/p\/([^/]+)/);return t==null?void 0:t[1]}function yB({isOpen:e,onClose:t,onCloseComplete:n,onSelectCommand:s,onSelectWorkflow:a,onCloseCompleteAction:o,textareaContent:u,onSearchMessages:c,onToggleAutoScroll:d,isAutoScrollActive:f}){const[,p]=br(),m=en(ee=>ee.fetchCommands),x=Ct(ee=>ee.fetchWorkflows),_=ht(ee=>ee.fetchAgents),w=en(ee=>ee.defaults),k=en(ee=>ee.userItems),v=en(ee=>ee.projectItems),S=Ct(ee=>ee.defaults),y=Ct(ee=>ee.userItems),b=Ct(ee=>ee.projectItems),E=ht(ee=>ee.defaults),N=ht(ee=>ee.userItems),T=ht(ee=>ee.projectItems),L=we(ee=>{var Z;return(Z=ee.currentSession)==null?void 0:Z.mode}),A=we(ee=>{var Z;return((Z=ee.currentSession)==null?void 0:Z.dangerLevel)??"normal"}),M=we(ee=>ee.switchMode),D=we(ee=>ee.switchDangerLevel),U=we(ee=>{var Z;return(Z=ee.currentSession)==null?void 0:Z.projectId}),F=R.useRef(void 0),[B,Y]=R.useState(""),[W,H]=R.useState(0),K=R.useRef(null),X=R.useRef(!1);R.useEffect(()=>{e&&(X.current=!0)},[e]),R.useEffect(()=>{if(e){m(),x(),_(),Y(""),H(0);const ee=setTimeout(()=>{var Z;return(Z=K.current)==null?void 0:Z.focus()},50);return()=>clearTimeout(ee)}},[e,m,x,_]),R.useEffect(()=>{var ee;!e&&X.current&&(n==null||n(),(ee=F.current)==null||ee.call(F),F.current=void 0)},[e,n]);const P=(ee,Z)=>{const re=new Set(Z.map(Q=>Q.id));return[...ee.filter(Q=>!re.has(Q.id)),...Z]},z=[{id:"create-session",name:"New Session",prefix:"Action > Create",action:()=>{const ee=U??_B(window.location.pathname);ee&&p(`/p/${ee}/new`)}},{id:"navigate-session",name:"Another Session",prefix:"Action > Navigate to",action:()=>{F.current=o,t()}},{id:"search-messages",name:"Messages",prefix:"Action > Search",action:()=>{t(),c==null||c()}},{id:"toggle-autoscroll",name:f?"Auto-scroll Off":"Auto-scroll On",prefix:"Action > Toggle",action:()=>{t(),d==null||d(!f)}},...P(P(E,N),T).filter(ee=>!ee.subagent&&ee.id!==L).map(ee=>({id:ee.id,name:ee.name,prefix:"Agent > Switch to",action:()=>M(ee.id)})),...P(P(w,k),v).map(ee=>({id:ee.id,name:ee.name,prefix:"Command > Launch",action:()=>s(ee.id,u)})),...P(P(S,y),b).map(ee=>({id:ee.id,name:ee.name,prefix:"Workflow > Run",action:()=>a(ee.id)})),...["normal","dangerous"].filter(ee=>ee!==A).map(ee=>({id:ee,name:ee.charAt(0).toUpperCase()+ee.slice(1),prefix:"Mode > Switch to",action:()=>D(ee)}))].filter(ee=>MC(`${ee.prefix} ${ee.name}`,B)),V=z.length-1,$=ee=>{IC(ee,V,H,()=>{var Z;(Z=z[W])==null||Z.action(),t()},t)};return e?Di.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),l.jsxs("div",{className:"relative w-full max-w-md bg-bg-secondary border border-border rounded shadow-xl",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[l.jsx("input",{ref:K,type:"text",value:B,onChange:ee=>{Y(ee.target.value),H(0)},onKeyDown:$,placeholder:"Search...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),l.jsx(pp,{onClick:t,className:"shrink-0","aria-label":"Close"})]}),l.jsx("div",{className:"overflow-y-auto max-h-[60vh] p-2",children:z.length===0?l.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:w.length+k.length+S.length+y.length>0?"No matches":"No agents, commands, or workflows yet"}):z.map((ee,Z)=>l.jsxs("button",{type:"button",onClick:()=>{ee.action(),t()},className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${Z===W?"bg-accent-primary/20 text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:[l.jsxs("span",{className:"text-text-muted font-normal",children:[ee.prefix," "]}),l.jsx("span",{children:ee.name})]},ee.id))})]})]}),document.body):null}function vB(e){const t=new Date(e),n=new Date;if(t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear())return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});const a=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),u=String(t.getDate()).padStart(2,"0"),c=String(t.getHours()).padStart(2,"0"),d=String(t.getMinutes()).padStart(2,"0");return`${a}/${o}/${u} ${c}:${d}`}function bB(e){var t;if(e.type==="message")return e.message.timestamp;if(e.type==="subagent")return(t=e.messages[0])==null?void 0:t.timestamp}function SB(e){var t,n;if(e.type==="message"){const s=e.message;if(s.role==="assistant"){const a=(t=s.content)==null?void 0:t.trim();return((n=s.thinkingContent)==null?void 0:n.trim())&&!a?"italic text-text-muted":""}if(s.role==="user")return"font-bold"}return""}function wB(e){var n,s;if(e.type!=="message")return l.jsx(Iv,{className:"w-3.5 h-3.5"});const t=e.message;return t.role==="assistant"?(n=t.thinkingContent)!=null&&n.trim()&&!((s=t.content)!=null&&s.trim())?l.jsx(Ij,{className:"w-3.5 h-3.5"}):l.jsx(Iv,{className:"w-3.5 h-3.5"}):l.jsx(Mj,{className:"w-3.5 h-3.5"})}function G0(e){var t;if(e.type==="message"){const n=e.message,s=n.content||"",a=s.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(n.messageKind==="workflow-started")try{return`Workflow: ${JSON.parse(s).workflowName}`}catch{return"Workflow started"}if(n.messageKind==="task-completed")return"Task completed";if(n.messageKind==="auto-prompt")return"Auto-prompt";if(n.messageKind==="correction")return"Correction";if(n.messageKind==="context-reset")return"Context reset";if(n.messageKind==="command")return"Command executed";if(n.role==="assistant")return a?a.slice(0,200):(t=n.thinkingContent)!=null&&t.trim()?n.thinkingContent.slice(0,200):"";const o=a.slice(0,200);return o.length<a.length?`${o}...`:o}return e.type==="subagent"?`Sub-agent: ${e.subAgentType}`:e.type==="criteria-batch"?"Acceptance Criteria":""}function CB({isOpen:e,onClose:t,displayItems:n,onNavigate:s}){const[a,o]=R.useState(""),[u,c]=R.useState(0),d=R.useRef(null),f=R.useRef(null),p=R.useMemo(()=>n.filter(v=>{var S,y;return!(v.type==="context-divider"||v.type==="message"&&v.message.role==="assistant"&&!((S=v.message.content)!=null&&S.trim())&&!((y=v.message.thinkingContent)!=null&&y.trim()))}),[n]),m=R.useMemo(()=>a?p.filter(v=>{const S=G0(v);return MC(S,a)}):p,[p,a]),x=m.length-1;R.useEffect(()=>{if(e){o(""),c(0);const v=setTimeout(()=>{var S;return(S=d.current)==null?void 0:S.focus()},50);return()=>clearTimeout(v)}},[e]),R.useEffect(()=>{e&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e]);const _=v=>{IC(v,x,c,()=>{const S=m[u];if(S){const y=n.indexOf(S);y>=0&&s(y),t()}},t)},w=v=>{const S=n.indexOf(v);S>=0&&s(S),t()},k=v=>n.indexOf(v);return e?Di.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] p-4",children:[l.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),l.jsxs("div",{className:"relative w-full max-w-lg bg-bg-secondary border border-border rounded shadow-xl",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border",children:[l.jsx(fp,{}),l.jsx("input",{ref:d,type:"text",value:a,onChange:v=>{o(v.target.value),c(0)},onKeyDown:_,placeholder:"Search timeline...",className:"flex-1 bg-transparent text-sm focus:outline-none placeholder:text-text-muted"}),l.jsx("button",{type:"button",onClick:t,className:"p-0.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Close",children:l.jsx(yl,{className:"w-4 h-4"})})]}),l.jsx("div",{ref:f,className:"overflow-y-auto max-h-[60vh] p-2",children:m.length===0?l.jsx("div",{className:"px-3 py-4 text-center text-text-muted text-sm",children:p.length>0?"No matches":"No messages yet"}):m.map((v,S)=>{const y=k(v),b=wB(v),E=G0(v),N=SB(v),T=bB(v),L=v.type==="message"&&v.message.role==="user";return l.jsx("button",{type:"button",onClick:()=>w(v),className:`w-full text-left px-3 py-2 rounded text-sm transition-colors ${S===u?"bg-accent-primary/20 text-text-primary":L?"bg-accent-primary/5 text-text-secondary hover:bg-accent-primary/10 hover:text-text-primary":"text-text-secondary hover:bg-bg-tertiary hover:text-text-primary"}`,children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[l.jsx("span",{className:"flex-shrink-0",children:b}),l.jsx("span",{className:`truncate flex-1 ${N}`,children:E})]}),T&&l.jsx("span",{className:"text-text-muted text-xs shrink-0",children:vB(T)})]})},`${y}-${v.type}`)})})]})]}),document.body):null}function kB({attachment:e,onRemove:t}){const n=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return l.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[l.jsx(bl,{onClick:()=>t(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),l.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),l.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),l.jsx("div",{className:"text-[10px] text-text-muted",children:n(e.size)})]})}function EB({history:e,selectedIndex:t,onSelect:n,onEscape:s,onNavigate:a}){const o=R.useRef(null),u=R.useRef(null);R.useEffect(()=>{u.current&&o.current&&u.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[t]);const c=f=>{switch(f.key){case"Enter":f.preventDefault(),e[t]&&n(e[t].content);break;case"Escape":f.preventDefault(),s();break;case"ArrowUp":f.preventDefault(),a("up");break;case"ArrowDown":f.preventDefault(),a("down");break}},d=f=>{n(f)};return l.jsx("div",{ref:o,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:c,children:e.map((f,p)=>l.jsxs("div",{ref:p===t?u:null,role:"listitem",onClick:()=>d(f.content),className:`
|
|
293
|
-
p-2 rounded cursor-pointer transition-colors
|
|
294
|
-
${p===t?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
295
|
-
`,children:[l.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&l.jsxs(l.Fragment,{children:[" | ",l.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),l.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}function jB(){const e=cj(),t=e?"bg-amber-400":"bg-accent-primary";return l.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsxs("span",{className:"flex gap-0.5",children:[l.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"0ms"}}),l.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"150ms"}}),l.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${t}`,style:{animationDelay:"300ms"}})]}),l.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&l.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}const TB={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function NB(e,t={}){const n={...TB,...t};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=n.maxSizeBytes){const a=await e.arrayBuffer(),o=IB(a),u=`data:${e.type};base64,${o}`,c=await PC(u);return{dataUrl:u,mimeType:e.type,size:e.size,width:c.width,height:c.height}}return await AB(e,n)}async function AB(e,t){const n=await DB(e),s=await PC(n),{width:a,height:o}=LB(s.width,s.height,t.maxWidth,t.maxHeight),u=RB();u.width=a,u.height=o;const c=u.getContext("2d");if(!c)throw new Error("Failed to get canvas context");c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(s,0,0,a,o);let d=t.quality,f="";for(let m=0;m<10&&(f=u.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),!(W0(f)<=t.maxSizeBytes||d<=.3));m++)d-=.1;const p=W0(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:p,width:a,height:o}}function LB(e,t,n,s){const a=e/t;return e>t&&e>n?{width:n,height:Math.round(n/a)}:t>e&&t>s?{width:Math.round(s*a),height:s}:{width:e,height:t}}function DB(e){return new Promise((t,n)=>{const s=MB(),a=new s;a.onload=()=>t(a.result),a.onerror=()=>n(new Error("Failed to read file")),a.readAsDataURL(e)})}function PC(e){return new Promise((t,n)=>{const s=OB(),a=new s;a.onload=()=>t(a),a.onerror=()=>n(new Error("Failed to load image")),a.src=e})}function RB(){var t;const e=ag();if(!((t=e.document)!=null&&t.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function OB(){const e=ag();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function MB(){const e=ag();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function ag(){return globalThis}function IB(e){const t=new Uint8Array(e);let n="";for(let s=0;s<t.byteLength;s++){const a=t[s];a!==void 0&&(n+=String.fromCharCode(a))}return btoa(n)}function W0(e){const n=e.split(",")[1];return n?Math.round(n.length*3/4):0}function PB(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function BB(e,t=50*1024*1024){return e.size>t?{valid:!1,error:`Image file is too large (${q0(e.size)}). Maximum size is ${q0(t)}.`}:{valid:!0}}function q0(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function ym(e,t,n,s={}){const{maxSizeBytes:a=50*1024*1024,filename:o}=s;if(!PB(e)){n(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const u=BB(e,a);if(!u.valid){n(u.error??"Image file is too large");return}try{const c=await NB(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:lS(),filename:o??e.name,mimeType:c.mimeType,size:c.size,data:c.dataUrl};t(d)}catch(c){const d=c instanceof Error?c.message??"Failed to process image":"Failed to process image";n(d)}}function zB({children:e}){return Di.createPortal(e,document.body)}function HB(e){const t=e.startCondition;if(!t||t.type==="always")return!0;switch(t.type){case"step_result":case"metadata_all_match":case"metadata_all_in":return null;default:return null}}function $B({onSendCommand:e,onSelectWorkflow:t,onSelectWorkflowWithSubGroup:n,onOpenCommandsManager:s,onOpenWorkflowsManager:a,onAttach:o,textareaContent:u,attachments:c}){const[d,f]=R.useState(!1),[p,m]=R.useState("commands"),[x,_]=R.useState(""),[w,k]=R.useState(0),[v,S]=R.useState(null),[y,b]=R.useState(null),E=R.useRef(null),N=R.useRef(null),T=en(V=>V.defaults),L=en(V=>V.userItems),A=en(V=>V.fetchCommands),M=Ct(V=>V.defaults),D=Ct(V=>V.userItems),U=Ct(V=>V.fetchWorkflows),F=[...T,...L],B=[...M,...D];R.useEffect(()=>{d&&(p==="commands"?A():p==="workflows"&&U())},[d,p,A,U]),R.useEffect(()=>{d&&(_(""),k(0),requestAnimationFrame(()=>{var V;return(V=E.current)==null?void 0:V.focus()}))},[d,p]),R.useEffect(()=>{if(!d)return;const V=$=>{var ee;(ee=N.current)!=null&&ee.contains($.target)||f(!1)};return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[d]);const Y=V=>{switch(V.key){case"ArrowDown":V.preventDefault(),k($=>{const Z=(p==="commands"?F:B).filter(re=>{const Q=x.toLowerCase();return!Q||re.name.toLowerCase().includes(Q)});return Math.min($+1,Z.length-1)});break;case"ArrowUp":V.preventDefault(),k($=>Math.max($-1,0));break;case"Enter":V.preventDefault();break;case"Escape":V.preventDefault(),f(!1);break}},W=V=>{_(V),k(0)},H=F.filter(V=>!x||V.name.toLowerCase().includes(x.toLowerCase())),K=B.filter(V=>!x||V.name.toLowerCase().includes(x.toLowerCase())),X=async V=>{const $=await en.getState().fetchCommand(V);$&&e($.prompt,$.metadata.agentMode,u,c),f(!1)},P=V=>{t(V),f(!1)},O=(V,$)=>{$.stopPropagation(),f(!1),S(V)},z=(V,$)=>{$.stopPropagation(),f(!1),b(V)};return l.jsxs("div",{ref:N,className:"relative",children:[l.jsx("button",{type:"button",onClick:()=>f(!d),className:"px-1.5 py-2 rounded-r bg-bg-secondary text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors border-l border-border/50",title:"More options",children:l.jsx(xS,{className:"w-4 h-4"})}),d&&l.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-80 max-w-[calc(100vw-2rem)] bg-bg-secondary border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[l.jsxs("div",{className:"flex border-b border-border",children:[l.jsx("button",{type:"button",onClick:()=>{m("commands"),_(""),k(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="commands"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Commands"}),l.jsx("button",{type:"button",onClick:()=>{m("workflows"),_(""),k(0)},className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="workflows"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Workflows"}),l.jsx("button",{type:"button",onClick:()=>m("attach"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${p==="attach"?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-primary"}`,children:"Attach"})]}),p!=="attach"&&l.jsx("div",{className:"p-2 border-b border-border",children:l.jsx("input",{ref:E,value:x,onChange:V=>W(V.target.value),onKeyDown:Y,placeholder:p==="commands"?"Search commands...":"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),l.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:p==="commands"?H.length===0?l.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:F.length===0?"No commands yet":"No matches"}):H.map((V,$)=>l.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${$===w?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[l.jsx("button",{type:"button",onClick:()=>X(V.id),className:"flex-1 text-left",children:l.jsx("div",{className:"text-sm text-text-primary font-medium",children:V.name})}),l.jsx(Fs,{className:"opacity-0 group-hover:opacity-100",onClick:ee=>O(V.id,ee)})]},V.id)):p==="workflows"?K.length===0?l.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:B.length===0?"No workflows yet":"No matches"}):K.map((V,$)=>{const ee=HB(V),Z=V.color??"#3b82f6";return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${$===w?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[l.jsxs("button",{type:"button",onClick:()=>P(V.id),className:"flex-1 text-left flex items-center gap-2",children:[l.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:Z}}),l.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:V.name}),ee!==null&&l.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:ee?"#22c55e":"#6b7280"},title:ee?"Entry condition met":"Entry condition not met"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[V.subGroups&&V.subGroups.length>0&&l.jsx(UB,{subGroups:V.subGroups,onSelect:re=>{f(!1),n(V.id,re)}}),l.jsx(Fs,{className:"opacity-0 group-hover:opacity-100",onClick:re=>z(V.id,re)})]})]},V.id)}):l.jsxs("div",{className:"p-4 flex flex-col items-center gap-3",children:[l.jsxs("button",{type:"button",onClick:()=>{o(),f(!1)},className:"flex items-center gap-2 px-4 py-2 rounded bg-bg-tertiary hover:bg-accent-primary/20 text-text-primary transition-colors",children:[l.jsx(gj,{className:"w-4 h-4"}),l.jsx("span",{className:"text-sm font-medium",children:"Attach image"})]}),l.jsx("span",{className:"text-xs text-text-muted",children:"or drag & drop into chat"})]})}),p!=="attach"&&l.jsx("div",{className:"border-t border-border p-1",children:l.jsx("button",{type:"button",onClick:()=>{f(!1),p==="commands"?s():a()},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:p==="commands"?"Manage Commands...":"Manage Workflows..."})})]}),l.jsx(LC,{isOpen:!!v,onClose:()=>S(null),initialEditId:v}),l.jsx(OC,{isOpen:!!y,onClose:()=>b(null),initialEditId:y})]})}function UB({subGroups:e,onSelect:t}){const[n,s]=R.useState(!1),[a,o]=R.useState({top:0,right:0}),u=R.useRef(null),c=R.useRef(null);AC(c,()=>s(!1),n);const d=f=>{if(f.stopPropagation(),!n&&u.current){const p=u.current.getBoundingClientRect();o({top:p.bottom+4,right:window.innerWidth-p.right})}s(!n)};return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:u,type:"button",onClick:d,className:"p-1 rounded text-text-muted hover:text-text-primary transition-colors",title:"Sub-groups",children:"⋮"}),n&&l.jsx(zB,{children:l.jsx("div",{ref:c,onMouseDown:f=>f.stopPropagation(),className:"fixed w-40 bg-bg-secondary border border-border rounded-lg shadow-xl z-[100] overflow-hidden",style:{top:a.top,right:a.right},children:e.map(f=>l.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),t(f)},className:"w-full text-left px-3 py-2 text-sm text-text-primary hover:bg-bg-tertiary transition-colors",children:f},f))})})]})}function FB({messages:e,onCancel:t}){return e.length===0?null:l.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:e.map(n=>l.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${n.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[l.jsxs("span",{className:"font-medium",children:[n.mode==="asap"?"ASAP":"Queue",":"]}),l.jsx("span",{className:"truncate max-w-[200px]",children:n.content}),l.jsx(bl,{onClick:()=>t(n.queueId),size:"sm"})]},n.queueId))})}function VB({agent:e,isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:u}){return l.jsxs(jS,{isBuiltIn:t,isConfirmingDelete:n,onView:s,onEdit:a,onDuplicate:o,onDelete:u,children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),l.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),l.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),t&&l.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&l.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),l.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(c=>l.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:c},c)),e.allowedTools.length>5&&l.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function K0({title:e,agents:t,subagents:n,isBuiltIn:s,onView:a,onDuplicate:o,onEdit:u,onDelete:c}){if(t.length===0&&n.length===0)return null;const d=f=>l.jsx(VB,{agent:f,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>a(f.id),onEdit:s?void 0:()=>u==null?void 0:u(f.id),onDuplicate:()=>o(f.id),onDelete:s?void 0:()=>c==null?void 0:c(f.id)},f.id);return l.jsxs("div",{children:[l.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),l.jsxs("div",{className:"space-y-2",children:[t.map(d),n.length>0&&l.jsxs("div",{className:"mt-3",children:[l.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),l.jsx("div",{className:"space-y-2",children:n.map(d)})]})]})]})}function GB(e){const t=new Map;for(const n of e){const s=n.indexOf(":");if(s===-1)t.set(n,new Set);else{const a=n.slice(0,s),u=n.slice(s+1).split(",").filter(Boolean);t.set(a,new Set(u))}}return t}function vm(e){const t=[];for(const[n,s]of e)s.size===0?t.push(n):t.push(`${n}:${[...s].join(",")}`);return t}function WB({formName:e,formId:t,formDescription:n,formSubagent:s,formTools:a,formColor:o,formPrompt:u,formError:c,saving:d,isReadOnly:f,availableTools:p,onNameChange:m,onIdChange:x,onDescriptionChange:_,onSubagentChange:w,onColorChange:k,onPromptChange:v,onSave:S,onCancel:y,onDuplicate:b}){const E=GB(a),N=(A,M)=>{const D=new Map(E),U=D.get(A)||new Set,F=new Set(U);F.has(M)?F.delete(M):F.add(M),F.size===0?D.set(A,new Set):D.set(A,F),L(vm(D))},T=A=>{const M=new Map(E);M.has(A)?M.delete(A):M.set(A,new Set),L(vm(M))},L=A=>{};return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"space-y-3",children:[c&&l.jsx(vp,{message:c}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Ti,{label:"Name",value:e,onChange:m,placeholder:"My Agent",readOnly:f}),l.jsx(Ti,{label:"ID",value:t,onChange:x,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Ti,{label:"Description",value:n,onChange:_,placeholder:"What this agent does",readOnly:f}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),l.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[l.jsx("button",{onClick:()=>!f&&w(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${s?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${f?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),l.jsx("button",{onClick:()=>!f&&w(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${s?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${f?"pointer-events-none opacity-60":""}`,children:"Top-level"}),l.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[l.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),l.jsx("input",{type:"color",value:o,onChange:A=>!f&&k(A.target.value),disabled:f,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),l.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:p.map(A=>{const M=E.has(A.name),D=A.actions.length>0,U=E.get(A.name)||new Set;return D?f?l.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[l.jsx("span",{children:A.name}),l.jsx("span",{className:"text-[10px]",children:"*"})]},A.name):l.jsx(vl,{trigger:l.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${M?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[l.jsx("span",{children:A.name}),D&&l.jsx("span",{className:`text-[10px] ${M&&U.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]}),minWidth:"160px",items:[...A.actions.map(F=>({label:l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${A.name}-${F}`,children:[l.jsx("input",{type:"checkbox",id:`${A.name}-${F}`,checked:U.has(F),onChange:()=>N(A.name,F),disabled:f,className:"w-3 h-3 rounded accent-accent-primary"}),l.jsx("span",{children:F})]}),closeOnClick:!1})),{label:M?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(M)T(A.name);else{const F=new Map(E);F.set(A.name,new Set(A.actions)),L(vm(F))}}}]},A.name):l.jsx("button",{onClick:()=>!f&&T(A.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${M?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${f?"pointer-events-none":"cursor-pointer"}`,children:l.jsx("span",{children:A.name})},A.name)})})]})]}),l.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[l.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),l.jsx("textarea",{value:u,onChange:A=>!f&&v(A.target.value),readOnly:f,placeholder:"Instructions for this agent...",className:`h-80 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"opacity-60":""}`})]}),l.jsx(qj,{onCancel:y,onSave:S,saving:d,saveDisabled:!e||!u||f}),f&&l.jsx("div",{className:"flex justify-end mt-2",children:l.jsx("button",{onClick:b,className:"px-3 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 transition-colors",children:"Duplicate & Customize"})})]})}function qB(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function KB({isOpen:e,onClose:t,initialEditId:n}){const s=ht(de=>de.defaults),a=ht(de=>de.userItems),o=ht(de=>de.loading),u=ht(de=>de.fetchAgents),c=ht(de=>de.fetchAgent),d=ht(de=>de.fetchDefaultContent),f=ht(de=>de.createAgent),p=ht(de=>de.updateAgent),m=ht(de=>de.deleteAgent),[x,_]=R.useState("list"),[w,k]=R.useState(null),[v,S]=R.useState(!1),[y,b]=R.useState(""),[E,N]=R.useState(""),[T,L]=R.useState(""),[A,M]=R.useState(!0),[D,U]=R.useState([]),[F,B]=R.useState("#6b7280"),[Y,W]=R.useState(""),[H,K]=R.useState(""),[X,P]=R.useState(!1),[O,z]=R.useState([]),V=de=>{b(de.metadata.name),N(de.metadata.id),L(de.metadata.description),M(de.metadata.subagent),U(de.metadata.allowedTools),B(de.metadata.color??"#6b7280"),W(de.prompt),K("")},$=(de,Ie,Se)=>{b(de.metadata.name+" (copy)"),N(`${Ie}-copy-${Date.now()}`),L(de.metadata.description),M(de.metadata.subagent),U(de.metadata.allowedTools),B(de.metadata.color??"#6b7280"),W(de.prompt),K(""),k(null),S(!1),_("edit")},ee=(de,Ie)=>{V(de),k(Ie),S(!0),_("edit")};R.useEffect(()=>{e&&(u(),Te("/api/tools").then(de=>de.json()).then(de=>z(de.tools||[])).catch(()=>z([])),n?s.some(Ie=>Ie.id===n)?d(n).then(Ie=>{Ie&&$(Ie,n)}):c(n).then(Ie=>{Ie&&(V(Ie),k(n),S(!1),_("edit"))}):(_("list"),k(null),S(!1)))},[e,u,c,d,n]);const Z=async de=>{if(s.some(Se=>Se.id===de)){const Se=await d(de);if(!Se)return;ee(Se,de)}else{const Se=await c(de);if(!Se)return;ee(Se,de)}},re=async de=>{const Ie=await d(de);Ie&&$(Ie,de)},Q=()=>{k(null),b(""),N(""),L(""),M(!0),U(["read_file"]),B("#6b7280"),W(""),K(""),S(!1),_("edit")},G=async de=>{const Ie=await c(de);Ie&&(V(Ie),k(de),S(!1),_("edit"))},te=async de=>{await m(de)},se=async()=>{const de=w??E;if(!de||!y||!Y){K("Name and prompt are required.");return}P(!0),K("");const Ie={metadata:{id:de,name:y,description:T,subagent:A,allowedTools:D,color:F},prompt:Y},Se=w?await p(w,Ie):await f(Ie);if(P(!1),!Se.success){K(Se.error??"Failed to save agent.");return}n?t():_("list")},_e=()=>{n?t():(_("list"),S(!1))},ye=de=>{b(de),w||N(qB(de))},Ae=s.filter(de=>de.subagent),De=s.filter(de=>!de.subagent),Me=a.filter(de=>de.subagent),$e=a.filter(de=>!de.subagent);return x==="edit"?l.jsx(kt,{isOpen:e,onClose:_e,title:v?`${y}`:w?"Edit Agent":"New Agent",size:"xl",children:l.jsx(WB,{formName:y,formId:E,formDescription:T,formSubagent:A,formTools:D,formColor:F,formPrompt:Y,formError:H,saving:X,isReadOnly:v,availableTools:O,onNameChange:ye,onIdChange:N,onDescriptionChange:L,onSubagentChange:M,onColorChange:B,onPromptChange:W,onSave:se,onCancel:_e,onDuplicate:()=>{b(y+" (copy)"),N(`${w}-copy-${Date.now()}`),k(null),S(!1)}})}):l.jsx(kt,{isOpen:e,onClose:t,title:"Agents",size:"lg",children:l.jsx(CS,{description:"Agents define behavior, tools, and prompts for top-level modes and sub-agents.",onNew:Q,loading:o,hasItems:s.length>0||a.length>0,children:l.jsxs("div",{className:"space-y-4",children:[s.length>0&&l.jsx(K0,{title:"Built-in",agents:De,subagents:Ae,isBuiltIn:!0,onView:Z,onDuplicate:re}),a.length>0&&l.jsx(K0,{title:"Custom",agents:$e,subagents:Me,isBuiltIn:!1,onView:Z,onDuplicate:re,onEdit:G,onDelete:te})]})})})}function YB(){const e=we(y=>{var b;return(b=y.currentSession)==null?void 0:b.mode}),t=we(y=>y.switchMode),n=ht(y=>y.defaults),s=ht(y=>y.userItems),a=ht(y=>y.fetchAgents),o=[...n,...s],[u,c]=R.useState(!1),[d,f]=R.useState(!1),[p,m]=R.useState(null),x=R.useRef(null);R.useEffect(()=>{a()},[a]),R.useEffect(()=>{function y(b){x.current&&!x.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const _=mp();if(!e)return null;const w=o.filter(y=>!y.subagent),k=w.find(y=>y.id===e),v=(k==null?void 0:k.name)??e,S=ll(o,e);return l.jsxs("div",{className:"relative",ref:x,children:[l.jsxs("button",{type:"button",onClick:()=>c(!u),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[l.jsx("span",{className:"text-sm font-medium",style:{color:S},children:v}),l.jsx(Mr,{className:`w-3 h-3 text-text-muted transition-transform ${u?"rotate-180":""}`})]}),u&&w.length>0&&l.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[w.map((y,b)=>{const E=y.id===e,N=ll(o,y.id),T=_.agentSwitching[b],L=T?vS(T):null;return l.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${E?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[l.jsxs("button",{type:"button",onClick:()=>{E||t(y.id),c(!1)},className:"flex-1 text-left flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"font-medium truncate",style:{color:N},children:y.name}),E&&l.jsx(Or,{className:"w-3.5 h-3.5 text-text-muted shrink-0"})]}),L&&l.jsx("span",{className:"shrink-0 px-1.5 py-0.5 text-[10px] bg-bg-tertiary text-text-muted rounded",children:L})]},y.id)}),l.jsx("div",{className:"border-t border-border p-1",children:l.jsx("button",{type:"button",onClick:()=>{c(!1),f(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),l.jsx(KB,{isOpen:d,onClose:()=>{f(!1),m(null)},initialEditId:p})]})}function XB(){const e=we(s=>s.currentSession),t=we(s=>s.switchDangerLevel);if(!e)return null;const n=e.dangerLevel??"normal";return l.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[l.jsx("button",{type:"button",onClick:()=>t("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${n==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),l.jsx("button",{type:"button",onClick:()=>t("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${n==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function QB({content:e,children:t,position:n="top",delay:s=200}){const[a,o]=R.useState(!1),[u,c]=R.useState({top:0,left:0}),d=R.useRef(void 0),f=R.useRef(null);R.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const p=()=>{d.current=setTimeout(()=>{if(f.current){const _=f.current.getBoundingClientRect();c({top:_.top,left:_.left+_.width/2})}o(!0)},s)},m=()=>{d.current&&clearTimeout(d.current),o(!1)},x=(()=>{switch(n){case"top":return{top:u.top-8,left:u.left,tx:"-50%",ty:"-100%"};case"bottom":return{top:u.top+8,left:u.left,tx:"-50%",ty:"0%"};case"left":return{top:u.top,left:u.left-8,tx:"-100%",ty:"-50%"};case"right":return{top:u.top,left:u.left+8,tx:"0%",ty:"-50%"}}})();return l.jsxs(l.Fragment,{children:[l.jsx("span",{ref:f,className:"inline-flex",onMouseEnter:p,onMouseLeave:m,onFocus:p,onBlur:m,children:t}),a&&Di.createPortal(l.jsx("div",{className:"fixed z-[9999] px-4 py-3 text-sm text-text-primary bg-bg-secondary border border-border rounded-lg shadow-xl max-w-sm break-words pointer-events-none",style:{top:x.top,left:x.left,transform:`translate(${x.tx}, ${x.ty})`},children:e}),document.body)]})}function bm(e){return{contextWindow:e.contextWindow,temperature:e.temperature??null,topP:e.topP??null,topK:e.topK??null,maxTokens:e.maxTokens??null,supportsVision:e.supportsVision??null}}function JB({label:e,children:t}){return l.jsxs("div",{className:"space-y-3",children:[l.jsx("h4",{className:"text-sm font-medium text-text-secondary border-b border-border/50 pb-1",children:e}),t]})}function Jo({label:e,value:t,onChange:n,min:s,max:a,step:o=1,helpText:u,defaultValue:c,profileDefault:d,tooltip:f}){const[p,m]=R.useState((t==null?void 0:t.toString())??""),[x,_]=R.useState(t===null);R.useEffect(()=>{m((t==null?void 0:t.toString())??""),_(t===null)},[t]);const w=S=>{if(m(S),S==="")n(null);else{const y=parseFloat(S);isNaN(y)||n(y)}},k=()=>{x?(_(!1),c!==void 0&&(m(c.toString()),n(c))):(_(!0),n(null))},v=l.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[f&&l.jsx(QB,{content:f,children:l.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-xs text-text-muted hover:text-text-secondary cursor-help rounded-full border border-border/50",children:"?"})}),e,l.jsx("button",{type:"button",onClick:k,className:`text-xs px-1.5 py-0.5 rounded border ${x?"border-accent-primary/50 bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-secondary"}`,title:x?"Click to set a custom value":"Click to use default",children:x?"default":"custom"})]});return l.jsxs("div",{children:[v,l.jsx("input",{type:"number",min:s,max:a,step:o,value:p,readOnly:x,onChange:S=>w(S.target.value),onClick:()=>x&&k(),placeholder:x?`${d!==void 0?d:"Using default"} (click to edit)`:"",className:`w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary ${x?"opacity-50 cursor-pointer":""}`}),u&&l.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[l.jsx("p",{className:"text-xs text-text-muted",children:u}),d!==void 0&&l.jsxs("span",{className:"text-xs text-text-muted/60",children:["(default: ",d,")"]})]}),!u&&d!==void 0&&l.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Profile default: ",d]})]})}function ZB({isOpen:e,onClose:t,providerId:n,model:s}){const[a,o]=R.useState(()=>bm(s)),[u,c]=R.useState(!1),d=Ot(m=>m.updateModelSettings);R.useEffect(()=>{o(bm(s))},[s]);const f=async()=>{if(a.contextWindow<1024||a.contextWindow>1e7)return;c(!0);const m=a.temperature!==(s.temperature??null)||a.topP!==(s.topP??null)||a.topK!==(s.topK??null)||a.maxTokens!==(s.maxTokens??null)||a.supportsVision!==(s.supportsVision??null);await d(n,s.id,{contextWindow:a.contextWindow,...m&&{temperature:a.temperature,topP:a.topP,topK:a.topK,maxTokens:a.maxTokens,supportsVision:a.supportsVision??void 0}}),c(!1),t()},p=()=>{o(bm(s)),t()};return e?l.jsx(kt,{isOpen:e,onClose:t,title:"Model Properties",size:"lg",footer:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{variant:"secondary",onClick:p,disabled:u,children:"Cancel"}),l.jsx(Je,{variant:"primary",onClick:f,disabled:u||a.contextWindow<1024||a.contextWindow>1e7,children:u?"Saving...":"Save"})]}),children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),l.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded font-mono text-sm break-all",children:s.id})]}),l.jsx(Jo,{label:"Context Window",value:a.contextWindow,onChange:m=>m!==null&&o(x=>({...x,contextWindow:m})),min:1024,max:1e7,helpText:"Range: 1,024 - 10,000,000 tokens"}),l.jsxs(JB,{label:"Sampling Parameters",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(Jo,{label:"Temperature",value:a.temperature,onChange:m=>o(x=>({...x,temperature:m})),min:0,max:2,step:.1,helpText:"0.0 - 2.0",defaultValue:1,profileDefault:s.defaultTemperature,tooltip:"How random the response is. Low (0.1-0.3) = precise and predictable. High (0.7-1.5) = creative and varied."}),l.jsx(Jo,{label:"Top P",value:a.topP,onChange:m=>o(x=>({...x,topP:m})),min:0,max:1,step:.05,helpText:"0.0 - 1.0",defaultValue:1,profileDefault:s.defaultTopP,tooltip:"How to pick the next word. Low (0.5-0.8) = stick to obvious choices. High (0.95-1.0) = allow surprising words."})]}),l.jsx(Jo,{label:"Top K",value:a.topK,onChange:m=>o(x=>({...x,topK:m})),min:1,max:200,helpText:"1 - 200 (leave as default if not supported)",profileDefault:s.defaultTopK,tooltip:"Restricts word choices to the top K most likely ones. Low (10-20) = focused. High (50-200) = diverse. Not all backends support this."})]}),l.jsx(Jo,{label:"Max Tokens",value:a.maxTokens,onChange:m=>o(x=>({...x,maxTokens:m})),min:256,max:32e3,helpText:"Maximum tokens to generate per response",profileDefault:s.defaultMaxTokens,tooltip:"Longest response length. Higher values let the model write more, but use up your context window faster."}),l.jsxs("div",{children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-text-secondary mb-1",children:[l.jsx("input",{type:"checkbox",checked:a.supportsVision??!1,onChange:m=>o(x=>({...x,supportsVision:m.target.checked})),className:"rounded border-border bg-bg-tertiary text-accent-primary focus:ring-accent-primary focus:ring-offset-0"}),"Vision Enabled"]}),l.jsx("p",{className:"text-xs text-text-muted",children:"Allow sending images directly to this model. Disable if the model doesn't support vision."})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),l.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded text-sm",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]})}):null}function e8(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function t8(){var K;const[,e]=br(),t=we(X=>X.currentSession),n=we(X=>X.setSessionProvider),[s,a]=R.useState(!1),[o,u]=R.useState([]),[c,d]=R.useState(null),f=R.useRef(null),[p,m]=R.useState(null),x=R.useRef(new Set),_=Ot(X=>X.providers),w=Ot(X=>X.activeProviderId),k=Ot(X=>X.defaultModelSelection);Ot(X=>X.backend);const v=Ot(X=>X.activating),S=Ot(X=>X.activateProvider),y=Ot(X=>X.refreshModel),b=Ot(X=>X.refreshProviderModels);R.useEffect(()=>{function X(P){f.current&&!f.current.contains(P.target)&&(a(!1),u([]),x.current=new Set)}return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[]),R.useEffect(()=>{if(s){const X=_.map(P=>P.id);u(X),X.forEach(P=>{x.current.has(P)||(x.current.add(P),M(P))})}},[s,_]);const E=_.find(X=>X.id===w),N=(E==null?void 0:E.status)==="disconnected",T=k?k.split("/").pop()??null:null,L=T?((K=T.split("/").pop())==null?void 0:K.replace(/-/g," "))??T:"detecting...",A=(X,P)=>k?k===`${X}/${P}`:!1,M=async X=>{d(X);try{await b(X)}catch{}finally{d(null)}},D=X=>{o.includes(X.id)?u(o.filter(P=>P!==X.id)):(u([...o,X.id]),M(X.id))},U=async X=>{if(X.id===w){D(X);return}t?(n(X.id,void 0),Ot.getState().syncFromSession(X.id,""),a(!1),u([])):await S(X.id)&&(a(!1),u([]))},F=X=>{D(X)},B=async(X,P)=>{X.stopPropagation(),x.current.delete(P),await b(P),await M(P)},Y=(X,P)=>{m({providerId:X,model:P})},W=()=>{m(null)},H=async(X,P)=>{if(t){n(X,P),Ot.getState().syncFromSession(X,P),u([]),a(!1);return}d("activating");try{Ot.getState().syncFromSession(X,P),u([]),a(!1);const O=await Te(`/api/providers/${X}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:P})});if(O.ok){const z=await O.json();Ot.getState().syncFromSession(z.activeProviderId,z.model)}}catch{}finally{d(null)}};return _.length===0?l.jsxs("button",{type:"button",onClick:()=>y(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:N?"LLM server is offline. Click to retry.":T??"Click to refresh model",children:[N?l.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-sm text-accent-primary",children:L}),l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded-full ${E!=null&&E.isLocal?"text-accent-success bg-accent-success/10":"text-accent-warning bg-accent-warning/10"}`,children:E!=null&&E.isLocal?"local":"api"})]}),l.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):l.jsxs("div",{className:"relative",ref:f,children:[l.jsxs("button",{type:"button",onClick:()=>a(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[N?l.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-sm text-accent-primary",children:L}),l.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded-full ${E!=null&&E.isLocal?"text-accent-success bg-accent-success/10":"text-accent-warning bg-accent-warning/10"}`,children:E!=null&&E.isLocal?"local":"api"})]}),l.jsx(Mr,{className:"w-3 h-3 text-text-muted transition-transform",rotate:s?180:0})]}),s&&l.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden max-h-[80vh] overflow-y-auto",children:[l.jsx("div",{className:"py-1",children:_.map(X=>{var P;return l.jsxs("div",{children:[l.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${X.id===w?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${v?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[l.jsxs("div",{onClick:()=>!v&&U(X),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[l.jsx("span",{className:`text-sm font-medium truncate ${X.id===w?"text-accent-primary":"text-text-primary"}`,children:X.name}),l.jsx("span",{className:"text-xs text-text-muted truncate",children:X.backend!=="auto"&&wm(X.backend)})]}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[X.id===w?l.jsx("span",{className:"text-accent-success",title:"Active",children:l.jsx(Or,{className:"w-4 h-4"})}):l.jsx("span",{className:"w-4"}),l.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),B(O,X.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:l.jsx(hp,{className:`w-4 h-4 ${c===X.id?"animate-spin":""} ${X.id===w?"text-accent-primary":"text-text-muted"}`})}),l.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),F(X)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:l.jsx(Mr,{className:`w-4 h-4 transition-transform ${o.includes(X.id)?"rotate-180":""} ${X.id===w?"text-accent-primary":"text-text-muted"}`})})]})]}),o.includes(X.id)&&l.jsx("div",{className:"bg-bg-primary border-t border-border max-h-40 overflow-y-auto",children:c===X.id?l.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(P=X.models)!=null&&P.length?X.models.map(O=>{var z;return l.jsxs("button",{type:"button",onClick:()=>H(X.id,O.id),disabled:c==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${c==="activating"?"opacity-50 cursor-wait":""} ${A(X.id,O.id)?"text-accent-primary":"text-text-secondary"}`,children:[l.jsx("span",{className:"truncate flex-1",children:((z=O.id.split("/").pop())==null?void 0:z.replace(/-/g," "))??O.id}),l.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[l.jsx("span",{className:"text-xs text-text-muted",children:e8(O.contextWindow)}),l.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),Y(X.id,O)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:l.jsx(vj,{className:"w-3 h-3 text-text-muted"})})]}),A(X.id,O.id)&&l.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:l.jsx(Or,{className:"w-3.5 h-3.5"})})]},O.id)}):l.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},X.id)})}),l.jsx("div",{className:"border-t border-border px-3 py-2",children:l.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),p&&l.jsx(ZB,{isOpen:!0,onClose:W,providerId:p.providerId,model:p.model})]})}function n8({input:e,setInput:t,attachments:n,setAttachments:s,dragOver:a,setDragOver:o,errorMessage:u,setErrorMessage:c,scrollContainerRef:d,sessionId:f,sessionMode:p,showHistory:m,history:x,selectedIndex:_,openHistory:w,closeHistory:k,navigateUp:v,navigateDown:S,selectCurrent:y,isAutoScrollActive:b,setAutoScroll:E,onOpenMessageSearch:N,onOpenCommandsModal:T,onOpenWorkflowsModal:L,onSelectWorkflow:A,onSelectWorkflowWithSubGroup:M,clearInput:D}){const U=R.useRef(null),F=R.useRef(null),B=R.useRef(0),Y=Hu(),W=we(te=>te.sendMessage),H=we(te=>te.stopGeneration),K=we(te=>te.cancelQueued),X=we(te=>te.queuedMessages),P=R.useCallback(()=>{const te=U.current;if(!te)return;const se=e.length>=B.current;B.current=e.length,se||(te.style.height="auto"),te.style.height=`${Math.min(200,te.scrollHeight)}px`},[e]);R.useEffect(()=>{if(!f)return;const te=`openfox:draft:${f}`,se=localStorage.getItem(te);se!==null&&t(se)},[f,t]),R.useEffect(()=>{var te;(te=U.current)==null||te.focus(),P()},[f,P]),R.useEffect(()=>{if(!f)return;const te=`openfox:draft:${f}`,se=setTimeout(()=>{e?localStorage.setItem(te,e):localStorage.removeItem(te)},500);return()=>clearTimeout(se)},[f,e]),R.useEffect(()=>{P()},[e,P]),R.useEffect(()=>{const te=U.current;if(!te)return;const se=async _e=>{var Ae;if(document.activeElement!==te)return;const ye=(Ae=_e.clipboardData)==null?void 0:Ae.items;if(ye){for(const De of Array.from(ye))if(De.type.startsWith("image/")){_e.preventDefault();const Me=De.getAsFile();if(!Me)continue;await ym(Me,$e=>s([...n,$e]),c,{filename:"pasted-image"})}}};return te.addEventListener("paste",se),()=>te.removeEventListener("paste",se)},[n,s,c]);const O=te=>{te.preventDefault(),!(!e.trim()&&n.length===0)&&(W(e,n.length>0?n:void 0),D())},z=te=>{if(m)switch(te.key){case"Enter":{te.preventDefault();const se=y();se&&(t(se),k());return}case"Escape":te.preventDefault(),k(),Y&&H();return;case"ArrowUp":te.preventDefault(),v();return;case"ArrowDown":te.preventDefault(),S();return}if(te.key==="ArrowUp"&&e.trim()===""&&!m){te.preventDefault(),w();return}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),O(te))},V=R.useCallback(async te=>{const se=te.target.files;if(!(!se||se.length===0)){c(null);for(const _e of Array.from(se))await ym(_e,ye=>s([...n,ye]),c);F.current&&(F.current.value="")}},[n,s,c]),$=R.useCallback(te=>{te.preventDefault(),te.stopPropagation(),o(!0)},[o]),ee=R.useCallback(te=>{te.preventDefault(),te.stopPropagation(),o(!1)},[o]),Z=R.useCallback(async te=>{te.preventDefault(),te.stopPropagation(),o(!1),c(null);const se=te.dataTransfer.files;if(!(!se||se.length===0))for(const _e of Array.from(se))await ym(_e,ye=>s([...n,ye]),c)},[n,s,o,c]),re=R.useCallback(te=>{s(n.filter(se=>se.id!==te))},[n,s]),Q=R.useCallback(()=>{var te;(te=F.current)==null||te.click()},[]),G=()=>{var te;!e.trim()&&n.length===0||((te=d.current)==null||te.scrollTo({top:d.current.scrollHeight,behavior:"smooth"}),W(e,n),D())};return l.jsxs("form",{onSubmit:O,className:"relative p-2 md:p-4 bg-secondary",children:[Y&&l.jsx("div",{className:"absolute -top-8 left-2 md:left-4 z-10",children:l.jsx(jB,{})}),l.jsxs("div",{className:"absolute -top-8 right-2 md:right-4 z-10 flex items-center gap-2",children:[l.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5 px-2 py-0.5 rounded hover:bg-bg-tertiary transition-colors",onClick:()=>E(!b),children:[b?l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-success"}):l.jsx(Mr,{className:"w-3 h-3 text-text-muted"}),b?"live":"scroll to bottom"]}),l.jsxs("button",{type:"button",onClick:N,className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5 px-2 py-0.5 rounded hover:bg-bg-tertiary transition-colors","aria-label":"Browse history",children:[l.jsx(fp,{}),"Browse history"]})]}),l.jsx("input",{ref:F,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:V,className:"hidden",multiple:!0}),u&&l.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:u}),n.length>0&&l.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:n.map(te=>l.jsx(kB,{attachment:te,onRemove:re},te.id))}),m&&l.jsx(EB,{history:x,selectedIndex:_,onSelect:te=>{t(te),k()},onEscape:k,onNavigate:te=>{te==="up"?v():S()}}),l.jsx(FB,{messages:X,onCancel:K}),l.jsxs("div",{className:`flex items-end gap-3 p-3 rounded transition-colors ${a?"bg-accent-primary/10":"bg-primary"}`,onDragOver:$,onDragLeave:ee,onDrop:Z,children:[l.jsx("textarea",{id:DS,ref:U,value:e,onChange:te=>{t(te.target.value),m&&k()},onKeyDown:z,placeholder:"What would you like to build?","data-testid":"chat-input-textarea",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),l.jsxs("div",{className:"flex items-center self-center gap-1.5",children:[Y&&l.jsxs("button",{type:"button",onClick:()=>H(),"data-testid":"chat-stop-button",className:"flex items-center gap-1 px-4 py-1.5 rounded bg-accent-error/20 text-sm text-accent-error font-medium hover:bg-accent-error/30 transition-colors whitespace-nowrap",children:[l.jsx(_S,{}),"Abort"]}),l.jsxs("div",{className:"flex items-center",children:[l.jsx("button",{type:"button",onClick:G,disabled:!e.trim()&&n.length===0,"data-testid":"chat-send-button",className:"px-4 py-1.5 rounded-l bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"}),l.jsx($B,{onSendCommand:(te,se,_e,ye)=>{var De;se&&p!==se&&we.getState().switchMode(se);const Ae=_e&&_e.trim()?`${_e.trim()}
|
|
296
|
-
|
|
297
|
-
${te}`:te;(De=d.current)==null||De.scrollTo({top:d.current.scrollHeight,behavior:"smooth"}),W(Ae,ye!=null&&ye.length?ye:void 0,{messageKind:"command",isSystemGenerated:!0}),D()},onSelectWorkflow:A,onSelectWorkflowWithSubGroup:M,onOpenCommandsManager:T,onOpenWorkflowsManager:L,onAttach:Q,textareaContent:e,attachments:n.length>0?n:void 0})]})]})]}),l.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(YB,{}),l.jsx(XB,{})]}),l.jsx(t8,{})]})]})}function r8(e){return e==="criterion"||e==="session_metadata"}function s8(e){var t,n;return e.role!=="assistant"||e.subAgentId||(t=e.content)!=null&&t.trim()||(n=e.thinkingContent)!=null&&n.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>r8(s.name))}function i8(e,t=[]){const n=[];let s=null,a=[],o,u=1;const c=new Map,d=new Map,f=[];for(const _ of t)_.type==="message"?c.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&f.push(_);let p=0;const m=()=>{if(a.length>0){const _=f[p];_&&_.type==="criteria-batch"&&_.toolCalls.length===a.length&&_.toolCalls.every((k,v)=>{var S;return k.id===((S=a[v])==null?void 0:S.id)})?n.push(_):n.push({type:"criteria-batch",toolCalls:[...a]}),p++,a=[]}},x=()=>{if(!s)return;const _=s,w=d.get(_.subAgentId);w&&w.type==="subagent"&&w.messages.length===_.messages.length&&w.messages.every((v,S)=>v===_.messages[S])?n.push(w):n.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&o&&_.contextWindowId!==o&&(m(),x(),u++,n.push({type:"context-divider",windowSequence:u})),o=_.contextWindowId,s8(_)){x();for(const w of _.toolCalls)a.push(w);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(x(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{x();const w=c.get(_.id);w&&w.type==="message"&&w.message===_?n.push(w):n.push({type:"message",message:_})}}return m(),x(),n}function a8(e){const{year:t,month:n,day:s}=MS(e);return`${t}/${n}/${s} ${Fu(e)}`}function o8(e,t){return e.length<=t?e:e.substring(0,t)+"..."}const l8=10,c8=150;function u8(e){const t=[];if(e.recentUserPrompts)for(const n of e.recentUserPrompts)t.push({id:n.id,content:n.content,timestamp:n.timestamp,sessionId:e.id,sessionName:e.title||e.id});return t}function d8(e){return[...e].sort((s,a)=>new Date(a.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,l8).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:a8(s.timestamp),trimmedContent:o8(s.content,c8),sessionId:s.sessionId,sessionName:s.sessionName}))}function h8(e,t,n){const s=[],a=e.filter(o=>o.role==="user"&&!o.isSystemGenerated&&o.messageKind!=="auto-prompt");for(const o of a)s.push({id:o.id,content:o.content,timestamp:o.timestamp,sessionId:n??"",sessionName:"This session"});for(const o of t)n&&o.id===n||s.push(...u8(o));return d8(s)}function f8(e,t=[],n=null){const[s,a]=R.useState(0),[o,u]=R.useState(!1),c=R.useMemo(()=>h8(e,t,n),[e,t,n]),d=R.useCallback(()=>{c.length>0&&(a(c.length-1),u(!0))},[c.length]),f=R.useCallback(()=>{u(!1),a(0)},[]),p=R.useCallback(()=>{a(_=>c.length===0?_:_===0?c.length-1:_-1)},[c.length]),m=R.useCallback(()=>{a(_=>c.length===0?_:_===c.length-1?0:_+1)},[c.length]),x=R.useCallback(()=>{if(c.length===0||!o)return null;const _=c[s];return(_==null?void 0:_.content)??null},[c,s,o]);return{history:c,selectedIndex:s,showHistory:o,openHistory:d,closeHistory:f,navigateUp:p,navigateDown:m,selectCurrent:x}}R.memo(function({item:t}){const[n,s]=R.useState(!1);return t.type==="start"?l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[l.jsx("span",{className:"animate-pulse",children:"●"}),l.jsx("span",{children:"Delegating image to fallback vision model..."}),t.filename&&l.jsxs("span",{className:"text-amber-400/70",children:["(",t.filename,")"]})]}):l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[l.jsx("span",{className:"text-accent-success",children:"✓"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),l.jsx("button",{type:"button",onClick:()=>s(!n),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:n?"Hide":"Show"})]}),n&&t.description&&l.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:l.jsx(us,{content:t.description})})]})]})});function m8({criteriaSidebarOpen:e,onCriteriaSidebarToggle:t}={}){const n=e??!0,[s,a]=R.useState(""),[o,u]=R.useState([]),[c,d]=R.useState(!1),[f,p]=R.useState(null),[m,x]=R.useState(!1),[_,w]=R.useState(!1),[k,v]=R.useState(!1),[S,y]=R.useState(!1),[b,E]=R.useState(null),N=R.useRef(null),T=we(Se=>Se.currentSession),L=we(Se=>Se.messages),A=we(Se=>Se.streamingMessage),M=we(Se=>Se.sessions),D=we(Se=>Se.pendingQuestion),U=Hu(),F=we(Se=>Se.sendMessage),B=we(Se=>Se.acceptAndBuild),Y=we(Se=>Se.stopGeneration),W=we(Se=>Se.launchRunner),H=ht(Se=>Se.defaults),K=ht(Se=>Se.userItems),X=[...H,...K].filter(Se=>!Se.subagent),{history:P,selectedIndex:O,showHistory:z,openHistory:V,closeHistory:$,navigateUp:ee,navigateDown:Z,selectCurrent:re}=f8(L,M,T==null?void 0:T.id);R.useEffect(()=>{const Se=fe=>{E(fe.detail.stats)};return window.addEventListener("open-turn-stats",Se),()=>window.removeEventListener("open-turn-stats",Se)},[]),R.useEffect(()=>{Ct.getState().fetchWorkflows()},[]);const Q=R.useMemo(()=>A?L.map(Se=>Se.id===A.id?A:Se):L,[L,A]),G=R.useRef([]),te=R.useMemo(()=>{const Se=i8(Q,G.current);return G.current=Se,Se},[Q]),{isAutoScrollActive:se,setAutoScroll:_e}=NC(N,T),ye=R.useCallback(Se=>{var je;_e(!1);const fe=document.querySelector(`[data-item-index="${Se}"]`);fe&&(fe.scrollIntoView({behavior:"smooth",block:"start"}),(je=fe.closest('[data-testid="chat-scroll-container"]'))==null||je.scrollBy(0,-80))},[_e]);R.useEffect(()=>{const Se=fe=>{const je=k||m||_||S||b;fe.key==="Escape"&&U&&!je&&Y(),fe.key==="ScrollLock"&&_e(!se)};return window.addEventListener("keydown",Se),()=>window.removeEventListener("keydown",Se)},[U,Y,se,k,m,_,S,b]);const Ae=mp();wS(Ae.quickAction,()=>{v(!0)}),$j(Ae.agentSwitching,X,Se=>{we.getState().switchMode(Se)});const De=(T==null?void 0:T.mode)==="planner",Me=(T==null?void 0:T.mode)==="builder",$e=Se=>{const fe=s.trim()?s:void 0,je=o.length>0?o:void 0;De?B(Se,fe,je):Me&&W(fe,je,Se),Ie()},de=(Se,fe)=>{const je=s.trim()?s:void 0,ot=o.length>0?o:void 0;De?B(Se,je,ot,fe):Me&&W(je,ot,Se,fe),Ie()},Ie=()=>{a(""),u([]),T!=null&&T.id&&localStorage.removeItem(`openfox:draft:${T.id}`)};return l.jsxs(l.Fragment,{children:[l.jsxs(wN,{criteriaSidebarOpen:n,onCriteriaSidebarToggle:t,messages:Q,children:[D&&l.jsx(aB,{question:D}),l.jsx(EN,{}),b&&l.jsx(jN,{stats:b,onClose:()=>E(null)}),l.jsx(oB,{}),l.jsx(sB,{displayItems:te,scrollContainerRef:N,highlightedMessageId:null}),l.jsx(n8,{input:s,setInput:a,attachments:o,setAttachments:u,dragOver:c,setDragOver:d,errorMessage:f,setErrorMessage:p,scrollContainerRef:N,sessionId:T==null?void 0:T.id,sessionMode:T==null?void 0:T.mode,showHistory:z,history:P,selectedIndex:O,openHistory:V,closeHistory:$,navigateUp:ee,navigateDown:Z,selectCurrent:re,isAutoScrollActive:se,setAutoScroll:_e,onOpenMessageSearch:()=>y(!0),onOpenCommandsModal:()=>x(!0),onOpenWorkflowsModal:()=>w(!0),onSelectWorkflow:$e,onSelectWorkflowWithSubGroup:de,clearInput:Ie}),l.jsx(LC,{isOpen:m,onClose:()=>x(!1)}),l.jsx(OC,{isOpen:_,onClose:()=>w(!1)}),l.jsx(yB,{isOpen:k,onClose:()=>v(!1),onSearchMessages:()=>y(!0),isAutoScrollActive:se,onToggleAutoScroll:_e,textareaContent:s,onCloseComplete:RS,onCloseCompleteAction:()=>window.dispatchEvent(new CustomEvent("open-session-dropdown")),onSelectCommand:async(Se,fe)=>{const je=await en.getState().fetchCommand(Se);if(je){const ot=fe!=null&&fe.trim()?`${fe.trim()}
|
|
298
|
-
|
|
299
|
-
${je.prompt}`:je.prompt;je.metadata.agentMode&&we.getState().switchMode(je.metadata.agentMode),F(ot,o!=null&&o.length?o:void 0,{messageKind:"command",isSystemGenerated:!0}),Ie()}},onSelectWorkflow:Se=>{const fe=s.trim()||void 0,je=o.length>0?o:void 0;(T==null?void 0:T.mode)==="planner"?we.getState().acceptAndBuild(Se,fe,je):we.getState().launchRunner(fe,je,Se),Ie()}})]}),S&&l.jsx(CB,{isOpen:S,onClose:()=>y(!1),displayItems:te,onNavigate:ye})]})}function Y0({isOpen:e,isRetry:t,onSubmit:n,onCancel:s}){const[a,o]=R.useState(""),u=R.useRef(null);R.useEffect(()=>{e&&(o(""),setTimeout(()=>{var d;return(d=u.current)==null?void 0:d.focus()},100))},[e]);const c=d=>{d.preventDefault(),a.trim()&&n(a)};return l.jsx(kt,{isOpen:e,onClose:s,title:t?"Invalid Password":"Password Required",size:"sm",children:l.jsxs("form",{onSubmit:c,className:"space-y-4",children:[l.jsx("p",{className:"text-text-secondary text-sm",children:t?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),l.jsx(Vu,{ref:u,type:"password",value:a,onChange:d=>o(d.target.value),placeholder:"Enter password",autoFocus:!0}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(Je,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),l.jsx(Je,{type:"submit",disabled:!a.trim(),children:t?"Try Again":"Connect"})]})]})})}function p8({currentStep:e,totalSteps:t,labels:n,onStepClick:s}){return l.jsx("div",{className:"flex justify-center py-6",children:l.jsx("div",{className:"flex items-center",children:Array.from({length:t},(a,o)=>{const u=o+1,c=u<e,d=u===e;return l.jsxs("div",{className:"flex items-center",children:[l.jsx("button",{onClick:()=>s==null?void 0:s(u),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${c?"bg-accent-primary text-text-primary hover:opacity-80":d?"bg-accent-primary text-text-primary":"bg-bg-tertiary text-text-muted"}`,children:c?"✓":u}),l.jsx("button",{onClick:()=>s==null?void 0:s(u),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:n[o]}),o<t-1&&l.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${c?"bg-accent-primary":"bg-border"}`})]},o)})})})}const g8=[8e3,11434,8080],x8=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function _8({onNext:e}){const[t,n]=R.useState([]),[s,a]=R.useState([]),[o,u]=R.useState(!1),[c,d]=R.useState(""),[f,p]=R.useState(""),[m,x]=R.useState(""),[_,w]=R.useState("auto"),[k,v]=R.useState(!1),[S,y]=R.useState(!1),[b,E]=R.useState(null),[N,T]=R.useState(null),[L,A]=R.useState(null),[M,D]=R.useState("");R.useEffect(()=>{U()},[]);async function U(){try{const K=await Te("/api/providers");if(K.ok){const P=(await K.json()).providers.map(O=>({id:O.id,name:O.name,url:O.url,backend:O.backend,model:null,apiKey:O.apiKey,isLocal:O.isLocal}));n(P),a(P)}}catch{}}async function F(K){y(!0),E(null);const X=_!=="auto";try{const O=await(await Te("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:K,skipBackendDetection:X})})).json();O.success?(X||w(O.backend??"auto"),E({success:!0,model:O.model??void 0})):E({success:!1,error:O.error??"Connection failed"})}catch(P){E({success:!1,error:P instanceof Error?P.message:"Connection failed"})}y(!1)}function B(){if(!f)return;const K=c||`Provider ${s.length+1}`,X={id:`temp-${Date.now()}`,name:K,url:f,backend:b!=null&&b.success?_:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0,isLocal:k||void 0};a([...s,X]),d(""),p(""),x(""),E(null)}function Y(K){T(K),t.some(P=>P.id===K)?Te(`/api/providers/${K}`,{method:"DELETE"}).then(()=>{a(s.filter(P=>P.id!==K)),n(t.filter(P=>P.id!==K)),T(null)}).catch(()=>{T(null)}):(a(s.filter(P=>P.id!==K)),T(null))}async function W(){for(const X of s)(X.id.startsWith("temp-")||!t.some(P=>P.id===X.id))&&((await Te("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X.name,url:X.url,backend:X.backend,model:X.model,apiKey:X.apiKey,isLocal:X.isLocal})})).ok||console.error("Failed to add provider",X));const K=s.filter(X=>!X.id.startsWith("temp-"));e({providers:K})}const H=s.length>0;return l.jsxs("div",{className:"max-w-xl mx-auto",children:[l.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),l.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),l.jsxs("div",{className:"space-y-4",children:[s.length>0?l.jsx("div",{className:"space-y-2",children:s.map(K=>l.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:wm(K.backend)}),l.jsxs("label",{className:"flex items-center gap-1 cursor-pointer text-xs",children:[l.jsx("input",{type:"checkbox",checked:K.isLocal??!1,onChange:X=>{const P=X.target.checked;a(s.map(O=>O.id===K.id?{...O,isLocal:P||void 0}:O)),K.id.startsWith("temp-")||Te(`/api/providers/${K.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({isLocal:P})}).catch(()=>{})},className:"w-3.5 h-3.5 rounded border-border bg-bg-secondary accent-accent-primary"}),l.jsx("span",{className:K.isLocal?"text-accent-success":"text-text-muted",children:"local"})]}),L===K.id?l.jsx("input",{type:"text",value:M,onChange:X=>D(X.target.value),onKeyDown:X=>{X.key==="Enter"&&(a(s.map(P=>P.id===K.id?{...P,name:M}:P)),A(null)),X.key==="Escape"&&A(null)},onBlur:()=>{a(s.map(X=>X.id===K.id?{...X,name:M}:X)),A(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):l.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{A(K.id),D(K.name)},title:"Click to edit",children:K.name})]}),l.jsx("p",{className:"text-text-muted text-sm mt-1",children:K.url}),K.model&&l.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",K.model]})]}),l.jsx("button",{onClick:()=>Y(K.id),disabled:N===K.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:l.jsx(_l,{})})]},K.id))}):l.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:l.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),o?l.jsxs("form",{onSubmit:K=>{K.preventDefault(),f&&B()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:x8.map(K=>l.jsx("button",{type:"button",onClick:()=>{d(K.name),p(K.url),w(K.backend),E(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===K.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:K.name},K.name))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),l.jsx("div",{className:"grid grid-cols-3 gap-2",children:g8.map(K=>l.jsxs("button",{type:"button",onClick:()=>{d(""),p(`http://localhost:${K}`),w("auto"),E(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${K}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",K]},K))})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),l.jsx("input",{type:"text",name:"url",value:f,onChange:K=>{p(K.target.value),E(null)},onKeyDown:K=>{K.key==="Enter"&&(K.preventDefault(),F(f))},placeholder:"http://localhost:8000","data-testid":"onboarding-provider-url-input",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),l.jsx("input",{type:"text",name:"name",value:c,onChange:K=>d(K.target.value),onKeyDown:K=>{K.key==="Enter"&&(K.preventDefault(),B())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),l.jsx("input",{type:"password",name:"apiKey",value:m,onChange:K=>x(K.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:k,onChange:K=>v(K.target.checked),className:"w-4 h-4 rounded border-border bg-bg-secondary accent-accent-primary"}),l.jsx("span",{className:"text-sm text-text-secondary",children:"This is a local provider"})]}),b&&l.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?l.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",wm(_),b.model&&` (${b.model})`]}):l.jsx("p",{className:"text-red-500",children:b.error})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{type:"button",onClick:()=>F(f),disabled:!f||S,"data-testid":"onboarding-test-connection-button",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:S?l.jsx(qs,{className:"w-4 h-4"}):"Test Connection"}),l.jsx("button",{type:"submit",disabled:!f,"data-testid":"onboarding-add-provider-submit-button",className:"flex-1 px-4 py-2 bg-accent-primary text-text-primary rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:b!=null&&b.success?"Add Provider ✓":"Add Provider"})]}),l.jsx("button",{type:"button",onClick:()=>{u(!1),d(""),p(""),x(""),v(!1),E(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):l.jsxs("button",{onClick:()=>u(!0),"data-testid":"onboarding-add-provider-button",className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[l.jsx(qs,{className:"w-4 h-4"}),"Add Provider"]}),l.jsx("button",{onClick:W,disabled:!H,"data-testid":"onboarding-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function y8({onNext:e}){const[t,n]=R.useState(""),[s,a]=R.useState(!1);return R.useEffect(()=>{Te("/api/config").then(o=>o.json()).then(o=>{o.workdir?n(o.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&n(u.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(o=>o.json()).then(o=>{o.current&&n(o.current)}).catch(()=>{})})},[]),l.jsxs("div",{className:"max-w-xl mx-auto",children:[l.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),l.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),placeholder:"/home/user/projects","data-testid":"onboarding-workdir-input",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),l.jsx("button",{onClick:()=>a(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&l.jsx($S,{initialPath:t||void 0,onSelect:o=>{n(o),a(!1)},onClose:()=>a(!1)}),l.jsx("button",{onClick:()=>e({workdir:t}),disabled:!t,"data-testid":"onboarding-workdir-continue-button",className:"w-full mt-6 px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function v8({onNext:e}){const[t,n]=R.useState(!1),[s,a]=R.useState("http://localhost:11434"),[o,u]=R.useState("qwen3.5:0.8b"),{copied:c,copy:d}=CC();R.useEffect(()=>{Te("/api/config").then(p=>p.json()).then(p=>{p.visionFallback&&(n(p.visionFallback.enabled),a(p.visionFallback.url),u(p.visionFallback.model))}).catch(()=>{})},[]);function f(p){if(p){e({});return}e({visionFallback:{enabled:t,url:s,model:o,timeout:120}})}return l.jsxs("div",{className:"max-w-xl mx-auto",children:[l.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),l.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[l.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),l.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),l.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[l.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3.5:0.8b"}),l.jsx("button",{onClick:()=>d("ollama pull qwen3.5:0.8b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:c?l.jsx(Or,{className:"w-4 h-4 text-accent-primary"}):l.jsx(yj,{className:"w-4 h-4"})})]})]}),l.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:t,onChange:p=>n(p.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),l.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),t&&l.jsxs("div",{className:"space-y-4 pl-8",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),l.jsx("input",{type:"text",value:s,onChange:p=>a(p.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),l.jsx("input",{type:"text",value:o,onChange:p=>u(p.target.value),placeholder:"qwen3.5:0.8b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),l.jsxs("div",{className:"flex items-center justify-between pt-4",children:[l.jsx("button",{onClick:()=>f(!0),"data-testid":"onboarding-skip-button",className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),l.jsx("button",{onClick:()=>f(!1),className:"px-6 py-3 bg-accent-primary text-text-primary rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function b8({onComplete:e}){const[t,n]=R.useState(1),[s,a]=R.useState(!1),[o,u]=R.useState({});async function c(m){u(x=>({...x,providers:m.providers})),n(2)}async function d(m){u(x=>({...x,...m})),n(3)}async function f(m){a(!0);try{if(!(await Te("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:o.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(x){console.error("Failed to save onboarding data:",x),a(!1)}}const p=m=>{n(m)};return l.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[l.jsx(bl,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),l.jsx(p8,{currentStep:t,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:p}),l.jsx("div",{className:"max-w-xl mx-auto",children:s?l.jsxs("div",{className:"text-center",children:[l.jsx(qs,{className:"w-6 h-6"}),l.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):l.jsxs(l.Fragment,{children:[t===1&&l.jsx(_8,{onNext:c}),t===2&&l.jsx(y8,{onNext:d}),t===3&&l.jsx(v8,{onNext:f})]})})]})}const X0="openfox_updated_to",Q0="update_pending";function S8(){const[e,t]=R.useState(!1),n=localStorage.getItem(X0),s=localStorage.getItem(Q0);R.useEffect(()=>{if(!n||!s)return;const o=setTimeout(()=>t(!0),3e4);return()=>clearTimeout(o)},[n,s]);const a=()=>{localStorage.removeItem(X0),localStorage.removeItem(Q0),t(!0)};return e||s!=="true"||!n?null:l.jsxs("div",{className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-[100] flex items-center gap-3 px-4 py-2.5 bg-bg-secondary border border-border rounded-lg shadow-xl animate-slide-down",role:"status","aria-live":"polite",children:[l.jsx("div",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent-primary/20",children:l.jsx(Or,{className:"w-3 h-3 text-accent-primary"})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:"text-sm font-medium text-text-primary",children:"OpenFox updated successfully"}),l.jsxs("span",{className:"text-xs text-text-muted",children:["Now running ",n]})]}),l.jsx("button",{onClick:a,className:"ml-2 p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors","aria-label":"Dismiss",children:l.jsx(yS,{className:"w-3.5 h-3.5"})})]})}typeof window<"u"&&($t.getState().loadUserPresets(),$t.getState().applySavedTheme());function og(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function BC(){return l.jsx("div",{className:"flex-1 flex items-center justify-center",children:l.jsx(Sl,{})})}function w8({sidebarOpen:e,onSidebarToggle:t}){const[,n]=lp("/p/:projectId"),s=n==null?void 0:n.projectId,a=we(d=>d.connectionStatus),o=Bt(d=>d.currentProject),u=og();return fj({canLoad:a==="connected"||u,projectId:s,currentProjectId:o==null?void 0:o.id}),!o||o.id!==s?l.jsx(BC,{}):l.jsxs(l.Fragment,{children:[l.jsx(PS,{projectId:s,isOpen:e,onClose:t}),l.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:l.jsx(PT,{})})]})}function C8({sidebarOpen:e,onSidebarToggle:t,rightSidebarOpen:n,onRightSidebarToggle:s}){const[,a]=lp("/p/:projectId/s/:sessionId"),o=a==null?void 0:a.projectId,u=a==null?void 0:a.sessionId,[,c]=br(),d=we(k=>k.connectionStatus),f=we(k=>k.currentSession),p=we(k=>k.error),m=we(k=>k.clearError),x=Bt(k=>k.currentProject),_=og();return mj({canLoad:d==="connected"||_,projectId:o,sessionId:u,currentProjectId:x==null?void 0:x.id,currentSessionId:f==null?void 0:f.id}),R.useEffect(()=>{(p==null?void 0:p.code)==="NOT_FOUND"&&o&&(m(),c(`/p/${o}`))},[p,o,m,c]),!x||x.id!==o?l.jsx(BC,{}):l.jsxs(l.Fragment,{children:[l.jsx(PS,{projectId:o,isOpen:e,onClose:t}),l.jsx("div",{className:"flex-1 min-w-0 bg-primary",children:l.jsx(m8,{criteriaSidebarOpen:n,onCriteriaSidebarToggle:s})})]})}function k8(){const e=Ot(n=>n.fetchConfig);function t(){e(),window.history.back()}return l.jsx("div",{className:"flex-1 overflow-y-auto",children:l.jsx(b8,{onComplete:t})})}function E8(){const{connectionStatus:e}=uj(),t=Ot(W=>W.fetchConfig),n=Ot(W=>W.refreshProviderModels),s=Ot(W=>W.providers),a=Ot(W=>W.activeProviderId),[,o]=br(),u=og(),[c,d]=R.useState(!1);R.useEffect(()=>{(e==="connected"||u)&&t().then(()=>{d(!0),rn.getState().getSettings([...Z0,Be.DISPLAY_THEME,Be.DISPLAY_USER_PRESETS,Be.KEYBINDINGS])})},[e,u,t]),R.useEffect(()=>{c&&a&&n(a).then(()=>{const W=Ot.getState().defaultModelSelection;(W?W.split("/")[0]:null)!==a&&t()})},[c,a,n,t]);const f=rn(W=>W.settings);R.useEffect(()=>{c&&s.length===0&&o("/onboarding")},[c,s.length]),R.useEffect(()=>{const{applyPreset:W,applyTokens:H,setFollowSystemTheme:K,initSystemThemeListener:X}=$t.getState(),P=f[Be.DISPLAY_THEME],O=f[Be.DISPLAY_USER_PRESETS],z=f[Be.DISPLAY_FOLLOW_SYSTEM_THEME];if(O&&localStorage.setItem("openfox:userPresets",O),P){localStorage.setItem("openfox:theme",P);try{const $=JSON.parse(P);$.preset&&$.tokens?(W($.preset),$t.setState({basePreset:$.preset}),H($.tokens)):$.preset?W($.preset):$.tokens&&H($.tokens)}catch{W("dark")}}else W("system");z!==void 0&&$t.getState().followSystemTheme!==(z==="true")&&K(z==="true");const V=X();return()=>V()},[f[Be.DISPLAY_THEME],f[Be.DISPLAY_USER_PRESETS]]);const p=()=>{const W=localStorage.getItem("openfox:leftSidebar");return W!==null?W==="true":!0},m=()=>{const W=localStorage.getItem("openfox:rightSidebar");return W!==null?W==="true":!0},[x,_]=R.useState(p),[w,k]=R.useState(m),[v,S]=R.useState(!1),[y,b]=R.useState(!1),[E,N]=R.useState(!1),T=g2();R.useEffect(()=>{const W=()=>{N(window.innerWidth<768)};return W(),window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]);const L=E?v:x,A=E?y:w,M=()=>{E?S(!v):_(!x)},D=()=>{E?b(!y):k(!w)};R.useEffect(()=>{E||localStorage.setItem("openfox:leftSidebar",String(x))},[x,E]),R.useEffect(()=>{E||localStorage.setItem("openfox:rightSidebar",String(w))},[w,E]),R.useEffect(()=>{(e==="connected"||u)&&t()},[e,t,u]);const U=we(W=>W.showPasswordModal),F=we(W=>W.passwordModalRetry),B=we(W=>W.submitPassword),Y=we(W=>W.cancelPassword);return e!=="connected"&&!U&&!u?l.jsxs(l.Fragment,{children:[l.jsx(Y0,{isOpen:!0,isRetry:F,onSubmit:B,onCancel:Y}),l.jsx("div",{className:"h-screen flex items-center justify-center",children:l.jsx(RT,{text:"Connecting to server..."})})]}):l.jsxs(l.Fragment,{children:[l.jsx(Y0,{isOpen:U,isRetry:F,onSubmit:B,onCancel:Y}),l.jsxs("div",{className:"flex flex-col",style:{height:E?`calc(${T.offsetTop}px + ${T.height}px)`:"100vh"},children:[l.jsx(NT,{}),l.jsx(wT,{onMenuClick:M,onCriteriaToggle:D}),l.jsx("div",{className:"flex-1 flex overflow-hidden",children:l.jsxs(B2,{children:[l.jsx(Uo,{path:"/onboarding",children:l.jsx(k8,{})}),l.jsx(Uo,{path:"/p/:projectId/s/:sessionId",children:l.jsx(C8,{sidebarOpen:L,onSidebarToggle:M,rightSidebarOpen:A,onRightSidebarToggle:D})}),l.jsx(Uo,{path:"/p/:projectId/new",children:l.jsx(IT,{})}),l.jsx(Uo,{path:"/p/:projectId",children:l.jsx(w8,{sidebarOpen:L,onSidebarToggle:M})}),l.jsx(Uo,{path:"/",children:l.jsx(MT,{})})]})})]}),l.jsx(S8,{})]})}d2.createRoot(document.getElementById("root")).render(l.jsx($s.StrictMode,{children:l.jsx(E8,{})}));
|