openfox 1.6.15 → 1.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,150 +0,0 @@
1
- var E1=Object.defineProperty;var j1=(e,r,i)=>r in e?E1(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var er=(e,r,i)=>j1(e,typeof r!="symbol"?r+"":r,i);function N1(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const c in s)if(c!=="default"&&!(c in e)){const u=Object.getOwnPropertyDescriptor(s,c);u&&Object.defineProperty(e,c,u.get?u:{enumerable:!0,get:()=>s[c]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const p of u.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function Hl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xd={exports:{}},ja={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var rx;function T1(){if(rx)return ja;rx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,c,u){var p=null;if(u!==void 0&&(p=""+u),c.key!==void 0&&(p=""+c.key),"key"in c){u={};for(var l in c)l!=="key"&&(u[l]=c[l])}else u=c;return c=u.ref,{$$typeof:e,type:s,key:p,ref:c!==void 0?c:null,props:u}}return ja.Fragment=r,ja.jsx=i,ja.jsxs=i,ja}var ix;function A1(){return ix||(ix=1,xd.exports=T1()),xd.exports}var o=A1(),vd={exports:{}},Fe={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var sx;function D1(){if(sx)return Fe;sx=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),p=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function S(L){return L===null||typeof L!="object"?null:(L=b&&L[b]||L["@@iterator"],typeof L=="function"?L:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,v={};function y(L,q,U){this.props=L,this.context=q,this.refs=v,this.updater=U||k}y.prototype.isReactComponent={},y.prototype.setState=function(L,q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,q,"setState")},y.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function x(){}x.prototype=y.prototype;function _(L,q,U){this.props=L,this.context=q,this.refs=v,this.updater=U||k}var j=_.prototype=new x;j.constructor=_,C(j,y.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var R={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(L,q,U){var K=U.ref;return{$$typeof:e,type:L,key:q,ref:K!==void 0?K:null,props:U}}function z(L,q){return I(L.type,q,L.props)}function V(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function Y(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(U){return q[U]})}var $=/\/+/g;function F(L,q){return typeof L=="object"&&L!==null&&L.key!=null?Y(""+L.key):q.toString(36)}function P(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(N,N):(L.status="pending",L.then(function(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function B(L,q,U,K,ee){var ne=typeof L;(ne==="undefined"||ne==="boolean")&&(L=null);var Z=!1;if(L===null)Z=!0;else switch(ne){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(L.$$typeof){case e:case r:Z=!0;break;case g:return Z=L._init,B(Z(L._payload),q,U,K,ee)}}if(Z)return ee=ee(L),Z=K===""?"."+F(L,0):K,A(ee)?(U="",Z!=null&&(U=Z.replace($,"$&/")+"/"),B(ee,q,U,"",function(se){return se})):ee!=null&&(V(ee)&&(ee=z(ee,U+(ee.key==null||L&&L.key===ee.key?"":(""+ee.key).replace($,"$&/")+"/")+Z)),q.push(ee)),1;Z=0;var W=K===""?".":K+":";if(A(L))for(var ae=0;ae<L.length;ae++)K=L[ae],ne=W+F(K,ae),Z+=B(K,q,U,ne,ee);else if(ae=S(L),typeof ae=="function")for(L=ae.call(L),ae=0;!(K=L.next()).done;)K=K.value,ne=W+F(K,ae++),Z+=B(K,q,U,ne,ee);else if(ne==="object"){if(typeof L.then=="function")return B(P(L),q,U,K,ee);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Z}function X(L,q,U){if(L==null)return L;var K=[],ee=0;return B(L,K,"","",function(ne){return q.call(U,ne,ee++)}),K}function Q(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(U){(L._status===0||L._status===-1)&&(L._status=1,L._result=U)},function(U){(L._status===0||L._status===-1)&&(L._status=2,L._result=U)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var O=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},D={map:X,forEach:function(L,q,U){X(L,function(){q.apply(this,arguments)},U)},count:function(L){var q=0;return X(L,function(){q++}),q},toArray:function(L){return X(L,function(q){return q})||[]},only:function(L){if(!V(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Fe.Activity=m,Fe.Children=D,Fe.Component=y,Fe.Fragment=i,Fe.Profiler=c,Fe.PureComponent=_,Fe.StrictMode=s,Fe.Suspense=d,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(L){return R.H.useMemoCache(L)}},Fe.cache=function(L){return function(){return L.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(L,q,U){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var K=C({},L.props),ee=L.key;if(q!=null)for(ne in q.key!==void 0&&(ee=""+q.key),q)!T.call(q,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&q.ref===void 0||(K[ne]=q[ne]);var ne=arguments.length-2;if(ne===1)K.children=U;else if(1<ne){for(var Z=Array(ne),W=0;W<ne;W++)Z[W]=arguments[W+2];K.children=Z}return I(L.type,ee,K)},Fe.createContext=function(L){return L={$$typeof:p,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:u,_context:L},L},Fe.createElement=function(L,q,U){var K,ee={},ne=null;if(q!=null)for(K in q.key!==void 0&&(ne=""+q.key),q)T.call(q,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(ee[K]=q[K]);var Z=arguments.length-2;if(Z===1)ee.children=U;else if(1<Z){for(var W=Array(Z),ae=0;ae<Z;ae++)W[ae]=arguments[ae+2];ee.children=W}if(L&&L.defaultProps)for(K in Z=L.defaultProps,Z)ee[K]===void 0&&(ee[K]=Z[K]);return I(L,ne,ee)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(L){return{$$typeof:l,render:L}},Fe.isValidElement=V,Fe.lazy=function(L){return{$$typeof:g,_payload:{_status:-1,_result:L},_init:Q}},Fe.memo=function(L,q){return{$$typeof:f,type:L,compare:q===void 0?null:q}},Fe.startTransition=function(L){var q=R.T,U={};R.T=U;try{var K=L(),ee=R.S;ee!==null&&ee(U,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(N,O)}catch(ne){O(ne)}finally{q!==null&&U.types!==null&&(q.types=U.types),R.T=q}},Fe.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Fe.use=function(L){return R.H.use(L)},Fe.useActionState=function(L,q,U){return R.H.useActionState(L,q,U)},Fe.useCallback=function(L,q){return R.H.useCallback(L,q)},Fe.useContext=function(L){return R.H.useContext(L)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(L,q){return R.H.useDeferredValue(L,q)},Fe.useEffect=function(L,q){return R.H.useEffect(L,q)},Fe.useEffectEvent=function(L){return R.H.useEffectEvent(L)},Fe.useId=function(){return R.H.useId()},Fe.useImperativeHandle=function(L,q,U){return R.H.useImperativeHandle(L,q,U)},Fe.useInsertionEffect=function(L,q){return R.H.useInsertionEffect(L,q)},Fe.useLayoutEffect=function(L,q){return R.H.useLayoutEffect(L,q)},Fe.useMemo=function(L,q){return R.H.useMemo(L,q)},Fe.useOptimistic=function(L,q){return R.H.useOptimistic(L,q)},Fe.useReducer=function(L,q,U){return R.H.useReducer(L,q,U)},Fe.useRef=function(L){return R.H.useRef(L)},Fe.useState=function(L){return R.H.useState(L)},Fe.useSyncExternalStore=function(L,q,U){return R.H.useSyncExternalStore(L,q,U)},Fe.useTransition=function(){return R.H.useTransition()},Fe.version="19.2.4",Fe}var ax;function Pl(){return ax||(ax=1,vd.exports=D1()),vd.exports}var H=Pl();const ln=Hl(H),R1=N1({__proto__:null,default:ln},[H]);var bd={exports:{}},Na={},yd={exports:{}},_d={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var ox;function L1(){return ox||(ox=1,(function(e){function r(B,X){var Q=B.length;B.push(X);e:for(;0<Q;){var O=Q-1>>>1,D=B[O];if(0<c(D,X))B[O]=X,B[Q]=D,Q=O;else break e}}function i(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var X=B[0],Q=B.pop();if(Q!==X){B[0]=Q;e:for(var O=0,D=B.length,L=D>>>1;O<L;){var q=2*(O+1)-1,U=B[q],K=q+1,ee=B[K];if(0>c(U,Q))K<D&&0>c(ee,U)?(B[O]=ee,B[K]=Q,O=K):(B[O]=U,B[q]=Q,O=q);else if(K<D&&0>c(ee,Q))B[O]=ee,B[K]=Q,O=K;else break e}}return X}function c(B,X){var Q=B.sortIndex-X.sortIndex;return Q!==0?Q:B.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var p=Date,l=p.now();e.unstable_now=function(){return p.now()-l}}var d=[],f=[],g=1,m=null,b=3,S=!1,k=!1,C=!1,v=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function j(B){for(var X=i(f);X!==null;){if(X.callback===null)s(f);else if(X.startTime<=B)s(f),X.sortIndex=X.expirationTime,r(d,X);else break;X=i(f)}}function A(B){if(C=!1,j(B),!k)if(i(d)!==null)k=!0,N||(N=!0,Y());else{var X=i(f);X!==null&&P(A,X.startTime-B)}}var N=!1,R=-1,T=5,I=-1;function z(){return v?!0:!(e.unstable_now()-I<T)}function V(){if(v=!1,N){var B=e.unstable_now();I=B;var X=!0;try{e:{k=!1,C&&(C=!1,x(R),R=-1),S=!0;var Q=b;try{t:{for(j(B),m=i(d);m!==null&&!(m.expirationTime>B&&z());){var O=m.callback;if(typeof O=="function"){m.callback=null,b=m.priorityLevel;var D=O(m.expirationTime<=B);if(B=e.unstable_now(),typeof D=="function"){m.callback=D,j(B),X=!0;break t}m===i(d)&&s(d),j(B)}else s(d);m=i(d)}if(m!==null)X=!0;else{var L=i(f);L!==null&&P(A,L.startTime-B),X=!1}}break e}finally{m=null,b=Q,S=!1}X=void 0}}finally{X?Y():N=!1}}}var Y;if(typeof _=="function")Y=function(){_(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,F=$.port2;$.port1.onmessage=V,Y=function(){F.postMessage(null)}}else Y=function(){y(V,0)};function P(B,X){R=y(function(){B(e.unstable_now())},X)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(B){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var Q=b;b=X;try{return B()}finally{b=Q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(B,X){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Q=b;b=B;try{return X()}finally{b=Q}},e.unstable_scheduleCallback=function(B,X,Q){var O=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?O+Q:O):Q=O,B){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=Q+D,B={id:g++,callback:X,priorityLevel:B,startTime:Q,expirationTime:D,sortIndex:-1},Q>O?(B.sortIndex=Q,r(f,B),i(d)===null&&B===i(f)&&(C?(x(R),R=-1):C=!0,P(A,Q-O))):(B.sortIndex=D,r(d,B),k||S||(k=!0,N||(N=!0,Y()))),B},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(B){var X=b;return function(){var Q=b;b=X;try{return B.apply(this,arguments)}finally{b=Q}}}})(_d)),_d}var lx;function M1(){return lx||(lx=1,yd.exports=L1()),yd.exports}var Sd={exports:{}},tn={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var cx;function O1(){if(cx)return tn;cx=1;var e=Pl();function r(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}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 i(){}var s={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(d,f,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:m==null?null:""+m,children:d,containerInfo:f,implementation:g}}var p=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,tn.createPortal=function(d,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(r(299));return u(d,f,null,g)},tn.flushSync=function(d){var f=p.T,g=s.p;try{if(p.T=null,s.p=2,d)return d()}finally{p.T=f,s.p=g,s.d.f()}},tn.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))},tn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},tn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var g=f.as,m=l(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?s.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:S}):g==="script"&&s.d.X(d,{crossOrigin:m,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},tn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=l(f.as,f.crossOrigin);s.d.M(d,{crossOrigin:g,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)},tn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,m=l(g,f.crossOrigin);s.d.L(d,g,{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})}},tn.preloadModule=function(d,f){if(typeof d=="string")if(f){var g=l(f.as,f.crossOrigin);s.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(d)},tn.requestFormReset=function(d){s.d.r(d)},tn.unstable_batchedUpdates=function(d,f){return d(f)},tn.useFormState=function(d,f,g){return p.H.useFormState(d,f,g)},tn.useFormStatus=function(){return p.H.useHostTransitionStatus()},tn.version="19.2.4",tn}var ux;function eb(){if(ux)return Sd.exports;ux=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(r){console.error(r)}}return e(),Sd.exports=O1(),Sd.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var dx;function I1(){if(dx)return Na;dx=1;var e=M1(),r=Pl(),i=eb();function s(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,a=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(a=n.return),t=n.return;while(t)}return n.tag===3?a:null}function p(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function l(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function d(t){if(u(t)!==t)throw Error(s(188))}function f(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,h=n;;){var w=a.return;if(w===null)break;var E=w.alternate;if(E===null){if(h=w.return,h!==null){a=h;continue}break}if(w.child===E.child){for(E=w.child;E;){if(E===a)return d(w),t;if(E===h)return d(w),n;E=E.sibling}throw Error(s(188))}if(a.return!==h.return)a=w,h=E;else{for(var M=!1,G=w.child;G;){if(G===a){M=!0,a=w,h=E;break}if(G===h){M=!0,h=w,a=E;break}G=G.sibling}if(!M){for(G=E.child;G;){if(G===a){M=!0,a=E,h=w;break}if(G===h){M=!0,h=E,a=w;break}G=G.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==h)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function Y(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var $=Symbol.for("react.client.reference");function F(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===$?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case y:return"Profiler";case v:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case I:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case _:return t.displayName||"Context";case x:return(t._context.displayName||"Context")+".Consumer";case j:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case R:return n=t.displayName||null,n!==null?n:F(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return F(t(n))}catch{}}return null}var P=Array.isArray,B=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},O=[],D=-1;function L(t){return{current:t}}function q(t){0>D||(t.current=O[D],O[D]=null,D--)}function U(t,n){D++,O[D]=t.current,t.current=n}var K=L(null),ee=L(null),ne=L(null),Z=L(null);function W(t,n){switch(U(ne,n),U(ee,t),U(K,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Eg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Eg(n),t=jg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}q(K),U(K,t)}function ae(){q(K),q(ee),q(ne)}function se(t){t.memoizedState!==null&&U(Z,t);var n=K.current,a=jg(n,t.type);n!==a&&(U(ee,t),U(K,a))}function pe(t){ee.current===t&&(q(K),q(ee)),Z.current===t&&(q(Z),wa._currentValue=Q)}var be,je;function Ne(t){if(be===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);be=n&&n[1]||"",je=-1<a.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+be+t+je}var Le=!1;function Ue(t,n){if(!t||Le)return"";Le=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(n){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(de){var ce=de}Reflect.construct(t,[],ge)}else{try{ge.call()}catch(de){ce=de}t.call(ge.prototype)}}else{try{throw Error()}catch(de){ce=de}(ge=t())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(de){if(de&&ce&&typeof de.stack=="string")return[de.stack,ce.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=h.DetermineComponentFrameRoot(),M=E[0],G=E[1];if(M&&G){var J=M.split(`
44
- `),le=G.split(`
45
- `);for(w=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(h===J.length||w===le.length)for(h=J.length-1,w=le.length-1;1<=h&&0<=w&&J[h]!==le[w];)w--;for(;1<=h&&0<=w;h--,w--)if(J[h]!==le[w]){if(h!==1||w!==1)do if(h--,w--,0>w||J[h]!==le[w]){var fe=`
46
- `+J[h].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=h&&0<=w);break}}}finally{Le=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Ne(a):""}function we(t,n){switch(t.tag){case 26:case 27:case 5:return Ne(t.type);case 16:return Ne("Lazy");case 13:return t.child!==n&&n!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return Ne("Activity");default:return""}}function ct(t){try{var n="",a=null;do n+=we(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
47
- Error generating stack: `+h.message+`
48
- `+h.stack}}var ut=Object.prototype.hasOwnProperty,jt=e.unstable_scheduleCallback,xe=e.unstable_cancelCallback,ze=e.unstable_shouldYield,Pe=e.unstable_requestPaint,qe=e.unstable_now,ot=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,He=e.unstable_LowPriority,ie=e.unstable_IdlePriority,ke=e.log,Ae=e.unstable_setDisableYieldValue,Ve=null,Ye=null;function _t(t){if(typeof ke=="function"&&Ae(t),Ye&&typeof Ye.setStrictMode=="function")try{Ye.setStrictMode(Ve,t)}catch{}}var Je=Math.clz32?Math.clz32:Se,dn=Math.log,he=Math.LN2;function Se(t){return t>>>=0,t===0?32:31-(dn(t)/he|0)|0}var Be=256,Ke=262144,nt=4194304;function Oe(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Lt(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,E=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~E,h!==0?w=Oe(h):(M&=G,M!==0?w=Oe(M):a||(a=G&~t,a!==0&&(w=Oe(a))))):(G=h&~E,G!==0?w=Oe(G):M!==0?w=Oe(M):a||(a=h&~t,a!==0&&(w=Oe(a)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,a=n&-n,E>=a||E===32&&(a&4194048)!==0)?n:w}function kt(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Yt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 sc(){var t=nt;return nt<<=1,(nt&62914560)===0&&(nt=4194304),t}function Is(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Bs(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function p0(t,n,a,h,w,E){var M=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var fe=31-Je(a),ge=1<<fe;G[fe]=0,J[fe]=-1;var ce=le[fe];if(ce!==null)for(le[fe]=null,fe=0;fe<ce.length;fe++){var de=ce[fe];de!==null&&(de.lane&=-536870913)}a&=~ge}h!==0&&lf(t,h,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(M&~n))}function lf(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-Je(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function cf(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-Je(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function uf(t,n){var a=n&-n;return a=(a&42)!==0?1:ac(a),(a&(t.suspendedLanes|n))!==0?0:a}function ac(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function oc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function df(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:Xg(t.type))}function hf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Tr=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Tr,hn="__reactProps$"+Tr,Bi="__reactContainer$"+Tr,lc="__reactEvents$"+Tr,m0="__reactListeners$"+Tr,g0="__reactHandles$"+Tr,ff="__reactResources$"+Tr,zs="__reactMarker$"+Tr;function cc(t){delete t[Kt],delete t[hn],delete t[lc],delete t[m0],delete t[g0]}function zi(t){var n=t[Kt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Bi]||a[Kt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Mg(t);t!==null;){if(a=t[Kt])return a;t=Mg(t)}return n}t=a,a=t.parentNode}return null}function Hi(t){if(t=t[Kt]||t[Bi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Hs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Pi(t){var n=t[ff];return n||(n=t[ff]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function qt(t){t[zs]=!0}var pf=new Set,mf={};function oi(t,n){Fi(t,n),Fi(t+"Capture",n)}function Fi(t,n){for(mf[t]=n,t=0;t<n.length;t++)pf.add(n[t])}var x0=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]*$"),gf={},xf={};function v0(t){return ut.call(xf,t)?!0:ut.call(gf,t)?!1:x0.test(t)?xf[t]=!0:(gf[t]=!0,!1)}function io(t,n,a){if(v0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function so(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function or(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function Rn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function vf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function b0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,E=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,E.call(this,M)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function uc(t){if(!t._valueTracker){var n=vf(t)?"checked":"value";t._valueTracker=b0(t,n,""+t[n])}}function bf(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=vf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function ao(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var y0=/[\n"\\]/g;function Ln(t){return t.replace(y0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function dc(t,n,a,h,w,E,M,G){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),n!=null?M==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Rn(n)):t.value!==""+Rn(n)&&(t.value=""+Rn(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?hc(t,M,Rn(n)):a!=null?hc(t,M,Rn(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Rn(G):t.removeAttribute("name")}function yf(t,n,a,h,w,E,M,G){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){uc(t);return}a=a!=null?""+Rn(a):"",n=n!=null?""+Rn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),uc(t)}function hc(t,n,a){n==="number"&&ao(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Ui(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+Rn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function _f(t,n,a){if(n!=null&&(n=""+Rn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Rn(a):""}function Sf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(P(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Rn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),uc(t)}function $i(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var _0=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 wf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||_0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Cf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&wf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&wf(t,E,n[E])}function fc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 S0=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"]]),w0=/^[\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 oo(t){return w0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function lr(){}var pc=null;function mc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var qi=null,Wi=null;function kf(t){var n=Hi(t);if(n&&(t=n.stateNode)){var a=t[hn]||null;e:switch(t=n.stateNode,n.type){case"input":if(dc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ln(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[hn]||null;if(!w)throw Error(s(90));dc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&bf(h)}break e;case"textarea":_f(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ui(t,!!a.multiple,n,!1)}}}var gc=!1;function Ef(t,n,a){if(gc)return t(n,a);gc=!0;try{var h=t(n);return h}finally{if(gc=!1,(qi!==null||Wi!==null)&&(Ko(),qi&&(n=qi,t=Wi,Wi=qi=null,kf(n),t)))for(n=0;n<t.length;n++)kf(t[n])}}function Ps(t,n){var a=t.stateNode;if(a===null)return null;var h=a[hn]||null;if(h===null)return null;a=h[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var cr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xc=!1;if(cr)try{var Fs={};Object.defineProperty(Fs,"passive",{get:function(){xc=!0}}),window.addEventListener("test",Fs,Fs),window.removeEventListener("test",Fs,Fs)}catch{xc=!1}var Ar=null,vc=null,lo=null;function jf(){if(lo)return lo;var t,n=vc,a=n.length,h,w="value"in Ar?Ar.value:Ar.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(h=1;h<=M&&n[a-h]===w[E-h];h++);return lo=w.slice(t,1<h?1-h:void 0)}function co(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function uo(){return!0}function Nf(){return!1}function fn(t){function n(a,h,w,E,M){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=M,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(E):E[G]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?uo:Nf,this.isPropagationStopped=Nf,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=uo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=uo)},persist:function(){},isPersistent:uo}),n}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ho=fn(li),Us=m({},li,{view:0,detail:0}),C0=fn(Us),bc,yc,$s,fo=m({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==$s&&($s&&t.type==="mousemove"?(bc=t.screenX-$s.screenX,yc=t.screenY-$s.screenY):yc=bc=0,$s=t),bc)},movementY:function(t){return"movementY"in t?t.movementY:yc}}),Tf=fn(fo),k0=m({},fo,{dataTransfer:0}),E0=fn(k0),j0=m({},Us,{relatedTarget:0}),_c=fn(j0),N0=m({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),T0=fn(N0),A0=m({},li,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),D0=fn(A0),R0=m({},li,{data:0}),Af=fn(R0),L0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},M0={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"},O0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function I0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=O0[t])?!!n[t]:!1}function Sc(){return I0}var B0=m({},Us,{key:function(t){if(t.key){var n=L0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=co(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?M0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sc,charCode:function(t){return t.type==="keypress"?co(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?co(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),z0=fn(B0),H0=m({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Df=fn(H0),P0=m({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sc}),F0=fn(P0),U0=m({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),$0=fn(U0),q0=m({},fo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),W0=fn(q0),G0=m({},li,{newState:0,oldState:0}),V0=fn(G0),Y0=[9,13,27,32],wc=cr&&"CompositionEvent"in window,qs=null;cr&&"documentMode"in document&&(qs=document.documentMode);var K0=cr&&"TextEvent"in window&&!qs,Rf=cr&&(!wc||qs&&8<qs&&11>=qs),Lf=" ",Mf=!1;function Of(t,n){switch(t){case"keyup":return Y0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function If(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Gi=!1;function X0(t,n){switch(t){case"compositionend":return If(n);case"keypress":return n.which!==32?null:(Mf=!0,Lf);case"textInput":return t=n.data,t===Lf&&Mf?null:t;default:return null}}function Z0(t,n){if(Gi)return t==="compositionend"||!wc&&Of(t,n)?(t=jf(),lo=vc=Ar=null,Gi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Rf&&n.locale!=="ko"?null:n.data;default:return null}}var Q0={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 Bf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Q0[t.type]:n==="textarea"}function zf(t,n,a,h){qi?Wi?Wi.push(h):Wi=[h]:qi=h,n=nl(n,"onChange"),0<n.length&&(a=new ho("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Ws=null,Gs=null;function J0(t){yg(t,0)}function po(t){var n=Hs(t);if(bf(n))return t}function Hf(t,n){if(t==="change")return n}var Pf=!1;if(cr){var Cc;if(cr){var kc="oninput"in document;if(!kc){var Ff=document.createElement("div");Ff.setAttribute("oninput","return;"),kc=typeof Ff.oninput=="function"}Cc=kc}else Cc=!1;Pf=Cc&&(!document.documentMode||9<document.documentMode)}function Uf(){Ws&&(Ws.detachEvent("onpropertychange",$f),Gs=Ws=null)}function $f(t){if(t.propertyName==="value"&&po(Gs)){var n=[];zf(n,Gs,t,mc(t)),Ef(J0,n)}}function e_(t,n,a){t==="focusin"?(Uf(),Ws=n,Gs=a,Ws.attachEvent("onpropertychange",$f)):t==="focusout"&&Uf()}function t_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return po(Gs)}function n_(t,n){if(t==="click")return po(n)}function r_(t,n){if(t==="input"||t==="change")return po(n)}function i_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var _n=typeof Object.is=="function"?Object.is:i_;function Vs(t,n){if(_n(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!ut.call(n,w)||!_n(t[w],n[w]))return!1}return!0}function qf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Wf(t,n){var a=qf(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=qf(a)}}function Gf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Gf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Vf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=ao(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=ao(t.document)}return n}function Ec(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var s_=cr&&"documentMode"in document&&11>=document.documentMode,Vi=null,jc=null,Ys=null,Nc=!1;function Yf(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nc||Vi==null||Vi!==ao(h)||(h=Vi,"selectionStart"in h&&Ec(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ys&&Vs(Ys,h)||(Ys=h,h=nl(jc,"onSelect"),0<h.length&&(n=new ho("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Vi)))}function ci(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Yi={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},Tc={},Kf={};cr&&(Kf=document.createElement("div").style,"AnimationEvent"in window||(delete Yi.animationend.animation,delete Yi.animationiteration.animation,delete Yi.animationstart.animation),"TransitionEvent"in window||delete Yi.transitionend.transition);function ui(t){if(Tc[t])return Tc[t];if(!Yi[t])return t;var n=Yi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Kf)return Tc[t]=n[a];return t}var Xf=ui("animationend"),Zf=ui("animationiteration"),Qf=ui("animationstart"),a_=ui("transitionrun"),o_=ui("transitionstart"),l_=ui("transitioncancel"),Jf=ui("transitionend"),ep=new Map,Ac="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(" ");Ac.push("scrollEnd");function Wn(t,n){ep.set(t,n),oi(n,[t])}var mo=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Mn=[],Ki=0,Dc=0;function go(){for(var t=Ki,n=Dc=Ki=0;n<t;){var a=Mn[n];Mn[n++]=null;var h=Mn[n];Mn[n++]=null;var w=Mn[n];Mn[n++]=null;var E=Mn[n];if(Mn[n++]=null,h!==null&&w!==null){var M=h.pending;M===null?w.next=w:(w.next=M.next,M.next=w),h.pending=w}E!==0&&tp(a,w,E)}}function xo(t,n,a,h){Mn[Ki++]=t,Mn[Ki++]=n,Mn[Ki++]=a,Mn[Ki++]=h,Dc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Rc(t,n,a,h){return xo(t,n,a,h),vo(t)}function di(t,n){return xo(t,null,null,n),vo(t)}function tp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,h=E.alternate,h!==null&&(h.childLanes|=a),E.tag===22&&(t=E.stateNode,t===null||t._visibility&1||(w=!0)),t=E,E=E.return;return t.tag===3?(E=t.stateNode,w&&n!==null&&(w=31-Je(a),t=E.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),E):null}function vo(t){if(50<ga)throw ga=0,Fu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Xi={};function c_(t,n,a,h){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(t,n,a,h){return new c_(t,n,a,h)}function Lc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ur(t,n){var a=t.alternate;return a===null?(a=Sn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function np(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function bo(t,n,a,h,w,E){var M=0;if(h=t,typeof t=="function")Lc(t)&&(M=1);else if(typeof t=="string")M=p1(t,a,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=Sn(31,a,n,w),t.elementType=I,t.lanes=E,t;case C:return hi(a.children,w,E,n);case v:M=8,w|=24;break;case y:return t=Sn(12,a,n,w|2),t.elementType=y,t.lanes=E,t;case A:return t=Sn(13,a,n,w),t.elementType=A,t.lanes=E,t;case N:return t=Sn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:M=10;break e;case x:M=9;break e;case j:M=11;break e;case R:M=14;break e;case T:M=16,h=null;break e}M=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=Sn(M,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function hi(t,n,a,h){return t=Sn(7,t,h,n),t.lanes=a,t}function Mc(t,n,a){return t=Sn(6,t,null,n),t.lanes=a,t}function rp(t){var n=Sn(18,null,null,0);return n.stateNode=t,n}function Oc(t,n,a){return n=Sn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var ip=new WeakMap;function On(t,n){if(typeof t=="object"&&t!==null){var a=ip.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ct(n)},ip.set(t,n),n)}return{value:t,source:n,stack:ct(n)}}var Zi=[],Qi=0,yo=null,Ks=0,In=[],Bn=0,Dr=null,Xn=1,Zn="";function dr(t,n){Zi[Qi++]=Ks,Zi[Qi++]=yo,yo=t,Ks=n}function sp(t,n,a){In[Bn++]=Xn,In[Bn++]=Zn,In[Bn++]=Dr,Dr=t;var h=Xn;t=Zn;var w=32-Je(h)-1;h&=~(1<<w),a+=1;var E=32-Je(n)+w;if(30<E){var M=w-w%5;E=(h&(1<<M)-1).toString(32),h>>=M,w-=M,Xn=1<<32-Je(n)+w|a<<w|h,Zn=E+t}else Xn=1<<E|a<<w|h,Zn=t}function Ic(t){t.return!==null&&(dr(t,1),sp(t,1,0))}function Bc(t){for(;t===yo;)yo=Zi[--Qi],Zi[Qi]=null,Ks=Zi[--Qi],Zi[Qi]=null;for(;t===Dr;)Dr=In[--Bn],In[Bn]=null,Zn=In[--Bn],In[Bn]=null,Xn=In[--Bn],In[Bn]=null}function ap(t,n){In[Bn++]=Xn,In[Bn++]=Zn,In[Bn++]=Dr,Xn=n.id,Zn=n.overflow,Dr=t}var Xt=null,St=null,rt=!1,Rr=null,zn=!1,zc=Error(s(519));function Lr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xs(On(n,t)),zc}function op(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[Kt]=t,n[hn]=h,a){case"dialog":Ze("cancel",n),Ze("close",n);break;case"iframe":case"object":case"embed":Ze("load",n);break;case"video":case"audio":for(a=0;a<va.length;a++)Ze(va[a],n);break;case"source":Ze("error",n);break;case"img":case"image":case"link":Ze("error",n),Ze("load",n);break;case"details":Ze("toggle",n);break;case"input":Ze("invalid",n),yf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Ze("invalid",n);break;case"textarea":Ze("invalid",n),Sf(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Cg(n.textContent,a)?(h.popover!=null&&(Ze("beforetoggle",n),Ze("toggle",n)),h.onScroll!=null&&Ze("scroll",n),h.onScrollEnd!=null&&Ze("scrollend",n),h.onClick!=null&&(n.onclick=lr),n=!0):n=!1,n||Lr(t,!0)}function lp(t){for(Xt=t.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Xt=Xt.return}}function Ji(t){if(t!==Xt)return!1;if(!rt)return lp(t),rt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||nd(t.type,t.memoizedProps)),a=!a),a&&St&&Lr(t),lp(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=Lg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=Lg(t)}else n===27?(n=St,Vr(t.type)?(t=od,od=null,St=t):St=n):St=Xt?Pn(t.stateNode.nextSibling):null;return!0}function fi(){St=Xt=null,rt=!1}function Hc(){var t=Rr;return t!==null&&(xn===null?xn=t:xn.push.apply(xn,t),Rr=null),t}function Xs(t){Rr===null?Rr=[t]:Rr.push(t)}var Pc=L(null),pi=null,hr=null;function Mr(t,n,a){U(Pc,n._currentValue),n._currentValue=a}function fr(t){t._currentValue=Pc.current,q(Pc)}function Fc(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function Uc(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var M=w.child;E=E.firstContext;e:for(;E!==null;){var G=E;E=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){E.lanes|=a,G=E.alternate,G!==null&&(G.lanes|=a),Fc(E.return,a,t),h||(M=null);break e}E=G.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(s(341));M.lanes|=a,E=M.alternate,E!==null&&(E.lanes|=a),Fc(M,a,t),M=null}else M=w.child;if(M!==null)M.return=w;else for(M=w;M!==null;){if(M===t){M=null;break}if(w=M.sibling,w!==null){w.return=M.return,M=w;break}M=M.return}w=M}}function es(t,n,a,h){t=null;for(var w=n,E=!1;w!==null;){if(!E){if((w.flags&524288)!==0)E=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var M=w.alternate;if(M===null)throw Error(s(387));if(M=M.memoizedProps,M!==null){var G=w.type;_n(w.pendingProps.value,M.value)||(t!==null?t.push(G):t=[G])}}else if(w===Z.current){if(M=w.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(wa):t=[wa])}w=w.return}t!==null&&Uc(n,t,a,h),n.flags|=262144}function _o(t){for(t=t.firstContext;t!==null;){if(!_n(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function mi(t){pi=t,hr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Zt(t){return cp(pi,t)}function So(t,n){return pi===null&&mi(t),cp(t,n)}function cp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},hr===null){if(t===null)throw Error(s(308));hr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else hr=hr.next=n;return a}var u_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},d_=e.unstable_scheduleCallback,h_=e.unstable_NormalPriority,Mt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $c(){return{controller:new u_,data:new Map,refCount:0}}function Zs(t){t.refCount--,t.refCount===0&&d_(h_,function(){t.controller.abort()})}var Qs=null,qc=0,ts=0,ns=null;function f_(t,n){if(Qs===null){var a=Qs=[];qc=0,ts=Vu(),ns={status:"pending",value:void 0,then:function(h){a.push(h)}}}return qc++,n.then(up,up),n}function up(){if(--qc===0&&Qs!==null){ns!==null&&(ns.status="fulfilled");var t=Qs;Qs=null,ts=0,ns=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function p_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var dp=B.S;B.S=function(t,n){Ym=qe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&f_(t,n),dp!==null&&dp(t,n)};var gi=L(null);function Wc(){var t=gi.current;return t!==null?t:xt.pooledCache}function wo(t,n){n===null?U(gi,gi.current):U(gi,n.pool)}function hp(){var t=Wc();return t===null?null:{parent:Mt._currentValue,pool:t}}var rs=Error(s(460)),Gc=Error(s(474)),Co=Error(s(542)),ko={then:function(){}};function fp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function pp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(lr,lr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,gp(t),t;default:if(typeof n.status=="string")n.then(lr,lr);else{if(t=xt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,gp(t),t}throw vi=n,rs}}function xi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(vi=a,rs):a}}var vi=null;function mp(){if(vi===null)throw Error(s(459));var t=vi;return vi=null,t}function gp(t){if(t===rs||t===Co)throw Error(s(483))}var is=null,Js=0;function Eo(t){var n=Js;return Js+=1,is===null&&(is=[]),pp(is,t,n)}function ea(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function jo(t,n){throw n.$$typeof===b?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function xp(t){function n(re,te){if(t){var oe=re.deletions;oe===null?(re.deletions=[te],re.flags|=16):oe.push(te)}}function a(re,te){if(!t)return null;for(;te!==null;)n(re,te),te=te.sibling;return null}function h(re){for(var te=new Map;re!==null;)re.key!==null?te.set(re.key,re):te.set(re.index,re),re=re.sibling;return te}function w(re,te){return re=ur(re,te),re.index=0,re.sibling=null,re}function E(re,te,oe){return re.index=oe,t?(oe=re.alternate,oe!==null?(oe=oe.index,oe<te?(re.flags|=67108866,te):oe):(re.flags|=67108866,te)):(re.flags|=1048576,te)}function M(re){return t&&re.alternate===null&&(re.flags|=67108866),re}function G(re,te,oe,me){return te===null||te.tag!==6?(te=Mc(oe,re.mode,me),te.return=re,te):(te=w(te,oe),te.return=re,te)}function J(re,te,oe,me){var Re=oe.type;return Re===C?fe(re,te,oe.props.children,me,oe.key):te!==null&&(te.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===T&&xi(Re)===te.type)?(te=w(te,oe.props),ea(te,oe),te.return=re,te):(te=bo(oe.type,oe.key,oe.props,null,re.mode,me),ea(te,oe),te.return=re,te)}function le(re,te,oe,me){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Oc(oe,re.mode,me),te.return=re,te):(te=w(te,oe.children||[]),te.return=re,te)}function fe(re,te,oe,me,Re){return te===null||te.tag!==7?(te=hi(oe,re.mode,me,Re),te.return=re,te):(te=w(te,oe),te.return=re,te)}function ge(re,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Mc(""+te,re.mode,oe),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case S:return oe=bo(te.type,te.key,te.props,null,re.mode,oe),ea(oe,te),oe.return=re,oe;case k:return te=Oc(te,re.mode,oe),te.return=re,te;case T:return te=xi(te),ge(re,te,oe)}if(P(te)||Y(te))return te=hi(te,re.mode,oe,null),te.return=re,te;if(typeof te.then=="function")return ge(re,Eo(te),oe);if(te.$$typeof===_)return ge(re,So(re,te),oe);jo(re,te)}return null}function ce(re,te,oe,me){var Re=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Re!==null?null:G(re,te,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return oe.key===Re?J(re,te,oe,me):null;case k:return oe.key===Re?le(re,te,oe,me):null;case T:return oe=xi(oe),ce(re,te,oe,me)}if(P(oe)||Y(oe))return Re!==null?null:fe(re,te,oe,me,null);if(typeof oe.then=="function")return ce(re,te,Eo(oe),me);if(oe.$$typeof===_)return ce(re,te,So(re,oe),me);jo(re,oe)}return null}function de(re,te,oe,me,Re){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return re=re.get(oe)||null,G(te,re,""+me,Re);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return re=re.get(me.key===null?oe:me.key)||null,J(te,re,me,Re);case k:return re=re.get(me.key===null?oe:me.key)||null,le(te,re,me,Re);case T:return me=xi(me),de(re,te,oe,me,Re)}if(P(me)||Y(me))return re=re.get(oe)||null,fe(te,re,me,Re,null);if(typeof me.then=="function")return de(re,te,oe,Eo(me),Re);if(me.$$typeof===_)return de(re,te,oe,So(te,me),Re);jo(te,me)}return null}function Ee(re,te,oe,me){for(var Re=null,st=null,De=te,We=te=0,tt=null;De!==null&&We<oe.length;We++){De.index>We?(tt=De,De=null):tt=De.sibling;var at=ce(re,De,oe[We],me);if(at===null){De===null&&(De=tt);break}t&&De&&at.alternate===null&&n(re,De),te=E(at,te,We),st===null?Re=at:st.sibling=at,st=at,De=tt}if(We===oe.length)return a(re,De),rt&&dr(re,We),Re;if(De===null){for(;We<oe.length;We++)De=ge(re,oe[We],me),De!==null&&(te=E(De,te,We),st===null?Re=De:st.sibling=De,st=De);return rt&&dr(re,We),Re}for(De=h(De);We<oe.length;We++)tt=de(De,re,We,oe[We],me),tt!==null&&(t&&tt.alternate!==null&&De.delete(tt.key===null?We:tt.key),te=E(tt,te,We),st===null?Re=tt:st.sibling=tt,st=tt);return t&&De.forEach(function(Qr){return n(re,Qr)}),rt&&dr(re,We),Re}function Ie(re,te,oe,me){if(oe==null)throw Error(s(151));for(var Re=null,st=null,De=te,We=te=0,tt=null,at=oe.next();De!==null&&!at.done;We++,at=oe.next()){De.index>We?(tt=De,De=null):tt=De.sibling;var Qr=ce(re,De,at.value,me);if(Qr===null){De===null&&(De=tt);break}t&&De&&Qr.alternate===null&&n(re,De),te=E(Qr,te,We),st===null?Re=Qr:st.sibling=Qr,st=Qr,De=tt}if(at.done)return a(re,De),rt&&dr(re,We),Re;if(De===null){for(;!at.done;We++,at=oe.next())at=ge(re,at.value,me),at!==null&&(te=E(at,te,We),st===null?Re=at:st.sibling=at,st=at);return rt&&dr(re,We),Re}for(De=h(De);!at.done;We++,at=oe.next())at=de(De,re,We,at.value,me),at!==null&&(t&&at.alternate!==null&&De.delete(at.key===null?We:at.key),te=E(at,te,We),st===null?Re=at:st.sibling=at,st=at);return t&&De.forEach(function(k1){return n(re,k1)}),rt&&dr(re,We),Re}function gt(re,te,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:e:{for(var Re=oe.key;te!==null;){if(te.key===Re){if(Re=oe.type,Re===C){if(te.tag===7){a(re,te.sibling),me=w(te,oe.props.children),me.return=re,re=me;break e}}else if(te.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===T&&xi(Re)===te.type){a(re,te.sibling),me=w(te,oe.props),ea(me,oe),me.return=re,re=me;break e}a(re,te);break}else n(re,te);te=te.sibling}oe.type===C?(me=hi(oe.props.children,re.mode,me,oe.key),me.return=re,re=me):(me=bo(oe.type,oe.key,oe.props,null,re.mode,me),ea(me,oe),me.return=re,re=me)}return M(re);case k:e:{for(Re=oe.key;te!==null;){if(te.key===Re)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){a(re,te.sibling),me=w(te,oe.children||[]),me.return=re,re=me;break e}else{a(re,te);break}else n(re,te);te=te.sibling}me=Oc(oe,re.mode,me),me.return=re,re=me}return M(re);case T:return oe=xi(oe),gt(re,te,oe,me)}if(P(oe))return Ee(re,te,oe,me);if(Y(oe)){if(Re=Y(oe),typeof Re!="function")throw Error(s(150));return oe=Re.call(oe),Ie(re,te,oe,me)}if(typeof oe.then=="function")return gt(re,te,Eo(oe),me);if(oe.$$typeof===_)return gt(re,te,So(re,oe),me);jo(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(a(re,te.sibling),me=w(te,oe),me.return=re,re=me):(a(re,te),me=Mc(oe,re.mode,me),me.return=re,re=me),M(re)):a(re,te)}return function(re,te,oe,me){try{Js=0;var Re=gt(re,te,oe,me);return is=null,Re}catch(De){if(De===rs||De===Co)throw De;var st=Sn(29,De,null,re.mode);return st.lanes=me,st.return=re,st}finally{}}}var bi=xp(!0),vp=xp(!1),Or=!1;function Vc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ir(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Br(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(lt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=vo(t),tp(t,null,a),n}return xo(t,h,n,a),vo(t)}function ta(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,cf(t,a)}}function Kc(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=M:E=E.next=M,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Xc=!1;function na(){if(Xc){var t=ns;if(t!==null)throw t}}function ra(t,n,a,h){Xc=!1;var w=t.updateQueue;Or=!1;var E=w.firstBaseUpdate,M=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,M===null?E=le:M.next=le,M=J;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,G=fe.lastBaseUpdate,G!==M&&(G===null?fe.firstBaseUpdate=le:G.next=le,fe.lastBaseUpdate=J))}if(E!==null){var ge=w.baseState;M=0,fe=le=J=null,G=E;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(et&ce)===ce:(h&ce)===ce){ce!==0&&ce===ts&&(Xc=!0),fe!==null&&(fe=fe.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var Ee=t,Ie=G;ce=n;var gt=a;switch(Ie.tag){case 1:if(Ee=Ie.payload,typeof Ee=="function"){ge=Ee.call(gt,ge,ce);break e}ge=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ie.payload,ce=typeof Ee=="function"?Ee.call(gt,ge,ce):Ee,ce==null)break e;ge=m({},ge,ce);break e;case 2:Or=!0}}ce=G.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},fe===null?(le=fe=de,J=ge):fe=fe.next=de,M|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);fe===null&&(J=ge),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=fe,E===null&&(w.shared.lanes=0),Ur|=M,t.lanes=M,t.memoizedState=ge}}function bp(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function yp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)bp(a[t],n)}var ss=L(null),No=L(0);function _p(t,n){t=Sr,U(No,t),U(ss,n),Sr=t|n.baseLanes}function Zc(){U(No,Sr),U(ss,ss.current)}function Qc(){Sr=No.current,q(ss),q(No)}var wn=L(null),Hn=null;function zr(t){var n=t.alternate;U(At,At.current&1),U(wn,t),Hn===null&&(n===null||ss.current!==null||n.memoizedState!==null)&&(Hn=t)}function Jc(t){U(At,At.current),U(wn,t),Hn===null&&(Hn=t)}function Sp(t){t.tag===22?(U(At,At.current),U(wn,t),Hn===null&&(Hn=t)):Hr()}function Hr(){U(At,At.current),U(wn,wn.current)}function Cn(t){q(wn),Hn===t&&(Hn=null),q(At)}var At=L(0);function To(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||sd(a)||ad(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var pr=0,$e=null,pt=null,Ot=null,Ao=!1,as=!1,yi=!1,Do=0,ia=0,os=null,m_=0;function Nt(){throw Error(s(321))}function eu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!_n(t[a],n[a]))return!1;return!0}function tu(t,n,a,h,w,E){return pr=E,$e=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=t===null||t.memoizedState===null?sm:gu,yi=!1,E=a(h,w),yi=!1,as&&(E=Cp(n,a,h,w)),wp(t),E}function wp(t){B.H=oa;var n=pt!==null&&pt.next!==null;if(pr=0,Ot=pt=$e=null,Ao=!1,ia=0,os=null,n)throw Error(s(300));t===null||It||(t=t.dependencies,t!==null&&_o(t)&&(It=!0))}function Cp(t,n,a,h){$e=t;var w=0;do{if(as&&(os=null),ia=0,as=!1,25<=w)throw Error(s(301));if(w+=1,Ot=pt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}B.H=am,E=n(a,h)}while(as);return E}function g_(){var t=B.H,n=t.useState()[0];return n=typeof n.then=="function"?sa(n):n,t=t.useState()[0],(pt!==null?pt.memoizedState:null)!==t&&($e.flags|=1024),n}function nu(){var t=Do!==0;return Do=0,t}function ru(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function iu(t){if(Ao){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Ao=!1}pr=0,Ot=pt=$e=null,as=!1,ia=Do=0,os=null}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?$e.memoizedState=Ot=t:Ot=Ot.next=t,Ot}function Dt(){if(pt===null){var t=$e.alternate;t=t!==null?t.memoizedState:null}else t=pt.next;var n=Ot===null?$e.memoizedState:Ot.next;if(n!==null)Ot=n,pt=t;else{if(t===null)throw $e.alternate===null?Error(s(467)):Error(s(310));pt=t,t={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Ot===null?$e.memoizedState=Ot=t:Ot=Ot.next=t}return Ot}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sa(t){var n=ia;return ia+=1,os===null&&(os=[]),t=pp(os,t,n),n=$e,(Ot===null?n.memoizedState:Ot.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?sm:gu),t}function Lo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return sa(t);if(t.$$typeof===_)return Zt(t)}throw Error(s(438,String(t)))}function su(t){var n=null,a=$e.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=$e.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ro(),$e.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=z;return n.index++,a}function mr(t,n){return typeof n=="function"?n(t):n}function Mo(t){var n=Dt();return au(n,pt,t)}function au(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,E=h.pending;if(E!==null){if(w!==null){var M=w.next;w.next=E.next,E.next=M}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var G=M=null,J=null,le=n,fe=!1;do{var ge=le.lane&-536870913;if(ge!==le.lane?(et&ge)===ge:(pr&ge)===ge){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),ge===ts&&(fe=!0);else if((pr&ce)===ce){le=le.next,ce===ts&&(fe=!0);continue}else ge={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ge,M=E):J=J.next=ge,$e.lanes|=ce,Ur|=ce;ge=le.action,yi&&a(E,ge),E=le.hasEagerState?le.eagerState:a(E,ge)}else ce={lane:ge,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,M=E):J=J.next=ce,$e.lanes|=ge,Ur|=ge;le=le.next}while(le!==null&&le!==n);if(J===null?M=E:J.next=G,!_n(E,t.memoizedState)&&(It=!0,fe&&(a=ns,a!==null)))throw a;t.memoizedState=E,t.baseState=M,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function ou(t){var n=Dt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do E=t(E,M.action),M=M.next;while(M!==w);_n(E,n.memoizedState)||(It=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function kp(t,n,a){var h=$e,w=Dt(),E=rt;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!_n((pt||w).memoizedState,a);if(M&&(w.memoizedState=a,It=!0),w=w.queue,uu(Np.bind(null,h,w,t),[t]),w.getSnapshot!==n||M||Ot!==null&&Ot.memoizedState.tag&1){if(h.flags|=2048,ls(9,{destroy:void 0},jp.bind(null,h,w,a,n),null),xt===null)throw Error(s(349));E||(pr&127)!==0||Ep(h,n,a)}return a}function Ep(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=$e.updateQueue,n===null?(n=Ro(),$e.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function jp(t,n,a,h){n.value=a,n.getSnapshot=h,Tp(n)&&Ap(t)}function Np(t,n,a){return a(function(){Tp(n)&&Ap(t)})}function Tp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!_n(t,a)}catch{return!0}}function Ap(t){var n=di(t,2);n!==null&&vn(n,t,2)}function lu(t){var n=on();if(typeof t=="function"){var a=t;if(t=a(),yi){_t(!0);try{a()}finally{_t(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:t},n}function Dp(t,n,a,h){return t.baseState=a,au(t,pt,typeof h=="function"?h:mr)}function x_(t,n,a,h,w){if(Bo(t))throw Error(s(485));if(t=n.action,t!==null){var E={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){E.listeners.push(M)}};B.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,Rp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function Rp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=B.T,M={};B.T=M;try{var G=a(w,h),J=B.S;J!==null&&J(M,G),Lp(t,n,G)}catch(le){cu(t,n,le)}finally{E!==null&&M.types!==null&&(E.types=M.types),B.T=E}}else try{E=a(w,h),Lp(t,n,E)}catch(le){cu(t,n,le)}}function Lp(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Mp(t,n,h)},function(h){return cu(t,n,h)}):Mp(t,n,a)}function Mp(t,n,a){n.status="fulfilled",n.value=a,Op(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Rp(t,a)))}function cu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Op(n),n=n.next;while(n!==h)}t.action=null}function Op(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Ip(t,n){return n}function Bp(t,n){if(rt){var a=xt.formState;if(a!==null){e:{var h=$e;if(rt){if(St){t:{for(var w=St,E=zn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Pn(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){St=Pn(w.nextSibling),h=w.data==="F!";break e}}Lr(h)}h=!1}h&&(n=a[0])}}return a=on(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ip,lastRenderedState:n},a.queue=h,a=nm.bind(null,$e,h),h.dispatch=a,h=lu(!1),E=mu.bind(null,$e,!1,h.queue),h=on(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=x_.bind(null,$e,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function zp(t){var n=Dt();return Hp(n,pt,t)}function Hp(t,n,a){if(n=au(t,n,Ip)[0],t=Mo(mr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=sa(n)}catch(M){throw M===rs?Co:M}else h=n;n=Dt();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&($e.flags|=2048,ls(9,{destroy:void 0},v_.bind(null,w,a),null)),[h,E,t]}function v_(t,n){t.action=n}function Pp(t){var n=Dt(),a=pt;if(a!==null)return Hp(n,a,t);Dt(),n=n.memoizedState,a=Dt();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function ls(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=$e.updateQueue,n===null&&(n=Ro(),$e.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function Fp(){return Dt().memoizedState}function Oo(t,n,a,h){var w=on();$e.flags|=t,w.memoizedState=ls(1|n,{destroy:void 0},a,h===void 0?null:h)}function Io(t,n,a,h){var w=Dt();h=h===void 0?null:h;var E=w.memoizedState.inst;pt!==null&&h!==null&&eu(h,pt.memoizedState.deps)?w.memoizedState=ls(n,E,a,h):($e.flags|=t,w.memoizedState=ls(1|n,E,a,h))}function Up(t,n){Oo(8390656,8,t,n)}function uu(t,n){Io(2048,8,t,n)}function b_(t){$e.flags|=4;var n=$e.updateQueue;if(n===null)n=Ro(),$e.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function $p(t){var n=Dt().memoizedState;return b_({ref:n,nextImpl:t}),function(){if((lt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function qp(t,n){return Io(4,2,t,n)}function Wp(t,n){return Io(4,4,t,n)}function Gp(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Vp(t,n,a){a=a!=null?a.concat([t]):null,Io(4,4,Gp.bind(null,n,t),a)}function du(){}function Yp(t,n){var a=Dt();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&eu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function Kp(t,n){var a=Dt();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&eu(n,h[1]))return h[0];if(h=t(),yi){_t(!0);try{t()}finally{_t(!1)}}return a.memoizedState=[h,n],h}function hu(t,n,a){return a===void 0||(pr&1073741824)!==0&&(et&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Xm(),$e.lanes|=t,Ur|=t,a)}function Xp(t,n,a,h){return _n(a,n)?a:ss.current!==null?(t=hu(t,a,h),_n(t,n)||(It=!0),t):(pr&42)===0||(pr&1073741824)!==0&&(et&261930)===0?(It=!0,t.memoizedState=a):(t=Xm(),$e.lanes|=t,Ur|=t,n)}function Zp(t,n,a,h,w){var E=X.p;X.p=E!==0&&8>E?E:8;var M=B.T,G={};B.T=G,mu(t,!1,n,a);try{var J=w(),le=B.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var fe=p_(J,h);aa(t,n,fe,jn(t))}else aa(t,n,h,jn(t))}catch(ge){aa(t,n,{then:function(){},status:"rejected",reason:ge},jn())}finally{X.p=E,M!==null&&G.types!==null&&(M.types=G.types),B.T=M}}function y_(){}function fu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=Qp(t).queue;Zp(t,w,n,Q,a===null?y_:function(){return Jp(t),a(h)})}function Qp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:Q},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Jp(t){var n=Qp(t);n.next===null&&(n=t.alternate.memoizedState),aa(t,n.next.queue,{},jn())}function pu(){return Zt(wa)}function em(){return Dt().memoizedState}function tm(){return Dt().memoizedState}function __(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=jn();t=Ir(a);var h=Br(n,t,a);h!==null&&(vn(h,n,a),ta(h,n,a)),n={cache:$c()},t.payload=n;return}n=n.return}}function S_(t,n,a){var h=jn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Bo(t)?rm(n,a):(a=Rc(t,n,a,h),a!==null&&(vn(a,t,h),im(a,n,h)))}function nm(t,n,a){var h=jn();aa(t,n,a,h)}function aa(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Bo(t))rm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var M=n.lastRenderedState,G=E(M,a);if(w.hasEagerState=!0,w.eagerState=G,_n(G,M))return xo(t,n,w,0),xt===null&&go(),!1}catch{}finally{}if(a=Rc(t,n,w,h),a!==null)return vn(a,t,h),im(a,n,h),!0}return!1}function mu(t,n,a,h){if(h={lane:2,revertLane:Vu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Bo(t)){if(n)throw Error(s(479))}else n=Rc(t,a,h,2),n!==null&&vn(n,t,2)}function Bo(t){var n=t.alternate;return t===$e||n!==null&&n===$e}function rm(t,n){as=Ao=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function im(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,cf(t,a)}}var oa={readContext:Zt,use:Lo,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};oa.useEffectEvent=Nt;var sm={readContext:Zt,use:Lo,useCallback:function(t,n){return on().memoizedState=[t,n===void 0?null:n],t},useContext:Zt,useEffect:Up,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Oo(4194308,4,Gp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Oo(4194308,4,t,n)},useInsertionEffect:function(t,n){Oo(4,2,t,n)},useMemo:function(t,n){var a=on();n=n===void 0?null:n;var h=t();if(yi){_t(!0);try{t()}finally{_t(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=on();if(a!==void 0){var w=a(n);if(yi){_t(!0);try{a(n)}finally{_t(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=S_.bind(null,$e,t),[h.memoizedState,t]},useRef:function(t){var n=on();return t={current:t},n.memoizedState=t},useState:function(t){t=lu(t);var n=t.queue,a=nm.bind(null,$e,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:du,useDeferredValue:function(t,n){var a=on();return hu(a,t,n)},useTransition:function(){var t=lu(!1);return t=Zp.bind(null,$e,t.queue,!0,!1),on().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=$e,w=on();if(rt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),xt===null)throw Error(s(349));(et&127)!==0||Ep(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,Up(Np.bind(null,h,E,t),[t]),h.flags|=2048,ls(9,{destroy:void 0},jp.bind(null,h,E,a,n),null),a},useId:function(){var t=on(),n=xt.identifierPrefix;if(rt){var a=Zn,h=Xn;a=(h&~(1<<32-Je(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Do++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=m_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:pu,useFormState:Bp,useActionState:Bp,useOptimistic:function(t){var n=on();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=mu.bind(null,$e,!0,a),a.dispatch=n,[t,n]},useMemoCache:su,useCacheRefresh:function(){return on().memoizedState=__.bind(null,$e)},useEffectEvent:function(t){var n=on(),a={impl:t};return n.memoizedState=a,function(){if((lt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},gu={readContext:Zt,use:Lo,useCallback:Yp,useContext:Zt,useEffect:uu,useImperativeHandle:Vp,useInsertionEffect:qp,useLayoutEffect:Wp,useMemo:Kp,useReducer:Mo,useRef:Fp,useState:function(){return Mo(mr)},useDebugValue:du,useDeferredValue:function(t,n){var a=Dt();return Xp(a,pt.memoizedState,t,n)},useTransition:function(){var t=Mo(mr)[0],n=Dt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:kp,useId:em,useHostTransitionStatus:pu,useFormState:zp,useActionState:zp,useOptimistic:function(t,n){var a=Dt();return Dp(a,pt,t,n)},useMemoCache:su,useCacheRefresh:tm};gu.useEffectEvent=$p;var am={readContext:Zt,use:Lo,useCallback:Yp,useContext:Zt,useEffect:uu,useImperativeHandle:Vp,useInsertionEffect:qp,useLayoutEffect:Wp,useMemo:Kp,useReducer:ou,useRef:Fp,useState:function(){return ou(mr)},useDebugValue:du,useDeferredValue:function(t,n){var a=Dt();return pt===null?hu(a,t,n):Xp(a,pt.memoizedState,t,n)},useTransition:function(){var t=ou(mr)[0],n=Dt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:kp,useId:em,useHostTransitionStatus:pu,useFormState:Pp,useActionState:Pp,useOptimistic:function(t,n){var a=Dt();return pt!==null?Dp(a,pt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:su,useCacheRefresh:tm};am.useEffectEvent=$p;function xu(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var vu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=jn(),w=Ir(h);w.payload=n,a!=null&&(w.callback=a),n=Br(t,w,h),n!==null&&(vn(n,t,h),ta(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=jn(),w=Ir(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Br(t,w,h),n!==null&&(vn(n,t,h),ta(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=jn(),h=Ir(a);h.tag=2,n!=null&&(h.callback=n),n=Br(t,h,a),n!==null&&(vn(n,t,a),ta(n,t,a))}};function om(t,n,a,h,w,E,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,M):n.prototype&&n.prototype.isPureReactComponent?!Vs(a,h)||!Vs(w,E):!0}function lm(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&vu.enqueueReplaceState(n,n.state,null)}function _i(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function cm(t){mo(t)}function um(t){console.error(t)}function dm(t){mo(t)}function zo(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function hm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function bu(t,n,a){return a=Ir(a),a.tag=3,a.payload={element:null},a.callback=function(){zo(t,n)},a}function fm(t){return t=Ir(t),t.tag=3,t}function pm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=h.value;t.payload=function(){return w(E)},t.callback=function(){hm(n,a,h)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){hm(n,a,h),typeof w!="function"&&($r===null?$r=new Set([this]):$r.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function w_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&es(n,a,w,!0),a=wn.current,a!==null){switch(a.tag){case 31:case 13:return Hn===null?Xo():a.alternate===null&&Tt===0&&(Tt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===ko?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),qu(t,h,w)),!1;case 22:return a.flags|=65536,h===ko?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),qu(t,h,w)),!1}throw Error(s(435,a.tag))}return qu(t,h,w),Xo(),!1}if(rt)return n=wn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==zc&&(t=Error(s(422),{cause:h}),Xs(On(t,a)))):(h!==zc&&(n=Error(s(423),{cause:h}),Xs(On(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=On(h,a),w=bu(t.stateNode,h,w),Kc(t,w),Tt!==4&&(Tt=2)),!1;var E=Error(s(520),{cause:h});if(E=On(E,a),ma===null?ma=[E]:ma.push(E),Tt!==4&&(Tt=2),n===null)return!0;h=On(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=bu(a.stateNode,h,t),Kc(a,t),!1;case 1:if(n=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&($r===null||!$r.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=fm(w),pm(w,t,a,h),Kc(a,w),!1}a=a.return}while(a!==null);return!1}var yu=Error(s(461)),It=!1;function Qt(t,n,a,h){n.child=t===null?vp(n,null,a,h):bi(n,t.child,a,h)}function mm(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var M={};for(var G in h)G!=="ref"&&(M[G]=h[G])}else M=h;return mi(n),h=tu(t,n,a,M,E,w),G=nu(),t!==null&&!It?(ru(t,n,w),gr(t,n,w)):(rt&&G&&Ic(n),n.flags|=1,Qt(t,n,h,w),n.child)}function gm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!Lc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,xm(t,n,E,h,w)):(t=bo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Nu(t,w)){var M=E.memoizedProps;if(a=a.compare,a=a!==null?a:Vs,a(M,h)&&t.ref===n.ref)return gr(t,n,w)}return n.flags|=1,t=ur(E,h),t.ref=n.ref,t.return=n,n.child=t}function xm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(Vs(E,h)&&t.ref===n.ref)if(It=!1,n.pendingProps=h=E,Nu(t,w))(t.flags&131072)!==0&&(It=!0);else return n.lanes=t.lanes,gr(t,n,w)}return _u(t,n,a,h,w)}function vm(t,n,a,h){var w=h.children,E=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~E}else h=0,n.child=null;return bm(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&wo(n,E!==null?E.cachePool:null),E!==null?_p(n,E):Zc(),Sp(n);else return h=n.lanes=536870912,bm(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(wo(n,E.cachePool),_p(n,E),Hr(),n.memoizedState=null):(t!==null&&wo(n,null),Zc(),Hr());return Qt(t,n,w,a),n.child}function la(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function bm(t,n,a,h,w){var E=Wc();return E=E===null?null:{parent:Mt._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&wo(n,null),Zc(),Sp(n),t!==null&&es(t,n,h,!0),n.childLanes=w,null}function Ho(t,n){return n=Fo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function ym(t,n,a){return bi(n,t.child,null,a),t=Ho(n,n.pendingProps),t.flags|=2,Cn(n),n.memoizedState=null,t}function C_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(rt){if(h.mode==="hidden")return t=Ho(n,h),n.lanes=536870912,la(null,t);if(Jc(n),(t=St)?(t=Rg(t,zn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Dr!==null?{id:Xn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},a=rp(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Lr(n);return n.lanes=536870912,null}return Ho(n,h)}var E=t.memoizedState;if(E!==null){var M=E.dehydrated;if(Jc(n),w)if(n.flags&256)n.flags&=-257,n=ym(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(It||es(t,n,a,!1),w=(a&t.childLanes)!==0,It||w){if(h=xt,h!==null&&(M=uf(h,a),M!==0&&M!==E.retryLane))throw E.retryLane=M,di(t,M),vn(h,t,M),yu;Xo(),n=ym(t,n,a)}else t=E.treeContext,St=Pn(M.nextSibling),Xt=n,rt=!0,Rr=null,zn=!1,t!==null&&ap(n,t),n=Ho(n,h),n.flags|=4096;return n}return t=ur(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Po(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function _u(t,n,a,h,w){return mi(n),a=tu(t,n,a,h,void 0,w),h=nu(),t!==null&&!It?(ru(t,n,w),gr(t,n,w)):(rt&&h&&Ic(n),n.flags|=1,Qt(t,n,a,w),n.child)}function _m(t,n,a,h,w,E){return mi(n),n.updateQueue=null,a=Cp(n,h,a,w),wp(t),h=nu(),t!==null&&!It?(ru(t,n,E),gr(t,n,E)):(rt&&h&&Ic(n),n.flags|=1,Qt(t,n,a,E),n.child)}function Sm(t,n,a,h,w){if(mi(n),n.stateNode===null){var E=Xi,M=a.contextType;typeof M=="object"&&M!==null&&(E=Zt(M)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=vu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},Vc(n),M=a.contextType,E.context=typeof M=="object"&&M!==null?Zt(M):Xi,E.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(xu(n,a,M,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(M=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),M!==E.state&&vu.enqueueReplaceState(E,E.state,null),ra(n,h,E,w),na(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var G=n.memoizedProps,J=_i(a,G);E.props=J;var le=E.context,fe=a.contextType;M=Xi,typeof fe=="object"&&fe!==null&&(M=Zt(fe));var ge=a.getDerivedStateFromProps;fe=typeof ge=="function"||typeof E.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,fe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(G||le!==M)&&lm(n,E,h,M),Or=!1;var ce=n.memoizedState;E.state=ce,ra(n,h,E,w),na(),le=n.memoizedState,G||ce!==le||Or?(typeof ge=="function"&&(xu(n,a,ge,h),le=n.memoizedState),(J=Or||om(n,a,J,h,ce,le,M))?(fe||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(n.flags|=4194308)):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),E.props=h,E.state=le,E.context=M,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,Yc(t,n),M=n.memoizedProps,fe=_i(a,M),E.props=fe,ge=n.pendingProps,ce=E.context,le=a.contextType,J=Xi,typeof le=="object"&&le!==null&&(J=Zt(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(M!==ge||ce!==J)&&lm(n,E,h,J),Or=!1,ce=n.memoizedState,E.state=ce,ra(n,h,E,w),na();var de=n.memoizedState;M!==ge||ce!==de||Or||t!==null&&t.dependencies!==null&&_o(t.dependencies)?(typeof G=="function"&&(xu(n,a,G,h),de=n.memoizedState),(fe=Or||om(n,a,fe,h,ce,de,J)||t!==null&&t.dependencies!==null&&_o(t.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),E.props=h,E.state=de,E.context=J,h=fe):(typeof E.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,Po(t,n),h=(n.flags&128)!==0,E||h?(E=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&h?(n.child=bi(n,t.child,null,w),n.child=bi(n,null,a,w)):Qt(t,n,a,w),n.memoizedState=E.state,t=n.child):t=gr(t,n,w),t}function wm(t,n,a,h){return fi(),n.flags|=256,Qt(t,n,a,h),n.child}var Su={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wu(t){return{baseLanes:t,cachePool:hp()}}function Cu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=En),t}function Cm(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,M;if((M=E)||(M=t!==null&&t.memoizedState===null?!1:(At.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(rt){if(w?zr(n):Hr(),(t=St)?(t=Rg(t,zn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Dr!==null?{id:Xn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},a=rp(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Lr(n);return ad(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Hr(),w=n.mode,G=Fo({mode:"hidden",children:G},w),h=hi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=wu(a),h.childLanes=Cu(t,M,a),n.memoizedState=Su,la(null,h)):(zr(n),ku(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(E)n.flags&256?(zr(n),n.flags&=-257,n=Eu(t,n,a)):n.memoizedState!==null?(Hr(),n.child=t.child,n.flags|=128,n=null):(Hr(),G=h.fallback,w=n.mode,h=Fo({mode:"visible",children:h.children},w),G=hi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,bi(n,t.child,null,a),h=n.child,h.memoizedState=wu(a),h.childLanes=Cu(t,M,a),n.memoizedState=Su,n=la(null,h));else if(zr(n),ad(G)){if(M=G.nextSibling&&G.nextSibling.dataset,M)var le=M.dgst;M=le,h=Error(s(419)),h.stack="",h.digest=M,Xs({value:h,source:null,stack:null}),n=Eu(t,n,a)}else if(It||es(t,n,a,!1),M=(a&t.childLanes)!==0,It||M){if(M=xt,M!==null&&(h=uf(M,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,di(t,h),vn(M,t,h),yu;sd(G)||Xo(),n=Eu(t,n,a)}else sd(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,St=Pn(G.nextSibling),Xt=n,rt=!0,Rr=null,zn=!1,t!==null&&ap(n,t),n=ku(n,h.children),n.flags|=4096);return n}return w?(Hr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=ur(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=ur(le,G):(G=hi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,la(null,h),h=n.child,G=t.child.memoizedState,G===null?G=wu(a):(w=G.cachePool,w!==null?(J=Mt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=hp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=Cu(t,M,a),n.memoizedState=Su,la(t.child,h)):(zr(n),a=t.child,t=a.sibling,a=ur(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(M=n.deletions,M===null?(n.deletions=[t],n.flags|=16):M.push(t)),n.child=a,n.memoizedState=null,a)}function ku(t,n){return n=Fo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Fo(t,n){return t=Sn(22,t,null,n),t.lanes=0,t}function Eu(t,n,a){return bi(n,t.child,null,a),t=ku(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function km(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Fc(t.return,n,a)}function ju(t,n,a,h,w,E){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=h,M.tail=a,M.tailMode=w,M.treeForkCount=E)}function Em(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=h.tail;h=h.children;var M=At.current,G=(M&2)!==0;if(G?(M=M&1|2,n.flags|=128):M&=1,U(At,M),Qt(t,n,h,a),h=rt?Ks:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&km(t,a,n);else if(t.tag===19)km(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&To(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),ju(n,!1,w,a,E,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&To(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}ju(n,!0,a,null,E,h);break;case"together":ju(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function gr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Ur|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(es(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=ur(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=ur(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Nu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&_o(t)))}function k_(t,n,a){switch(n.tag){case 3:W(n,n.stateNode.containerInfo),Mr(n,Mt,t.memoizedState.cache),fi();break;case 27:case 5:se(n);break;case 4:W(n,n.stateNode.containerInfo);break;case 10:Mr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Jc(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(zr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Cm(t,n,a):(zr(n),t=gr(t,n,a),t!==null?t.sibling:null);zr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(es(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Em(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),U(At,At.current),h)break;return null;case 22:return n.lanes=0,vm(t,n,a,n.pendingProps);case 24:Mr(n,Mt,t.memoizedState.cache)}return gr(t,n,a)}function jm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)It=!0;else{if(!Nu(t,a)&&(n.flags&128)===0)return It=!1,k_(t,n,a);It=(t.flags&131072)!==0}else It=!1,rt&&(n.flags&1048576)!==0&&sp(n,Ks,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=xi(n.elementType),n.type=t,typeof t=="function")Lc(t)?(h=_i(t,h),n.tag=1,n=Sm(null,n,t,h,a)):(n.tag=0,n=_u(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=mm(null,n,t,h,a);break e}else if(w===R){n.tag=14,n=gm(null,n,t,h,a);break e}}throw n=F(t)||t,Error(s(306,n,""))}}return n;case 0:return _u(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=_i(h,n.pendingProps),Sm(t,n,h,w,a);case 3:e:{if(W(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,Yc(t,n),ra(n,h,null,a);var M=n.memoizedState;if(h=M.cache,Mr(n,Mt,h),h!==E.cache&&Uc(n,[Mt],a,!0),na(),h=M.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=wm(t,n,h,a);break e}else if(h!==w){w=On(Error(s(424)),n),Xs(w),n=wm(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(St=Pn(t.firstChild),Xt=n,rt=!0,Rr=null,zn=!0,a=vp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(fi(),h===w){n=gr(t,n,a);break e}Qt(t,n,h,a)}n=n.child}return n;case 26:return Po(t,n),t===null?(a=zg(n.type,null,n.pendingProps,null))?n.memoizedState=a:rt||(a=n.type,t=n.pendingProps,h=rl(ne.current).createElement(a),h[Kt]=n,h[hn]=t,Jt(h,a,t),qt(h),n.stateNode=h):n.memoizedState=zg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return se(n),t===null&&rt&&(h=n.stateNode=Og(n.type,n.pendingProps,ne.current),Xt=n,zn=!0,w=St,Vr(n.type)?(od=w,St=Pn(h.firstChild)):St=w),Qt(t,n,n.pendingProps.children,a),Po(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&rt&&((w=h=St)&&(h=t1(h,n.type,n.pendingProps,zn),h!==null?(n.stateNode=h,Xt=n,St=Pn(h.firstChild),zn=!1,w=!0):w=!1),w||Lr(n)),se(n),w=n.type,E=n.pendingProps,M=t!==null?t.memoizedProps:null,h=E.children,nd(w,E)?h=null:M!==null&&nd(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=tu(t,n,g_,null,null,a),wa._currentValue=w),Po(t,n),Qt(t,n,h,a),n.child;case 6:return t===null&&rt&&((t=a=St)&&(a=n1(a,n.pendingProps,zn),a!==null?(n.stateNode=a,Xt=n,St=null,t=!0):t=!1),t||Lr(n)),null;case 13:return Cm(t,n,a);case 4:return W(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=bi(n,null,h,a):Qt(t,n,h,a),n.child;case 11:return mm(t,n,n.type,n.pendingProps,a);case 7:return Qt(t,n,n.pendingProps,a),n.child;case 8:return Qt(t,n,n.pendingProps.children,a),n.child;case 12:return Qt(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Mr(n,n.type,h.value),Qt(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,mi(n),w=Zt(w),h=h(w),n.flags|=1,Qt(t,n,h,a),n.child;case 14:return gm(t,n,n.type,n.pendingProps,a);case 15:return xm(t,n,n.type,n.pendingProps,a);case 19:return Em(t,n,a);case 31:return C_(t,n,a);case 22:return vm(t,n,a,n.pendingProps);case 24:return mi(n),h=Zt(Mt),t===null?(w=Wc(),w===null&&(w=xt,E=$c(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},Vc(n),Mr(n,Mt,w)):((t.lanes&a)!==0&&(Yc(t,n),ra(n,null,null,a),na()),w=t.memoizedState,E=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Mr(n,Mt,h)):(h=E.cache,Mr(n,Mt,h),h!==w.cache&&Uc(n,[Mt],a,!0))),Qt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function xr(t){t.flags|=4}function Tu(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(eg())t.flags|=8192;else throw vi=ko,Gc}else t.flags&=-16777217}function Nm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!$g(n))if(eg())t.flags|=8192;else throw vi=ko,Gc}function Uo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?sc():536870912,t.lanes|=n,hs|=n)}function ca(t,n){if(!rt)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function wt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function E_(t,n,a){var h=n.pendingProps;switch(Bc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wt(n),null;case 1:return wt(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),fr(Mt),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ji(n)?xr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Hc())),wt(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(xr(n),E!==null?(wt(n),Nm(n,E)):(wt(n),Tu(n,w,null,h,a))):E?E!==t.memoizedState?(xr(n),wt(n),Nm(n,E)):(wt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&xr(n),wt(n),Tu(n,w,t,h,a)),null;case 27:if(pe(n),a=ne.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&xr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return wt(n),null}t=K.current,Ji(n)?op(n):(t=Og(w,h,a),n.stateNode=t,xr(n))}return wt(n),null;case 5:if(pe(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&xr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return wt(n),null}if(E=K.current,Ji(n))op(n);else{var M=rl(ne.current);switch(E){case 1:E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=M.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?M.createElement("select",{is:h.is}):M.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?M.createElement(w,{is:h.is}):M.createElement(w)}}E[Kt]=n,E[hn]=h;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)E.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===n)break e;for(;M.sibling===null;){if(M.return===null||M.return===n)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}n.stateNode=E;e:switch(Jt(E,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&xr(n)}}return wt(n),Tu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&xr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ne.current,Ji(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=Xt,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[Kt]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Cg(t.nodeValue,a)),t||Lr(n,!0)}else t=rl(t).createTextNode(h),t[Kt]=n,n.stateNode=t}return wt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=Ji(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Kt]=n}else fi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),t=!1}else a=Hc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(Cn(n),n):(Cn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return wt(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=Ji(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[Kt]=n}else fi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),w=!1}else w=Hc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(Cn(n),n):(Cn(n),null)}return Cn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),E=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(E=h.memoizedState.cachePool.pool),E!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Uo(n,n.updateQueue),wt(n),null);case 4:return ae(),t===null&&Zu(n.stateNode.containerInfo),wt(n),null;case 10:return fr(n.type),wt(n),null;case 19:if(q(At),h=n.memoizedState,h===null)return wt(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)ca(h,!1);else{if(Tt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=To(t),E!==null){for(n.flags|=128,ca(h,!1),t=E.updateQueue,n.updateQueue=t,Uo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)np(a,t),a=a.sibling;return U(At,At.current&1|2),rt&&dr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&qe()>Vo&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304)}else{if(!w)if(t=To(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Uo(n,t),ca(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!rt)return wt(n),null}else 2*qe()-h.renderingStartTime>Vo&&a!==536870912&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(t=h.last,t!==null?t.sibling=E:n.child=E,h.last=E)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=qe(),t.sibling=null,a=At.current,U(At,w?a&1|2:a&1),rt&&dr(n,h.treeForkCount),t):(wt(n),null);case 22:case 23:return Cn(n),Qc(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(wt(n),n.subtreeFlags&6&&(n.flags|=8192)):wt(n),a=n.updateQueue,a!==null&&Uo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&q(gi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),fr(Mt),wt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function j_(t,n){switch(Bc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return fr(Mt),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return pe(n),null;case 31:if(n.memoizedState!==null){if(Cn(n),n.alternate===null)throw Error(s(340));fi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Cn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));fi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return q(At),null;case 4:return ae(),null;case 10:return fr(n.type),null;case 22:case 23:return Cn(n),Qc(),t!==null&&q(gi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return fr(Mt),null;case 25:return null;default:return null}}function Tm(t,n){switch(Bc(n),n.tag){case 3:fr(Mt),ae();break;case 26:case 27:case 5:pe(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&Cn(n);break;case 13:Cn(n);break;case 19:q(At);break;case 10:fr(n.type);break;case 22:case 23:Cn(n),Qc(),t!==null&&q(gi);break;case 24:fr(Mt)}}function ua(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var E=a.create,M=a.inst;h=E(),M.destroy=h}a=a.next}while(a!==w)}}catch(G){ht(n,n.return,G)}}function Pr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var E=w.next;h=E;do{if((h.tag&t)===t){var M=h.inst,G=M.destroy;if(G!==void 0){M.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(fe){ht(w,J,fe)}}}h=h.next}while(h!==E)}}catch(fe){ht(n,n.return,fe)}}function Am(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{yp(n,a)}catch(h){ht(t,t.return,h)}}}function Dm(t,n,a){a.props=_i(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ht(t,n,h)}}function da(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){ht(t,n,w)}}function Qn(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){ht(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){ht(t,n,w)}else a.current=null}function Rm(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){ht(t,t.return,w)}}function Au(t,n,a){try{var h=t.stateNode;K_(h,t.type,a,n),h[hn]=n}catch(w){ht(t,t.return,w)}}function Lm(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Vr(t.type)||t.tag===4}function Du(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Lm(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Vr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ru(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=lr));else if(h!==4&&(h===27&&Vr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ru(t,n,a),t=t.sibling;t!==null;)Ru(t,n,a),t=t.sibling}function $o(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&Vr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for($o(t,n,a),t=t.sibling;t!==null;)$o(t,n,a),t=t.sibling}function Mm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);Jt(n,h,a),n[Kt]=t,n[hn]=a}catch(E){ht(t,t.return,E)}}var vr=!1,Bt=!1,Lu=!1,Om=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function N_(t,n){if(t=t.containerInfo,ed=ul,t=Vf(t),Ec(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,E=h.focusNode;h=h.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var M=0,G=-1,J=-1,le=0,fe=0,ge=t,ce=null;t:for(;;){for(var de;ge!==a||w!==0&&ge.nodeType!==3||(G=M+w),ge!==E||h!==0&&ge.nodeType!==3||(J=M+h),ge.nodeType===3&&(M+=ge.nodeValue.length),(de=ge.firstChild)!==null;)ce=ge,ge=de;for(;;){if(ge===t)break t;if(ce===a&&++le===w&&(G=M),ce===E&&++fe===h&&(J=M),(de=ge.nextSibling)!==null)break;ge=ce,ce=ge.parentNode}ge=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(td={focusedElem:t,selectionRange:a},ul=!1,Wt=n;Wt!==null;)if(n=Wt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Wt=t;else for(;Wt!==null;){switch(n=Wt,E=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&E!==null){t=void 0,a=n,w=E.memoizedProps,E=E.memoizedState,h=a.stateNode;try{var Ee=_i(a.type,w);t=h.getSnapshotBeforeUpdate(Ee,E),h.__reactInternalSnapshotBeforeUpdate=t}catch(Ie){ht(a,a.return,Ie)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)id(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":id(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Wt=t;break}Wt=n.return}}function Im(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:yr(t,a),h&4&&ua(5,a);break;case 1:if(yr(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){ht(a,a.return,M)}else{var w=_i(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){ht(a,a.return,M)}}h&64&&Am(a),h&512&&da(a,a.return);break;case 3:if(yr(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{yp(t,n)}catch(M){ht(a,a.return,M)}}break;case 27:n===null&&h&4&&Mm(a);case 26:case 5:yr(t,a),n===null&&h&4&&Rm(a),h&512&&da(a,a.return);break;case 12:yr(t,a);break;case 31:yr(t,a),h&4&&Hm(t,a);break;case 13:yr(t,a),h&4&&Pm(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=B_.bind(null,a),r1(t,a))));break;case 22:if(h=a.memoizedState!==null||vr,!h){n=n!==null&&n.memoizedState!==null||Bt,w=vr;var E=Bt;vr=h,(Bt=n)&&!E?_r(t,a,(a.subtreeFlags&8772)!==0):yr(t,a),vr=w,Bt=E}break;case 30:break;default:yr(t,a)}}function Bm(t){var n=t.alternate;n!==null&&(t.alternate=null,Bm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&cc(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Ct=null,pn=!1;function br(t,n,a){for(a=a.child;a!==null;)zm(t,n,a),a=a.sibling}function zm(t,n,a){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(Ve,a)}catch{}switch(a.tag){case 26:Bt||Qn(a,n),br(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Bt||Qn(a,n);var h=Ct,w=pn;Vr(a.type)&&(Ct=a.stateNode,pn=!1),br(t,n,a),ya(a.stateNode),Ct=h,pn=w;break;case 5:Bt||Qn(a,n);case 6:if(h=Ct,w=pn,Ct=null,br(t,n,a),Ct=h,pn=w,Ct!==null)if(pn)try{(Ct.nodeType===9?Ct.body:Ct.nodeName==="HTML"?Ct.ownerDocument.body:Ct).removeChild(a.stateNode)}catch(E){ht(a,n,E)}else try{Ct.removeChild(a.stateNode)}catch(E){ht(a,n,E)}break;case 18:Ct!==null&&(pn?(t=Ct,Ag(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ys(t)):Ag(Ct,a.stateNode));break;case 4:h=Ct,w=pn,Ct=a.stateNode.containerInfo,pn=!0,br(t,n,a),Ct=h,pn=w;break;case 0:case 11:case 14:case 15:Pr(2,a,n),Bt||Pr(4,a,n),br(t,n,a);break;case 1:Bt||(Qn(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Dm(a,n,h)),br(t,n,a);break;case 21:br(t,n,a);break;case 22:Bt=(h=Bt)||a.memoizedState!==null,br(t,n,a),Bt=h;break;default:br(t,n,a)}}function Hm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ys(t)}catch(a){ht(n,n.return,a)}}}function Pm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ys(t)}catch(a){ht(n,n.return,a)}}function T_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Om),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Om),n;default:throw Error(s(435,t.tag))}}function qo(t,n){var a=T_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=z_.bind(null,t,h);h.then(w,w)}})}function mn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],E=t,M=n,G=M;e:for(;G!==null;){switch(G.tag){case 27:if(Vr(G.type)){Ct=G.stateNode,pn=!1;break e}break;case 5:Ct=G.stateNode,pn=!1;break e;case 3:case 4:Ct=G.stateNode.containerInfo,pn=!0;break e}G=G.return}if(Ct===null)throw Error(s(160));zm(E,M,w),Ct=null,pn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Fm(n,t),n=n.sibling}var Gn=null;function Fm(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:mn(n,t),gn(t),h&4&&(Pr(3,t,t.return),ua(3,t),Pr(5,t,t.return));break;case 1:mn(n,t),gn(t),h&512&&(Bt||a===null||Qn(a,a.return)),h&64&&vr&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=Gn;if(mn(n,t),gn(t),h&512&&(Bt||a===null||Qn(a,a.return)),h&4){var E=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":E=w.getElementsByTagName("title")[0],(!E||E[zs]||E[Kt]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),Jt(E,h,a),E[Kt]=t,qt(E),h=E;break e;case"link":var M=Fg("link","href",w).get(h+(a.href||""));if(M){for(var G=0;G<M.length;G++)if(E=M[G],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){M.splice(G,1);break t}}E=w.createElement(h),Jt(E,h,a),w.head.appendChild(E);break;case"meta":if(M=Fg("meta","content",w).get(h+(a.content||""))){for(G=0;G<M.length;G++)if(E=M[G],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){M.splice(G,1);break t}}E=w.createElement(h),Jt(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[Kt]=t,qt(E),h=E}t.stateNode=h}else Ug(w,t.type,t.stateNode);else t.stateNode=Pg(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?Ug(w,t.type,t.stateNode):Pg(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Au(t,t.memoizedProps,a.memoizedProps)}break;case 27:mn(n,t),gn(t),h&512&&(Bt||a===null||Qn(a,a.return)),a!==null&&h&4&&Au(t,t.memoizedProps,a.memoizedProps);break;case 5:if(mn(n,t),gn(t),h&512&&(Bt||a===null||Qn(a,a.return)),t.flags&32){w=t.stateNode;try{$i(w,"")}catch(Ee){ht(t,t.return,Ee)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Au(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Lu=!0);break;case 6:if(mn(n,t),gn(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(Ee){ht(t,t.return,Ee)}}break;case 3:if(al=null,w=Gn,Gn=il(n.containerInfo),mn(n,t),Gn=w,gn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ys(n.containerInfo)}catch(Ee){ht(t,t.return,Ee)}Lu&&(Lu=!1,Um(t));break;case 4:h=Gn,Gn=il(t.stateNode.containerInfo),mn(n,t),gn(t),Gn=h;break;case 12:mn(n,t),gn(t);break;case 31:mn(n,t),gn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,qo(t,h)));break;case 13:mn(n,t),gn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Go=qe()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,qo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=vr,fe=Bt;if(vr=le||w,Bt=fe||J,mn(n,t),Bt=fe,vr=le,gn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||vr||Bt||Si(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)M=E.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{G=J.stateNode;var ge=J.memoizedProps.style,ce=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Ee){ht(J,J.return,Ee)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(Ee){ht(J,J.return,Ee)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Dg(de,!0):Dg(J.stateNode,!1)}catch(Ee){ht(J,J.return,Ee)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,qo(t,a))));break;case 19:mn(n,t),gn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,qo(t,h)));break;case 30:break;case 21:break;default:mn(n,t),gn(t)}}function gn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Lm(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=Du(t);$o(t,E,w);break;case 5:var M=a.stateNode;a.flags&32&&($i(M,""),a.flags&=-33);var G=Du(t);$o(t,G,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Du(t);Ru(t,le,J);break;default:throw Error(s(161))}}catch(fe){ht(t,t.return,fe)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Um(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Um(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function yr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Im(t,n.alternate,n),n=n.sibling}function Si(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Pr(4,n,n.return),Si(n);break;case 1:Qn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Dm(n,n.return,a),Si(n);break;case 27:ya(n.stateNode);case 26:case 5:Qn(n,n.return),Si(n);break;case 22:n.memoizedState===null&&Si(n);break;case 30:Si(n);break;default:Si(n)}t=t.sibling}}function _r(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,E=n,M=E.flags;switch(E.tag){case 0:case 11:case 15:_r(w,E,a),ua(4,E);break;case 1:if(_r(w,E,a),h=E,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ht(h,h.return,le)}if(h=E,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)bp(J[w],G)}catch(le){ht(h,h.return,le)}}a&&M&64&&Am(E),da(E,E.return);break;case 27:Mm(E);case 26:case 5:_r(w,E,a),a&&h===null&&M&4&&Rm(E),da(E,E.return);break;case 12:_r(w,E,a);break;case 31:_r(w,E,a),a&&M&4&&Hm(w,E);break;case 13:_r(w,E,a),a&&M&4&&Pm(w,E);break;case 22:E.memoizedState===null&&_r(w,E,a),da(E,E.return);break;case 30:break;default:_r(w,E,a)}n=n.sibling}}function Mu(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Zs(a))}function Ou(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t))}function Vn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)$m(t,n,a,h),n=n.sibling}function $m(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Vn(t,n,a,h),w&2048&&ua(9,n);break;case 1:Vn(t,n,a,h);break;case 3:Vn(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t)));break;case 12:if(w&2048){Vn(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,M=E.id,G=E.onPostCommit;typeof G=="function"&&G(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ht(n,n.return,J)}}else Vn(t,n,a,h);break;case 31:Vn(t,n,a,h);break;case 13:Vn(t,n,a,h);break;case 23:break;case 22:E=n.stateNode,M=n.alternate,n.memoizedState!==null?E._visibility&2?Vn(t,n,a,h):ha(t,n):E._visibility&2?Vn(t,n,a,h):(E._visibility|=2,cs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Mu(M,n);break;case 24:Vn(t,n,a,h),w&2048&&Ou(n.alternate,n);break;default:Vn(t,n,a,h)}}function cs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,M=n,G=a,J=h,le=M.flags;switch(M.tag){case 0:case 11:case 15:cs(E,M,G,J,w),ua(8,M);break;case 23:break;case 22:var fe=M.stateNode;M.memoizedState!==null?fe._visibility&2?cs(E,M,G,J,w):ha(E,M):(fe._visibility|=2,cs(E,M,G,J,w)),w&&le&2048&&Mu(M.alternate,M);break;case 24:cs(E,M,G,J,w),w&&le&2048&&Ou(M.alternate,M);break;default:cs(E,M,G,J,w)}n=n.sibling}}function ha(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:ha(a,h),w&2048&&Mu(h.alternate,h);break;case 24:ha(a,h),w&2048&&Ou(h.alternate,h);break;default:ha(a,h)}n=n.sibling}}var fa=8192;function us(t,n,a){if(t.subtreeFlags&fa)for(t=t.child;t!==null;)qm(t,n,a),t=t.sibling}function qm(t,n,a){switch(t.tag){case 26:us(t,n,a),t.flags&fa&&t.memoizedState!==null&&m1(a,Gn,t.memoizedState,t.memoizedProps);break;case 5:us(t,n,a);break;case 3:case 4:var h=Gn;Gn=il(t.stateNode.containerInfo),us(t,n,a),Gn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=fa,fa=16777216,us(t,n,a),fa=h):us(t,n,a));break;default:us(t,n,a)}}function Wm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function pa(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Wt=h,Vm(h,t)}Wm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Gm(t),t=t.sibling}function Gm(t){switch(t.tag){case 0:case 11:case 15:pa(t),t.flags&2048&&Pr(9,t,t.return);break;case 3:pa(t);break;case 12:pa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Wo(t)):pa(t);break;default:pa(t)}}function Wo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Wt=h,Vm(h,t)}Wm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Pr(8,n,n.return),Wo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Wo(n));break;default:Wo(n)}t=t.sibling}}function Vm(t,n){for(;Wt!==null;){var a=Wt;switch(a.tag){case 0:case 11:case 15:Pr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Zs(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Wt=h;else e:for(a=t;Wt!==null;){h=Wt;var w=h.sibling,E=h.return;if(Bm(h),h===a){Wt=null;break e}if(w!==null){w.return=E,Wt=w;break e}Wt=E}}}var A_={getCacheForType:function(t){var n=Zt(Mt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Zt(Mt).controller.signal}},D_=typeof WeakMap=="function"?WeakMap:Map,lt=0,xt=null,Xe=null,et=0,dt=0,kn=null,Fr=!1,ds=!1,Iu=!1,Sr=0,Tt=0,Ur=0,wi=0,Bu=0,En=0,hs=0,ma=null,xn=null,zu=!1,Go=0,Ym=0,Vo=1/0,Yo=null,$r=null,Ft=0,qr=null,fs=null,wr=0,Hu=0,Pu=null,Km=null,ga=0,Fu=null;function jn(){return(lt&2)!==0&&et!==0?et&-et:B.T!==null?Vu():df()}function Xm(){if(En===0)if((et&536870912)===0||rt){var t=Ke;Ke<<=1,(Ke&3932160)===0&&(Ke=262144),En=t}else En=536870912;return t=wn.current,t!==null&&(t.flags|=32),En}function vn(t,n,a){(t===xt&&(dt===2||dt===9)||t.cancelPendingCommit!==null)&&(ps(t,0),Wr(t,et,En,!1)),Bs(t,a),((lt&2)===0||t!==xt)&&(t===xt&&((lt&2)===0&&(wi|=a),Tt===4&&Wr(t,et,En,!1)),Jn(t))}function Zm(t,n,a){if((lt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||kt(t,n),w=h?M_(t,n):$u(t,n,!0),E=h;do{if(w===0){ds&&!h&&Wr(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!R_(a)){w=$u(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var G=t;w=ma;var J=G.current.memoizedState.isDehydrated;if(J&&(ps(G,M).flags|=256),M=$u(G,M,!1),M!==2){if(Iu&&!J){G.errorRecoveryDisabledLanes|=E,wi|=E,w=4;break e}E=xn,xn=w,E!==null&&(xn===null?xn=E:xn.push.apply(xn,E))}w=M}if(E=!1,w!==2)continue}}if(w===1){ps(t,0),Wr(t,n,0,!0);break}e:{switch(h=t,E=w,E){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Wr(h,n,En,!Fr);break e;case 2:xn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Go+300-qe(),10<w)){if(Wr(h,n,En,!Fr),Lt(h,0,!0)!==0)break e;wr=n,h.timeoutHandle=Ng(Qm.bind(null,h,a,xn,Yo,zu,n,En,wi,hs,Fr,E,"Throttled",-0,0),w);break e}Qm(h,a,xn,Yo,zu,n,En,wi,hs,Fr,E,null,-0,0)}}break}while(!0);Jn(t)}function Qm(t,n,a,h,w,E,M,G,J,le,fe,ge,ce,de){if(t.timeoutHandle=-1,ge=n.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:lr},qm(n,E,ge);var Ee=(E&62914560)===E?Go-qe():(E&4194048)===E?Ym-qe():0;if(Ee=g1(ge,Ee),Ee!==null){wr=E,t.cancelPendingCommit=Ee(ag.bind(null,t,n,E,a,h,w,M,G,J,fe,ge,null,ce,de)),Wr(t,E,M,!le);return}}ag(t,n,E,a,h,w,M,G,J)}function R_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],E=w.getSnapshot;w=w.value;try{if(!_n(E(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Wr(t,n,a,h){n&=~Bu,n&=~wi,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-Je(w),M=1<<E;h[E]=-1,w&=~M}a!==0&&lf(t,a,n)}function Ko(){return(lt&6)===0?(xa(0),!1):!0}function Uu(){if(Xe!==null){if(dt===0)var t=Xe.return;else t=Xe,hr=pi=null,iu(t),is=null,Js=0,t=Xe;for(;t!==null;)Tm(t.alternate,t),t=t.return;Xe=null}}function ps(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,Q_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),wr=0,Uu(),xt=t,Xe=a=ur(t.current,null),et=n,dt=0,kn=null,Fr=!1,ds=kt(t,n),Iu=!1,hs=En=Bu=wi=Ur=Tt=0,xn=ma=null,zu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-Je(h),E=1<<w;n|=t[w],h&=~E}return Sr=n,go(),a}function Jm(t,n){$e=null,B.H=oa,n===rs||n===Co?(n=mp(),dt=3):n===Gc?(n=mp(),dt=4):dt=n===yu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,kn=n,Xe===null&&(Tt=1,zo(t,On(n,t.current)))}function eg(){var t=wn.current;return t===null?!0:(et&4194048)===et?Hn===null:(et&62914560)===et||(et&536870912)!==0?t===Hn:!1}function tg(){var t=B.H;return B.H=oa,t===null?oa:t}function ng(){var t=B.A;return B.A=A_,t}function Xo(){Tt=4,Fr||(et&4194048)!==et&&wn.current!==null||(ds=!0),(Ur&134217727)===0&&(wi&134217727)===0||xt===null||Wr(xt,et,En,!1)}function $u(t,n,a){var h=lt;lt|=2;var w=tg(),E=ng();(xt!==t||et!==n)&&(Yo=null,ps(t,n)),n=!1;var M=Tt;e:do try{if(dt!==0&&Xe!==null){var G=Xe,J=kn;switch(dt){case 8:Uu(),M=6;break e;case 3:case 2:case 9:case 6:wn.current===null&&(n=!0);var le=dt;if(dt=0,kn=null,ms(t,G,J,le),a&&ds){M=0;break e}break;default:le=dt,dt=0,kn=null,ms(t,G,J,le)}}L_(),M=Tt;break}catch(fe){Jm(t,fe)}while(!0);return n&&t.shellSuspendCounter++,hr=pi=null,lt=h,B.H=w,B.A=E,Xe===null&&(xt=null,et=0,go()),M}function L_(){for(;Xe!==null;)rg(Xe)}function M_(t,n){var a=lt;lt|=2;var h=tg(),w=ng();xt!==t||et!==n?(Yo=null,Vo=qe()+500,ps(t,n)):ds=kt(t,n);e:do try{if(dt!==0&&Xe!==null){n=Xe;var E=kn;t:switch(dt){case 1:dt=0,kn=null,ms(t,n,E,1);break;case 2:case 9:if(fp(E)){dt=0,kn=null,ig(n);break}n=function(){dt!==2&&dt!==9||xt!==t||(dt=7),Jn(t)},E.then(n,n);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:fp(E)?(dt=0,kn=null,ig(n)):(dt=0,kn=null,ms(t,n,E,7));break;case 5:var M=null;switch(Xe.tag){case 26:M=Xe.memoizedState;case 5:case 27:var G=Xe;if(M?$g(M):G.stateNode.complete){dt=0,kn=null;var J=G.sibling;if(J!==null)Xe=J;else{var le=G.return;le!==null?(Xe=le,Zo(le)):Xe=null}break t}}dt=0,kn=null,ms(t,n,E,5);break;case 6:dt=0,kn=null,ms(t,n,E,6);break;case 8:Uu(),Tt=6;break e;default:throw Error(s(462))}}O_();break}catch(fe){Jm(t,fe)}while(!0);return hr=pi=null,B.H=h,B.A=w,lt=a,Xe!==null?0:(xt=null,et=0,go(),Tt)}function O_(){for(;Xe!==null&&!ze();)rg(Xe)}function rg(t){var n=jm(t.alternate,t,Sr);t.memoizedProps=t.pendingProps,n===null?Zo(t):Xe=n}function ig(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=_m(a,n,n.pendingProps,n.type,void 0,et);break;case 11:n=_m(a,n,n.pendingProps,n.type.render,n.ref,et);break;case 5:iu(n);default:Tm(a,n),n=Xe=np(n,Sr),n=jm(a,n,Sr)}t.memoizedProps=t.pendingProps,n===null?Zo(t):Xe=n}function ms(t,n,a,h){hr=pi=null,iu(n),is=null,Js=0;var w=n.return;try{if(w_(t,w,n,a,et)){Tt=1,zo(t,On(a,t.current)),Xe=null;return}}catch(E){if(w!==null)throw Xe=w,E;Tt=1,zo(t,On(a,t.current)),Xe=null;return}n.flags&32768?(rt||h===1?t=!0:ds||(et&536870912)!==0?t=!1:(Fr=t=!0,(h===2||h===9||h===3||h===6)&&(h=wn.current,h!==null&&h.tag===13&&(h.flags|=16384))),sg(n,t)):Zo(n)}function Zo(t){var n=t;do{if((n.flags&32768)!==0){sg(n,Fr);return}t=n.return;var a=E_(n.alternate,n,Sr);if(a!==null){Xe=a;return}if(n=n.sibling,n!==null){Xe=n;return}Xe=n=t}while(n!==null);Tt===0&&(Tt=5)}function sg(t,n){do{var a=j_(t.alternate,t);if(a!==null){a.flags&=32767,Xe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Xe=t;return}Xe=t=a}while(t!==null);Tt=6,Xe=null}function ag(t,n,a,h,w,E,M,G,J){t.cancelPendingCommit=null;do Qo();while(Ft!==0);if((lt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(E=n.lanes|n.childLanes,E|=Dc,p0(t,a,E,M,G,J),t===xt&&(Xe=xt=null,et=0),fs=n,qr=t,wr=a,Hu=E,Pu=w,Km=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,H_(Te,function(){return dg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=B.T,B.T=null,w=X.p,X.p=2,M=lt,lt|=4;try{N_(t,n,a)}finally{lt=M,X.p=w,B.T=h}}Ft=1,og(),lg(),cg()}}function og(){if(Ft===1){Ft=0;var t=qr,n=fs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var h=X.p;X.p=2;var w=lt;lt|=4;try{Fm(n,t);var E=td,M=Vf(t.containerInfo),G=E.focusedElem,J=E.selectionRange;if(M!==G&&G&&G.ownerDocument&&Gf(G.ownerDocument.documentElement,G)){if(J!==null&&Ec(G)){var le=J.start,fe=J.end;if(fe===void 0&&(fe=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(fe,G.value.length);else{var ge=G.ownerDocument||document,ce=ge&&ge.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),Ee=G.textContent.length,Ie=Math.min(J.start,Ee),gt=J.end===void 0?Ie:Math.min(J.end,Ee);!de.extend&&Ie>gt&&(M=gt,gt=Ie,Ie=M);var re=Wf(G,Ie),te=Wf(G,gt);if(re&&te&&(de.rangeCount!==1||de.anchorNode!==re.node||de.anchorOffset!==re.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var oe=ge.createRange();oe.setStart(re.node,re.offset),de.removeAllRanges(),Ie>gt?(de.addRange(oe),de.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),de.addRange(oe))}}}}for(ge=[],de=G;de=de.parentNode;)de.nodeType===1&&ge.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<ge.length;G++){var me=ge[G];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ul=!!ed,td=ed=null}finally{lt=w,X.p=h,B.T=a}}t.current=n,Ft=2}}function lg(){if(Ft===2){Ft=0;var t=qr,n=fs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var h=X.p;X.p=2;var w=lt;lt|=4;try{Im(t,n.alternate,n)}finally{lt=w,X.p=h,B.T=a}}Ft=3}}function cg(){if(Ft===4||Ft===3){Ft=0,Pe();var t=qr,n=fs,a=wr,h=Km;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ft=5:(Ft=0,fs=qr=null,ug(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&($r=null),oc(a),n=n.stateNode,Ye&&typeof Ye.onCommitFiberRoot=="function")try{Ye.onCommitFiberRoot(Ve,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=B.T,w=X.p,X.p=2,B.T=null;try{for(var E=t.onRecoverableError,M=0;M<h.length;M++){var G=h[M];E(G.value,{componentStack:G.stack})}}finally{B.T=n,X.p=w}}(wr&3)!==0&&Qo(),Jn(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Fu?ga++:(ga=0,Fu=t):ga=0,xa(0)}}function ug(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Zs(n)))}function Qo(){return og(),lg(),cg(),dg()}function dg(){if(Ft!==5)return!1;var t=qr,n=Hu;Hu=0;var a=oc(wr),h=B.T,w=X.p;try{X.p=32>a?32:a,B.T=null,a=Pu,Pu=null;var E=qr,M=wr;if(Ft=0,fs=qr=null,wr=0,(lt&6)!==0)throw Error(s(331));var G=lt;if(lt|=4,Gm(E.current),$m(E,E.current,M,a),lt=G,xa(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot=="function")try{Ye.onPostCommitFiberRoot(Ve,E)}catch{}return!0}finally{X.p=w,B.T=h,ug(t,n)}}function hg(t,n,a){n=On(a,n),n=bu(t.stateNode,n,2),t=Br(t,n,2),t!==null&&(Bs(t,2),Jn(t))}function ht(t,n,a){if(t.tag===3)hg(t,t,a);else for(;n!==null;){if(n.tag===3){hg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&($r===null||!$r.has(h))){t=On(a,t),a=fm(2),h=Br(n,a,2),h!==null&&(pm(a,h,n,t),Bs(h,2),Jn(h));break}}n=n.return}}function qu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new D_;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(Iu=!0,w.add(a),t=I_.bind(null,t,n,a),n.then(t,t))}function I_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,xt===t&&(et&a)===a&&(Tt===4||Tt===3&&(et&62914560)===et&&300>qe()-Go?(lt&2)===0&&ps(t,0):Bu|=a,hs===et&&(hs=0)),Jn(t)}function fg(t,n){n===0&&(n=sc()),t=di(t,n),t!==null&&(Bs(t,n),Jn(t))}function B_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),fg(t,a)}function z_(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(n),fg(t,a)}function H_(t,n){return jt(t,n)}var Jo=null,gs=null,Wu=!1,el=!1,Gu=!1,Gr=0;function Jn(t){t!==gs&&t.next===null&&(gs===null?Jo=gs=t:gs=gs.next=t),el=!0,Wu||(Wu=!0,F_())}function xa(t,n){if(!Gu&&el){Gu=!0;do for(var a=!1,h=Jo;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var M=h.suspendedLanes,G=h.pingedLanes;E=(1<<31-Je(42|t)+1)-1,E&=w&~(M&~G),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,xg(h,E))}else E=et,E=Lt(h,h===xt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||kt(h,E)||(a=!0,xg(h,E));h=h.next}while(a);Gu=!1}}function P_(){pg()}function pg(){el=Wu=!1;var t=0;Gr!==0&&Z_()&&(t=Gr);for(var n=qe(),a=null,h=Jo;h!==null;){var w=h.next,E=mg(h,n);E===0?(h.next=null,a===null?Jo=w:a.next=w,w===null&&(gs=a)):(a=h,(t!==0||(E&3)!==0)&&(el=!0)),h=w}Ft!==0&&Ft!==5||xa(t),Gr!==0&&(Gr=0)}function mg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var M=31-Je(E),G=1<<M,J=w[M];J===-1?((G&a)===0||(G&h)!==0)&&(w[M]=Yt(G,n)):J<=n&&(t.expiredLanes|=G),E&=~G}if(n=xt,a=et,a=Lt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(dt===2||dt===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&xe(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||kt(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&xe(h),oc(a)){case 2:case 8:a=ve;break;case 32:a=Te;break;case 268435456:a=ie;break;default:a=Te}return h=gg.bind(null,t),a=jt(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&xe(h),t.callbackPriority=2,t.callbackNode=null,2}function gg(t,n){if(Ft!==0&&Ft!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Qo()&&t.callbackNode!==a)return null;var h=et;return h=Lt(t,t===xt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(Zm(t,h,n),mg(t,qe()),t.callbackNode!=null&&t.callbackNode===a?gg.bind(null,t):null)}function xg(t,n){if(Qo())return null;Zm(t,n,!0)}function F_(){J_(function(){(lt&6)!==0?jt(ue,P_):pg()})}function Vu(){if(Gr===0){var t=ts;t===0&&(t=Be,Be<<=1,(Be&261888)===0&&(Be=256)),Gr=t}return Gr}function vg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:oo(""+t)}function bg(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function U_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=vg((w[hn]||null).action),M=h.submitter;M&&(n=(n=M[hn]||null)?vg(n.formAction):M.getAttribute("formAction"),n!==null&&(E=n,M=null));var G=new ho("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Gr!==0){var J=M?bg(w,M):new FormData(w);fu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(G.preventDefault(),J=M?bg(w,M):new FormData(w),fu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var Yu=0;Yu<Ac.length;Yu++){var Ku=Ac[Yu],$_=Ku.toLowerCase(),q_=Ku[0].toUpperCase()+Ku.slice(1);Wn($_,"on"+q_)}Wn(Xf,"onAnimationEnd"),Wn(Zf,"onAnimationIteration"),Wn(Qf,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(a_,"onTransitionRun"),Wn(o_,"onTransitionStart"),Wn(l_,"onTransitionCancel"),Wn(Jf,"onTransitionEnd"),Fi("onMouseEnter",["mouseout","mouseover"]),Fi("onMouseLeave",["mouseout","mouseover"]),Fi("onPointerEnter",["pointerout","pointerover"]),Fi("onPointerLeave",["pointerout","pointerover"]),oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),W_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(va));function yg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var E=void 0;if(n)for(var M=h.length-1;0<=M;M--){var G=h[M],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(fe){mo(fe)}w.currentTarget=null,E=J}else for(M=0;M<h.length;M++){if(G=h[M],J=G.instance,le=G.currentTarget,G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(fe){mo(fe)}w.currentTarget=null,E=J}}}}function Ze(t,n){var a=n[lc];a===void 0&&(a=n[lc]=new Set);var h=t+"__bubble";a.has(h)||(_g(n,t,2,!1),a.add(h))}function Xu(t,n,a){var h=0;n&&(h|=4),_g(a,t,h,n)}var tl="_reactListening"+Math.random().toString(36).slice(2);function Zu(t){if(!t[tl]){t[tl]=!0,pf.forEach(function(a){a!=="selectionchange"&&(W_.has(a)||Xu(a,!1,t),Xu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[tl]||(n[tl]=!0,Xu("selectionchange",!1,n))}}function _g(t,n,a,h){switch(Xg(n)){case 2:var w=b1;break;case 8:w=y1;break;default:w=hd}a=w.bind(null,n,a,t),w=void 0,!xc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function Qu(t,n,a,h,w){var E=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var M=h.tag;if(M===3||M===4){var G=h.stateNode.containerInfo;if(G===w)break;if(M===4)for(M=h.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;G!==null;){if(M=zi(G),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){h=E=M;continue e}G=G.parentNode}}h=h.return}Ef(function(){var le=E,fe=mc(a),ge=[];e:{var ce=ep.get(t);if(ce!==void 0){var de=ho,Ee=t;switch(t){case"keypress":if(co(a)===0)break e;case"keydown":case"keyup":de=z0;break;case"focusin":Ee="focus",de=_c;break;case"focusout":Ee="blur",de=_c;break;case"beforeblur":case"afterblur":de=_c;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Tf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=E0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=F0;break;case Xf:case Zf:case Qf:de=T0;break;case Jf:de=$0;break;case"scroll":case"scrollend":de=C0;break;case"wheel":de=W0;break;case"copy":case"cut":case"paste":de=D0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Df;break;case"toggle":case"beforetoggle":de=V0}var Ie=(n&4)!==0,gt=!Ie&&(t==="scroll"||t==="scrollend"),re=Ie?ce!==null?ce+"Capture":null:ce;Ie=[];for(var te=le,oe;te!==null;){var me=te;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||re===null||(me=Ps(te,re),me!=null&&Ie.push(ba(te,me,oe))),gt)break;te=te.return}0<Ie.length&&(ce=new de(ce,Ee,null,a,fe),ge.push({event:ce,listeners:Ie}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==pc&&(Ee=a.relatedTarget||a.fromElement)&&(zi(Ee)||Ee[Bi]))break e;if((de||ce)&&(ce=fe.window===fe?fe:(ce=fe.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(Ee=a.relatedTarget||a.toElement,de=le,Ee=Ee?zi(Ee):null,Ee!==null&&(gt=u(Ee),Ie=Ee.tag,Ee!==gt||Ie!==5&&Ie!==27&&Ie!==6)&&(Ee=null)):(de=null,Ee=le),de!==Ee)){if(Ie=Tf,me="onMouseLeave",re="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=Df,me="onPointerLeave",re="onPointerEnter",te="pointer"),gt=de==null?ce:Hs(de),oe=Ee==null?ce:Hs(Ee),ce=new Ie(me,te+"leave",de,a,fe),ce.target=gt,ce.relatedTarget=oe,me=null,zi(fe)===le&&(Ie=new Ie(re,te+"enter",Ee,a,fe),Ie.target=oe,Ie.relatedTarget=gt,me=Ie),gt=me,de&&Ee)t:{for(Ie=G_,re=de,te=Ee,oe=0,me=re;me;me=Ie(me))oe++;me=0;for(var Re=te;Re;Re=Ie(Re))me++;for(;0<oe-me;)re=Ie(re),oe--;for(;0<me-oe;)te=Ie(te),me--;for(;oe--;){if(re===te||te!==null&&re===te.alternate){Ie=re;break t}re=Ie(re),te=Ie(te)}Ie=null}else Ie=null;de!==null&&Sg(ge,ce,de,Ie,!1),Ee!==null&&gt!==null&&Sg(ge,gt,Ee,Ie,!0)}}e:{if(ce=le?Hs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var st=Hf;else if(Bf(ce))if(Pf)st=r_;else{st=t_;var De=e_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&fc(le.elementType)&&(st=Hf):st=n_;if(st&&(st=st(t,le))){zf(ge,st,a,fe);break e}De&&De(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&hc(ce,"number",ce.value)}switch(De=le?Hs(le):window,t){case"focusin":(Bf(De)||De.contentEditable==="true")&&(Vi=De,jc=le,Ys=null);break;case"focusout":Ys=jc=Vi=null;break;case"mousedown":Nc=!0;break;case"contextmenu":case"mouseup":case"dragend":Nc=!1,Yf(ge,a,fe);break;case"selectionchange":if(s_)break;case"keydown":case"keyup":Yf(ge,a,fe)}var We;if(wc)e:{switch(t){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Gi?Of(t,a)&&(tt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(tt="onCompositionStart");tt&&(Rf&&a.locale!=="ko"&&(Gi||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Gi&&(We=jf()):(Ar=fe,vc="value"in Ar?Ar.value:Ar.textContent,Gi=!0)),De=nl(le,tt),0<De.length&&(tt=new Af(tt,t,null,a,fe),ge.push({event:tt,listeners:De}),We?tt.data=We:(We=If(a),We!==null&&(tt.data=We)))),(We=K0?X0(t,a):Z0(t,a))&&(tt=nl(le,"onBeforeInput"),0<tt.length&&(De=new Af("onBeforeInput","beforeinput",null,a,fe),ge.push({event:De,listeners:tt}),De.data=We)),U_(ge,t,le,a,fe)}yg(ge,n)})}function ba(t,n,a){return{instance:t,listener:n,currentTarget:a}}function nl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Ps(t,a),w!=null&&h.unshift(ba(t,w,E)),w=Ps(t,n),w!=null&&h.push(ba(t,w,E))),t.tag===3)return h;t=t.return}return[]}function G_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Sg(t,n,a,h,w){for(var E=n._reactName,M=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Ps(a,E),le!=null&&M.unshift(ba(a,le,J))):w||(le=Ps(a,E),le!=null&&M.push(ba(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var V_=/\r\n?/g,Y_=/\u0000|\uFFFD/g;function wg(t){return(typeof t=="string"?t:""+t).replace(V_,`
49
- `).replace(Y_,"")}function Cg(t,n){return n=wg(n),wg(t)===n}function mt(t,n,a,h,w,E){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||$i(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&$i(t,""+h);break;case"className":so(t,"class",h);break;case"tabIndex":so(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":so(t,a,h);break;case"style":Cf(t,h,E);break;case"data":if(n!=="object"){so(t,"data",h);break}case"src":case"href":if(h===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=oo(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"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 E=="function"&&(a==="formAction"?(n!=="input"&&mt(t,n,"name",w.name,w,null),mt(t,n,"formEncType",w.formEncType,w,null),mt(t,n,"formMethod",w.formMethod,w,null),mt(t,n,"formTarget",w.formTarget,w,null)):(mt(t,n,"encType",w.encType,w,null),mt(t,n,"method",w.method,w,null),mt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=oo(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=lr);break;case"onScroll":h!=null&&Ze("scroll",t);break;case"onScrollEnd":h!=null&&Ze("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=oo(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);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":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":Ze("beforetoggle",t),Ze("toggle",t),io(t,"popover",h);break;case"xlinkActuate":or(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":or(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":or(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":or(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":or(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":or(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":or(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":or(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":or(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":io(t,"is",h);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=S0.get(a)||a,io(t,a,h))}}function Ju(t,n,a,h,w,E){switch(a){case"style":Cf(t,h,E);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof h=="string"?$i(t,h):(typeof h=="number"||typeof h=="bigint")&&$i(t,""+h);break;case"onScroll":h!=null&&Ze("scroll",t);break;case"onScrollEnd":h!=null&&Ze("scrollend",t);break;case"onClick":h!=null&&(t.onclick=lr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),E=t[hn]||null,E=E!=null?E[a]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof h=="function")){typeof E!="function"&&E!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):io(t,a,h)}}}function Jt(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",t),Ze("load",t);var h=!1,w=!1,E;for(E in a)if(a.hasOwnProperty(E)){var M=a[E];if(M!=null)switch(E){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:mt(t,n,E,M,a,null)}}w&&mt(t,n,"srcSet",a.srcSet,a,null),h&&mt(t,n,"src",a.src,a,null);return;case"input":Ze("invalid",t);var G=E=M=w=null,J=null,le=null;for(h in a)if(a.hasOwnProperty(h)){var fe=a[h];if(fe!=null)switch(h){case"name":w=fe;break;case"type":M=fe;break;case"checked":J=fe;break;case"defaultChecked":le=fe;break;case"value":E=fe;break;case"defaultValue":G=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,n));break;default:mt(t,n,h,fe,a,null)}}yf(t,E,G,J,le,M,w,!1);return;case"select":Ze("invalid",t),h=M=E=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":E=G;break;case"defaultValue":M=G;break;case"multiple":h=G;default:mt(t,n,w,G,a,null)}n=E,a=M,t.multiple=!!h,n!=null?Ui(t,!!h,n,!1):a!=null&&Ui(t,!!h,a,!0);return;case"textarea":Ze("invalid",t),E=w=h=null;for(M in a)if(a.hasOwnProperty(M)&&(G=a[M],G!=null))switch(M){case"value":h=G;break;case"defaultValue":w=G;break;case"children":E=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:mt(t,n,M,G,a,null)}Sf(t,h,w,E);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:mt(t,n,J,h,a,null)}return;case"dialog":Ze("beforetoggle",t),Ze("toggle",t),Ze("cancel",t),Ze("close",t);break;case"iframe":case"object":Ze("load",t);break;case"video":case"audio":for(h=0;h<va.length;h++)Ze(va[h],t);break;case"image":Ze("error",t),Ze("load",t);break;case"details":Ze("toggle",t);break;case"embed":case"source":case"link":Ze("error",t),Ze("load",t);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 a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:mt(t,n,le,h,a,null)}return;default:if(fc(n)){for(fe in a)a.hasOwnProperty(fe)&&(h=a[fe],h!==void 0&&Ju(t,n,fe,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&&mt(t,n,G,h,a,null))}function K_(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,E=null,M=null,G=null,J=null,le=null,fe=null;for(de in a){var ge=a[de];if(a.hasOwnProperty(de)&&ge!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":J=ge;default:h.hasOwnProperty(de)||mt(t,n,de,null,h,ge)}}for(var ce in h){var de=h[ce];if(ge=a[ce],h.hasOwnProperty(ce)&&(de!=null||ge!=null))switch(ce){case"type":E=de;break;case"name":w=de;break;case"checked":le=de;break;case"defaultChecked":fe=de;break;case"value":M=de;break;case"defaultValue":G=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,n));break;default:de!==ge&&mt(t,n,ce,de,h,ge)}}dc(t,M,G,J,le,fe,E,w);return;case"select":de=M=G=ce=null;for(E in a)if(J=a[E],a.hasOwnProperty(E)&&J!=null)switch(E){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(E)||mt(t,n,E,null,h,J)}for(w in h)if(E=h[w],J=a[w],h.hasOwnProperty(w)&&(E!=null||J!=null))switch(w){case"value":ce=E;break;case"defaultValue":G=E;break;case"multiple":M=E;default:E!==J&&mt(t,n,w,E,h,J)}n=G,a=M,h=de,ce!=null?Ui(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Ui(t,!!a,n,!0):Ui(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!h.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:mt(t,n,G,null,h,w)}for(M in h)if(w=h[M],E=a[M],h.hasOwnProperty(M)&&(w!=null||E!=null))switch(M){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==E&&mt(t,n,M,w,h,E)}_f(t,ce,de);return;case"option":for(var Ee in a)if(ce=a[Ee],a.hasOwnProperty(Ee)&&ce!=null&&!h.hasOwnProperty(Ee))switch(Ee){case"selected":t.selected=!1;break;default:mt(t,n,Ee,null,h,ce)}for(J in h)if(ce=h[J],de=a[J],h.hasOwnProperty(J)&&ce!==de&&(ce!=null||de!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:mt(t,n,J,ce,h,de)}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 Ie in a)ce=a[Ie],a.hasOwnProperty(Ie)&&ce!=null&&!h.hasOwnProperty(Ie)&&mt(t,n,Ie,null,h,ce);for(le in h)if(ce=h[le],de=a[le],h.hasOwnProperty(le)&&ce!==de&&(ce!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:mt(t,n,le,ce,h,de)}return;default:if(fc(n)){for(var gt in a)ce=a[gt],a.hasOwnProperty(gt)&&ce!==void 0&&!h.hasOwnProperty(gt)&&Ju(t,n,gt,void 0,h,ce);for(fe in h)ce=h[fe],de=a[fe],!h.hasOwnProperty(fe)||ce===de||ce===void 0&&de===void 0||Ju(t,n,fe,ce,h,de);return}}for(var re in a)ce=a[re],a.hasOwnProperty(re)&&ce!=null&&!h.hasOwnProperty(re)&&mt(t,n,re,null,h,ce);for(ge in h)ce=h[ge],de=a[ge],!h.hasOwnProperty(ge)||ce===de||ce==null&&de==null||mt(t,n,ge,ce,h,de)}function kg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function X_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],E=w.transferSize,M=w.initiatorType,G=w.duration;if(E&&G&&kg(M)){for(M=0,G=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>G)break;var fe=J.transferSize,ge=J.initiatorType;fe&&kg(ge)&&(J=J.responseEnd,M+=fe*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(E+M)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var ed=null,td=null;function rl(t){return t.nodeType===9?t:t.ownerDocument}function Eg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function nd(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var rd=null;function Z_(){var t=window.event;return t&&t.type==="popstate"?t===rd?!1:(rd=t,!0):(rd=null,!1)}var Ng=typeof setTimeout=="function"?setTimeout:void 0,Q_=typeof clearTimeout=="function"?clearTimeout:void 0,Tg=typeof Promise=="function"?Promise:void 0,J_=typeof queueMicrotask=="function"?queueMicrotask:typeof Tg<"u"?function(t){return Tg.resolve(null).then(t).catch(e1)}:Ng;function e1(t){setTimeout(function(){throw t})}function Vr(t){return t==="head"}function Ag(t,n){var a=n,h=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(h===0){t.removeChild(w),ys(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")ya(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ya(a);for(var E=a.firstChild;E;){var M=E.nextSibling,G=E.nodeName;E[zs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=M}}else a==="body"&&ya(t.ownerDocument.body);a=w}while(a);ys(n)}function Dg(t,n){var a=t;t=0;do{var h=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=h}while(a)}function id(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":id(a),cc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function t1(t,n,a,h){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!h&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(h){if(!t[zs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(E=t.getAttribute("rel"),E==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(E!==w.rel||t.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||t.getAttribute("title")!==(w.title==null?null:w.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(E=t.getAttribute("src"),(E!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&E&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var E=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===E)return t}else return t;if(t=Pn(t.nextSibling),t===null)break}return null}function n1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Pn(t.nextSibling),t===null))return null;return t}function Rg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Pn(t.nextSibling),t===null))return null;return t}function sd(t){return t.data==="$?"||t.data==="$~"}function ad(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function r1(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var h=function(){n(),a.removeEventListener("DOMContentLoaded",h)};a.addEventListener("DOMContentLoaded",h),t._reactRetry=h}}function Pn(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var od=null;function Lg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Pn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Mg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function Og(t,n,a){switch(n=rl(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function ya(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);cc(t)}var Fn=new Map,Ig=new Set;function il(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Cr=X.d;X.d={f:i1,r:s1,D:a1,C:o1,L:l1,m:c1,X:d1,S:u1,M:h1};function i1(){var t=Cr.f(),n=Ko();return t||n}function s1(t){var n=Hi(t);n!==null&&n.tag===5&&n.type==="form"?Jp(n):Cr.r(t)}var xs=typeof document>"u"?null:document;function Bg(t,n,a){var h=xs;if(h&&typeof n=="string"&&n){var w=Ln(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Ig.has(w)||(Ig.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),Jt(n,"link",t),qt(n),h.head.appendChild(n)))}}function a1(t){Cr.D(t),Bg("dns-prefetch",t,null)}function o1(t,n){Cr.C(t,n),Bg("preconnect",t,n)}function l1(t,n,a){Cr.L(t,n,a);var h=xs;if(h&&t&&n){var w='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Ln(a.imageSizes)+'"]')):w+='[href="'+Ln(t)+'"]';var E=w;switch(n){case"style":E=vs(t);break;case"script":E=bs(t)}Fn.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Fn.set(E,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(_a(E))||n==="script"&&h.querySelector(Sa(E))||(n=h.createElement("link"),Jt(n,"link",t),qt(n),h.head.appendChild(n)))}}function c1(t,n){Cr.m(t,n);var a=xs;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Ln(h)+'"][href="'+Ln(t)+'"]',E=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=bs(t)}if(!Fn.has(E)&&(t=m({rel:"modulepreload",href:t},n),Fn.set(E,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Sa(E)))return}h=a.createElement("link"),Jt(h,"link",t),qt(h),a.head.appendChild(h)}}}function u1(t,n,a){Cr.S(t,n,a);var h=xs;if(h&&t){var w=Pi(h).hoistableStyles,E=vs(t);n=n||"default";var M=w.get(E);if(!M){var G={loading:0,preload:null};if(M=h.querySelector(_a(E)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Fn.get(E))&&ld(t,a);var J=M=h.createElement("link");qt(J),Jt(J,"link",t),J._p=new Promise(function(le,fe){J.onload=le,J.onerror=fe}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,sl(M,n,h)}M={type:"stylesheet",instance:M,count:1,state:G},w.set(E,M)}}}function d1(t,n){Cr.X(t,n);var a=xs;if(a&&t){var h=Pi(a).hoistableScripts,w=bs(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0},n),(n=Fn.get(w))&&cd(t,n),E=a.createElement("script"),qt(E),Jt(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function h1(t,n){Cr.M(t,n);var a=xs;if(a&&t){var h=Pi(a).hoistableScripts,w=bs(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=Fn.get(w))&&cd(t,n),E=a.createElement("script"),qt(E),Jt(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function zg(t,n,a,h){var w=(w=ne.current)?il(w):null;if(!w)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=vs(a.href),a=Pi(w).hoistableStyles,h=a.get(n),h||(h={type:"style",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=vs(a.href);var E=Pi(w).hoistableStyles,M=E.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,M),(E=w.querySelector(_a(t)))&&!E._p&&(M.instance=E,M.state.loading=5),Fn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Fn.set(t,a),E||f1(w,t,a,M.state))),n&&h===null)throw Error(s(528,""));return M}if(n&&h!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=bs(a),a=Pi(w).hoistableScripts,h=a.get(n),h||(h={type:"script",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function vs(t){return'href="'+Ln(t)+'"'}function _a(t){return'link[rel="stylesheet"]['+t+"]"}function Hg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function f1(t,n,a,h){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?h.loading=1:(n=t.createElement("link"),h.preload=n,n.addEventListener("load",function(){return h.loading|=1}),n.addEventListener("error",function(){return h.loading|=2}),Jt(n,"link",a),qt(n),t.head.appendChild(n))}function bs(t){return'[src="'+Ln(t)+'"]'}function Sa(t){return"script[async]"+t}function Pg(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(h)return n.instance=h,qt(h),h;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return h=(t.ownerDocument||t).createElement("style"),qt(h),Jt(h,"style",w),sl(h,a.precedence,t),n.instance=h;case"stylesheet":w=vs(a.href);var E=t.querySelector(_a(w));if(E)return n.state.loading|=4,n.instance=E,qt(E),E;h=Hg(a),(w=Fn.get(w))&&ld(h,w),E=(t.ownerDocument||t).createElement("link"),qt(E);var M=E;return M._p=new Promise(function(G,J){M.onload=G,M.onerror=J}),Jt(E,"link",h),n.state.loading|=4,sl(E,a.precedence,t),n.instance=E;case"script":return E=bs(a.src),(w=t.querySelector(Sa(E)))?(n.instance=w,qt(w),w):(h=a,(w=Fn.get(E))&&(h=m({},a),cd(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),qt(w),Jt(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,sl(h,a.precedence,t));return n.instance}function sl(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,E=w,M=0;M<h.length;M++){var G=h[M];if(G.dataset.precedence===n)E=G;else if(E!==w)break}E?E.parentNode.insertBefore(t,E.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function ld(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function cd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var al=null;function Fg(t,n,a){if(al===null){var h=new Map,w=al=new Map;w.set(a,h)}else w=al,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var E=a[w];if(!(E[zs]||E[Kt]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var M=E.getAttribute(n)||"";M=t+M;var G=h.get(M);G?G.push(E):h.set(M,[E])}}return h}function Ug(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function p1(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function $g(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function m1(t,n,a,h){if(a.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=vs(h.href),E=n.querySelector(_a(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ol.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,qt(E);return}E=n.ownerDocument||n,h=Hg(h),(w=Fn.get(w))&&ld(h,w),E=E.createElement("link"),qt(E);var M=E;M._p=new Promise(function(G,J){M.onload=G,M.onerror=J}),Jt(E,"link",h),a.instance=E}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ol.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var ud=0;function g1(t,n){return t.stylesheets&&t.count===0&&cl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&cl(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&ud===0&&(ud=62500*X_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&cl(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>ud?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function ol(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ll=null;function cl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ll=new Map,n.forEach(x1,t),ll=null,ol.call(t))}function x1(t,n){if(!(n.state.loading&4)){var a=ll.get(t);if(a)var h=a.get(null);else{a=new Map,ll.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var M=w[E];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),h=M)}h&&a.set(null,h)}w=n.instance,M=w.getAttribute("data-precedence"),E=a.get(M)||h,E===h&&a.set(null,w),a.set(M,w),this.count++,h=ol.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),E?E.parentNode.insertBefore(w,E.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var wa={$$typeof:_,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function v1(t,n,a,h,w,E,M,G,J){this.tag=1,this.containerInfo=t,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=Is(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Is(0),this.hiddenUpdates=Is(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=E,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function qg(t,n,a,h,w,E,M,G,J,le,fe,ge){return t=new v1(t,n,a,M,J,le,fe,ge,G),n=1,E===!0&&(n|=24),E=Sn(3,null,null,n),t.current=E,E.stateNode=t,n=$c(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:h,isDehydrated:a,cache:n},Vc(E),t}function Wg(t){return t?(t=Xi,t):Xi}function Gg(t,n,a,h,w,E){w=Wg(w),h.context===null?h.context=w:h.pendingContext=w,h=Ir(n),h.payload={element:a},E=E===void 0?null:E,E!==null&&(h.callback=E),a=Br(t,h,n),a!==null&&(vn(a,t,n),ta(a,t,n))}function Vg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function dd(t,n){Vg(t,n),(t=t.alternate)&&Vg(t,n)}function Yg(t){if(t.tag===13||t.tag===31){var n=di(t,67108864);n!==null&&vn(n,t,67108864),dd(t,67108864)}}function Kg(t){if(t.tag===13||t.tag===31){var n=jn();n=ac(n);var a=di(t,n);a!==null&&vn(a,t,n),dd(t,n)}}var ul=!0;function b1(t,n,a,h){var w=B.T;B.T=null;var E=X.p;try{X.p=2,hd(t,n,a,h)}finally{X.p=E,B.T=w}}function y1(t,n,a,h){var w=B.T;B.T=null;var E=X.p;try{X.p=8,hd(t,n,a,h)}finally{X.p=E,B.T=w}}function hd(t,n,a,h){if(ul){var w=fd(h);if(w===null)Qu(t,n,h,dl,a),Zg(t,h);else if(S1(w,t,n,a,h))h.stopPropagation();else if(Zg(t,h),n&4&&-1<_1.indexOf(t)){for(;w!==null;){var E=Hi(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var M=Oe(E.pendingLanes);if(M!==0){var G=E;for(G.pendingLanes|=2,G.entangledLanes|=2;M;){var J=1<<31-Je(M);G.entanglements[1]|=J,M&=~J}Jn(E),(lt&6)===0&&(Vo=qe()+500,xa(0))}}break;case 31:case 13:G=di(E,2),G!==null&&vn(G,E,2),Ko(),dd(E,2)}if(E=fd(h),E===null&&Qu(t,n,h,dl,a),E===w)break;w=E}w!==null&&h.stopPropagation()}else Qu(t,n,h,null,a)}}function fd(t){return t=mc(t),pd(t)}var dl=null;function pd(t){if(dl=null,t=zi(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=p(n),t!==null)return t;t=null}else if(a===31){if(t=l(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return dl=t,null}function Xg(t){switch(t){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(ot()){case ue:return 2;case ve:return 8;case Te:case He:return 32;case ie:return 268435456;default:return 32}default:return 32}}var md=!1,Yr=null,Kr=null,Xr=null,Ca=new Map,ka=new Map,Zr=[],_1="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 Zg(t,n){switch(t){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Xr=null;break;case"pointerover":case"pointerout":Ca.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ka.delete(n.pointerId)}}function Ea(t,n,a,h,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Hi(n),n!==null&&Yg(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function S1(t,n,a,h,w){switch(n){case"focusin":return Yr=Ea(Yr,t,n,a,h,w),!0;case"dragenter":return Kr=Ea(Kr,t,n,a,h,w),!0;case"mouseover":return Xr=Ea(Xr,t,n,a,h,w),!0;case"pointerover":var E=w.pointerId;return Ca.set(E,Ea(Ca.get(E)||null,t,n,a,h,w)),!0;case"gotpointercapture":return E=w.pointerId,ka.set(E,Ea(ka.get(E)||null,t,n,a,h,w)),!0}return!1}function Qg(t){var n=zi(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=p(a),n!==null){t.blockedOn=n,hf(t.priority,function(){Kg(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,hf(t.priority,function(){Kg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function hl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=fd(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);pc=h,a.target.dispatchEvent(h),pc=null}else return n=Hi(a),n!==null&&Yg(n),t.blockedOn=a,!1;n.shift()}return!0}function Jg(t,n,a){hl(t)&&a.delete(n)}function w1(){md=!1,Yr!==null&&hl(Yr)&&(Yr=null),Kr!==null&&hl(Kr)&&(Kr=null),Xr!==null&&hl(Xr)&&(Xr=null),Ca.forEach(Jg),ka.forEach(Jg)}function fl(t,n){t.blockedOn===n&&(t.blockedOn=null,md||(md=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,w1)))}var pl=null;function ex(t){pl!==t&&(pl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){pl===t&&(pl=null);for(var n=0;n<t.length;n+=3){var a=t[n],h=t[n+1],w=t[n+2];if(typeof h!="function"){if(pd(h||a)===null)continue;break}var E=Hi(a);E!==null&&(t.splice(n,3),n-=3,fu(E,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function ys(t){function n(J){return fl(J,t)}Yr!==null&&fl(Yr,t),Kr!==null&&fl(Kr,t),Xr!==null&&fl(Xr,t),Ca.forEach(n),ka.forEach(n);for(var a=0;a<Zr.length;a++){var h=Zr[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<Zr.length&&(a=Zr[0],a.blockedOn===null);)Qg(a),a.blockedOn===null&&Zr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],E=a[h+1],M=w[hn]||null;if(typeof E=="function")M||ex(a);else if(M){var G=null;if(E&&E.hasAttribute("formAction")){if(w=E,M=E[hn]||null)G=M.formAction;else if(pd(w)!==null)continue}else G=M.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),ex(a)}}}function tx(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),h||setTimeout(a,20)}function a(){if(!h&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function gd(t){this._internalRoot=t}ml.prototype.render=gd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=jn();Gg(a,h,t,n,null,null)},ml.prototype.unmount=gd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Gg(t.current,2,null,t,null,null),Ko(),n[Bi]=null}};function ml(t){this._internalRoot=t}ml.prototype.unstable_scheduleHydration=function(t){if(t){var n=df();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Zr.length&&n!==0&&n<Zr[a].priority;a++);Zr.splice(a,0,t),a===0&&Qg(t)}};var nx=r.version;if(nx!=="19.2.4")throw Error(s(527,nx,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=f(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var C1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var gl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!gl.isDisabled&&gl.supportsFiber)try{Ve=gl.inject(C1),Ye=gl}catch{}}return Na.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,h="",w=cm,E=um,M=dm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(E=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=qg(t,1,!1,null,null,a,h,null,w,E,M,tx),t[Bi]=n.current,Zu(t),new gd(n)},Na.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var h=!1,w="",E=cm,M=um,G=dm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=qg(t,1,!0,n,a??null,h,w,J,E,M,G,tx),n.context=Wg(null),a=n.current,h=jn(),h=ac(h),w=Ir(h),w.callback=null,Br(a,w,h),a=h,n.current.lanes=a,Bs(n,a),Jn(n),t[Bi]=n.current,Zu(t),new ml(n)},Na.version="19.2.4",Na}var hx;function B1(){if(hx)return bd.exports;hx=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(r){console.error(r)}}return e(),bd.exports=I1(),bd.exports}var z1=B1();const H1=Hl(z1);function P1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,u,p=[],l="",d=e.split("/");for(d[0]||d.shift();c=d.shift();)i=c[0],i==="*"?(p.push(i),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=c.indexOf("?",1),u=c.indexOf(".",1),p.push(c.substring(1,~s?s:~u?u:c.length)),l+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~s?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:p,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var wd={exports:{}},Cd={};/**
50
- * @license React
51
- * use-sync-external-store-shim.production.js
52
- *
53
- * Copyright (c) Meta Platforms, Inc. and affiliates.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE file in the root directory of this source tree.
57
- */var fx;function F1(){if(fx)return Cd;fx=1;var e=Pl();function r(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,p=e.useDebugValue;function l(m,b){var S=b(),k=s({inst:{value:S,getSnapshot:b}}),C=k[0].inst,v=k[1];return u(function(){C.value=S,C.getSnapshot=b,d(C)&&v({inst:C})},[m,S,b]),c(function(){return d(C)&&v({inst:C}),m(function(){d(C)&&v({inst:C})})},[m]),p(S),S}function d(m){var b=m.getSnapshot;m=m.value;try{var S=b();return!i(m,S)}catch{return!0}}function f(m,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return Cd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Cd}var px;function U1(){return px||(px=1,wd.exports=F1()),wd.exports}var $1=U1();const q1=R1.useInsertionEffect,W1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",G1=W1?H.useLayoutEffect:H.useEffect,V1=q1||G1,tb=e=>{const r=H.useRef([e,(...i)=>r[0](...i)]).current;return V1(()=>{r[0]=e}),r[1]},Y1="popstate",mh="pushState",gh="replaceState",K1="hashchange",mx=[Y1,mh,gh,K1],X1=e=>{for(const r of mx)addEventListener(r,e);return()=>{for(const r of mx)removeEventListener(r,e)}},nb=(e,r)=>$1.useSyncExternalStore(X1,e,r),gx=()=>location.search,Z1=({ssrSearch:e}={})=>nb(gx,e!=null?()=>e:gx),xx=()=>location.pathname,Q1=({ssrPath:e}={})=>nb(xx,e!=null?()=>e:xx),J1=(e,{replace:r=!1,state:i=null}={})=>history[r?gh:mh](i,"",e),eS=(e={})=>[Q1(e),J1],vx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[vx]>"u"){for(const e of[mh,gh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,vx,{value:!0})}const tS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",rb=(e="")=>e==="/"?"":e,nS=(e,r)=>e[0]==="~"?e.slice(1):rb(r)+e,rS=(e="",r)=>tS(bx(rb(e)),bx(r)),bx=e=>{try{return decodeURI(e)}catch{return e}},ib={hook:eS,searchHook:Z1,parser:P1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},sb=H.createContext(ib),Ls=()=>H.useContext(sb),ab={},ob=H.createContext(ab),iS=()=>H.useContext(ob),Fl=e=>{const[r,i]=e.hook(e);return[rS(e.base,r),tb((s,c)=>e.aroundNav(i,nS(s,e.base),c))]},sr=()=>Fl(Ls()),xh=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),p=c.exec(i)||[],[l,...d]=p;return l!==void 0?[!0,(()=>{const f=u!==!1?Object.fromEntries(u.map((m,b)=>[m,d[b]])):p.groups;let g={...d};return f&&Object.assign(g,f),g})(),...s?[l]:[]]:[!1,null]},vh=e=>xh(Ls().parser,e,sr()[0]),sS=({children:e,...r})=>{var g,m,b;const i=Ls(),s=r.hook?ib:i;let c=s;const[u,p=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=p,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((b=r.hook)==null?void 0:b.searchHook);let l=H.useRef({}),d=l.current,f=d;for(let S in s){const k=S==="base"?s[S]+(r[S]??""):r[S]??s[S];d===f&&k!==f[S]&&(l.current=f={...f}),f[S]=k,(k!==s[S]||k!==c[S])&&(c=f)}return H.createElement(sb.Provider,{value:c,children:e})},yx=({children:e,component:r},i)=>r?H.createElement(r,{params:i}):typeof e=="function"?e(i):e,aS=e=>{let r=H.useRef(ab);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},Ta=({path:e,nest:r,match:i,...s})=>{const c=Ls(),[u]=Fl(c),[p,l,d]=i??xh(c.parser,e,u,r),f=aS({...iS(),...l});if(!p)return null;const g=d?H.createElement(sS,{base:d},yx(s,f)):yx(s,f);return H.createElement(ob.Provider,{value:f,children:g})},An=H.forwardRef((e,r)=>{const i=Ls(),[s,c]=Fl(i),{to:u="",href:p=u,onClick:l,asChild:d,children:f,className:g,replace:m,state:b,transition:S,...k}=e,C=tb(y=>{y.ctrlKey||y.metaKey||y.altKey||y.shiftKey||y.button!==0||(l==null||l(y),y.defaultPrevented||(y.preventDefault(),c(p,e)))}),v=i.hrefs(p[0]==="~"?p.slice(1):i.base+p,i);return d&&H.isValidElement(f)?H.cloneElement(f,{onClick:C,href:v}):H.createElement("a",{...k,onClick:C,href:v,className:g!=null&&g.call?g(s===p):g,children:f,ref:r})}),lb=e=>Array.isArray(e)?e.flatMap(r=>lb(r&&r.type===H.Fragment?r.props.children:r)):[e],oS=({children:e,location:r})=>{const i=Ls(),[s]=Fl(i);for(const c of lb(e)){let u=0;if(H.isValidElement(c)&&(u=xh(i.parser,c.props.path,r||s,c.props.nest))[0])return H.cloneElement(c,{match:u})}return null},_x=e=>{let r;const i=new Set,s=(f,g)=>{const m=typeof f=="function"?f(r):f;if(!Object.is(m,r)){const b=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(S=>S(r,b))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>d,subscribe:f=>(i.add(f),()=>i.delete(f))},d=r=e(s,c,l);return l},lS=(e=>e?_x(e):_x),cS=e=>e;function uS(e,r=cS){const i=ln.useSyncExternalStore(e.subscribe,ln.useCallback(()=>r(e.getState()),[e,r]),ln.useCallback(()=>r(e.getInitialState()),[e,r]));return ln.useDebugValue(i),i}const Sx=e=>{const r=lS(e),i=s=>uS(r,s);return Object.assign(i,r),i},qn=(e=>e?Sx(e):Sx);async function _e(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function dS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function cb(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}class hS{constructor(r){er(this,"ws",null);er(this,"handlers",new Set);er(this,"statusHandler",null);er(this,"baseUrl");er(this,"isReconnecting",!1);er(this,"connectingPromise",null);er(this,"lastCloseCode",0);er(this,"reconnectAttempts",0);er(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const p=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(p),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),s()},this.ws.onclose=l=>{var d,f,g;clearTimeout(p),this.lastCloseCode=l.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(f=this.statusHandler)==null||f.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(p),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const d=JSON.parse(l.data);dS(d)&&this.handlers.forEach(f=>f(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.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(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=cb(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const fS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Ht=new hS(fS),ii=async(e,r,i)=>{try{const s=await _e(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function ub(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let xl=[];const rr=qn()((e,r)=>{function i(){if(xl.length===0)return;const c=xl;xl=[],e(u=>({logs:[...u.logs,...c]}))}const s=ub(i);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:c=>{r().workdir!==c&&(e({workdir:c,status:null,logs:[],config:null,loading:!0}),c&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const c=r().workdir;if(c)try{const p=await(await _e(`/api/dev-server?workdir=${encodeURIComponent(c)}`)).json();e({status:p,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const c=r().workdir;if(c)try{const p=await(await _e(`/api/dev-server/config?workdir=${encodeURIComponent(c)}`)).json();e({config:p.config??null})}catch{}},fetchLogs:async()=>{const c=r().workdir;if(c)try{const l=(await(await _e(`/api/dev-server/logs?workdir=${encodeURIComponent(c)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:l})}catch{}},start:async()=>{const c=r().workdir;if(c)try{const p=await(await _e(`/api/dev-server/start?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:p,logs:[]})}catch{}},stop:async()=>{const c=r().workdir;if(c)try{const p=await(await _e(`/api/dev-server/stop?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:p})}catch{}},restart:async()=>{const c=r().workdir;if(c)try{const p=await(await _e(`/api/dev-server/restart?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:p,logs:[]})}catch{}},saveConfig:async c=>{const u=r().workdir;if(u)try{const l=await(await _e(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json();e({config:l.config??c}),r().fetchStatus()}catch{}},handleMessage:c=>{const u=r().workdir;if(u)switch(c.type){case"devServer.output":{const p=c.payload;if(p.workdir!==u)return;xl.push({stream:p.stream,content:p.content}),s();break}case"devServer.state":{const p=c.payload;if(p.workdir!==u)return;e(l=>({status:l.status?{...l.status,state:p.state,errorMessage:p.errorMessage}:l.status}));break}}}}}),pS=3e4;function mS(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 Et=qn((e,r)=>({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 i=await _e("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.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(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await _e("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ce.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await _e(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const p=await u.json();return e({activeProviderId:p.activeProviderId,model:p.model,backend:p.backend,providers:c.map(l=>({...l,isActive:l.id===p.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await _e(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model context")}const p=await u.json(),{providers:l}=r();return e({providers:l.map(d=>d.id===i?{...d,models:d.models.map(f=>f.id===s?{...f,contextWindow:c,source:"user"}:f)}:d),activating:!1}),p.contextState&&Ce.getState().updateContextState(p.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await _e(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const p=await s.json();throw new Error(p.error??"Failed to refresh models")}const c=await s.json(),{providers:u}=r();return e({providers:u.map(p=>p.id===i?{...p,models:c.models}:p),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},pS);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const p=u.models.find(l=>l.id===i);return(p==null?void 0:p.contextWindow)??2e5}})),Ut=qn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await _e("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await _e("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await _e(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await _e(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const p=await u.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:p.project}),await r().listProjects(),p.project}catch{return null}},deleteProject:async i=>{var s;try{return(await _e(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let vl=[];const Pa=qn()((e,r)=>{function i(){if(vl.length===0)return;const c=vl;vl=[],e(u=>{const p={...u.logs};for(const l of c){const d=p[l.processId]??[];p[l.processId]=[...d,{offset:d.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:p}})}const s=ub(i);return{processes:[],logs:{},loading:!1,setProcesses:c=>e({processes:c}),addProcess:c=>e(u=>({processes:[...u.processes,c]})),updateProcess:(c,u)=>e(p=>({processes:p.processes.map(l=>l.id===c?{...l,...u}:l)})),removeProcess:c=>e(u=>({processes:u.processes.filter(p=>p.id!==c),logs:Object.fromEntries(Object.entries(u.logs).filter(([p])=>p!==c))})),stopProcess:async(c,u)=>{try{(await _e(`/api/sessions/${u}/background-process/${c}/stop`,{method:"POST"})).ok&&r().removeProcess(c)}catch{}},appendLog:(c,u,p)=>{vl.push({processId:c,stream:u,content:p}),s()},setLogs:(c,u)=>e(p=>({logs:{...p.logs,[c]:u}})),clearLogs:c=>e(u=>({logs:{...u.logs,[c]:[]}})),handleMessage:(c,u)=>{switch(c){case"backgroundProcess.started":{const{processId:p,name:l,pid:d,status:f}=u;e(g=>({processes:[...g.processes,{id:p,sessionId:"",name:l,command:"",cwd:"",pid:d,status:f,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const p=u.processId,l=u.stream,d=u.content;r().appendLog(p,l,d);break}case"backgroundProcess.exited":{const p=u.processId,l=u.exitCode;e(d=>({processes:d.processes.map(f=>f.id===p?{...f,status:"exited",exitCode:l}:f)}));break}case"backgroundProcess.removed":{const p=u.processId;r().removeProcess(p);break}}}}}),ei={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"};function bl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function wx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const ti=qn(e=>({settings:{},loading:{},getSetting:async r=>{e(bl(r,!0));try{const s=await(await _e(`/api/settings/${r}`)).json();return e(wx(r,s.value??"")),s.value}catch{return e(bl(r,!1)),null}},setSetting:async(r,i)=>{e(bl(r,!0));try{const c=await(await _e(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(wx(r,c.value??""))}catch{e(bl(r,!1))}}})),gS=[{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"}],xS=[{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"}],db={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"},ni={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},hb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Zd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ni},waiting_for_user:{...ni},phase_done:{...ni},phase_blocked:{...ni},new_message:{...hb}},agentOverrides:{}};function fb(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const Ni=qn((e,r)=>({settings:Zd,loaded:!1,load:()=>{ti.getState().getSetting(ei.NOTIFICATION_SETTINGS);const s=ti.subscribe(u=>{const p=u.settings[ei.NOTIFICATION_SETTINGS];if(p!==void 0)try{const l=JSON.parse(p);e({settings:Cx(l),loaded:!0})}catch{e({loaded:!0})}}),c=ti.getState().settings[ei.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:Cx(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),kd(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),kd(u)},updateAgentOverride:(i,s,c)=>{var d;const u=r().settings,p={...u.agentOverrides};if(c===null){if(p[i]){const f={...p[i]};delete f[s],Object.keys(f).length===0?delete p[i]:p[i]=f}}else p[i]={...p[i],[s]:{...((d=p[i])==null?void 0:d[s])??{},...c}};const l={...u,agentOverrides:p};e({settings:l}),kd(l)}}));function kd(e){ti.getState().setSetting(ei.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Cx(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??Zd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Zd.browserNotificationEnabled,events:{complete:{...ni,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ni,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ni,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ni,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...hb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const kx=new Map;function vS(e){let r=kx.get(e);return r||(r=new Audio(e),r.volume=.5,kx.set(e,r)),r}let pb=typeof Notification<"u"?Notification.permission:"denied";function bS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(pb=e,e))}const yS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},_S={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 SS(e){typeof Notification>"u"||pb==="granted"&&(document.hasFocus()||new Notification(yS[e],{body:_S[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Qa(e,r){const{settings:i}=Ni.getState(),s=fb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??db[e],u=vS(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&SS(e)}const wS=e=>Qa("complete",e),CS=e=>Qa("phase_done",e),kS=e=>Qa("phase_blocked",e),Ex=e=>Qa("waiting_for_user",e),ES=e=>Qa("new_message",e);let Aa=!1,tr=null;const Ed=new Set,zt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ns=null,nn=null;function jd(){Ns===null&&(Ns=requestAnimationFrame(()=>{Ns=null,nn==null||nn()}))}function Ci(){Ns!==null&&(cancelAnimationFrame(Ns),Ns=null)}function Rt(e,r){return r!==null&&e.sessionId===r}function jS(e,r,i){return e.id!==void 0||Rt(e,r)||i===!0&&e.sessionId!==void 0}function NS(e,r){return e.includes(r)?e:[...e,r]}function Da(e,r){return e.filter(i=>i!==r)}function TS(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(c=>c.id===r.id?s:c):[s,...e]}function AS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(p=>p.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const jx=new Map;function za(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(p=>p.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function DS(e,r){if(e.type==="chat.done"){const i=e.payload,s=za(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&wS(c),i.reason==="waiting_for_user"&&Ex(c);return}if(e.type==="chat.path_confirmation"){const i=za(r,e.sessionId);Ex(i);return}if(e.type==="task.completed"){const i=za(r,e.sessionId);CS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=jx.get(e.sessionId)??null;if(jx.set(e.sessionId,i.phase),s===i.phase)return;const c=za(r,e.sessionId);i.phase==="blocked"&&kS(c)}}const Ce=qn((e,r)=>(nn=()=>{const i=zt;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const p=i.deltaContent,l=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(f=>{var m;const g=f.streamingMessage;if(g&&g.id===i.messageId){let b={...g};if(s&&(b.content=b.content+p),c&&(b.thinkingContent=(b.thinkingContent??"")+l),u){const S=new Set;b.toolCalls=(m=b.toolCalls)==null?void 0:m.map(C=>{const v=d.filter(y=>y.callId===C.id);return v.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...v.map(y=>({stream:y.stream,content:y.content}))]})});const k=d.filter(C=>!S.has(C.callId));k.length>0&&zt.toolOutput.push(...k)}return{streamingMessage:b}}if(u){const b=new Set,S=f.messages.map(C=>{var y;if(C.id!==i.messageId)return C;const v=(y=C.toolCalls)==null?void 0:y.map(x=>{const _=d.filter(j=>j.callId===x.id);return _.length===0?x:(b.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],..._.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:v}}),k=d.filter(C=>!b.has(C.callId));return k.length>0&&zt.toolOutput.push(...k),{messages:S}}return f})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await _e("/api/auth")).json()).requiresAuth}catch{}if(s&&!Ht.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Ht.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Ht.connect(),!Aa){Aa=!0;const c=r().handleServerMessage;tr=Ht.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Ht.getLastCloseCode();if(!Ht.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}tr&&(tr(),tr=null),Aa=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Ht.disconnect(),tr&&(tr(),tr=null),Aa=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Ht.disconnect(),tr&&(tr(),tr=null),Aa=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Ht.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Ut.getState(),{fetchConfig:p}=Et.getState();u(),p(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Ht.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await _e("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Ht.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(Ci(),e({currentSession:null,unreadSessionIds:Da(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Da(r().unreadSessionIds,i)});const c=await _e(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Ht.send("session.load",{sessionId:i});try{const p=await _e(`/api/sessions/${i}/background-processes`);if(p.ok){const l=await p.json();Pa.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const p=await(await _e(`/api/sessions?${c.toString()}`)).json();e({sessions:p.sessions??[],sessionsHasMore:i?p.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);const p=await(await _e(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...p.sessions??[]],sessionsHasMore:p.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await _e(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await _e(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{Ci(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Da(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u){e({streamingMessageId:null});try{const d=await(await _e(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){Ci(),nn==null||nn(),e({abortInProgress:!0});try{await _e(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await _e(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Ht.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await _e(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const p=await u.json();p.session&&e({currentSession:p.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await _e(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const p=await u.json();p.session&&e({currentSession:p.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Ht.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await _e(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Ht.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const p=await _e(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!p.ok)return null;const l=await p.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,c=!1)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u)try{await _e(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await _e(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(p){console.error("Error answering question:",p)}e({pendingQuestion:null})}},queueAsap:async(i,s,c)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u)try{const d=await(await _e(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,c)=>{var p;const u=(p=r().currentSession)==null?void 0:p.id;if(u)try{const d=await(await _e(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const p=await(await _e(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();p.queueState&&e({queuedMessages:p.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var p,l,d,f,g,m,b,S,k,C,v,y,x,_,j,A,N,R,T,I,z,V,Y,$;const s=r();DS(i,s);const c=((p=s.currentSession)==null?void 0:p.id)??null,u=()=>{const F=i.sessionId;!F||F===c||e(P=>({unreadSessionIds:NS(P.unreadSessionIds,F)}))};switch(i.type){case"session.state":{const F=i.payload;if(!jS(i,c,s.pendingSessionCreate))break;Ci();const P=F.messages.find(D=>D.isStreaming)??null,B=r().pendingSessionCreate===!0,X=F.pendingConfirmations??[],O=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:F.session,sessions:TS(r().sessions,F.session),unreadSessionIds:Da(r().unreadSessionIds,F.session.id),messages:F.messages,streamingMessageId:(P==null?void 0:P.id)??null,streamingMessage:P,currentTodos:[],pendingPathConfirmation:O,error:null,...B?{pendingSessionCreate:F.session.id}:{}}),F.session.providerId&&F.session.providerModel){const D=Et.getState();D.providers.find(q=>q.id===F.session.providerId)&&D.syncFromSession(F.session.providerId,F.session.providerModel)}break}case"session.list":{const F=i.payload;e(P=>({sessions:AS(F.sessions,P.sessions,P.currentSession)}));break}case"session.deleted":{const F=i.payload;e(P=>({unreadSessionIds:Da(P.unreadSessionIds,F.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const F=i.payload,P=i.sessionId,B=(l=r().currentSession)==null?void 0:l.id,X=P&&P!==B;e(Q=>({sessions:Q.sessions.map(O=>O.id===P?{...O,isRunning:F.isRunning}:O)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,isRunning:F.isRunning}:null,...F.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Rt(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const F=i.payload;e(P=>P.messages.some(B=>B.id===F.message.id)?P:{messages:[...P.messages,F.message],streamingMessageId:F.message.isStreaming?F.message.id:P.streamingMessageId,streamingMessage:F.message.isStreaming?F.message:P.streamingMessage});break}case"chat.message_updated":{if(!Rt(i,((f=r().currentSession)==null?void 0:f.id)??null)){u();break}const F=i.payload,P=F.updates.isStreaming===!1&&r().streamingMessageId===F.messageId;P&&(Ci(),nn==null||nn()),e(B=>{const X=B.streamingMessage,Q=P;if(X&&X.id===F.messageId){const O={...X,...F.updates};return{messages:B.messages.map(D=>D.id===F.messageId?O:D),streamingMessageId:Q?null:B.streamingMessageId,streamingMessage:Q?null:{...X,...F.updates}}}return{messages:B.messages.map(O=>O.id===F.messageId?{...O,...F.updates}:O),streamingMessageId:Q?null:B.streamingMessageId}});break}case"chat.delta":{if(!Rt(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const F=i.payload;if(!Ed.has(F.messageId)){Ed.add(F.messageId);const P=za(r(),i.sessionId);ES(P)}zt.messageId=F.messageId,zt.deltaContent+=F.content,jd();break}case"chat.thinking":{if(!Rt(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const F=i.payload;zt.messageId=F.messageId,zt.thinkingContent+=F.content,jd();break}case"chat.tool_preparing":{if(!Rt(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const F=i.payload;e(P=>{const B=P.streamingMessage;return B&&B.id===F.messageId?{streamingMessage:{...B,preparingToolCalls:[...B.preparingToolCalls??[],{index:F.index,name:F.name}]}}:{messages:P.messages.map(X=>X.id===F.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:F.index,name:F.name}]}:X)}});break}case"chat.tool_call":{if(!Rt(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const F=i.payload,P=B=>{var O;const X=(O=B.preparingToolCalls)==null?void 0:O.filter((D,L)=>{var q;return D.name===F.tool?(q=B.preparingToolCalls)==null?void 0:q.slice(0,L).some(K=>K.name===F.tool):!0}),Q=zt.toolOutput.filter(D=>D.callId===F.callId);return Q.length>0&&(zt.toolOutput=zt.toolOutput.filter(D=>D.callId!==F.callId)),{...B,toolCalls:[...B.toolCalls??[],{id:F.callId,name:F.tool,arguments:F.args,startedAt:Date.now(),...Q.length>0?{streamingOutput:Q.map(D=>({stream:D.stream,content:D.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(B=>{const X=B.streamingMessage;return X&&X.id===F.messageId?{streamingMessage:P(X)}:{messages:B.messages.map(Q=>Q.id===F.messageId?P(Q):Q)}});break}case"chat.tool_output":{if(!Rt(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const F=i.payload;zt.messageId=F.messageId,zt.toolOutput.push({messageId:F.messageId,callId:F.callId,stream:F.stream,content:F.output}),jd();break}case"chat.tool_result":{if(!Rt(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const F=i.payload,P=B=>{var Q;const X=(Q=B.toolCalls)==null?void 0:Q.map(O=>O.id===F.callId?{...O,result:F.result}:O);return{...B,toolCalls:X}};e(B=>{const X=B.streamingMessage;return X&&X.id===F.messageId?{streamingMessage:P(X)}:{messages:B.messages.map(Q=>Q.id===F.messageId?P(Q):Q)}});break}case"chat.vision_fallback":{if(!Rt(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const F=i.payload;e(P=>{const B=`${F.messageId}-${F.attachmentId}`,X={...P.visionFallbackByMessage};return X[B]={type:F.type,attachmentId:F.attachmentId,filename:F.filename,description:F.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!Rt(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const F=i.payload;e({currentTodos:F.todos});break}case"chat.summary":{if(!Rt(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const F=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,summary:F.summary}:null}));break}case"chat.progress":{if(!Rt(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const F=i.payload;console.log("Progress:",F.message,F.phase);break}case"chat.format_retry":{if(!Rt(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const F=i.payload;console.log("Format retry:",F.attempt,"/",F.maxAttempts);break}case"chat.done":{if(!Rt(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}Ci(),nn==null||nn();const F=i.payload,P=F.stats;zt.messageId=null,zt.deltaContent="",zt.thinkingContent="",zt.toolOutput=[],Ed.delete(F.messageId),e(B=>{const X=B.streamingMessage,Q=X&&X.id===F.messageId?{...X,isStreaming:!1,stats:P??X.stats}:null;return{messages:B.messages.map(O=>O.id===F.messageId?Q??{...O,isStreaming:!1,stats:P??O.stats}:O),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Rt(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}Ci(),nn==null||nn();const F=i.payload;console.error("Chat error:",F.error,"recoverable:",F.recoverable),F.recoverable||(zt.messageId=null,zt.deltaContent="",zt.thinkingContent="",zt.toolOutput=[]),e(P=>({error:{code:"CHAT_ERROR",message:F.error},streamingMessageId:F.recoverable?P.streamingMessageId:null,...F.recoverable?{}:{messages:P.streamingMessage?P.messages.map(B=>B.id===P.streamingMessage.id?P.streamingMessage:B):P.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Rt(i,((R=r().currentSession)==null?void 0:R.id)??null)){u();break}const F=i.payload;e({pendingPathConfirmation:{callId:F.callId,tool:F.tool,paths:F.paths,workdir:F.workdir,reason:F.reason}});break}case"chat.ask_user":{if(!Rt(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const F=i.payload;e({pendingQuestion:{callId:F.callId,question:F.question}});break}case"mode.changed":{if(!Rt(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const F=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,mode:F.mode}:null}));break}case"phase.changed":{const F=i.payload,P=i.sessionId,B=(z=r().currentSession)==null?void 0:z.id,X=P&&P!==B;e(Q=>({sessions:Q.sessions.map(O=>O.id===P?{...O,phase:F.phase}:O)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,phase:F.phase}:null}));break}case"criteria.updated":{if(!Rt(i,((V=r().currentSession)==null?void 0:V.id)??null)){u();break}const F=i.payload;e(P=>({currentSession:P.currentSession?{...P.currentSession,criteria:F.criteria}:null}));break}case"context.state":{const F=i.payload,P=Rt(i,((Y=r().currentSession)==null?void 0:Y.id)??null);F.subAgentId?P&&r().updateSubAgentContextState(F.subAgentId,F.context):P?e({contextState:F.context}):u();break}case"session.name_generated":{const F=i.payload,P=i.sessionId,B=($=r().currentSession)==null?void 0:$.id;e(X=>{const Q=X.sessions.map(D=>D.id===P?{...D,title:F.name,updatedAt:new Date().toISOString()}:D),O=B===P?X.currentSession?{...X.currentSession,title:F.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Q,currentSession:O}});break}case"queue.state":{const F=i.payload;e({queuedMessages:F.messages});break}case"devServer.output":case"devServer.state":{rr.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Pa.getState().handleMessage(i.type,i.payload);break}case"error":{const F=i.payload;console.error("Server error:",F),e({error:{code:F.code,message:F.message},streamingMessageId:null});break}}}}));function mb(){return Ce(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function RS(){return Ce(e=>e.queuedMessages)}function LS(){return Ce(e=>e.abortInProgress)}function MS(){const e=Ce(s=>s.connect),r=Ce(s=>s.connectionStatus),i=Ni(s=>s.load);return H.useEffect(()=>{e()},[e]),H.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Qd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}function Nx(e,r){const i=Ht.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Qd(),type:e,payload:r}))}const ir=qn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await _e("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Ht.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:Qd(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await _e("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(p=>({sessions:[...p.sessions,c]}));const u=Ht.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Qd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Nx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{Nx("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await _e(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(p=>p.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Ht.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&ir.getState().handleMessage(e)});const bh=H.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));bh.displayName="IconButton";const OS="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",si=H.forwardRef((e,r)=>o.jsx(bh,{ref:r,icon:OS,title:"Edit",...e}));si.displayName="EditButton";const IS="M6 18L18 6M6 6l12 12",Ul=H.forwardRef((e,r)=>o.jsx(bh,{ref:r,icon:IS,...e}));Ul.displayName="CloseButton";var $l=eb();function un({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const u=H.useRef(null),p=H.useRef(null),l=H.useCallback(f=>{f.key==="Escape"&&r()},[r]);if(H.useEffect(()=>{var f,g;return e?(p.current=document.activeElement,(f=u.current)==null||f.focus(),document.body.style.overflow="hidden"):((g=p.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),H.useEffect(()=>{if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,l]),!e)return null;const d={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return $l.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{ref:u,tabIndex:-1,className:`relative w-full ${d[c]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),o.jsx(Ul,{onClick:r,className:"flex-shrink-0","aria-label":"Close modal"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const yt=H.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{const p="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white 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 o.jsx("button",{ref:u,className:`${p} ${l[e]} ${d[r]} ${i}`,...c,children:s})});yt.displayName="Button";function BS({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const p=u.target.value;s(p===r?null:p)},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:xS.map(({url:u,label:p})=>o.jsx("option",{value:u,title:p,children:p.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Tx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function zS(){const e=Ni(d=>d.settings),r=Ni(d=>d.update),i=Ni(d=>d.updateEvent),s=Ni(d=>d.updateAgentOverride),c=Ni(d=>d.load);H.useEffect(()=>{c()},[c]);const u=async()=>{await bS()==="granted"&&r({...e,browserNotificationEnabled:!0})},p=(d,f,g,m)=>{d==="general"?i(f,{[g]:m}):s(d,f,{[g]:m})},l=(d,f,g)=>{d==="general"?i(f,{customSoundUrl:g}):s(d,f,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Ax,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Ax,{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"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Tx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:gS.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Tx.map(f=>{const g=fb(e,d.key,f.key==="general"?void 0:f.key),m=db[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:b=>p(f.key,d.key,"soundEnabled",b.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:b=>p(f.key,d.key,"browserNotification",b.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(BS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:b=>l(f.key,d.key,b)})]})},f.key)})]},d.key))})]})})]})]})}function Ax({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}const kr=qn((e,r)=>({skills:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await _e("/api/skills/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchSkills:async()=>{e({loading:!0});try{const s=await(await _e("/api/skills")).json();e({skills:s.skills??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},toggleSkill:async i=>{try{const c=await(await _e(`/api/skills/${i}/toggle`,{method:"POST"})).json();e({skills:r().skills.map(u=>u.id===i?{...u,enabled:c.enabled}:u)})}catch{}},fetchSkill:async i=>{try{const s=await _e(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await ii("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const c=await ii("PUT",`/api/skills/${i}`,s);return c.success&&await r().fetchSkills(),c},deleteSkill:async i=>{try{return(await _e(`/api/skills/${i}`,{method:"DELETE"})).ok?(e({skills:r().skills.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/skills/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/skills/restore-all-defaults",{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}}}));function gb(){const[e,r]=H.useState({id:null,type:null}),i=H.useCallback(d=>r({id:d,type:"delete"}),[]),s=H.useCallback(d=>r({id:d,type:"restore"}),[]),c=H.useCallback(()=>r({id:null,type:"restoreAll"}),[]),u=H.useCallback(()=>r({id:null,type:null}),[]),p=H.useCallback((d,f)=>e.id===d&&e.type===f,[e.id,e.type]),l=H.useCallback(()=>e.type==="restoreAll",[e.type]);return{requestDelete:i,requestRestore:s,requestRestoreAll:c,clearConfirm:u,isConfirming:p,isConfirmingRestoreAll:l}}function As({type:e,onConfirm:r,onCancel:i}){const s=e==="delete";return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:r,className:`px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors ${s?"bg-accent-error/20 text-accent-error hover:bg-accent-error/30":"bg-amber-500/20 text-amber-400 hover:bg-amber-500/30"}`,children:s?"Delete":"Restore"}),o.jsx("button",{onClick:i,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function yh({onClick:e}){return o.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:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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 _h({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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 Ti({label:e,value:r,onChange:i,placeholder:s,readOnly:c,hint:u,mono:p}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:l=>i(l.target.value),readOnly:c,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 ${p?"font-mono":""} ${c?"opacity-60":""}`})]})}function xb({label:e,value:r,onChange:i,placeholder:s,className:c=""}){return o.jsxs("div",{className:c,children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:e}),o.jsx("textarea",{value:r,onChange:u=>i(u.target.value),placeholder:s,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})}function Sh({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(yt,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(yt,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function wh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function vb({description:e,modifiedCount:r,onRestoreAll:i,isConfirmingRestoreAll:s,onCancelRestoreAll:c,onNew:u,newLabel:p="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[r>0&&o.jsx("div",{className:"flex items-center gap-2 text-xs",children:s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-accent-warning",children:"Confirm restore all?"}),o.jsx("button",{onClick:c,className:"text-text-muted hover:text-text-primary",children:"Cancel"}),o.jsx("button",{onClick:i,className:"text-accent-error hover:text-accent-error/80",children:"Confirm"})]}):o.jsxs("button",{onClick:i,className:"text-accent-warning hover:text-accent-warning/80 transition-colors",children:["Restore defaults (",r,")"]})}),o.jsx(yt,{variant:"primary",size:"sm",onClick:u,children:p})]})]})}function bb({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:c="My Item",idPlaceholder:u="my-item",nameHint:p,readOnlyId:l=!1,readOnlyHint:d="(read-only)",onNameChange:f,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ti,{label:i,value:e,onChange:f,placeholder:c,hint:p}),o.jsx(Ti,{label:s,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function yb(e={}){const{initialData:r={}}=e,[i,s]=H.useState("list"),[c,u]=H.useState(null),[p,l]=H.useState(""),[d,f]=H.useState(!1),[g,m]=H.useState(r),b=H.useCallback(()=>{m(r),l(""),u(null)},[r]),S=H.useCallback(y=>{s(y),y==="list"&&b()},[b]),k=H.useCallback(y=>{m(x=>typeof y=="function"?y(x):y)},[]),C=H.useCallback((y,x={})=>{u(y),s("edit"),m({...x}),l("")},[]),v=H.useCallback(()=>{u(null),s("edit"),m(r),l("")},[r]);return{view:i,editingId:c,formError:p,saving:d,formData:g,setView:S,setEditingId:u,setFormError:l,setFormData:k,setSaving:f,resetForm:b,startEditing:C,startNew:v}}function HS({isOpen:e}){const r=kr(P=>P.skills),i=kr(P=>P.modifiedIds),s=kr(P=>P.loading),c=kr(P=>P.fetchSkills),u=kr(P=>P.fetchSkill),p=kr(P=>P.createSkill),l=kr(P=>P.updateSkill),d=kr(P=>P.deleteSkill),f=kr(P=>P.restoreDefault),{view:g,editingId:m,formError:b,saving:S,formData:k,setView:C,setEditingId:v,setFormError:y,setFormData:x,setSaving:_}=yb(),{requestDelete:j,requestRestore:A,requestRestoreAll:N,clearConfirm:R,isConfirming:T,isConfirmingRestoreAll:I}=gb();H.useEffect(()=>{e&&(c(),C("list"),v(null),R())},[e,c,R]);const z=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:""}),C("edit")},V=async P=>{const B=await u(P);B&&(v(P),x({name:B.metadata.name,id:B.metadata.id,description:B.metadata.description??"",version:B.metadata.version??"1.0.0",prompt:B.prompt}),y(""),C("edit"))},Y=async P=>{await d(P),R()},$=async()=>{const P=m??k.id;if(!P||!k.name||!k.prompt){y("Name, ID, and prompt are required.");return}_(!0),y("");const B={metadata:{id:P,name:k.name,description:k.description,version:k.version},prompt:k.prompt},X=m?await l(m,B):await p(B);if(_(!1),!X.success){y(X.error??"Failed to save skill.");return}C("list")},F=P=>{x(B=>({...B,name:P})),m||x(B=>({...B,id:P.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))};return g==="edit"?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-4 flex justify-between items-center",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),b&&o.jsx(wh,{message:b}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(bb,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!!m,onNameChange:F,onIdChange:P=>x(B=>({...B,id:P}))}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ti,{label:"Description",value:k.description,onChange:P=>x(B=>({...B,description:P})),placeholder:"What this skill does..."}),o.jsx(Ti,{label:"Version",value:k.version,onChange:P=>x(B=>({...B,version:P})),placeholder:"1.0.0"})]}),o.jsx(xb,{label:"Prompt",value:k.prompt,onChange:P=>x(B=>({...B,prompt:P})),placeholder:"The system prompt for this skill...",className:"h-48"}),o.jsx(Sh,{onCancel:()=>C("list"),onSave:$,saving:S,saveDisabled:!k.name||!k.id||!k.prompt})]})]}):o.jsxs("div",{children:[o.jsx(vb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",modifiedCount:i.length,onRestoreAll:N,isConfirmingRestoreAll:I(),onCancelRestoreAll:R,onNew:z}),s&&r.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading skills..."}):r.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No skills created yet."}):o.jsx("div",{className:"space-y-2",children:r.map(P=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:P.name}),i.includes(P.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),P.description&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:P.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i.includes(P.id)&&(T(P.id,"restore")?o.jsx(As,{type:"restore",onConfirm:()=>f(P.id).then(R),onCancel:R}):o.jsx(_h,{onClick:()=>A(P.id)})),o.jsx(si,{onClick:()=>V(P.id)}),T(P.id,"delete")?o.jsx(As,{type:"delete",onConfirm:()=>Y(P.id),onCancel:R}):o.jsx(yh,{onClick:()=>j(P.id)})]})]},P.id))})]})}function PS({isOpen:e,onClose:r}){const[i,s]=H.useState("instructions");return o.jsx(un,{isOpen:e,onClose:r,title:"Settings",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(yl,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(yl,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(yl,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(yl,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(US,{isOpen:e}),i==="skills"&&o.jsx(HS,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(zS,{})}),i==="advanced"&&o.jsx(FS,{onClose:r})]})})}function FS({onClose:e}){const[,r]=sr();function i(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(yt,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function yl({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function US({isOpen:e}){const r=ti(v=>v.settings),i=ti(v=>v.loading),s=ti(v=>v.getSetting),c=ti(v=>v.setSetting),u=r[ei.GLOBAL_INSTRUCTIONS]??"",p=i[ei.GLOBAL_INSTRUCTIONS]??!1,[l,d]=H.useState(u),[f,g]=H.useState(!1),[m,b]=H.useState(!1);H.useEffect(()=>{e&&s(ei.GLOBAL_INSTRUCTIONS)},[e,s]),H.useEffect(()=>{d(u),g(!1)},[u]);const S=async()=>{b(!0),c(ei.GLOBAL_INSTRUCTIONS,l),b(!1),g(!1)},k=()=>{d(u),g(!1)},C=p||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:v=>{d(v.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(yt,{variant:"secondary",onClick:k,disabled:!f,children:"Discard"}),o.jsx(yt,{variant:"primary",onClick:S,disabled:!f||C,children:m?"Saving...":"Save"})]})]})}var Nd={exports:{}},Dx;function $S(){return Dx||(Dx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,l,d){var f=this&&this.__decorate||function(x,_,j,A){var N,R=arguments.length,T=R<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(R<3?N(T):R>3?N(_,j,T):N(_,j))||T);return R>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),b=d(9924),S=d(844),k=d(4725),C=d(2585),v=d(3656);let y=l.AccessibilityManager=class extends S.Disposable{constructor(x,_,j,A){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=A,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 N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,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 b.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((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
58
- `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.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,S.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let _=0;_<x;_++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
59
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,_){this._liveRegionDebouncer.refresh(x,_,this._terminal.rows)}_renderRows(x,_){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=x;N<=_;N++){const R=j.lines.get(j.ydisp+N),T=[],I=(R==null?void 0:R.translateToString(!0,void 0,void 0,T))||"",z=(j.ydisp+N+1).toString(),V=this._rowElements[N];V&&(I.length===0?(V.innerText=" ",this._rowColumns.set(V,[0,1])):(V.textContent=I,this._rowColumns.set(V,T)),V.setAttribute("aria-posinset",z),V.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,_){const j=x.target,A=this._rowElements[_===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==A)return;let N,R;if(_===0?(N=j,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(N=this._rowElements.shift(),R=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((_.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===j.node&&_.offset>j.offset)&&([_,j]=[j,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:z,offset:V})=>{const Y=z instanceof Text?z.parentNode:z;let $=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const F=this._rowColumns.get(Y);if(!F)return console.warn("columns is null. Race condition?"),null;let P=V<F.length?F[V]:F.slice(-1)[0]+1;return P>=this._terminal.cols&&(++$,P=0),{row:$,column:P}},R=N(_),T=N(j);if(R&&T){if(R.row>T.row||R.row===T.row&&R.column>=T.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(T.row-R.row)*this._terminal.cols-R.column+T.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=y=f([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],y)},3614:(p,l)=>{function d(b){return b.replace(/\r?\n/g,"\r")}function f(b,S){return S?"\x1B[200~"+b+"\x1B[201~":b}function g(b,S,k,C){b=f(b=d(b),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(b,!0),S.value=""}function m(b,S,k){const C=k.getBoundingClientRect(),v=b.clientX-C.left-10,y=b.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${v}px`,S.style.top=`${y}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=f,l.copyHandler=function(b,S){b.clipboardData&&b.clipboardData.setData("text/plain",S.selectionText),b.preventDefault()},l.handlePasteEvent=function(b,S,k,C){b.stopPropagation(),b.clipboardData&&g(b.clipboardData.getData("text/plain"),S,k,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(b,S,k,C,v){m(b,S,k),v&&C.rightClickSelect(b),S.value=C.selectionText,S.select()}},7239:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=d(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,m,b){this._css.set(g,m,b)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,b){this._color.set(g,m,b)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,f,g,m){d.addEventListener(f,g,m);let b=!1;return{dispose:()=>{b||(b=!0,d.removeEventListener(f,g,m))}}}},3551:function(p,l,d){var f=this&&this.__decorate||function(y,x,_,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(R=(N<3?A(R):N>3?A(x,_,R):A(x,_))||R);return N>3&&R&&Object.defineProperty(x,_,R),R},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=d(3656),b=d(8460),S=d(844),k=d(2585),C=d(4725);let v=l.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(y,x,_,j,A){super(),this._element=y,this._mouseService=x,this._renderService=_,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,S.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,S.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.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(y){this._lastMouseEvent=y;const x=this._positionFromMouseEvent(y,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const _=y.composedPath();for(let j=0;j<_.length;j++){const A=_[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(y){if(this._activeLine!==y.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(y,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,y)||(this._clearCurrentLink(),this._askForLink(y,!0))}_askForLink(y,x){var j,A;this._activeProviderReplies&&x||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=y.y);let _=!1;for(const[N,R]of this._linkProviderService.linkProviders.entries())x?(A=this._activeProviderReplies)!=null&&A.get(N)&&(_=this._checkLinkProviderResult(N,y,_)):R.provideLinks(y.y,(T=>{var z,V;if(this._isMouseOut)return;const I=T==null?void 0:T.map((Y=>({link:Y})));(z=this._activeProviderReplies)==null||z.set(N,I),_=this._checkLinkProviderResult(N,y,_),((V=this._activeProviderReplies)==null?void 0:V.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(y.y,this._activeProviderReplies)}))}_removeIntersectingLinks(y,x){const _=new Set;for(let j=0;j<x.size;j++){const A=x.get(j);if(A)for(let N=0;N<A.length;N++){const R=A[N],T=R.link.range.start.y<y?0:R.link.range.start.x,I=R.link.range.end.y>y?this._bufferService.cols:R.link.range.end.x;for(let z=T;z<=I;z++){if(_.has(z)){A.splice(N--,1);break}_.add(z)}}}}_checkLinkProviderResult(y,x,_){var N;if(!this._activeProviderReplies)return _;const j=this._activeProviderReplies.get(y);let A=!1;for(let R=0;R<y;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(A=!0);if(!A&&j){const R=j.find((T=>this._linkAtPosition(T.link,x)));R&&(_=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let R=0;R<this._activeProviderReplies.size;R++){const T=(N=this._activeProviderReplies.get(R))==null?void 0:N.find((I=>this._linkAtPosition(I.link,x)));if(T){_=!0,this._handleNewLink(T);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(y){if(!this._currentLink)return;const x=this._positionFromMouseEvent(y,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(y,this._currentLink.link.text)}_clearCurrentLink(y,x){this._currentLink&&this._lastMouseEvent&&(!y||!x||this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(y){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(y.link,x)&&(this._currentLink=y,this._currentLink.state={decorations:{underline:y.link.decorations===void 0||y.link.decorations.underline,pointerCursor:y.link.decorations===void 0||y.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,y.link,this._lastMouseEvent),y.link.decorations={},Object.defineProperties(y.link.decorations,{pointerCursor:{get:()=>{var _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.pointerCursor},set:_=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,j;return(j=(_=this._currentLink)==null?void 0:_.state)==null?void 0:j.decorations.underline},set:_=>{var j,A,N;(j=this._currentLink)!=null&&j.state&&((N=(A=this._currentLink)==null?void 0:A.state)==null?void 0:N.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(y.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const j=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(y,x,_){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&y.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(_,x.text)}_fireUnderlineEvent(y,x){const _=y.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-j-1,_.end.x,_.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(y,x,_){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&y.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(_,x.text)}_linkAtPosition(y,x){const _=y.range.start.y*this._bufferService.cols+y.range.start.x,j=y.range.end.y*this._bufferService.cols+y.range.end.x,A=x.y*this._bufferService.cols+x.x;return _<=A&&A<=j}_positionFromMouseEvent(y,x,_){const j=_.getCoords(y,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(y,x,_,j,A){return{x1:y,y1:x,x2:_,y2:j,cols:this._bufferService.cols,fg:A}}};l.Linkifier=v=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.IBufferService),g(4,C.ILinkProviderService)],v)},9042:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(p,l,d){var f=this&&this.__decorate||function(C,v,y,x){var _,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(v,y,A):_(v,y))||A);return j>3&&A&&Object.defineProperty(v,y,A),A},g=this&&this.__param||function(C,v){return function(y,x){v(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=d(511),b=d(2585);let S=l.OscLinkProvider=class{constructor(C,v,y){this._bufferService=C,this._optionsService=v,this._oscLinkService=y}provideLinks(C,v){var I;const y=this._bufferService.buffer.lines.get(C-1);if(!y)return void v(void 0);const x=[],_=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=y.getTrimmedLength();let N=-1,R=-1,T=!1;for(let z=0;z<A;z++)if(R!==-1||y.hasContent(z)){if(y.loadCell(z,j),j.hasExtendedAttrs()&&j.extended.urlId){if(R===-1){R=z,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else R!==-1&&(T=!0);if(T||R!==-1&&z===A-1){const V=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(V){const Y={start:{x:R+1,y:C},end:{x:z+(T||z!==A-1?0:1),y:C}};let $=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const F=new URL(V);["http:","https:"].includes(F.protocol)||($=!0)}catch{$=!0}$||x.push({text:V,range:Y,activate:(F,P)=>_?_.activate(F,P,Y):k(0,P),hover:(F,P)=>{var B;return(B=_==null?void 0:_.hover)==null?void 0:B.call(_,F,P,Y)},leave:(F,P)=>{var B;return(B=_==null?void 0:_.leave)==null?void 0:B.call(_,F,P,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(R=z,N=j.extended.urlId):(R=-1,N=-1)}}v(x)}};function k(C,v){if(confirm(`Do you want to navigate to ${v}?
60
-
61
- WARNING: This link could potentially be dangerous`)){const y=window.open();if(y){try{y.opener=null}catch{}y.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=S=f([g(0,b.IBufferService),g(1,b.IOptionsService),g(2,b.IOscLinkService)],S)},6193:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.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,g){this._rowCount=g,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:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=d(3614),g=d(3656),m=d(3551),b=d(9042),S=d(3730),k=d(1680),C=d(3107),v=d(5744),y=d(2950),x=d(1296),_=d(428),j=d(4269),A=d(5114),N=d(8934),R=d(3230),T=d(9312),I=d(4725),z=d(6731),V=d(8055),Y=d(8969),$=d(8460),F=d(844),P=d(6114),B=d(8437),X=d(2584),Q=d(7399),O=d(5941),D=d(9074),L=d(2585),q=d(5435),U=d(4567),K=d(779);class ee extends Y.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(Z={}){super(Z),this.browser=P,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new F.MutableDisposable),this._onCursorMove=this.register(new $.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new $.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new $.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new $.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new $.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new $.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new $.EventEmitter),this._onBlur=this.register(new $.EventEmitter),this._onA11yCharEmitter=this.register(new $.EventEmitter),this._onA11yTabEmitter=this.register(new $.EventEmitter),this._onWillOpen=this.register(new $.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(L.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((W,ae)=>this.refresh(W,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((W=>this._reportWindowsOptions(W)))),this.register(this._inputHandler.onColor((W=>this._handleColorEvent(W)))),this.register((0,$.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,$.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,F.toDisposable)((()=>{var W,ae;this._customKeyEventHandler=void 0,(ae=(W=this.element)==null?void 0:W.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const W of Z){let ae,se="";switch(W.index){case 256:ae="foreground",se="10";break;case 257:ae="background",se="11";break;case 258:ae="cursor",se="12";break;default:ae="ansi",se="4;"+W.index}switch(W.type){case 0:const pe=V.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${se};${(0,O.toRgbString)(pe)}${X.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((be=>be.ansi[W.index]=V.channels.toColor(...W.color)));else{const be=ae;this._themeService.modifyColors((je=>je[be]=V.channels.toColor(...W.color)))}break;case 2:this._themeService.restoreColor(W.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.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 Z=this.buffer.ybase+this.buffer.y,W=this.buffer.lines.get(Z);if(!W)return;const ae=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,pe=W.getWidth(ae),be=this._renderService.dimensions.css.cell.width*pe,je=this.buffer.y*this._renderService.dimensions.css.cell.height,Ne=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ne+"px",this.textarea.style.top=je+"px",this.textarea.style.width=be+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(W=>{this.hasSelection()&&(0,f.copyHandler)(W,this._selectionService)})));const Z=W=>(0,f.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Z)),P.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,f.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),P.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,f.moveTextAreaUnderMouseCursor)(W,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ae;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const W=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),W.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,g.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),W.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),P.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(A.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.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(y.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(W);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(k.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(T.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.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,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.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(U.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(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,W=this.element;function ae(be){const je=Z._mouseService.getMouseReportCoords(be,Z.screenElement);if(!je)return!1;let Ne,Le;switch(be.overrideType||be.type){case"mousemove":Le=32,be.buttons===void 0?(Ne=3,be.button!==void 0&&(Ne=be.button<3?be.button:3)):Ne=1&be.buttons?0:4&be.buttons?1:2&be.buttons?2:3;break;case"mouseup":Le=0,Ne=be.button<3?be.button:3;break;case"mousedown":Le=1,Ne=be.button<3?be.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(be)===!1||Z.viewport.getLinesScrolled(be)===0)return!1;Le=be.deltaY<0?0:1,Ne=4;break;default:return!1}return!(Le===void 0||Ne===void 0||Ne>4)&&Z.coreMouseService.triggerMouseEvent({col:je.col,row:je.row,x:je.x,y:je.y,button:Ne,action:Le,ctrl:be.ctrlKey,alt:be.altKey,shift:be.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:be=>(ae(be),be.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(be)),wheel:be=>(ae(be),this.cancel(be,!0)),mousedrag:be=>{be.buttons&&ae(be)},mousemove:be=>{be.buttons||ae(be)}};this.register(this.coreMouseService.onProtocolChange((be=>{be?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(be)),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&be?se.mousemove||(W.addEventListener("mousemove",pe.mousemove),se.mousemove=pe.mousemove):(W.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&be?se.wheel||(W.addEventListener("wheel",pe.wheel,{passive:!1}),se.wheel=pe.wheel):(W.removeEventListener("wheel",se.wheel),se.wheel=null),2&be?se.mouseup||(se.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&be?se.mousedrag||(se.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(W,"mousedown",(be=>{if(be.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(be))return ae(be),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(be)}))),this.register((0,g.addDisposableDomListener)(W,"wheel",(be=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(be)===!1)return!1;if(!this.buffer.hasScrollback){const je=this.viewport.getLinesScrolled(be);if(je===0)return;const Ne=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(be.deltaY<0?"A":"B");let Le="";for(let Ue=0;Ue<Math.abs(je);Ue++)Le+=Ne;return this.coreService.triggerDataEvent(Le,!0),this.cancel(be,!0)}return this.viewport.handleWheel(be)?this.cancel(be):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(W,"touchstart",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(be),this.cancel(be)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(W,"touchmove",(be=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(be)?void 0:this.cancel(be)}),{passive:!1}))}refresh(Z,W){var ae;(ae=this._renderService)==null||ae.refreshRows(Z,W)}updateCursorStyle(Z){var W;(W=this._selectionService)!=null&&W.shouldColumnSelect(Z)?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(Z,W,ae=0){var se;ae===1?(super.scrollLines(Z,W,ae),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const W=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),W}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,W,ae){this._selectionService.setSelection(Z,W,ae)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,W){var ae;(ae=this._selectionService)==null||ae.selectLines(Z,W)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const W=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!W&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;W||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,Q.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ae.type===3||ae.type===2){const se=this.rows-1;return this.scrollLines(ae.type===2?-se:se),this.cancel(Z,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ae.cancel&&this.cancel(Z,!0),!ae.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==X.C0.ETX&&ae.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,W){const ae=Z.isMac&&!this.options.macOptionIsMeta&&W.altKey&&!W.ctrlKey&&!W.metaKey||Z.isWindows&&W.altKey&&W.ctrlKey&&!W.metaKey||Z.isWindows&&W.getModifierState("AltGraph");return W.type==="keypress"?ae:ae&&(!W.keyCode||W.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(W){return W.keyCode===16||W.keyCode===17||W.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let W;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)W=Z.charCode;else if(Z.which===null||Z.which===void 0)W=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;W=Z.which}return!(!W||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(W=String.fromCharCode(W),this._onKey.fire({key:W,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(W,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const W=Z.data;return this.coreService.triggerDataEvent(W,!0),this.cancel(Z),!0}return!1}resize(Z,W){Z!==this.cols||W!==this.rows?super.resize(Z,W):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,W){var ae,se;(ae=this._charSizeService)==null||ae.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var Z;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 W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(B.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Z=this.viewport)==null||Z.reset(),this.refresh(0,this.rows-1)}}reset(){var W,ae;this.options.rows=this.rows,this.options.cols=this.cols;const Z=this._customKeyEventHandler;this._setup(),super.reset(),(W=this._selectionService)==null||W.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=Z,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Z;(Z=this._renderService)==null||Z.clearTextureAtlas()}_reportFocus(){var Z;(Z=this.element)!=null&&Z.classList.contains("focus")?this.coreService.triggerDataEvent(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(Z){if(this._renderService)switch(Z){case q.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const W=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[4;${ae};${W}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),pe=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${pe};${se}t`)}}cancel(Z,W){if(this.options.cancelEvents||W)return Z.preventDefault(),Z.stopPropagation(),!1}}l.Terminal=ee},9924:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.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,g){this._rowCount=g,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 b=m-this._lastRefreshMs,S=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),S)}}_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(p,l,d){var f=this&&this.__decorate||function(y,x,_,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(R=(N<3?A(R):N>3?A(x,_,R):A(x,_))||R);return N>3&&R&&Object.defineProperty(x,_,R),R},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=d(3656),b=d(4725),S=d(8460),k=d(844),C=d(2585);let v=l.Viewport=class extends k.Disposable{constructor(y,x,_,j,A,N,R,T){super(),this._viewportElement=y,this._scrollArea=x,this._bufferService=_,this._optionsService=j,this._charSizeService=A,this._renderService=N,this._coreBrowserService=R,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 S.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((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(y){this._viewportElement.style.backgroundColor=y.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(y){if(y)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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const y=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==y&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=y),this._refreshAnimationFrame=null}syncScrollArea(y=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(y);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(y)}_handleScroll(y){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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const y=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(y*(this._smoothScrollState.target-this._smoothScrollState.origin)),y<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(y,x){const _=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&_<this._lastRecordedBufferHeight)||(y.cancelable&&y.preventDefault(),!1)}handleWheel(y){const x=this._getPixelsScrolled(y);return x!==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+x:this._smoothScrollState.target+=x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=x,this._bubbleScroll(y,x))}scrollLines(y){if(y!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=y*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+x,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:y,suppressScrollEvent:!1})}_getPixelsScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let x=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(y,x){var T;let _,j="";const A=[],N=x??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let I=y;I<N;I++){const z=R.get(I);if(!z)continue;const V=(T=R.get(I+1))==null?void 0:T.isWrapped;if(j+=z.translateToString(!V),!V||I===R.length-1){const Y=document.createElement("div");Y.textContent=j,A.push(Y),j.length>0&&(_=Y),j=""}}return{bufferElements:A,cursorElement:_}}getLinesScrolled(y){if(y.deltaY===0||y.shiftKey)return 0;let x=this._applyScrollModifier(y.deltaY,y);return y.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):y.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(y,x){const _=this._optionsService.rawOptions.fastScrollModifier;return _==="alt"&&x.altKey||_==="ctrl"&&x.ctrlKey||_==="shift"&&x.shiftKey?y*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:y*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(y){this._lastTouchY=y.touches[0].pageY}handleTouchMove(y){const x=this._lastTouchY-y.touches[0].pageY;return this._lastTouchY=y.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(y,x))}};l.Viewport=v=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,b.ICharSizeService),g(5,b.IRenderService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],v)},3107:function(p,l,d){var f=this&&this.__decorate||function(C,v,y,x){var _,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(v,y,A):_(v,y))||A);return j>3&&A&&Object.defineProperty(v,y,A),A},g=this&&this.__param||function(C,v){return function(y,x){v(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=d(4725),b=d(844),S=d(2585);let k=l.BufferDecorationRenderer=class extends b.Disposable{constructor(C,v,y,x,_){super(),this._screenElement=C,this._bufferService=v,this._coreBrowserService=y,this._decorationService=x,this._renderService=_,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((j=>this._removeDecoration(j)))),this.register((0,b.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),v.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(C.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 y=C.options.x??0;return y&&y>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(C,v),v}_refreshStyle(C){const v=C.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let y=this._decorationElements.get(C);y||(y=this._createElement(C),C.element=y,this._decorationElements.set(C,y),this._container.appendChild(y),C.onDispose((()=>{this._decorationElements.delete(C),y.remove()}))),y.style.top=v*this._renderService.dimensions.css.cell.height+"px",y.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(y)}}_refreshXPosition(C,v=C.element){if(!v)return;const y=C.options.x??0;(C.options.anchor||"left")==="right"?v.style.right=y?y*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=y?y*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var v;(v=this._decorationElements.get(C))==null||v.remove(),this._decorationElements.delete(C),C.dispose()}};l.BufferDecorationRenderer=k=f([g(1,S.IBufferService),g(2,m.ICoreBrowserService),g(3,S.IDecorationService),g(4,m.IRenderService)],k)},5871:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.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,g){return f>=d.startBufferLine-this._linePadding[g||"full"]&&f<=d.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(d,f){d.startBufferLine=Math.min(d.startBufferLine,f),d.endBufferLine=Math.max(d.endBufferLine,f)}}},5744:function(p,l,d){var f=this&&this.__decorate||function(_,j,A,N){var R,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(_,j,A,N);else for(var z=_.length-1;z>=0;z--)(R=_[z])&&(I=(T<3?R(I):T>3?R(j,A,I):R(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(_,j){return function(A,N){j(A,N,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=d(5871),b=d(4725),S=d(844),k=d(2585),C={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(_,j,A,N,R,T,I){var V;super(),this._viewportElement=_,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=R,this._optionsService=T,this._coreBrowserService=I,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(),(V=this._viewportElement.parentElement)==null||V.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,S.toDisposable)((()=>{var Y;(Y=this._canvas)==null||Y.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 _=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=_,v.center=j,v.right=_,this._refreshDrawHeightConstants(),y.full=0,y.left=0,y.center=v.left,y.right=v.left+v.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const _=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(_,12),6)*this._coreBrowserService.dpr);C.left=j,C.center=j,C.right=j}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 j of this._decorationService.decorations)this._colorZoneStore.addDecoration(j);this._ctx.lineWidth=1;const _=this._colorZoneStore.zones;for(const j of _)j.position!=="full"&&this._renderColorZone(j);for(const j of _)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(_){this._ctx.fillStyle=_.color,this._ctx.fillRect(y[_.position||"full"],Math.round((this._canvas.height-1)*(_.startBufferLine/this._bufferService.buffers.active.lines.length)-C[_.position||"full"]/2),v[_.position||"full"],Math.round((this._canvas.height-1)*((_.endBufferLine-_.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[_.position||"full"]))}_queueRefresh(_,j){this._shouldUpdateDimensions=_||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=f([g(2,k.IBufferService),g(3,k.IDecorationService),g(4,b.IRenderService),g(5,k.IOptionsService),g(6,b.ICoreBrowserService)],x)},2950:function(p,l,d){var f=this&&this.__decorate||function(C,v,y,x){var _,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,y):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,y,x);else for(var N=C.length-1;N>=0;N--)(_=C[N])&&(A=(j<3?_(A):j>3?_(v,y,A):_(v,y))||A);return j>3&&A&&Object.defineProperty(v,y,A),A},g=this&&this.__param||function(C,v){return function(y,x){v(y,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=d(4725),b=d(2585),S=d(2584);let k=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,v,y,x,_,j){this._textarea=C,this._compositionView=v,this._bufferService=y,this._optionsService=x,this._coreService=_,this._renderService=j,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let y;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,y=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),y.length>0&&this._coreService.triggerDataEvent(y,!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 C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,y=v.replace(C,"");this._dataAlreadySent=y,v.length>C.length?this._coreService.triggerDataEvent(y,!0):v.length<C.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):v.length===C.length&&v!==C&&this._coreService.triggerDataEvent(v,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const v=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,_=v*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=y+"px",this._compositionView.style.lineHeight=y+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const j=this._compositionView.getBoundingClientRect();this._textarea.style.left=_+"px",this._textarea.style.top=x+"px",this._textarea.style.width=Math.max(j.width,1)+"px",this._textarea.style.height=Math.max(j.height,1)+"px",this._textarea.style.lineHeight=j.height+"px"}C||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=k=f([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,b.ICoreService),g(5,m.IRenderService)],k)},9806:(p,l)=>{function d(f,g,m){const b=m.getBoundingClientRect(),S=f.getComputedStyle(m),k=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-b.left-k,g.clientY-b.top-C]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=d,l.getCoords=function(f,g,m,b,S,k,C,v,y){if(!k)return;const x=d(f,g,m);return x?(x[0]=Math.ceil((x[0]+(y?C/2:0))/C),x[1]=Math.ceil(x[1]/v),x[0]=Math.min(Math.max(x[0],1),b+(y?1:0)),x[1]=Math.min(Math.max(x[1],1),S),x):void 0}},9504:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=d(2584);function g(v,y,x,_){const j=v-m(v,x),A=y-m(y,x),N=Math.abs(j-A)-(function(R,T,I){let z=0;const V=R-m(R,I),Y=T-m(T,I);for(let $=0;$<Math.abs(V-Y);$++){const F=b(R,T)==="A"?-1:1,P=I.buffer.lines.get(V+F*$);P!=null&&P.isWrapped&&z++}return z})(v,y,x);return C(N,k(b(v,y),_))}function m(v,y){let x=0,_=y.buffer.lines.get(v),j=_==null?void 0:_.isWrapped;for(;j&&v>=0&&v<y.rows;)x++,_=y.buffer.lines.get(--v),j=_==null?void 0:_.isWrapped;return x}function b(v,y){return v>y?"A":"B"}function S(v,y,x,_,j,A){let N=v,R=y,T="";for(;N!==x||R!==_;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(R,!1,v,N),N=0,v=0,R++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(R,!1,0,v+1),N=A.cols-1,v=N,R--);return T+A.buffer.translateBufferLineToString(R,!1,v,N)}function k(v,y){const x=y?"O":"[";return f.C0.ESC+x+v}function C(v,y){v=Math.floor(v);let x="";for(let _=0;_<v;_++)x+=y;return x}l.moveToCellSequence=function(v,y,x,_){const j=x.buffer.x,A=x.buffer.y;if(!x.buffer.hasScrollback)return(function(T,I,z,V,Y,$){return g(I,V,Y,$).length===0?"":C(S(T,I,T,I-m(I,Y),!1,Y).length,k("D",$))})(j,A,0,y,x,_)+g(A,y,x,_)+(function(T,I,z,V,Y,$){let F;F=g(I,V,Y,$).length>0?V-m(V,Y):I;const P=V,B=(function(X,Q,O,D,L,q){let U;return U=g(O,D,L,q).length>0?D-m(D,L):Q,X<O&&U<=D||X>=O&&U<D?"C":"D"})(T,I,z,V,Y,$);return C(S(T,F,z,P,B==="C",Y).length,k(B,$))})(j,A,v,y,x,_);let N;if(A===y)return N=j>v?"D":"C",C(Math.abs(j-v),k(N,_));N=A>y?"D":"C";const R=Math.abs(A-y);return C((function(T,I){return I.cols-T})(A>y?v:j,x)+(R-1)*x.cols+1+((A>y?j:v)-1),k(N,_))}},1296:function(p,l,d){var f=this&&this.__decorate||function($,F,P,B){var X,Q=arguments.length,O=Q<3?F:B===null?B=Object.getOwnPropertyDescriptor(F,P):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate($,F,P,B);else for(var D=$.length-1;D>=0;D--)(X=$[D])&&(O=(Q<3?X(O):Q>3?X(F,P,O):X(F,P))||O);return Q>3&&O&&Object.defineProperty(F,P,O),O},g=this&&this.__param||function($,F){return function(P,B){F(P,B,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=d(3787),b=d(2550),S=d(2223),k=d(6171),C=d(6052),v=d(4725),y=d(8055),x=d(8460),_=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",R="xterm-fg-",T="xterm-bg-",I="xterm-focus",z="xterm-selection";let V=1,Y=l.DomRenderer=class extends _.Disposable{constructor($,F,P,B,X,Q,O,D,L,q,U,K,ee){super(),this._terminal=$,this._document=F,this._element=P,this._screenElement=B,this._viewportElement=X,this._helperContainer=Q,this._linkifier2=O,this._charSizeService=L,this._optionsService=q,this._bufferService=U,this._coreBrowserService=K,this._themeService=ee,this._terminalClass=V++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),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(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,k.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ne=>this._injectCss(ne)))),this._injectCss(this._themeService.colors),this._rowFactory=D.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ne=>this._handleLinkHover(ne)))),this.register(this._linkifier2.onHideLinkUnderline((ne=>this._handleLinkLeave(ne)))),this.register((0,_.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new b.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 $=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*$,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*$),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/$),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/$),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 P of this._rowElements)P.style.width=`${this.dimensions.css.canvas.width}px`,P.style.height=`${this.dimensions.css.cell.height}px`,P.style.lineHeight=`${this.dimensions.css.cell.height}px`,P.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const F=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=F,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($){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let F=`${this._terminalSelector} .${N} { color: ${$.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;F+=`${this._terminalSelector} .${N} .xterm-dim { color: ${y.color.multiplyOpacity($.foreground,.5).css};}`,F+=`${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 P=`blink_underline_${this._terminalClass}`,B=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;F+=`@keyframes ${P} { 50% { border-bottom-style: hidden; }}`,F+=`@keyframes ${B} { 50% { box-shadow: none; }}`,F+=`@keyframes ${X} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,F+=`${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${B} 1s step-end infinite;}${this._terminalSelector} .${N}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${$.cursor.css} !important; color: ${$.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${$.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${$.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${$.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,F+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[Q,O]of $.ansi.entries())F+=`${this._terminalSelector} .${R}${Q} { color: ${O.css}; }${this._terminalSelector} .${R}${Q}.xterm-dim { color: ${y.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${T}${Q} { background-color: ${O.css}; }`;F+=`${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR} { color: ${y.color.opaque($.background).css}; }${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${y.color.multiplyOpacity(y.color.opaque($.background),.5).css}; }${this._terminalSelector} .${T}${S.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=F}_setDefaultSpacing(){const $=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${$}px`,this._rowFactory.defaultSpacing=$}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements($,F){for(let P=this._rowElements.length;P<=F;P++){const B=this._document.createElement("div");this._rowContainer.appendChild(B),this._rowElements.push(B)}for(;this._rowElements.length>F;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,F){this._refreshRowElements($,F),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,F,P){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,F,P),this.renderRows(0,this._bufferService.rows-1),!$||!F)return;this._selectionRenderModel.update(this._terminal,$,F,P);const B=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,Q=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(Q>=this._bufferService.rows||O<0)return;const D=this._document.createDocumentFragment();if(P){const L=$[0]>F[0];D.appendChild(this._createSelectionElement(Q,L?F[0]:$[0],L?$[0]:F[0],O-Q+1))}else{const L=B===Q?$[0]:0,q=Q===X?F[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(Q,L,q));const U=O-Q-1;if(D.appendChild(this._createSelectionElement(Q+1,0,this._bufferService.cols,U)),Q!==O){const K=X===O?F[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(O,0,K))}}this._selectionContainer.appendChild(D)}_createSelectionElement($,F,P,B=1){const X=this._document.createElement("div"),Q=F*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(P-F);return Q+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-Q),X.style.height=B*this.dimensions.css.cell.height+"px",X.style.top=$*this.dimensions.css.cell.height+"px",X.style.left=`${Q}px`,X.style.width=`${O}px`,X}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 $ of this._rowElements)$.replaceChildren()}renderRows($,F){const P=this._bufferService.buffer,B=P.ybase+P.y,X=Math.min(P.x,this._bufferService.cols-1),Q=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let L=$;L<=F;L++){const q=L+P.ydisp,U=this._rowElements[L],K=P.lines.get(q);if(!U||!K)break;U.replaceChildren(...this._rowFactory.createRow(K,q,q===B,O,D,X,Q,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!0)}_handleLinkLeave($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!1)}_setCellUnderline($,F,P,B,X,Q){P<0&&($=0),B<0&&(F=0);const O=this._bufferService.rows-1;P=Math.max(Math.min(P,O),0),B=Math.max(Math.min(B,O),0),X=Math.min(X,this._bufferService.cols);const D=this._bufferService.buffer,L=D.ybase+D.y,q=Math.min(D.x,X-1),U=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let ne=P;ne<=B;++ne){const Z=ne+D.ydisp,W=this._rowElements[ne],ae=D.lines.get(Z);if(!W||!ae)break;W.replaceChildren(...this._rowFactory.createRow(ae,Z,Z===L,K,ee,q,U,this.dimensions.css.cell.width,this._widthCache,Q?ne===P?$:0:-1,Q?(ne===B?F:X)-1:-1))}}};l.DomRenderer=Y=f([g(7,j.IInstantiationService),g(8,v.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,v.ICoreBrowserService),g(12,v.IThemeService)],Y)},3787:function(p,l,d){var f=this&&this.__decorate||function(N,R,T,I){var z,V=arguments.length,Y=V<3?R:I===null?I=Object.getOwnPropertyDescriptor(R,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,R,T,I);else for(var $=N.length-1;$>=0;$--)(z=N[$])&&(Y=(V<3?z(Y):V>3?z(R,T,Y):z(R,T))||Y);return V>3&&Y&&Object.defineProperty(R,T,Y),Y},g=this&&this.__param||function(N,R){return function(T,I){R(T,I,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=d(2223),b=d(643),S=d(511),k=d(2585),C=d(8055),v=d(4725),y=d(4269),x=d(6171),_=d(3734);let j=l.DomRendererRowFactory=class{constructor(N,R,T,I,z,V,Y){this._document=N,this._characterJoinerService=R,this._optionsService=T,this._coreBrowserService=I,this._coreService=z,this._decorationService=V,this._themeService=Y,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,R,T){this._selectionStart=N,this._selectionEnd=R,this._columnSelectMode=T}createRow(N,R,T,I,z,V,Y,$,F,P,B){const X=[],Q=this._characterJoinerService.getJoinedCharacters(R),O=this._themeService.colors;let D,L=N.getNoBgTrimmedLength();T&&L<V+1&&(L=V+1);let q=0,U="",K=0,ee=0,ne=0,Z=!1,W=0,ae=!1,se=0;const pe=[],be=P!==-1&&B!==-1;for(let je=0;je<L;je++){N.loadCell(je,this._workCell);let Ne=this._workCell.getWidth();if(Ne===0)continue;let Le=!1,Ue=je,we=this._workCell;if(Q.length>0&&je===Q[0][0]){Le=!0;const Ae=Q.shift();we=new y.JoinedCellData(this._workCell,N.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),Ue=Ae[1]-1,Ne=we.getWidth()}const ct=this._isCellInSelection(je,R),ut=T&&je===V,jt=be&&je>=P&&je<=B;let xe=!1;this._decorationService.forEachDecorationAtCell(je,R,void 0,(Ae=>{xe=!0}));let ze=we.getChars()||b.WHITESPACE_CELL_CHAR;if(ze===" "&&(we.isUnderline()||we.isOverline())&&(ze=" "),se=Ne*$-F.get(ze,we.isBold(),we.isItalic()),D){if(q&&(ct&&ae||!ct&&!ae&&we.bg===K)&&(ct&&ae&&O.selectionForeground||we.fg===ee)&&we.extended.ext===ne&&jt===Z&&se===W&&!ut&&!Le&&!xe){we.isInvisible()?U+=b.WHITESPACE_CELL_CHAR:U+=ze,q++;continue}q&&(D.textContent=U),D=this._document.createElement("span"),q=0,U=""}else D=this._document.createElement("span");if(K=we.bg,ee=we.fg,ne=we.extended.ext,Z=jt,W=se,ae=ct,Le&&V>=je&&V<=Ue&&(V=je),!this._coreService.isCursorHidden&&ut&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&pe.push("xterm-cursor-blink"),pe.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(we.isBold()&&pe.push("xterm-bold"),we.isItalic()&&pe.push("xterm-italic"),we.isDim()&&pe.push("xterm-dim"),U=we.isInvisible()?b.WHITESPACE_CELL_CHAR:we.getChars()||b.WHITESPACE_CELL_CHAR,we.isUnderline()&&(pe.push(`xterm-underline-${we.extended.underlineStyle}`),U===" "&&(U=" "),!we.isUnderlineColorDefault()))if(we.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${_.AttributeData.toColorRGB(we.getUnderlineColor()).join(",")})`;else{let Ae=we.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&we.isBold()&&Ae<8&&(Ae+=8),D.style.textDecorationColor=O.ansi[Ae].css}we.isOverline()&&(pe.push("xterm-overline"),U===" "&&(U=" ")),we.isStrikethrough()&&pe.push("xterm-strikethrough"),jt&&(D.style.textDecoration="underline");let Pe=we.getFgColor(),qe=we.getFgColorMode(),ot=we.getBgColor(),ue=we.getBgColorMode();const ve=!!we.isInverse();if(ve){const Ae=Pe;Pe=ot,ot=Ae;const Ve=qe;qe=ue,ue=Ve}let Te,He,ie,ke=!1;switch(this._decorationService.forEachDecorationAtCell(je,R,void 0,(Ae=>{Ae.options.layer!=="top"&&ke||(Ae.backgroundColorRGB&&(ue=50331648,ot=Ae.backgroundColorRGB.rgba>>8&16777215,Te=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(qe=50331648,Pe=Ae.foregroundColorRGB.rgba>>8&16777215,He=Ae.foregroundColorRGB),ke=Ae.options.layer==="top")})),!ke&&ct&&(Te=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,ot=Te.rgba>>8&16777215,ue=50331648,ke=!0,O.selectionForeground&&(qe=50331648,Pe=O.selectionForeground.rgba>>8&16777215,He=O.selectionForeground)),ke&&pe.push("xterm-decoration-top"),ue){case 16777216:case 33554432:ie=O.ansi[ot],pe.push(`xterm-bg-${ot}`);break;case 50331648:ie=C.channels.toColor(ot>>16,ot>>8&255,255&ot),this._addStyle(D,`background-color:#${A((ot>>>0).toString(16),"0",6)}`);break;default:ve?(ie=O.foreground,pe.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):ie=O.background}switch(Te||we.isDim()&&(Te=C.color.multiplyOpacity(ie,.5)),qe){case 16777216:case 33554432:we.isBold()&&Pe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Pe+=8),this._applyMinimumContrast(D,ie,O.ansi[Pe],we,Te,void 0)||pe.push(`xterm-fg-${Pe}`);break;case 50331648:const Ae=C.channels.toColor(Pe>>16&255,Pe>>8&255,255&Pe);this._applyMinimumContrast(D,ie,Ae,we,Te,He)||this._addStyle(D,`color:#${A(Pe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,ie,O.foreground,we,Te,He)||ve&&pe.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}pe.length&&(D.className=pe.join(" "),pe.length=0),ut||Le||xe?D.textContent=U:q++,se!==this.defaultSpacing&&(D.style.letterSpacing=`${se}px`),X.push(D),je=Ue}return D&&q&&(D.textContent=U),X}_applyMinimumContrast(N,R,T,I,z,V){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const Y=this._getContrastCache(I);let $;if(z||V||($=Y.getColor(R.rgba,T.rgba)),$===void 0){const F=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);$=C.color.ensureContrastRatio(z||R,V||T,F),Y.setColor((z||R).rgba,(V||T).rgba,$??null)}return!!$&&(this._addStyle(N,`color:${$.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,R){N.setAttribute("style",`${N.getAttribute("style")||""}${R};`)}_isCellInSelection(N,R){const T=this._selectionStart,I=this._selectionEnd;return!(!T||!I)&&(this._columnSelectMode?T[0]<=I[0]?N>=T[0]&&R>=T[1]&&N<I[0]&&R<=I[1]:N<T[0]&&R>=T[1]&&N>=I[0]&&R<=I[1]:R>T[1]&&R<I[1]||T[1]===I[1]&&R===T[1]&&N>=T[0]&&N<I[0]||T[1]<I[1]&&R===I[1]&&N<I[0]||T[1]<I[1]&&R===T[1]&&N>=T[0])}};function A(N,R,T){for(;N.length<T;)N=R+N;return N}l.DomRendererRowFactory=j=f([g(1,v.ICharacterJoinerService),g(2,k.IOptionsService),g(3,v.ICoreBrowserService),g(4,k.ICoreService),g(5,k.IDecorationService),g(6,v.IThemeService)],j)},2550:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.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 g=d.createElement("span");g.classList.add("xterm-char-measure-element");const m=d.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const b=d.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const S=d.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontWeight="bold",S.style.fontStyle="italic",this._measureElements=[g,m,b,S],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(b),this._container.appendChild(S),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,g,m){d===this._font&&f===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=d,this._fontSize=f,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(d,f,g){let m=0;if(!f&&!g&&d.length===1&&(m=d.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const k=this._measure(d,0);return k>0&&(this._flat[m]=k),k}let b=d;f&&(b+="B"),g&&(b+="I");let S=this._holey.get(b);if(S===void 0){let k=0;f&&(k|=1),g&&(k|=2),S=this._measure(d,k),S>0&&this._holey.set(b,S)}return S}_measure(d,f){const g=this._measureElements[f];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(p,l)=>{function d(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},l.isPowerlineGlyph=d,l.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},l.isEmoji=f,l.allowRescaling=function(g,m,b,S){return m===1&&b>Math.ceil(1.5*S)&&g!==void 0&&g>255&&!f(g)&&!d(g)&&!(function(k){return 57344<=k&&k<=63743})(g)},l.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(m){return 9472<=m&&m<=9631})(g)},l.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}}}},l.computeNextVariantOffset=function(g,m,b=0){return(g-(2*Math.round(m)-b))%(2*Math.round(m))}},6052:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.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(g,m,b,S=!1){if(this.selectionStart=m,this.selectionEnd=b,!m||!b||m[0]===b[0]&&m[1]===b[1])return void this.clear();const k=g.buffers.active.ydisp,C=m[1]-k,v=b[1]-k,y=Math.max(C,0),x=Math.min(v,g.rows-1);y>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=v,this.viewportCappedStartRow=y,this.viewportCappedEndRow=x,this.startCol=m[0],this.endCol=b[0])}isCellSelected(g,m,b){return!!this.hasSelection&&(b-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&b>=this.viewportCappedStartRow&&m<this.endCol&&b<=this.viewportCappedEndRow:m<this.startCol&&b>=this.viewportCappedStartRow&&m>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new d}},456:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.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(p,l,d){var f=this&&this.__decorate||function(x,_,j,A){var N,R=arguments.length,T=R<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(R<3?N(T):R>3?N(_,j,T):N(_,j))||T);return R>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=d(2585),b=d(8460),S=d(844);let k=l.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,_,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new y(this._optionsService))}catch{this._measureStrategy=this.register(new v(x,_,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=k=f([g(2,m.IOptionsService)],k);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(_,j){_!==void 0&&_>0&&j!==void 0&&j>0&&(this._result.width=_,this._result.height=j)}}class v extends C{constructor(_,j,A){super(),this._document=_,this._parentElement=j,this._optionsService=A,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 y extends C{constructor(_){super(),this._optionsService=_,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const j=this._ctx.measureText("W");if(!("width"in j&&"fontBoundingBoxAscent"in j&&"fontBoundingBoxDescent"in j))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const _=this._ctx.measureText("W");return this._validateAndSet(_.width,_.fontBoundingBoxAscent+_.fontBoundingBoxDescent),this._result}}},4269:function(p,l,d){var f=this&&this.__decorate||function(y,x,_,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,_):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,x,_,j);else for(var T=y.length-1;T>=0;T--)(A=y[T])&&(R=(N<3?A(R):N>3?A(x,_,R):A(x,_))||R);return N>3&&R&&Object.defineProperty(x,_,R),R},g=this&&this.__param||function(y,x){return function(_,j){x(_,j,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=d(3734),b=d(643),S=d(511),k=d(2585);class C extends m.AttributeData{constructor(x,_,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=_,this._width=j}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=C;let v=l.CharacterJoinerService=class _b{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(x){const _={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(_),_.id}deregister(x){for(let _=0;_<this._characterJoiners.length;_++)if(this._characterJoiners[_].id===x)return this._characterJoiners.splice(_,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const _=this._bufferService.buffer.lines.get(x);if(!_||_.length===0)return[];const j=[],A=_.translateToString(!0);let N=0,R=0,T=0,I=_.getFg(0),z=_.getBg(0);for(let V=0;V<_.getTrimmedLength();V++)if(_.loadCell(V,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==z){if(V-N>1){const Y=this._getJoinedRanges(A,T,R,_,N);for(let $=0;$<Y.length;$++)j.push(Y[$])}N=V,T=R,I=this._workCell.fg,z=this._workCell.bg}R+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const V=this._getJoinedRanges(A,T,R,_,N);for(let Y=0;Y<V.length;Y++)j.push(V[Y])}return j}_getJoinedRanges(x,_,j,A,N){const R=x.substring(_,j);let T=[];try{T=this._characterJoiners[0].handler(R)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const z=this._characterJoiners[I].handler(R);for(let V=0;V<z.length;V++)_b._mergeRanges(T,z[V])}catch(z){console.error(z)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(x,_,j){let A=0,N=!1,R=0,T=x[A];if(T){for(let I=j;I<this._bufferService.cols;I++){const z=_.getWidth(I),V=_.getString(I).length||b.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!N&&T[0]<=R&&(T[0]=I,N=!0),T[1]<=R){if(T[1]=I,T=x[++A],!T)break;T[0]<=R?(T[0]=I,N=!0):N=!1}R+=V}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(x,_){let j=!1;for(let A=0;A<x.length;A++){const N=x[A];if(j){if(_[1]<=N[0])return x[A-1][1]=_[1],x;if(_[1]<=N[1])return x[A-1][1]=Math.max(_[1],N[1]),x.splice(A,1),x;x.splice(A,1),A--}else{if(_[1]<=N[0])return x.splice(A,0,_),x;if(_[1]<=N[1])return N[0]=Math.min(_[0],N[0]),x;_[0]<N[1]&&(N[0]=Math.min(_[0],N[0]),j=!0)}}return j?x[x.length-1][1]=_[1]:x.push(_),x}};l.CharacterJoinerService=v=f([g(0,k.IBufferService)],v)},5114:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=d(844),g=d(8460),m=d(3656);class b extends f.Disposable{constructor(C,v,y){super(),this._textarea=C,this._window=v,this.mainDocument=y,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new S(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.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(C){this._window!==C&&(this._window=C,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}}l.CoreBrowserService=b;class S extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new g.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(C){this._parentWindow=C,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 C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=d(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const S=this.linkProviders.indexOf(b);S!==-1&&this.linkProviders.splice(S,1)}}}}l.LinkProviderService=g},8934:function(p,l,d){var f=this&&this.__decorate||function(k,C,v,y){var x,_=arguments.length,j=_<3?C:y===null?y=Object.getOwnPropertyDescriptor(C,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(k,C,v,y);else for(var A=k.length-1;A>=0;A--)(x=k[A])&&(j=(_<3?x(j):_>3?x(C,v,j):x(C,v))||j);return _>3&&j&&Object.defineProperty(C,v,j),j},g=this&&this.__param||function(k,C){return function(v,y){C(v,y,k)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=d(4725),b=d(9806);let S=l.MouseService=class{constructor(k,C){this._renderService=k,this._charSizeService=C}getCoords(k,C,v,y,x){return(0,b.getCoords)(window,k,C,v,y,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(k,C){const v=(0,b.getCoordsRelativeToElement)(window,k,C);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])}}};l.MouseService=S=f([g(0,m.IRenderService),g(1,m.ICharSizeService)],S)},3230:function(p,l,d){var f=this&&this.__decorate||function(x,_,j,A){var N,R=arguments.length,T=R<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(R<3?N(T):R>3?N(_,j,T):N(_,j))||T);return R>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=d(6193),b=d(4725),S=d(8460),k=d(844),C=d(7226),v=d(2585);let y=l.RenderService=class extends k.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,_,j,A,N,R,T,I){super(),this._rowCount=x,this._charSizeService=A,this._renderer=this.register(new k.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new k.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 S.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new S.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new S.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new S.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((z,V)=>this._renderRows(z,V)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(j.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(j.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(j.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,_),this.register(T.onWindowChange((z=>this._registerIntersectionObserver(z,_))))}_registerIntersectionObserver(x,_){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(_),this._observerDisposable.value=(0,k.toDisposable)((()=>j.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,_,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,_,this._rowCount))}_renderRows(x,_){this._renderer.value&&(x=Math.min(x,this._rowCount-1),_=Math.min(_,this._rowCount-1),this._renderer.value.renderRows(x,_),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:_}),this._onRender.fire({start:x,end:_}),this._isNextRenderRedrawOnly=!0)}resize(x,_){this._rowCount=_,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((_=>this.refreshRows(_.start,_.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,_;this._renderer.value&&((_=(x=this._renderer.value).clearTextureAtlas)==null||_.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,_){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,_)})):this._renderer.value.handleResize(x,_),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,_,j){var A;this._selectionState.start=x,this._selectionState.end=_,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(x,_,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=y=f([g(2,v.IOptionsService),g(3,b.ICharSizeService),g(4,v.IDecorationService),g(5,v.IBufferService),g(6,b.ICoreBrowserService),g(7,b.IThemeService)],y)},9312:function(p,l,d){var f=this&&this.__decorate||function(T,I,z,V){var Y,$=arguments.length,F=$<3?I:V===null?V=Object.getOwnPropertyDescriptor(I,z):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(T,I,z,V);else for(var P=T.length-1;P>=0;P--)(Y=T[P])&&(F=($<3?Y(F):$>3?Y(I,z,F):Y(I,z))||F);return $>3&&F&&Object.defineProperty(I,z,F),F},g=this&&this.__param||function(T,I){return function(z,V){I(z,V,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=d(9806),b=d(9504),S=d(456),k=d(4725),C=d(8460),v=d(844),y=d(6114),x=d(4841),_=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let R=l.SelectionService=class extends v.Disposable{constructor(T,I,z,V,Y,$,F,P,B){super(),this._element=T,this._screenElement=I,this._linkifier=z,this._bufferService=V,this._coreService=Y,this._mouseService=$,this._optionsService=F,this._renderService=P,this._coreBrowserService=B,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new S.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 T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!T||!I||T[0]===I[0]&&T[1]===I[1])}get selectionText(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!T||!I)return"";const z=this._bufferService.buffer,V=[];if(this._activeSelectionMode===3){if(T[0]===I[0])return"";const Y=T[0]<I[0]?T[0]:I[0],$=T[0]<I[0]?I[0]:T[0];for(let F=T[1];F<=I[1];F++){const P=z.translateBufferLineToString(F,!0,Y,$);V.push(P)}}else{const Y=T[1]===I[1]?I[0]:void 0;V.push(z.translateBufferLineToString(T[1],!0,T[0],Y));for(let $=T[1]+1;$<=I[1]-1;$++){const F=z.lines.get($),P=z.translateBufferLineToString($,!0);F!=null&&F.isWrapped?V[V.length-1]+=P:V.push(P)}if(T[1]!==I[1]){const $=z.lines.get(I[1]),F=z.translateBufferLineToString(I[1],!0,0,I[0]);$&&$.isWrapped?V[V.length-1]+=F:V.push(F)}}return V.map((Y=>Y.replace(N," "))).join(y.isWindows?`\r
62
- `:`
63
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(T){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),y.isLinux&&T&&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(T){const I=this._getMouseBufferCoords(T),z=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!!(z&&V&&I)&&this._areCoordsInSelection(I,z,V)}isCellInSelection(T,I){const z=this._model.finalSelectionStart,V=this._model.finalSelectionEnd;return!(!z||!V)&&this._areCoordsInSelection([T,I],z,V)}_areCoordsInSelection(T,I,z){return T[1]>I[1]&&T[1]<z[1]||I[1]===z[1]&&T[1]===I[1]&&T[0]>=I[0]&&T[0]<z[0]||I[1]<z[1]&&T[1]===z[1]&&T[0]<z[0]||I[1]<z[1]&&T[1]===I[1]&&T[0]>=I[0]}_selectWordAtCursor(T,I){var Y,$;const z=($=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:$.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const V=this._getMouseBufferCoords(T);return!!V&&(this._selectWordAt(V,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,I){this._model.clearSelection(),T=Math.max(T,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const I=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(T){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=z?0:(I>z&&(I-=z),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(T){return y.isMac?T.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:T.shiftKey}handleMouseDown(T){if(this._mouseDownTimeStamp=T.timeStamp,(T.button!==2||!this.hasSelection)&&T.button===0){if(!this._enabled){if(!this.shouldForceSelection(T))return;T.stopPropagation()}T.preventDefault(),this._dragScrollAmount=0,this._enabled&&T.shiftKey?this._handleIncrementalClick(T):T.detail===1?this._handleSingleClick(T):T.detail===2?this._handleDoubleClick(T):T.detail===3&&this._handleTripleClick(T),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(T){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(T))}_handleSingleClick(T){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(T)?3:0,this._model.selectionStart=this._getMouseBufferCoords(T),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const I=this._getMouseBufferCoords(T);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(T){return T.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(T),!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(T),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const V=z.lines.get(this._model.selectionEnd[1]);V&&V.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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 T=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(T.ydisp+this._bufferService.rows,T.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=T.ydisp),this.refresh()}}_handleMouseUp(T){const I=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const V=(0,b.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(V,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,z=!(!T||!I||T[0]===I[0]&&T[1]===I[1]);z?T&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,I,z)):this._oldHasSelection&&this._fireOnSelectionChange(T,I,z)}_fireOnSelectionChange(T,I,z){this._oldSelectionStart=T,this._oldSelectionEnd=I,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(T,I){let z=I;for(let V=0;I>=V;V++){const Y=T.loadCell(V,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:Y>1&&I!==V&&(z+=Y-1)}return z}setSelection(T,I,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,I],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,I,z=!0,V=!0){if(T[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,$=Y.lines.get(T[1]);if(!$)return;const F=Y.translateBufferLineToString(T[1],!1);let P=this._convertViewportColToCharacterIndex($,T[0]),B=P;const X=T[0]-P;let Q=0,O=0,D=0,L=0;if(F.charAt(P)===" "){for(;P>0&&F.charAt(P-1)===" ";)P--;for(;B<F.length&&F.charAt(B+1)===" ";)B++}else{let K=T[0],ee=T[0];$.getWidth(K)===0&&(Q++,K--),$.getWidth(ee)===2&&(O++,ee++);const ne=$.getString(ee).length;for(ne>1&&(L+=ne-1,B+=ne-1);K>0&&P>0&&!this._isCharWordSeparator($.loadCell(K-1,this._workCell));){$.loadCell(K-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(Q++,K--):Z>1&&(D+=Z-1,P-=Z-1),P--,K--}for(;ee<$.length&&B+1<F.length&&!this._isCharWordSeparator($.loadCell(ee+1,this._workCell));){$.loadCell(ee+1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,ee++):Z>1&&(L+=Z-1,B+=Z-1),B++,ee++}}B++;let q=P+X-Q+D,U=Math.min(this._bufferService.cols,B-P+Q+O-D-L);if(I||F.slice(P,B).trim()!==""){if(z&&q===0&&$.getCodePoint(0)!==32){const K=Y.lines.get(T[1]-1);if(K&&$.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(ee){const ne=this._bufferService.cols-ee.start;q-=ne,U+=ne}}}if(V&&q+U===this._bufferService.cols&&$.getCodePoint(this._bufferService.cols-1)!==32){const K=Y.lines.get(T[1]+1);if(K!=null&&K.isWrapped&&K.getCodePoint(0)!==32){const ee=this._getWordAt([0,T[1]+1],!1,!1,!0);ee&&(U+=ee.length)}}return{start:q,length:U}}}_selectWordAt(T,I){const z=this._getWordAt(T,I);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[z.start,T[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(T){const I=this._getWordAt(T,!0);if(I){let z=T[1];for(;I.start<0;)I.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,z]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const I=this._bufferService.buffer.getWrappedRangeForLine(T),z={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols)}};l.SelectionService=R=f([g(3,j.IBufferService),g(4,j.ICoreService),g(5,k.IMouseService),g(6,j.IOptionsService),g(7,k.IRenderService),g(8,k.ICoreBrowserService)],R)},4725:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=d(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(p,l,d){var f=this&&this.__decorate||function(R,T,I,z){var V,Y=arguments.length,$=Y<3?T:z===null?z=Object.getOwnPropertyDescriptor(T,I):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(R,T,I,z);else for(var F=R.length-1;F>=0;F--)(V=R[F])&&($=(Y<3?V($):Y>3?V(T,I,$):V(T,I))||$);return Y>3&&$&&Object.defineProperty(T,I,$),$},g=this&&this.__param||function(R,T){return function(I,z){T(I,z,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=d(7239),b=d(8055),S=d(8460),k=d(844),C=d(2585),v=b.css.toColor("#ffffff"),y=b.css.toColor("#000000"),x=b.css.toColor("#ffffff"),_=b.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let I=0;I<216;I++){const z=T[I/36%6|0],V=T[I/6%6|0],Y=T[I%6];R.push({css:b.channels.toCss(z,V,Y),rgba:b.channels.toRgba(z,V,Y)})}for(let I=0;I<24;I++){const z=8+10*I;R.push({css:b.channels.toCss(z,z,z),rgba:b.channels.toRgba(z,z,z)})}return R})());let A=l.ThemeService=class extends k.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:y,cursor:x,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:b.color.blend(y,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:b.color.blend(y,j),ansi:l.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(R={}){const T=this._colors;if(T.foreground=N(R.foreground,v),T.background=N(R.background,y),T.cursor=N(R.cursor,x),T.cursorAccent=N(R.cursorAccent,_),T.selectionBackgroundTransparent=N(R.selectionBackground,j),T.selectionBackgroundOpaque=b.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(R.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=b.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=R.selectionForeground?N(R.selectionForeground,b.NULL_COLOR):void 0,T.selectionForeground===b.NULL_COLOR&&(T.selectionForeground=void 0),b.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=b.color.opacity(T.selectionBackgroundTransparent,.3)),b.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=b.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=l.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(R.black,l.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(R.red,l.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(R.green,l.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(R.yellow,l.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(R.blue,l.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(R.magenta,l.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(R.cyan,l.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(R.white,l.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(R.brightBlack,l.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(R.brightRed,l.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(R.brightGreen,l.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(R.brightYellow,l.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(R.brightBlue,l.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(R.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(R.brightCyan,l.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(R.brightWhite,l.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const I=Math.min(T.ansi.length-16,R.extendedAnsi.length);for(let z=0;z<I;z++)T.ansi[z+16]=N(R.extendedAnsi[z],l.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let T=0;T<this._restoreColors.ansi.length;++T)this._colors.ansi[T]=this._restoreColors.ansi[T]}modifyColors(R){R(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 N(R,T){if(R!==void 0)try{return b.css.toColor(R)}catch{}return T}l.ThemeService=A=f([g(0,C.IOptionsService)],A)},6349:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=d(8460),g=d(844);class m extends g.Disposable{constructor(S){super(),this._maxLength=S,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(S){if(this._maxLength===S)return;const k=new Array(S);for(let C=0;C<Math.min(S,this.length);C++)k[C]=this._array[this._getCyclicIndex(C)];this._array=k,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let k=this._length;k<S;k++)this._array[k]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,k){this._array[this._getCyclicIndex(S)]=k}push(S){this._array[this._getCyclicIndex(this._length)]=S,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(S,k,...C){if(k){for(let v=S;v<this._length-k;v++)this._array[this._getCyclicIndex(v)]=this._array[this._getCyclicIndex(v+k)];this._length-=k,this.onDeleteEmitter.fire({index:S,amount:k})}for(let v=this._length-1;v>=S;v--)this._array[this._getCyclicIndex(v+C.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;v<C.length;v++)this._array[this._getCyclicIndex(S+v)]=C[v];if(C.length&&this.onInsertEmitter.fire({index:S,amount:C.length}),this._length+C.length>this._maxLength){const v=this._length+C.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=C.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,k,C){if(!(k<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let y=k-1;y>=0;y--)this.set(S+y+C,this.get(S+y));const v=S+k+C-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<k;v++)this.set(S+v+C,this.get(S+v))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}l.CircularList=m},1439:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function d(f,g=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const b in f)m[b]=g<=1?f[b]:f[b]&&d(f[b],g-1);return m}},8055:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let d=0,f=0,g=0,m=0;var b,S,k,C,v;function y(_){const j=_.toString(16);return j.length<2?"0"+j:j}function x(_,j){return _<j?(j+.05)/(_+.05):(_+.05)/(j+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(j,A,N,R){return R!==void 0?`#${y(j)}${y(A)}${y(N)}${y(R)}`:`#${y(j)}${y(A)}${y(N)}`},_.toRgba=function(j,A,N,R=255){return(j<<24|A<<16|N<<8|R)>>>0},_.toColor=function(j,A,N,R){return{css:_.toCss(j,A,N,R),rgba:_.toRgba(j,A,N,R)}}})(b||(l.channels=b={})),(function(_){function j(A,N){return m=Math.round(255*N),[d,f,g]=v.toChannels(A.rgba),{css:b.toCss(d,f,g,m),rgba:b.toRgba(d,f,g,m)}}_.blend=function(A,N){if(m=(255&N.rgba)/255,m===1)return{css:N.css,rgba:N.rgba};const R=N.rgba>>24&255,T=N.rgba>>16&255,I=N.rgba>>8&255,z=A.rgba>>24&255,V=A.rgba>>16&255,Y=A.rgba>>8&255;return d=z+Math.round((R-z)*m),f=V+Math.round((T-V)*m),g=Y+Math.round((I-Y)*m),{css:b.toCss(d,f,g),rgba:b.toRgba(d,f,g)}},_.isOpaque=function(A){return(255&A.rgba)==255},_.ensureContrastRatio=function(A,N,R){const T=v.ensureContrastRatio(A.rgba,N.rgba,R);if(T)return b.toColor(T>>24&255,T>>16&255,T>>8&255)},_.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,f,g]=v.toChannels(N),{css:b.toCss(d,f,g),rgba:N}},_.opacity=j,_.multiplyOpacity=function(A,N){return m=255&A.rgba,j(A,m*N/255)},_.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(S||(l.color=S={})),(function(_){let j,A;try{const N=document.createElement("canvas");N.width=1,N.height=1;const R=N.getContext("2d",{willReadFrequently:!0});R&&(j=R,j.globalCompositeOperation="copy",A=j.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return d=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),b.toColor(d,f,g);case 5:return d=parseInt(N.slice(1,2).repeat(2),16),f=parseInt(N.slice(2,3).repeat(2),16),g=parseInt(N.slice(3,4).repeat(2),16),m=parseInt(N.slice(4,5).repeat(2),16),b.toColor(d,f,g,m);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const R=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return d=parseInt(R[1]),f=parseInt(R[2]),g=parseInt(R[3]),m=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),b.toColor(d,f,g,m);if(!j||!A)throw new Error("css.toColor: Unsupported css format");if(j.fillStyle=A,j.fillStyle=N,typeof j.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(j.fillRect(0,0,1,1),[d,f,g,m]=j.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(d,f,g,m),css:N}}})(k||(l.css=k={})),(function(_){function j(A,N,R){const T=A/255,I=N/255,z=R/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}_.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},_.relativeLuminance2=j})(C||(l.rgb=C={})),(function(_){function j(N,R,T){const I=N>>24&255,z=N>>16&255,V=N>>8&255;let Y=R>>24&255,$=R>>16&255,F=R>>8&255,P=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));for(;P<T&&(Y>0||$>0||F>0);)Y-=Math.max(0,Math.ceil(.1*Y)),$-=Math.max(0,Math.ceil(.1*$)),F-=Math.max(0,Math.ceil(.1*F)),P=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));return(Y<<24|$<<16|F<<8|255)>>>0}function A(N,R,T){const I=N>>24&255,z=N>>16&255,V=N>>8&255;let Y=R>>24&255,$=R>>16&255,F=R>>8&255,P=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));for(;P<T&&(Y<255||$<255||F<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),$=Math.min(255,$+Math.ceil(.1*(255-$))),F=Math.min(255,F+Math.ceil(.1*(255-F))),P=x(C.relativeLuminance2(Y,$,F),C.relativeLuminance2(I,z,V));return(Y<<24|$<<16|F<<8|255)>>>0}_.blend=function(N,R){if(m=(255&R)/255,m===1)return R;const T=R>>24&255,I=R>>16&255,z=R>>8&255,V=N>>24&255,Y=N>>16&255,$=N>>8&255;return d=V+Math.round((T-V)*m),f=Y+Math.round((I-Y)*m),g=$+Math.round((z-$)*m),b.toRgba(d,f,g)},_.ensureContrastRatio=function(N,R,T){const I=C.relativeLuminance(N>>8),z=C.relativeLuminance(R>>8);if(x(I,z)<T){if(z<I){const $=j(N,R,T),F=x(I,C.relativeLuminance($>>8));if(F<T){const P=A(N,R,T);return F>x(I,C.relativeLuminance(P>>8))?$:P}return $}const V=A(N,R,T),Y=x(I,C.relativeLuminance(V>>8));if(Y<T){const $=j(N,R,T);return Y>x(I,C.relativeLuminance($>>8))?V:$}return V}},_.reduceLuminance=j,_.increaseLuminance=A,_.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(l.rgba=v={})),l.toPaddedHex=y,l.contrastRatio=x},8969:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=d(844),g=d(2585),m=d(4348),b=d(7866),S=d(744),k=d(7302),C=d(6975),v=d(8460),y=d(1753),x=d(1480),_=d(7994),j=d(9282),A=d(5435),N=d(5981),R=d(2660);let T=!1;class I extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((V=>{var Y;(Y=this._onScrollApi)==null||Y.fire(V.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(V){for(const Y in V)this.optionsService.options[Y]=V[Y]}constructor(V){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 k.OptionsService(V)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(S.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.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((Y=>{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((Y=>{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 N.WriteBuffer(((Y,$)=>this._inputHandler.parse(Y,$)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(V,Y){this._writeBuffer.write(V,Y)}writeSync(V,Y){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(V,Y)}input(V,Y=!0){this.coreService.triggerDataEvent(V,Y)}resize(V,Y){isNaN(V)||isNaN(Y)||(V=Math.max(V,S.MINIMUM_COLS),Y=Math.max(Y,S.MINIMUM_ROWS),this._bufferService.resize(V,Y))}scroll(V,Y=!1){this._bufferService.scroll(V,Y)}scrollLines(V,Y,$){this._bufferService.scrollLines(V,Y,$)}scrollPages(V){this.scrollLines(V*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(V){const Y=V-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(V,Y){return this._inputHandler.registerEscHandler(V,Y)}registerDcsHandler(V,Y){return this._inputHandler.registerDcsHandler(V,Y)}registerCsiHandler(V,Y){return this._inputHandler.registerCsiHandler(V,Y)}registerOscHandler(V,Y){return this._inputHandler.registerOscHandler(V,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let V=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?V=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(V=!0),V?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const V=[];V.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),V.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of V)Y.dispose()}))}}}l.CoreTerminal=I},8460:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.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 g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(d,f){return d((g=>f.fire(g)))},l.runAndSubscribe=function(d,f){return f(void 0),d((g=>f(g)))}},5435:function(p,l,d){var f=this&&this.__decorate||function(Q,O,D,L){var q,U=arguments.length,K=U<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,D):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(Q,O,D,L);else for(var ee=Q.length-1;ee>=0;ee--)(q=Q[ee])&&(K=(U<3?q(K):U>3?q(O,D,K):q(O,D))||K);return U>3&&K&&Object.defineProperty(O,D,K),K},g=this&&this.__param||function(Q,O){return function(D,L){O(D,L,Q)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=d(2584),b=d(7116),S=d(2015),k=d(844),C=d(482),v=d(8437),y=d(8460),x=d(643),_=d(511),j=d(3734),A=d(2585),N=d(1480),R=d(6242),T=d(6351),I=d(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},V=131072;function Y(Q,O){if(Q>24)return O.setWinLines||!1;switch(Q){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var $;(function(Q){Q[Q.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Q[Q.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(l.WindowsOptionsReportType=$={}));let F=0;class P extends k.Disposable{getAttrData(){return this._curAttrData}constructor(O,D,L,q,U,K,ee,ne,Z=new S.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=D,this._coreService=L,this._logService=q,this._optionsService=U,this._oscLinkService=K,this._coreMouseService=ee,this._unicodeService=ne,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new _.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 y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.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 B(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((W=>this._activeBuffer=W.activeBuffer))),this._parser.setCsiHandlerFallback(((W,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(W),params:ae.toArray()})})),this._parser.setEscHandlerFallback((W=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(W)})})),this._parser.setExecuteHandlerFallback((W=>{this._logService.debug("Unknown EXECUTE code: ",{code:W})})),this._parser.setOscHandlerFallback(((W,ae,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:W,action:ae,data:se})})),this._parser.setDcsHandlerFallback(((W,ae,se)=>{ae==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(W),action:ae,payload:se})})),this._parser.setPrintHandler(((W,ae,se)=>this.print(W,ae,se))),this._parser.registerCsiHandler({final:"@"},(W=>this.insertChars(W))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(W=>this.scrollLeft(W))),this._parser.registerCsiHandler({final:"A"},(W=>this.cursorUp(W))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(W=>this.scrollRight(W))),this._parser.registerCsiHandler({final:"B"},(W=>this.cursorDown(W))),this._parser.registerCsiHandler({final:"C"},(W=>this.cursorForward(W))),this._parser.registerCsiHandler({final:"D"},(W=>this.cursorBackward(W))),this._parser.registerCsiHandler({final:"E"},(W=>this.cursorNextLine(W))),this._parser.registerCsiHandler({final:"F"},(W=>this.cursorPrecedingLine(W))),this._parser.registerCsiHandler({final:"G"},(W=>this.cursorCharAbsolute(W))),this._parser.registerCsiHandler({final:"H"},(W=>this.cursorPosition(W))),this._parser.registerCsiHandler({final:"I"},(W=>this.cursorForwardTab(W))),this._parser.registerCsiHandler({final:"J"},(W=>this.eraseInDisplay(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(W=>this.eraseInDisplay(W,!0))),this._parser.registerCsiHandler({final:"K"},(W=>this.eraseInLine(W,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(W=>this.eraseInLine(W,!0))),this._parser.registerCsiHandler({final:"L"},(W=>this.insertLines(W))),this._parser.registerCsiHandler({final:"M"},(W=>this.deleteLines(W))),this._parser.registerCsiHandler({final:"P"},(W=>this.deleteChars(W))),this._parser.registerCsiHandler({final:"S"},(W=>this.scrollUp(W))),this._parser.registerCsiHandler({final:"T"},(W=>this.scrollDown(W))),this._parser.registerCsiHandler({final:"X"},(W=>this.eraseChars(W))),this._parser.registerCsiHandler({final:"Z"},(W=>this.cursorBackwardTab(W))),this._parser.registerCsiHandler({final:"`"},(W=>this.charPosAbsolute(W))),this._parser.registerCsiHandler({final:"a"},(W=>this.hPositionRelative(W))),this._parser.registerCsiHandler({final:"b"},(W=>this.repeatPrecedingCharacter(W))),this._parser.registerCsiHandler({final:"c"},(W=>this.sendDeviceAttributesPrimary(W))),this._parser.registerCsiHandler({prefix:">",final:"c"},(W=>this.sendDeviceAttributesSecondary(W))),this._parser.registerCsiHandler({final:"d"},(W=>this.linePosAbsolute(W))),this._parser.registerCsiHandler({final:"e"},(W=>this.vPositionRelative(W))),this._parser.registerCsiHandler({final:"f"},(W=>this.hVPosition(W))),this._parser.registerCsiHandler({final:"g"},(W=>this.tabClear(W))),this._parser.registerCsiHandler({final:"h"},(W=>this.setMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(W=>this.setModePrivate(W))),this._parser.registerCsiHandler({final:"l"},(W=>this.resetMode(W))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(W=>this.resetModePrivate(W))),this._parser.registerCsiHandler({final:"m"},(W=>this.charAttributes(W))),this._parser.registerCsiHandler({final:"n"},(W=>this.deviceStatus(W))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(W=>this.deviceStatusPrivate(W))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(W=>this.softReset(W))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(W=>this.setCursorStyle(W))),this._parser.registerCsiHandler({final:"r"},(W=>this.setScrollRegion(W))),this._parser.registerCsiHandler({final:"s"},(W=>this.saveCursor(W))),this._parser.registerCsiHandler({final:"t"},(W=>this.windowOptions(W))),this._parser.registerCsiHandler({final:"u"},(W=>this.restoreCursor(W))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(W=>this.insertColumns(W))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(W=>this.deleteColumns(W))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(W=>this.selectProtected(W))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(W=>this.requestMode(W,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(W=>this.requestMode(W,!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 R.OscHandler((W=>(this.setTitle(W),this.setIconName(W),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((W=>this.setIconName(W)))),this._parser.registerOscHandler(2,new R.OscHandler((W=>this.setTitle(W)))),this._parser.registerOscHandler(4,new R.OscHandler((W=>this.setOrReportIndexedColor(W)))),this._parser.registerOscHandler(8,new R.OscHandler((W=>this.setHyperlink(W)))),this._parser.registerOscHandler(10,new R.OscHandler((W=>this.setOrReportFgColor(W)))),this._parser.registerOscHandler(11,new R.OscHandler((W=>this.setOrReportBgColor(W)))),this._parser.registerOscHandler(12,new R.OscHandler((W=>this.setOrReportCursorColor(W)))),this._parser.registerOscHandler(104,new R.OscHandler((W=>this.restoreIndexedColor(W)))),this._parser.registerOscHandler(110,new R.OscHandler((W=>this.restoreFgColor(W)))),this._parser.registerOscHandler(111,new R.OscHandler((W=>this.restoreBgColor(W)))),this._parser.registerOscHandler(112,new R.OscHandler((W=>this.restoreCursorColor(W)))),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 W in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:W},(()=>this.selectCharset("("+W))),this._parser.registerEscHandler({intermediates:")",final:W},(()=>this.selectCharset(")"+W))),this._parser.registerEscHandler({intermediates:"*",final:W},(()=>this.selectCharset("*"+W))),this._parser.registerEscHandler({intermediates:"+",final:W},(()=>this.selectCharset("+"+W))),this._parser.registerEscHandler({intermediates:"-",final:W},(()=>this.selectCharset("-"+W))),this._parser.registerEscHandler({intermediates:".",final:W},(()=>this.selectCharset("."+W))),this._parser.registerEscHandler({intermediates:"/",final:W},(()=>this.selectCharset("/"+W)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((W=>(this._logService.error("Parsing error: ",W),W))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((W,ae)=>this.requestStatusString(W,ae))))}_preserveStack(O,D,L,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=L,this._parseStack.position=q}_logSlowResolvingAsync(O){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([O,new Promise(((D,L)=>setTimeout((()=>L("#SLOW_TIMEOUT")),5e3)))]).catch((D=>{if(D!=="#SLOW_TIMEOUT")throw D;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,D){let L,q=this._activeBuffer.x,U=this._activeBuffer.y,K=0;const ee=this._parseStack.paused;if(ee){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(L),L;q=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>V&&(K=this._parseStack.position+V)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(W=>String.fromCharCode(W))).join("")}"`),typeof O=="string"?O.split("").map((W=>W.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<V&&(this._parseBuffer=new Uint32Array(Math.min(O.length,V))),ee||this._dirtyRowTracker.clearRange(),O.length>V)for(let W=K;W<O.length;W+=V){const ae=W+V<O.length?W+V:O.length,se=typeof O=="string"?this._stringDecoder.decode(O.substring(W,ae),this._parseBuffer):this._utf8Decoder.decode(O.subarray(W,ae),this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,se))return this._preserveStack(q,U,se,W),this._logSlowResolvingAsync(L),L}else if(!ee){const W=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(L=this._parser.parse(this._parseBuffer,W))return this._preserveStack(q,U,W,0),this._logSlowResolvingAsync(L),L}this._activeBuffer.x===q&&this._activeBuffer.y===U||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Z,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(O,D,L){let q,U;const K=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,Z=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,ae=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&L-D>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let pe=this._parser.precedingJoinState;for(let be=D;be<L;++be){if(q=O[be],q<127&&K){const Ue=K[String.fromCharCode(q)];Ue&&(q=Ue.charCodeAt(0))}const je=this._unicodeService.charProperties(q,pe);U=N.UnicodeService.extractWidth(je);const Ne=N.UnicodeService.extractShouldJoin(je),Le=Ne?N.UnicodeService.extractWidth(pe):0;if(pe=je,ee&&this._onA11yChar.fire((0,C.stringFromCodePoint)(q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+U-Le>ne){if(Z){const Ue=se;let we=this._activeBuffer.x-Le;for(this._activeBuffer.x=Le,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),Le>0&&se instanceof v.BufferLine&&se.copyCellsFrom(Ue,we,0,Le,!1);we<ne;)Ue.setCellFromCodepoint(we++,0,1,ae)}else if(this._activeBuffer.x=ne-1,U===2)continue}if(Ne&&this._activeBuffer.x){const Ue=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-Ue,q,U);for(let we=U-Le;--we>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(W&&(se.insertCells(this._activeBuffer.x,U-Le,this._activeBuffer.getNullCell(ae)),se.getWidth(ne-1)===2&&se.setCellFromCodepoint(ne-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ae)),se.setCellFromCodepoint(this._activeBuffer.x++,q,U,ae),U>0)for(;--U;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=pe,this._activeBuffer.x<ne&&L-D>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,D){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,D):this._parser.registerCsiHandler(O,(L=>!Y(L.params[0],this._optionsService.rawOptions.windowOptions)||D(L)))}registerDcsHandler(O,D){return this._parser.registerDcsHandler(O,new T.DcsHandler(D))}registerEscHandler(O,D){return this._parser.registerEscHandler(O,D)}registerOscHandler(O,D){return this._parser.registerOscHandler(O,new R.OscHandler(D))}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 O;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&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);D.hasWidth(this._activeBuffer.x)&&!D.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=O,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+D)}cursorUp(O){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const D=O.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=O.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=O.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const D=O.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,D,L,q=!1,U=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);K.replaceCells(D,L,this._activeBuffer.getNullCell(this._eraseAttrData()),U),q&&(K.isWrapped=!1)}_resetBufferLine(O,D=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);L&&(L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),L.isWrapped=!1)}eraseInDisplay(O,D=!1){let L;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);L<this._bufferService.rows;L++)this._resetBufferLine(L,D);this._dirtyRowTracker.markDirty(L);break;case 1:for(L=this._activeBuffer.y,this._dirtyRowTracker.markDirty(L),this._eraseInBufferLine(L,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowTracker.markDirty(L-1);L--;)this._resetBufferLine(L,D);this._dirtyRowTracker.markDirty(0);break;case 3:const q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(O,D=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,D);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,D)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let D=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y,q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-q+1;for(;D--;)this._activeBuffer.lines.splice(U-1,1),this._activeBuffer.lines.splice(L,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let D=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=this._activeBuffer.ybase+this._activeBuffer.y;let q;for(q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-q;D--;)this._activeBuffer.lines.splice(L,1),this._activeBuffer.lines.splice(q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let D=O.params[0]||1;for(;D--;)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(O){let D=O.params[0]||1;for(;D--;)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(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=O.params[0]||1;for(let L=this._activeBuffer.scrollTop;L<=this._activeBuffer.scrollBottom;++L){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);q.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const D=this._parser.precedingJoinState;if(!D)return!0;const L=O.params[0]||1,q=N.UnicodeService.extractWidth(D),U=this._activeBuffer.x-q,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(U),ee=new Uint32Array(K.length*L);let ne=0;for(let W=0;W<K.length;){const ae=K.codePointAt(W)||0;ee[ne++]=ae,W+=ae>65535?2:1}let Z=ne;for(let W=1;W<L;++W)ee.copyWithin(Z,0,ne),Z+=ne;return this.print(ee,0,Z),!0}sendDeviceAttributesPrimary(O){return O.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(O){return O.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(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let D=0;D<O.length;D++)switch(O.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let D=0;D<O.length;D++)switch(O.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.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(O){for(let D=0;D<O.length;D++)switch(O.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let D=0;D<O.length;D++)switch(O.params[D]){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(),O.params[D]===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(O,D){const L=this._coreService.decPrivateModes,{activeProtocol:q,activeEncoding:U}=this._coreMouseService,K=this._coreService,{buffers:ee,cols:ne}=this._bufferService,{active:Z,alt:W}=ee,ae=this._optionsService.rawOptions,se=Ne=>Ne?1:2,pe=O.params[0];return be=pe,je=D?pe===2?4:pe===4?se(K.modes.insertMode):pe===12?3:pe===20?se(ae.convertEol):0:pe===1?se(L.applicationCursorKeys):pe===3?ae.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:pe===6?se(L.origin):pe===7?se(L.wraparound):pe===8?3:pe===9?se(q==="X10"):pe===12?se(ae.cursorBlink):pe===25?se(!K.isCursorHidden):pe===45?se(L.reverseWraparound):pe===66?se(L.applicationKeypad):pe===67?4:pe===1e3?se(q==="VT200"):pe===1002?se(q==="DRAG"):pe===1003?se(q==="ANY"):pe===1004?se(L.sendFocus):pe===1005?4:pe===1006?se(U==="SGR"):pe===1015?4:pe===1016?se(U==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?se(Z===W):pe===2004?se(L.bracketedPasteMode):0,K.triggerDataEvent(`${m.C0.ESC}[${D?"":"?"}${be};${je}$y`),!0;var be,je}_updateAttrColor(O,D,L,q,U){return D===2?(O|=50331648,O&=-16777216,O|=j.AttributeData.fromColorRGB([L,q,U])):D===5&&(O&=-50331904,O|=33554432|255&L),O}_extractColor(O,D,L){const q=[0,0,-1,0,0,0];let U=0,K=0;do{if(q[K+U]=O.params[D+K],O.hasSubParams(D+K)){const ee=O.getSubParams(D+K);let ne=0;do q[1]===5&&(U=1),q[K+ne+1+U]=ee[ne];while(++ne<ee.length&&ne+K+1+U<q.length);break}if(q[1]===5&&K+U>=2||q[1]===2&&K+U>=5)break;q[1]&&(U=1)}while(++K+D<O.length&&K+U<q.length);for(let ee=2;ee<q.length;++ee)q[ee]===-1&&(q[ee]=0);switch(q[0]){case 38:L.fg=this._updateAttrColor(L.fg,q[1],q[3],q[4],q[5]);break;case 48:L.bg=this._updateAttrColor(L.bg,q[1],q[3],q[4],q[5]);break;case 58:L.extended=L.extended.clone(),L.extended.underlineColor=this._updateAttrColor(L.extended.underlineColor,q[1],q[3],q[4],q[5])}return K}_processUnderline(O,D){D.extended=D.extended.clone(),(!~O||O>5)&&(O=1),D.extended.underlineStyle=O,D.fg|=268435456,O===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(O){O.fg=v.DEFAULT_ATTR_DATA.fg,O.bg=v.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=O.length;let L;const q=this._curAttrData;for(let U=0;U<D;U++)L=O.params[U],L>=30&&L<=37?(q.fg&=-50331904,q.fg|=16777216|L-30):L>=40&&L<=47?(q.bg&=-50331904,q.bg|=16777216|L-40):L>=90&&L<=97?(q.fg&=-50331904,q.fg|=16777224|L-90):L>=100&&L<=107?(q.bg&=-50331904,q.bg|=16777224|L-100):L===0?this._processSGR0(q):L===1?q.fg|=134217728:L===3?q.bg|=67108864:L===4?(q.fg|=268435456,this._processUnderline(O.hasSubParams(U)?O.getSubParams(U)[0]:1,q)):L===5?q.fg|=536870912:L===7?q.fg|=67108864:L===8?q.fg|=1073741824:L===9?q.fg|=2147483648:L===2?q.bg|=134217728:L===21?this._processUnderline(2,q):L===22?(q.fg&=-134217729,q.bg&=-134217729):L===23?q.bg&=-67108865:L===24?(q.fg&=-268435457,this._processUnderline(0,q)):L===25?q.fg&=-536870913:L===27?q.fg&=-67108865:L===28?q.fg&=-1073741825:L===29?q.fg&=2147483647:L===39?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):L===49?(q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?U+=this._extractColor(O,U,q):L===53?q.bg|=1073741824:L===55?q.bg&=-1073741825:L===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):L===100?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${D};${L}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const D=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${D};${L}R`)}return!0}softReset(O){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(O){const D=O.params[0]||1;switch(D){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 L=D%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(O){const D=O.params[0]||1;let L;return(O.length<2||(L=O.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(O){if(!Y(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire($.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire($.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:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const D=[],L=O.split(";");for(;L.length>1;){const q=L.shift(),U=L.shift();if(/^\d+$/.exec(q)){const K=parseInt(q);if(X(K))if(U==="?")D.push({type:0,index:K});else{const ee=(0,I.parseColor)(U);ee&&D.push({type:1,index:K,color:ee})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(O){const D=O.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(O,D){this._getCurrentLinkId()&&this._finishHyperlink();const L=O.split(":");let q;const U=L.findIndex((K=>K.startsWith("id=")));return U!==-1&&(q=L[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:D}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,D){const L=O.split(";");for(let q=0;q<L.length&&!(D>=this._specialColors.length);++q,++D)if(L[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const U=(0,I.parseColor)(L[q]);U&&this._onColor.fire([{type:1,index:this._specialColors[D],color:U}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const D=[],L=O.split(";");for(let q=0;q<L.length;++q)if(/^\d+$/.exec(L[q])){const U=parseInt(L[q]);X(U)&&D.push({type:2,index:U})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){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,b.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(z[O[0]],b.CHARSETS[O[1]]||b.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 O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new _.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const L=this._activeBuffer.ybase+this._activeBuffer.y+D,q=this._activeBuffer.lines.get(L);q&&(q.fill(O),q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,D){const L=this._bufferService.buffer,q=this._optionsService.rawOptions;return(U=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${U}${m.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,D){this._dirtyRowTracker.markRangeDirty(O,D)}}l.InputHandler=P;let B=class{constructor(Q){this._bufferService=Q,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Q){Q<this.start?this.start=Q:Q>this.end&&(this.end=Q)}markRangeDirty(Q,O){Q>O&&(F=Q,Q=O,O=F),Q<this.start&&(this.start=Q),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(Q){return 0<=Q&&Q<256}B=f([g(0,A.IBufferService)],B)},844:(p,l)=>{function d(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.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 g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.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}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=d,l.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,m,b){this._data[g]||(this._data[g]={}),this._data[g][m]=b}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=d,l.FourKeyMap=class{constructor(){this._data=new d}set(f,g,m,b,S){this._data.get(f,g)||this._data.set(f,g,new d),this._data.get(f,g).set(m,b,S)}get(f,g,m,b){var S;return(S=this._data.get(f,g))==null?void 0:S.get(m,b)}clear(){this._data.clear()}}},6114:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const d=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=d.includes("Firefox"),l.isLegacyEdge=d.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(d),l.getSafariVersion=function(){if(!l.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(d)},6106:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let d=0;l.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 g=this._getKey(f);if(g===void 0||(d=this._search(g),d===-1)||this._getKey(this._array[d])!==g)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])===g);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,g){if(this._array.length!==0&&(d=this._search(f),!(d<0||d>=this._array.length)&&this._getKey(this._array[d])===f))do g(this._array[d]);while(++d<this._array.length&&this._getKey(this._array[d])===f)}values(){return[...this._array].values()}_search(f){let g=0,m=this._array.length-1;for(;m>=g;){let b=g+m>>1;const S=this._getKey(this._array[b]);if(S>f)m=b-1;else{if(!(S<f)){for(;b>0&&this._getKey(this._array[b-1])===f;)b--;return b}g=b+1}}return g}}},7226:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=d(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(S){this._tasks.push(S),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(S){this._idleCallback=void 0;let k=0,C=0,v=S.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(k=Date.now(),this._tasks[this._i]()||this._i++,k=Math.max(1,Date.now()-k),C=Math.max(k,C),y=S.timeRemaining(),1.5*C>y)return v-k<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-k))}ms`),void this._start();v=y}this.clear()}}class m extends g{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const k=Date.now()+S;return{timeRemaining:()=>Math.max(0,k-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=d(643);l.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),b=m==null?void 0:m.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&b&&(S.isWrapped=b[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&b[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.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}}l.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,b=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=b}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=d(6349),g=d(7226),m=d(3734),b=d(8437),S=d(4634),k=d(511),C=d(643),v=d(4863),y=d(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,_,j){this._hasScrollback=x,this._optionsService=_,this._bufferService=j,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=k.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=k.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.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(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,_){return new b.BufferLine(this._bufferService.cols,this.getNullCell(x),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&x<this._rows}_getCorrectBufferLength(x){if(!this._hasScrollback)return x;const _=x+this._optionsService.rawOptions.scrollback;return _>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:_}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=b.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(x))}}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(x,_){const j=this.getNullCell(b.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(_);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols<x)for(let T=0;T<this.lines.length;T++)A+=+this.lines.get(T).resize(x,j);let R=0;if(this._rows<_)for(let T=this._rows;T<_;T++)this.lines.length<_+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(x,j)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(x,j)));else for(let T=this._rows;T>_;T--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N<this.lines.maxLength){const T=this.lines.length-N;T>0&&(this.lines.trimStart(T),this.ybase=Math.max(this.ybase-T,0),this.ydisp=Math.max(this.ydisp-T,0),this.savedY=Math.max(this.savedY-T,0)),this.lines.maxLength=N}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,_-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(x,_),this._cols>x))for(let R=0;R<this.lines.length;R++)A+=+this.lines.get(R).resize(x,j);this._cols=x,this._rows=_,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,_){this._cols!==x&&(x>this._cols?this._reflowLarger(x,_):this._reflowSmaller(x,_))}_reflowLarger(x,_){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(j.length>0){const A=(0,S.reflowLargerCreateNewLayout)(this.lines,j);(0,S.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(x,_,A.countRemoved)}}_reflowLargerAdjustViewport(x,_,j){const A=this.getNullCell(b.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new b.BufferLine(x,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,_){const j=this.getNullCell(b.DEFAULT_ATTR_DATA),A=[];let N=0;for(let R=this.lines.length-1;R>=0;R--){let T=this.lines.get(R);if(!T||!T.isWrapped&&T.getTrimmedLength()<=x)continue;const I=[T];for(;T.isWrapped&&R>0;)T=this.lines.get(--R),I.unshift(T);const z=this.ybase+this.y;if(z>=R&&z<R+I.length)continue;const V=I[I.length-1].getTrimmedLength(),Y=(0,S.reflowSmallerGetNewLineLengths)(I,this._cols,x),$=Y.length-I.length;let F;F=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+$):Math.max(0,this.lines.length-this.lines.maxLength+$);const P=[];for(let L=0;L<$;L++){const q=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);P.push(q)}P.length>0&&(A.push({start:R+I.length+N,newLines:P}),N+=P.length),I.push(...P);let B=Y.length-1,X=Y[B];X===0&&(B--,X=Y[B]);let Q=I.length-$-1,O=V;for(;Q>=0;){const L=Math.min(O,X);if(I[B]===void 0)break;if(I[B].copyCellsFrom(I[Q],O-L,X-L,L,!0),X-=L,X===0&&(B--,X=Y[B]),O-=L,O===0){Q--;const q=Math.max(Q,0);O=(0,S.getWrappedLineTrimmedLength)(I,q,this._cols)}}for(let L=0;L<I.length;L++)Y[L]<x&&I[L].setCell(Y[L],j);let D=$-F;for(;D-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+$,this.ybase+_-1)}if(A.length>0){const R=[],T=[];for(let B=0;B<this.lines.length;B++)T.push(this.lines.get(B));const I=this.lines.length;let z=I-1,V=0,Y=A[V];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let $=0;for(let B=Math.min(this.lines.maxLength-1,I+N-1);B>=0;B--)if(Y&&Y.start>z+$){for(let X=Y.newLines.length-1;X>=0;X--)this.lines.set(B--,Y.newLines[X]);B++,R.push({index:z+1,amount:Y.newLines.length}),$+=Y.newLines.length,Y=A[++V]}else this.lines.set(B,T[z--]);let F=0;for(let B=R.length-1;B>=0;B--)R[B].index+=F,this.lines.onInsertEmitter.fire(R[B]),F+=R[B].amount;const P=Math.max(0,I+N-this.lines.maxLength);P>0&&this.lines.onTrimEmitter.fire(P)}}translateBufferLineToString(x,_,j=0,A){const N=this.lines.get(x);return N?N.translateToString(_,j,A):""}getWrappedRangeForLine(x){let _=x,j=x;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:_,last:j}}setupTabStops(x){for(x!=null?this.tabs[x]||(x=this.prevStop(x)):(this.tabs={},x=0);x<this._cols;x+=this._optionsService.rawOptions.tabStopWidth)this.tabs[x]=!0}prevStop(x){for(x==null&&(x=this.x);!this.tabs[--x]&&x>0;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x<this._cols;);return x>=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===x&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].dispose(),this.markers.splice(x--,1);this._isClearing=!1}addMarker(x){const _=new v.Marker(x);return this.markers.push(_),_.register(this.lines.onTrim((j=>{_.line-=j,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((j=>{_.line>=j.index&&(_.line+=j.amount)}))),_.register(this.lines.onDelete((j=>{_.line>=j.index&&_.line<j.index+j.amount&&_.dispose(),_.line>j.index&&(_.line-=j.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=d(3734),g=d(511),m=d(643),b=d(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let S=0;class k{constructor(v,y,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const _=y||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let j=0;j<v;++j)this.setCell(j,_);this.length=v}get(v){const y=this._data[3*v+0],x=2097151&y;return[this._data[3*v+1],2097152&y?this._combined[v]:x?(0,b.stringFromCodePoint)(x):"",y>>22,2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):x]}set(v,y){this._data[3*v+1]=y[m.CHAR_DATA_ATTR_INDEX],y[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=y[1],this._data[3*v+0]=2097152|v|y[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=y[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[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 y=this._data[3*v+0];return 2097152&y?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&y}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const y=this._data[3*v+0];return 2097152&y?this._combined[v]:2097151&y?(0,b.stringFromCodePoint)(2097151&y):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,y){return S=3*v,y.content=this._data[S+0],y.fg=this._data[S+1],y.bg=this._data[S+2],2097152&y.content&&(y.combinedData=this._combined[v]),268435456&y.bg&&(y.extended=this._extendedAttrs[v]),y}setCell(v,y){2097152&y.content&&(this._combined[v]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=y.content,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}setCellFromCodepoint(v,y,x,_){268435456&_.bg&&(this._extendedAttrs[v]=_.extended),this._data[3*v+0]=y|x<<22,this._data[3*v+1]=_.fg,this._data[3*v+2]=_.bg}addCodepointToCell(v,y,x){let _=this._data[3*v+0];2097152&_?this._combined[v]+=(0,b.stringFromCodePoint)(y):2097151&_?(this._combined[v]=(0,b.stringFromCodePoint)(2097151&_)+(0,b.stringFromCodePoint)(y),_&=-2097152,_|=2097152):_=y|4194304,x&&(_&=-12582913,_|=x<<22),this._data[3*v+0]=_}insertCells(v,y,x){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),y<this.length-v){const _=new g.CellData;for(let j=this.length-v-y-1;j>=0;--j)this.setCell(v+y+j,this.loadCell(v+j,_));for(let j=0;j<y;++j)this.setCell(v+j,x)}else for(let _=v;_<this.length;++_)this.setCell(_,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(v,y,x){if(v%=this.length,y<this.length-v){const _=new g.CellData;for(let j=0;j<this.length-v-y;++j)this.setCell(v+j,this.loadCell(v+y+j,_));for(let j=this.length-y;j<this.length;++j)this.setCell(j,x)}else for(let _=v;_<this.length;++_)this.setCell(_,x);v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),this.getWidth(v)!==0||this.hasContent(v)||this.setCellFromCodepoint(v,0,1,x)}replaceCells(v,y,x,_=!1){if(_)for(v&&this.getWidth(v-1)===2&&!this.isProtected(v-1)&&this.setCellFromCodepoint(v-1,0,1,x),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,x);v<y&&v<this.length;)this.isProtected(v)||this.setCell(v,x),v++;else for(v&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,x),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,x);v<y&&v<this.length;)this.setCell(v++,x)}resize(v,y){if(v===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*v;if(v>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const _=new Uint32Array(x);_.set(this._data),this._data=_}for(let _=this.length;_<v;++_)this.setCell(_,y)}else{this._data=this._data.subarray(0,x);const _=Object.keys(this._combined);for(let A=0;A<_.length;A++){const N=parseInt(_[A],10);N>=v&&delete this._combined[N]}const j=Object.keys(this._extendedAttrs);for(let A=0;A<j.length;A++){const N=parseInt(j[A],10);N>=v&&delete this._extendedAttrs[N]}}return this.length=v,4*x*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,y=!1){if(y)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,v);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,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 y in v._combined)this._combined[y]=v._combined[y];this._extendedAttrs={};for(const y in v._extendedAttrs)this._extendedAttrs[y]=v._extendedAttrs[y];this.isWrapped=v.isWrapped}clone(){const v=new k(0);v._data=new Uint32Array(this._data),v.length=this.length;for(const y in this._combined)v._combined[y]=this._combined[y];for(const y in this._extendedAttrs)v._extendedAttrs[y]=this._extendedAttrs[y];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,y,x,_,j){const A=v._data;if(j)for(let R=_-1;R>=0;R--){for(let T=0;T<3;T++)this._data[3*(x+R)+T]=A[3*(y+R)+T];268435456&A[3*(y+R)+2]&&(this._extendedAttrs[x+R]=v._extendedAttrs[y+R])}else for(let R=0;R<_;R++){for(let T=0;T<3;T++)this._data[3*(x+R)+T]=A[3*(y+R)+T];268435456&A[3*(y+R)+2]&&(this._extendedAttrs[x+R]=v._extendedAttrs[y+R])}const N=Object.keys(v._combined);for(let R=0;R<N.length;R++){const T=parseInt(N[R],10);T>=y&&(this._combined[T-y+x]=v._combined[T])}}translateToString(v,y,x,_){y=y??0,x=x??this.length,v&&(x=Math.min(x,this.getTrimmedLength())),_&&(_.length=0);let j="";for(;y<x;){const A=this._data[3*y+0],N=2097151&A,R=2097152&A?this._combined[y]:N?(0,b.stringFromCodePoint)(N):m.WHITESPACE_CELL_CHAR;if(j+=R,_)for(let T=0;T<R.length;++T)_.push(y);y+=A>>22||1}return _&&_.push(y),j}}l.BufferLine=k},4841:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.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:(p,l)=>{function d(f,g,m){if(g===f.length-1)return f[g].getTrimmedLength();const b=!f[g].hasContent(m-1)&&f[g].getWidth(m-1)===1,S=f[g+1].getWidth(0)===2;return b&&S?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,g,m,b,S){const k=[];for(let C=0;C<f.length-1;C++){let v=C,y=f.get(++v);if(!y.isWrapped)continue;const x=[f.get(C)];for(;v<f.length&&y.isWrapped;)x.push(y),y=f.get(++v);if(b>=C&&b<v){C+=x.length-1;continue}let _=0,j=d(x,_,g),A=1,N=0;for(;A<x.length;){const T=d(x,A,g),I=T-N,z=m-j,V=Math.min(I,z);x[_].copyCellsFrom(x[A],N,j,V,!1),j+=V,j===m&&(_++,j=0),N+=V,N===T&&(A++,N=0),j===0&&_!==0&&x[_-1].getWidth(m-1)===2&&(x[_].copyCellsFrom(x[_-1],m-1,j++,1,!1),x[_-1].setCell(m-1,S))}x[_].replaceCells(j,m,S);let R=0;for(let T=x.length-1;T>0&&(T>_||x[T].getTrimmedLength()===0);T--)R++;R>0&&(k.push(C+x.length-R),k.push(R)),C+=x.length-1}return k},l.reflowLargerCreateNewLayout=function(f,g){const m=[];let b=0,S=g[b],k=0;for(let C=0;C<f.length;C++)if(S===C){const v=g[++b];f.onDeleteEmitter.fire({index:C-k,amount:v}),C+=v-1,k+=v,S=g[++b]}else m.push(C);return{layout:m,countRemoved:k}},l.reflowLargerApplyNewLayout=function(f,g){const m=[];for(let b=0;b<g.length;b++)m.push(f.get(g[b]));for(let b=0;b<m.length;b++)f.set(b,m[b]);f.length=g.length},l.reflowSmallerGetNewLineLengths=function(f,g,m){const b=[],S=f.map(((y,x)=>d(f,x,g))).reduce(((y,x)=>y+x));let k=0,C=0,v=0;for(;v<S;){if(S-v<m){b.push(S-v);break}k+=m;const y=d(f,C,g);k>y&&(k-=y,C++);const x=f[C].getWidth(k-1)===2;x&&k--;const _=x?m-1:m;b.push(_),v+=_}return b},l.getWrappedLineTrimmedLength=d},5295:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=d(8460),g=d(844),m=d(9092);class b extends g.Disposable{constructor(k,C){super(),this._optionsService=k,this._bufferService=C,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(k){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(k),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(k,C){this._normal.resize(k,C),this._alt.resize(k,C),this.setupTabStops(k)}setupTabStops(k){this._normal.setupTabStops(k),this._alt.setupTabStops(k)}}l.BufferSet=b},511:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=d(482),g=d(643),m=d(3734);class b extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(k){const C=new b;return C.setFromCharData(k),C}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(k){this.fg=k[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(k[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(k[g.CHAR_DATA_CHAR_INDEX].length===2){const v=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const y=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(v-55296)+y-56320+65536|k[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=k[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|k[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=k[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|k[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=b},643:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=d(8460),g=d(844);class m{get id(){return this._id}constructor(S){this.line=S,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,g.disposeArray)(this._disposables),this._disposables.length=0)}register(S){return this._disposables.push(S),S}}l.Marker=m,m._nextId=1},7116:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.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:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(p,l)=>{var d,f,g;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.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=`
64
- `,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||(l.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||(l.C1=f={})),(function(m){m.ST=`${d.ESC}\\`})(g||(l.C1_ESCAPED=g={}))},7399:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=d(2584),g={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:["'",'"']};l.evaluateKeyboardEvent=function(m,b,S,k){const C={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"?C.key=b?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?C.key=b?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?C.key=b?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(C.key=b?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(m.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,m.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(m.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(S?"b":"[1;5D"))):C.key=b?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(S?"f":"[1;5C"))):C.key=b?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"A",S||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=b?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;v?(C.key=f.C0.ESC+"[1;"+(v+1)+"B",S||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=b?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=v?f.C0.ESC+"[3;"+(v+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=v?f.C0.ESC+"[1;"+(v+1)+"H":b?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=v?f.C0.ESC+"[1;"+(v+1)+"F":b?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?C.type=2:m.ctrlKey?C.key=f.C0.ESC+"[5;"+(v+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?C.type=3:m.ctrlKey?C.key=f.C0.ESC+"[6;"+(v+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=v?f.C0.ESC+"[1;"+(v+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=v?f.C0.ESC+"[1;"+(v+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=v?f.C0.ESC+"[1;"+(v+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=v?f.C0.ESC+"[1;"+(v+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=v?f.C0.ESC+"[15;"+(v+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=v?f.C0.ESC+"[17;"+(v+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=v?f.C0.ESC+"[18;"+(v+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=v?f.C0.ESC+"[19;"+(v+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=v?f.C0.ESC+"[20;"+(v+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=v?f.C0.ESC+"[21;"+(v+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=v?f.C0.ESC+"[23;"+(v+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=v?f.C0.ESC+"[24;"+(v+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(S&&!k||!m.altKey||m.metaKey)!S||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?C.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(C.key=f.C0.US),m.key==="@"&&(C.key=f.C0.NUL)):m.keyCode===65&&(C.type=1);else{const y=g[m.keyCode],x=y==null?void 0:y[m.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(m.keyCode>=65&&m.keyCode<=90){const _=m.ctrlKey?m.keyCode-64:m.keyCode+32;let j=String.fromCharCode(_);m.shiftKey&&(j=j.toUpperCase()),C.key=f.C0.ESC+j}else if(m.keyCode===32)C.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let _=m.code.slice(3,4);m.shiftKey||(_=_.toLowerCase()),C.key=f.C0.ESC+_,C.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?C.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?C.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?C.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?C.key=f.C0.DEL:m.keyCode===219?C.key=f.C0.ESC:m.keyCode===220?C.key=f.C0.FS:m.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},l.utf32ToString=function(d,f=0,g=d.length){let m="";for(let b=f;b<g;++b){let S=d[b];S>65535?(S-=65536,m+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):m+=String.fromCharCode(S)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const g=d.length;if(!g)return 0;let m=0,b=0;if(this._interim){const S=d.charCodeAt(b++);56320<=S&&S<=57343?f[m++]=1024*(this._interim-55296)+S-56320+65536:(f[m++]=this._interim,f[m++]=S),this._interim=0}for(let S=b;S<g;++S){const k=d.charCodeAt(S);if(55296<=k&&k<=56319){if(++S>=g)return this._interim=k,m;const C=d.charCodeAt(S);56320<=C&&C<=57343?f[m++]=1024*(k-55296)+C-56320+65536:(f[m++]=k,f[m++]=C)}else k!==65279&&(f[m++]=k)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(d,f){const g=d.length;if(!g)return 0;let m,b,S,k,C=0,v=0,y=0;if(this.interim[0]){let j=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let N,R=0;for(;(N=63&this.interim[++R])&&R<4;)A<<=6,A|=N;const T=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=T-R;for(;y<I;){if(y>=g)return 0;if(N=d[y++],(192&N)!=128){y--,j=!0;break}this.interim[R++]=N,A<<=6,A|=63&N}j||(T===2?A<128?y--:f[C++]=A:T===3?A<2048||A>=55296&&A<=57343||A===65279||(f[C++]=A):A<65536||A>1114111||(f[C++]=A)),this.interim.fill(0)}const x=g-4;let _=y;for(;_<g;){for(;!(!(_<x)||128&(m=d[_])||128&(b=d[_+1])||128&(S=d[_+2])||128&(k=d[_+3]));)f[C++]=m,f[C++]=b,f[C++]=S,f[C++]=k,_+=4;if(m=d[_++],m<128)f[C++]=m;else if((224&m)==192){if(_>=g)return this.interim[0]=m,C;if(b=d[_++],(192&b)!=128){_--;continue}if(v=(31&m)<<6|63&b,v<128){_--;continue}f[C++]=v}else if((240&m)==224){if(_>=g)return this.interim[0]=m,C;if(b=d[_++],(192&b)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=b,C;if(S=d[_++],(192&S)!=128){_--;continue}if(v=(15&m)<<12|(63&b)<<6|63&S,v<2048||v>=55296&&v<=57343||v===65279)continue;f[C++]=v}else if((248&m)==240){if(_>=g)return this.interim[0]=m,C;if(b=d[_++],(192&b)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=b,C;if(S=d[_++],(192&S)!=128){_--;continue}if(_>=g)return this.interim[0]=m,this.interim[1]=b,this.interim[2]=S,C;if(k=d[_++],(192&k)!=128){_--;continue}if(v=(7&m)<<18|(63&b)<<12|(63&S)<<6|63&k,v<65536||v>1114111)continue;f[C++]=v}}return C}}},225:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=d(1480),g=[[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 b;l.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let S=0;S<g.length;++S)b.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?b[S]:(function(k,C){let v,y=0,x=C.length-1;if(k<C[0][0]||k>C[x][1])return!1;for(;x>=y;)if(v=y+x>>1,k>C[v][1])y=v+1;else{if(!(k<C[v][0]))return!0;x=v-1}return!1})(S,m)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,k){let C=this.wcwidth(S),v=C===0&&k!==0;if(v){const y=f.UnicodeService.extractWidth(k);y===0?v=!1:y>C&&(C=y)}return f.UnicodeService.createPropertyValue(0,C,v)}}},5981:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=d(8460),g=d(844);class m extends g.Disposable{constructor(S){super(),this._action=S,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(S,k){if(k!==void 0&&this._syncCalls>k)return void(this._syncCalls=0);if(this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,k){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+=S.length,this._writeBuffer.push(S),this._callbacks.push(k),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(k)}_innerWrite(S=0,k=!0){const C=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],y=this._action(v,k);if(y){const _=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void y.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(_)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-C>=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()}}l.WriteBuffer=m},5941:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.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 g(m,b){const S=m.toString(16),k=S.length<2?"0"+S:S;switch(b){case 4:return S[0];case 8:return k;case 12:return(k+k).slice(0,3);default:return k+k}}l.parseColor=function(m){if(!m)return;let b=m.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const S=d.exec(b);if(S){const k=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/k*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/k*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/k*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),f.exec(b)&&[3,6,9,12].includes(b.length))){const S=b.length/3,k=[0,0,0];for(let C=0;C<3;++C){const v=parseInt(b.slice(S*C,S*C+S),16);k[C]=S===1?v<<4:S===2?v:S===3?v>>4:v>>8}return k}},l.toRgbString=function(m,b=16){const[S,k,C]=m;return`rgb:${g(S,b)}/${g(k,b)}/${g(C,b)}`}},5770:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=d(482),g=d(8742),m=d(5770),b=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(k,C){this._handlers[k]===void 0&&(this._handlers[k]=[]);const v=this._handlers[k];return v.push(C),{dispose:()=>{const y=v.indexOf(C);y!==-1&&v.splice(y,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}reset(){if(this._active.length)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(k,C){if(this.reset(),this._ident=k,this._active=this._handlers[k]||b,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(k,C,v){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(k,C,v);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(k,C,v))}unhook(k,C=!0){if(this._active.length){let v=!1,y=this._active.length-1,x=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,v=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&v===!1){for(;y>=0&&(v=this._active[y].unhook(k),v!==!0);y--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,v;y--}for(;y>=0;y--)if(v=this._active[y].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",k);this._active=b,this._ident=0}};const S=new g.Params;S.addParam(0),l.DcsHandler=class{constructor(k){this._handler=k,this._data="",this._params=S,this._hitLimit=!1}hook(k){this._params=k.length>1||k.params[0]?k.clone():S,this._data="",this._hitLimit=!1}put(k,C,v){this._hitLimit||(this._data+=(0,f.utf32ToString)(k,C,v),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(k){let C=!1;if(this._hitLimit)C=!1;else if(k&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((v=>(this._params=S,this._data="",this._hitLimit=!1,v)));return this._params=S,this._data="",this._hitLimit=!1,C}}},2015:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=d(844),g=d(8742),m=d(6242),b=d(6351);class S{constructor(y){this.table=new Uint8Array(y)}setDefault(y,x){this.table.fill(y<<4|x)}add(y,x,_,j){this.table[x<<8|y]=_<<4|j}addMany(y,x,_,j){for(let A=0;A<y.length;A++)this.table[x<<8|y[A]]=_<<4|j}}l.TransitionTable=S;const k=160;l.VT500_TRANSITION_TABLE=(function(){const v=new S(4095),y=Array.apply(null,Array(256)).map(((R,T)=>T)),x=(R,T)=>y.slice(R,T),_=x(32,127),j=x(0,24);j.push(25),j.push.apply(j,x(28,32));const A=x(0,14);let N;for(N in v.setDefault(1,0),v.addMany(_,0,2,0),A)v.addMany([24,26,153,154],N,3,0),v.addMany(x(128,144),N,3,0),v.addMany(x(144,152),N,3,0),v.add(156,N,0,0),v.add(27,N,11,1),v.add(157,N,4,8),v.addMany([152,158,159],N,0,7),v.add(155,N,11,3),v.add(144,N,11,9);return v.addMany(j,0,3,0),v.addMany(j,1,3,1),v.add(127,1,0,1),v.addMany(j,8,0,8),v.addMany(j,3,3,3),v.add(127,3,0,3),v.addMany(j,4,3,4),v.add(127,4,0,4),v.addMany(j,6,3,6),v.addMany(j,5,3,5),v.add(127,5,0,5),v.addMany(j,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(_,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(x(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(_,7,0,7),v.addMany(j,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(x(64,127),3,7,0),v.addMany(x(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(x(48,60),4,8,4),v.addMany(x(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(x(32,64),6,0,6),v.add(127,6,0,6),v.addMany(x(64,127),6,0,0),v.addMany(x(32,48),3,9,5),v.addMany(x(32,48),5,9,5),v.addMany(x(48,64),5,0,6),v.addMany(x(64,127),5,7,0),v.addMany(x(32,48),4,9,5),v.addMany(x(32,48),1,9,2),v.addMany(x(32,48),2,9,2),v.addMany(x(48,127),2,10,0),v.addMany(x(48,80),1,10,0),v.addMany(x(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(x(96,127),1,10,0),v.add(80,1,11,9),v.addMany(j,9,0,9),v.add(127,9,0,9),v.addMany(x(28,32),9,0,9),v.addMany(x(32,48),9,9,12),v.addMany(x(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(j,11,0,11),v.addMany(x(32,128),11,0,11),v.addMany(x(28,32),11,0,11),v.addMany(j,10,0,10),v.add(127,10,0,10),v.addMany(x(28,32),10,0,10),v.addMany(x(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(x(32,48),10,9,12),v.addMany(j,12,0,12),v.add(127,12,0,12),v.addMany(x(28,32),12,0,12),v.addMany(x(32,48),12,9,12),v.addMany(x(48,64),12,0,11),v.addMany(x(64,127),12,12,13),v.addMany(x(64,127),10,12,13),v.addMany(x(64,127),9,12,13),v.addMany(j,13,13,13),v.addMany(_,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(k,0,2,0),v.add(k,8,5,8),v.add(k,6,0,6),v.add(k,11,0,11),v.add(k,13,13,13),v})();class C extends f.Disposable{constructor(y=l.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,_,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,_)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,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 b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,x=[64,126]){let _=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=y.prefix.charCodeAt(0),_&&60>_||_>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<y.intermediates.length;++A){const N=y.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=N}}if(y.final.length!==1)throw new Error("final must be a single byte");const j=y.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return _<<=8,_|=j,_}identToString(y){const x=[];for(;y;)x.push(String.fromCharCode(255&y)),y>>=8;return x.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,x){const _=this._identifier(y,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const j=this._escHandlers[_];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,x){this._executeHandlers[y.charCodeAt(0)]=x}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,x){const _=this._identifier(y);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const j=this._csiHandlers[_];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,x){return this._dcsParser.registerHandler(this._identifier(y),x)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,x){return this._oscParser.registerHandler(y,x)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}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(y,x,_,j,A){this._parseStack.state=y,this._parseStack.handlers=x,this._parseStack.handlerPos=_,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(y,x,_){let j,A=0,N=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const T=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&I>-1){for(;I>=0&&(j=T[I](this._params),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 4:if(_===!1&&I>-1){for(;I>=0&&(j=T[I](),j!==!0);I--)if(j instanceof Promise)return this._parseStack.handlerPos=I,j}this._parseStack.handlers=[];break;case 6:if(A=y[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,_),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=y[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,_),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let T=R;T<x;++T){switch(A=y[T],N=this._transitions.table[this.currentState<<8|(A<160?A:k)],N>>4){case 2:for(let $=T+1;;++$){if($>=x||(A=y[$])<32||A>126&&A<k){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<k){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<k){this._printHandler(y,T,$),T=$-1;break}if(++$>=x||(A=y[$])<32||A>126&&A<k){this._printHandler(y,T,$),T=$-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:T,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|A];let z=I?I.length-1:-1;for(;z>=0&&(j=I[z](this._params),j!==!0);z--)if(j instanceof Promise)return this._preserveStack(3,I,z,N,T),j;z<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++T<x&&(A=y[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const V=this._escHandlers[this._collect<<8|A];let Y=V?V.length-1:-1;for(;Y>=0&&(j=V[Y](),j!==!0);Y--)if(j instanceof Promise)return this._preserveStack(4,V,Y,N,T),j;Y<0&&this._escHandlerFb(this._collect<<8|A),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|A,this._params);break;case 13:for(let $=T+1;;++$)if($>=x||(A=y[$])===24||A===26||A===27||A>127&&A<k){this._dcsParser.put(y,T,$),T=$-1;break}break;case 14:if(j=this._dcsParser.unhook(A!==24&&A!==26),j)return this._preserveStack(6,[],0,N,T),j;A===27&&(N|=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 $=T+1;;$++)if($>=x||(A=y[$])<32||A>127&&A<k){this._oscParser.put(y,T,$),T=$-1;break}break;case 6:if(j=this._oscParser.end(A!==24&&A!==26),j)return this._preserveStack(5,[],0,N,T),j;A===27&&(N|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&N}}}l.EscapeSequenceParser=C},6242:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=d(5770),g=d(482),m=[];l.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(b,S){this._handlers[b]===void 0&&(this._handlers[b]=[]);const k=this._handlers[b];return k.push(S),{dispose:()=>{const C=k.indexOf(S);C!==-1&&k.splice(C,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].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 b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,S,k){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(b,S,k);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(b,S,k))}start(){this.reset(),this._state=1}put(b,S,k){if(this._state!==3){if(this._state===1)for(;S<k;){const C=b[S++];if(C===59){this._state=2,this._start();break}if(C<48||57<C)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+C-48}this._state===2&&k-S>0&&this._put(b,S,k)}}end(b,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let k=!1,C=this._active.length-1,v=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,k=S,v=this._stack.fallThrough,this._stack.paused=!1),!v&&k===!1){for(;C>=0&&(k=this._active[C].end(b),k!==!0);C--)if(k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,k;C--}for(;C>=0;C--)if(k=this._active[C].end(!1),k instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,k}else this._handlerFb(this._id,"END",b);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,S,k){this._hitLimit||(this._data+=(0,g.utf32ToString)(b,S,k),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let S=!1;if(this._hitLimit)S=!1;else if(b&&(S=this._handler(this._data),S instanceof Promise))return S.then((k=>(this._data="",this._hitLimit=!1,k)));return this._data="",this._hitLimit=!1,S}}},8742:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const d=2147483647;class f{static fromArray(m){const b=new f;if(!m.length)return b;for(let S=Array.isArray(m[0])?1:0;S<m.length;++S){const k=m[S];if(Array.isArray(k))for(let C=0;C<k.length;++C)b.addSubParam(k[C]);else b.addParam(k)}return b}constructor(m=32,b=32){if(this.maxLength=m,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(b),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 b=0;b<this.length;++b){m.push(this.params[b]);const S=this._subParamsIdx[b]>>8,k=255&this._subParamsIdx[b];k-S>0&&m.push(Array.prototype.slice.call(this._subParams,S,k))}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 b=this._subParamsIdx[m]>>8,S=255&this._subParamsIdx[m];return S-b>0?this._subParams.subarray(b,S):null}getSubParamsAll(){const m={};for(let b=0;b<this.length;++b){const S=this._subParamsIdx[b]>>8,k=255&this._subParamsIdx[b];k-S>0&&(m[b]=this._subParams.slice(S,k))}return m}addDigit(m){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,k=S[b-1];S[b-1]=~k?Math.min(10*k+m,d):m}}l.Params=f},5741:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.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 g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(d)}_wrappedAddonDispose(d){if(d.isDisposed)return;let f=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===d){f=g;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:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=d(3785),g=d(511);l.BufferApiView=class{constructor(m,b){this._buffer=m,this.type=b}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 b=this._buffer.lines.get(m);if(b)return new f.BufferLineApiView(b)}getNullCell(){return new g.CellData}}},3785:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=d(511);l.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new f.CellData)}translateToString(g,m,b){return this._line.translateToString(g,m,b)}}},8285:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=d(8771),g=d(8460),m=d(844);class b extends m.Disposable{constructor(k){super(),this._core=k,this._onBufferChange=this.register(new g.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)}}l.BufferNamespaceApi=b},7975:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(d){this._core=d}registerCsiHandler(d,f){return this._core.registerCsiHandler(d,(g=>f(g.toArray())))}addCsiHandler(d,f){return this.registerCsiHandler(d,f)}registerDcsHandler(d,f){return this._core.registerDcsHandler(d,((g,m)=>f(g,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:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.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(p,l,d){var f=this&&this.__decorate||function(v,y,x,_){var j,A=arguments.length,N=A<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,y,x,_);else for(var R=v.length-1;R>=0;R--)(j=v[R])&&(N=(A<3?j(N):A>3?j(y,x,N):j(y,x))||N);return A>3&&N&&Object.defineProperty(y,x,N),N},g=this&&this.__param||function(v,y){return function(x,_){y(x,_,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=d(8460),b=d(844),S=d(5295),k=d(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let C=l.BufferService=class extends b.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,l.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(v,this))}resize(v,y){this.cols=v,this.rows=y,this.buffers.resize(v,y),this._onResize.fire({cols:v,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,y=!1){const x=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===v.fg&&_.getBg(0)===v.bg||(_=x.getBlankLine(v,y),this._cachedBlankLine=_),_.isWrapped=y;const j=x.ybase+x.scrollTop,A=x.ybase+x.scrollBottom;if(x.scrollTop===0){const N=x.lines.isFull;A===x.lines.length-1?N?x.lines.recycle().copyFrom(_):x.lines.push(_.clone()):x.lines.splice(A+1,0,_.clone()),N?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const N=A-j+1;x.lines.shiftElements(j+1,N-1,-1),x.lines.set(A,_.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(v,y,x){const _=this.buffer;if(v<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else v+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const j=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+v,_.ybase),0),j!==_.ydisp&&(y||this._onScroll.fire(_.ydisp))}};l.BufferService=C=f([g(0,k.IOptionsService)],C)},7994:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.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(p,l,d){var f=this&&this.__decorate||function(_,j,A,N){var R,T=arguments.length,I=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(_,j,A,N);else for(var z=_.length-1;z>=0;z--)(R=_[z])&&(I=(T<3?R(I):T>3?R(j,A,I):R(j,A))||I);return T>3&&I&&Object.defineProperty(j,A,I),I},g=this&&this.__param||function(_,j){return function(A,N){j(A,N,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=d(2585),b=d(8460),S=d(844),k={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function C(_,j){let A=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(A|=64,A|=_.action):(A|=3&_.button,4&_.button&&(A|=64),8&_.button&&(A|=128),_.action===32?A|=32:_.action!==0||j||(A|=3)),A}const v=String.fromCharCode,y={DEFAULT:_=>{const j=[C(_,!1)+32,_.col+32,_.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${v(j[0])}${v(j[1])}${v(j[2])}`},SGR:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.col};${_.row}${j}`},SGR_PIXELS:_=>{const j=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${C(_,!0)};${_.x};${_.y}${j}`}};let x=l.CoreMouseService=class extends S.Disposable{constructor(_,j){super(),this._bufferService=_,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(k))this.addProtocol(A,k[A]);for(const A of Object.keys(y))this.addEncoding(A,y[A]);this.reset()}addProtocol(_,j){this._protocols[_]=j}addEncoding(_,j){this._encodings[_]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const j=this._encodings[this._activeEncoding](_);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,j,A){if(A){if(_.x!==j.x||_.y!==j.y)return!1}else if(_.col!==j.col||_.row!==j.row)return!1;return _.button===j.button&&_.action===j.action&&_.ctrl===j.ctrl&&_.alt===j.alt&&_.shift===j.shift}};l.CoreMouseService=x=f([g(0,m.IBufferService),g(1,m.ICoreService)],x)},6975:function(p,l,d){var f=this&&this.__decorate||function(x,_,j,A){var N,R=arguments.length,T=R<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,_,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(R<3?N(T):R>3?N(_,j,T):N(_,j))||T);return R>3&&T&&Object.defineProperty(_,j,T),T},g=this&&this.__param||function(x,_){return function(j,A){_(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=d(1439),b=d(8460),S=d(844),k=d(2585),C=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=l.CoreService=class extends S.Disposable{constructor(x,_,j){super(),this._bufferService=x,this._logService=_,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(v)}reset(){this.modes=(0,m.clone)(C),this.decPrivateModes=(0,m.clone)(v)}triggerDataEvent(x,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=y=f([g(0,k.IBufferService),g(1,k.ILogService),g(2,k.IOptionsService)],y)},9074:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=d(8055),g=d(8460),m=d(844),b=d(6106);let S=0,k=0;class C extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const _=new v(x);if(_){const j=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),j.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,_,j){let A=0,N=0;for(const R of this._decorations.getKeyIterator(_))A=R.options.x??0,N=A+(R.options.width??1),x>=A&&x<N&&(!j||(R.options.layer??"bottom")===j)&&(yield R)}forEachDecorationAtCell(x,_,j,A){this._decorations.forEachByKey(_,(N=>{S=N.options.x??0,k=S+(N.options.width??1),x>=S&&x<k&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}l.DecorationService=C;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(x){super(),this.options=x,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=x.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=d(2585),g=d(8343);class m{constructor(...S){this._entries=new Map;for(const[k,C]of S)this.set(k,C)}set(S,k){const C=this._entries.get(S);return this._entries.set(S,k),C}forEach(S){for(const[k,C]of this._entries.entries())S(k,C)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(b,S){this._services.set(b,S)}getService(b){return this._services.get(b)}createInstance(b,...S){const k=(0,g.getServiceDependencies)(b).sort(((y,x)=>y.index-x.index)),C=[];for(const y of k){const x=this._services.get(y.id);if(!x)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${y.id}.`);C.push(x)}const v=k.length>0?k[0].index:S.length;if(S.length!==v)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${v+1} conflicts with ${S.length} static arguments`);return new b(...S,...C)}}},7866:function(p,l,d){var f=this&&this.__decorate||function(v,y,x,_){var j,A=arguments.length,N=A<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,x):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,y,x,_);else for(var R=v.length-1;R>=0;R--)(j=v[R])&&(N=(A<3?j(N):A>3?j(y,x,N):j(y,x))||N);return A>3&&N&&Object.defineProperty(y,x,N),N},g=this&&this.__param||function(v,y){return function(x,_){y(x,_,v)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=d(844),b=d(2585),S={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let k,C=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),k=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let y=0;y<v.length;y++)typeof v[y]=="function"&&(v[y]=v[y]())}_log(v,y,x){this._evalLazyOptionalParams(x),v.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,...x)}trace(v,...y){var x;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,v,y)}debug(v,...y){var x;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,v,y)}info(v,...y){var x;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,v,y)}warn(v,...y){var x;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,v,y)}error(v,...y){var x;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,v,y)}};l.LogService=C=f([g(0,b.IOptionsService)],C),l.setTraceLogger=function(v){k=v},l.traceCall=function(v,y,x){if(typeof x.value!="function")throw new Error("not supported");const _=x.value;x.value=function(...j){if(k.logLevel!==b.LogLevelEnum.TRACE)return _.apply(this,j);k.trace(`GlyphRenderer#${_.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=_.apply(this,j);return k.trace(`GlyphRenderer#${_.name} return`,A),A}}},7302:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=d(8460),g=d(844),m=d(6114);l.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 b=["normal","bold","100","200","300","400","500","600","700","800","900"];class S extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...l.DEFAULT_OPTIONS};for(const y in C)if(y in v)try{const x=C[y];v[y]=this._sanitizeAndValidateOption(y,x)}catch(x){console.error(x)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,v){return this.onOptionChange((y=>{y===C&&v(this.rawOptions[C])}))}onMultipleOptionChange(C,v){return this.onOptionChange((y=>{C.indexOf(y)!==-1&&v()}))}_setupOptions(){const C=y=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},v=(y,x)=>{if(!(y in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);x=this._sanitizeAndValidateOption(y,x),this.rawOptions[y]!==x&&(this.rawOptions[y]=x,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const x={get:C.bind(this,y),set:v.bind(this,y)};Object.defineProperty(this.options,y,x)}}_sanitizeAndValidateOption(C,v){switch(C){case"cursorStyle":if(v||(v=l.DEFAULT_OPTIONS[C]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${C}`);break;case"wordSeparator":v||(v=l.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=b.includes(v)?v:l.DEFAULT_OPTIONS[C];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${C} 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(`${C} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${C} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}l.OptionsService=S},2660:function(p,l,d){var f=this&&this.__decorate||function(S,k,C,v){var y,x=arguments.length,_=x<3?k:v===null?v=Object.getOwnPropertyDescriptor(k,C):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(S,k,C,v);else for(var j=S.length-1;j>=0;j--)(y=S[j])&&(_=(x<3?y(_):x>3?y(k,C,_):y(k,C))||_);return x>3&&_&&Object.defineProperty(k,C,_),_},g=this&&this.__param||function(S,k){return function(C,v){k(C,v,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=d(2585);let b=l.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const k=this._bufferService.buffer;if(S.id===void 0){const j=k.addMarker(k.ybase+k.y),A={data:S,id:this._nextId++,lines:[j]};return j.onDispose((()=>this._removeMarkerFromLink(A,j))),this._dataByLinkId.set(A.id,A),A.id}const C=S,v=this._getEntryIdKey(C),y=this._entriesWithId.get(v);if(y)return this.addLineToLink(y.id,k.ybase+k.y),y.id;const x=k.addMarker(k.ybase+k.y),_={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(_,x))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(S,k){const C=this._dataByLinkId.get(S);if(C&&C.lines.every((v=>v.line!==k))){const v=this._bufferService.buffer.addMarker(k);C.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(C,v)))}}getLinkData(S){var k;return(k=this._dataByLinkId.get(S))==null?void 0:k.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,k){const C=S.lines.indexOf(k);C!==-1&&(S.lines.splice(C,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};l.OscLinkService=b=f([g(0,m.IBufferService)],b)},8343:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const d="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(g){return g[f]||[]},l.createDecorator=function(g){if(l.serviceRegistry.has(g))return l.serviceRegistry.get(g);const m=function(b,S,k){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,v,y){v[d]===v?v[f].push({id:C,index:y}):(v[f]=[{id:C,index:y}],v[d]=v)})(m,b,k)};return m.toString=()=>g,l.serviceRegistry.set(g,m),m}},2585:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=d(8343);var g;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.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"})(g||(l.LogLevelEnum=g={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(p,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=d(8460),g=d(225);class m{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,k,C=!1){return(16777215&S)<<3|(3&k)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const S=new g.UnicodeV6;this.register(S),this._active=S.version,this._activeProvider=S}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(S){if(!this._providers[S])throw new Error(`unknown Unicode version "${S}"`);this._active=S,this._activeProvider=this._providers[S],this._onChange.fire(S)}register(S){this._providers[S.version]=S}wcwidth(S){return this._activeProvider.wcwidth(S)}getStringCellWidth(S){let k=0,C=0;const v=S.length;for(let y=0;y<v;++y){let x=S.charCodeAt(y);if(55296<=x&&x<=56319){if(++y>=v)return k+this.wcwidth(x);const A=S.charCodeAt(y);56320<=A&&A<=57343?x=1024*(x-55296)+A-56320+65536:k+=this.wcwidth(A)}const _=this.charProperties(x,C);let j=m.extractWidth(_);m.extractShouldJoin(_)&&(j-=m.extractWidth(C)),k+=j,C=_}return k}charProperties(S,k){return this._activeProvider.charProperties(S,k)}}l.UnicodeService=m}},s={};function c(p){var l=s[p];if(l!==void 0)return l.exports;var d=s[p]={exports:{}};return i[p].call(d.exports,d,d.exports,c),d.exports}var u={};return(()=>{var p=u;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const l=c(9042),d=c(3236),f=c(844),g=c(5741),m=c(8285),b=c(7975),S=c(7090),k=["cols","rows"];class C extends f.Disposable{constructor(y){super(),this._core=this.register(new d.Terminal(y)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],_=(j,A)=>{this._checkReadonlyOptions(j),this._core.options[j]=A};for(const j in this._core.options){const A={get:x.bind(this,j),set:_.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(y){if(k.includes(y))throw new Error(`Option "${y}" 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 b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new S.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 y=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const x in y)this._publicOptions[x]=y[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,x=!0){this._core.input(y,x)}resize(y,x){this._verifyIntegers(y,x),this._core.resize(y,x)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,x,_){this._verifyIntegers(y,x,_),this._core.select(y,x,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,x){this._verifyIntegers(y,x),this._core.selectLines(y,x)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,x){this._core.write(y,x)}writeln(y,x){this._core.write(y),this._core.write(`\r
65
- `,x)}paste(y){this._core.paste(y)}refresh(y,x){this._verifyIntegers(y,x),this._core.refresh(y,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return l}_verifyIntegers(...y){for(const x of y)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const x of y)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}p.Terminal=C})(),u})()))})(Nd)),Nd.exports}var qS=$S();/**
66
- * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
67
- * @license MIT
68
- *
69
- * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
70
- * @license MIT
71
- *
72
- * Originally forked from (with the author's permission):
73
- * Fabrice Bellard's javascript vt100 for jslinux:
74
- * http://bellard.org/jslinux/
75
- * Copyright (c) 2011 Fabrice Bellard
76
- */var WS=2,GS=1,VS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),p={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=p.top+p.bottom,d=p.right+p.left,f=s-l,g=c-d-r;return{cols:Math.max(WS,Math.floor(g/e.css.cell.width)),rows:Math.max(GS,Math.floor(f/e.css.cell.height))}}};function YS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=H.useRef(null),u=H.useRef(e),p=H.useRef(null),l=H.useRef(null),d=ir(g=>g.writeSession),f=ir(g=>g.resizeSession);return H.useEffect(()=>{u.current=e},[e]),H.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),H.useEffect(()=>{if(!c.current)return;const g=new qS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new VS;g.loadAddon(m),p.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const b=c.current.querySelector(".xterm");b&&(b.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const S=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const C=(v=p.current)==null?void 0:v.term;C&&C.cols>0&&C.rows>0&&f(u.current,C.cols,C.rows)})},100)});S.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const k=Ht.subscribe(C=>{var v,y;if(C.type==="terminal.output"&&((v=C.payload)==null?void 0:v.sessionId)===u.current){const x=(y=C.payload)==null?void 0:y.data;x&&g.write(x)}});return()=>{k(),S.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),p.current=null}},[e,d,f]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.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.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function KS(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 XS({isOpen:e,onClose:r,onFocusChat:i}){const s=ir(C=>C.createSession),c=ir(C=>C.killSession),u=ir(C=>C.sessions),p=ir(C=>C.setWorkdir),l=ir(C=>C.fetchSessions),d=Ut(C=>C.currentProject),[f,g]=H.useState(!0),m=H.useRef(null),b=H.useRef(!1),S=H.useRef(!1),k=H.useCallback(()=>{r(),i()},[r,i]);return H.useEffect(()=>{d!=null&&d.workdir&&p(d.workdir)},[d==null?void 0:d.workdir,p]),H.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),H.useEffect(()=>{e&&u.length===0&&!f&&!S.current&&(S.current=!0,s())},[e,u.length,f,s]),H.useEffect(()=>{e?(b.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{b.current=!1},200)},100)):S.current=!1},[e]),H.useEffect(()=>{if(!e)return;const C=v=>{b.current||(v.key==="Escape"||v.key==="²"||v.key==="`")&&(v.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:k}),o.jsxs("div",{ref:m,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:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),k())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.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"})})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.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"})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:f?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${KS(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(YS,{sessionId:C.id,onClose:()=>c(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function Ja({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=H.useState(!1),[u,p]=H.useState(null),l=H.useRef(null),d=H.useRef(null);H.useEffect(()=>{function b(S){d.current&&!d.current.contains(S.target)&&c(!1)}return s&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b)}},[s]);const f=H.useCallback(()=>{if(!l.current)return;const b=l.current.getBoundingClientRect(),S=200,C=window.innerHeight-b.bottom<S;p({top:C?b.top-S-4:b.bottom+4,left:b.left,alignToTop:C})},[]),g=b=>{b.stopPropagation(),s||f(),c(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((b,S)=>{const k=o.jsxs(o.Fragment,{children:[b.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:b.icon}),b.label]});return b.href?o.jsx(An,{href:b.href,onClick:C=>{var v;(v=b.onClick)==null||v.call(b,C),c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${b.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:k},S):o.jsx("button",{onClick:C=>{var v;(v=b.onClick)==null||v.call(b,C),b.closeOnClick!==!1&&c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${b.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:k},S)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:l,onClick:g,children:r})}),s&&$l.createPortal(m,document.body)]})}function Sb({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function ql({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function wb(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${u}/${p}`}function Wl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function ZS(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),p=Wl(e);if(u===0)return`today ${p}`;if(u===1)return`yesterday ${p}`;if(u<7)return`${u} days ago ${p}`;{const l=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${l}/${d}/${f} ${p}`}}function Cb(e){const r=new Date(e);return{year:r.getFullYear(),month:String(r.getMonth()+1).padStart(2,"0"),day:String(r.getDate()).padStart(2,"0")}}function QS(e){const{year:r,month:i,day:s}=Cb(e);return`${r}-${i}-${s}`}function kb(e){const r=new Map;for(const c of e){const u=QS(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.sort((p,l)=>{const d=new Date(p.updatedAt).getTime();return new Date(l.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function JS({items:e,trigger:r,isActive:i=!1}){const[s,c]=H.useState(!1),u=H.useRef(null);return H.useEffect(()=>{function p(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&e.length>0&&o.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((p,l)=>{const d=p.label&&typeof p.label=="object"&&p.label.type===An?p.label:null;if(d){const f=d.props.href||"";return o.jsxs(An,{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:[p.icon,d.props.children]},l)}return p.href?o.jsxs("a",{href:p.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[p.icon,p.label]},l):o.jsxs("button",{type:"button",onClick:()=>{var f;(f=p.onClick)==null||f.call(p),c(!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:[p.icon,p.label]},l)})})]})}function ew({projects:e,currentProject:r}){const i=Ut(u=>u.loadProject),c=[...e].sort((u,p)=>u.name.localeCompare(p.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(ql,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(Ja,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(Sb,{})]}),minWidth:"250px"})}function tw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const c=r.filter(p=>p.projectId===e.id).sort((p,l)=>new Date(l.updatedAt).getTime()-new Date(p.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(An,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...c.map(p=>({label:o.jsx(An,{href:`/p/${e.id}/s/${p.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:p.title??p.id.slice(0,8)})}),icon:p.id===(i==null?void 0:i.id)?o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(An,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(JS,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function nw({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ce(f=>f.loadSession),c=e.filter(f=>f.projectId===r.id).slice(0,15),u=kb(c),p=[];p.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[f,g]of u){const m=g[0];if(m){p.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:wb(m.updatedAt)}),onClick:()=>{}});for(const b of g)p.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:b.title??b.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Wl(b.updatedAt)})]}),icon:b.id===(i==null?void 0:i.id)?o.jsx(ql,{}):void 0,href:`/p/${r.id}/s/${b.id}`,onClick:()=>{s(b.id)}})}}const l=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(Ja,{items:p,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:l,"data-testid":"header-session-dropdown",children:[l,o.jsx(Sb,{})]}),minWidth:"280px"})}function rw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=H.useState(!1),[c]=sr(),u=c.startsWith("/p/"),p=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ce(v=>v.currentSession),d=Ce(v=>v.sessions),f=Ut(v=>v.currentProject),g=Ut(v=>v.projects),m=Et(v=>v.startAutoRefresh),b=Et(v=>v.stopAutoRefresh),S=ir(v=>v.setOpen),k=ir(v=>v.isOpen),C=H.useCallback(()=>{const v=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');v&&v.focus()},[]);return H.useEffect(()=>{const v=y=>{(y.key==="²"||y.key==="`")&&(y.preventDefault(),k||S(!0))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[k,S]),H.useEffect(()=>(m(),()=>b()),[m,b]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.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:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),o.jsx(An,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),f&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(ew,{projects:g,currentProject:f})}),o.jsx("span",{className:"md:hidden",children:o.jsx(tw,{currentProject:f,sessions:d,currentSession:l,projectIdFromUrl:u&&c.split("/")[2]||null},f==null?void 0:f.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(nw,{sessions:d,currentProject:f,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>S(!k),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${k?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}),o.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:o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.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"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.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:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})}),r&&p&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),o.jsx(PS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(XS,{isOpen:k,onClose:()=>S(!1),onFocusChat:C})]})}function iw({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:p,isLoading:l=!1,onSave:d}){const[f,g]=H.useState(p),[m,b]=H.useState(!1),[S,k]=H.useState(!1);H.useEffect(()=>{g(p),b(!1)},[p]);const C=_=>{g(_.target.value),b(!0)},v=async()=>{k(!0),await d(f),k(!1),b(!1),r()},y=()=>{g(p),b(!1),r()},x=l||S;return o.jsx(un,{isOpen:e,onClose:y,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:f,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(yt,{variant:"secondary",onClick:y,children:"Cancel"}),o.jsx(yt,{variant:"primary",onClick:v,disabled:!m||x,children:S?"Saving...":"Save"})]})]})})}function sw({isOpen:e,onClose:r,project:i}){const s=Ut(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(p=>setTimeout(p,100))};return o.jsx(iw,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:c})}const aw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Ds({onClick:e,className:r="",size:i="md",variant:s="default"}){const c=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 o.jsx("button",{onClick:e,className:`${c} ${r}`,title:"Close",children:o.jsx("svg",{className:aw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function Eb({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=sr(),[c,u]=H.useState(!1),p=Ce(j=>j.sessions),l=Ce(j=>j.currentSession),d=Ce(j=>j.unreadSessionIds),f=Ce(j=>j.deleteSession),g=Ce(j=>j.deleteAllSessions),m=Ce(j=>j.loadMoreSessions),b=Ce(j=>j.sessionsHasMore),S=Ce(j=>j.sessionsPaginationLoading),k=Ut(j=>j.currentProject),C=H.useRef(null),v=H.useCallback(()=>{b&&!S&&k&&m(k.id)},[b,S,k,m]);H.useEffect(()=>{if(!C.current||!b)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&v()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[b,v]);const y=p.filter(j=>j.projectId===(k==null?void 0:k.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(f(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},_=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("aside",{className:`
77
- ${r?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
78
- md:relative md:h-auto md:translate-x-0
79
-
80
- fixed z-50 h-[calc(100vh-32px)]
81
- w-[300px] bg-bg-secondary border-r border-border flex flex-col
82
- transition-all duration-300 ease-in-out
83
- ${r?"translate-x-0":"-translate-x-full"}
84
- `,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(An,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(Ja,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:_,danger:!0}],trigger:o.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:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&o.jsx(Ds,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(sw,{isOpen:c,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:y.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:ow(y,l,d,x,e)}),S&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function ow(e,r,i,s,c){const u=kb(e);return Array.from(u).map(([p,l])=>{const d=l[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:wb(d.updatedAt)}),l.map(f=>{const g=(r==null?void 0:r.id)===f.id,m=i.includes(f.id),b=f.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(An,{href:`/p/${c}/s/${f.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:f.title??f.id.slice(0,6)}),o.jsx(Ja,{items:[{label:"Delete session",onClick:S=>s(f.id,S),danger:!0}],trigger:o.jsx("button",{onClick:S=>S.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[b?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Wl(f.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[f.messageCount," messages"]})]})]})},f.id)})]},p):null})}const Rx=["⠋","⠙","⠹","⠸","⠼","⠴"];function lw(){var l;const e=Ut(d=>d.currentProject),r=Ce(d=>d.currentSession),i=mb(),s=!1,c=H.useRef(0),u=H.useRef(null);H.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Rx.length,p()},150),p()):(u.current&&(clearInterval(u.current),u.current=null),p()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const p=()=>{var m;const f=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Rx[c.current]} `:"";e&&f?document.title=`${g}${e.name} - ${f} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Gl=H.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,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}`,...r}));Gl.displayName="Input";function cw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(un,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(yt,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(yt,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function uw(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 dw({isOpen:e,onClose:r}){const[,i]=sr(),[s,c]=H.useState(""),[u,p]=H.useState(null),[l,d]=H.useState(!1),[f,g]=H.useState(""),m=H.useRef(null);H.useEffect(()=>{e&&(_e("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),p(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const b=H.useCallback(async C=>{C.preventDefault();const v=uw(s);if(!v.valid){p(v.error);return}d(!0),p(null);const y=`${f}/${s}`;try{const x=await _e("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:y})});if(!x.ok){const A=await x.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await x.json()).project;r(),i(`/p/${j.id}`)}catch(x){p(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[s,i,r,f]),S=H.useCallback(()=>{c(""),p(null),r()},[r]),k=s?`${f}/${s}`:"";return o.jsx(un,{isOpen:e,onClose:S,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Gl,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),p(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:k})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(yt,{type:"button",variant:"secondary",onClick:S,disabled:l,children:"Cancel"}),o.jsx(yt,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create"})]})]})})}const hw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Vl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${hw[e]} ${r}`})}function fw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Vl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function jb({onSelect:e,onClose:r,initialPath:i}){const[s,c]=H.useState(null),[u,p]=H.useState(!0),l=H.useCallback(async k=>{p(!0);try{const C=k?`/api/directories?path=${encodeURIComponent(k)}`:"/api/directories",y=await(await _e(C)).json();c(y)}catch(C){console.error("Failed to load directories:",C)}finally{p(!1)}},[]);H.useEffect(()=>{l(i)},[i,l]);const d=k=>{l(k)},f=k=>{e(k)},m=((s==null?void 0:s.current)??"").split("/").filter(Boolean),S=m.map((k,C)=>({name:k,path:"/"+m.slice(0,C+1).join("/")}));return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:r,children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Select Folder"}),o.jsx(Ul,{onClick:r,className:"hover:bg-bg-tertiary"})]}),s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[S.map((k,C)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>d(k.path),className:`px-1 ${C===S.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:k.name})]},k.path)),S.length===0&&o.jsx("button",{onClick:()=>d("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Vl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>d(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(k=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>d(k.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{children:k.name})]}),o.jsx("button",{onClick:()=>f(k.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},k.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"p-4 border-t border-border space-y-2",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>f(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})})}async function Td(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await _e(i)).json()}function pw({isOpen:e,onClose:r}){const[,i]=sr(),[s,c]=H.useState(!1),[u,p]=H.useState(""),[l,d]=H.useState(null),[f,g]=H.useState(!1),[m,b]=H.useState(null),S=Ut(O=>O.projects),k=Ut(O=>O.createProject),C=Ut(O=>O.listProjects),v=Ut(O=>O.deleteProject),[y,x]=H.useState(null),[_,j]=H.useState(-1),[A,N]=H.useState(null),[R,T]=H.useState(!1),I=H.useRef([]);H.useEffect(()=>{_e("/api/config").then(O=>O.json()).then(O=>{O.workdir&&b(O.workdir)})},[]);const z=H.useCallback(async O=>{g(!0);try{const D=await Td(O,m??void 0);d(D)}catch(D){console.error("Failed to load directories:",D)}finally{g(!1)}},[m]);H.useEffect(()=>{e&&m&&(Td(m),C())},[e,m,z,C]);const V=(l==null?void 0:l.directories.filter(O=>u===""||O.name.toLowerCase().includes(u.toLowerCase())))??[],Y=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...V.map(O=>({type:"directory",path:O.path,name:O.name}))],$=O=>{i(`/p/${O}`),r()},F=(O,D)=>{D.stopPropagation(),N(O)},P=()=>{A&&(v(A.id),N(null))},B=O=>{const D=O.split("/").filter(Boolean).pop()??"";k(D,O),C(),x(O)};H.useEffect(()=>{if(y){const O=S.find(D=>D.workdir===y);O&&(i(`/p/${O.id}`),r(),x(null))}},[S,y,i,r]),H.useEffect(()=>{j(Y.length>0?0:-1)},[u,Y.length]);const X=O=>{p(""),Td(O)},Q=H.useCallback(O=>{if(!e)return;if(O.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(O.key))return;const D=document.activeElement;if(!(!D||D.tagName!=="INPUT")){if(O.preventDefault(),O.key==="ArrowDown")j(L=>{const q=L+1;return q>=Y.length?0:q});else if(O.key==="ArrowUp")j(L=>{const q=L-1;return q<0?Y.length-1:q});else if(O.key==="Enter"&&_>=0&&_<Y.length){const L=Y[_];(L==null?void 0:L.type)==="parent"?X(L.path):L&&B(L.path)}}},[e,Y.length,_,X,B,r]);return H.useEffect(()=>{if(e)return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,Q]),H.useEffect(()=>{_>=0&&I.current[_]&&I.current[_].scrollIntoView({behavior:"smooth",block:"nearest"})},[_]),e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),o.jsx(Ds,{onClick:r,variant:"modal",size:"lg"})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:S.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:S.map(O=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>$(O.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:O.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:O.workdir})]})]}),o.jsx("button",{onClick:D=>F(O,D),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},O.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Gl,{value:u,onChange:O=>p(O.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:f?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):Y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:Y.map((O,D)=>o.jsxs("button",{ref:L=>{I.current[D]=L},onClick:()=>O.type==="parent"?X(O.path):B(O.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${D===_?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"flex-1",children:O.name})]},O.path))})})]})]}),o.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[o.jsx(yt,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(yt,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&o.jsx(dw,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(cw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:P}),R&&o.jsx(jb,{initialPath:m??void 0,onSelect:O=>{B(O),T(!1)},onClose:()=>T(!1)})]}):null}function mw(){const[e,r]=H.useState(!1),i=Ce(g=>g.sessions),s=Ut(g=>g.projects),c=Ut(g=>g.listProjects),u=Ce(g=>g.listSessions),p=Ce(g=>g.connectionStatus);H.useEffect(()=>{p==="connected"&&(c(),u())},[p,c,u]);const l=[...s].sort((g,m)=>{const b=i.filter(v=>v.workdir.startsWith(g.workdir)),S=i.filter(v=>v.workdir.startsWith(m.workdir)),k=b.length>0?new Date(b.reduce((v,y)=>new Date(y.updatedAt)>new Date(v.updatedAt)?y:v).updatedAt).getTime():new Date(g.updatedAt).getTime();return(S.length>0?new Date(S.reduce((v,y)=>new Date(y.updatedAt)>new Date(v.updatedAt)?y:v).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(b=>b.id===g);return m?i.filter(b=>b.workdir.startsWith(m.workdir)).sort((b,S)=>new Date(S.updatedAt).getTime()-new Date(b.updatedAt).getTime()).slice(0,5):[]},f=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(yt,{variant:"primary",onClick:f,children:"Open Project"})]}),l.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(An,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(An,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(b=>{const S=s.find(C=>b.workdir.startsWith(C.workdir)),k=S?`/p/${S.id}/s/${b.id}`:"#";return o.jsx(An,{href:k,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:b.title??b.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:ZS(b.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[b.messageCount," msgs"]})]})]})},b.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(pw,{isOpen:e,onClose:()=>r(!1)})]})}function gw(){const[,e]=vh("/p/:projectId/new"),[,r]=sr(),i=e==null?void 0:e.projectId,s=Ce(c=>c.createSession);return H.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Vl,{})})}function xw(){const e=Ut(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(An,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const Ra=e=>Math.round(e*10)/10;function Jd(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function vw(e){return`${e.providerId}::${e.model}`}function bw(e){return`${e.providerName} > ${e.model}`}function Lx(e){let r=0,i=0,s=0,c=0,u=0,p=0;const l=[],d=[];let f=0;for(const[b,S]of e.entries()){const k=S.stats,C=Jd(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,c+=k.generationTokens;const v=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,y=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=v,p+=y,l.push({messageId:S.id,timestamp:S.timestamp,...C,mode:k.mode,responseIndex:b+1,prefillTokens:k.prefillTokens,generationTokens:k.generationTokens,prefillSpeed:k.prefillSpeed,generationSpeed:k.generationSpeed,totalTime:k.totalTime,aiTime:k.totalTime-k.toolTime,toolTime:k.toolTime});const x=k.llmCalls??[];for(const _ of x)f+=1,d.push({messageId:S.id,timestamp:_.timestamp??S.timestamp,providerId:_.providerId,providerName:_.providerName,backend:_.backend,model:_.model,mode:k.mode,responseIndex:b+1,sessionCallIndex:f,callIndex:_.callIndex,promptTokens:_.promptTokens,completionTokens:_.completionTokens,ttft:_.ttft,completionTime:_.completionTime,prefillSpeed:_.prefillSpeed,generationSpeed:_.generationSpeed,totalTime:_.totalTime})}const g=u>0?Ra(s/u):0,m=p>0?Ra(c/p):0;return{totalTime:Ra(r),aiTime:Ra(r-i),toolTime:Ra(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function yw(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const u=vw(Jd(c.stats)),p=i.get(u)??[];i.set(u,[...p,c])}const s=Array.from(i.entries()).map(([c,u])=>{const p=Jd(u[0].stats),l=Lx(u);return{...p,key:c,label:bw(p),...l}});return{...Lx(r),modelGroups:s}}function _w(e){return H.useMemo(()=>yw(e),[e])}function Sw(e){const[r,i]=H.useState(null),[s,c]=H.useState(!0),[u,p]=H.useState(null),l=e||"";return H.useEffect(()=>{if(!l){c(!1);return}let d=!0,f=null;const g=async()=>{try{const b=await(await _e(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();d&&(i(b.branch),p(b.error||null),c(!1))}catch(m){d&&(p(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),f=setInterval(g,3e3),()=>{d=!1,f&&clearInterval(f)}},[l]),{branch:r,loading:s,error:u}}function Dl(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Mx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function ww(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const Cw="modulepreload",kw=function(e){return"/"+e},Ox={},Ew=function(r,i,s){let c=Promise.resolve();if(i&&i.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=p(i.map(f=>{if(f=kw(f),f in Ox)return;Ox[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Cw,g||(b.as="script"),b.crossOrigin="",b.href=f,d&&b.setAttribute("nonce",d),document.head.appendChild(b),g)return new Promise((S,k)=>{b.addEventListener("load",S),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(p){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=p,window.dispatchEvent(l),!l.defaultPrevented)throw p}return c.then(p=>{for(const l of p||[])l.status==="rejected"&&u(l.reason);return r().catch(u)})},Ix=["▁","▂","▃","▄","▅","▆","▇","█"];function jw(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function Nw(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Tw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,b)=>m.x-b.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),p=Math.max(...i.map(m=>m.y)),{minY:l,maxY:d}=Nw(u,p),f=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const b=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),S=g.get(b)??[];g.set(b,[...S,m.y])}for(const[m,b]of g){const S=Math.max(...b);f[m]=Ix[jw(S,l,d)]??Ix[0]}return{blocks:f.join(""),minX:s,maxX:c,minY:l,maxY:d}}function Bx(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function zx({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:p=!0,formatY:l=Bx,formatX:d=Bx}){const f=H.useMemo(()=>{const g=Tw(e,r),m=Math.max(r*6,240),b=10,S=8,C=[...e].sort((_,j)=>_.x-j.x).map(_=>{const j=g.maxX===g.minX?m/2:b+(_.x-g.minX)/(g.maxX-g.minX)*(m-b*2),A=g.maxY===g.minY?i/2:S+(g.maxY-_.y)/(g.maxY-g.minY)*(i-S*2);return{..._,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),v=C.map((_,j)=>`${j===0?"M":"L"} ${_.cx.toFixed(1)} ${_.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(_=>({value:_,y:g.maxY===g.minY?i/2:S+(g.maxY-_)/(g.maxY-g.minY)*(i-S*2)}));return{...g,chartWidth:m,points:C,path:v,gridLines:x}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[p&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${f.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[f.gridLines.map(g=>o.jsx("line",{x1:"0",x2:f.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),f.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:i-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),f.points.length>1&&o.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),p&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(f.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:d(f.maxX)})]})]}),u&&p&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Aw({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),p=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(zx,{data:u,width:c,label:r,xLabel:s}),o.jsx(zx,{data:p,width:c,label:i,xLabel:s})]})}function Dw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function Rw(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(r=>({x:r.responseIndex,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function Lw(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(r=>({x:r.promptTokens,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function Mw(e){return e.callDataPoints.length>0?Lw(e):Rw(e)}function Ad(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Ai(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ha(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Ow(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Ai(r)} ctx`:`${Ai(r)}-${Ai(i)} ctx`}function Rl(e){return`${Ha(e)} t/s`}function Nb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Iw(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(r=>({responseIndex:r.responseIndex,timestamp:r.timestamp,mode:r.mode,prefillTokens:r.prefillTokens,generationTokens:r.generationTokens,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime,aiTime:r.aiTime,toolTime:r.toolTime})),llmCalls:e.callDataPoints.map(r=>({sessionCallIndex:r.sessionCallIndex,responseIndex:r.responseIndex,callIndex:r.callIndex,timestamp:r.timestamp,mode:r.mode,promptTokens:r.promptTokens,completionTokens:r.completionTokens,ttft:r.ttft,completionTime:r.completionTime,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime}))}}function Bw({isOpen:e,onClose:r,stats:i}){const s=H.useRef(null),[c,u]=H.useState({}),[p,l]=H.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});H.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===p)||l(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[p,i.modelGroups]);const d=H.useMemo(()=>i.modelGroups.find(k=>k.key===p)??i.modelGroups[0],[p,i.modelGroups]),f=H.useMemo(()=>d?Dw(d):[],[d]),g=H.useMemo(()=>d?Mw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=H.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),b=H.useCallback(()=>{if(!d)return;const k=Iw(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),S=H.useCallback(async()=>{if(s.current)try{const k=(await Ew(async()=>{const{default:y}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:y}},[])).default,C=await k(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=C.toDataURL("image/png"),v.click()}catch(k){console.error("Failed to export PNG:",k),b()}},[b]);return o.jsx(un,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(k=>o.jsx("button",{onClick:()=>l(k.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${k.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:k.label,children:k.label},k.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(Er,{label:"AI Time",value:Ad(d.aiTime)}),o.jsx(Er,{label:"Total Time",value:Ad(d.totalTime)}),o.jsx(Er,{label:"Tool Time",value:Ad(d.toolTime)}),o.jsx(Er,{label:"Responses",value:d.responseCount.toString()}),o.jsx(Er,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(Er,{label:"Prefill Tokens",value:Ai(d.prefillTokens),subValue:`@ ${Ha(d.avgPrefillSpeed)} tok/s`}),o.jsx(Er,{label:"Gen Tokens",value:Ai(d.generationTokens),subValue:`@ ${Ha(d.avgGenerationSpeed)} tok/s`}),o.jsx(Er,{label:"Avg PP Speed",value:`${Ha(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(Er,{label:"Avg TG Speed",value:`${Ha(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:b,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:S,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(Aw,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:f.map((k,C)=>o.jsxs(H.Fragment,{children:[o.jsx(zw,{row:k,index:C,isExpanded:c[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(c[k.messageId]??!1)&&k.calls.map((v,y)=>o.jsx(Hw,{dataPoint:v,index:y},`${v.messageId}-${v.callIndex}`))]},k.messageId))})]})})]})]})})}function Er({label:e,value:r,subValue:i}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function zw({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?Ow(e.calls.map(u=>u.promptTokens)):`${Ai(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Nb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function Hw({dataPoint:e,index:r}){return o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.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]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Nb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Ai(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]})}const Pw={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},Fw=H.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const u=Pw[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function Uw({isOpen:e,onClose:r}){const i=rr(S=>S.config),s=rr(S=>S.saveConfig),[c,u]=H.useState(""),[p,l]=H.useState(""),[d,f]=H.useState(!1),[g,m]=H.useState(!1);H.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),f((i==null?void 0:i.hotReload)??!1))},[e,i]);const b=async()=>{!c.trim()||!p.trim()||(m(!0),await s({command:c.trim(),url:p.trim(),hotReload:d}),m(!1),r())};return o.jsx(un,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:S=>u(S.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:p,onChange:S=>l(S.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:S=>f(S.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:b,disabled:g||!c.trim()||!p.trim(),children:g?"Saving...":"Save"})]})]})})}const Hx={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"},$w={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"},Px={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},qw="text-text-primary";function Ww(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const f=e.slice(s,u.index);f&&r.push({text:f,className:c})}const p=u[1];if(!p)continue;const l=p.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const d=[];for(const f of l)if(f>=30&&f<=37){const g=Hx[f];g&&d.push(g)}else if(f>=40&&f<=47){const g=$w[f];g&&d.push(g)}else if(f>=90&&f<=97){const g=Hx[f];g&&d.push(g)}else if(f in Px){const g=Px[f];g&&d.push(g)}else f===39?d.push(qw):f===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),s=i.lastIndex}if(s<e.length){const p=e.slice(s);p&&r.push({text:p,className:c})}return r}catch(p){return console.warn("ANSI parsing failed, stripping codes:",p),[{text:Gw(e),className:"text-text-primary"}]}}function Gw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Wa(e){var i,s;const r=Ww(e);return r.length===1&&((i=r[0])==null?void 0:i.className)==="text-text-primary"?(s=r[0])==null?void 0:s.text:r.map((c,u)=>ln.createElement("span",{key:u,className:c.className},c.text))}const Tb=H.memo(function({title:r,logs:i,onClose:s,preClassName:c="flex-1 overflow-auto p-4 text-sm font-mono text-text-primary"}){const u=H.useRef(null);return H.useEffect(()=>{const p=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[s]),H.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s,children:o.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:p=>p.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary truncate",children:r}),o.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.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"})})})]}),o.jsx("pre",{ref:u,className:c,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((p,l)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Wa(p.content)},l))})]})})}),Vw=H.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[p,l]=H.useState(null),d=H.useRef(null);return H.useEffect(()=>{var g;const f=(g=i.current)==null?void 0:g.getBoundingClientRect();f&&l({bottom:window.innerHeight-f.bottom,right:window.innerWidth-f.right,width:f.width,height:f.height})},[i]),H.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),p?o.jsxs("div",{className:"relative",children:[o.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:p.bottom,right:p.right,width:p.width*2,maxHeight:p.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((f,g)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Wa(f.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:p.bottom+8,right:p.right+8},children:"Expand"})]}):null}),Yw=H.memo(function({workdir:r}){const i=rr(z=>z.setWorkdir),s=rr(z=>z.status),c=rr(z=>z.config),u=rr(z=>z.logs),p=rr(z=>z.start),l=rr(z=>z.stop),d=rr(z=>z.fetchLogs),[f,g]=H.useState(!1),[m,b]=H.useState(!1),[S,k]=H.useState(!1),[C,v]=H.useState(!1),y=H.useRef(null),x=H.useRef(null),_=H.useRef(null),j=H.useRef(null),A=(s==null?void 0:s.state)??"off",N=c!==null,R=A==="running"||A==="warning";H.useEffect(()=>{i(r??null)},[r,i]),H.useEffect(()=>{R&&d()},[R,d]),H.useEffect(()=>{_.current&&R&&(_.current.scrollTop=_.current.scrollHeight)},[u,R]);const T=()=>{R?l():p()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.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"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.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"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,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:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",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-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.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"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),R&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),y.current=setTimeout(()=>{k(!0),v(!1)},500)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),v(!0),x.current=setTimeout(()=>k(!1),150)},children:[o.jsx("pre",{ref:_,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((z,V)=>o.jsx("span",{className:z.stream==="stderr"?"text-accent-warning":"",children:Wa(z.content)},V))}),(S||C)&&j.current&&$l.createPortal(o.jsx(Vw,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>b(!0),onClose:()=>k(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!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"}),o.jsx(Uw,{isOpen:f,onClose:()=>g(!1)}),m&&o.jsx(Tb,{title:"Dev Server Logs",logs:u,onClose:()=>b(!1)})]})}),Kw=H.memo(function({isOpen:r,onClose:i,processName:s,logs:c}){return r?o.jsx(Tb,{title:s,logs:c,onClose:i,preClassName:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary whitespace-pre-wrap"}):null}),Xw=H.memo(function({sessionId:r}){var S;const i=Pa(k=>k.processes),s=Pa(k=>k.stopProcess),[c,u]=H.useState(null),[p,l]=H.useState([]),d=i.filter(k=>k.status!=="exited"),f=d.filter(k=>k.status==="running").length;if(i.length===0)return null;const g=k=>{switch(k){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=k=>{const C=Pa.getState().logs[k]??[];l(C.map(v=>({content:v.content,stream:v.stream}))),u(k)},b=k=>{r&&s(k,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(k=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(k.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(k.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"}),o.jsx("button",{onClick:()=>b(k.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"})]})]})},k.id))}),c&&o.jsx(Kw,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((S=d.find(k=>k.id===c))==null?void 0:S.name)??"",logs:p})]})});function Fx({summary:e,messages:r,workdir:i}){const[s,c]=H.useState(!1),u=_w(r),{branch:p}=Sw(i),l=Et(f=>f.version),d=Ce(f=>f.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!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:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:ww(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Mx(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Mx(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Bw,{isOpen:s,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(Fw,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),p&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:o.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"})}),o.jsx("span",{className:"truncate text-text-secondary",title:p,children:p})]}),o.jsx(Yw,{workdir:i}),o.jsx(Xw,{sessionId:d==null?void 0:d.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function Zw({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ce(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(Fx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
85
- md:hidden
86
- p-4 overflow-y-auto bg-bg-secondary
87
- transition-all duration-300 ease-in-out
88
- fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
89
- ${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
90
- `,children:o.jsx(Fx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function Qw(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Ab({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const c=i==="sm"?"w-12":"w-20",u=i==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${c} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${Qw(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function Jw({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Ux(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function eC(){const e=Ce(f=>f.contextState),r=Ce(f=>f.currentSession),i=Ce(f=>f.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:c,compactionCount:u,dangerZone:p}=e,l=Math.round(s/c*100),d=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:"Context:"}),o.jsxs("span",{className:Ux(l,p),children:[Dl(s)," / ",Dl(c)]}),o.jsxs("span",{className:Ux(l,p),children:["(",l,"%)"]})]}),o.jsx(Ab,{percent:l,dangerZone:p}),o.jsx(Jw,{dangerZone:p}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(yt,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:p?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function $x(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const p=i.slice(c,s).trim();(p||!u)&&r.push(p),c=s+1,s=i.indexOf(",",c)}return r}function tC(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const nC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,iC={};function qx(e,r){return(iC.jsx?rC:nC).test(e)}const sC=/[ \t\n\f\r]/g;function aC(e){return typeof e=="object"?e.type==="text"?Wx(e.value):!1:Wx(e)}function Wx(e){return e.replace(sC,"")===""}class eo{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}eo.prototype.normal={};eo.prototype.property={};eo.prototype.space=void 0;function Db(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new eo(i,s,r)}function Ga(e){return e.toLowerCase()}class yn{constructor(r,i){this.attribute=i,this.property=r}}yn.prototype.attribute="";yn.prototype.booleanish=!1;yn.prototype.boolean=!1;yn.prototype.commaOrSpaceSeparated=!1;yn.prototype.commaSeparated=!1;yn.prototype.defined=!1;yn.prototype.mustUseProperty=!1;yn.prototype.number=!1;yn.prototype.overloadedBoolean=!1;yn.prototype.property="";yn.prototype.spaceSeparated=!1;yn.prototype.space=void 0;let oC=0;const Ge=Li(),Pt=Li(),eh=Li(),ye=Li(),bt=Li(),Ts=Li(),Tn=Li();function Li(){return 2**++oC}const th=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:Pt,commaOrSpaceSeparated:Tn,commaSeparated:Ts,number:ye,overloadedBoolean:eh,spaceSeparated:bt},Symbol.toStringTag,{value:"Module"})),Dd=Object.keys(th);class Ch extends yn{constructor(r,i,s,c){let u=-1;if(super(r,i),Gx(this,"space",c),typeof s=="number")for(;++u<Dd.length;){const p=Dd[u];Gx(this,Dd[u],(s&th[p])===th[p])}}}Ch.prototype.defined=!0;function Gx(e,r,i){i&&(e[r]=i)}function Ms(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const u=new Ch(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Ga(s)]=s,i[Ga(u.attribute)]=s}return new eo(r,i,e.space)}const Rb=Ms({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:bt,ariaCurrent:null,ariaDescribedBy:bt,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:bt,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:bt,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bt,ariaLevel:ye,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:bt,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:bt,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:Pt,ariaSetSize:ye,ariaSort:null,ariaValueMax:ye,ariaValueMin:ye,ariaValueNow:ye,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Lb(e,r){return r in e?e[r]:r}function Mb(e,r){return Lb(e,r.toLowerCase())}const lC=Ms({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ts,acceptCharset:bt,accessKey:bt,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:bt,autoFocus:Ge,autoPlay:Ge,blocking:bt,capture:null,charSet:null,checked:Ge,cite:null,className:bt,cols:ye,colSpan:null,content:null,contentEditable:Pt,controls:Ge,controlsList:bt,coords:ye|Ts,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:eh,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:bt,height:ye,hidden:eh,high:ye,href:null,hrefLang:null,htmlFor:bt,httpEquiv:bt,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:bt,itemRef:bt,itemScope:Ge,itemType:bt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,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:Ge,optimum:ye,pattern:null,ping:bt,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:bt,required:Ge,reversed:Ge,rows:ye,rowSpan:ye,sandbox:bt,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ye,step:null,style:null,tabIndex:ye,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:Pt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bt,axis:null,background:null,bgColor:null,border:ye,borderColor:null,bottomMargin:ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:Mb}),cC=Ms({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:Tn,accentHeight:ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ye,amplitude:ye,arabicForm:null,ascent:ye,attributeName:null,attributeType:null,azimuth:ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ye,by:null,calcMode:null,capHeight:ye,className:bt,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:ye,diffuseConstant:ye,direction:null,display:null,dur:null,divisor:ye,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ye,enableBackground:null,end:null,event:null,exponent:ye,externalResourcesRequired:null,fill:null,fillOpacity:ye,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:Ts,g2:Ts,glyphName:Ts,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ye,horizOriginX:ye,horizOriginY:ye,id:null,ideographic:ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ye,k:ye,k1:ye,k2:ye,k3:ye,k4:ye,kernelMatrix:Tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ye,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:ye,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:ye,overlineThickness:ye,paintOrder:null,panose1:null,path:null,pathLength:ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:bt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tn,rev:Tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tn,requiredFeatures:Tn,requiredFonts:Tn,requiredFormats:Tn,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:ye,specularExponent:ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ye,strikethroughThickness:ye,string:null,stroke:null,strokeDashArray:Tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ye,strokeOpacity:ye,strokeWidth:null,style:null,surfaceScale:ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tn,tabIndex:ye,tableValues:null,target:null,targetX:ye,targetY:ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ye,underlineThickness:ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ye,values:null,vAlphabetic:ye,vMathematical:ye,vectorEffect:null,vHanging:ye,vIdeographic:ye,version:null,vertAdvY:ye,vertOriginX:ye,vertOriginY:ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Lb}),Ob=Ms({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),Ib=Ms({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Mb}),Bb=Ms({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),uC={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"},dC=/[A-Z]/g,Vx=/-[a-z]/g,hC=/^data[-\w.:]+$/i;function zb(e,r){const i=Ga(r);let s=r,c=yn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&hC.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Vx,pC);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Vx.test(u)){let p=u.replace(dC,fC);p.charAt(0)!=="-"&&(p="-"+p),r="data"+p}}c=Ch}return new c(s,r)}function fC(e){return"-"+e.toLowerCase()}function pC(e){return e.charAt(1).toUpperCase()}const Hb=Db([Rb,lC,Ob,Ib,Bb],"html"),Yl=Db([Rb,cC,Ob,Ib,Bb],"svg");function Yx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function mC(e){return e.join(" ").trim()}var _s={},Rd,Kx;function gC(){if(Kx)return Rd;Kx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,p=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
91
- `,f="/",g="*",m="",b="comment",S="declaration";function k(v,y){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];y=y||{};var x=1,_=1;function j(F){var P=F.match(r);P&&(x+=P.length);var B=F.lastIndexOf(d);_=~B?F.length-B:_+F.length}function A(){var F={line:x,column:_};return function(P){return P.position=new N(F),I(),P}}function N(F){this.start=F,this.end={line:x,column:_},this.source=y.source}N.prototype.content=v;function R(F){var P=new Error(y.source+":"+x+":"+_+": "+F);if(P.reason=F,P.filename=y.source,P.line=x,P.column=_,P.source=v,!y.silent)throw P}function T(F){var P=F.exec(v);if(P){var B=P[0];return j(B),v=v.slice(B.length),P}}function I(){T(i)}function z(F){var P;for(F=F||[];P=V();)P!==!1&&F.push(P);return F}function V(){var F=A();if(!(f!=v.charAt(0)||g!=v.charAt(1))){for(var P=2;m!=v.charAt(P)&&(g!=v.charAt(P)||f!=v.charAt(P+1));)++P;if(P+=2,m===v.charAt(P-1))return R("End of comment missing");var B=v.slice(2,P-2);return _+=2,j(B),v=v.slice(P),_+=2,F({type:b,comment:B})}}function Y(){var F=A(),P=T(s);if(P){if(V(),!T(c))return R("property missing ':'");var B=T(u),X=F({type:S,property:C(P[0].replace(e,m)),value:B?C(B[0].replace(e,m)):m});return T(p),X}}function $(){var F=[];z(F);for(var P;P=Y();)P!==!1&&(F.push(P),z(F));return F}return I(),$()}function C(v){return v?v.replace(l,m):m}return Rd=k,Rd}var Xx;function xC(){if(Xx)return _s;Xx=1;var e=_s&&_s.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=i;const r=e(gC());function i(s,c){let u=null;if(!s||typeof s!="string")return u;const p=(0,r.default)(s),l=typeof c=="function";return p.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:g}=d;l?c(f,g,d):g&&(u=u||{},u[f]=g)}),u}return _s}var La={},Zx;function vC(){if(Zx)return La;Zx=1,Object.defineProperty(La,"__esModule",{value:!0}),La.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(f){return!f||i.test(f)||e.test(f)},p=function(f,g){return g.toUpperCase()},l=function(f,g){return"".concat(g,"-")},d=function(f,g){return g===void 0&&(g={}),u(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(c,l):f=f.replace(s,l),f.replace(r,p))};return La.camelCase=d,La}var Ma,Qx;function bC(){if(Qx)return Ma;Qx=1;var e=Ma&&Ma.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(xC()),i=vC();function s(c,u){var p={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(p[(0,i.camelCase)(l,u)]=d)}),p}return s.default=s,Ma=s,Ma}var yC=bC();const _C=Hl(yC),Pb=Fb("end"),kh=Fb("start");function Fb(e){return r;function r(i){const s=i&&i.position&&i.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 SC(e){const r=kh(e),i=Pb(e);if(r&&i)return{start:r,end:i}}function Fa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jx(e.position):"start"in e||"end"in e?Jx(e):"line"in e||"column"in e?nh(e):""}function nh(e){return ev(e&&e.line)+":"+ev(e&&e.column)}function Jx(e){return nh(e&&e.start)+"-"+nh(e&&e.end)}function ev(e){return e&&typeof e=="number"?e:1}class an extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},p=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(p=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const l=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=Fa(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=p&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}an.prototype.file="";an.prototype.name="";an.prototype.reason="";an.prototype.message="";an.prototype.stack="";an.prototype.column=void 0;an.prototype.line=void 0;an.prototype.ancestors=void 0;an.prototype.cause=void 0;an.prototype.fatal=void 0;an.prototype.place=void 0;an.prototype.ruleId=void 0;an.prototype.source=void 0;const Eh={}.hasOwnProperty,wC=new Map,CC=/[A-Z]/g,kC=new Set(["table","tbody","thead","tfoot","tr"]),EC=new Set(["td","th"]),Ub="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function jC(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=OC(i,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=MC(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Yl:Hb,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=$b(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function $b(e,r,i){if(r.type==="element")return NC(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return TC(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return DC(e,r,i);if(r.type==="mdxjsEsm")return AC(e,r);if(r.type==="root")return RC(e,r,i);if(r.type==="text")return LC(e,r)}function NC(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Yl,e.schema=c),e.ancestors.push(r);const u=Wb(e,r.tagName,!1),p=IC(e,r);let l=Nh(e,r);return kC.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!aC(d):!0})),qb(e,p,u,r),jh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,u,p,i)}function TC(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Va(e,r.position)}function AC(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Va(e,r.position)}function DC(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Yl,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Wb(e,r.name,!0),p=BC(e,r),l=Nh(e,r);return qb(e,p,u,r),jh(p,l),e.ancestors.pop(),e.schema=s,e.create(r,u,p,i)}function RC(e,r,i){const s={};return jh(s,Nh(e,r)),e.create(r,e.Fragment,s,i)}function LC(e,r){return r.value}function qb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function jh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function MC(e,r,i){return s;function s(c,u,p,l){const f=Array.isArray(p.children)?i:r;return l?f(u,p,l):f(u,p)}}function OC(e,r){return i;function i(s,c,u,p){const l=Array.isArray(u.children),d=kh(s);return r(c,u,p,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function IC(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&Eh.call(r.properties,c)){const u=zC(e,c,r.properties[c]);if(u){const[p,l]=u;e.tableCellAlignToStyle&&p==="align"&&typeof l=="string"&&EC.has(r.tagName)?s=l:i[p]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function BC(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const p=u.expression;p.type;const l=p.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else Va(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else Va(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function Nh(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:wC;for(;++s<r.children.length;){const u=r.children[s];let p;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const f=c.get(d)||0;p=d+"-"+f,c.set(d,f+1)}}const l=$b(e,u,p);l!==void 0&&i.push(l)}return i}function zC(e,r,i){const s=zb(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?tC(i):mC(i)),s.property==="style"){let c=typeof i=="object"?i:HC(e,String(i));return e.stylePropertyNameCase==="css"&&(c=PC(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?uC[s.property]||s.property:s.attribute,i]}}function HC(e,r){try{return _C(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new an("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Ub+"#cannot-parse-style-attribute",c}}function Wb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,p;for(;++u<c.length;){const l=qx(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};p=p?{type:"MemberExpression",object:p,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}s=p}else s=qx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return Eh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);Va(e)}function Va(e,r){const i=new an("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Ub+"#cannot-handle-mdx-estrees-without-createevaluater",i}function PC(e){const r={};let i;for(i in e)Eh.call(e,i)&&(r[FC(i)]=e[i]);return r}function FC(e){let r=e.replace(CC,UC);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function UC(e){return"-"+e.toLowerCase()}const Ld={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"]},$C={};function Th(e,r){const i=$C,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Gb(e,s,c)}function Gb(e,r,i){if(qC(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return tv(e.children,r,i)}return Array.isArray(e)?tv(e,r,i):""}function tv(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Gb(e[c],r,i);return s.join("")}function qC(e){return!!(e&&typeof e=="object")}const nv=document.createElement("i");function Ya(e){const r="&"+e+";";nv.innerHTML=r;const i=nv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Dn(e,r,i,s){const c=e.length;let u=0,p;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)p=Array.from(s),p.unshift(r,i),e.splice(...p);else for(i&&e.splice(r,i);u<s.length;)p=s.slice(u,u+1e4),p.unshift(r,0),e.splice(...p),u+=1e4,r+=1e4}function $n(e,r){return e.length>0?(Dn(e,e.length,0,r),e):r}const rv={}.hasOwnProperty;function Vb(e){const r={};let i=-1;for(;++i<e.length;)WC(r,e[i]);return r}function WC(e,r){let i;for(i in r){const c=(rv.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let p;if(u)for(p in u){rv.call(c,p)||(c[p]=[]);const l=u[p];GC(c[p],Array.isArray(l)?l:l?[l]:[])}}}function GC(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Dn(e,0,0,s)}function Yb(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=ai(/[A-Za-z]/),sn=ai(/[\dA-Za-z]/),VC=ai(/[#-'*+\--9=?A-Z^-~]/);function Ll(e){return e!==null&&(e<32||e===127)}const rh=ai(/\d/),YC=ai(/[\dA-Fa-f]/),KC=ai(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function vt(e){return e!==null&&(e<0||e===32)}function Qe(e){return e===-2||e===-1||e===32}const Kl=ai(new RegExp("\\p{P}|\\p{S}","u")),Ri=ai(/\s/);function ai(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Os(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let p="";if(u===37&&sn(e.charCodeAt(i+1))&&sn(e.charCodeAt(i+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(p=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(i+1);u<56320&&l>56319&&l<57344?(p=String.fromCharCode(u,l),c=1):p="�"}else p=String.fromCharCode(u);p&&(r.push(e.slice(s,i),encodeURIComponent(p)),s=i+c+1,p=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function it(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return p;function p(d){return Qe(d)?(e.enter(i),l(d)):r(d)}function l(d){return Qe(d)&&u++<c?(e.consume(d),l):(e.exit(i),r(d))}}const XC={tokenize:ZC};function ZC(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),it(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(l){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,p(l)}function p(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Me(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),p)}}const QC={tokenize:JC},iv={tokenize:e2};function JC(e){const r=this,i=[];let s=0,c,u,p;return l;function l(_){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,f)(_)}return f(_)}function d(_){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}y(s);let R=j;for(;R<r.events.length;)r.events[R][1].end={...N},R++;return Dn(r.events,A+1,0,r.events.slice(j)),r.events.length=R,f(_)}return l(_)}function f(_){if(s===i.length){if(!c)return b(_);if(c.currentConstruct&&c.currentConstruct.concrete)return k(_);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(iv,g,m)(_)}function g(_){return c&&x(),y(s),b(_)}function m(_){return r.parser.lazy[r.now().line]=s!==i.length,p=r.now().offset,k(_)}function b(_){return r.containerState={},e.attempt(iv,S,k)(_)}function S(_){return s++,i.push([r.currentConstruct,r.containerState]),b(_)}function k(_){if(_===null){c&&x(),y(0),e.consume(_);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(_);return}return Me(_)?(e.consume(_),v(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(_),C)}function v(_,j){const A=r.sliceStream(_);if(j&&A.push(null),_.previous=u,u&&(u.next=_),u=_,c.defineSkip(_.start),c.write(A),r.parser.lazy[_.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<p&&(!c.events[N][1].end||c.events[N][1].end.offset>p))return;const R=r.events.length;let T=R,I,z;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){z=r.events[T][1].end;break}I=!0}for(y(s),N=R;N<r.events.length;)r.events[N][1].end={...z},N++;Dn(r.events,T+1,0,r.events.slice(R)),r.events.length=N}}function y(_){let j=i.length;for(;j-- >_;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=_}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function e2(e,r,i){return it(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rs(e){if(e===null||vt(e)||Ri(e))return 1;if(Kl(e))return 2}function Xl(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const ih={name:"attention",resolveAll:t2,tokenize:n2};function t2(e,r){let i=-1,s,c,u,p,l,d,f,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},b={...e[i][1].start};sv(m,-d),sv(b,d),p={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:b},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:d>1?"strong":"emphasis",start:{...p.start},end:{...l.end}},e[s][1].end={...p.start},e[i][1].start={...l.end},f=[],e[s][1].end.offset-e[s][1].start.offset&&(f=$n(f,[["enter",e[s][1],r],["exit",e[s][1],r]])),f=$n(f,[["enter",c,r],["enter",p,r],["exit",p,r],["enter",u,r]]),f=$n(f,Xl(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),f=$n(f,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,f=$n(f,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Dn(e,s-1,i-s+3,f),i=s+f.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function n2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Rs(s);let u;return p;function p(d){return u=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===u)return e.consume(d),l;const f=e.exit("attentionSequence"),g=Rs(d),m=!g||g===2&&c||i.includes(d),b=!c||c===2&&g||i.includes(s);return f._open=!!(u===42?m:m&&(c||!b)),f._close=!!(u===42?b:b&&(g||!m)),r(d)}}function sv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const r2={name:"autolink",tokenize:i2};function i2(e,r,i){let s=0;return c;function c(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(S){return cn(S)?(e.consume(S),p):S===64?i(S):f(S)}function p(S){return S===43||S===45||S===46||sn(S)?(s=1,l(S)):f(S)}function l(S){return S===58?(e.consume(S),s=0,d):(S===43||S===45||S===46||sn(S))&&s++<32?(e.consume(S),l):(s=0,f(S))}function d(S){return S===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):S===null||S===32||S===60||Ll(S)?i(S):(e.consume(S),d)}function f(S){return S===64?(e.consume(S),g):VC(S)?(e.consume(S),f):i(S)}function g(S){return sn(S)?m(S):i(S)}function m(S){return S===46?(e.consume(S),s=0,g):S===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.exit("autolink"),r):b(S)}function b(S){if((S===45||sn(S))&&s++<63){const k=S===45?b:m;return e.consume(S),k}return i(S)}}const to={partial:!0,tokenize:s2};function s2(e,r,i){return s;function s(u){return Qe(u)?it(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||Me(u)?r(u):i(u)}}const Kb={continuation:{tokenize:o2},exit:l2,name:"blockQuote",tokenize:a2};function a2(e,r,i){const s=this;return c;function c(p){if(p===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(p),e.exit("blockQuoteMarker"),u}return i(p)}function u(p){return Qe(p)?(e.enter("blockQuotePrefixWhitespace"),e.consume(p),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(p))}}function o2(e,r,i){const s=this;return c;function c(p){return Qe(p)?it(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p):u(p)}function u(p){return e.attempt(Kb,r,i)(p)}}function l2(e){e.exit("blockQuote")}const Xb={name:"characterEscape",tokenize:c2};function c2(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return KC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const Zb={name:"characterReference",tokenize:u2};function u2(e,r,i){const s=this;let c=0,u,p;return l;function l(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"),u=31,p=sn,g(m))}function f(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,p=YC,g):(e.enter("characterReferenceValue"),u=7,p=rh,g(m))}function g(m){if(m===59&&c){const b=e.exit("characterReferenceValue");return p===sn&&!Ya(s.sliceSerialize(b))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return p(m)&&c++<u?(e.consume(m),g):i(m)}}const av={partial:!0,tokenize:h2},ov={concrete:!0,name:"codeFenced",tokenize:d2};function d2(e,r,i){const s=this,c={partial:!0,tokenize:A};let u=0,p=0,l;return d;function d(N){return f(N)}function f(N){const R=s.events[s.events.length-1];return u=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(p++,e.consume(N),g):p<3?i(N):(e.exit("codeFencedFenceSequence"),Qe(N)?it(e,m,"whitespace")(N):m(N))}function m(N){return N===null||Me(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(av,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(N))}function b(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):Qe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),it(e,S,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),b)}function S(N){return N===null||Me(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),k)}function C(N){return e.attempt(c,j,v)(N)}function v(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),y}function y(N){return u>0&&Qe(N)?it(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||Me(N)?e.check(av,C,j)(N):(e.enter("codeFlowValue"),_(N))}function _(N){return N===null||Me(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),_)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,R,T){let I=0;return z;function z(P){return N.enter("lineEnding"),N.consume(P),N.exit("lineEnding"),V}function V(P){return N.enter("codeFencedFence"),Qe(P)?it(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Y(P)}function Y(P){return P===l?(N.enter("codeFencedFenceSequence"),$(P)):T(P)}function $(P){return P===l?(I++,N.consume(P),$):I>=p?(N.exit("codeFencedFenceSequence"),Qe(P)?it(N,F,"whitespace")(P):F(P)):T(P)}function F(P){return P===null||Me(P)?(N.exit("codeFencedFence"),R(P)):T(P)}}}function h2(e,r,i){const s=this;return c;function c(p){return p===null?i(p):(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u)}function u(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}const Md={name:"codeIndented",tokenize:p2},f2={partial:!0,tokenize:m2};function p2(e,r,i){const s=this;return c;function c(f){return e.enter("codeIndented"),it(e,u,"linePrefix",5)(f)}function u(f){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?p(f):i(f)}function p(f){return f===null?d(f):Me(f)?e.attempt(f2,p,d)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||Me(f)?(e.exit("codeFlowValue"),p(f)):(e.consume(f),l)}function d(f){return e.exit("codeIndented"),r(f)}}function m2(e,r,i){const s=this;return c;function c(p){return s.parser.lazy[s.now().line]?i(p):Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):it(e,u,"linePrefix",5)(p)}function u(p){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(p):Me(p)?c(p):i(p)}}const g2={name:"codeText",previous:v2,resolve:x2,tokenize:b2};function x2(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function v2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function b2(e,r,i){let s=0,c,u;return p;function p(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),c=0,g(m)):Me(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||Me(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),f)}function g(m){return m===96?(e.consume(m),c++,g):c===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",f(m))}}class y2{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Oa(this.left,s),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),Oa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Oa(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const i=this.left.splice(r,Number.POSITIVE_INFINITY);Oa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Oa(this.left,i.reverse())}}}function Oa(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function Qb(e){const r={};let i=-1,s,c,u,p,l,d,f;const g=new y2(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,_2(g,i)),i=r[i],f=!0);else if(s[1]._container){for(u=i,c=void 0;u--;)if(p=g.get(u),p[1].type==="lineEnding"||p[1].type==="lineEndingBlank")p[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),p[1].type="lineEnding",c=u);else if(!(p[1].type==="linePrefix"||p[1].type==="listItemIndent"))break;c&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Dn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function _2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];let p=i._tokenizer;p||(p=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(p._contentTypeTextTrailing=!0));const l=p.events,d=[],f={};let g,m,b=-1,S=i,k=0,C=0;const v=[C];for(;S;){for(;e.get(++c)[1]!==S;);u.push(c),S._tokenizer||(g=s.sliceStream(S),S.next||g.push(null),m&&p.defineSkip(S.start),S._isInFirstContentOfListItem&&(p._gfmTasklistFirstContentOfListItem=!0),p.write(g),S._isInFirstContentOfListItem&&(p._gfmTasklistFirstContentOfListItem=void 0)),m=S,S=S.next}for(S=i;++b<l.length;)l[b][0]==="exit"&&l[b-1][0]==="enter"&&l[b][1].type===l[b-1][1].type&&l[b][1].start.line!==l[b][1].end.line&&(C=b+1,v.push(C),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(p.events=[],S?(S._tokenizer=void 0,S.previous=void 0):v.pop(),b=v.length;b--;){const y=l.slice(v[b],v[b+1]),x=u.pop();d.push([x,x+y.length-1]),e.splice(x,2,y)}for(d.reverse(),b=-1;++b<d.length;)f[k+d[b][0]]=k+d[b][1],k+=d[b][1]-d[b][0]-1;return f}const S2={resolve:C2,tokenize:k2},w2={partial:!0,tokenize:E2};function C2(e){return Qb(e),e}function k2(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):Me(l)?e.check(w2,p,u)(l):(e.consume(l),c)}function u(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function p(l){return e.consume(l),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function E2(e,r,i){const s=this;return c;function c(p){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),it(e,u,"linePrefix")}function u(p){if(p===null||Me(p))return i(p);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(p):e.interrupt(s.parser.constructs.flow,i,r)(p)}}function Jb(e,r,i,s,c,u,p,l,d){const f=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(y){return y===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(y),e.exit(u),b):y===null||y===32||y===41||Ll(y)?i(y):(e.enter(s),e.enter(p),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(y))}function b(y){return y===62?(e.enter(u),e.consume(y),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),S(y))}function S(y){return y===62?(e.exit("chunkString"),e.exit(l),b(y)):y===null||y===60||Me(y)?i(y):(e.consume(y),y===92?k:S)}function k(y){return y===60||y===62||y===92?(e.consume(y),S):S(y)}function C(y){return!g&&(y===null||y===41||vt(y))?(e.exit("chunkString"),e.exit(l),e.exit(p),e.exit(s),r(y)):g<f&&y===40?(e.consume(y),g++,C):y===41?(e.consume(y),g--,C):y===null||y===32||y===40||Ll(y)?i(y):(e.consume(y),y===92?v:C)}function v(y){return y===40||y===41||y===92?(e.consume(y),C):C(y)}}function ey(e,r,i,s,c,u){const p=this;let l=0,d;return f;function f(S){return e.enter(s),e.enter(c),e.consume(S),e.exit(c),e.enter(u),g}function g(S){return l>999||S===null||S===91||S===93&&!d||S===94&&!l&&"_hiddenFootnoteSupport"in p.parser.constructs?i(S):S===93?(e.exit(u),e.enter(c),e.consume(S),e.exit(c),e.exit(s),r):Me(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||S===91||S===93||Me(S)||l++>999?(e.exit("chunkString"),g(S)):(e.consume(S),d||(d=!Qe(S)),S===92?b:m)}function b(S){return S===91||S===92||S===93?(e.consume(S),l++,m):m(S)}}function ty(e,r,i,s,c,u){let p;return l;function l(b){return b===34||b===39||b===40?(e.enter(s),e.enter(c),e.consume(b),e.exit(c),p=b===40?41:b,d):i(b)}function d(b){return b===p?(e.enter(c),e.consume(b),e.exit(c),e.exit(s),r):(e.enter(u),f(b))}function f(b){return b===p?(e.exit(u),d(p)):b===null?i(b):Me(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),it(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===p||b===null||Me(b)?(e.exit("chunkString"),f(b)):(e.consume(b),b===92?m:g)}function m(b){return b===p||b===92?(e.consume(b),g):g(b)}}function Ua(e,r){let i;return s;function s(c){return Me(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):Qe(c)?it(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const j2={name:"definition",tokenize:T2},N2={partial:!0,tokenize:A2};function T2(e,r,i){const s=this;let c;return u;function u(S){return e.enter("definition"),p(S)}function p(S){return ey.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function l(S){return c=Kn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),d):i(S)}function d(S){return vt(S)?Ua(e,f)(S):f(S)}function f(S){return Jb(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(N2,m,m)(S)}function m(S){return Qe(S)?it(e,b,"whitespace")(S):b(S)}function b(S){return S===null||Me(S)?(e.exit("definition"),s.parser.defined.push(c),r(S)):i(S)}}function A2(e,r,i){return s;function s(l){return vt(l)?Ua(e,c)(l):i(l)}function c(l){return ty(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return Qe(l)?it(e,p,"whitespace")(l):p(l)}function p(l){return l===null||Me(l)?r(l):i(l)}}const D2={name:"hardBreakEscape",tokenize:R2};function R2(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return Me(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const L2={name:"headingAtx",resolve:M2,tokenize:O2};function M2(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Dn(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function O2(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),p(g)}function p(g){return g===35&&s++<6?(e.consume(g),p):g===null||vt(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Me(g)?(e.exit("atxHeading"),r(g)):Qe(g)?it(e,l,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),l(g))}function f(g){return g===null||g===35||vt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),f)}}const I2=["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"],lv=["pre","script","style","textarea"],B2={concrete:!0,name:"htmlFlow",resolveTo:P2,tokenize:F2},z2={partial:!0,tokenize:$2},H2={partial:!0,tokenize:U2};function P2(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function F2(e,r,i){const s=this;let c,u,p,l,d;return f;function f(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),m}function m(U){return U===33?(e.consume(U),b):U===47?(e.consume(U),u=!0,C):U===63?(e.consume(U),c=3,s.interrupt?r:D):cn(U)?(e.consume(U),p=String.fromCharCode(U),v):i(U)}function b(U){return U===45?(e.consume(U),c=2,S):U===91?(e.consume(U),c=5,l=0,k):cn(U)?(e.consume(U),c=4,s.interrupt?r:D):i(U)}function S(U){return U===45?(e.consume(U),s.interrupt?r:D):i(U)}function k(U){const K="CDATA[";return U===K.charCodeAt(l++)?(e.consume(U),l===K.length?s.interrupt?r:Y:k):i(U)}function C(U){return cn(U)?(e.consume(U),p=String.fromCharCode(U),v):i(U)}function v(U){if(U===null||U===47||U===62||vt(U)){const K=U===47,ee=p.toLowerCase();return!K&&!u&&lv.includes(ee)?(c=1,s.interrupt?r(U):Y(U)):I2.includes(p.toLowerCase())?(c=6,K?(e.consume(U),y):s.interrupt?r(U):Y(U)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(U):u?x(U):_(U))}return U===45||sn(U)?(e.consume(U),p+=String.fromCharCode(U),v):i(U)}function y(U){return U===62?(e.consume(U),s.interrupt?r:Y):i(U)}function x(U){return Qe(U)?(e.consume(U),x):z(U)}function _(U){return U===47?(e.consume(U),z):U===58||U===95||cn(U)?(e.consume(U),j):Qe(U)?(e.consume(U),_):z(U)}function j(U){return U===45||U===46||U===58||U===95||sn(U)?(e.consume(U),j):A(U)}function A(U){return U===61?(e.consume(U),N):Qe(U)?(e.consume(U),A):_(U)}function N(U){return U===null||U===60||U===61||U===62||U===96?i(U):U===34||U===39?(e.consume(U),d=U,R):Qe(U)?(e.consume(U),N):T(U)}function R(U){return U===d?(e.consume(U),d=null,I):U===null||Me(U)?i(U):(e.consume(U),R)}function T(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||vt(U)?A(U):(e.consume(U),T)}function I(U){return U===47||U===62||Qe(U)?_(U):i(U)}function z(U){return U===62?(e.consume(U),V):i(U)}function V(U){return U===null||Me(U)?Y(U):Qe(U)?(e.consume(U),V):i(U)}function Y(U){return U===45&&c===2?(e.consume(U),B):U===60&&c===1?(e.consume(U),X):U===62&&c===4?(e.consume(U),L):U===63&&c===3?(e.consume(U),D):U===93&&c===5?(e.consume(U),O):Me(U)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check(z2,q,$)(U)):U===null||Me(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),Y)}function $(U){return e.check(H2,F,q)(U)}function F(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),P}function P(U){return U===null||Me(U)?$(U):(e.enter("htmlFlowData"),Y(U))}function B(U){return U===45?(e.consume(U),D):Y(U)}function X(U){return U===47?(e.consume(U),p="",Q):Y(U)}function Q(U){if(U===62){const K=p.toLowerCase();return lv.includes(K)?(e.consume(U),L):Y(U)}return cn(U)&&p.length<8?(e.consume(U),p+=String.fromCharCode(U),Q):Y(U)}function O(U){return U===93?(e.consume(U),D):Y(U)}function D(U){return U===62?(e.consume(U),L):U===45&&c===2?(e.consume(U),D):Y(U)}function L(U){return U===null||Me(U)?(e.exit("htmlFlowData"),q(U)):(e.consume(U),L)}function q(U){return e.exit("htmlFlow"),r(U)}}function U2(e,r,i){const s=this;return c;function c(p){return Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):i(p)}function u(p){return s.parser.lazy[s.now().line]?i(p):r(p)}}function $2(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(to,r,i)}}const q2={name:"htmlText",tokenize:W2};function W2(e,r,i){const s=this;let c,u,p;return l;function l(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),f):D===47?(e.consume(D),A):D===63?(e.consume(D),_):cn(D)?(e.consume(D),T):i(D)}function f(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),u=0,k):cn(D)?(e.consume(D),x):i(D)}function g(D){return D===45?(e.consume(D),S):i(D)}function m(D){return D===null?i(D):D===45?(e.consume(D),b):Me(D)?(p=m,X(D)):(e.consume(D),m)}function b(D){return D===45?(e.consume(D),S):m(D)}function S(D){return D===62?B(D):D===45?b(D):m(D)}function k(D){const L="CDATA[";return D===L.charCodeAt(u++)?(e.consume(D),u===L.length?C:k):i(D)}function C(D){return D===null?i(D):D===93?(e.consume(D),v):Me(D)?(p=C,X(D)):(e.consume(D),C)}function v(D){return D===93?(e.consume(D),y):C(D)}function y(D){return D===62?B(D):D===93?(e.consume(D),y):C(D)}function x(D){return D===null||D===62?B(D):Me(D)?(p=x,X(D)):(e.consume(D),x)}function _(D){return D===null?i(D):D===63?(e.consume(D),j):Me(D)?(p=_,X(D)):(e.consume(D),_)}function j(D){return D===62?B(D):_(D)}function A(D){return cn(D)?(e.consume(D),N):i(D)}function N(D){return D===45||sn(D)?(e.consume(D),N):R(D)}function R(D){return Me(D)?(p=R,X(D)):Qe(D)?(e.consume(D),R):B(D)}function T(D){return D===45||sn(D)?(e.consume(D),T):D===47||D===62||vt(D)?I(D):i(D)}function I(D){return D===47?(e.consume(D),B):D===58||D===95||cn(D)?(e.consume(D),z):Me(D)?(p=I,X(D)):Qe(D)?(e.consume(D),I):B(D)}function z(D){return D===45||D===46||D===58||D===95||sn(D)?(e.consume(D),z):V(D)}function V(D){return D===61?(e.consume(D),Y):Me(D)?(p=V,X(D)):Qe(D)?(e.consume(D),V):I(D)}function Y(D){return D===null||D===60||D===61||D===62||D===96?i(D):D===34||D===39?(e.consume(D),c=D,$):Me(D)?(p=Y,X(D)):Qe(D)?(e.consume(D),Y):(e.consume(D),F)}function $(D){return D===c?(e.consume(D),c=void 0,P):D===null?i(D):Me(D)?(p=$,X(D)):(e.consume(D),$)}function F(D){return D===null||D===34||D===39||D===60||D===61||D===96?i(D):D===47||D===62||vt(D)?I(D):(e.consume(D),F)}function P(D){return D===47||D===62||vt(D)?I(D):i(D)}function B(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),r):i(D)}function X(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),Q}function Q(D){return Qe(D)?it(e,O,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):O(D)}function O(D){return e.enter("htmlTextData"),p(D)}}const Ah={name:"labelEnd",resolveAll:K2,resolveTo:X2,tokenize:Z2},G2={tokenize:Q2},V2={tokenize:J2},Y2={tokenize:ek};function K2(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Dn(e,0,e.length,i),e}function X2(e,r){let i=e.length,s=0,c,u,p,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(p){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(p=i);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[p][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[p-2][1].start}};return l=[["enter",d,r],["enter",f,r]],l=$n(l,e.slice(u+1,u+s+3)),l=$n(l,[["enter",g,r]]),l=$n(l,Xl(r.parser.constructs.insideSpan.null,e.slice(u+s+4,p-3),r)),l=$n(l,[["exit",g,r],e[p-2],e[p-1],["exit",f,r]]),l=$n(l,e.slice(p+1)),l=$n(l,[["exit",d,r]]),Dn(e,u,e.length,l),e}function Z2(e,r,i){const s=this;let c=s.events.length,u,p;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(b){return u?u._inactive?m(b):(p=s.parser.defined.includes(Kn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),d):i(b)}function d(b){return b===40?e.attempt(G2,g,p?g:m)(b):b===91?e.attempt(V2,g,p?f:m)(b):p?g(b):m(b)}function f(b){return e.attempt(Y2,g,m)(b)}function g(b){return r(b)}function m(b){return u._balanced=!0,i(b)}}function Q2(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return vt(m)?Ua(e,u)(m):u(m)}function u(m){return m===41?g(m):Jb(e,p,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function p(m){return vt(m)?Ua(e,d)(m):g(m)}function l(m){return i(m)}function d(m){return m===34||m===39||m===40?ty(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function f(m){return vt(m)?Ua(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function J2(e,r,i){const s=this;return c;function c(l){return ey.call(s,e,u,p,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(Kn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function p(l){return i(l)}}function ek(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const tk={name:"labelStartImage",resolveAll:Ah.resolveAll,tokenize:nk};function nk(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),p):i(l)}function p(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const rk={name:"labelStartLink",resolveAll:Ah.resolveAll,tokenize:ik};function ik(e,r,i){const s=this;return c;function c(p){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelLink"),u}function u(p){return p===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(p):r(p)}}const Od={name:"lineEnding",tokenize:sk};function sk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),it(e,r,"linePrefix")}}const jl={name:"thematicBreak",tokenize:ak};function ak(e,r,i){let s=0,c;return u;function u(f){return e.enter("thematicBreak"),p(f)}function p(f){return c=f,l(f)}function l(f){return f===c?(e.enter("thematicBreakSequence"),d(f)):s>=3&&(f===null||Me(f))?(e.exit("thematicBreak"),r(f)):i(f)}function d(f){return f===c?(e.consume(f),s++,d):(e.exit("thematicBreakSequence"),Qe(f)?it(e,l,"whitespace")(f):l(f))}}const bn={continuation:{tokenize:uk},exit:hk,name:"list",tokenize:ck},ok={partial:!0,tokenize:fk},lk={partial:!0,tokenize:dk};function ck(e,r,i){const s=this,c=s.events[s.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,p=0;return l;function l(S){const k=s.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||S===s.containerState.marker:rh(S)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(jl,i,f)(S):f(S);if(!s.interrupt||S===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(S)}return i(S)}function d(S){return rh(S)&&++p<10?(e.consume(S),d):(!s.interrupt||p<2)&&(s.containerState.marker?S===s.containerState.marker:S===41||S===46)?(e.exit("listItemValue"),f(S)):i(S)}function f(S){return e.enter("listItemMarker"),e.consume(S),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||S,e.check(to,s.interrupt?i:g,e.attempt(ok,b,m))}function g(S){return s.containerState.initialBlankLine=!0,u++,b(S)}function m(S){return Qe(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),b):i(S)}function b(S){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(S)}}function uk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(to,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,it(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!Qe(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,p(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(lk,r,p)(l))}function p(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,it(e,e.attempt(bn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function dk(e,r,i){const s=this;return it(e,c,"listItemIndent",s.containerState.size+1);function c(u){const p=s.events[s.events.length-1];return p&&p[1].type==="listItemIndent"&&p[2].sliceSerialize(p[1],!0).length===s.containerState.size?r(u):i(u)}}function hk(e){e.exit(this.containerState.type)}function fk(e,r,i){const s=this;return it(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const p=s.events[s.events.length-1];return!Qe(u)&&p&&p[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const cv={name:"setextUnderline",resolveTo:pk,tokenize:mk};function pk(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const p={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",p,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=p,e.push(["exit",p,r]),e}function mk(e,r,i){const s=this;let c;return u;function u(f){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=f,p(f)):i(f)}function p(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===c?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Qe(f)?it(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Me(f)?(e.exit("setextHeadingLine"),r(f)):i(f)}}const gk={tokenize:xk};function xk(e){const r=this,i=e.attempt(to,s,e.attempt(this.parser.constructs.flowInitial,c,it(e,e.attempt(this.parser.constructs.flow,c,e.attempt(S2,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const vk={resolveAll:ry()},bk=ny("string"),yk=ny("text");function ny(e){return{resolveAll:ry(e==="text"?_k:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,p,l);return p;function p(g){return f(g)?u(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return f(g)?(i.exit("data"),u(g)):(i.consume(g),d)}function f(g){if(g===null)return!0;const m=c[g];let b=-1;if(m)for(;++b<m.length;){const S=m[b];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function ry(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function _k(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let u=c.length,p=-1,l=0,d;for(;u--;){const f=c[u];if(typeof f=="string"){for(p=f.length;f.charCodeAt(p-1)===32;)l++,p--;if(p)break;p=-1}else if(f===-2)d=!0,l++;else if(f!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const f={type:i===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?p:s.start._bufferIndex+p,_index:s.start._index+u,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(e.splice(i,0,["enter",f,r],["exit",f,r]),i+=2)}i++}return e}const Sk={42:bn,43:bn,45:bn,48:bn,49:bn,50:bn,51:bn,52:bn,53:bn,54:bn,55:bn,56:bn,57:bn,62:Kb},wk={91:j2},Ck={[-2]:Md,[-1]:Md,32:Md},kk={35:L2,42:jl,45:[cv,jl],60:B2,61:cv,95:jl,96:ov,126:ov},Ek={38:Zb,92:Xb},jk={[-5]:Od,[-4]:Od,[-3]:Od,33:tk,38:Zb,42:ih,60:[r2,q2],91:rk,92:[D2,Xb],93:Ah,95:ih,96:g2},Nk={null:[ih,vk]},Tk={null:[42,95]},Ak={null:[]},Dk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Tk,contentInitial:wk,disable:Ak,document:Sk,flow:kk,flowInitial:Ck,insideSpan:Nk,string:Ek,text:jk},Symbol.toStringTag,{value:"Module"}));function Rk(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let p=[],l=[];const d={attempt:R(A),check:R(N),consume:x,enter:_,exit:j,interrupt:R(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:S,write:m};let g=r.tokenize.call(f,d);return r.resolveAll&&u.push(r),f;function m(V){return p=$n(p,V),v(),p[p.length-1]!==null?[]:(T(r,0),f.events=Xl(u,f.events,f),f.events)}function b(V,Y){return Mk(S(V),Y)}function S(V){return Lk(p,V)}function k(){const{_bufferIndex:V,_index:Y,line:$,column:F,offset:P}=s;return{_bufferIndex:V,_index:Y,line:$,column:F,offset:P}}function C(V){c[V.line]=V.column,z()}function v(){let V;for(;s._index<p.length;){const Y=p[s._index];if(typeof Y=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<Y.length;)y(Y.charCodeAt(s._bufferIndex));else y(Y)}}function y(V){g=g(V)}function x(V){Me(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,z()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===p[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=V}function _(V,Y){const $=Y||{};return $.type=V,$.start=k(),f.events.push(["enter",$,f]),l.push($),$}function j(V){const Y=l.pop();return Y.end=k(),f.events.push(["exit",Y,f]),Y}function A(V,Y){T(V,Y.from)}function N(V,Y){Y.restore()}function R(V,Y){return $;function $(F,P,B){let X,Q,O,D;return Array.isArray(F)?q(F):"tokenize"in F?q([F]):L(F);function L(ne){return Z;function Z(W){const ae=W!==null&&ne[W],se=W!==null&&ne.null,pe=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(se)?se:se?[se]:[]];return q(pe)(W)}}function q(ne){return X=ne,Q=0,ne.length===0?B:U(ne[Q])}function U(ne){return Z;function Z(W){return D=I(),O=ne,ne.partial||(f.currentConstruct=ne),ne.name&&f.parser.constructs.disable.null.includes(ne.name)?ee():ne.tokenize.call(Y?Object.assign(Object.create(f),Y):f,d,K,ee)(W)}}function K(ne){return V(O,D),P}function ee(ne){return D.restore(),++Q<X.length?U(X[Q]):B}}}function T(V,Y){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Dn(f.events,Y,f.events.length-Y,V.resolve(f.events.slice(Y),f)),V.resolveTo&&(f.events=V.resolveTo(f.events,f))}function I(){const V=k(),Y=f.previous,$=f.currentConstruct,F=f.events.length,P=Array.from(l);return{from:F,restore:B};function B(){s=V,f.previous=Y,f.currentConstruct=$,f.events.length=F,l=P,z()}}function z(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function Lk(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let p;if(i===c)p=[e[i].slice(s,u)];else{if(p=e.slice(i,c),s>-1){const l=p[0];typeof l=="string"?p[0]=l.slice(s):p.shift()}u>0&&p.push(e[c].slice(0,u))}return p}function Mk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];let p;if(typeof u=="string")p=u;else switch(u){case-5:{p="\r";break}case-4:{p=`
92
- `;break}case-3:{p=`\r
93
- `;break}case-2:{p=r?" ":" ";break}case-1:{if(!r&&c)continue;p=" ";break}default:p=String.fromCharCode(u)}c=u===-2,s.push(p)}return s.join("")}function Ok(e){const s={constructs:Vb([Dk,...(e||{}).extensions||[]]),content:c(XC),defined:[],document:c(QC),flow:c(gk),lazy:{},string:c(bk),text:c(yk)};return s;function c(u){return p;function p(l){return Rk(s,u,l)}}}function Ik(e){for(;!Qb(e););return e}const uv=/[\0\t\n\r]/g;function Bk(){let e=1,r="",i=!0,s;return c;function c(u,p,l){const d=[];let f,g,m,b,S;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(p||void 0).decode(u)),m=0,r="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(uv.lastIndex=m,f=uv.exec(u),b=f&&f.index!==void 0?f.index:u.length,S=u.charCodeAt(b),!f){r=u.slice(m);break}if(S===10&&m===b&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<b&&(d.push(u.slice(m,b)),e+=b-m),S){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}m=b+1}return l&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const zk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Hk(e){return e.replace(zk,Pk)}function Pk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),u=c===120||c===88;return Yb(i.slice(u?2:1),u?16:10)}return Ya(i)||e}const iy={}.hasOwnProperty;function Fk(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),Uk(i)(Ik(Ok(i).document().write(Bk()(e,r,!0))))}function Uk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(ut),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(Le),blockQuote:u(se),characterEscape:I,characterReference:I,codeFenced:u(pe),codeFencedFenceInfo:p,codeFencedFenceMeta:p,codeIndented:u(pe,p),codeText:u(be,p),codeTextData:I,data:I,codeFlowValue:I,definition:u(je),definitionDestinationString:p,definitionLabelString:p,definitionTitleString:p,emphasis:u(Ne),hardBreakEscape:u(Ue),hardBreakTrailing:u(Ue),htmlFlow:u(we,p),htmlFlowData:I,htmlText:u(we,p),htmlTextData:I,image:u(ct),label:p,link:u(ut),listItem:u(xe),listItemValue:b,listOrdered:u(jt,m),listUnordered:u(jt),paragraph:u(ze),reference:U,referenceString:p,resourceDestinationString:p,resourceTitleString:p,setextHeading:u(Le),strong:u(Pe),thematicBreak:u(ot)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:W,blockQuote:d(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ne,characterReference:Z,codeFenced:d(v),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:k,codeFlowValue:z,codeIndented:d(y),codeText:d(P),codeTextData:z,data:z,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:_,emphasis:d(),hardBreakEscape:d(Y),hardBreakTrailing:d(Y),htmlFlow:d($),htmlFlowData:z,htmlText:d(F),htmlTextData:z,image:d(X),label:O,labelText:Q,lineEnding:V,link:d(B),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:D,resourceTitleString:L,resource:q,setextHeading:d(T),setextHeadingLineSequence:R,setextHeadingText:N,strong:d(),thematicBreak:d()}};sy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let ve={type:"root",children:[]};const Te={stack:[ve],tokenStack:[],config:r,enter:l,exit:f,buffer:p,resume:g,data:i},He=[];let ie=-1;for(;++ie<ue.length;)if(ue[ie][1].type==="listOrdered"||ue[ie][1].type==="listUnordered")if(ue[ie][0]==="enter")He.push(ie);else{const ke=He.pop();ie=c(ue,ke,ie)}for(ie=-1;++ie<ue.length;){const ke=r[ue[ie][0]];iy.call(ke,ue[ie][1].type)&&ke[ue[ie][1].type].call(Object.assign({sliceSerialize:ue[ie][2].sliceSerialize},Te),ue[ie][1])}if(Te.tokenStack.length>0){const ke=Te.tokenStack[Te.tokenStack.length-1];(ke[1]||dv).call(Te,void 0,ke[0])}for(ve.position={start:Jr(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Jr(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},ie=-1;++ie<r.transforms.length;)ve=r.transforms[ie](ve)||ve;return ve}function c(ue,ve,Te){let He=ve-1,ie=-1,ke=!1,Ae,Ve,Ye,_t;for(;++He<=Te;){const Je=ue[He];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?ie++:ie--,_t=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Ae&&!_t&&!ie&&!Ye&&(Ye=He),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!ie&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||ie===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Ae){let dn=He;for(Ve=void 0;dn--;){const he=ue[dn];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;Ve&&(ue[Ve][1].type="lineEndingBlank",ke=!0),he[1].type="lineEnding",Ve=dn}else if(!(he[1].type==="linePrefix"||he[1].type==="blockQuotePrefix"||he[1].type==="blockQuotePrefixWhitespace"||he[1].type==="blockQuoteMarker"||he[1].type==="listItemIndent"))break}Ye&&(!Ve||Ye<Ve)&&(Ae._spread=!0),Ae.end=Object.assign({},Ve?ue[Ve][1].start:Je[1].end),ue.splice(Ve||He,0,["exit",Ae,Je[2]]),He++,Te++}if(Je[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Ae=dn,ue.splice(He,0,["enter",dn,Je[2]]),He++,Te++,Ye=void 0,_t=!0}}}return ue[ve][1]._spread=ke,Te}function u(ue,ve){return Te;function Te(He){l.call(this,ue(He),He),ve&&ve.call(this,He)}}function p(){this.stack.push({type:"fragment",children:[]})}function l(ue,ve,Te){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ve,Te||void 0]),ue.position={start:Jr(ve.start),end:void 0}}function d(ue){return ve;function ve(Te){ue&&ue.call(this,Te),f.call(this,Te)}}function f(ue,ve){const Te=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==ue.type&&(ve?ve.call(this,ue,He[0]):(He[1]||dv).call(this,ue,He[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Fa({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=Jr(ue.end)}function g(){return Th(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function b(ue){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function S(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ue}function k(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue.replace(/(\r?\n|\r)$/g,"")}function x(ue){const ve=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ve,Te.identifier=Kn(this.sliceSerialize(ue)).toLowerCase()}function _(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ue}function j(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ue}function A(ue){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Te=this.sliceSerialize(ue).length;ve.depth=Te}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function R(ue){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ue){const Te=this.stack[this.stack.length-1].children;let He=Te[Te.length-1];(!He||He.type!=="text")&&(He=qe(),He.position={start:Jr(ue.start),end:void 0},Te.push(He)),this.stack.push(He)}function z(ue){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ue),ve.position.end=Jr(ue.end)}function V(ue){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=ve.children[ve.children.length-1];Te.position.end=Jr(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(ve.type)&&(I.call(this,ue),z.call(this,ue))}function Y(){this.data.atHardBreak=!0}function $(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function F(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function P(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ue}function B(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ve,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function X(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ve,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Q(ue){const ve=this.sliceSerialize(ue),Te=this.stack[this.stack.length-2];Te.label=Hk(ve),Te.identifier=Kn(ve).toLowerCase()}function O(){const ue=this.stack[this.stack.length-1],ve=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const He=ue.children;Te.children=He}else Te.alt=ve}function D(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ue}function L(){const ue=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ue}function q(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function K(ue){const ve=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ve,Te.identifier=Kn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function ee(ue){this.data.characterReferenceType=ue.type}function ne(ue){const ve=this.sliceSerialize(ue),Te=this.data.characterReferenceType;let He;Te?(He=Yb(ve,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=Ya(ve);const ie=this.stack[this.stack.length-1];ie.value+=He}function Z(ue){const ve=this.stack.pop();ve.position.end=Jr(ue.end)}function W(ue){z.call(this,ue);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ue)}function ae(ue){z.call(this,ue);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ue)}function se(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function Le(){return{type:"heading",depth:0,children:[]}}function Ue(){return{type:"break"}}function we(){return{type:"html",value:""}}function ct(){return{type:"image",title:null,url:"",alt:null}}function ut(){return{type:"link",title:null,url:"",children:[]}}function jt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function xe(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Pe(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function ot(){return{type:"thematicBreak"}}}function Jr(e){return{line:e.line,column:e.column,offset:e.offset}}function sy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?sy(e,s):$k(e,s)}}function $k(e,r){let i;for(i in r)if(iy.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function dv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Fa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is still open")}function qk(e){const r=this;r.parser=i;function i(s){return Fk(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Wk(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function Gk(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
94
- `}]}function Vk(e,r){const i=r.value?r.value+`
95
- `:"",s={},c=r.lang?r.lang.split(/\s+/):[];c.length>0&&(s.className=["language-"+c[0]]);let u={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(u.data={meta:r.meta}),e.patch(r,u),u=e.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(r,u),u}function Yk(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Kk(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Xk(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),c=Os(s.toLowerCase()),u=e.footnoteOrder.indexOf(s);let p,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),p=e.footnoteOrder.length):p=u+1,l+=1,e.footnoteCounts.set(s,l);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+c,id:i+"fnref-"+c+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(p)}]};e.patch(r,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,f),e.applyData(r,f)}function Zk(e,r){const i={type:"element",tagName:"h"+r.depth,properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function Qk(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function ay(e,r){const i=r.referenceType;let s="]";if(i==="collapsed"?s+="[]":i==="full"&&(s+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+s}];const c=e.all(r),u=c[0];u&&u.type==="text"?u.value="["+u.value:c.unshift({type:"text",value:"["});const p=c[c.length-1];return p&&p.type==="text"?p.value+=s:c.push({type:"text",value:s}),c}function Jk(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return ay(e,r);const c={src:Os(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"img",properties:c,children:[]};return e.patch(r,u),e.applyData(r,u)}function eE(e,r){const i={src:Os(r.url)};r.alt!==null&&r.alt!==void 0&&(i.alt=r.alt),r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(r,s),e.applyData(r,s)}function tE(e,r){const i={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};e.patch(r,i);const s={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(r,s),e.applyData(r,s)}function nE(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return ay(e,r);const c={href:Os(s.url||"")};s.title!==null&&s.title!==void 0&&(c.title=s.title);const u={type:"element",tagName:"a",properties:c,children:e.all(r)};return e.patch(r,u),e.applyData(r,u)}function rE(e,r){const i={href:Os(r.url)};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function iE(e,r,i){const s=e.all(r),c=i?sE(i):oy(r),u={},p=[];if(typeof r.checked=="boolean"){const g=s[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(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:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const g=s[l];(c||l!==0||g.type!=="element"||g.tagName!=="p")&&p.push({type:"text",value:`
96
- `}),g.type==="element"&&g.tagName==="p"&&!c?p.push(...g.children):p.push(g)}const d=s[s.length-1];d&&(c||d.type!=="element"||d.tagName!=="p")&&p.push({type:"text",value:`
97
- `});const f={type:"element",tagName:"li",properties:u,children:p};return e.patch(r,f),e.applyData(r,f)}function sE(e){let r=!1;if(e.type==="list"){r=e.spread||!1;const i=e.children;let s=-1;for(;!r&&++s<i.length;)r=oy(i[s])}return r}function oy(e){const r=e.spread;return r??e.children.length>1}function aE(e,r){const i={},s=e.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++c<s.length;){const p=s[c];if(p.type==="element"&&p.tagName==="li"&&p.properties&&Array.isArray(p.properties.className)&&p.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,u),e.applyData(r,u)}function oE(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function lE(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function cE(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function uE(e,r){const i=e.all(r),s=i.shift(),c=[];if(s){const p={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],p),c.push(p)}if(i.length>0){const p={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},l=kh(r.children[1]),d=Pb(r.children[r.children.length-1]);l&&d&&(p.position={start:l,end:d}),c.push(p)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(c,!0)};return e.patch(r,u),e.applyData(r,u)}function dE(e,r,i){const s=i?i.children:void 0,u=(s?s.indexOf(r):1)===0?"th":"td",p=i&&i.type==="table"?i.align:void 0,l=p?p.length:r.children.length;let d=-1;const f=[];for(;++d<l;){const m=r.children[d],b={},S=p?p[d]:void 0;S&&(b.align=S);let k={type:"element",tagName:u,properties:b,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),f.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(r,g),e.applyData(r,g)}function hE(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const hv=9,fv=32;function fE(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),c=0;const u=[];for(;s;)u.push(pv(r.slice(c,s.index),c>0,!0),s[0]),c=s.index+s[0].length,s=i.exec(r);return u.push(pv(r.slice(c),c>0,!1)),u.join("")}function pv(e,r,i){let s=0,c=e.length;if(r){let u=e.codePointAt(s);for(;u===hv||u===fv;)s++,u=e.codePointAt(s)}if(i){let u=e.codePointAt(c-1);for(;u===hv||u===fv;)c--,u=e.codePointAt(c-1)}return c>s?e.slice(s,c):""}function pE(e,r){const i={type:"text",value:fE(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function mE(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const gE={blockquote:Wk,break:Gk,code:Vk,delete:Yk,emphasis:Kk,footnoteReference:Xk,heading:Zk,html:Qk,imageReference:Jk,image:eE,inlineCode:tE,linkReference:nE,link:rE,listItem:iE,list:aE,paragraph:oE,root:lE,strong:cE,table:uE,tableCell:hE,tableRow:dE,text:pE,thematicBreak:mE,toml:_l,yaml:_l,definition:_l,footnoteDefinition:_l};function _l(){}const ly=-1,Zl=0,$a=1,Ml=2,Dh=3,Rh=4,Lh=5,Mh=6,cy=7,uy=8,mv=typeof self=="object"?self:globalThis,xE=(e,r)=>{const i=(c,u)=>(e.set(u,c),c),s=c=>{if(e.has(c))return e.get(c);const[u,p]=r[c];switch(u){case Zl:case ly:return i(p,c);case $a:{const l=i([],c);for(const d of p)l.push(s(d));return l}case Ml:{const l=i({},c);for(const[d,f]of p)l[s(d)]=s(f);return l}case Dh:return i(new Date(p),c);case Rh:{const{source:l,flags:d}=p;return i(new RegExp(l,d),c)}case Lh:{const l=i(new Map,c);for(const[d,f]of p)l.set(s(d),s(f));return l}case Mh:{const l=i(new Set,c);for(const d of p)l.add(s(d));return l}case cy:{const{name:l,message:d}=p;return i(new mv[l](d),c)}case uy:return i(BigInt(p),c);case"BigInt":return i(Object(BigInt(p)),c);case"ArrayBuffer":return i(new Uint8Array(p).buffer,p);case"DataView":{const{buffer:l}=new Uint8Array(p);return i(new DataView(l),p)}}return i(new mv[u](p),c)};return s},gv=e=>xE(new Map,e)(0),Ss="",{toString:vE}={},{keys:bE}=Object,Ia=e=>{const r=typeof e;if(r!=="object"||!e)return[Zl,r];const i=vE.call(e).slice(8,-1);switch(i){case"Array":return[$a,Ss];case"Object":return[Ml,Ss];case"Date":return[Dh,Ss];case"RegExp":return[Rh,Ss];case"Map":return[Lh,Ss];case"Set":return[Mh,Ss];case"DataView":return[$a,i]}return i.includes("Array")?[$a,i]:i.includes("Error")?[cy,i]:[Ml,i]},Sl=([e,r])=>e===Zl&&(r==="function"||r==="symbol"),yE=(e,r,i,s)=>{const c=(p,l)=>{const d=s.push(p)-1;return i.set(l,d),d},u=p=>{if(i.has(p))return i.get(p);let[l,d]=Ia(p);switch(l){case Zl:{let g=p;switch(d){case"bigint":l=uy,g=p.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return c([ly],p)}return c([l,g],p)}case $a:{if(d){let b=p;return d==="DataView"?b=new Uint8Array(p.buffer):d==="ArrayBuffer"&&(b=new Uint8Array(p)),c([d,[...b]],p)}const g=[],m=c([l,g],p);for(const b of p)g.push(u(b));return m}case Ml:{if(d)switch(d){case"BigInt":return c([d,p.toString()],p);case"Boolean":case"Number":case"String":return c([d,p.valueOf()],p)}if(r&&"toJSON"in p)return u(p.toJSON());const g=[],m=c([l,g],p);for(const b of bE(p))(e||!Sl(Ia(p[b])))&&g.push([u(b),u(p[b])]);return m}case Dh:return c([l,p.toISOString()],p);case Rh:{const{source:g,flags:m}=p;return c([l,{source:g,flags:m}],p)}case Lh:{const g=[],m=c([l,g],p);for(const[b,S]of p)(e||!(Sl(Ia(b))||Sl(Ia(S))))&&g.push([u(b),u(S)]);return m}case Mh:{const g=[],m=c([l,g],p);for(const b of p)(e||!Sl(Ia(b)))&&g.push(u(b));return m}}const{message:f}=p;return c([l,{name:d,message:f}],p)};return u},xv=(e,{json:r,lossy:i}={})=>{const s=[];return yE(!(r||i),!!r,new Map,s)(e),s},Ol=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?gv(xv(e,r)):structuredClone(e):(e,r)=>gv(xv(e,r));function _E(e,r){const i=[{type:"text",value:"↩"}];return r>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),i}function SE(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function wE(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||_E,s=e.options.footnoteBackLabel||SE,c=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",p=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const g=e.all(f),m=String(f.identifier).toUpperCase(),b=Os(m.toLowerCase());let S=0;const k=[],C=e.footnoteCounts.get(m);for(;C!==void 0&&++S<=C;){k.length>0&&k.push({type:"text",value:" "});let x=typeof i=="string"?i:i(d,S);typeof x=="string"&&(x={type:"text",value:x}),k.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,S),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=g[g.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...k)}else g.push(...k);const y={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:e.wrap(g,!0)};e.patch(f,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Ol(p),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
98
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
99
- `}]}}const Ql=(function(e){if(e==null)return jE;if(typeof e=="function")return Jl(e);if(typeof e=="object")return Array.isArray(e)?CE(e):kE(e);if(typeof e=="string")return EE(e);throw new Error("Expected function, string, or object as test")});function CE(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ql(e[i]);return Jl(s);function s(...c){let u=-1;for(;++u<r.length;)if(r[u].apply(this,c))return!0;return!1}}function kE(e){const r=e;return Jl(i);function i(s){const c=s;let u;for(u in e)if(c[u]!==r[u])return!1;return!0}}function EE(e){return Jl(r);function r(i){return i&&i.type===e}}function Jl(e){return r;function r(i,s,c){return!!(NE(i)&&e.call(this,i,typeof s=="number"?s:void 0,c||void 0))}}function jE(){return!0}function NE(e){return e!==null&&typeof e=="object"&&"type"in e}const dy=[],TE=!0,sh=!1,AE="skip";function hy(e,r,i,s){let c;typeof r=="function"&&typeof i!="function"?(s=i,i=r):c=r;const u=Ql(c),p=s?-1:1;l(e,void 0,[])();function l(d,f,g){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const S=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(d.type+(S?"<"+S+">":""))+")"})}return b;function b(){let S=dy,k,C,v;if((!r||u(d,f,g[g.length-1]||void 0))&&(S=DE(i(d,g)),S[0]===sh))return S;if("children"in d&&d.children){const y=d;if(y.children&&S[0]!==AE)for(C=(s?y.children.length:-1)+p,v=g.concat(y);C>-1&&C<y.children.length;){const x=y.children[C];if(k=l(x,C,v)(),k[0]===sh)return k;C=typeof k[1]=="number"?k[1]:C+p}}return S}}}function DE(e){return Array.isArray(e)?e:typeof e=="number"?[TE,e]:e==null?dy:[e]}function Oh(e,r,i,s){let c,u,p;typeof r=="function"&&typeof i!="function"?(u=void 0,p=r,c=i):(u=r,p=i,c=s),hy(e,u,l,c);function l(d,f){const g=f[f.length-1],m=g?g.children.indexOf(d):void 0;return p(d,m,g)}}const ah={}.hasOwnProperty,RE={};function LE(e,r){const i=r||RE,s=new Map,c=new Map,u=new Map,p={...gE,...i.handlers},l={all:f,applyData:OE,definitionById:s,footnoteById:c,footnoteCounts:u,footnoteOrder:[],handlers:p,one:d,options:i,patch:ME,wrap:BE};return Oh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?s:c,b=String(g.identifier).toUpperCase();m.has(b)||m.set(b,g)}}),l;function d(g,m){const b=g.type,S=l.handlers[b];if(ah.call(l.handlers,b)&&S)return S(l,g,m);if(l.options.passThrough&&l.options.passThrough.includes(b)){if("children"in g){const{children:C,...v}=g,y=Ol(v);return y.children=l.all(g),y}return Ol(g)}return(l.options.unknownHandler||IE)(l,g,m)}function f(g){const m=[];if("children"in g){const b=g.children;let S=-1;for(;++S<b.length;){const k=l.one(b[S],g);if(k){if(S&&b[S-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=vv(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=vv(C.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function ME(e,r){e.position&&(r.position=SC(e))}function OE(e,r){let i=r;if(e&&e.data){const s=e.data.hName,c=e.data.hChildren,u=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const p="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:p}}i.type==="element"&&u&&Object.assign(i.properties,Ol(u)),"children"in i&&i.children&&c!==null&&c!==void 0&&(i.children=c)}return i}function IE(e,r){const i=r.data||{},s="value"in r&&!(ah.call(i,"hProperties")||ah.call(i,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:e.all(r)};return e.patch(r,s),e.applyData(r,s)}function BE(e,r){const i=[];let s=-1;for(r&&i.push({type:"text",value:`
100
- `});++s<e.length;)s&&i.push({type:"text",value:`
101
- `}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
102
- `}),i}function vv(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function bv(e,r){const i=LE(e,r),s=i.one(e,void 0),c=wE(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
103
- `},c),u}function zE(e,r){return e&&"run"in e?async function(i,s){const c=bv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return bv(i,{file:s,...e||r})}}function yv(e){if(e)throw e}var Id,_v;function HE(){if(_v)return Id;_v=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(f){return typeof Array.isArray=="function"?Array.isArray(f):r.call(f)==="[object Array]"},u=function(f){if(!f||r.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!m)return!1;var b;for(b in f);return typeof b>"u"||e.call(f,b)},p=function(f,g){i&&g.name==="__proto__"?i(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},l=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(s)return s(f,g).value}else return;return f[g]};return Id=function d(){var f,g,m,b,S,k,C=arguments[0],v=1,y=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<y;++v)if(f=arguments[v],f!=null)for(g in f)m=l(C,g),b=l(f,g),C!==b&&(x&&b&&(u(b)||(S=c(b)))?(S?(S=!1,k=m&&c(m)?m:[]):k=m&&u(m)?m:{},p(C,{name:g,newValue:d(x,k,b)})):typeof b<"u"&&p(C,{name:g,newValue:b}));return C},Id}var PE=HE();const Bd=Hl(PE);function oh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function FE(){const e=[],r={run:i,use:s};return r;function i(...c){let u=-1;const p=c.pop();if(typeof p!="function")throw new TypeError("Expected function as last argument, not "+p);l(null,...c);function l(d,...f){const g=e[++u];let m=-1;if(d){p(d);return}for(;++m<c.length;)(f[m]===null||f[m]===void 0)&&(f[m]=c[m]);c=f,g?UE(g,l)(...f):p(null,...f)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function UE(e,r){let i;return s;function s(...p){const l=e.length>p.length;let d;l&&p.push(c);try{d=e.apply(this,p)}catch(f){const g=f;if(l&&i)throw g;return c(g)}l||(d&&d.then&&typeof d.then=="function"?d.then(u,c):d instanceof Error?c(d):u(d))}function c(p,...l){i||(i=!0,r(p,...l))}function u(p){c(null,p)}}const nr={basename:$E,dirname:qE,extname:WE,join:GE,sep:"/"};function $E(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');no(e);let i=0,s=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let p=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else p<0&&(u=!0,p=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=p));return i===s?s=p:s<0&&(s=e.length),e.slice(i,s)}function qE(e){if(no(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function WE(e){no(e);let r=e.length,i=-1,s=0,c=-1,u=0,p;for(;r--;){const l=e.codePointAt(r);if(l===47){if(p){s=r+1;break}continue}i<0&&(p=!0,i=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function GE(...e){let r=-1,i;for(;++r<e.length;)no(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":VE(i)}function VE(e){no(e);const r=e.codePointAt(0)===47;let i=YE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function YE(e,r){let i="",s=0,c=-1,u=0,p=-1,l,d;for(;++p<=e.length;){if(p<e.length)l=e.codePointAt(p);else{if(l===47)break;l=47}if(l===47){if(!(c===p-1||u===1))if(c!==p-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),c=p,u=0;continue}}else if(i.length>0){i="",s=0,c=p,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,p):i=e.slice(c+1,p),s=p-c-1;c=p,u=0}else l===46&&u>-1?u++:u=-1}return i}function no(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const KE={cwd:XE};function XE(){return"/"}function lh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ZE(e){if(typeof e=="string")e=new URL(e);else if(!lh(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return QE(e)}function QE(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 r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const zd=["history","path","basename","stem","extname","dirname"];class fy{constructor(r){let i;r?lh(r)?i={path:r}:typeof r=="string"||JE(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":KE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<zd.length;){const u=zd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)zd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?nr.basename(this.path):void 0}set basename(r){Pd(r,"basename"),Hd(r,"basename"),this.path=nr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?nr.dirname(this.path):void 0}set dirname(r){Sv(this.basename,"dirname"),this.path=nr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?nr.extname(this.path):void 0}set extname(r){if(Hd(r,"extname"),Sv(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=nr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){lh(r)&&(r=ZE(r)),Pd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?nr.basename(this.path,this.extname):void 0}set stem(r){Pd(r,"stem"),Hd(r,"stem"),this.path=nr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new an(r,i,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Hd(e,r){if(e&&e.includes(nr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+nr.sep+"`")}function Pd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function Sv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function JE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ej=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),tj={}.hasOwnProperty;class Ih extends ej{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=FE()}copy(){const r=new Ih;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Bd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?($d("data",this.frozen),this.namespace[r]=i,this):tj.call(this.namespace,r)&&this.namespace[r]||void 0:r?($d("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=wl(r),s=this.parser||this.Parser;return Fd("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Fd("process",this.parser||this.Parser),Ud("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,p){const l=wl(r),d=s.parse(l);s.run(d,l,function(g,m,b){if(g||!m||!b)return f(g);const S=m,k=s.stringify(S,b);ij(k)?b.value=k:b.result=k,f(g,b)});function f(g,m){g||!m?p(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Fd("processSync",this.parser||this.Parser),Ud("processSync",this.compiler||this.Compiler),this.process(r,c),Cv("processSync","process",i),s;function c(u,p){i=!0,yv(u),s=p}}run(r,i,s){wv(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(p,l){const d=wl(i);c.run(r,d,f);function f(g,m,b){const S=m||r;g?l(g):p?p(S):s(void 0,S,b)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),Cv("runSync","run",s),c;function u(p,l){yv(p),c=l,s=!0}}stringify(r,i){this.freeze();const s=wl(i),c=this.compiler||this.Compiler;return Ud("stringify",c),wv(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if($d("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?l(r):p(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...m]=f;d(g,m)}else p(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function p(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");l(f.plugins),f.settings&&(c.settings=Bd(!0,c.settings,f.settings))}function l(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const m=f[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,g){let m=-1,b=-1;for(;++m<s.length;)if(s[m][0]===f){b=m;break}if(b===-1)s.push([f,...g]);else if(g.length>0){let[S,...k]=g;const C=s[b][1];oh(C)&&oh(S)&&(S=Bd(!0,C,S)),s[b]=[f,S,...k]}}}}const nj=new Ih().freeze();function Fd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ud(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $d(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wv(e){if(!oh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function wl(e){return rj(e)?e:new fy(e)}function rj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ij(e){return typeof e=="string"||sj(e)}function sj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const aj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kv=[],Ev={allowDangerousHtml:!0},oj=/^(https?|ircs?|mailto|xmpp)$/i,lj=[{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 cj(e){const r=uj(e),i=dj(e);return hj(r.runSync(r.parse(i),i),e)}function uj(e){const r=e.rehypePlugins||kv,i=e.remarkPlugins||kv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ev}:Ev;return nj().use(qk).use(i).use(zE,s).use(r)}function dj(e){const r=e.children||"",i=new fy;return typeof r=="string"&&(i.value=r),i}function hj(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,p=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||fj;for(const g of lj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+aj+g.id,void 0);return Oh(e,f),jC(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(g,m,b){if(g.type==="raw"&&b&&typeof m=="number")return p?b.children.splice(m,1):b.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let S;for(S in Ld)if(Object.hasOwn(Ld,S)&&Object.hasOwn(g.properties,S)){const k=g.properties[S],C=Ld[S];(C===null||C.includes(g.tagName))&&(g.properties[S]=d(String(k||""),S,g))}}if(g.type==="element"){let S=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!S&&s&&typeof m=="number"&&(S=!s(g,m,b)),S&&b&&typeof m=="number")return l&&g.children?b.children.splice(m,1,...g.children):b.children.splice(m,1),m}}}function fj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||oj.test(e.slice(0,r))?e:""}function jv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function pj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mj(e,r,i){const c=Ql((i||{}).ignore||[]),u=gj(r);let p=-1;for(;++p<u.length;)hy(e,"text",l);function l(f,g){let m=-1,b;for(;++m<g.length;){const S=g[m],k=b?b.children:void 0;if(c(S,k?k.indexOf(S):void 0,b))return;b=S}if(b)return d(f,g)}function d(f,g){const m=g[g.length-1],b=u[p][0],S=u[p][1];let k=0;const v=m.children.indexOf(f);let y=!1,x=[];b.lastIndex=0;let _=b.exec(f.value);for(;_;){const j=_.index,A={index:_.index,input:_.input,stack:[...g,f]};let N=S(..._,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?b.lastIndex=j+1:(k!==j&&x.push({type:"text",value:f.value.slice(k,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),k=j+_[0].length,y=!0),!b.global)break;_=b.exec(f.value)}return y?(k<f.value.length&&x.push({type:"text",value:f.value.slice(k)}),m.children.splice(v,1,...x)):x=[f],v+x.length}}function gj(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([xj(c[0]),vj(c[1])])}return r}function xj(e){return typeof e=="string"?new RegExp(pj(e),"g"):e}function vj(e){return typeof e=="function"?e:function(){return e}}const qd="phrasing",Wd=["autolink","link","image","label"];function bj(){return{transforms:[Ej],enter:{literalAutolink:_j,literalAutolinkEmail:Gd,literalAutolinkHttp:Gd,literalAutolinkWww:Gd},exit:{literalAutolink:kj,literalAutolinkEmail:Cj,literalAutolinkHttp:Sj,literalAutolinkWww:wj}}}function yj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:qd,notInConstruct:Wd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:qd,notInConstruct:Wd},{character:":",before:"[ps]",after:"\\/",inConstruct:qd,notInConstruct:Wd}]}}function _j(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gd(e){this.config.enter.autolinkProtocol.call(this,e)}function Sj(e){this.config.exit.autolinkProtocol.call(this,e)}function wj(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function Cj(e){this.config.exit.autolinkEmail.call(this,e)}function kj(e){this.exit(e)}function Ej(e){mj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Nj]],{ignore:["link","linkReference"]})}function jj(e,r,i,s,c){let u="";if(!py(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Tj(i)))return!1;const p=Aj(i+s);if(!p[0])return!1;const l={type:"link",title:null,url:u+r+p[0],children:[{type:"text",value:r+p[0]}]};return p[1]?[l,{type:"text",value:p[1]}]:l}function Nj(e,r,i,s){return!py(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Tj(e){const r=e.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function Aj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=jv(e,"(");let u=jv(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function py(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ri(i)||Kl(i))&&(!r||i!==47)}my.peek=Hj;function Dj(){this.buffer()}function Rj(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Lj(){this.buffer()}function Mj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Oj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Kn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Ij(e){this.exit(e)}function Bj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Kn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function zj(e){this.exit(e)}function Hj(){return"["}function my(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const p=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),p(),u+=c.move("]"),u}function Pj(){return{enter:{gfmFootnoteCallString:Dj,gfmFootnoteCall:Rj,gfmFootnoteDefinitionLabelString:Lj,gfmFootnoteDefinition:Mj},exit:{gfmFootnoteCallString:Oj,gfmFootnoteCall:Ij,gfmFootnoteDefinitionLabelString:Bj,gfmFootnoteDefinition:zj}}}function Fj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:my},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,u,p){const l=u.createTracker(p);let d=l.move("[^");const f=u.enter("footnoteDefinition"),g=u.enter("label");return d+=l.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),d+=l.move((r?`
104
- `:" ")+u.indentLines(u.containerFlow(s,l.current()),r?gy:Uj))),f(),d}}function Uj(e,r,i){return r===0?e:gy(e,r,i)}function gy(e,r,i){return(i?"":" ")+e}const $j=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];xy.peek=Yj;function qj(){return{canContainEols:["delete"],enter:{strikethrough:Gj},exit:{strikethrough:Vj}}}function Wj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$j}],handlers:{delete:xy}}}function Gj(e){this.enter({type:"delete",children:[]},e)}function Vj(e){this.exit(e)}function xy(e,r,i,s){const c=i.createTracker(s),u=i.enter("strikethrough");let p=c.move("~~");return p+=i.containerPhrasing(e,{...c.current(),before:p,after:"~"}),p+=c.move("~~"),u(),p}function Yj(){return"~"}function Kj(e){return e.length}function Xj(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||Kj,u=[],p=[],l=[],d=[];let f=0,g=-1;for(;++g<e.length;){const C=[],v=[];let y=-1;for(e[g].length>f&&(f=e[g].length);++y<e[g].length;){const x=Zj(e[g][y]);if(i.alignDelimiters!==!1){const _=c(x);v[y]=_,(d[y]===void 0||_>d[y])&&(d[y]=_)}C.push(x)}p[g]=C,l[g]=v}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)u[m]=Nv(s[m]);else{const C=Nv(s);for(;++m<f;)u[m]=C}m=-1;const b=[],S=[];for(;++m<f;){const C=u[m];let v="",y="";C===99?(v=":",y=":"):C===108?v=":":C===114&&(y=":");let x=i.alignDelimiters===!1?1:Math.max(1,d[m]-v.length-y.length);const _=v+"-".repeat(x)+y;i.alignDelimiters!==!1&&(x=v.length+x+y.length,x>d[m]&&(d[m]=x),S[m]=x),b[m]=_}p.splice(1,0,b),l.splice(1,0,S),g=-1;const k=[];for(;++g<p.length;){const C=p[g],v=l[g];m=-1;const y=[];for(;++m<f;){const x=C[m]||"";let _="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(v[m]||0),N=u[m];N===114?_=" ".repeat(A):N===99?A%2?(_=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(_=" ".repeat(A/2),j=_):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&y.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&x==="")&&(i.delimiterStart!==!1||m)&&y.push(" "),i.alignDelimiters!==!1&&y.push(_),y.push(x),i.alignDelimiters!==!1&&y.push(j),i.padding!==!1&&y.push(" "),(i.delimiterEnd!==!1||m!==f-1)&&y.push("|")}k.push(i.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return k.join(`
105
- `)}function Zj(e){return e==null?"":String(e)}function Nv(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Qj(e,r,i,s){const c=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const p=i.indentLines(i.containerFlow(e,u.current()),Jj);return c(),p}function Jj(e,r,i){return">"+(i?"":" ")+e}function eN(e,r){return Tv(e,r.inConstruct,!0)&&!Tv(e,r.notInConstruct,!1)}function Tv(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Av(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
106
- `&&eN(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
107
- `}function tN(e,r){const i=String(e);let s=i.indexOf(r),c=s,u=0,p=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===c?++u>p&&(p=u):u=1,c=s+r.length,s=i.indexOf(r,c);return p}function nN(e,r){return!!(r.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function rN(e){const r=e.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function iN(e,r,i,s){const c=rN(i),u=e.value||"",p=c==="`"?"GraveAccent":"Tilde";if(nN(e,i)){const m=i.enter("codeIndented"),b=i.indentLines(u,sN);return m(),b}const l=i.createTracker(s),d=c.repeat(Math.max(tN(u,c)+1,3)),f=i.enter("codeFenced");let g=l.move(d);if(e.lang){const m=i.enter(`codeFencedLang${p}`);g+=l.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=i.enter(`codeFencedMeta${p}`);g+=l.move(" "),g+=l.move(i.safe(e.meta,{before:g,after:`
108
- `,encode:["`"],...l.current()})),m()}return g+=l.move(`
109
- `),u&&(g+=l.move(u+`
110
- `)),g+=l.move(d),f(),g}function sN(e,r,i){return(i?"":" ")+e}function Bh(e){const r=e.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function aN(e,r,i,s){const c=Bh(i),u=c==='"'?"Quote":"Apostrophe",p=i.enter("definition");let l=i.enter("label");const d=i.createTracker(s);let f=d.move("[");return f+=d.move(i.safe(i.associationId(e),{before:f,after:"]",...d.current()})),f+=d.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(i.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(l=i.enter("destinationRaw"),f+=d.move(i.safe(e.url,{before:f,after:e.title?" ":`
111
- `,...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),f+=d.move(" "+c),f+=d.move(i.safe(e.title,{before:f,after:c,...d.current()})),f+=d.move(c),l()),p(),f}function oN(e){const r=e.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Ka(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Il(e,r,i){const s=Rs(e),c=Rs(r);return s===void 0?c===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}vy.peek=lN;function vy(e,r,i,s){const c=oN(i),u=i.enter("emphasis"),p=i.createTracker(s),l=p.move(c);let d=p.move(i.containerPhrasing(e,{after:c,before:l,...p.current()}));const f=d.charCodeAt(0),g=Il(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(d=Ka(f)+d.slice(1));const m=d.charCodeAt(d.length-1),b=Il(s.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+Ka(m));const S=p.move(c);return u(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+S}function lN(e,r,i){return i.options.emphasis||"*"}function cN(e,r){let i=!1;return Oh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,sh}),!!((!e.depth||e.depth<3)&&Th(e)&&(r.options.setext||i))}function uN(e,r,i,s){const c=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(s);if(cN(e,i)){const g=i.enter("headingSetext"),m=i.enter("phrasing"),b=i.containerPhrasing(e,{...u.current(),before:`
112
- `,after:`
113
- `});return m(),g(),b+`
114
- `+(c===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
115
- `))+1))}const p="#".repeat(c),l=i.enter("headingAtx"),d=i.enter("phrasing");u.move(p+" ");let f=i.containerPhrasing(e,{before:"# ",after:`
116
- `,...u.current()});return/^[\t ]/.test(f)&&(f=Ka(f.charCodeAt(0))+f.slice(1)),f=f?p+" "+f:p,i.options.closeAtx&&(f+=" "+p),d(),l(),f}by.peek=dN;function by(e){return e.value||""}function dN(){return"<"}yy.peek=hN;function yy(e,r,i,s){const c=Bh(i),u=c==='"'?"Quote":"Apostrophe",p=i.enter("image");let l=i.enter("label");const d=i.createTracker(s);let f=d.move("![");return f+=d.move(i.safe(e.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(i.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(l=i.enter("destinationRaw"),f+=d.move(i.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),f+=d.move(" "+c),f+=d.move(i.safe(e.title,{before:f,after:c,...d.current()})),f+=d.move(c),l()),f+=d.move(")"),p(),f}function hN(){return"!"}_y.peek=fN;function _y(e,r,i,s){const c=e.referenceType,u=i.enter("imageReference");let p=i.enter("label");const l=i.createTracker(s);let d=l.move("![");const f=i.safe(e.alt,{before:d,after:"]",...l.current()});d+=l.move(f+"]["),p();const g=i.stack;i.stack=[],p=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return p(),i.stack=g,u(),c==="full"||!f||f!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function fN(){return"!"}Sy.peek=pN;function Sy(e,r,i){let s=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const p=i.unsafe[u],l=i.compilePattern(p);let d;if(p.atBreak)for(;d=l.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 c+s+c}function pN(){return"`"}function wy(e,r){const i=Th(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Cy.peek=mN;function Cy(e,r,i,s){const c=Bh(i),u=c==='"'?"Quote":"Apostrophe",p=i.createTracker(s);let l,d;if(wy(e,i)){const g=i.stack;i.stack=[],l=i.enter("autolink");let m=p.move("<");return m+=p.move(i.containerPhrasing(e,{before:m,after:">",...p.current()})),m+=p.move(">"),l(),i.stack=g,m}l=i.enter("link"),d=i.enter("label");let f=p.move("[");return f+=p.move(i.containerPhrasing(e,{before:f,after:"](",...p.current()})),f+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),f+=p.move("<"),f+=p.move(i.safe(e.url,{before:f,after:">",...p.current()})),f+=p.move(">")):(d=i.enter("destinationRaw"),f+=p.move(i.safe(e.url,{before:f,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=i.enter(`title${u}`),f+=p.move(" "+c),f+=p.move(i.safe(e.title,{before:f,after:c,...p.current()})),f+=p.move(c),d()),f+=p.move(")"),l(),f}function mN(e,r,i){return wy(e,i)?"<":"["}ky.peek=gN;function ky(e,r,i,s){const c=e.referenceType,u=i.enter("linkReference");let p=i.enter("label");const l=i.createTracker(s);let d=l.move("[");const f=i.containerPhrasing(e,{before:d,after:"]",...l.current()});d+=l.move(f+"]["),p();const g=i.stack;i.stack=[],p=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return p(),i.stack=g,u(),c==="full"||!f||f!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function gN(){return"["}function zh(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function xN(e){const r=zh(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function vN(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Ey(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function bN(e,r,i,s){const c=i.enter("list"),u=i.bulletCurrent;let p=e.ordered?vN(i):zh(i);const l=e.ordered?p==="."?")":".":xN(i);let d=r&&i.bulletLastUsed?p===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((p==="*"||p==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(d=!0),Ey(i)===p&&g){let m=-1;for(;++m<e.children.length;){const b=e.children[m];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(p=l),i.bulletCurrent=p;const f=i.containerFlow(e,s);return i.bulletLastUsed=p,i.bulletCurrent=u,c(),f}function yN(e){const r=e.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function _N(e,r,i,s){const c=yN(i);let u=i.bulletCurrent||zh(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let p=u.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(p=Math.ceil(p/4)*4);const l=i.createTracker(s);l.move(u+" ".repeat(p-u.length)),l.shift(p);const d=i.enter("listItem"),f=i.indentLines(i.containerFlow(e,l.current()),g);return d(),f;function g(m,b,S){return b?(S?"":" ".repeat(p))+m:(S?u:u+" ".repeat(p-u.length))+m}}function SN(e,r,i,s){const c=i.enter("paragraph"),u=i.enter("phrasing"),p=i.containerPhrasing(e,s);return u(),c(),p}const wN=Ql(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CN(e,r,i,s){return(e.children.some(function(p){return wN(p)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function kN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}jy.peek=EN;function jy(e,r,i,s){const c=kN(i),u=i.enter("strong"),p=i.createTracker(s),l=p.move(c+c);let d=p.move(i.containerPhrasing(e,{after:c,before:l,...p.current()}));const f=d.charCodeAt(0),g=Il(s.before.charCodeAt(s.before.length-1),f,c);g.inside&&(d=Ka(f)+d.slice(1));const m=d.charCodeAt(d.length-1),b=Il(s.after.charCodeAt(0),m,c);b.inside&&(d=d.slice(0,-1)+Ka(m));const S=p.move(c+c);return u(),i.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},l+d+S}function EN(e,r,i){return i.options.strong||"*"}function jN(e,r,i,s){return i.safe(e.value,s)}function NN(e){const r=e.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function TN(e,r,i){const s=(Ey(i)+(i.options.ruleSpaces?" ":"")).repeat(NN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Ny={blockquote:Qj,break:Av,code:iN,definition:aN,emphasis:vy,hardBreak:Av,heading:uN,html:by,image:yy,imageReference:_y,inlineCode:Sy,link:Cy,linkReference:ky,list:bN,listItem:_N,paragraph:SN,root:CN,strong:jy,text:jN,thematicBreak:TN};function AN(){return{enter:{table:DN,tableData:Dv,tableHeader:Dv,tableRow:LN},exit:{codeText:MN,table:RN,tableData:Vd,tableHeader:Vd,tableRow:Vd}}}function DN(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function RN(e){this.exit(e),this.data.inTable=void 0}function LN(e){this.enter({type:"tableRow",children:[]},e)}function Vd(e){this.exit(e)}function Dv(e){this.enter({type:"tableCell",children:[]},e)}function MN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,ON));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function ON(e,r){return r==="|"?r:e}function IN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,u=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
117
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:p,tableCell:d,tableRow:l}};function p(S,k,C,v){return f(g(S,C,v),S.align)}function l(S,k,C,v){const y=m(S,C,v),x=f([y]);return x.slice(0,x.indexOf(`
118
- `))}function d(S,k,C,v){const y=C.enter("tableCell"),x=C.enter("phrasing"),_=C.containerPhrasing(S,{...v,before:u,after:u});return x(),y(),_}function f(S,k){return Xj(S,{align:k,alignDelimiters:s,padding:i,stringLength:c})}function g(S,k,C){const v=S.children;let y=-1;const x=[],_=k.enter("table");for(;++y<v.length;)x[y]=m(v[y],k,C);return _(),x}function m(S,k,C){const v=S.children;let y=-1;const x=[],_=k.enter("tableRow");for(;++y<v.length;)x[y]=d(v[y],S,k,C);return _(),x}function b(S,k,C){let v=Ny.inlineCode(S,k,C);return C.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function BN(){return{exit:{taskListCheckValueChecked:Rv,taskListCheckValueUnchecked:Rv,paragraph:HN}}}function zN(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:PN}}}function Rv(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function HN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let u=-1,p;for(;++u<c.length;){const l=c[u];if(l.type==="paragraph"){p=l;break}}p===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function PN(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",p="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(p);let d=Ny.listItem(e,r,i,{...s,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(g){return g+p}}function FN(){return[bj(),Pj(),qj(),AN(),BN()]}function UN(e){return{extensions:[yj(),Fj(e),Wj(),IN(e),zN()]}}const $N={tokenize:KN,partial:!0},Ty={tokenize:XN,partial:!0},Ay={tokenize:ZN,partial:!0},Dy={tokenize:QN,partial:!0},qN={tokenize:JN,partial:!0},Ry={name:"wwwAutolink",tokenize:VN,previous:My},Ly={name:"protocolAutolink",tokenize:YN,previous:Oy},Nr={name:"emailAutolink",tokenize:GN,previous:Iy},ar={};function WN(){return{text:ar}}let ki=48;for(;ki<123;)ar[ki]=Nr,ki++,ki===58?ki=65:ki===91&&(ki=97);ar[43]=Nr;ar[45]=Nr;ar[46]=Nr;ar[95]=Nr;ar[72]=[Nr,Ly];ar[104]=[Nr,Ly];ar[87]=[Nr,Ry];ar[119]=[Nr,Ry];function GN(e,r,i){const s=this;let c,u;return p;function p(m){return!ch(m)||!Iy.call(s,s.previous)||Hh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return ch(m)?(e.consume(m),l):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(qN,g,f)(m):m===45||m===95||sn(m)?(u=!0,e.consume(m),d):g(m)}function f(m){return e.consume(m),c=!0,d}function g(m){return u&&c&&cn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function VN(e,r,i){const s=this;return c;function c(p){return p!==87&&p!==119||!My.call(s,s.previous)||Hh(s.events)?i(p):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check($N,e.attempt(Ty,e.attempt(Ay,u),i),i)(p))}function u(p){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(p)}}function YN(e,r,i){const s=this;let c="",u=!1;return p;function p(m){return(m===72||m===104)&&Oy.call(s,s.previous)&&!Hh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(cn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const b=c.toLowerCase();if(b==="http"||b==="https")return e.consume(m),d}return i(m)}function d(m){return m===47?(e.consume(m),u?f:(u=!0,d)):i(m)}function f(m){return m===null||Ll(m)||vt(m)||Ri(m)||Kl(m)?i(m):e.attempt(Ty,e.attempt(Ay,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function KN(e,r,i){let s=0;return c;function c(p){return(p===87||p===119)&&s<3?(s++,e.consume(p),c):p===46&&s===3?(e.consume(p),u):i(p)}function u(p){return p===null?i(p):r(p)}}function XN(e,r,i){let s,c,u;return p;function p(f){return f===46||f===95?e.check(Dy,d,l)(f):f===null||vt(f)||Ri(f)||f!==45&&Kl(f)?d(f):(u=!0,e.consume(f),p)}function l(f){return f===95?s=!0:(c=s,s=void 0),e.consume(f),p}function d(f){return c||s||!u?i(f):r(f)}}function ZN(e,r){let i=0,s=0;return c;function c(p){return p===40?(i++,e.consume(p),c):p===41&&s<i?u(p):p===33||p===34||p===38||p===39||p===41||p===42||p===44||p===46||p===58||p===59||p===60||p===63||p===93||p===95||p===126?e.check(Dy,r,u)(p):p===null||vt(p)||Ri(p)?r(p):(e.consume(p),c)}function u(p){return p===41&&s++,e.consume(p),c}}function QN(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||vt(l)||Ri(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||vt(l)||Ri(l)?r(l):s(l)}function u(l){return cn(l)?p(l):i(l)}function p(l){return l===59?(e.consume(l),s):cn(l)?(e.consume(l),p):i(l)}}function JN(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return sn(u)?i(u):r(u)}}function My(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||vt(e)}function Oy(e){return!cn(e)}function Iy(e){return!(e===47||ch(e))}function ch(e){return e===43||e===45||e===46||e===95||sn(e)}function Hh(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const e5={tokenize:l5,partial:!0};function t5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:s5,continuation:{tokenize:a5},exit:o5}},text:{91:{name:"gfmFootnoteCall",tokenize:i5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:n5,resolveTo:r5}}}}function n5(e,r,i){const s=this;let c=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let p;for(;c--;){const d=s.events[c][1];if(d.type==="labelImage"){p=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return l;function l(d){if(!p||!p._balanced)return i(d);const f=Kn(s.sliceSerialize({start:p.end,end:s.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function r5(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},p={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",p,r],["exit",p,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function i5(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,p;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(m){if(u>999||m===93&&!p||m===null||m===91||vt(m))return i(m);if(m===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return c.includes(Kn(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return vt(m)||(p=!0),u++,e.consume(m),m===92?g:f}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,f):f(m)}}function s5(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,p=0,l;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(k)}function g(k){if(p>999||k===93&&!l||k===null||k===91||vt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Kn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return vt(k)||(l=!0),p++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),p++,g):g(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),c.includes(u)||c.push(u),it(e,S,"gfmFootnoteDefinitionWhitespace")):i(k)}function S(k){return r(k)}}function a5(e,r,i){return e.check(to,r,e.attempt(e5,r,i))}function o5(e){e.exit("gfmFootnoteDefinition")}function l5(e,r,i){const s=this;return it(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const p=s.events[s.events.length-1];return p&&p[1].type==="gfmFootnoteDefinitionIndent"&&p[2].sliceSerialize(p[1],!0).length===4?r(u):i(u)}}function c5(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(p,l){let d=-1;for(;++d<p.length;)if(p[d][0]==="enter"&&p[d][1].type==="strikethroughSequenceTemporary"&&p[d][1]._close){let f=d;for(;f--;)if(p[f][0]==="exit"&&p[f][1].type==="strikethroughSequenceTemporary"&&p[f][1]._open&&p[d][1].end.offset-p[d][1].start.offset===p[f][1].end.offset-p[f][1].start.offset){p[d][1].type="strikethroughSequence",p[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},p[f][1].start),end:Object.assign({},p[d][1].end)},m={type:"strikethroughText",start:Object.assign({},p[f][1].end),end:Object.assign({},p[d][1].start)},b=[["enter",g,l],["enter",p[f][1],l],["exit",p[f][1],l],["enter",m,l]],S=l.parser.constructs.insideSpan.null;S&&Dn(b,b.length,0,Xl(S,p.slice(f+1,d),l)),Dn(b,b.length,0,[["exit",m,l],["enter",p[d][1],l],["exit",p[d][1],l],["exit",g,l]]),Dn(p,f-1,d-f+3,b),d=f+b.length-2;break}}for(d=-1;++d<p.length;)p[d][1].type==="strikethroughSequenceTemporary"&&(p[d][1].type="data");return p}function u(p,l,d){const f=this.previous,g=this.events;let m=0;return b;function b(k){return f===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(p.enter("strikethroughSequenceTemporary"),S(k))}function S(k){const C=Rs(f);if(k===126)return m>1?d(k):(p.consume(k),m++,S);if(m<2&&!i)return d(k);const v=p.exit("strikethroughSequenceTemporary"),y=Rs(k);return v._open=!y||y===2&&!!C,v._close=!C||C===2&&!!y,l(k)}}}class u5{constructor(){this.map=[]}add(r,i,s){d5(this,r,i,s)}consume(r){if(this.map.sort(function(u,p){return u[0]-p[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const u of c)r.push(u);c=s.pop()}this.map.length=0}}function d5(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function h5(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function f5(){return{flow:{null:{name:"table",tokenize:p5,resolveAll:m5}}}}function p5(e,r,i){const s=this;let c=0,u=0,p;return l;function l(z){let V=s.events.length-1;for(;V>-1;){const F=s.events[V][1].type;if(F==="lineEnding"||F==="linePrefix")V--;else break}const Y=V>-1?s.events[V][1].type:null,$=Y==="tableHead"||Y==="tableRow"?N:d;return $===N&&s.parser.lazy[s.now().line]?i(z):$(z)}function d(z){return e.enter("tableHead"),e.enter("tableRow"),f(z)}function f(z){return z===124||(p=!0,u+=1),g(z)}function g(z){return z===null?i(z):Me(z)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),S):i(z):Qe(z)?it(e,g,"whitespace")(z):(u+=1,p&&(p=!1,c+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),p=!0,g):(e.enter("data"),m(z)))}function m(z){return z===null||z===124||vt(z)?(e.exit("data"),g(z)):(e.consume(z),z===92?b:m)}function b(z){return z===92||z===124?(e.consume(z),m):m(z)}function S(z){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(z):(e.enter("tableDelimiterRow"),p=!1,Qe(z)?it(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):k(z))}function k(z){return z===45||z===58?v(z):z===124?(p=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),C):A(z)}function C(z){return Qe(z)?it(e,v,"whitespace")(z):v(z)}function v(z){return z===58?(u+=1,p=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),y):z===45?(u+=1,y(z)):z===null||Me(z)?j(z):A(z)}function y(z){return z===45?(e.enter("tableDelimiterFiller"),x(z)):A(z)}function x(z){return z===45?(e.consume(z),x):z===58?(p=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(z))}function _(z){return Qe(z)?it(e,j,"whitespace")(z):j(z)}function j(z){return z===124?k(z):z===null||Me(z)?!p||c!==u?A(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(z)):A(z)}function A(z){return i(z)}function N(z){return e.enter("tableRow"),R(z)}function R(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),R):z===null||Me(z)?(e.exit("tableRow"),r(z)):Qe(z)?it(e,R,"whitespace")(z):(e.enter("data"),T(z))}function T(z){return z===null||z===124||vt(z)?(e.exit("data"),R(z)):(e.consume(z),z===92?I:T)}function I(z){return z===92||z===124?(e.consume(z),T):T(z)}}function m5(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],p=[0,0,0,0],l=!1,d=0,f,g,m;const b=new u5;for(;++i<e.length;){const S=e[i],k=S[1];S[0]==="enter"?k.type==="tableHead"?(l=!1,d!==0&&(Lv(b,r,d,f,g),g=void 0,d=0),f={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(i,0,[["enter",f,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],p=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(i,0,[["enter",g,r]])),c=k.type==="tableDelimiterRow"?2:g?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,p[2]===0&&(u[1]!==0&&(p[0]=p[1],m=Cl(b,r,u,c,void 0,m),u=[0,0,0,0]),p[2]=i)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(p[0]=p[1],m=Cl(b,r,u,c,void 0,m)),u=p,p=[u[1],i,0,0])):k.type==="tableHead"?(l=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(p[0]=p[1],m=Cl(b,r,u,c,i,m)):p[1]!==0&&(m=Cl(b,r,p,c,i,m)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(p[3]=i)}for(d!==0&&Lv(b,r,d,f,g),b.consume(r.events),i=-1;++i<r.events.length;){const S=r.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=h5(r.events,i))}return e}function Cl(e,r,i,s,c,u){const p=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Es(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Es(r.events,i[1]);if(u={type:p,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const f=Es(r.events,i[2]),g=Es(r.events,i[3]),m={type:l,start:Object.assign({},f),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const b=r.events[i[2]],S=r.events[i[3]];if(b[1].end=Object.assign({},S[1].end),b[1].type="chunkText",b[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,C=i[3]-i[2]-1;e.add(k,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Es(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Lv(e,r,i,s,c){const u=[],p=Es(r.events,i);c&&(c.end=Object.assign({},p),u.push(["exit",c,r])),s.end=Object.assign({},p),u.push(["exit",s,r]),e.add(i+1,0,u)}function Es(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const g5={name:"tasklistCheck",tokenize:v5};function x5(){return{text:{91:g5}}}function v5(e,r,i){const s=this;return c;function c(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return vt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),p):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),p):i(d)}function p(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(d)}function l(d){return Me(d)?r(d):Qe(d)?e.check({tokenize:b5},r,i)(d):i(d)}}function b5(e,r,i){return it(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function y5(e){return Vb([WN(),t5(),c5(e),f5(),x5()])}const _5={};function S5(e){const r=this,i=e||_5,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),p=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(y5(i)),u.push(FN()),p.push(UN(i))}function w5(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function C5(e,r){if(e==null)return{};var i,s,c=w5(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function uh(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function k5(e){if(Array.isArray(e))return uh(e)}function E5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function j5(e,r){if(e){if(typeof e=="string")return uh(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?uh(e,r):void 0}}function N5(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
119
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dh(e){return k5(e)||E5(e)||j5(e)||N5()}function Xa(e){"@babel/helpers - typeof";return Xa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Xa(e)}function T5(e,r){if(Xa(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Xa(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function A5(e){var r=T5(e,"string");return Xa(r)=="symbol"?r:r+""}function By(e,r,i){return(r=A5(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function hh(){return hh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},hh.apply(null,arguments)}function Mv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function js(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Mv(Object(i),!0).forEach(function(s){By(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Mv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function D5(e){var r=e.length;if(r===0||r===1)return e;if(r===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(r===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(r>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var Yd={};function R5(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Yd[r]||(Yd[r]=D5(e)),Yd[r]}function L5(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=R5(s);return c.reduce(function(u,p){return js(js({},u),i[p])},r)}function Ov(e){return e.join(" ")}function M5(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return zy({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function zy(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,u=e.useInlineStyles,p=e.key,l=r.properties,d=r.type,f=r.tagName,g=r.value;if(d==="text")return g;if(f){var m=M5(i,u),b;if(!u)b=js(js({},l),{},{className:Ov(l.className)});else{var S=Object.keys(i).reduce(function(y,x){return x.split(".").forEach(function(_){y.includes(_)||y.push(_)}),y},[]),k=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&k.concat(l.className.filter(function(y){return!S.includes(y)}));b=js(js({},l),{},{className:Ov(C)||void 0,style:L5(l.className,Object.assign({},l.style,c),i)})}var v=m(r.children);return ln.createElement(f,hh({key:p},b),v)}}const O5=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var I5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Iv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function ri(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Iv(Object(i),!0).forEach(function(s){By(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Iv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var B5=/\n/g;function z5(e){return e.match(B5)}function H5(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,u){var p=u+i;return ln.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(p):s},"".concat(p,`
120
- `))})}function P5(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,p=u===void 0?{}:u,l=e.startingLineNumber;return ln.createElement("code",{style:Object.assign({},i,c)},H5({lines:r.replace(/\n$/,"").split(`
121
- `),style:p,startingLineNumber:l}))}function F5(e){return"".concat(e.toString().length,".25em")}function Hy(e,r){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:r},children:[{type:"text",value:e}]}}function Py(e,r,i){var s={display:"inline-block",minWidth:F5(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=ri(ri({},s),c);return u}function Nl(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,c=e.largestLineNumber,u=e.showInlineLineNumbers,p=e.lineProps,l=p===void 0?{}:p,d=e.className,f=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,b=e.wrapLines,S=b===void 0?!1:b,k=S?ri({},typeof l=="function"?l(i):l):{};if(k.className=k.className?[].concat(dh(k.className.trim().split(/\s+/)),dh(f)):f,i&&u){var C=Py(s,i,c);r.unshift(Hy(i,C))}return m&g&&(k.style=ri({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function Fy(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var c=e[s];if(c.type==="text")i.push(Nl({children:[c],className:dh(new Set(r))}));else if(c.children){var u,p=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);Fy(c.children,p).forEach(function(l){return i.push(l)})}}return i}function U5(e,r,i,s,c,u,p,l,d){var f,g=Fy(e.value),m=[],b=-1,S=0;function k(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Nl({children:A,lineNumber:N,lineNumberStyle:l,largestLineNumber:p,showInlineLineNumbers:c,lineProps:i,className:R,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&c){var R=Py(l,N,p);A.unshift(Hy(N,R))}return A}function v(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||R.length>0?k(A,N,R):C(A,N)}for(var y=function(){var N=g[S],R=N.children[0].value,T=z5(R);if(T){var I=R.split(`
122
- `);I.forEach(function(z,V){var Y=s&&m.length+u,$={type:"text",value:"".concat(z,`
123
- `)};if(V===0){var F=g.slice(b+1,S).concat(Nl({children:[$],className:N.properties.className})),P=v(F,Y);m.push(P)}else if(V===I.length-1){var B=g[S+1]&&g[S+1].children&&g[S+1].children[0],X={type:"text",value:"".concat(z)};if(B){var Q=Nl({children:[X],className:N.properties.className});g.splice(S+1,0,Q)}else{var O=[X],D=v(O,Y,N.properties.className);m.push(D)}}else{var L=[$],q=v(L,Y,N.properties.className);m.push(q)}}),b=S}S++};S<g.length;)y();if(b!==g.length-1){var x=g.slice(b+1,g.length);if(x&&x.length){var _=s&&m.length+u,j=v(x,_);m.push(j)}}return r?m:(f=[]).concat.apply(f,m)}function $5(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return zy({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Uy(e){return e&&typeof e.highlightAuto<"u"}function q5(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(Uy(r)){var u=O5(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function W5(e,r){return function(s){var c,u,p=s.language,l=s.children,d=s.style,f=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,b=s.codeTagProps,S=b===void 0?{className:p?"language-".concat(p):void 0,style:ri(ri({},f['code[class*="language-"]']),f['code[class*="language-'.concat(p,'"]')])}:b,k=s.useInlineStyles,C=k===void 0?!0:k,v=s.showLineNumbers,y=v===void 0?!1:v,x=s.showInlineLineNumbers,_=x===void 0?!0:x,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,R=s.lineNumberStyle,T=R===void 0?{}:R,I=s.wrapLines,z=s.wrapLongLines,V=z===void 0?!1:z,Y=s.lineProps,$=Y===void 0?{}:Y,F=s.renderer,P=s.PreTag,B=P===void 0?"pre":P,X=s.CodeTag,Q=X===void 0?"code":X,O=s.code,D=O===void 0?(Array.isArray(l)?l[0]:l)||"":O,L=s.astGenerator,q=C5(s,I5);L=L||e;var U=y?ln.createElement(P5,{containerStyle:N,codeStyle:S.style||{},numberStyle:T,startingLineNumber:A,codeString:D}):null,K=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},ee=Uy(L)?"hljs":"prismjs",ne=C?Object.assign({},q,{style:Object.assign({},K,m)}):Object.assign({},q,{className:q.className?"".concat(ee," ").concat(q.className):ee,style:Object.assign({},m)});if(V?S.style=ri({whiteSpace:"pre-wrap"},S.style):S.style=ri({whiteSpace:"pre"},S.style),!L)return ln.createElement(B,ne,U,ln.createElement(Q,S,D));(I===void 0&&F||V)&&(I=!0),F=F||$5;var Z=[{type:"text",value:D}],W=q5({astGenerator:L,language:p,code:D,defaultCodeValue:Z});W.language===null&&(W.value=Z);var ae=(c=(u=D.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,se=A+ae,pe=U5(W,I,$,y,_,A,se,T,V);return ln.createElement(B,ne,ln.createElement(Q,S,!_&&U,F({rows:pe,stylesheet:f,useInlineStyles:C})))}}const Bv=/[#.]/g;function G5(e,r){const i=e||"",s={};let c=0,u,p;for(;c<i.length;){Bv.lastIndex=c;const l=Bv.exec(i),d=i.slice(c,l?l.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:p=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:p||r||"div",properties:s,children:[]}}function $y(e,r,i){const s=i?X5(i):void 0;function c(u,p,...l){let d;if(u==null){d={type:"root",children:[]};const f=p;l.unshift(f)}else{d=G5(u,r);const f=d.tagName.toLowerCase(),g=s?s.get(f):void 0;if(d.tagName=g||f,V5(p))l.unshift(p);else for(const[m,b]of Object.entries(p))Y5(e,d.properties,m,b)}for(const f of l)fh(d.children,f);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return c}function V5(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const p of u)if(typeof p!="number"&&typeof p!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Y5(e,r,i,s){const c=zb(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=Yx(s):c.commaSeparated?u=$x(s):c.commaOrSpaceSeparated?u=Yx($x(s).join(" ")):u=zv(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?K5(s):String(s);if(Array.isArray(u)){const p=[];for(const l of u)p.push(zv(c,c.property,l));u=p}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function fh(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const i of r)fh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?fh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function zv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Ga(i)===Ga(r)))return!0}return i}function K5(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function X5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const Z5=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Q5=$y(Hb,"div");$y(Yl,"g",Z5);const J5=["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"],Hv={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function qy(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function e3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function t3(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Pv(e){return t3(e)||qy(e)}const n3=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function r3(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=0,p=-1,l="",d,f;i.position&&("start"in i.position||"indent"in i.position?(f=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,b=k(),S;for(u--;++u<=e.length;)if(S===10&&(m=(f?f[p]:0)||1),S=e.charCodeAt(u),S===38){const y=e.charCodeAt(u+1);if(y===9||y===10||y===12||y===32||y===38||y===60||Number.isNaN(y)||s&&y===s){l+=String.fromCharCode(S),m++;continue}const x=u+1;let _=x,j=x,A;if(y===35){j=++_;const $=e.charCodeAt(j);$===88||$===120?(A="hexadecimal",j=++_):A="decimal"}else A="named";let N="",R="",T="";const I=A==="named"?Pv:A==="decimal"?qy:e3;for(j--;++j<=e.length;){const $=e.charCodeAt(j);if(!I($))break;T+=String.fromCharCode($),A==="named"&&J5.includes(T)&&(N=T,R=Ya(T))}let z=e.charCodeAt(j)===59;if(z){j++;const $=A==="named"?Ya(T):!1;$&&(N=T,R=$)}let V=1+j-x,Y="";if(!(!z&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,V);else if(A==="named"){if(z&&!R)C(5,1);else if(N!==T&&(j=_+N.length,V=1+j-_,z=!1),!z){const $=N?1:3;if(i.attribute){const F=e.charCodeAt(j);F===61?(C($,V),R=""):Pv(F)?R="":C($,V)}else C($,V)}Y=R}else{z||C(2,V);let $=Number.parseInt(T,A==="hexadecimal"?16:10);if(i3($))C(7,V),Y="�";else if($ in Hv)C(6,V),Y=Hv[$];else{let F="";s3($)&&C(6,V),$>65535&&($-=65536,F+=String.fromCharCode($>>>10|55296),$=56320|$&1023),Y=F+String.fromCharCode($)}}if(Y){v(),b=k(),u=j-1,m+=j-x+1,c.push(Y);const $=k();$.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:b,end:$},e.slice(x-1,j)),b=$}else T=e.slice(x-1,j),l+=T,m+=T.length,u=j-1}else S===10&&(g++,p++,m=0),Number.isNaN(S)?v():(l+=String.fromCharCode(S),m++);return c.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(y,x){let _;i.warning&&(_=k(),_.column+=x,_.offset+=x,i.warning.call(i.warningContext||void 0,n3[y],_,y))}function v(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:b,end:k()}),l="")}}function i3(e){return e>=55296&&e<=57343||e>1114111}function s3(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var a3=0,kl={},Gt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++a3}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Gt.util.type(r)){case"Object":if(c=Gt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=Gt.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(p,l){s[l]=e(p,i)}),s);default:return r}}},languages:{plain:kl,plaintext:kl,text:kl,txt:kl,extend:function(e,r){var i=Gt.util.clone(Gt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Gt.languages;var c=s[e],u={};for(var p in c)if(c.hasOwnProperty(p)){if(p==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(p)||(u[p]=c[p])}var d=s[e];return s[e]=u,Gt.languages.DFS(Gt.languages,function(f,g){g===d&&f!=e&&(this[f]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=Gt.util.objId;for(var p in r)if(r.hasOwnProperty(p)){i.call(r,p,r[p],s||p);var l=r[p],d=Gt.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,p,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Gt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Gt.tokenize(s.code,s.grammar),Gt.hooks.run("after-tokenize",s),qa.stringify(Gt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new o3;return Tl(c,c.head,e),Wy(e,c,r,c.head,0),c3(c)},hooks:{all:{},add:function(e,r){var i=Gt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Gt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:qa};function qa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Fv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function Wy(e,r,i,s,c,u){for(var p in i)if(!(!i.hasOwnProperty(p)||!i[p])){var l=i[p];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(u&&u.cause==p+","+d)return;var f=l[d],g=f.inside,m=!!f.lookbehind,b=!!f.greedy,S=f.alias;if(b&&!f.pattern.global){var k=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,k+"g")}for(var C=f.pattern||f,v=s.next,y=c;v!==r.tail&&!(u&&y>=u.reach);y+=v.value.length,v=v.next){var x=v.value;if(r.length>e.length)return;if(!(x instanceof qa)){var _=1,j;if(b){if(j=Fv(C,y,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=y;for(N+=v.value.length;T>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,y=N,v.value instanceof qa)continue;for(var R=v;R!==r.tail&&(N<A||typeof R.value=="string");R=R.next)_++,N+=R.value.length;_--,x=e.slice(y,N),j.index-=y}else if(j=Fv(C,0,x,m),!j)continue;var T=j.index,I=j[0],z=x.slice(0,T),V=x.slice(T+I.length),Y=y+x.length;u&&Y>u.reach&&(u.reach=Y);var $=v.prev;z&&($=Tl(r,$,z),y+=z.length),l3(r,$,_);var F=new qa(p,g?Gt.tokenize(I,g):I,S,I);if(v=Tl(r,$,F),V&&Tl(r,v,V),_>1){var P={cause:p+","+d,reach:Y};Wy(e,r,i,v.prev,y,P),u&&P.reach>u.reach&&(u.reach=P.reach)}}}}}}function o3(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function Tl(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function l3(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function c3(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const Gy=Gt;function Vy(){}Vy.prototype=Gy;const $t=new Vy;$t.highlight=u3;$t.register=d3;$t.alias=h3;$t.registered=f3;$t.listLanguages=p3;$t.util.encode=m3;$t.Token.stringify=ph;function u3(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn($t.languages,s))i=$t.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:Gy.highlight.call($t,e,i,s)}}function d3(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn($t.languages,e.displayName)||e($t)}function h3(e,r){const i=$t.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const u=s[c],p=typeof u=="string"?[u]:u;let l=-1;for(;++l<p.length;)i[p[l]]=i[c]}}function f3(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn($t.languages,e)}function p3(){const e=$t.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function ph(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(ph(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:ph(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),$t.hooks.run("wrap",i),Q5(i.tag+"."+i.classes.join("."),g3(i.attributes),i.content)}function m3(e){return e}function g3(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=r3(e[r]));return e}var ft=W5($t,{});ft.registerLanguage=function(e,r){return $t.register(r)};ft.alias=function(e,r){return $t.alias(e,r)};Mi.displayName="markup";Mi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Mi(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&amp;/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var p={};p[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",p)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:e.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}ec.displayName="css";ec.aliases=[];function ec(e){(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Oi.displayName="clike";Oi.aliases=[];function Oi(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}ro.displayName="javascript";ro.aliases=["js"];function ro(e){e.register(Oi),e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Ph.displayName="sql";Ph.aliases=[];function Ph(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}tc.displayName="c";tc.aliases=[];function tc(e){e.register(Oi),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Fh.displayName="cpp";Fh.aliases=[];function Fh(e){e.register(tc),(function(r){var i=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:i,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}Uh.displayName="bash";Uh.aliases=["sh","shell"];function Uh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],p=c.variable[1].inside,l=0;l<u.length;l++)p[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}$h.displayName="yaml";$h.aliases=["yml"];function $h(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),p=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(d,f){f=(f||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return d});return RegExp(g,f)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+p+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(p),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}qh.displayName="markdown";qh.aliases=["md"];function qh(e){e.register(Mi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),p=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+p+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+p+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+p+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(d){l!==d&&(r.languages.markdown[l].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var g=0,m=f.length;g<m;g++){var b=f[g];if(b.type!=="code"){d(b.content);continue}var S=b.content[1],k=b.content[3];if(S&&k&&S.type==="code-language"&&k.type==="code-block"&&typeof S.content=="string"){var C=S.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var v="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,v]:k.alias.push(v):k.alias=[v]}}}d(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var d="",f=0,g=l.classes.length;f<g;f++){var m=l.classes[f],b=/language-(.+)/.exec(m);if(b){d=b[1];break}}var S=r.languages[d];if(S)l.content=r.highlight(l.content.value,S,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=k,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(k);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}Wh.displayName="ruby";Wh.aliases=["rb"];function Wh(e){e.register(Oi),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Gh.displayName="diff";Gh.aliases=[];function Gh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
124
- ?|
125
- |(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}Vh.displayName="docker";Vh.aliases=["dockerfile"];function Vh(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),p={pattern:RegExp(c),greedy:!0},l={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(f,g){return f=f.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return s}),RegExp(f,g)}r.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:d(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[p,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:d(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:l,string:p,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:l},r.languages.dockerfile=r.languages.docker})(e)}Yh.displayName="go";Yh.aliases=[];function Yh(e){e.register(Oi),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}Kh.displayName="graphql";Kh.aliases=[];function Kh(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(v){return typeof v!="string"&&v.type!=="comment"&&v.type!=="scalar"}),c=0;function u(v){return s[c+v]}function p(v,y){y=y||0;for(var x=0;x<v.length;x++){var _=u(x+y);if(!_||_.type!==v[x])return!1}return!0}function l(v,y){for(var x=1,_=c;_<s.length;_++){var j=s[_],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(v.test(A))x++;else if(y.test(A)&&(x--,x===0))return _}}return-1}function d(v,y){var x=v.alias;x?Array.isArray(x)||(v.alias=x=[x]):v.alias=x=[],x.push(y)}for(;c<s.length;){var f=s[c++];if(f.type==="keyword"&&f.content==="mutation"){var g=[];if(p(["definition-mutation","punctuation"])&&u(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var b=u(0);b.type==="variable"&&(d(b,"variable-input"),g.push(b.content))}c=m+1}if(p(["punctuation","property-query"])&&u(0).content==="{"&&(c++,d(u(0),"property-mutation"),g.length>0)){var S=l(/^\{$/,/^\}$/);if(S===-1)continue;for(var k=c;k<S;k++){var C=s[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}Xh.displayName="scss";Xh.aliases=[];function Xh(e){e.register(ec),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}Zh.displayName="json";Zh.aliases=["webmanifest"];function Zh(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Qh.displayName="java";Qh.aliases=[];function Qh(e){e.register(Oi),(function(r){var i=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[c,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:c.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:i,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":c,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:c.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}nc.displayName="typescript";nc.aliases=["ts"];function nc(e){e.register(ro),(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var i=r.languages.extend("typescript",{});delete i["class-name"],r.languages.typescript["class-name"].inside=i,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:i}}}}),r.languages.ts=r.languages.typescript})(e)}Jh.displayName="python";Jh.aliases=["py"];function Jh(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}rc.displayName="jsx";rc.aliases=[];function rc(e){e.register(ro),e.register(Mi),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function p(f,g){return f=f.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return c}).replace(/<SPREAD>/g,function(){return u}),RegExp(f,g)}u=p(u).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=p(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),r.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,r.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,r.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,r.languages.jsx.tag.inside.comment=i.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:p(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:p(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var l=function(f){return f?typeof f=="string"?f:typeof f.content=="string"?f.content:f.content.map(l).join(""):""},d=function(f){for(var g=[],m=0;m<f.length;m++){var b=f[m],S=!1;if(typeof b!="string"&&(b.type==="tag"&&b.content[0]&&b.content[0].type==="tag"?b.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(b.content[0].content[1])&&g.pop():b.content[b.content.length-1].content==="/>"||g.push({tagName:l(b.content[0].content[1]),openedBraces:0}):g.length>0&&b.type==="punctuation"&&b.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&b.type==="punctuation"&&b.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof b=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var k=l(b);m<f.length-1&&(typeof f[m+1]=="string"||f[m+1].type==="plain-text")&&(k+=l(f[m+1]),f.splice(m+1,1)),m>0&&(typeof f[m-1]=="string"||f[m-1].type==="plain-text")&&(k=l(f[m-1])+k,f.splice(m-1,1),m--),f[m]=new r.Token("plain-text",k,null,k)}b.content&&typeof b.content!="string"&&d(b.content)}};r.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||d(f.tokens)})})(e)}ef.displayName="tsx";ef.aliases=[];function ef(e){e.register(rc),e.register(nc),(function(r){var i=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",i),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var s=r.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}tf.displayName="rust";tf.aliases=[];function tf(e){(function(r){for(var i=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)i=i.replace(/<self>/g,function(){return i});i=i.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+i),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(e)}nf.displayName="toml";nf.aliases=[];function nf(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(c){return c.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const Al={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};ft.registerLanguage("typescript",nc);ft.registerLanguage("javascript",ro);ft.registerLanguage("tsx",ef);ft.registerLanguage("jsx",rc);ft.registerLanguage("python",Jh);ft.registerLanguage("bash",Uh);ft.registerLanguage("json",Zh);ft.registerLanguage("css",ec);ft.registerLanguage("html",Mi);ft.registerLanguage("markup",Mi);ft.registerLanguage("xml",Mi);ft.registerLanguage("sql",Ph);ft.registerLanguage("yaml",$h);ft.registerLanguage("markdown",qh);ft.registerLanguage("diff",Gh);ft.registerLanguage("rust",tf);ft.registerLanguage("go",Yh);ft.registerLanguage("java",Qh);ft.registerLanguage("c",tc);ft.registerLanguage("cpp",Fh);ft.registerLanguage("ruby",Wh);ft.registerLanguage("toml",nf);ft.registerLanguage("scss",Xh);ft.registerLanguage("graphql",Kh);ft.registerLanguage("docker",Vh);function Yy(e=2e3){const[r,i]=H.useState(!1),s=H.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const u=document.createElement("textarea");u.value=c,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const x3={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
126
- `))return o.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...i,children:r});const u=(s==null?void 0:s[1])||"text",p=String(r).replace(/\n$/,""),{copied:l,copy:d}=Yy();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.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:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick:f=>{f.preventDefault(),f.stopPropagation(),d(p)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:l?o.jsx(ql,{}):o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(ft,{style:Al,language:u,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:p})})]})},p({children:e}){return o.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return o.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return o.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return o.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return o.jsx("h3",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},h4({children:e}){return o.jsx("h4",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},strong({children:e}){return o.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return o.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return o.jsx("blockquote",{className:"border-l-2 border-accent-primary pl-2 my-1.5 text-text-secondary italic text-sm",children:e})},table({children:e}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:e})},td({children:e}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return o.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},Ii=H.memo(function({content:r,className:i=""}){const s=H.useMemo(()=>{let c=v3(r);return c=b3(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(cj,{remarkPlugins:[S5],components:x3,children:s})})});function v3(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function b3(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
127
- `),e+"\n```"}return e}const y3=H.memo(function({content:r,variant:i="default"}){return i==="labeled"?o.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[o.jsx("span",{className:"text-purple-400",children:"thinking:"}),o.jsx("div",{className:"ml-1.5 mt-0.5",children:o.jsx(Ii,{content:r})})]}):o.jsx("div",{className:"text-text-muted text-sm italic bg-bg-tertiary/50 rounded p-1.5 feed-item whitespace-pre-wrap",children:r})});function Ky({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"?o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}):o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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 _3={...Al,'pre[class*="language-"]':{...Al['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Al['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},S3={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 ic(e){var c;if(!e)return"text";const r=e.split("/").pop()??"",i=r.toLowerCase();if(i==="dockerfile")return"docker";if(i==="makefile")return"makefile";if(i==="cmakelists.txt")return"cmake";const s=(c=r.split(".").pop())==null?void 0:c.toLowerCase();return s?S3[s]??"text":"text"}const Xy={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},w3={...Xy,display:"inline"},C3={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},Za=H.memo(function({code:r,language:i,variant:s}){const c=s==="inline"?"span":s==="block-nowrap"?"div":"pre",u=s==="inline"?w3:s==="block-nowrap"?Xy:C3;return o.jsx(ft,{style:_3,language:i,PreTag:c,customStyle:u,children:r})});function Zy({src:e,alt:r,isOpen:i,onClose:s}){const c=H.useRef(null);H.useEffect(()=>{if(!i)return;const p=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[i,s]);const u=p=>{p.target===p.currentTarget&&s()};return i?o.jsx("div",{ref:c,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:u,role:"dialog","aria-modal":"true","aria-label":"Image viewer",children:o.jsxs("div",{className:"relative max-w-[95vw] max-h-[95vh] flex items-center justify-center",children:[o.jsx(Ul,{onClick:s,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors","aria-label":"Close image viewer"}),o.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"})]})}):null}const k3=H.memo(function({oldString:r,newString:i,filePath:s}){const c=H.useMemo(()=>ic(s),[s]),u=r.split(`
128
- `),p=i.split(`
129
- `),l=r.length>0,d=i.length>0;return!l&&!d?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-red-400/60"}),o.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:u.map((f,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),o.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:o.jsx(Za,{code:r,language:c,variant:"block-nowrap"})})]}),d&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:p.map((f,g)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),o.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:o.jsx(Za,{code:i,language:c,variant:"block-nowrap"})})]})]})}),E3=H.memo(function({content:r,filePath:i}){const s=H.useMemo(()=>ic(i),[i]);return o.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:o.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[o.jsx("div",{className:"bg-green-400/60"}),o.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
130
- `).map((c,u)=>o.jsx("div",{className:"leading-[1.5rem]",children:"+"},u))}),o.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:o.jsx(Za,{code:r,language:s,variant:"block"})})]})})}),j3=H.memo(function({regions:r,filePath:i}){const s=H.useMemo(()=>ic(i),[i]);return r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):o.jsx("div",{className:"space-y-2",children:r.map((c,u)=>o.jsx(N3,{region:c,language:s},u))})}),N3=H.memo(function({region:r,language:i}){const s=T3(r),c=Math.max(...r.beforeContext.map(p=>p.lineNumber),...r.afterContext.map(p=>p.lineNumber),...r.edits.flatMap(p=>[p.startLine,p.endLine])),u=String(c).length;return o.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((p,l)=>o.jsx(A3,{item:p,language:i,lineNumWidth:u},l))})});function T3(e){const r=[];for(const i of e.beforeContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});for(const i of e.edits){const s=i.oldContent.split(`
131
- `);for(let u=0;u<s.length;u++)r.push({type:"removed",lineNumber:i.startLine+u,content:s[u]});const c=i.newContent.split(`
132
- `);for(let u=0;u<c.length;u++)r.push({type:"added",lineNumber:i.startLine+u,content:c[u]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const A3=H.memo(function({item:r,language:i,lineNumWidth:s}){const c=String(r.lineNumber).padStart(s," "),u=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",p=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",l=r.type==="context"?" ":r.type==="removed"?"-":"+",d=r.type==="removed"?"line-through decoration-red-400/30":"",f=r.type==="context"?"bg-transparent":r.type==="removed"?"bg-red-400/60":"bg-green-400/60";return o.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${u}`,children:[o.jsx("div",{className:f}),o.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:c}),o.jsx("div",{className:`text-center select-none leading-[1.5rem] ${p}`,children:l}),o.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:o.jsx(Za,{code:r.content||" ",language:i,variant:"inline"})})]})}),D3=H.memo(function({result:r,metadata:i,filePath:s,heightExpanded:c=!1}){const[u,p]=H.useState(!1),l=H.useMemo(()=>ic(s),[s]),d=i==null?void 0:i.mimeType,f=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&f){const b=`data:${d};base64,${f}`;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>p(!0),children:o.jsx("img",{src:b,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),o.jsx(Zy,{src:b,alt:s,isOpen:u,onClose:()=>p(!1)})]})}if(!r)return o.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
133
- `),m=g.filter(b=>!b.startsWith(`
134
- [`)&&!b.startsWith("[")).map(b=>b.replace(/^\d+: /,"")).join(`
135
- `);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(b=>!b.startsWith(`
136
- [`)&&!b.startsWith("[")).map((b,S)=>{const k=b.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:S+1},S)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(Za,{code:m,language:l,variant:"block"})})]})})}),R3={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"}},Uv=H.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,p)=>{const l=R3[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},p)})})]})}),L3=H.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:p,error:l,durationMs:d}){const f=H.useRef(null),[g,m]=H.useState(0);H.useEffect(()=>{f.current&&u==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[c,u]),H.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const b=i/1e3,S=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":p??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",b,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(k||u==="pending")&&o.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${u==="pending"?"border border-accent-warning/30":""}`,children:u==="pending"&&c?c.map((C,v)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Wa(C.content)},v)):Wa(k)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function M3(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"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function O3({confirmation:e}){const r=Ce(g=>g.confirmPath),i=Ce(g=>g.currentSession),s=Ce(g=>g.switchDangerLevel),{title:c,description:u}=M3(e.reason),p=e.reason==="sensitive_file"||e.reason==="both",l=p?"border-red-500/50":"border-amber-500/50",d=p?"bg-red-500/10":"bg-amber-500/10",f=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${p?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${p?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${p?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(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"}),o.jsx("button",{onClick:()=>r(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-white transition-colors",children:"Allow"}),o.jsx("button",{onClick:f,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function I3(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,u=r.limit,p=[];return c!==void 0&&c!==1&&p.push(`offset=${c}`),u!==void 0&&p.push(`limit=${u}`),p.length>0?`${s} [${p.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function $v(e,r,i){return I3(e,r)}function B3(e){return JSON.stringify(e,null,2)}const z3={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}},H3=H.memo(function({tool:r,args:i,status:s,variant:c="compact",result:u,error:p,durationMs:l,diagnostics:d,editContext:f,startedAt:g,streamingOutput:m,metadata:b,callId:S}){const k=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",v=r==="read_file",y=r==="return_value",[x,_]=H.useState(k||C||y),j=z3[s],A=Ce(R=>R.pendingPathConfirmation),N=s==="pending"&&A&&S&&A.callId===S?A:null;return c==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(Ky,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:$v(r,i)}),o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>_(!x),children:[o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:$v(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&o.jsx(O3,{confirmation:N}),(x||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(L3,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:u,error:p,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[f&&f.regions.length>0?o.jsx(j3,{regions:f.regions,filePath:String(i.path??"")}):o.jsx(k3,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Uv,{diagnostics:d})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(E3,{content:String(i.content??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Uv,{diagnostics:d})]}),r==="read_file"&&s==="success"&&o.jsx(D3,{result:u,metadata:b,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const R=(m==null?void 0:m.map(I=>I.content).join(""))??"",T=s==="pending"&&R?R:String(i.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Ii,{content:T})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:B3(i)})]}),s==="success"&&u!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",l!==void 0&&` (${l}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:u||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&l!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",l,"ms"]}),s==="error"&&p&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:p})]})]})]})}),P3={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",todo_write:"Updating tasks"};function F3(e){return P3[e]??`Preparing ${e}`}const U3=H.memo(function({name:r}){const i=F3(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(Ky,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),$3={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},q3=H.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=$3[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),qv={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"}},Qy=H.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),c=r.find(u=>{var p,l;return u.arguments.action==="get"&&((p=u.result)==null?void 0:p.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(Ii,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((p,l)=>o.jsx(Wv,{tc:p,index:l,criteriaMap:s},p.id??l))}})():r.map((u,p)=>o.jsx(Wv,{tc:u,index:p,criteriaMap:s},u.id??p))})]})});function Wv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&qv[s]?qv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,p=s==="remove",l=u.id,d=u.description,f=l?i.get(l):void 0,g=d??(f==null?void 0:f.description)??(p&&l?`[${l}]`:"Criterion updated"),m=u.reason,b=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:p?"line-through text-text-muted":"",children:o.jsx(Ii,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${b?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function W3(e){return e==="criterion"}const G3="#6b7280";function Bl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??G3}const rn=qn((e,r)=>{const i=async()=>{e({loading:!0});try{const c=await(await _e("/api/agents")).json();e({agents:c.agents??[],defaultIds:c.defaultIds??r().defaultIds,modifiedIds:c.modifiedIds??[],loading:!1})}catch{e({loading:!1})}};return{agents:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const c=await(await _e("/api/agents/default-ids")).json();e({defaultIds:c.ids??[]})}catch{}},fetchAgents:i,createAgent:async s=>{const c=await ii("POST","/api/agents",s);return c.success&&await i(),c},updateAgent:async(s,c)=>{const u=await ii("PUT",`/api/agents/${s}`,c);return u.success&&await i(),u},fetchAgent:async s=>{try{const c=await _e(`/api/agents/${s}`);return c.ok?await c.json():null}catch{return null}},deleteAgent:async s=>{try{return(await _e(`/api/agents/${s}`,{method:"DELETE"})).ok?(e({agents:r().agents.filter(u=>u.id!==s)}),!0):!1}catch{return!1}},restoreDefault:async s=>{try{return(await _e(`/api/agents/${s}/restore-default`,{method:"POST"})).ok?(await i(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/agents/restore-all-defaults",{method:"POST"})).ok?(await i(),!0):!1}catch{return!1}}}});function V3(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&W3(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function Y3(e,r){if(e.segments&&e.segments.length>0)return K3(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function K3(e,r,i,s,c){const u=[],p=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const d=p.get(l.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const l of i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const rf=H.memo(function({message:r,showStats:i=!0}){const s=Ce(l=>{var d;return(d=l.currentSession)==null?void 0:d.criteria}),c=rn(l=>l.agents),u=Y3(r,i),p=V3(u);return p.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[p.map((l,d)=>{var f,g;switch(l.type){case"thinking":return o.jsx(y3,{content:l.content},d);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(Ii,{content:l.content})},d);case"preparing_tool_call":return o.jsx(U3,{name:l.preparing.name},`preparing-${l.preparing.index}`);case"tool_call":{const m=l.toolCall,b=m.result;if(m.name==="todo_write"){const C=m.arguments.todos,v=Array.isArray(C)?C:[];return o.jsx(q3,{todos:v},d)}const S=(f=b==null?void 0:b.output)==null?void 0:f.includes("[interrupted by user]"),k=b?S?"interrupted":b.success?"success":"error":"pending";return o.jsx(H3,{tool:m.name,args:m.arguments,status:k,variant:"expandable",result:b==null?void 0:b.output,error:b==null?void 0:b.error,durationMs:b==null?void 0:b.durationMs,diagnostics:b==null?void 0:b.diagnostics,editContext:b==null?void 0:b.editContext,startedAt:m.startedAt,streamingOutput:m.streamingOutput,metadata:b==null?void 0:b.metadata,callId:m.id},d)}case"criteria_group":return o.jsx(Qy,{toolCalls:l.toolCalls,criteria:s},d);case"stats":{const m=l.stats,b=((g=m.model.split("/").pop())==null?void 0:g.split("-").slice(0,2).join("-"))??m.model,S=Bl(c,m.mode),k=v=>v>=1e3?`${(v/1e3).toFixed(1)}k`:v.toString(),C=v=>v>=1e3?`${(v/1e3).toFixed(1)}k`:v.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:b}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:S},children:m.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[m.totalTime.toFixed(1),"s"]}),m.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[m.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[k(m.prefillTokens)," @ ",C(m.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[k(m.generationTokens)," @ ",C(m.generationSpeed)," tg"]}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},d)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{children:"Aborted"})]})]})})}),Vt=qn((e,r)=>({workflows:[],defaultIds:[],modifiedIds:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await _e("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchDefaultIds:async()=>{try{const s=await(await _e("/api/workflows/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await _e("/api/workflows")).json();e({workflows:s.workflows??[],activeWorkflowId:s.activeWorkflowId??"default",defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await _e(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await ii("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const c=await ii("PUT",`/api/workflows/${i}`,s);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async i=>{try{return(await _e(`/api/workflows/${i}`,{method:"DELETE"})).ok?(e({workflows:r().workflows.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/workflows/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/workflows/restore-all-defaults",{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}}}));function zl(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}function X3(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function Z3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const Q3=H.memo(function({data:r}){var c;const s=((c=Vt(u=>u.workflows).find(u=>u.id===r.workflowId))==null?void 0:c.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:zl(s,.3),backgroundColor:zl(s,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:s,viewBox:"0 0 24 24",children:o.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"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:s},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ba,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ba,{label:"Total time",value:X3(r.totalTimeSeconds)}),o.jsx(Ba,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ba,{label:"Tokens",value:Z3(r.totalTokensGenerated)}),o.jsx(Ba,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ba({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const J3=H.memo(function({data:r}){var c;const s=((c=Vt(u=>u.workflows).find(u=>u.id===r.workflowId))==null?void 0:c.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:zl(s,.3),backgroundColor:zl(s,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:s,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:s},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function eT({attachments:e,messageId:r}){const[i,s]=H.useState(null),c=Ce(g=>g.visionFallbackByMessage),u=Ce(g=>g.messages),p=H.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const b=u[m];if(b&&b.role==="assistant")return b.id}return null},[u,r]),l=g=>{s(g)},d=()=>{s(null)},f=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(p){const b=`${p}-${g}`;return c[b]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=f(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.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"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.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?"...":""]})]},g.id)})}),i&&o.jsx(Zy,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function tT({isOpen:e,onClose:r,promptContext:i}){const[s,c]=H.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=p=>{c(l=>({...l,[p]:!l[p]}))};return o.jsx(un,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(ws,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(ws,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((p,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:p.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:p.source}),p.toolCallId&&o.jsx("span",{className:"font-mono",children:p.toolCallId}),p.attachments&&p.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[p.attachments.length," attachment",p.attachments.length===1?"":"s"]})]}),p.attachments&&p.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:p.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:p.content||"(empty)"})]},`${p.role}-${l}`))})}),o.jsx(ws,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((p,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:p.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:p.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(p.parameters,null,2)})]},`${p.name}-${l}`))]})}),o.jsx(ws,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(ws,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((p,l)=>o.jsx(nT,{file:p,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(ws,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function nT({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function ws({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function rT({content:e,promptContext:r,align:i="right"}){const[s,c]=H.useState(!1),[u,p]=H.useState(!1),[l,d]=H.useState(!1),f=H.useRef(null);H.useEffect(()=>{const b=S=>{f.current&&!f.current.contains(S.target)&&c(!1)};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const b=document.createElement("textarea");b.value=e,b.style.position="fixed",b.style.left="-999999px",document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}d(!0),c(!1),window.setTimeout(()=>d(!1),1500)}catch(b){console.error("Failed to copy:",b)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:f,className:"relative",children:[o.jsx("button",{onClick:()=>c(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,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:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{p(!0),c(!1)},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:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"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"})]}),"Inspect"]})]})]})]}),r&&o.jsx(tT,{isOpen:u,onClose:()=>p(!1),promptContext:r})]})}function iT({message:e}){const[r,i]=H.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",p=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[p]??"injected",f=p==="workflow"||p==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${f?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!f&&i(!0)}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!f&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&i(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(un,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.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 sT({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(rT,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(eT,{attachments:e.attachments,messageId:e.id})]})]})}const Jy=H.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",p=r.role==="system",l=r.role==="tool";if(u)return o.jsx(rf,{message:r,showStats:i});if(p&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
137
- `,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(J3,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(Q3,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(iT,{message:r}):c?o.jsx(sT,{message:r,promptContext:s}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(Ii,{content:r.content})})})}),e0=(e,r)=>{const i=H.useRef(!0),[s,c]=H.useState(!0),u=()=>{const p=e.current;p&&(p.scrollTop=p.scrollHeight)};return H.useEffect(()=>{const p=e.current;if(!p)return;const l=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{p.scrollHeight-p.scrollTop-p.offsetHeight<100&&(i.current=!0,c(!0))}));return}i.current=!1,c(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),f=setInterval(()=>{i.current&&u()},1e3);return p.addEventListener("wheel",l,{passive:!0}),d.observe(p,{childList:!0,subtree:!0,characterData:!0}),()=>{p.removeEventListener("wheel",l),d.disconnect(),clearInterval(f)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,c(!0),u()},isAutoScrollActive:s,setAutoScroll:p=>{i.current=p,c(p),p&&u()}}},aT={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function oT(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function lT(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function cT({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:lT(u,c),children:[Dl(r),"/",Dl(i)]}),o.jsx(Ab,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const uT=H.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=H.useRef(null),p=H.useRef(null),[l,d]=H.useState(!1),f=rn(_=>_.agents),g=Ce(_=>_.subAgentContextStates[s]),{isAutoScrollActive:m,setAutoScroll:b}=e0(p,null);H.useEffect(()=>{c||b(!0)},[c]);const S=H.useCallback(()=>{const _=!l;d(_),_&&setTimeout(()=>{var j;(j=u.current)==null||j.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),k=f.find(_=>_.id===i),C=(k==null?void 0:k.name)??aT[i]??i,v=Bl(f,i),y=oT(v),x=r.filter(_=>_.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b",style:y,children:[o.jsx("span",{className:"text-xs font-medium",children:C}),o.jsxs("div",{className:"flex items-center gap-2",children:[g&&o.jsx(cT,{contextState:g}),o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>b(!m),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${m?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:S,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:p,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:x.map(_=>_.role==="assistant"?o.jsx(rf,{message:_,showStats:!0},_.id):o.jsx(Jy,{message:_,isLastAssistantMessage:!1},_.id))})]})});function dT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function Gv(e,r,i,s,c,u,p,l){return o.jsx(hT,{agent:e,isConfirmingDelete:r===e.id,isModified:i.includes(e.id),isConfirmingRestore:s===e.id,onRestore:async()=>{await c(e.id),u(null)},onEdit:()=>p(e.id),onDelete:()=>l(e.id)},e.id)}function hT({agent:e,isConfirmingDelete:r,isConfirmingRestore:i,isModified:s,onRestore:c,onEdit:u,onDelete:p}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),s&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s&&(i?o.jsx(As,{type:"restore",onConfirm:c,onCancel:()=>{}}):o.jsx(_h,{onClick:c})),o.jsx(si,{onClick:u}),r?o.jsx(As,{type:"delete",onConfirm:p,onCancel:()=>{}}):o.jsx(yh,{onClick:p})]})]})}function fT({isOpen:e,onClose:r,initialEditId:i}){const s=rn(xe=>xe.agents),c=rn(xe=>xe.modifiedIds),u=rn(xe=>xe.loading),p=rn(xe=>xe.fetchAgents),l=rn(xe=>xe.fetchAgent),d=rn(xe=>xe.createAgent),f=rn(xe=>xe.updateAgent),g=rn(xe=>xe.deleteAgent),m=rn(xe=>xe.restoreDefault),b=rn(xe=>xe.restoreAllDefaults),[S,k]=H.useState("list"),[C,v]=H.useState(null),[y,x]=H.useState(""),[_,j]=H.useState(""),[A,N]=H.useState(""),[R,T]=H.useState(!0),[I,z]=H.useState([]),[V,Y]=H.useState("#6b7280"),[$,F]=H.useState(""),[P,B]=H.useState(""),[X,Q]=H.useState(!1),[O,D]=H.useState(null),[L,q]=H.useState(null),[U,K]=H.useState(!1),[ee,ne]=H.useState([]);function Z(xe){const ze=new Map;for(const Pe of xe){const qe=Pe.indexOf(":");if(qe===-1)ze.set(Pe,new Set);else{const ot=Pe.slice(0,qe),ve=Pe.slice(qe+1).split(",").filter(Boolean);ze.set(ot,new Set(ve))}}return ze}function W(xe){const ze=[];for(const[Pe,qe]of xe)qe.size===0?ze.push(Pe):ze.push(`${Pe}:${[...qe].join(",")}`);return ze}const ae=Z(I),se=(xe,ze)=>{const Pe=new Map(ae),qe=Pe.get(xe)||new Set,ot=new Set(qe);ot.has(ze)?ot.delete(ze):ot.add(ze),ot.size===0?Pe.set(xe,new Set):Pe.set(xe,ot),z(W(Pe))},pe=xe=>{const ze=new Map(ae);ze.has(xe)?ze.delete(xe):ze.set(xe,new Set),z(W(ze))},be=(xe,ze=!1)=>{x(xe.metadata.name),j(xe.metadata.id),N(xe.metadata.description),T(xe.metadata.subagent),z(xe.metadata.allowedTools),Y(xe.metadata.color??"#6b7280"),F(xe.prompt),ze&&B("")};H.useEffect(()=>{e&&(p(),_e("/api/tools").then(xe=>xe.json()).then(xe=>ne(xe.tools||[])).catch(()=>ne([])),D(null),q(null),K(!1),i?(k("edit"),v(i),B(""),l(i).then(xe=>{xe&&be(xe)})):(k("list"),v(null)))},[e,p,l,i]);const je=()=>{v(null),x(""),j(""),N(""),T(!0),z(["read_file"]),Y("#6b7280"),F(""),B(""),k("edit")},Ne=async xe=>{const ze=await l(xe);ze&&(v(xe),be(ze,!0),k("edit"))},Le=async xe=>{await g(xe),D(null)},Ue=async()=>{const xe=C??_;if(!xe||!y||!$){B("Name and prompt are required.");return}Q(!0),B("");const ze={metadata:{id:xe,name:y,description:A,subagent:R,allowedTools:I,color:V},prompt:$},Pe=C?await f(C,ze):await d(ze);if(Q(!1),!Pe.success){B(Pe.error??"Failed to save agent.");return}i?r():k("list")},we=()=>{i?r():k("list")},ct=xe=>{x(xe),C||j(dT(xe))};if(S==="edit")return o.jsx(un,{isOpen:e,onClose:we,title:C?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[P&&o.jsx(wh,{message:P}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ti,{label:"Name",value:y,onChange:ct,placeholder:"My Agent"}),o.jsx(Ti,{label:"ID",value:_,onChange:j,readOnly:!!C,placeholder:"my_agent",hint:C?"(read-only)":void 0,mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ti,{label:"Description",value:A,onChange:N,placeholder:"What this agent does"}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>T(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${R?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>T(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${R?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:V,onChange:xe=>Y(xe.target.value),className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.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:ee.map(xe=>{const ze=ae.has(xe.name),Pe=xe.actions.length>0,qe=ae.get(xe.name)||new Set,ot=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${ze?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:[o.jsx("span",{children:xe.name}),Pe&&o.jsx("span",{className:`text-[10px] ${ze&&qe.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},xe.name);return Pe?o.jsx(Ja,{trigger:ot,minWidth:"160px",items:[...xe.actions.map(ue=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${xe.name}-${ue}`,children:[o.jsx("input",{type:"checkbox",id:`${xe.name}-${ue}`,checked:qe.has(ue),onChange:()=>se(xe.name,ue),className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:ue})]}),closeOnClick:!1})),{label:ze?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(ze)pe(xe.name);else{const ue=new Map(ae);ue.set(xe.name,new Set(xe.actions)),z(W(ue))}}}]},xe.name):o.jsx("button",{onClick:()=>pe(xe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${ze?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:o.jsx("span",{children:xe.name})},xe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] mt-5 overflow-hidden",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:$,onChange:xe=>F(xe.target.value),placeholder:"Instructions for this agent...",className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsx(Sh,{onCancel:we,onSave:Ue,saving:X,saveDisabled:!y||!$})]})});const ut=s.filter(xe=>xe.subagent),jt=s.filter(xe=>!xe.subagent);return o.jsxs(un,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[c.length>0&&(U?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await b(),K(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>K(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>K(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all agents to defaults",children:"Restore Defaults"})),o.jsx(yt,{variant:"primary",size:"sm",onClick:je,children:"+ New"})]})]}),u&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[jt.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Top-level"}),o.jsx("div",{className:"space-y-2",children:jt.map(xe=>Gv(xe,O,c,L,m,q,Ne,Le))})]}),ut.length>0&&o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:ut.map(xe=>Gv(xe,O,c,L,m,q,Ne,Le))})]})]})]})}function pT(){const e=Ce(C=>{var v;return(v=C.currentSession)==null?void 0:v.mode}),r=Ce(C=>C.switchMode),i=rn(C=>C.agents),s=rn(C=>C.fetchAgents),[c,u]=H.useState(!1),[p,l]=H.useState(!1),[d,f]=H.useState(null),g=H.useRef(null);if(H.useEffect(()=>{s()},[s]),H.useEffect(()=>{function C(v){g.current&&!g.current.contains(v.target)&&u(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),!e)return null;const m=i.filter(C=>!C.subagent),b=m.find(C=>C.id===e),S=(b==null?void 0:b.name)??e,k=Bl(i,e);return o.jsxs("div",{className:"relative",ref:g,children:[o.jsxs("button",{type:"button",onClick:()=>u(!c),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:k},children:S}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${c?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),c&&m.length>0&&o.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:[m.map(C=>{const v=C.id===e,y=Bl(i,C.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${v?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{v||r(C.id),u(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:y},children:C.name}),v&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(si,{className:"opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),u(!1),f(C.id),l(!0)}})]},C.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{u(!1),l(!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..."})})]}),o.jsx(fT,{isOpen:p,onClose:()=>{l(!1),f(null)},initialEditId:d})]})}function mT(){const e=Ce(s=>s.currentSession),r=Ce(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="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"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="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 gT({question:e}){const r=Ce(f=>f.answerQuestion),i=H.useRef(null),s=H.useRef(null),[c,u]=H.useState(""),p=H.useCallback(f=>{f.key},[]);H.useEffect(()=>{var f;return s.current=document.activeElement,(f=i.current)==null||f.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),H.useEffect(()=>(document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)),[p]);const l=()=>{r(e.callId,c)},d=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),l())};return $l.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),o.jsxs("div",{ref:i,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[o.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:c,onChange:f=>u(f.target.value),onKeyDown:d,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})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[o.jsx(yt,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(yt,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})]}),document.body)}function xT(){const e=Ce(s=>s.connectionStatus),r=Ce(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
138
- flex items-center justify-between px-4 py-2
139
- text-sm font-medium
140
- ${i?"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"}
141
- `,children:[o.jsx("div",{className:"flex items-center gap-2",children:i?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"flex gap-1",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"150ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse",style:{animationDelay:"300ms"}})]}),o.jsx("span",{children:"Reconnecting to server..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{children:"Connection lost"})]})}),o.jsx("button",{onClick:()=>r(),disabled:i,className:`
142
- px-3 py-1 rounded text-xs font-medium
143
- transition-colors
144
- ${i?"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"}
145
- `,children:i?"Reconnecting...":"Reconnect"})]})}function vT(){const e=LS(),r=e?"bg-amber-400":"bg-accent-primary";return o.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"flex gap-0.5",children:[o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),o.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&o.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function bT({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return o.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[o.jsx(Ds,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),o.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),o.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),o.jsx("div",{className:"text-[10px] text-text-muted",children:i(e.size)})]})}function yT({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const u=H.useRef(null),p=H.useRef(null);H.useEffect(()=>{p.current&&u.current&&p.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const l=f=>{switch(f.key){case"Enter":f.preventDefault(),e[r]&&i(e[r].content);break;case"Escape":f.preventDefault(),s();break;case"ArrowUp":f.preventDefault(),c("up");break;case"ArrowDown":f.preventDefault(),c("down");break}},d=f=>{i(f)};return o.jsx("div",{ref:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((f,g)=>o.jsxs("div",{ref:g===r?p:null,role:"listitem",onClick:()=>d(f.content),className:`
146
- p-2 rounded cursor-pointer transition-colors
147
- ${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
148
- `,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}const _T={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function ST(e,r={}){const i={..._T,...r};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<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=TT(c),p=`data:${e.type};base64,${u}`,l=await t0(p);return{dataUrl:p,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await wT(e,i)}async function wT(e,r){const i=await kT(e),s=await t0(i),{width:c,height:u}=CT(s.width,s.height,r.maxWidth,r.maxHeight),p=ET();p.width=c,p.height=u;const l=p.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,c,u);let d=r.quality,f;do{if(f=p.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Vv(f)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Vv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function CT(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function kT(e){return new Promise((r,i)=>{const s=NT(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function t0(e){return new Promise((r,i)=>{const s=jT(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function ET(){var r;const e=sf();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function jT(){const e=sf();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function NT(){const e=sf();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function sf(){return globalThis}function TT(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function Vv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function AT(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function DT(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Yv(e.size)}). Maximum size is ${Yv(r)}.`}:{valid:!0}}function Yv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Kd(e,r,i,s={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=s;if(!AT(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const p=DT(e,c);if(!p.valid){i(p.error??"Image file is too large");return}try{const l=await ST(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:cb(),filename:u??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};r(d)}catch(l){const d=l instanceof Error?l.message??"Failed to process image":"Failed to process image";i(d)}}function RT(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function LT({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=H.useState(s.contextWindow),[p,l]=H.useState(!1),d=Et(m=>m.updateModelContext);if(H.useEffect(()=>{u(s.contextWindow)},[s]),!e)return null;const f=async()=>{c<1024||c>1e7||(l(!0),await d(i,s.id,c),l(!1),r())},g=()=>{u(s.contextWindow),r()};return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[o.jsx("div",{className:"px-6 py-4 border-b border-border",children:o.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),o.jsxs("div",{className:"px-6 py-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),o.jsx("input",{type:"number",min:1024,max:1e7,value:c,onChange:m=>u(parseInt(m.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),o.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[o.jsx("button",{type:"button",onClick:g,disabled:p,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),o.jsx("button",{type:"button",onClick:f,disabled:p||c<1024||c>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Saving...":"Save"})]})]})})}function MT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function OT(){var P;const[,e]=sr(),r=Ce(B=>B.currentSession),i=Ce(B=>B.setSessionProvider),[s,c]=H.useState(!1),[u,p]=H.useState([]),[l,d]=H.useState(null),f=H.useRef(null),[g,m]=H.useState(null),b=H.useRef(new Set),S=Et(B=>B.providers),k=Et(B=>B.activeProviderId),C=Et(B=>B.model);Et(B=>B.backend);const v=Et(B=>B.llmStatus),y=Et(B=>B.activating),x=Et(B=>B.activateProvider),_=Et(B=>B.refreshModel),j=Et(B=>B.refreshProviderModels);H.useEffect(()=>{function B(X){f.current&&!f.current.contains(X.target)&&(c(!1),p([]),b.current=new Set)}return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]),H.useEffect(()=>{if(s){const B=S.map(X=>X.id);p(B),B.forEach(X=>{b.current.has(X)||(b.current.add(X),R(X))})}},[s,S]),S.find(B=>B.id===k);const A=v==="disconnected",N=C?((P=C.split("/").pop())==null?void 0:P.replace(/-/g," "))??C:"detecting...",R=async B=>{d(B);try{await j(B)}catch{}finally{d(null)}},T=B=>{u.includes(B.id)?p(u.filter(X=>X!==B.id)):(p([...u,B.id]),R(B.id))},I=async B=>{if(B.id===k){T(B);return}r?(i(B.id,void 0),Et.getState().syncFromSession(B.id,""),c(!1),p([])):await x(B.id)&&(c(!1),p([]))},z=B=>{T(B)},V=async(B,X)=>{B.stopPropagation(),b.current.delete(X),await j(X),await R(X)},Y=(B,X)=>{m({providerId:B,model:X})},$=()=>{m(null)},F=async(B,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",B,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(B,X),Et.getState().syncFromSession(B,X),p([]),c(!1);return}d("activating");try{(await _e(`/api/providers/${B}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await Et.getState().fetchConfig(),p([]),c(!1))}catch{}finally{d(null)}};return S.length===0?o.jsxs("button",{type:"button",onClick:()=>_(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:f,children:[o.jsxs("button",{type:"button",onClick:()=>c(!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:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&o.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",children:[o.jsx("div",{className:"py-1",children:S.map(B=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${B.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${y?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!y&&I(B),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${B.id===k?"text-accent-primary":"text-text-primary"}`,children:B.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:B.backend!=="auto"&&mS(B.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[B.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),V(Q,B.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${l===B.id?"animate-spin":""} ${B.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),z(B)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(B.id)?"rotate-180":""} ${B.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(B.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===B.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=B.models)!=null&&X.length?B.models.map(Q=>{var O;return o.jsxs("button",{type:"button",onClick:()=>F(B.id,Q.id),disabled:l==="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 ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Q.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((O=Q.id.split("/").pop())==null?void 0:O.replace(/-/g," "))??Q.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:MT(Q.contextWindow)}),o.jsx("button",{type:"button",onClick:D=>{D.stopPropagation(),Y(B.id,Q)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})})]}),C===Q.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Q.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},B.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(LT,{isOpen:!0,onClose:$,providerId:g.providerId,model:g.model})]})}const Un=qn((e,r)=>({commands:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await _e("/api/commands/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchCommands:async()=>{e({loading:!0});try{const s=await(await _e("/api/commands")).json();e({commands:s.commands??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchCommand:async i=>{try{const s=await _e(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await ii("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const c=await ii("PUT",`/api/commands/${i}`,s);return c.success&&await r().fetchCommands(),c},deleteCommand:async i=>{try{return(await _e(`/api/commands/${i}`,{method:"DELETE"})).ok?(e({commands:r().commands.filter(c=>c.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await _e(`/api/commands/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await _e("/api/commands/restore-all-defaults",{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}}}));function IT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function n0({isOpen:e,onClose:r,initialEditId:i}){const s=Un(L=>L.commands),c=Un(L=>L.modifiedIds),u=Un(L=>L.loading),p=Un(L=>L.fetchCommands),l=Un(L=>L.fetchCommand),d=Un(L=>L.createCommand),f=Un(L=>L.updateCommand),g=Un(L=>L.deleteCommand),m=Un(L=>L.restoreDefault),{view:b,editingId:S,formError:k,saving:C,formData:v,setView:y,setEditingId:x,setFormError:_,setFormData:j,setSaving:A}=yb(),{requestDelete:N,requestRestore:R,requestRestoreAll:T,clearConfirm:I,isConfirming:z,isConfirmingRestoreAll:V}=gb(),Y=rn(L=>L.agents),$=rn(L=>L.fetchAgents),F=Y.filter(L=>!L.subagent);H.useEffect(()=>{e&&(p(),$(),I(),i?(y("edit"),x(i),_(""),l(i).then(L=>{L&&j({name:L.metadata.name,id:L.metadata.id,prompt:L.prompt,agentMode:L.metadata.agentMode??""})})):(y("list"),x(null)))},[e,p,$,l,i,I]);const P=()=>{j({name:"",id:"",prompt:"",agentMode:""}),y("edit")},B=async L=>{const q=await l(L);q&&(x(L),j({name:q.metadata.name,id:q.metadata.id,prompt:q.prompt,agentMode:q.metadata.agentMode??""}),_(""),y("edit"))},X=async L=>{await g(L),I()},Q=async()=>{const L=S??v.id;if(!L||!v.name||!v.prompt){_("Name and message are required.");return}A(!0),_("");const q={metadata:{id:L,name:v.name,...v.agentMode?{agentMode:v.agentMode}:{}},prompt:v.prompt},U=S?await f(S,q):await d(q);if(A(!1),!U.success){_(U.error??"Failed to save command.");return}i?r():y("list")},O=()=>{i?r():y("list")},D=L=>{j(q=>({...q,name:L})),S||j(q=>({...q,id:IT(L)}))};return b==="edit"?o.jsx(un,{isOpen:e,onClose:O,title:S?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"space-y-3",children:[k&&o.jsx(wh,{message:k}),o.jsx(bb,{name:v.name,id:v.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!S,onNameChange:D,onIdChange:L=>j(q=>({...q,id:L}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:v.agentMode,onChange:L=>j(q=>({...q,agentMode:L.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:[o.jsx("option",{value:"",children:"None (keep current mode)"}),F.map(L=>o.jsx("option",{value:L.id,children:L.name},L.id))]})]}),o.jsx(xb,{label:"Message",value:v.prompt,onChange:L=>j(q=>({...q,prompt:L})),placeholder:"The message that will be sent when this command is triggered...",className:"h-64"}),o.jsx(Sh,{onCancel:O,onSave:Q,saving:C,saveDisabled:!v.name||!v.prompt})]})}):o.jsxs(un,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(vb,{description:"Commands are pre-defined messages you can send with a single click.",modifiedCount:c.length,onRestoreAll:T,isConfirmingRestoreAll:V(),onCancelRestoreAll:I,onNew:P}),u&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading commands..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No commands created yet."}):o.jsx("div",{className:"space-y-2",children:s.map(L=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:L.name}),c.includes(L.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[c.includes(L.id)&&(z(L.id,"restore")?o.jsx(As,{type:"restore",onConfirm:()=>m(L.id).then(I),onCancel:I}):o.jsx(_h,{onClick:()=>R(L.id)})),o.jsx(si,{onClick:()=>B(L.id)}),z(L.id,"delete")?o.jsx(As,{type:"delete",onConfirm:()=>X(L.id),onCancel:I}):o.jsx(yh,{onClick:()=>N(L.id)})]})]},L.id))})]})}function r0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:c}){const[u,p]=H.useState(""),[l,d]=H.useState(0),f=H.useRef(null),g=H.useRef(null);H.useEffect(()=>{r&&(p(""),d(0),requestAnimationFrame(()=>{var v;return(v=g.current)==null?void 0:v.focus()}))},[r]),H.useEffect(()=>{if(!r)return;const v=y=>{f.current&&!f.current.contains(y.target)&&s()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,s]);const m=H.useCallback(()=>{r?s():i()},[r,i,s]),b=H.useCallback(v=>{p(v),d(0)},[]),S=H.useCallback(v=>{const y=e.filter(x=>c(x,u));switch(v.key){case"ArrowDown":v.preventDefault(),d(x=>Math.min(x+1,y.length-1));break;case"ArrowUp":v.preventDefault(),d(x=>Math.max(x-1,0));break;case"Enter":v.preventDefault();break;case"Escape":v.preventDefault(),s();break}},[e,u,c,s]),k=H.useCallback(()=>{d(0)},[]),C=e.filter(v=>c(v,u));return{isOpen:r,search:u,selectedIndex:l,filtered:C,containerRef:f,searchRef:g,handleToggle:m,handleSearchChange:b,handleKeyDown:S,setSelectedIndex:d,resetSelection:k}}function i0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function s0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:c}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:c,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"})})}function a0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function o0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function l0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,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:e})})}function BT({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,u]=H.useState(!1),[p,l]=H.useState(null),d=Un(A=>A.commands),f=Un(A=>A.fetchCommands),{isOpen:g,search:m,selectedIndex:b,filtered:S,containerRef:k,searchRef:C,handleToggle:v,handleSearchChange:y,handleKeyDown:x}=r0({items:d,isOpen:c,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(A,N)=>!N||A.name.toLowerCase().includes(N.toLowerCase())});H.useEffect(()=>{c&&f()},[c,f]);const _=async A=>{const N=await Un.getState().fetchCommand(A);N&&e(N.prompt,N.metadata.agentMode,i,s),u(!1)},j=()=>{u(!1),r()};return o.jsxs("div",{ref:k,className:"relative",children:[o.jsx(i0,{label:"Commands",isOpen:g,onClick:v}),g&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:x,children:[o.jsx(s0,{value:m,onChange:y,onKeyDown:x,ref:C,placeholder:"Search commands..."}),o.jsx(a0,{children:S.length===0?o.jsx(o0,{hasItems:d.length>0,message:"No commands yet"}):S.map((A,N)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${N===b?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>_(A.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:A.name})}),o.jsx(si,{className:"opacity-0 group-hover:opacity-100",onClick:R=>{R.stopPropagation(),u(!1),l(A.id)}})]},A.id))}),o.jsx(l0,{label:"Manage Commands...",onClick:j})]}),o.jsx(n0,{isOpen:!!p,onClose:()=>l(null),initialEditId:p})]})}function zT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function HT(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const PT=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],c0={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},u0=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],Ei=150,jr=54,Cs=80,Nn=30,ks=70,Kv=100,ji=50,El=50,Xv=4;function af(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function FT(e,r,i,s){const c=El+ji+Ei+Kv+Ei+ji+El,u=c/2,p=El+ji+Ei/2,l=El+ji+Ei+Kv+Ei/2,d=[],f=[],g=new Map,m=e.filter(F=>F.type==="agent"||F.type==="shell"),b=e.filter(F=>F.type==="sub_agent"),S=b.length>0,k=S?p:u,C=m.length>0?l:u,v=ji+Nn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:v,w:Cs,h:Nn}),g.set("$start",{cx:k,cy:v,w:Cs,h:Nn}),e.length===0){const F=v+Nn/2+ks*2+Nn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:F,w:Cs,h:Nn}),g.set("$done",{cx:k,cy:F,w:Cs,h:Nn}),{nodes:d,edges:f,width:c,height:F+Nn/2+ji,posMap:g}}const y=v+Nn/2+ks,x=(F,P)=>{F.forEach((B,X)=>{const Q=y+X*(jr+ks)+jr/2,{name:O,color:D}=af(B,s);d.push({id:B.id,type:"step",label:O,color:D,cx:P,cy:Q,w:Ei,h:jr}),g.set(B.id,{cx:P,cy:Q,w:Ei,h:jr})})};x(m,k),x(b,C);const _=m.length>0?y+(m.length-1)*(jr+ks)+jr/2:v,j=S?y+(b.length-1)*(jr+ks)+jr/2:v,A=Math.max(_,j)+jr/2+ks+Nn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:A,w:Cs,h:Nn}),g.set("$done",{cx:k,cy:A,w:Cs,h:Nn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let R=0;for(const F of e)F.transitions.forEach((P,B)=>{if(!P.goto||!g.has(P.goto))return;const X=g.get(F.id),Q=g.get(P.goto),O=P.when.type==="step_result"?`${P.when.result}`:c0[P.when.type]??P.when.type,D=F.id===P.goto;let L;D?L="back":Q.cy>X.cy+1?L="down":Q.cy<X.cy-1?L="back":L="same",N.push({from:F.id,to:P.goto,label:O,edgeKey:`${F.id}:${B}`,direction:L,backEdgeIndex:L==="back"?R++:0})});const T=new Map,I=new Map,z=new Map,V=new Map;for(const F of N)F.direction==="down"&&(T.set(F.from,(T.get(F.from)??0)+1),I.set(F.to,(I.get(F.to)??0)+1));const Y=new Map,$=new Map;for(const F of N){if(F.direction!=="same")continue;const P=[F.from,F.to].sort().join("|");Y.set(P,(Y.get(P)??0)+1)}for(const F of N){if(F.direction==="back"||F.direction==="same"){let L=0;if(F.direction==="same"){const q=[F.from,F.to].sort().join("|");L=$.get(q)??0,$.set(q,L+1)}f.push({...F,fromPort:0,toPort:0,sameEdgeIndex:L});continue}const P=T.get(F.from)??1,B=I.get(F.to)??1,X=z.get(F.from)??0,Q=V.get(F.to)??0;z.set(F.from,X+1),V.set(F.to,Q+1);const O=P===1?0:-.6+1.2*X/(P-1),D=B===1?0:-.6+1.2*Q/(B-1);f.push({...F,fromPort:O,toPort:D,sameEdgeIndex:0})}return{nodes:d,edges:f,width:c,height:A+Nn/2+ji,posMap:g}}function UT({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,onSelectNode:p,onSelectEdge:l,onRemoveStep:d,onCreateTransition:f,onReconnectTo:g,onReconnectFrom:m,onDeleteTransition:b}){const S=H.useRef(null),k=H.useRef(!1),[C,v]=H.useState(null),[y,x]=H.useState(null),[_,j]=H.useState(null),{nodes:A,edges:N,width:R,height:T,posMap:I}=H.useMemo(()=>FT(e,r,c,u),[e,r,c,u]),z=H.useCallback(K=>{var ae;const ee=S.current;if(!ee)return{x:0,y:0};const ne=ee.createSVGPoint();ne.x=K.clientX,ne.y=K.clientY;const Z=(ae=ee.getScreenCTM())==null?void 0:ae.inverse();if(!Z)return{x:0,y:0};const W=ne.matrixTransform(Z);return{x:W.x,y:W.y}},[]),V=H.useCallback(K=>!K||!y||K==="$start"?!1:y.type==="reconnect-from"?K!=="$done":!0,[y]),Y=H.useCallback((K,ee)=>{K.stopPropagation(),K.preventDefault();const ne=z(K);x({type:"new",fromNodeId:ee,mouseX:ne.x,mouseY:ne.y})},[z]),$=H.useCallback((K,ee)=>{K.stopPropagation(),K.preventDefault();const ne=z(K);x({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:ne.x,mouseY:ne.y})},[z]),F=H.useCallback((K,ee)=>{K.stopPropagation(),K.preventDefault();const ne=z(K);x({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:ne.x,mouseY:ne.y})},[z]),P=H.useCallback(K=>{if(!y)return;const ee=z(K);x(ne=>ne?{...ne,mouseX:ee.x,mouseY:ee.y}:null)},[y,z]),B=H.useCallback(()=>{y&&(k.current=!0,_&&V(_)&&(y.type==="new"?f(y.fromNodeId,_):y.type==="reconnect-to"?g(y.edgeKey,_):y.type==="reconnect-from"&&m(y.edgeKey,_)),x(null),j(null))},[y,_,V,f,g,m]),X=H.useCallback(()=>{if(k.current){k.current=!1;return}p(null),l(null)},[p,l]);H.useEffect(()=>{const K=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&s&&s!=="start"&&(ee.preventDefault(),b(s),l(null))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[s,b,l]);const Q=K=>{const ee=I.get(K.from),ne=I.get(K.to);if(!ee||!ne)return null;let Z,W,ae,se="middle",pe,be;if(K.direction==="down"){const je=ee.cx+K.fromPort*(ee.w/2-10),Ne=ee.cy+ee.h/2,Le=ne.cx+K.toPort*(ne.w/2-10),Ue=ne.cy-ne.h/2,we=Ue-Ne,ct=Le-je;Z=`M ${je} ${Ne} C ${je} ${Ne+we*.4}, ${Le-ct*.2} ${Ue-we*.1}, ${Le} ${Ue}`,W=je+(Le-je)*.5,ae=Ne+we*.6,pe={x:je,y:Ne},be={x:Le,y:Ue}}else if(K.direction==="back"){const je=K.from===K.to,Ne=ee.cx>=R/2,Le=K.backEdgeIndex*16,Ue=Ne?R-20-Le:20+Le;if(je){const we=ee.cx>=R/2,ct=30+K.backEdgeIndex*14,ut=ee.cy-ee.h/2,jt=we?ee.cx+ee.w/2:ee.cx-ee.w/2,xe=we?jt+ct:jt-ct,ze=ee.cx+(we?ee.w/4:-ee.w/4),Pe=ut-20-K.backEdgeIndex*10;Z=`M ${jt} ${ee.cy} C ${xe} ${ee.cy}, ${xe} ${Pe}, ${ze} ${ut}`,W=xe+10,ae=Pe+4,se="middle",pe={x:jt,y:ee.cy},be={x:ze,y:ut}}else{const we=Ne?ee.cx+ee.w/2:ee.cx-ee.w/2,ct=ne.cx+(Ne?ne.w/4:-ne.w/4),ut=Math.min(ee.cy,ne.cy)-ne.h/2-18-K.backEdgeIndex*14;Z=`M ${we} ${ee.cy} L ${Ue} ${ee.cy} L ${Ue} ${ut} L ${ct} ${ut} L ${ct} ${ne.cy-ne.h/2}`,W=Ue,ae=(ee.cy+ut)/2,se=Ne?"start":"end",pe={x:we,y:ee.cy},be={x:ct,y:ne.cy-ne.h/2}}}else{const je=ne.cx>ee.cx,Ne=K.sameEdgeIndex===0?-12:12,Le=je?ee.cx+ee.w/2:ee.cx-ee.w/2,Ue=je?ne.cx-ne.w/2:ne.cx+ne.w/2,we=ee.cy+Ne,ct=ne.cy+Ne,ut=(Le+Ue)/2;Z=`M ${Le} ${we} C ${ut} ${we}, ${ut} ${ct}, ${Ue} ${ct}`,W=ut,ae=(we+ct)/2-6,pe={x:Le,y:we},be={x:Ue,y:ct}}return{path:Z,labelX:W,labelY:ae,labelAnchor:se,fromPt:pe,toPt:be}},O=(K,ee)=>{const ne=Q(K);if(!ne)return null;const{path:Z,labelX:W,labelY:ae,labelAnchor:se}=ne,pe=s===K.edgeKey,be=K.label&&!(K.from==="$start"&&K.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:Z,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:je=>{je.stopPropagation(),l(pe?null:K.edgeKey)}}),o.jsx("path",{d:Z,fill:"none",stroke:pe?"#58a6ff":"#484f58",strokeWidth:pe?2.2:1.2,markerEnd:pe?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),be&&o.jsx("text",{x:W+(se==="start"?5:se==="end"?-5:0),y:ae+3,textAnchor:se,className:"text-[8px]",fill:pe?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:K.label})]},ee)},D=()=>{if(!s||y)return null;const K=N.find(ae=>ae.edgeKey===s);if(!K)return null;const ee=Q(K);if(!ee)return null;const{fromPt:ne,toPt:Z}=ee,W=6;return o.jsxs(o.Fragment,{children:[K.edgeKey!=="start"&&o.jsx("circle",{cx:ne.x,cy:ne.y,r:W,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>F(ae,K)}),o.jsx("circle",{cx:Z.x,cy:Z.y,r:W,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>$(ae,K)})]})},L=()=>{if(!y)return null;let K,ee,ne,Z;if(y.type==="reconnect-from"){const se=I.get(y.fixedTargetId);if(!se)return null;K=y.mouseX,ee=y.mouseY,ne=se.cx,Z=se.cy-se.h/2}else{const se=I.get(y.fromNodeId);if(!se)return null;K=se.cx,ee=se.cy+se.h/2,ne=y.mouseX,Z=y.mouseY}const W=Z-ee,ae=Math.abs(W)>10?`M ${K} ${ee} C ${K} ${ee+W*.4}, ${ne} ${Z-W*.4}, ${ne} ${Z}`:`M ${K} ${ee} L ${ne} ${Z}`;return o.jsx("path",{d:ae,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},q=K=>{const ee=K.cy+K.h/2,ne=(y==null?void 0:y.fromNodeId)===K.id;return o.jsx("circle",{cx:K.cx,cy:ee,r:Xv,fill:ne?"#58a6ff":"#1c2128",stroke:ne?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:ne?1:.5,className:"cursor-crosshair",onMouseDown:Z=>Y(Z,K.id)})},U=K=>{const ee=K.cy-K.h/2,ne=y&&_===K.id&&V(K.id);return o.jsx("circle",{cx:K.cx,cy:ee,r:Xv,fill:ne?"#3fb950":"#1c2128",stroke:ne?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:ne?1:.5})};return o.jsxs("svg",{ref:S,viewBox:`0 0 ${R} ${T}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:P,onMouseUp:B,onClick:X,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),N.map((K,ee)=>O(K,ee)),A.map(K=>{const ee=i===K.id,ne=K.cx-K.w/2,Z=K.cy-K.h/2,W=C===K.id,ae=y&&_===K.id&&V(K.id);if(K.type==="terminal"){const pe=K.id==="$start",be=pe?"#58a6ff":"#3fb950",je=pe,Ne=!pe;return o.jsxs("g",{onClick:Le=>{Le.stopPropagation(),pe&&l("start")},className:pe?"cursor-pointer":void 0,children:[ae&&o.jsx("rect",{x:ne-3,y:Z-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),pe&&s==="start"&&o.jsx("rect",{x:ne-3,y:Z-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:ne,y:Z,width:K.w,height:K.h,rx:K.h/2,fill:be,fillOpacity:.08,stroke:be,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:be,className:"text-[10px] font-medium",pointerEvents:"none",children:K.label}),je&&q(K),Ne&&U(K)]},K.id)}const se=K.color??"#6b7280";return o.jsxs("g",{onClick:pe=>{pe.stopPropagation(),p(ee?null:K.id)},onMouseEnter:()=>v(K.id),onMouseLeave:()=>v(null),className:"cursor-pointer",children:[ae&&o.jsx("rect",{x:ne-3,y:Z-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:ne-3,y:Z-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:ne,y:Z,width:K.w,height:K.h,rx:10,fill:se,fillOpacity:.08,stroke:se,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:K.label}),q(K),U(K),W&&!y&&o.jsxs("g",{onClick:pe=>{pe.stopPropagation(),d(K.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:ne+K.w-2,cy:Z+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:ne+K.w-5,y1:Z-1,x2:ne+K.w+1,y2:Z+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:ne+K.w+1,y1:Z-1,x2:ne+K.w-5,y2:Z+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},K.id)}),y&&A.map(K=>V(K.id)?o.jsx("rect",{x:K.cx-K.w/2-8,y:K.cy-K.h/2-8,width:K.w+16,height:K.h+16,fill:"transparent",rx:12,onMouseEnter:()=>j(K.id),onMouseLeave:()=>j(null),onMouseUp:ee=>{ee.stopPropagation(),B()}},`drop-${K.id}`):null),L(),D()]})}const Yn="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",Di="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",en="block text-[11px] text-text-secondary mb-0.5";function $T({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,onDelete:p}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(f=>f.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:p,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Condition"}),o.jsx("select",{value:i.type,onChange:f=>{u(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:Di,children:u0.map(f=>o.jsx("option",{value:f.value,children:f.label},f.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Result"}),d?o.jsx("select",{value:i.result??l.results[0],onChange:f=>{u({type:"step_result",result:f.target.value})},className:Di,children:l.results.map(f=>o.jsx("option",{value:f,children:f},f))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:f=>u({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Xd({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.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:`{{${i.name}}}`},i.name))})}function qT({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:p,onSetEntry:l}){const{color:d,name:f}=af(e,i);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:f}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:p,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,b=m==="sub_agent"?"verification":"build";if(m==="agent"){const S=i.find(k=>!k.subagent);u({...e,type:m,phase:b,toolMode:(S==null?void 0:S.id)??"builder",name:(S==null?void 0:S.name)??"Agent"})}else if(m==="sub_agent"){const S=i.find(k=>k.subagent);u({...e,type:m,phase:b,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else u({...e,type:m,phase:b,name:"Shell"})},className:Di,children:PT.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(b=>b.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Di,children:i.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(b=>b.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Di,children:[o.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Xd,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Xd,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Yn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Xd,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Yn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Yn} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const Zv=[];function d0({isOpen:e,onClose:r,initialEditId:i}){const s=Vt(he=>he.workflows),c=Vt(he=>he.modifiedIds),u=Vt(he=>he.loading),p=Vt(he=>he.templateVariables),l=Vt(he=>he.fetchWorkflows),d=Vt(he=>he.fetchWorkflow),f=Vt(he=>he.fetchTemplateVariables),g=Vt(he=>he.createWorkflow),m=Vt(he=>he.updateWorkflow),b=Vt(he=>he.deleteWorkflow),S=Vt(he=>he.restoreDefault),k=Vt(he=>he.restoreAllDefaults),[C,v]=H.useState("list"),[y,x]=H.useState(null),[_,j]=H.useState(null),[A,N]=H.useState(null),[R,T]=H.useState(null),[I,z]=H.useState(""),[V,Y]=H.useState(""),[$,F]=H.useState(""),[P,B]=H.useState("1.0.0"),[X,Q]=H.useState("#3b82f6"),[O,D]=H.useState(""),[L,q]=H.useState(50),[U,K]=H.useState(Zv),[ee,ne]=H.useState({type:"always"}),[Z,W]=H.useState(""),[ae,se]=H.useState(!1),[pe,be]=H.useState([]),[je,Ne]=H.useState(null),[Le,Ue]=H.useState(!1);H.useEffect(()=>{e&&(l(),f(),_e("/api/agents").then(he=>he.json()).then(he=>be(he.agents??[])).catch(()=>{}),j(null),Ne(null),Ue(!1),N(null),T(null),i?(v("edit"),x(i),W(""),d(i).then(he=>{he&&(z(he.metadata.name),Y(he.metadata.id),F(he.metadata.description),B(he.metadata.version),Q(he.metadata.color??"#3b82f6"),D(he.entryStep),q(he.settings.maxIterations),K(he.steps),ne(he.startCondition??{type:"always"}))})):(v("list"),x(null)))},[e,l,d,f,i]);const we=()=>{x(null),z(""),Y(""),F(""),B("1.0.0"),Q("#3b82f6"),D(""),q(50),K(structuredClone(Zv)),ne({type:"always"}),W(""),N(null),T(null),v("edit")},ct=async he=>{const Se=await d(he);Se&&(x(he),z(Se.metadata.name),Y(Se.metadata.id),F(Se.metadata.description),B(Se.metadata.version),Q(Se.metadata.color??"#3b82f6"),D(Se.entryStep),q(Se.settings.maxIterations),K(Se.steps),ne(Se.startCondition??{type:"always"}),W(""),N(null),T(null),v("edit"))},ut=async()=>{var nt;const he=y??V;if(!he||!I)return W("Name is required."),!1;if(U.length===0)return W("Add at least one step."),!1;let Se=O;if(!Se||!U.some(Oe=>Oe.id===Se)){if(Se=((nt=U.find(Oe=>Oe.id))==null?void 0:nt.id)??"",!Se)return W("All steps need an ID."),!1;D(Se)}se(!0),W("");const Be={metadata:{id:he,name:I,description:$,version:P||"1.0.0",color:X},entryStep:Se,settings:{maxIterations:L},steps:U,startCondition:ee},Ke=y?await m(y,Be):await g(Be);return se(!1),Ke.success?(y||x(he),!0):(W(Ke.error??"Failed to save."),!1)},jt=async()=>{await ut()},xe=async()=>{await ut()&&(i?r():v("list"))},ze=()=>{i?r():v("list")},Pe=he=>{z(he),y||Y(zT(he))},qe=H.useCallback(he=>{N(he),T(null)},[]),ot=H.useCallback(he=>{T(he),N(null)},[]),ue=A!==null?Number(A):-1,ve=ue>=0?U[ue]??null:null,Te=H.useCallback(he=>{K(Se=>Se.map((Be,Ke)=>Ke===ue?he:Be))},[ue]),He=ee.type==="step_result"?`${ee.result}`:c0[ee.type]??ee.type,ie=()=>{const he=U.length,Se=HT(U),Be=pe.find(Ke=>!Ke.subagent);K([...U,{id:Se,name:(Be==null?void 0:Be.name)??"Agent",type:"agent",phase:"build",toolMode:(Be==null?void 0:Be.id)??"builder",transitions:[]}]),O||D(Se),qe(String(he))},ke=H.useCallback((he,Se)=>{he==="$start"?(D(Se),ot("start")):K(Be=>{const Ke=Be.find(Oe=>Oe.id===he),nt=Ke?Ke.transitions.length:0;return ot(`${he}:${nt}`),Be.map(Oe=>Oe.id===he?{...Oe,transitions:[...Oe.transitions,{when:{type:"always"},goto:Se}]}:Oe)})},[ot]),Ae=H.useCallback((he,Se)=>{if(he==="start")D(Se);else{const Be=he.lastIndexOf(":"),Ke=he.slice(0,Be),nt=parseInt(he.slice(Be+1));K(Oe=>Oe.map(Lt=>Lt.id===Ke?{...Lt,transitions:Lt.transitions.map((kt,Yt)=>Yt===nt?{...kt,goto:Se}:kt)}:Lt))}},[]),Ve=H.useCallback((he,Se)=>{const Be=he.lastIndexOf(":"),Ke=he.slice(0,Be),nt=parseInt(he.slice(Be+1));K(Oe=>{const Lt=Oe.find(Yt=>Yt.id===Ke);if(!Lt)return Oe;const kt=Lt.transitions[nt];return kt?Oe.map(Yt=>Yt.id===Ke?{...Yt,transitions:Yt.transitions.filter((sc,Is)=>Is!==nt)}:Yt.id===Se?{...Yt,transitions:[...Yt.transitions,kt]}:Yt):Oe}),T(null)},[]),Ye=H.useCallback(he=>{if(he==="start")D("");else{const Se=he.lastIndexOf(":"),Be=he.slice(0,Se),Ke=parseInt(he.slice(Se+1));K(nt=>nt.map(Oe=>Oe.id===Be?{...Oe,transitions:Oe.transitions.filter((Lt,kt)=>kt!==Ke)}:Oe))}T(null)},[]),_t=H.useCallback((he,Se)=>{if(he==="start")ne(Se);else{const Be=he.lastIndexOf(":"),Ke=he.slice(0,Be),nt=parseInt(he.slice(Be+1));K(Oe=>Oe.map(Lt=>Lt.id===Ke?{...Lt,transitions:Lt.transitions.map((kt,Yt)=>Yt===nt?{...kt,when:Se}:kt)}:Lt))}},[]),Je=he=>af(he,pe).name,dn=()=>{if(!R)return null;if(R==="start"){const kt=U.find(Yt=>Yt.id===O);return{type:"start",fromLabel:"Start",toLabel:kt?Je(kt):"(none)",condition:ee}}const he=R.lastIndexOf(":"),Se=R.slice(0,he),Be=parseInt(R.slice(he+1)),Ke=U.find(kt=>kt.id===Se);if(!Ke)return null;const nt=Ke.transitions[Be];if(!nt)return null;const Oe=U.find(kt=>kt.id===nt.goto),Lt=nt.goto==="$done"?"Done":Oe?Je(Oe):nt.goto;return{type:"step",fromLabel:Je(Ke),toLabel:Lt,condition:nt.when}};if(C==="edit"){const he=dn();return o.jsxs(un,{isOpen:e,onClose:ze,title:y?"Edit Workflow":"New Workflow",size:"full",children:[Z&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:Z}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:en,children:"Name"}),o.jsx("input",{value:I,onChange:Se=>Pe(Se.target.value),placeholder:"Workflow name",className:Yn})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:en,children:"ID"}),o.jsx("input",{value:V,onChange:Se=>!y&&Y(Se.target.value),readOnly:!!y,className:`${Yn} font-mono ${y?"opacity-50":""}`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:en,children:"Description"}),o.jsx("input",{value:$,onChange:Se=>F(Se.target.value),placeholder:"What does this workflow do?",className:Yn})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:en,children:"Max Iter."}),o.jsx("input",{type:"number",value:L,onChange:Se=>q(Number(Se.target.value)),className:`${Yn} font-mono`})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Color"}),o.jsx("input",{type:"color",value:X,onChange:Se=>Q(Se.target.value),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent"})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),o.jsx("button",{onClick:ie,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(UT,{steps:U,entryStep:O,selectedNodeId:(ve==null?void 0:ve.id)??null,selectedEdgeKey:R,startConditionLabel:He,agentTypes:pe,onSelectNode:Se=>{if(Se===null){qe(null);return}const Be=U.findIndex(Ke=>Ke.id===Se);qe(Be>=0?String(Be):null)},onSelectEdge:ot,onRemoveStep:Se=>{var Ke;const Be=U.findIndex(nt=>nt.id===Se);if(K(nt=>nt.filter(Oe=>Oe.id!==Se)),ue===Be&&qe(null),O===Se){const nt=U.filter(Oe=>Oe.id!==Se);D(((Ke=nt[0])==null?void 0:Ke.id)??"")}},onCreateTransition:ke,onReconnectTo:Ae,onReconnectFrom:Ve,onDeleteTransition:Ye}),U.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:ie,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"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:he?he.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),O&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"text-text-primary font-medium",children:he.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Activation Condition"}),o.jsx("select",{value:ee.type,onChange:Se=>ne(Se.target.value==="step_result"?{type:"step_result",result:"success"}:{type:Se.target.value}),className:Di,children:u0.map(Se=>o.jsx("option",{value:Se.value,children:Se.label},Se.value))})]}),ee.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:en,children:"Result"}),O&&(()=>{const Se=U.find(Oe=>Oe.id===O),Be=Se&&(Se.type==="sub_agent"||Se.type==="agent")?pe.find(Oe=>Oe.id===(Se.type==="sub_agent"?Se.subAgentType:Se.toolMode)):void 0,Ke=(Be==null?void 0:Be.results)&&Be.results.length>0,nt=(Be==null?void 0:Be.results)??[];return Ke?o.jsx("select",{value:ee.result??nt[0],onChange:Oe=>ne({type:"step_result",result:Oe.target.value}),className:Di,children:nt.map(Oe=>o.jsx("option",{value:Oe,children:Oe},Oe))}):o.jsx("input",{type:"text",value:ee.result??"success",onChange:Oe=>ne({type:"step_result",result:Oe.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})})()]}),o.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."})]}):o.jsx($T,{fromLabel:he.fromLabel,toLabel:he.toLabel,condition:he.condition,fromStep:he.type==="step"?U.find(Se=>Se.id===he.fromLabel):void 0,agentTypes:pe,onUpdateCondition:Se=>_t(R,Se),onDelete:()=>Ye(R)}):ve?o.jsx(qT,{step:ve,isEntry:ve.id===O,agentTypes:pe,transitionCount:ve.transitions.length,templateVariables:p,onUpdate:Te,onRemove:()=>{var Se;if(ve&&(K(U.filter((Be,Ke)=>Ke!==ue)),qe(null),O===ve.id)){const Be=U.filter((Ke,nt)=>nt!==ue);D(((Se=Be[0])==null?void 0:Se.id)??"")}},onSetEntry:()=>D(ve.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(yt,{variant:"secondary",onClick:ze,children:"Cancel"}),o.jsx(yt,{variant:"secondary",onClick:jt,disabled:ae||!I,children:ae?"Saving...":"Save"}),o.jsx(yt,{variant:"primary",onClick:xe,disabled:ae||!I,children:"Save & Close"})]})]})}return o.jsxs(un,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[c.length>0&&(Le?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await k(),Ue(!1)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Confirm"}),o.jsx("button",{onClick:()=>Ue(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>Ue(!0),className:"px-2 py-1 rounded text-xs text-text-muted hover:text-amber-400 hover:bg-amber-500/10 transition-colors",title:"Restore all workflows to defaults",children:"Restore Defaults"})),o.jsx(yt,{variant:"primary",size:"sm",onClick:we,children:"+ New"})]})]}),u&&s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsx("div",{className:"space-y-2",children:s.map(he=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:he.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",he.version]}),c.includes(he.id)&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:he.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[c.includes(he.id)&&(je===he.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:async()=>{await S(he.id),Ne(null)},className:"px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400 text-xs hover:bg-amber-500/30 transition-colors",children:"Restore"}),o.jsx("button",{onClick:()=>Ne(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):o.jsx("button",{onClick:()=>Ne(he.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})})),o.jsx(si,{onClick:()=>ct(he.id)}),he.id!=="default"&&(_===he.id?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:()=>{b(he.id),j(null)},className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs",children:"Delete"}),o.jsx("button",{onClick:()=>j(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs",children:"Cancel"})]}):o.jsx("button",{onClick:()=>j(he.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})}))]})]},he.id))})]})}function WT(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function GT({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=H.useState(!1),[u,p]=H.useState(null),l=Vt(j=>j.workflows),d=Vt(j=>j.fetchWorkflows),{isOpen:f,search:g,selectedIndex:m,filtered:b,containerRef:S,searchRef:k,handleToggle:C,handleSearchChange:v,handleKeyDown:y}=r0({items:l,isOpen:s,onOpen:()=>c(!0),onClose:()=>c(!1),filterFn:(j,A)=>!A||j.name.toLowerCase().includes(A.toLowerCase())});H.useEffect(()=>{s&&d()},[s,d]);const x=j=>{e(j),c(!1)},_=()=>{c(!1),r()};return o.jsxs("div",{ref:S,className:"relative",children:[o.jsx(i0,{label:"Workflows",isOpen:f,onClick:C}),f&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:y,children:[o.jsx(s0,{value:g,onChange:v,onKeyDown:y,ref:k,placeholder:"Search workflows..."}),o.jsx(a0,{children:b.length===0?o.jsx(o0,{hasItems:l.length>0,message:"No workflows yet"}):b.map((j,A)=>{const N=WT(j,i),R=j.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${A===m?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>x(j.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:R}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:j.name}),N!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:N?"#22c55e":"#6b7280"},title:N?"Entry condition met":"Entry condition not met"})]}),o.jsx(si,{className:"opacity-0 group-hover:opacity-100",onClick:T=>{T.stopPropagation(),c(!1),p(j.id)}})]},j.id)})}),o.jsx(l0,{label:"Manage Workflows...",onClick:_})]}),o.jsx(d0,{isOpen:!!u,onClose:()=>p(null),initialEditId:u})]})}function VT(e){return e==="criterion"}function YT(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>VT(s.name))}function KT(e,r=[]){const i=[];let s=null,c=[],u,p=1;const l=new Map,d=new Map,f=[];for(const S of r)S.type==="message"?l.set(S.message.id,S):S.type==="subagent"?d.set(S.subAgentId,S):S.type==="criteria-batch"&&f.push(S);let g=0;const m=()=>{if(c.length>0){const S=f[g];S&&S.type==="criteria-batch"&&S.toolCalls.length===c.length&&S.toolCalls.every((C,v)=>{var y;return C.id===((y=c[v])==null?void 0:y.id)})?i.push(S):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},b=()=>{if(!s)return;const S=s,k=d.get(S.subAgentId);k&&k.type==="subagent"&&k.messages.length===S.messages.length&&k.messages.every((v,y)=>v===S.messages[y])?i.push(k):i.push({type:"subagent",subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:S.messages}),s=null};for(const S of e)if(S.role!=="tool"){if(S.contextWindowId&&u&&S.contextWindowId!==u&&(m(),b(),p++,i.push({type:"context-divider",windowSequence:p})),u=S.contextWindowId,YT(S)){b();for(const k of S.toolCalls)c.push(k);continue}if(m(),S.subAgentId&&S.subAgentType)s&&s.subAgentId===S.subAgentId?s.messages.push(S):(b(),s={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{b();const k=l.get(S.id);k&&k.type==="message"&&k.message===S?i.push(k):i.push({type:"message",message:S})}}return m(),b(),i}function XT(e){const{year:r,month:i,day:s}=Cb(e);return`${r}/${i}/${s} ${Wl(e)}`}function ZT(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const QT=10,JT=150;function eA(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function tA(e){return[...e].sort((s,c)=>new Date(c.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,QT).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:XT(s.timestamp),trimmedContent:ZT(s.content,JT),sessionId:s.sessionId,sessionName:s.sessionName}))}function nA(e,r,i){const s=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...eA(u));return tA(s)}function rA(e,r=[],i=null){const[s,c]=H.useState(0),[u,p]=H.useState(!1),l=H.useMemo(()=>nA(e,r,i),[e,r,i]),d=H.useCallback(()=>{l.length>0&&(c(l.length-1),p(!0))},[l.length]),f=H.useCallback(()=>{p(!1),c(0)},[]),g=H.useCallback(()=>{c(S=>l.length===0?S:S===0?l.length-1:S-1)},[l.length]),m=H.useCallback(()=>{c(S=>l.length===0?S:S===l.length-1?0:S+1)},[l.length]),b=H.useCallback(()=>{if(l.length===0||!u)return null;const S=l[s];return(S==null?void 0:S.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:f,navigateUp:g,navigateDown:m,selectCurrent:b}}function iA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=H.useState(""),[u,p]=H.useState([]),[l,d]=H.useState(!1),[f,g]=H.useState(null),[m,b]=H.useState(!1),[S,k]=H.useState(!1),C=H.useRef(null),v=H.useRef(null),y=H.useRef(null),x=Ce(ie=>ie.currentSession),_=Ce(ie=>ie.messages),j=Ce(ie=>ie.streamingMessage),A=Ce(ie=>ie.sessions),N=Ce(ie=>ie.error),R=Ce(ie=>ie.pendingQuestion),T=mb(),I=Ce(ie=>ie.sendMessage),z=Ce(ie=>ie.clearError),V=Ce(ie=>ie.acceptAndBuild),Y=Ce(ie=>ie.stopGeneration),$=Ce(ie=>ie.launchRunner),F=Ce(ie=>ie.cancelQueued),P=RS(),B=Vt(ie=>ie.workflows),X=Vt(ie=>ie.fetchWorkflows);H.useEffect(()=>{X()},[X]);const{history:Q,selectedIndex:O,showHistory:D,openHistory:L,closeHistory:q,navigateUp:U,navigateDown:K,selectCurrent:ee}=rA(_,A,x==null?void 0:x.id),ne=H.useMemo(()=>j?_.map(ie=>ie.id===j.id?j:ie):_,[_,j]),Z=H.useRef([]),W=H.useMemo(()=>{const ie=KT(ne,Z.current);return Z.current=ie,ie},[ne]),ae=H.useMemo(()=>RT(_),[_]),{force_scroll_to_bottom:se,isAutoScrollActive:pe,setAutoScroll:be}=e0(C,x),je=H.useCallback(()=>{const ie=v.current;if(!ie)return;ie.style.height="auto";const ke=Math.min(200,ie.scrollHeight);ie.style.height=`${ke}px`},[]);H.useEffect(()=>{if(!(x!=null&&x.id))return;const ie=`openfox:draft:${x.id}`,ke=localStorage.getItem(ie);ke!==null&&c(ke)},[x==null?void 0:x.id]),H.useEffect(()=>{var ie;(ie=v.current)==null||ie.focus(),je()},[x==null?void 0:x.id,je]),H.useEffect(()=>{if(!(x!=null&&x.id))return;const ie=`openfox:draft:${x.id}`,ke=setTimeout(()=>{s?localStorage.setItem(ie,s):localStorage.removeItem(ie)},500);return()=>clearTimeout(ke)},[x==null?void 0:x.id,s]),H.useEffect(()=>{je()},[s,je]),H.useEffect(()=>{const ie=ke=>{ke.key==="Escape"&&T&&Y(),ke.key==="ScrollLock"&&be(!pe)};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[T,Y,pe]),H.useEffect(()=>{const ie=v.current;if(!ie)return;const ke=async Ae=>{var Ye;if(document.activeElement!==ie)return;const Ve=(Ye=Ae.clipboardData)==null?void 0:Ye.items;if(Ve){for(const _t of Array.from(Ve))if(_t.type.startsWith("image/")){Ae.preventDefault();const Je=_t.getAsFile();if(!Je)continue;await Kd(Je,dn=>p(he=>[...he,dn]),g,{filename:"pasted-image"})}}};return ie.addEventListener("paste",ke),()=>ie.removeEventListener("paste",ke)},[]);const Ne=()=>{c(""),p([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},Le=async ie=>{ie.preventDefault(),!(!s.trim()&&u.length===0)&&(se(),I(s,u.length>0?u:void 0),Ne())},Ue=ie=>{if(D)switch(ie.key){case"Enter":ie.preventDefault();const ke=ee();ke&&(c(ke),q());return;case"Escape":ie.preventDefault(),q(),T&&Y();return;case"ArrowUp":ie.preventDefault(),U();return;case"ArrowDown":ie.preventDefault(),K();return}if(ie.key==="ArrowUp"&&s.trim()===""&&!D){ie.preventDefault(),L();return}ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),Le(ie))},we=H.useCallback(async ie=>{const ke=ie.target.files;if(!(!ke||ke.length===0)){g(null);for(const Ae of Array.from(ke))await Kd(Ae,Ve=>p(Ye=>[...Ye,Ve]),g);y.current&&(y.current.value="")}},[]),ct=H.useCallback(ie=>{ie.preventDefault(),ie.stopPropagation(),d(!0)},[]),ut=H.useCallback(ie=>{ie.preventDefault(),ie.stopPropagation(),d(!1)},[]),jt=H.useCallback(async ie=>{ie.preventDefault(),ie.stopPropagation(),d(!1),g(null);const ke=ie.dataTransfer.files;if(!(!ke||ke.length===0))for(const Ae of Array.from(ke))await Kd(Ae,Ve=>p(Ye=>[...Ye,Ve]),g)},[]),xe=H.useCallback(ie=>{p(ke=>ke.filter(Ae=>Ae.id!==ie))},[]),ze=H.useCallback(()=>{var ie;(ie=y.current)==null||ie.click()},[]),Pe=(x==null?void 0:x.mode)==="planner",qe=(x==null?void 0:x.mode)==="builder",ot=((x==null?void 0:x.criteria.length)??0)>0,ue=(x==null?void 0:x.phase)==="done",ve=W.some(ie=>ie.type==="message"&&ie.message.role==="assistant"),Te=Pe&&ot&&!T&&ve&&!ue,He=ie=>{const ke=s.trim()?s:void 0,Ae=u.length>0?u:void 0;Pe?V(ie,ke,Ae):qe&&$(ke,Ae,ie),Ne()};return o.jsxs(Zw,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:ne,children:[R&&o.jsx(gT,{question:R}),o.jsx(eC,{}),o.jsx(xT,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:W.map((ie,ke)=>{if(ie.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},ke);if(ie.type==="subagent"){const Ve=ie.messages.some(Ye=>Ye.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(uT,{messages:ie.messages,subAgentType:ie.subAgentType,subAgentId:ie.subAgentId,isStreaming:Ve})},ke)}if(ie.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(Qy,{toolCalls:ie.toolCalls,criteria:x==null?void 0:x.criteria})},ke);const Ae=ie.message;return Ae.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(rf,{message:Ae,showStats:!0})},ke):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(Jy,{message:Ae,isLastAssistantMessage:!1,promptContext:Ae.role==="user"?ae[Ae.id]:void 0})},ke)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:N.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),o.jsx(Ds,{onClick:z,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Te&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:B.map(ie=>{const ke=ie.color??"#3b82f6",Ae=parseInt(ke.slice(1,3),16),Ve=parseInt(ke.slice(3,5),16),Ye=parseInt(ke.slice(5,7),16),_t=`rgba(${Ae},${Ve},${Ye},0.12)`,Je=`rgba(${Ae},${Ve},${Ye},0.22)`,dn=`rgba(${Ae},${Ve},${Ye},0.25)`;return o.jsxs("button",{onClick:()=>V(ie.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:_t,color:ke,border:`1px solid ${dn}`},onMouseEnter:he=>{he.currentTarget.style.backgroundColor=Je},onMouseLeave:he=>{he.currentTarget.style.backgroundColor=_t},children:["▶ ",ie.name]},ie.id)})}),T&&o.jsx(vT,{})]})]}),o.jsxs("form",{onSubmit:Le,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>be(!pe),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${pe?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:y,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:we,className:"hidden",multiple:!0}),f&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:f}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(ie=>o.jsx(bT,{attachment:ie,onRemove:xe},ie.id))}),D&&o.jsx(yT,{history:Q,selectedIndex:O,onSelect:ie=>{c(ie),q()},onEscape:q,onNavigate:ie=>{ie==="up"?U():K()}}),P.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:P.map(ie=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${ie.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:[o.jsxs("span",{className:"font-medium",children:[ie.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:ie.content}),o.jsx(Ds,{onClick:()=>F(ie.queueId),size:"sm"})]},ie.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${l?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:ct,onDragLeave:ut,onDrop:jt,children:[o.jsx("button",{type:"button",onClick:ze,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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"})})}),o.jsx("textarea",{ref:v,value:s,onChange:ie=>{c(ie.target.value),D&&q()},onKeyDown:Ue,placeholder:Pe?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"}}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(BT,{onSendCommand:(ie,ke,Ae,Ve)=>{var _t;ke&&(x==null?void 0:x.mode)!==ke&&Ce.getState().switchMode(ke);const Ye=Ae&&Ae.trim()?`${Ae.trim()}
149
-
150
- ${ie}`:ie;(_t=C.current)==null||_t.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(Ye,Ve!=null&&Ve.length?Ve:void 0,{messageKind:"command",isSystemGenerated:!0}),Ne()},onOpenManager:()=>b(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(GT,{onSelectWorkflow:He,onOpenManager:()=>k(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var ie;!s.trim()&&u.length===0||((ie=C.current)==null||ie.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(s,u),Ne())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded 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"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(pT,{}),o.jsx(mT,{})]}),o.jsx(OT,{})]})]}),o.jsx(n0,{isOpen:m,onClose:()=>b(!1)}),o.jsx(d0,{isOpen:S,onClose:()=>k(!1)})]})}H.memo(function({item:r}){const[i,s]=H.useState(!1);return r.type==="start"?o.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:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(Ii,{content:r.description})})]})]})});function Qv({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=H.useState(""),p=H.useRef(null);H.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=p.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&i(c)};return o.jsx(un,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Gl,{ref:p,type:"password",value:c,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(yt,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(yt,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const sA=[8e3,11434,8080],aA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function Jv(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"Unknown";default:return e}}function h0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function oA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function lA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.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 cA({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const p=u+1,l=p<e,d=p===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(p),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":p}),o.jsx("button",{onClick:()=>s==null?void 0:s(p),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:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function uA({onNext:e}){const[r,i]=H.useState([]),[s,c]=H.useState([]),[u,p]=H.useState(!1),[l,d]=H.useState(""),[f,g]=H.useState(""),[m,b]=H.useState(""),[S,k]=H.useState("auto"),[C,v]=H.useState(!1),[y,x]=H.useState(null),[_,j]=H.useState(null),[A,N]=H.useState(null),[R,T]=H.useState("");H.useEffect(()=>{I()},[]);async function I(){try{const P=await _e("/api/providers");if(P.ok){const X=(await P.json()).providers.map(Q=>({id:Q.id,name:Q.name,url:Q.url,backend:Q.backend,model:null,apiKey:Q.apiKey}));i(X),c(X)}}catch{}}async function z(P){v(!0),x(null);const B=S!=="auto";try{const Q=await(await _e("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:P,skipBackendDetection:B})})).json();Q.success?(B||k(Q.backend??"auto"),x({success:!0,model:Q.model??void 0})):x({success:!1,error:Q.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}v(!1)}function V(){if(!f)return;const P=l||`Provider ${s.length+1}`,B={id:`temp-${Date.now()}`,name:P,url:f,backend:y!=null&&y.success?S:"auto",model:y!=null&&y.success?y.model??null:null,apiKey:m||void 0};c([...s,B]),d(""),g(""),b(""),x(null)}function Y(P){j(P),r.some(X=>X.id===P)?_e(`/api/providers/${P}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==P)),i(r.filter(X=>X.id!==P)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==P)),j(null))}async function $(){for(const B of s)(B.id.startsWith("temp-")||!r.some(X=>X.id===B.id))&&((await _e("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B.name,url:B.url,backend:B.backend,model:B.model,apiKey:B.apiKey})})).ok||console.error("Failed to add provider",B));const P=s.filter(B=>!B.id.startsWith("temp-"));e({providers:P})}const F=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(P=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:Jv(P.backend)}),A===P.id?o.jsx("input",{type:"text",value:R,onChange:B=>T(B.target.value),onKeyDown:B=>{B.key==="Enter"&&(c(s.map(X=>X.id===P.id?{...X,name:R}:X)),N(null)),B.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(B=>B.id===P.id?{...B,name:R}:B)),N(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}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(P.id),T(P.name)},title:"Click to edit",children:P.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:P.url}),P.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",P.model]})]}),o.jsx("button",{onClick:()=>Y(P.id),disabled:_===P.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(lA,{})})]},P.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:P=>{P.preventDefault(),f&&V()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:aA.map(P=>o.jsx("button",{type:"button",onClick:()=>{d(P.name),g(P.url),k(P.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===P.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:P.name},P.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:sA.map(P=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${P}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${f===`http://localhost:${P}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",P]},P))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:f,onChange:P=>{g(P.target.value),x(null)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),z(f))},placeholder:"http://localhost:8000",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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:P=>d(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),V())},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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:P=>b(P.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"})]}),y&&o.jsx("div",{className:`p-3 rounded-lg ${y.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:y.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",Jv(S),y.model&&` (${y.model})`]}):o.jsx("p",{className:"text-red-500",children:y.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>z(f),disabled:!f||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(h0,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!f,className:"flex-1 px-4 py-2 bg-accent-primary text-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:y!=null&&y.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{p(!1),d(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>p(!0),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:[o.jsx(oA,{}),"Add Provider"]}),o.jsx("button",{onClick:$,disabled:!F,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function dA({onNext:e}){const[r,i]=H.useState(""),[s,c]=H.useState(!1);return H.useEffect(()=>{_e("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(p=>p.json()).then(p=>{p.current&&i(p.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",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"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(jb,{initialPath:r||void 0,onSelect:u=>{i(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function hA({onNext:e}){const[r,i]=H.useState(!1),[s,c]=H.useState("http://localhost:11434"),[u,p]=H.useState("qwen3-vl:2b"),{copied:l,copy:d}=Yy();H.useEffect(()=>{_e("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),p(g.visionFallback.model))}).catch(()=>{})},[]);function f(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?o.jsx(ql,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>i(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:s,onChange:g=>c(g.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"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>p(g.target.value),placeholder:"qwen3-vl:2b",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"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>f(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>f(!1),className:"px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function fA({onComplete:e}){const[r,i]=H.useState(1),[s,c]=H.useState(!1),[u,p]=H.useState({});async function l(m){p(b=>({...b,providers:m.providers})),i(2)}async function d(m){p(b=>({...b,...m})),i(3)}async function f(m){c(!0);try{if(!(await _e("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(b){console.error("Failed to save onboarding data:",b),c(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(Ds,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(cA,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(h0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(uA,{onNext:l}),r===2&&o.jsx(dA,{onNext:d}),r===3&&o.jsx(hA,{onNext:f})]})})]})}function of(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function f0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Vl,{})})}function pA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=vh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ce(m=>m.connectionStatus),u=Ce(m=>m.listSessions),p=Ce(m=>m.clearSession),l=Ut(m=>m.currentProject),d=Ut(m=>m.loadProject),f=of(),g=c==="connected"||f;return H.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&d(s),u(s),p())},[g,s,l==null?void 0:l.id,d,u,p]),!l||l.id!==s?o.jsx(f0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Eb,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(xw,{})})]})}function mA({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=vh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,p=c==null?void 0:c.sessionId,[,l]=sr(),d=Ce(_=>_.connectionStatus),f=Ce(_=>_.currentSession),g=Ce(_=>_.loadSession),m=Ce(_=>_.listSessions),b=Ce(_=>_.pendingSessionCreate),S=Ce(_=>_.error),k=Ce(_=>_.clearError),C=Ut(_=>_.currentProject),v=Ut(_=>_.loadProject),y=of(),x=d==="connected"||y;return H.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&v(u)},[x,u,C==null?void 0:C.id,v]),H.useEffect(()=>{x&&p&&(f==null?void 0:f.id)!==p&&!b&&g(p),x&&u&&m(u)},[x,p,f==null?void 0:f.id,g,m,b,u]),H.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&u&&(k(),l(`/p/${u}`))},[S,u,k,l]),!C||C.id!==u?o.jsx(f0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Eb,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(iA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function gA(){const e=Et(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(fA,{onComplete:r})})}function xA(){const{connectionStatus:e}=MS(),r=Et($=>$.fetchConfig),i=Et($=>$.refreshProviderModels),s=Et($=>$.providers),c=Et($=>$.activeProviderId),[,u]=sr(),p=of(),[l,d]=H.useState(!1);H.useEffect(()=>{(e==="connected"||p)&&r().then(()=>{d(!0)})},[e,p,r]),H.useEffect(()=>{l&&c&&i(c).then(()=>{r()})},[l,c,i,r]),H.useEffect(()=>{l&&s.length===0&&u("/onboarding")},[l,s.length]);const f=()=>{const $=localStorage.getItem("openfox:leftSidebar");return $!==null?$==="true":!1},g=()=>{const $=localStorage.getItem("openfox:rightSidebar");return $!==null?$==="true":!0},[m,b]=H.useState(f),[S,k]=H.useState(g),[C,v]=H.useState(!1),[y,x]=H.useState(!1),[_,j]=H.useState(!1);H.useEffect(()=>{const $=()=>{j(window.innerWidth<768)};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[]);const A=_?C:m,N=_?y:S,R=()=>{_?v(!C):b(!m)},T=()=>{_?x(!y):k(!S)};H.useEffect(()=>{_||localStorage.setItem("openfox:leftSidebar",String(m))},[m,_]),H.useEffect(()=>{_||localStorage.setItem("openfox:rightSidebar",String(S))},[S,_]),H.useEffect(()=>{(e==="connected"||p)&&r()},[e,r,p]);const I=Ce($=>$.showPasswordModal),z=Ce($=>$.passwordModalRetry),V=Ce($=>$.submitPassword),Y=Ce($=>$.cancelPassword);return e!=="connected"&&!I&&!p?o.jsxs(o.Fragment,{children:[o.jsx(Qv,{isOpen:!0,isRetry:z,onSubmit:V,onCancel:Y}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(fw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Qv,{isOpen:I,isRetry:z,onSubmit:V,onCancel:Y}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(lw,{}),o.jsx(rw,{onMenuClick:R,onCriteriaToggle:T}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(oS,{children:[o.jsx(Ta,{path:"/onboarding",children:o.jsx(gA,{})}),o.jsx(Ta,{path:"/p/:projectId/s/:sessionId",children:o.jsx(mA,{sidebarOpen:A,onSidebarToggle:R,rightSidebarOpen:N,onRightSidebarToggle:T})}),o.jsx(Ta,{path:"/p/:projectId/new",children:o.jsx(gw,{})}),o.jsx(Ta,{path:"/p/:projectId",children:o.jsx(pA,{sidebarOpen:A,onSidebarToggle:R})}),o.jsx(Ta,{path:"/",children:o.jsx(mw,{})})]})})]})]})}H1.createRoot(document.getElementById("root")).render(o.jsx(ln.StrictMode,{children:o.jsx(xA,{})}));