openfox 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-JF2HDJ6P.js +53 -0
- package/dist/{auto-compaction-RRFGQDQN.js → auto-compaction-C7URGBG3.js} +4 -4
- package/dist/{chat-handler-34PPF43W.js → chat-handler-BUCN7QJG.js} +6 -6
- package/dist/{chunk-O7O3XMWO.js → chunk-7POE2HLF.js} +2 -2
- package/dist/{chunk-4JBBQQOD.js → chunk-G5U2OBHQ.js} +8 -8
- package/dist/{chunk-IBA3NQAD.js → chunk-JVAYCY76.js} +1 -1
- package/dist/{chunk-NGSSEMII.js → chunk-L46YMTF2.js} +4 -4
- package/dist/{chunk-ON2IR3E4.js → chunk-M6HB2O3B.js} +127 -25
- package/dist/{chunk-D3C4Z53N.js → chunk-NJ24TM3O.js} +69 -44
- package/dist/{chunk-YSPC6TQJ.js → chunk-TXTPA76S.js} +2 -2
- package/dist/{chunk-BNK5N227.js → chunk-UZ6LHPX7.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/config-ONC2MTDE.js +3 -3
- package/dist/{orchestrator-K6PLFOVY.js → orchestrator-L3MBTPG2.js} +5 -5
- package/dist/package.json +1 -1
- package/dist/{processor-V57VGPXZ.js → processor-77Z5BZPK.js} +2 -2
- package/dist/{provider-FAO4R2GH.js → provider-K4HAXILY.js} +7 -7
- package/dist/{serve-SK5FZJXJ.js → serve-6QG3HSOL.js} +17 -17
- package/dist/server/index.js +8 -8
- package/dist/{tools-KTY6SVMF.js → tools-G6PT5NJO.js} +4 -4
- package/dist/{vision-fallback-MGSC5SWE.js → vision-fallback-P7WM3UGQ.js} +2 -2
- package/dist/web/assets/{index-BW3T98H-.css → index-BBtTirUQ.css} +1 -1
- package/dist/web/assets/index-D8PVAl5p.js +142 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/init-TLQQLRGQ.js +0 -294
- package/dist/web/assets/index-MxvFVrSK.js +0 -142
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var Y_=Object.defineProperty;var K_=(e,r,i)=>r in e?Y_(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i;var Cr=(e,r,i)=>K_(e,typeof r!="symbol"?r+"":r,i);function X_(e,r){for(var i=0;i<r.length;i++){const s=r[i];if(typeof s!="string"&&!Array.isArray(s)){for(const l in s)if(l!=="default"&&!(l in e)){const h=Object.getOwnPropertyDescriptor(s,l);h&&Object.defineProperty(e,l,h.get?h:{enumerable:!0,get:()=>s[l]})}}}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 l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const h of l)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&s(m)}).observe(document,{childList:!0,subtree:!0});function i(l){const h={};return l.integrity&&(h.integrity=l.integrity),l.referrerPolicy&&(h.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?h.credentials="include":l.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function s(l){if(l.ep)return;l.ep=!0;const h=i(l);fetch(l.href,h)}})();function Al(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rd={exports:{}},wa={};/**
|
|
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 Wg;function Z_(){if(Wg)return wa;Wg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(s,l,h){var m=null;if(h!==void 0&&(m=""+h),l.key!==void 0&&(m=""+l.key),"key"in l){h={};for(var o in l)o!=="key"&&(h[o]=l[o])}else h=l;return l=h.ref,{$$typeof:e,type:s,key:m,ref:l!==void 0?l:null,props:h}}return wa.Fragment=r,wa.jsx=i,wa.jsxs=i,wa}var Gg;function Q_(){return Gg||(Gg=1,rd.exports=Z_()),rd.exports}var c=Q_(),id={exports:{}},Pe={};/**
|
|
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 Vg;function J_(){if(Vg)return Pe;Vg=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),v=Symbol.iterator;function S(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function _(I,U,P){this.props=I,this.context=U,this.refs=b,this.updater=P||E}_.prototype.isReactComponent={},_.prototype.setState=function(I,U){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,U,"setState")},_.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function x(){}x.prototype=_.prototype;function y(I,U,P){this.props=I,this.context=U,this.refs=b,this.updater=P||E}var j=y.prototype=new x;j.constructor=y,C(j,_.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 B(I,U,P){var K=P.ref;return{$$typeof:e,type:I,key:U,ref:K!==void 0?K:null,props:P}}function H(I,U){return B(I.type,U,I.props)}function G(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function Y(I){var U={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(P){return U[P]})}var q=/\/+/g;function O(I,U){return typeof I=="object"&&I!==null&&I.key!=null?Y(""+I.key):U.toString(36)}function W(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(N,N):(I.status="pending",I.then(function(U){I.status==="pending"&&(I.status="fulfilled",I.value=U)},function(U){I.status==="pending"&&(I.status="rejected",I.reason=U)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function V(I,U,P,K,te){var Z=typeof I;(Z==="undefined"||Z==="boolean")&&(I=null);var X=!1;if(I===null)X=!0;else switch(Z){case"bigint":case"string":case"number":X=!0;break;case"object":switch(I.$$typeof){case e:case r:X=!0;break;case g:return X=I._init,V(X(I._payload),U,P,K,te)}}if(X)return te=te(I),X=K===""?"."+O(I,0):K,A(te)?(P="",X!=null&&(P=X.replace(q,"$&/")+"/"),V(te,U,P,"",function(se){return se})):te!=null&&(G(te)&&(te=H(te,P+(te.key==null||I&&I.key===te.key?"":(""+te.key).replace(q,"$&/")+"/")+X)),U.push(te)),1;X=0;var z=K===""?".":K+":";if(A(I))for(var ae=0;ae<I.length;ae++)K=I[ae],Z=z+O(K,ae),X+=V(K,U,P,Z,te);else if(ae=S(I),typeof ae=="function")for(I=ae.call(I),ae=0;!(K=I.next()).done;)K=K.value,Z=z+O(K,ae++),X+=V(K,U,P,Z,te);else if(Z==="object"){if(typeof I.then=="function")return V(W(I),U,P,K,te);throw U=String(I),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return X}function Q(I,U,P){if(I==null)return I;var K=[],te=0;return V(I,K,"","",function(Z){return U.call(P,Z,te++)}),K}function ee(I){if(I._status===-1){var U=I._result;U=U(),U.then(function(P){(I._status===0||I._status===-1)&&(I._status=1,I._result=P)},function(P){(I._status===0||I._status===-1)&&(I._status=2,I._result=P)}),I._status===-1&&(I._status=0,I._result=U)}if(I._status===1)return I._result.default;throw I._result}var L=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},D={map:Q,forEach:function(I,U,P){Q(I,function(){U.apply(this,arguments)},P)},count:function(I){var U=0;return Q(I,function(){U++}),U},toArray:function(I){return Q(I,function(U){return U})||[]},only:function(I){if(!G(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Pe.Activity=p,Pe.Children=D,Pe.Component=_,Pe.Fragment=i,Pe.Profiler=l,Pe.PureComponent=y,Pe.StrictMode=s,Pe.Suspense=d,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(I){return R.H.useMemoCache(I)}},Pe.cache=function(I){return function(){return I.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(I,U,P){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var K=C({},I.props),te=I.key;if(U!=null)for(Z in U.key!==void 0&&(te=""+U.key),U)!T.call(U,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&U.ref===void 0||(K[Z]=U[Z]);var Z=arguments.length-2;if(Z===1)K.children=P;else if(1<Z){for(var X=Array(Z),z=0;z<Z;z++)X[z]=arguments[z+2];K.children=X}return B(I.type,te,K)},Pe.createContext=function(I){return I={$$typeof:m,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:h,_context:I},I},Pe.createElement=function(I,U,P){var K,te={},Z=null;if(U!=null)for(K in U.key!==void 0&&(Z=""+U.key),U)T.call(U,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(te[K]=U[K]);var X=arguments.length-2;if(X===1)te.children=P;else if(1<X){for(var z=Array(X),ae=0;ae<X;ae++)z[ae]=arguments[ae+2];te.children=z}if(I&&I.defaultProps)for(K in X=I.defaultProps,X)te[K]===void 0&&(te[K]=X[K]);return B(I,Z,te)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(I){return{$$typeof:o,render:I}},Pe.isValidElement=G,Pe.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:ee}},Pe.memo=function(I,U){return{$$typeof:f,type:I,compare:U===void 0?null:U}},Pe.startTransition=function(I){var U=R.T,P={};R.T=P;try{var K=I(),te=R.S;te!==null&&te(P,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(N,L)}catch(Z){L(Z)}finally{U!==null&&P.types!==null&&(U.types=P.types),R.T=U}},Pe.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Pe.use=function(I){return R.H.use(I)},Pe.useActionState=function(I,U,P){return R.H.useActionState(I,U,P)},Pe.useCallback=function(I,U){return R.H.useCallback(I,U)},Pe.useContext=function(I){return R.H.useContext(I)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(I,U){return R.H.useDeferredValue(I,U)},Pe.useEffect=function(I,U){return R.H.useEffect(I,U)},Pe.useEffectEvent=function(I){return R.H.useEffectEvent(I)},Pe.useId=function(){return R.H.useId()},Pe.useImperativeHandle=function(I,U,P){return R.H.useImperativeHandle(I,U,P)},Pe.useInsertionEffect=function(I,U){return R.H.useInsertionEffect(I,U)},Pe.useLayoutEffect=function(I,U){return R.H.useLayoutEffect(I,U)},Pe.useMemo=function(I,U){return R.H.useMemo(I,U)},Pe.useOptimistic=function(I,U){return R.H.useOptimistic(I,U)},Pe.useReducer=function(I,U,P){return R.H.useReducer(I,U,P)},Pe.useRef=function(I){return R.H.useRef(I)},Pe.useState=function(I){return R.H.useState(I)},Pe.useSyncExternalStore=function(I,U,P){return R.H.useSyncExternalStore(I,U,P)},Pe.useTransition=function(){return R.H.useTransition()},Pe.version="19.2.4",Pe}var Yg;function Dl(){return Yg||(Yg=1,id.exports=J_()),id.exports}var F=Dl();const ln=Al(F),e1=X_({__proto__:null,default:ln},[F]);var sd={exports:{}},Ca={},ad={exports:{}},od={};/**
|
|
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 Kg;function t1(){return Kg||(Kg=1,(function(e){function r(V,Q){var ee=V.length;V.push(Q);e:for(;0<ee;){var L=ee-1>>>1,D=V[L];if(0<l(D,Q))V[L]=Q,V[ee]=D,ee=L;else break e}}function i(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var Q=V[0],ee=V.pop();if(ee!==Q){V[0]=ee;e:for(var L=0,D=V.length,I=D>>>1;L<I;){var U=2*(L+1)-1,P=V[U],K=U+1,te=V[K];if(0>l(P,ee))K<D&&0>l(te,P)?(V[L]=te,V[K]=ee,L=K):(V[L]=P,V[U]=ee,L=U);else if(K<D&&0>l(te,ee))V[L]=te,V[K]=ee,L=K;else break e}}return Q}function l(V,Q){var ee=V.sortIndex-Q.sortIndex;return ee!==0?ee:V.id-Q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var m=Date,o=m.now();e.unstable_now=function(){return m.now()-o}}var d=[],f=[],g=1,p=null,v=3,S=!1,E=!1,C=!1,b=!1,_=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function j(V){for(var Q=i(f);Q!==null;){if(Q.callback===null)s(f);else if(Q.startTime<=V)s(f),Q.sortIndex=Q.expirationTime,r(d,Q);else break;Q=i(f)}}function A(V){if(C=!1,j(V),!E)if(i(d)!==null)E=!0,N||(N=!0,Y());else{var Q=i(f);Q!==null&&W(A,Q.startTime-V)}}var N=!1,R=-1,T=5,B=-1;function H(){return b?!0:!(e.unstable_now()-B<T)}function G(){if(b=!1,N){var V=e.unstable_now();B=V;var Q=!0;try{e:{E=!1,C&&(C=!1,x(R),R=-1),S=!0;var ee=v;try{t:{for(j(V),p=i(d);p!==null&&!(p.expirationTime>V&&H());){var L=p.callback;if(typeof L=="function"){p.callback=null,v=p.priorityLevel;var D=L(p.expirationTime<=V);if(V=e.unstable_now(),typeof D=="function"){p.callback=D,j(V),Q=!0;break t}p===i(d)&&s(d),j(V)}else s(d);p=i(d)}if(p!==null)Q=!0;else{var I=i(f);I!==null&&W(A,I.startTime-V),Q=!1}}break e}finally{p=null,v=ee,S=!1}Q=void 0}}finally{Q?Y():N=!1}}}var Y;if(typeof y=="function")Y=function(){y(G)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,O=q.port2;q.port1.onmessage=G,Y=function(){O.postMessage(null)}}else Y=function(){_(G,0)};function W(V,Q){R=_(function(){V(e.unstable_now())},Q)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var Q=3;break;default:Q=v}var ee=v;v=Q;try{return V()}finally{v=ee}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(V,Q){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ee=v;v=V;try{return Q()}finally{v=ee}},e.unstable_scheduleCallback=function(V,Q,ee){var L=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?L+ee:L):ee=L,V){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=ee+D,V={id:g++,callback:Q,priorityLevel:V,startTime:ee,expirationTime:D,sortIndex:-1},ee>L?(V.sortIndex=ee,r(f,V),i(d)===null&&V===i(f)&&(C?(x(R),R=-1):C=!0,W(A,ee-L))):(V.sortIndex=D,r(d,V),E||S||(E=!0,N||(N=!0,Y()))),V},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(V){var Q=v;return function(){var ee=v;v=Q;try{return V.apply(this,arguments)}finally{v=ee}}}})(od)),od}var Xg;function n1(){return Xg||(Xg=1,ad.exports=t1()),ad.exports}var ld={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 Zg;function r1(){if(Zg)return tn;Zg=1;var e=Dl();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},l=Symbol.for("react.portal");function h(d,f,g){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:p==null?null:""+p,children:d,containerInfo:f,implementation:g}}var m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(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 h(d,f,null,g)},tn.flushSync=function(d){var f=m.T,g=s.p;try{if(m.T=null,s.p=2,d)return d()}finally{m.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,p=o(g,f.crossOrigin),v=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:p,integrity:v,fetchPriority:S}):g==="script"&&s.d.X(d,{crossOrigin:p,integrity:v,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=o(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,p=o(g,f.crossOrigin);s.d.L(d,g,{crossOrigin:p,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=o(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 m.H.useFormState(d,f,g)},tn.useFormStatus=function(){return m.H.useHostTransitionStatus()},tn.version="19.2.4",tn}var Qg;function $v(){if(Qg)return ld.exports;Qg=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(),ld.exports=r1(),ld.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 Jg;function i1(){if(Jg)return Ca;Jg=1;var e=n1(),r=Dl(),i=$v();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 l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function h(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 m(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 o(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(h(t)!==t)throw Error(s(188))}function f(t){var n=t.alternate;if(!n){if(n=h(t),n===null)throw Error(s(188));return n!==t?null:t}for(var a=t,u=n;;){var w=a.return;if(w===null)break;var k=w.alternate;if(k===null){if(u=w.return,u!==null){a=u;continue}break}if(w.child===k.child){for(k=w.child;k;){if(k===a)return d(w),t;if(k===u)return d(w),n;k=k.sibling}throw Error(s(188))}if(a.return!==u.return)a=w,u=k;else{for(var M=!1,$=w.child;$;){if($===a){M=!0,a=w,u=k;break}if($===u){M=!0,u=w,a=k;break}$=$.sibling}if(!M){for($=k.child;$;){if($===a){M=!0,a=k,u=w;break}if($===u){M=!0,u=k,a=w;break}$=$.sibling}if(!M)throw Error(s(189))}}if(a.alternate!==u)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 p=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),x=Symbol.for("react.consumer"),y=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"),B=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function Y(t){return t===null||typeof t!="object"?null:(t=G&&t[G]||t["@@iterator"],typeof t=="function"?t:null)}var q=Symbol.for("react.client.reference");function O(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===q?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case _:return"Profiler";case b:return"StrictMode";case A:return"Suspense";case N:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case y: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:O(t.type)||"Memo";case T:n=t._payload,t=t._init;try{return O(t(n))}catch{}}return null}var W=Array.isArray,V=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},L=[],D=-1;function I(t){return{current:t}}function U(t){0>D||(t.current=L[D],L[D]=null,D--)}function P(t,n){D++,L[D]=t.current,t.current=n}var K=I(null),te=I(null),Z=I(null),X=I(null);function z(t,n){switch(P(Z,n),P(te,t),P(K,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?pg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=pg(n),t=mg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}U(K),P(K,t)}function ae(){U(K),U(te),U(Z)}function se(t){t.memoizedState!==null&&P(X,t);var n=K.current,a=mg(n,t.type);n!==a&&(P(te,t),P(K,a))}function ge(t){te.current===t&&(U(K),U(te)),X.current===t&&(U(X),ba._currentValue=ee)}var ve,Ne;function De(t){if(ve===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",Ne=-1<a.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+ve+t+Ne}var Oe=!1;function Fe(t,n){if(!t||Oe)return"";Oe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(n){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var ce=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){ce=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=u.DetermineComponentFrameRoot(),M=k[0],$=k[1];if(M&&$){var J=M.split(`
|
|
44
|
-
`),le=$.split(`
|
|
45
|
-
`);for(w=u=0;u<J.length&&!J[u].includes("DetermineComponentFrameRoot");)u++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(u===J.length||w===le.length)for(u=J.length-1,w=le.length-1;1<=u&&0<=w&&J[u]!==le[w];)w--;for(;1<=u&&0<=w;u--,w--)if(J[u]!==le[w]){if(u!==1||w!==1)do if(u--,w--,0>w||J[u]!==le[w]){var he=`
|
|
46
|
-
`+J[u].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=u&&0<=w);break}}}finally{Oe=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?De(a):""}function ke(t,n){switch(t.tag){case 26:case 27:case 5:return De(t.type);case 16:return De("Lazy");case 13:return t.child!==n&&n!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return Fe(t.type,!1);case 11:return Fe(t.type.render,!1);case 1:return Fe(t.type,!0);case 31:return De("Activity");default:return""}}function lt(t){try{var n="",a=null;do n+=ke(t,a),a=t,t=t.return;while(t);return n}catch(u){return`
|
|
47
|
-
Error generating stack: `+u.message+`
|
|
48
|
-
`+u.stack}}var dt=Object.prototype.hasOwnProperty,fe=e.unstable_scheduleCallback,Le=e.unstable_cancelCallback,Je=e.unstable_shouldYield,et=e.unstable_requestPaint,Ge=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,re=e.unstable_NormalPriority,_e=e.unstable_LowPriority,Ce=e.unstable_IdlePriority,He=e.log,Ae=e.unstable_setDisableYieldValue,st=null,it=null;function Ct(t){if(typeof He=="function"&&Ae(t),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(st,t)}catch{}}var $e=Math.clz32?Math.clz32:we,Rn=Math.log,pe=Math.LN2;function we(t){return t>>>=0,t===0?32:31-(Rn(t)/pe|0)|0}var ze=256,Ve=262144,tt=4194304;function Ie(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 Rt(t,n,a){var u=t.pendingLanes;if(u===0)return 0;var w=0,k=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var $=u&134217727;return $!==0?(u=$&~k,u!==0?w=Ie(u):(M&=$,M!==0?w=Ie(M):a||(a=$&~t,a!==0&&(w=Ie(a))))):($=u&~k,$!==0?w=Ie($):M!==0?w=Ie(M):a||(a=u&~t,a!==0&&(w=Ie(a)))),w===0?0:n!==0&&n!==w&&(n&k)===0&&(k=w&-w,a=n&-n,k>=a||k===32&&(a&4194048)!==0)?n:w}function Et(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 Wl(){var t=tt;return tt<<=1,(tt&62914560)===0&&(tt=4194304),t}function Rs(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Ls(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Ib(t,n,a,u,w,k){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 $=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=M&~a;0<a;){var he=31-$e(a),xe=1<<he;$[he]=0,J[he]=-1;var ce=le[he];if(ce!==null)for(le[he]=null,he=0;he<ce.length;he++){var ue=ce[he];ue!==null&&(ue.lane&=-536870913)}a&=~xe}u!==0&&Kh(t,u,0),k!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=k&~(M&~n))}function Kh(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var u=31-$e(n);t.entangledLanes|=n,t.entanglements[u]=t.entanglements[u]|1073741824|a&261930}function Xh(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var u=31-$e(a),w=1<<u;w&n|t[u]&n&&(t[u]|=n),a&=~w}}function Zh(t,n){var a=n&-n;return a=(a&42)!==0?1:Gl(a),(a&(t.suspendedLanes|n))!==0?0:a}function Gl(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 Vl(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Qh(){var t=Q.p;return t!==0?t:(t=window.event,t===void 0?32:zg(t.type))}function Jh(t,n){var a=Q.p;try{return Q.p=t,n()}finally{Q.p=a}}var Nr=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Nr,dn="__reactProps$"+Nr,Li="__reactContainer$"+Nr,Yl="__reactEvents$"+Nr,Bb="__reactListeners$"+Nr,zb="__reactHandles$"+Nr,ef="__reactResources$"+Nr,Ms="__reactMarker$"+Nr;function Kl(t){delete t[Kt],delete t[dn],delete t[Yl],delete t[Bb],delete t[zb]}function Mi(t){var n=t[Kt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Li]||a[Kt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Sg(t);t!==null;){if(a=t[Kt])return a;t=Sg(t)}return n}t=a,a=t.parentNode}return null}function Oi(t){if(t=t[Kt]||t[Li]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Os(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function Ii(t){var n=t[ef];return n||(n=t[ef]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function $t(t){t[Ms]=!0}var tf=new Set,nf={};function ii(t,n){Bi(t,n),Bi(t+"Capture",n)}function Bi(t,n){for(nf[t]=n,t=0;t<n.length;t++)tf.add(n[t])}var Hb=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]*$"),rf={},sf={};function Pb(t){return dt.call(sf,t)?!0:dt.call(rf,t)?!1:Hb.test(t)?sf[t]=!0:(rf[t]=!0,!1)}function Xa(t,n,a){if(Pb(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var u=n.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function Za(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 ar(t,n,a,u){if(u===null)t.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+u)}}function Ln(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function af(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Fb(t,n,a){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var w=u.get,k=u.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(M){a=""+M,k.call(this,M)}}),Object.defineProperty(t,n,{enumerable:u.enumerable}),{getValue:function(){return a},setValue:function(M){a=""+M},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Xl(t){if(!t._valueTracker){var n=af(t)?"checked":"value";t._valueTracker=Fb(t,n,""+t[n])}}function of(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),u="";return t&&(u=af(t)?t.checked?"true":"false":t.value),t=u,t!==a?(n.setValue(t),!0):!1}function Qa(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 Ub=/[\n"\\]/g;function Mn(t){return t.replace(Ub,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Zl(t,n,a,u,w,k,M,$){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=""+Ln(n)):t.value!==""+Ln(n)&&(t.value=""+Ln(n)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),n!=null?Ql(t,M,Ln(n)):a!=null?Ql(t,M,Ln(a)):u!=null&&t.removeAttribute("value"),w==null&&k!=null&&(t.defaultChecked=!!k),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?t.name=""+Ln($):t.removeAttribute("name")}function lf(t,n,a,u,w,k,M,$){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(t.type=k),n!=null||a!=null){if(!(k!=="submit"&&k!=="reset"||n!=null)){Xl(t);return}a=a!=null?""+Ln(a):"",n=n!=null?""+Ln(n):a,$||n===t.value||(t.value=n),t.defaultValue=n}u=u??w,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=$?t.checked:!!u,t.defaultChecked=!!u,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Xl(t)}function Ql(t,n,a){n==="number"&&Qa(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function zi(t,n,a,u){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&&u&&(t[a].defaultSelected=!0)}else{for(a=""+Ln(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,u&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function cf(t,n,a){if(n!=null&&(n=""+Ln(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Ln(a):""}function uf(t,n,a,u){if(n==null){if(u!=null){if(a!=null)throw Error(s(92));if(W(u)){if(1<u.length)throw Error(s(93));u=u[0]}a=u}a==null&&(a=""),n=a}a=Ln(n),t.defaultValue=a,u=t.textContent,u===a&&u!==""&&u!==null&&(t.value=u),Xl(t)}function Hi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var $b=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 df(t,n,a){var u=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?u?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":u?t.setProperty(n,a):typeof a!="number"||a===0||$b.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function hf(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var u in a)!a.hasOwnProperty(u)||n!=null&&n.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var w in n)u=n[w],n.hasOwnProperty(w)&&a[w]!==u&&df(t,w,u)}else for(var k in n)n.hasOwnProperty(k)&&df(t,k,n[k])}function Jl(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 qb=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"]]),Wb=/^[\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 Ja(t){return Wb.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function or(){}var ec=null;function tc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Pi=null,Fi=null;function ff(t){var n=Oi(t);if(n&&(t=n.stateNode)){var a=t[dn]||null;e:switch(t=n.stateNode,n.type){case"input":if(Zl(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="'+Mn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var u=a[n];if(u!==t&&u.form===t.form){var w=u[dn]||null;if(!w)throw Error(s(90));Zl(u,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)u=a[n],u.form===t.form&&of(u)}break e;case"textarea":cf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&zi(t,!!a.multiple,n,!1)}}}var nc=!1;function pf(t,n,a){if(nc)return t(n,a);nc=!0;try{var u=t(n);return u}finally{if(nc=!1,(Pi!==null||Fi!==null)&&(Fo(),Pi&&(n=Pi,t=Fi,Fi=Pi=null,ff(n),t)))for(n=0;n<t.length;n++)ff(t[n])}}function Is(t,n){var a=t.stateNode;if(a===null)return null;var u=a[dn]||null;if(u===null)return null;a=u[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":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var lr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(lr)try{var Bs={};Object.defineProperty(Bs,"passive",{get:function(){rc=!0}}),window.addEventListener("test",Bs,Bs),window.removeEventListener("test",Bs,Bs)}catch{rc=!1}var Tr=null,ic=null,eo=null;function mf(){if(eo)return eo;var t,n=ic,a=n.length,u,w="value"in Tr?Tr.value:Tr.textContent,k=w.length;for(t=0;t<a&&n[t]===w[t];t++);var M=a-t;for(u=1;u<=M&&n[a-u]===w[k-u];u++);return eo=w.slice(t,1<u?1-u:void 0)}function to(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 no(){return!0}function gf(){return!1}function hn(t){function n(a,u,w,k,M){this._reactName=a,this._targetInst=w,this.type=u,this.nativeEvent=k,this.target=M,this.currentTarget=null;for(var $ in t)t.hasOwnProperty($)&&(a=t[$],this[$]=a?a(k):k[$]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?no:gf,this.isPropagationStopped=gf,this}return p(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=no)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),n}var si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ro=hn(si),zs=p({},si,{view:0,detail:0}),Gb=hn(zs),sc,ac,Hs,io=p({},zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lc,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!==Hs&&(Hs&&t.type==="mousemove"?(sc=t.screenX-Hs.screenX,ac=t.screenY-Hs.screenY):ac=sc=0,Hs=t),sc)},movementY:function(t){return"movementY"in t?t.movementY:ac}}),xf=hn(io),Vb=p({},io,{dataTransfer:0}),Yb=hn(Vb),Kb=p({},zs,{relatedTarget:0}),oc=hn(Kb),Xb=p({},si,{animationName:0,elapsedTime:0,pseudoElement:0}),Zb=hn(Xb),Qb=p({},si,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Jb=hn(Qb),ey=p({},si,{data:0}),vf=hn(ey),ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ny={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"},ry={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iy(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=ry[t])?!!n[t]:!1}function lc(){return iy}var sy=p({},zs,{key:function(t){if(t.key){var n=ty[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=to(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ny[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lc,charCode:function(t){return t.type==="keypress"?to(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?to(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ay=hn(sy),oy=p({},io,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bf=hn(oy),ly=p({},zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lc}),cy=hn(ly),uy=p({},si,{propertyName:0,elapsedTime:0,pseudoElement:0}),dy=hn(uy),hy=p({},io,{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}),fy=hn(hy),py=p({},si,{newState:0,oldState:0}),my=hn(py),gy=[9,13,27,32],cc=lr&&"CompositionEvent"in window,Ps=null;lr&&"documentMode"in document&&(Ps=document.documentMode);var xy=lr&&"TextEvent"in window&&!Ps,yf=lr&&(!cc||Ps&&8<Ps&&11>=Ps),_f=" ",Sf=!1;function wf(t,n){switch(t){case"keyup":return gy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ui=!1;function vy(t,n){switch(t){case"compositionend":return Cf(n);case"keypress":return n.which!==32?null:(Sf=!0,_f);case"textInput":return t=n.data,t===_f&&Sf?null:t;default:return null}}function by(t,n){if(Ui)return t==="compositionend"||!cc&&wf(t,n)?(t=mf(),eo=ic=Tr=null,Ui=!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 yf&&n.locale!=="ko"?null:n.data;default:return null}}var yy={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 kf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!yy[t.type]:n==="textarea"}function Ef(t,n,a,u){Pi?Fi?Fi.push(u):Fi=[u]:Pi=u,n=Yo(n,"onChange"),0<n.length&&(a=new ro("onChange","change",null,a,u),t.push({event:a,listeners:n}))}var Fs=null,Us=null;function _y(t){lg(t,0)}function so(t){var n=Os(t);if(of(n))return t}function jf(t,n){if(t==="change")return n}var Nf=!1;if(lr){var uc;if(lr){var dc="oninput"in document;if(!dc){var Tf=document.createElement("div");Tf.setAttribute("oninput","return;"),dc=typeof Tf.oninput=="function"}uc=dc}else uc=!1;Nf=uc&&(!document.documentMode||9<document.documentMode)}function Af(){Fs&&(Fs.detachEvent("onpropertychange",Df),Us=Fs=null)}function Df(t){if(t.propertyName==="value"&&so(Us)){var n=[];Ef(n,Us,t,tc(t)),pf(_y,n)}}function Sy(t,n,a){t==="focusin"?(Af(),Fs=n,Us=a,Fs.attachEvent("onpropertychange",Df)):t==="focusout"&&Af()}function wy(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return so(Us)}function Cy(t,n){if(t==="click")return so(n)}function ky(t,n){if(t==="input"||t==="change")return so(n)}function Ey(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var yn=typeof Object.is=="function"?Object.is:Ey;function $s(t,n){if(yn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),u=Object.keys(n);if(a.length!==u.length)return!1;for(u=0;u<a.length;u++){var w=a[u];if(!dt.call(n,w)||!yn(t[w],n[w]))return!1}return!0}function Rf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Lf(t,n){var a=Rf(t);t=0;for(var u;a;){if(a.nodeType===3){if(u=t+a.textContent.length,t<=n&&u>=n)return{node:a,offset:n-t};t=u}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Rf(a)}}function Mf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Mf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Of(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Qa(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=Qa(t.document)}return n}function hc(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 jy=lr&&"documentMode"in document&&11>=document.documentMode,$i=null,fc=null,qs=null,pc=!1;function If(t,n,a){var u=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;pc||$i==null||$i!==Qa(u)||(u=$i,"selectionStart"in u&&hc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),qs&&$s(qs,u)||(qs=u,u=Yo(fc,"onSelect"),0<u.length&&(n=new ro("onSelect","select",null,n,a),t.push({event:n,listeners:u}),n.target=$i)))}function ai(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var qi={animationend:ai("Animation","AnimationEnd"),animationiteration:ai("Animation","AnimationIteration"),animationstart:ai("Animation","AnimationStart"),transitionrun:ai("Transition","TransitionRun"),transitionstart:ai("Transition","TransitionStart"),transitioncancel:ai("Transition","TransitionCancel"),transitionend:ai("Transition","TransitionEnd")},mc={},Bf={};lr&&(Bf=document.createElement("div").style,"AnimationEvent"in window||(delete qi.animationend.animation,delete qi.animationiteration.animation,delete qi.animationstart.animation),"TransitionEvent"in window||delete qi.transitionend.transition);function oi(t){if(mc[t])return mc[t];if(!qi[t])return t;var n=qi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Bf)return mc[t]=n[a];return t}var zf=oi("animationend"),Hf=oi("animationiteration"),Pf=oi("animationstart"),Ny=oi("transitionrun"),Ty=oi("transitionstart"),Ay=oi("transitioncancel"),Ff=oi("transitionend"),Uf=new Map,gc="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(" ");gc.push("scrollEnd");function qn(t,n){Uf.set(t,n),ii(n,[t])}var ao=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)},On=[],Wi=0,xc=0;function oo(){for(var t=Wi,n=xc=Wi=0;n<t;){var a=On[n];On[n++]=null;var u=On[n];On[n++]=null;var w=On[n];On[n++]=null;var k=On[n];if(On[n++]=null,u!==null&&w!==null){var M=u.pending;M===null?w.next=w:(w.next=M.next,M.next=w),u.pending=w}k!==0&&$f(a,w,k)}}function lo(t,n,a,u){On[Wi++]=t,On[Wi++]=n,On[Wi++]=a,On[Wi++]=u,xc|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function vc(t,n,a,u){return lo(t,n,a,u),co(t)}function li(t,n){return lo(t,null,null,n),co(t)}function $f(t,n,a){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a);for(var w=!1,k=t.return;k!==null;)k.childLanes|=a,u=k.alternate,u!==null&&(u.childLanes|=a),k.tag===22&&(t=k.stateNode,t===null||t._visibility&1||(w=!0)),t=k,k=k.return;return t.tag===3?(k=t.stateNode,w&&n!==null&&(w=31-$e(a),t=k.hiddenUpdates,u=t[w],u===null?t[w]=[n]:u.push(n),n.lane=a|536870912),k):null}function co(t){if(50<ha)throw ha=0,ju=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Gi={};function Dy(t,n,a,u){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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _n(t,n,a,u){return new Dy(t,n,a,u)}function bc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function cr(t,n){var a=t.alternate;return a===null?(a=_n(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 qf(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 uo(t,n,a,u,w,k){var M=0;if(u=t,typeof t=="function")bc(t)&&(M=1);else if(typeof t=="string")M=I_(t,a,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=_n(31,a,n,w),t.elementType=B,t.lanes=k,t;case C:return ci(a.children,w,k,n);case b:M=8,w|=24;break;case _:return t=_n(12,a,n,w|2),t.elementType=_,t.lanes=k,t;case A:return t=_n(13,a,n,w),t.elementType=A,t.lanes=k,t;case N:return t=_n(19,a,n,w),t.elementType=N,t.lanes=k,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case y: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,u=null;break e}M=29,a=Error(s(130,t===null?"null":typeof t,"")),u=null}return n=_n(M,a,n,w),n.elementType=t,n.type=u,n.lanes=k,n}function ci(t,n,a,u){return t=_n(7,t,u,n),t.lanes=a,t}function yc(t,n,a){return t=_n(6,t,null,n),t.lanes=a,t}function Wf(t){var n=_n(18,null,null,0);return n.stateNode=t,n}function _c(t,n,a){return n=_n(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Gf=new WeakMap;function In(t,n){if(typeof t=="object"&&t!==null){var a=Gf.get(t);return a!==void 0?a:(n={value:t,source:n,stack:lt(n)},Gf.set(t,n),n)}return{value:t,source:n,stack:lt(n)}}var Vi=[],Yi=0,ho=null,Ws=0,Bn=[],zn=0,Ar=null,Zn=1,Qn="";function ur(t,n){Vi[Yi++]=Ws,Vi[Yi++]=ho,ho=t,Ws=n}function Vf(t,n,a){Bn[zn++]=Zn,Bn[zn++]=Qn,Bn[zn++]=Ar,Ar=t;var u=Zn;t=Qn;var w=32-$e(u)-1;u&=~(1<<w),a+=1;var k=32-$e(n)+w;if(30<k){var M=w-w%5;k=(u&(1<<M)-1).toString(32),u>>=M,w-=M,Zn=1<<32-$e(n)+w|a<<w|u,Qn=k+t}else Zn=1<<k|a<<w|u,Qn=t}function Sc(t){t.return!==null&&(ur(t,1),Vf(t,1,0))}function wc(t){for(;t===ho;)ho=Vi[--Yi],Vi[Yi]=null,Ws=Vi[--Yi],Vi[Yi]=null;for(;t===Ar;)Ar=Bn[--zn],Bn[zn]=null,Qn=Bn[--zn],Bn[zn]=null,Zn=Bn[--zn],Bn[zn]=null}function Yf(t,n){Bn[zn++]=Zn,Bn[zn++]=Qn,Bn[zn++]=Ar,Zn=n.id,Qn=n.overflow,Ar=t}var Xt=null,St=null,nt=!1,Dr=null,Hn=!1,Cc=Error(s(519));function Rr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gs(In(n,t)),Cc}function Kf(t){var n=t.stateNode,a=t.type,u=t.memoizedProps;switch(n[Kt]=t,n[dn]=u,a){case"dialog":Ke("cancel",n),Ke("close",n);break;case"iframe":case"object":case"embed":Ke("load",n);break;case"video":case"audio":for(a=0;a<pa.length;a++)Ke(pa[a],n);break;case"source":Ke("error",n);break;case"img":case"image":case"link":Ke("error",n),Ke("load",n);break;case"details":Ke("toggle",n);break;case"input":Ke("invalid",n),lf(n,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ke("invalid",n);break;case"textarea":Ke("invalid",n),uf(n,u.value,u.defaultValue,u.children)}a=u.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||u.suppressHydrationWarning===!0||hg(n.textContent,a)?(u.popover!=null&&(Ke("beforetoggle",n),Ke("toggle",n)),u.onScroll!=null&&Ke("scroll",n),u.onScrollEnd!=null&&Ke("scrollend",n),u.onClick!=null&&(n.onclick=or),n=!0):n=!1,n||Rr(t,!0)}function Xf(t){for(Xt=t.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Hn=!1;return;case 27:case 3:Hn=!0;return;default:Xt=Xt.return}}function Ki(t){if(t!==Xt)return!1;if(!nt)return Xf(t),nt=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||Uu(t.type,t.memoizedProps)),a=!a),a&&St&&Rr(t),Xf(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=_g(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));St=_g(t)}else n===27?(n=St,Gr(t.type)?(t=Vu,Vu=null,St=t):St=n):St=Xt?Fn(t.stateNode.nextSibling):null;return!0}function ui(){St=Xt=null,nt=!1}function kc(){var t=Dr;return t!==null&&(gn===null?gn=t:gn.push.apply(gn,t),Dr=null),t}function Gs(t){Dr===null?Dr=[t]:Dr.push(t)}var Ec=I(null),di=null,dr=null;function Lr(t,n,a){P(Ec,n._currentValue),n._currentValue=a}function hr(t){t._currentValue=Ec.current,U(Ec)}function jc(t,n,a){for(;t!==null;){var u=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,u!==null&&(u.childLanes|=n)):u!==null&&(u.childLanes&n)!==n&&(u.childLanes|=n),t===a)break;t=t.return}}function Nc(t,n,a,u){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var k=w.dependencies;if(k!==null){var M=w.child;k=k.firstContext;e:for(;k!==null;){var $=k;k=w;for(var J=0;J<n.length;J++)if($.context===n[J]){k.lanes|=a,$=k.alternate,$!==null&&($.lanes|=a),jc(k.return,a,t),u||(M=null);break e}k=$.next}}else if(w.tag===18){if(M=w.return,M===null)throw Error(s(341));M.lanes|=a,k=M.alternate,k!==null&&(k.lanes|=a),jc(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 Xi(t,n,a,u){t=null;for(var w=n,k=!1;w!==null;){if(!k){if((w.flags&524288)!==0)k=!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 $=w.type;yn(w.pendingProps.value,M.value)||(t!==null?t.push($):t=[$])}}else if(w===X.current){if(M=w.alternate,M===null)throw Error(s(387));M.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(ba):t=[ba])}w=w.return}t!==null&&Nc(n,t,a,u),n.flags|=262144}function fo(t){for(t=t.firstContext;t!==null;){if(!yn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function hi(t){di=t,dr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Zt(t){return Zf(di,t)}function po(t,n){return di===null&&hi(t),Zf(t,n)}function Zf(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},dr===null){if(t===null)throw Error(s(308));dr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else dr=dr.next=n;return a}var Ry=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,u){t.push(u)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},Ly=e.unstable_scheduleCallback,My=e.unstable_NormalPriority,Lt={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tc(){return{controller:new Ry,data:new Map,refCount:0}}function Vs(t){t.refCount--,t.refCount===0&&Ly(My,function(){t.controller.abort()})}var Ys=null,Ac=0,Zi=0,Qi=null;function Oy(t,n){if(Ys===null){var a=Ys=[];Ac=0,Zi=Lu(),Qi={status:"pending",value:void 0,then:function(u){a.push(u)}}}return Ac++,n.then(Qf,Qf),n}function Qf(){if(--Ac===0&&Ys!==null){Qi!==null&&(Qi.status="fulfilled");var t=Ys;Ys=null,Zi=0,Qi=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function Iy(t,n){var a=[],u={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){u.status="fulfilled",u.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(u.status="rejected",u.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),u}var Jf=V.S;V.S=function(t,n){Im=Ge(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Oy(t,n),Jf!==null&&Jf(t,n)};var fi=I(null);function Dc(){var t=fi.current;return t!==null?t:bt.pooledCache}function mo(t,n){n===null?P(fi,fi.current):P(fi,n.pool)}function ep(){var t=Dc();return t===null?null:{parent:Lt._currentValue,pool:t}}var Ji=Error(s(460)),Rc=Error(s(474)),go=Error(s(542)),xo={then:function(){}};function tp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function np(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(or,or),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,ip(t),t;default:if(typeof n.status=="string")n.then(or,or);else{if(t=bt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(u){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=u}},function(u){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=u}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,ip(t),t}throw mi=n,Ji}}function pi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(mi=a,Ji):a}}var mi=null;function rp(){if(mi===null)throw Error(s(459));var t=mi;return mi=null,t}function ip(t){if(t===Ji||t===go)throw Error(s(483))}var es=null,Ks=0;function vo(t){var n=Ks;return Ks+=1,es===null&&(es=[]),np(es,t,n)}function Xs(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function bo(t,n){throw n.$$typeof===v?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function sp(t){function n(ie,ne){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[ne],ie.flags|=16):oe.push(ne)}}function a(ie,ne){if(!t)return null;for(;ne!==null;)n(ie,ne),ne=ne.sibling;return null}function u(ie){for(var ne=new Map;ie!==null;)ie.key!==null?ne.set(ie.key,ie):ne.set(ie.index,ie),ie=ie.sibling;return ne}function w(ie,ne){return ie=cr(ie,ne),ie.index=0,ie.sibling=null,ie}function k(ie,ne,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<ne?(ie.flags|=67108866,ne):oe):(ie.flags|=67108866,ne)):(ie.flags|=1048576,ne)}function M(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function $(ie,ne,oe,me){return ne===null||ne.tag!==6?(ne=yc(oe,ie.mode,me),ne.return=ie,ne):(ne=w(ne,oe),ne.return=ie,ne)}function J(ie,ne,oe,me){var Re=oe.type;return Re===C?he(ie,ne,oe.props.children,me,oe.key):ne!==null&&(ne.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===T&&pi(Re)===ne.type)?(ne=w(ne,oe.props),Xs(ne,oe),ne.return=ie,ne):(ne=uo(oe.type,oe.key,oe.props,null,ie.mode,me),Xs(ne,oe),ne.return=ie,ne)}function le(ie,ne,oe,me){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=_c(oe,ie.mode,me),ne.return=ie,ne):(ne=w(ne,oe.children||[]),ne.return=ie,ne)}function he(ie,ne,oe,me,Re){return ne===null||ne.tag!==7?(ne=ci(oe,ie.mode,me,Re),ne.return=ie,ne):(ne=w(ne,oe),ne.return=ie,ne)}function xe(ie,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=yc(""+ne,ie.mode,oe),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return oe=uo(ne.type,ne.key,ne.props,null,ie.mode,oe),Xs(oe,ne),oe.return=ie,oe;case E:return ne=_c(ne,ie.mode,oe),ne.return=ie,ne;case T:return ne=pi(ne),xe(ie,ne,oe)}if(W(ne)||Y(ne))return ne=ci(ne,ie.mode,oe,null),ne.return=ie,ne;if(typeof ne.then=="function")return xe(ie,vo(ne),oe);if(ne.$$typeof===y)return xe(ie,po(ie,ne),oe);bo(ie,ne)}return null}function ce(ie,ne,oe,me){var Re=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Re!==null?null:$(ie,ne,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return oe.key===Re?J(ie,ne,oe,me):null;case E:return oe.key===Re?le(ie,ne,oe,me):null;case T:return oe=pi(oe),ce(ie,ne,oe,me)}if(W(oe)||Y(oe))return Re!==null?null:he(ie,ne,oe,me,null);if(typeof oe.then=="function")return ce(ie,ne,vo(oe),me);if(oe.$$typeof===y)return ce(ie,ne,po(ie,oe),me);bo(ie,oe)}return null}function ue(ie,ne,oe,me,Re){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,$(ne,ie,""+me,Re);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return ie=ie.get(me.key===null?oe:me.key)||null,J(ne,ie,me,Re);case E:return ie=ie.get(me.key===null?oe:me.key)||null,le(ne,ie,me,Re);case T:return me=pi(me),ue(ie,ne,oe,me,Re)}if(W(me)||Y(me))return ie=ie.get(oe)||null,he(ne,ie,me,Re,null);if(typeof me.then=="function")return ue(ie,ne,oe,vo(me),Re);if(me.$$typeof===y)return ue(ie,ne,oe,po(ne,me),Re);bo(ne,me)}return null}function je(ie,ne,oe,me){for(var Re=null,at=null,Te=ne,qe=ne=0,Qe=null;Te!==null&&qe<oe.length;qe++){Te.index>qe?(Qe=Te,Te=null):Qe=Te.sibling;var ot=ce(ie,Te,oe[qe],me);if(ot===null){Te===null&&(Te=Qe);break}t&&Te&&ot.alternate===null&&n(ie,Te),ne=k(ot,ne,qe),at===null?Re=ot:at.sibling=ot,at=ot,Te=Qe}if(qe===oe.length)return a(ie,Te),nt&&ur(ie,qe),Re;if(Te===null){for(;qe<oe.length;qe++)Te=xe(ie,oe[qe],me),Te!==null&&(ne=k(Te,ne,qe),at===null?Re=Te:at.sibling=Te,at=Te);return nt&&ur(ie,qe),Re}for(Te=u(Te);qe<oe.length;qe++)Qe=ue(Te,ie,qe,oe[qe],me),Qe!==null&&(t&&Qe.alternate!==null&&Te.delete(Qe.key===null?qe:Qe.key),ne=k(Qe,ne,qe),at===null?Re=Qe:at.sibling=Qe,at=Qe);return t&&Te.forEach(function(Zr){return n(ie,Zr)}),nt&&ur(ie,qe),Re}function Be(ie,ne,oe,me){if(oe==null)throw Error(s(151));for(var Re=null,at=null,Te=ne,qe=ne=0,Qe=null,ot=oe.next();Te!==null&&!ot.done;qe++,ot=oe.next()){Te.index>qe?(Qe=Te,Te=null):Qe=Te.sibling;var Zr=ce(ie,Te,ot.value,me);if(Zr===null){Te===null&&(Te=Qe);break}t&&Te&&Zr.alternate===null&&n(ie,Te),ne=k(Zr,ne,qe),at===null?Re=Zr:at.sibling=Zr,at=Zr,Te=Qe}if(ot.done)return a(ie,Te),nt&&ur(ie,qe),Re;if(Te===null){for(;!ot.done;qe++,ot=oe.next())ot=xe(ie,ot.value,me),ot!==null&&(ne=k(ot,ne,qe),at===null?Re=ot:at.sibling=ot,at=ot);return nt&&ur(ie,qe),Re}for(Te=u(Te);!ot.done;qe++,ot=oe.next())ot=ue(Te,ie,qe,ot.value,me),ot!==null&&(t&&ot.alternate!==null&&Te.delete(ot.key===null?qe:ot.key),ne=k(ot,ne,qe),at===null?Re=ot:at.sibling=ot,at=ot);return t&&Te.forEach(function(V_){return n(ie,V_)}),nt&&ur(ie,qe),Re}function vt(ie,ne,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;ne!==null;){if(ne.key===Re){if(Re=oe.type,Re===C){if(ne.tag===7){a(ie,ne.sibling),me=w(ne,oe.props.children),me.return=ie,ie=me;break e}}else if(ne.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===T&&pi(Re)===ne.type){a(ie,ne.sibling),me=w(ne,oe.props),Xs(me,oe),me.return=ie,ie=me;break e}a(ie,ne);break}else n(ie,ne);ne=ne.sibling}oe.type===C?(me=ci(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=uo(oe.type,oe.key,oe.props,null,ie.mode,me),Xs(me,oe),me.return=ie,ie=me)}return M(ie);case E:e:{for(Re=oe.key;ne!==null;){if(ne.key===Re)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){a(ie,ne.sibling),me=w(ne,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,ne);break}else n(ie,ne);ne=ne.sibling}me=_c(oe,ie.mode,me),me.return=ie,ie=me}return M(ie);case T:return oe=pi(oe),vt(ie,ne,oe,me)}if(W(oe))return je(ie,ne,oe,me);if(Y(oe)){if(Re=Y(oe),typeof Re!="function")throw Error(s(150));return oe=Re.call(oe),Be(ie,ne,oe,me)}if(typeof oe.then=="function")return vt(ie,ne,vo(oe),me);if(oe.$$typeof===y)return vt(ie,ne,po(ie,oe),me);bo(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ne!==null&&ne.tag===6?(a(ie,ne.sibling),me=w(ne,oe),me.return=ie,ie=me):(a(ie,ne),me=yc(oe,ie.mode,me),me.return=ie,ie=me),M(ie)):a(ie,ne)}return function(ie,ne,oe,me){try{Ks=0;var Re=vt(ie,ne,oe,me);return es=null,Re}catch(Te){if(Te===Ji||Te===go)throw Te;var at=_n(29,Te,null,ie.mode);return at.lanes=me,at.return=ie,at}finally{}}}var gi=sp(!0),ap=sp(!1),Mr=!1;function Lc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mc(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 Or(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ir(t,n,a){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(ut&2)!==0){var w=u.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),u.pending=n,n=co(t),$f(t,null,a),n}return lo(t,u,n,a),co(t)}function Zs(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Xh(t,a)}}function Oc(t,n){var a=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,a===u)){var w=null,k=null;if(a=a.firstBaseUpdate,a!==null){do{var M={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};k===null?w=k=M:k=k.next=M,a=a.next}while(a!==null);k===null?w=k=n:k=k.next=n}else w=k=n;a={baseState:u.baseState,firstBaseUpdate:w,lastBaseUpdate:k,shared:u.shared,callbacks:u.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Ic=!1;function Qs(){if(Ic){var t=Qi;if(t!==null)throw t}}function Js(t,n,a,u){Ic=!1;var w=t.updateQueue;Mr=!1;var k=w.firstBaseUpdate,M=w.lastBaseUpdate,$=w.shared.pending;if($!==null){w.shared.pending=null;var J=$,le=J.next;J.next=null,M===null?k=le:M.next=le,M=J;var he=t.alternate;he!==null&&(he=he.updateQueue,$=he.lastBaseUpdate,$!==M&&($===null?he.firstBaseUpdate=le:$.next=le,he.lastBaseUpdate=J))}if(k!==null){var xe=w.baseState;M=0,he=le=J=null,$=k;do{var ce=$.lane&-536870913,ue=ce!==$.lane;if(ue?(Ze&ce)===ce:(u&ce)===ce){ce!==0&&ce===Zi&&(Ic=!0),he!==null&&(he=he.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var je=t,Be=$;ce=n;var vt=a;switch(Be.tag){case 1:if(je=Be.payload,typeof je=="function"){xe=je.call(vt,xe,ce);break e}xe=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Be.payload,ce=typeof je=="function"?je.call(vt,xe,ce):je,ce==null)break e;xe=p({},xe,ce);break e;case 2:Mr=!0}}ce=$.callback,ce!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=w.callbacks,ue===null?w.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:$.tag,payload:$.payload,callback:$.callback,next:null},he===null?(le=he=ue,J=xe):he=he.next=ue,M|=ce;if($=$.next,$===null){if($=w.shared.pending,$===null)break;ue=$,$=ue.next,ue.next=null,w.lastBaseUpdate=ue,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=he,k===null&&(w.shared.lanes=0),Fr|=M,t.lanes=M,t.memoizedState=xe}}function op(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function lp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)op(a[t],n)}var ts=I(null),yo=I(0);function cp(t,n){t=_r,P(yo,t),P(ts,n),_r=t|n.baseLanes}function Bc(){P(yo,_r),P(ts,ts.current)}function zc(){_r=yo.current,U(ts),U(yo)}var Sn=I(null),Pn=null;function Br(t){var n=t.alternate;P(Tt,Tt.current&1),P(Sn,t),Pn===null&&(n===null||ts.current!==null||n.memoizedState!==null)&&(Pn=t)}function Hc(t){P(Tt,Tt.current),P(Sn,t),Pn===null&&(Pn=t)}function up(t){t.tag===22?(P(Tt,Tt.current),P(Sn,t),Pn===null&&(Pn=t)):zr()}function zr(){P(Tt,Tt.current),P(Sn,Sn.current)}function wn(t){U(Sn),Pn===t&&(Pn=null),U(Tt)}var Tt=I(0);function _o(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Wu(a)||Gu(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 fr=0,Ue=null,gt=null,Mt=null,So=!1,ns=!1,xi=!1,wo=0,ea=0,rs=null,By=0;function jt(){throw Error(s(321))}function Pc(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!yn(t[a],n[a]))return!1;return!0}function Fc(t,n,a,u,w,k){return fr=k,Ue=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,V.H=t===null||t.memoizedState===null?Vp:nu,xi=!1,k=a(u,w),xi=!1,ns&&(k=hp(n,a,u,w)),dp(t),k}function dp(t){V.H=ra;var n=gt!==null&>.next!==null;if(fr=0,Mt=gt=Ue=null,So=!1,ea=0,rs=null,n)throw Error(s(300));t===null||Ot||(t=t.dependencies,t!==null&&fo(t)&&(Ot=!0))}function hp(t,n,a,u){Ue=t;var w=0;do{if(ns&&(rs=null),ea=0,ns=!1,25<=w)throw Error(s(301));if(w+=1,Mt=gt=null,t.updateQueue!=null){var k=t.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}V.H=Yp,k=n(a,u)}while(ns);return k}function zy(){var t=V.H,n=t.useState()[0];return n=typeof n.then=="function"?ta(n):n,t=t.useState()[0],(gt!==null?gt.memoizedState:null)!==t&&(Ue.flags|=1024),n}function Uc(){var t=wo!==0;return wo=0,t}function $c(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function qc(t){if(So){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}So=!1}fr=0,Mt=gt=Ue=null,ns=!1,ea=wo=0,rs=null}function on(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Ue.memoizedState=Mt=t:Mt=Mt.next=t,Mt}function At(){if(gt===null){var t=Ue.alternate;t=t!==null?t.memoizedState:null}else t=gt.next;var n=Mt===null?Ue.memoizedState:Mt.next;if(n!==null)Mt=n,gt=t;else{if(t===null)throw Ue.alternate===null?Error(s(467)):Error(s(310));gt=t,t={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Mt===null?Ue.memoizedState=Mt=t:Mt=Mt.next=t}return Mt}function Co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ta(t){var n=ea;return ea+=1,rs===null&&(rs=[]),t=np(rs,t,n),n=Ue,(Mt===null?n.memoizedState:Mt.next)===null&&(n=n.alternate,V.H=n===null||n.memoizedState===null?Vp:nu),t}function ko(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ta(t);if(t.$$typeof===y)return Zt(t)}throw Error(s(438,String(t)))}function Wc(t){var n=null,a=Ue.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var u=Ue.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(n={data:u.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Co(),Ue.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),u=0;u<t;u++)a[u]=H;return n.index++,a}function pr(t,n){return typeof n=="function"?n(t):n}function Eo(t){var n=At();return Gc(n,gt,t)}function Gc(t,n,a){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=a;var w=t.baseQueue,k=u.pending;if(k!==null){if(w!==null){var M=w.next;w.next=k.next,k.next=M}n.baseQueue=w=k,u.pending=null}if(k=t.baseState,w===null)t.memoizedState=k;else{n=w.next;var $=M=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(Ze&xe)===xe:(fr&xe)===xe){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}),xe===Zi&&(he=!0);else if((fr&ce)===ce){le=le.next,ce===Zi&&(he=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?($=J=xe,M=k):J=J.next=xe,Ue.lanes|=ce,Fr|=ce;xe=le.action,xi&&a(k,xe),k=le.hasEagerState?le.eagerState:a(k,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?($=J=ce,M=k):J=J.next=ce,Ue.lanes|=xe,Fr|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?M=k:J.next=$,!yn(k,t.memoizedState)&&(Ot=!0,he&&(a=Qi,a!==null)))throw a;t.memoizedState=k,t.baseState=M,t.baseQueue=J,u.lastRenderedState=k}return w===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Vc(t){var n=At(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var u=a.dispatch,w=a.pending,k=n.memoizedState;if(w!==null){a.pending=null;var M=w=w.next;do k=t(k,M.action),M=M.next;while(M!==w);yn(k,n.memoizedState)||(Ot=!0),n.memoizedState=k,n.baseQueue===null&&(n.baseState=k),a.lastRenderedState=k}return[k,u]}function fp(t,n,a){var u=Ue,w=At(),k=nt;if(k){if(a===void 0)throw Error(s(407));a=a()}else a=n();var M=!yn((gt||w).memoizedState,a);if(M&&(w.memoizedState=a,Ot=!0),w=w.queue,Xc(gp.bind(null,u,w,t),[t]),w.getSnapshot!==n||M||Mt!==null&&Mt.memoizedState.tag&1){if(u.flags|=2048,is(9,{destroy:void 0},mp.bind(null,u,w,a,n),null),bt===null)throw Error(s(349));k||(fr&127)!==0||pp(u,n,a)}return a}function pp(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ue.updateQueue,n===null?(n=Co(),Ue.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function mp(t,n,a,u){n.value=a,n.getSnapshot=u,xp(n)&&vp(t)}function gp(t,n,a){return a(function(){xp(n)&&vp(t)})}function xp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!yn(t,a)}catch{return!0}}function vp(t){var n=li(t,2);n!==null&&xn(n,t,2)}function Yc(t){var n=on();if(typeof t=="function"){var a=t;if(t=a(),xi){Ct(!0);try{a()}finally{Ct(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:t},n}function bp(t,n,a,u){return t.baseState=a,Gc(t,gt,typeof u=="function"?u:pr)}function Hy(t,n,a,u,w){if(To(t))throw Error(s(485));if(t=n.action,t!==null){var k={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){k.listeners.push(M)}};V.T!==null?a(!0):k.isTransition=!1,u(k),a=n.pending,a===null?(k.next=n.pending=k,yp(n,k)):(k.next=a.next,n.pending=a.next=k)}}function yp(t,n){var a=n.action,u=n.payload,w=t.state;if(n.isTransition){var k=V.T,M={};V.T=M;try{var $=a(w,u),J=V.S;J!==null&&J(M,$),_p(t,n,$)}catch(le){Kc(t,n,le)}finally{k!==null&&M.types!==null&&(k.types=M.types),V.T=k}}else try{k=a(w,u),_p(t,n,k)}catch(le){Kc(t,n,le)}}function _p(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(u){Sp(t,n,u)},function(u){return Kc(t,n,u)}):Sp(t,n,a)}function Sp(t,n,a){n.status="fulfilled",n.value=a,wp(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,yp(t,a)))}function Kc(t,n,a){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do n.status="rejected",n.reason=a,wp(n),n=n.next;while(n!==u)}t.action=null}function wp(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Cp(t,n){return n}function kp(t,n){if(nt){var a=bt.formState;if(a!==null){e:{var u=Ue;if(nt){if(St){t:{for(var w=St,k=Hn;w.nodeType!==8;){if(!k){w=null;break t}if(w=Fn(w.nextSibling),w===null){w=null;break t}}k=w.data,w=k==="F!"||k==="F"?w:null}if(w){St=Fn(w.nextSibling),u=w.data==="F!";break e}}Rr(u)}u=!1}u&&(n=a[0])}}return a=on(),a.memoizedState=a.baseState=n,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cp,lastRenderedState:n},a.queue=u,a=qp.bind(null,Ue,u),u.dispatch=a,u=Yc(!1),k=tu.bind(null,Ue,!1,u.queue),u=on(),w={state:n,dispatch:null,action:t,pending:null},u.queue=w,a=Hy.bind(null,Ue,w,k,a),w.dispatch=a,u.memoizedState=t,[n,a,!1]}function Ep(t){var n=At();return jp(n,gt,t)}function jp(t,n,a){if(n=Gc(t,n,Cp)[0],t=Eo(pr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var u=ta(n)}catch(M){throw M===Ji?go:M}else u=n;n=At();var w=n.queue,k=w.dispatch;return a!==n.memoizedState&&(Ue.flags|=2048,is(9,{destroy:void 0},Py.bind(null,w,a),null)),[u,k,t]}function Py(t,n){t.action=n}function Np(t){var n=At(),a=gt;if(a!==null)return jp(n,a,t);At(),n=n.memoizedState,a=At();var u=a.queue.dispatch;return a.memoizedState=t,[n,u,!1]}function is(t,n,a,u){return t={tag:t,create:a,deps:u,inst:n,next:null},n=Ue.updateQueue,n===null&&(n=Co(),Ue.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(u=a.next,a.next=t,t.next=u,n.lastEffect=t),t}function Tp(){return At().memoizedState}function jo(t,n,a,u){var w=on();Ue.flags|=t,w.memoizedState=is(1|n,{destroy:void 0},a,u===void 0?null:u)}function No(t,n,a,u){var w=At();u=u===void 0?null:u;var k=w.memoizedState.inst;gt!==null&&u!==null&&Pc(u,gt.memoizedState.deps)?w.memoizedState=is(n,k,a,u):(Ue.flags|=t,w.memoizedState=is(1|n,k,a,u))}function Ap(t,n){jo(8390656,8,t,n)}function Xc(t,n){No(2048,8,t,n)}function Fy(t){Ue.flags|=4;var n=Ue.updateQueue;if(n===null)n=Co(),Ue.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Dp(t){var n=At().memoizedState;return Fy({ref:n,nextImpl:t}),function(){if((ut&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Rp(t,n){return No(4,2,t,n)}function Lp(t,n){return No(4,4,t,n)}function Mp(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 Op(t,n,a){a=a!=null?a.concat([t]):null,No(4,4,Mp.bind(null,n,t),a)}function Zc(){}function Ip(t,n){var a=At();n=n===void 0?null:n;var u=a.memoizedState;return n!==null&&Pc(n,u[1])?u[0]:(a.memoizedState=[t,n],t)}function Bp(t,n){var a=At();n=n===void 0?null:n;var u=a.memoizedState;if(n!==null&&Pc(n,u[1]))return u[0];if(u=t(),xi){Ct(!0);try{t()}finally{Ct(!1)}}return a.memoizedState=[u,n],u}function Qc(t,n,a){return a===void 0||(fr&1073741824)!==0&&(Ze&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=zm(),Ue.lanes|=t,Fr|=t,a)}function zp(t,n,a,u){return yn(a,n)?a:ts.current!==null?(t=Qc(t,a,u),yn(t,n)||(Ot=!0),t):(fr&42)===0||(fr&1073741824)!==0&&(Ze&261930)===0?(Ot=!0,t.memoizedState=a):(t=zm(),Ue.lanes|=t,Fr|=t,n)}function Hp(t,n,a,u,w){var k=Q.p;Q.p=k!==0&&8>k?k:8;var M=V.T,$={};V.T=$,tu(t,!1,n,a);try{var J=w(),le=V.S;if(le!==null&&le($,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=Iy(J,u);na(t,n,he,En(t))}else na(t,n,u,En(t))}catch(xe){na(t,n,{then:function(){},status:"rejected",reason:xe},En())}finally{Q.p=k,M!==null&&$.types!==null&&(M.types=$.types),V.T=M}}function Uy(){}function Jc(t,n,a,u){if(t.tag!==5)throw Error(s(476));var w=Pp(t).queue;Hp(t,w,n,ee,a===null?Uy:function(){return Fp(t),a(u)})}function Pp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:ee},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:pr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Fp(t){var n=Pp(t);n.next===null&&(n=t.alternate.memoizedState),na(t,n.next.queue,{},En())}function eu(){return Zt(ba)}function Up(){return At().memoizedState}function $p(){return At().memoizedState}function $y(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=En();t=Or(a);var u=Ir(n,t,a);u!==null&&(xn(u,n,a),Zs(u,n,a)),n={cache:Tc()},t.payload=n;return}n=n.return}}function qy(t,n,a){var u=En();a={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},To(t)?Wp(n,a):(a=vc(t,n,a,u),a!==null&&(xn(a,t,u),Gp(a,n,u)))}function qp(t,n,a){var u=En();na(t,n,a,u)}function na(t,n,a,u){var w={lane:u,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(To(t))Wp(n,w);else{var k=t.alternate;if(t.lanes===0&&(k===null||k.lanes===0)&&(k=n.lastRenderedReducer,k!==null))try{var M=n.lastRenderedState,$=k(M,a);if(w.hasEagerState=!0,w.eagerState=$,yn($,M))return lo(t,n,w,0),bt===null&&oo(),!1}catch{}finally{}if(a=vc(t,n,w,u),a!==null)return xn(a,t,u),Gp(a,n,u),!0}return!1}function tu(t,n,a,u){if(u={lane:2,revertLane:Lu(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},To(t)){if(n)throw Error(s(479))}else n=vc(t,a,u,2),n!==null&&xn(n,t,2)}function To(t){var n=t.alternate;return t===Ue||n!==null&&n===Ue}function Wp(t,n){ns=So=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function Gp(t,n,a){if((a&4194048)!==0){var u=n.lanes;u&=t.pendingLanes,a|=u,n.lanes=a,Xh(t,a)}}var ra={readContext:Zt,use:ko,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};ra.useEffectEvent=jt;var Vp={readContext:Zt,use:ko,useCallback:function(t,n){return on().memoizedState=[t,n===void 0?null:n],t},useContext:Zt,useEffect:Ap,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,jo(4194308,4,Mp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return jo(4194308,4,t,n)},useInsertionEffect:function(t,n){jo(4,2,t,n)},useMemo:function(t,n){var a=on();n=n===void 0?null:n;var u=t();if(xi){Ct(!0);try{t()}finally{Ct(!1)}}return a.memoizedState=[u,n],u},useReducer:function(t,n,a){var u=on();if(a!==void 0){var w=a(n);if(xi){Ct(!0);try{a(n)}finally{Ct(!1)}}}else w=n;return u.memoizedState=u.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},u.queue=t,t=t.dispatch=qy.bind(null,Ue,t),[u.memoizedState,t]},useRef:function(t){var n=on();return t={current:t},n.memoizedState=t},useState:function(t){t=Yc(t);var n=t.queue,a=qp.bind(null,Ue,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:Zc,useDeferredValue:function(t,n){var a=on();return Qc(a,t,n)},useTransition:function(){var t=Yc(!1);return t=Hp.bind(null,Ue,t.queue,!0,!1),on().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var u=Ue,w=on();if(nt){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),bt===null)throw Error(s(349));(Ze&127)!==0||pp(u,n,a)}w.memoizedState=a;var k={value:a,getSnapshot:n};return w.queue=k,Ap(gp.bind(null,u,k,t),[t]),u.flags|=2048,is(9,{destroy:void 0},mp.bind(null,u,k,a,n),null),a},useId:function(){var t=on(),n=bt.identifierPrefix;if(nt){var a=Qn,u=Zn;a=(u&~(1<<32-$e(u)-1)).toString(32)+a,n="_"+n+"R_"+a,a=wo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=By++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:eu,useFormState:kp,useActionState:kp,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=tu.bind(null,Ue,!0,a),a.dispatch=n,[t,n]},useMemoCache:Wc,useCacheRefresh:function(){return on().memoizedState=$y.bind(null,Ue)},useEffectEvent:function(t){var n=on(),a={impl:t};return n.memoizedState=a,function(){if((ut&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},nu={readContext:Zt,use:ko,useCallback:Ip,useContext:Zt,useEffect:Xc,useImperativeHandle:Op,useInsertionEffect:Rp,useLayoutEffect:Lp,useMemo:Bp,useReducer:Eo,useRef:Tp,useState:function(){return Eo(pr)},useDebugValue:Zc,useDeferredValue:function(t,n){var a=At();return zp(a,gt.memoizedState,t,n)},useTransition:function(){var t=Eo(pr)[0],n=At().memoizedState;return[typeof t=="boolean"?t:ta(t),n]},useSyncExternalStore:fp,useId:Up,useHostTransitionStatus:eu,useFormState:Ep,useActionState:Ep,useOptimistic:function(t,n){var a=At();return bp(a,gt,t,n)},useMemoCache:Wc,useCacheRefresh:$p};nu.useEffectEvent=Dp;var Yp={readContext:Zt,use:ko,useCallback:Ip,useContext:Zt,useEffect:Xc,useImperativeHandle:Op,useInsertionEffect:Rp,useLayoutEffect:Lp,useMemo:Bp,useReducer:Vc,useRef:Tp,useState:function(){return Vc(pr)},useDebugValue:Zc,useDeferredValue:function(t,n){var a=At();return gt===null?Qc(a,t,n):zp(a,gt.memoizedState,t,n)},useTransition:function(){var t=Vc(pr)[0],n=At().memoizedState;return[typeof t=="boolean"?t:ta(t),n]},useSyncExternalStore:fp,useId:Up,useHostTransitionStatus:eu,useFormState:Np,useActionState:Np,useOptimistic:function(t,n){var a=At();return gt!==null?bp(a,gt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:Wc,useCacheRefresh:$p};Yp.useEffectEvent=Dp;function ru(t,n,a,u){n=t.memoizedState,a=a(u,n),a=a==null?n:p({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var iu={enqueueSetState:function(t,n,a){t=t._reactInternals;var u=En(),w=Or(u);w.payload=n,a!=null&&(w.callback=a),n=Ir(t,w,u),n!==null&&(xn(n,t,u),Zs(n,t,u))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var u=En(),w=Or(u);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=Ir(t,w,u),n!==null&&(xn(n,t,u),Zs(n,t,u))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=En(),u=Or(a);u.tag=2,n!=null&&(u.callback=n),n=Ir(t,u,a),n!==null&&(xn(n,t,a),Zs(n,t,a))}};function Kp(t,n,a,u,w,k,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,k,M):n.prototype&&n.prototype.isPureReactComponent?!$s(a,u)||!$s(w,k):!0}function Xp(t,n,a,u){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,u),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,u),n.state!==t&&iu.enqueueReplaceState(n,n.state,null)}function vi(t,n){var a=n;if("ref"in n){a={};for(var u in n)u!=="ref"&&(a[u]=n[u])}if(t=t.defaultProps){a===n&&(a=p({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function Zp(t){ao(t)}function Qp(t){console.error(t)}function Jp(t){ao(t)}function Ao(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(u){setTimeout(function(){throw u})}}function em(t,n,a){try{var u=t.onCaughtError;u(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function su(t,n,a){return a=Or(a),a.tag=3,a.payload={element:null},a.callback=function(){Ao(t,n)},a}function tm(t){return t=Or(t),t.tag=3,t}function nm(t,n,a,u){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var k=u.value;t.payload=function(){return w(k)},t.callback=function(){em(n,a,u)}}var M=a.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){em(n,a,u),typeof w!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var $=u.stack;this.componentDidCatch(u.value,{componentStack:$!==null?$:""})})}function Wy(t,n,a,u,w){if(a.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(n=a.alternate,n!==null&&Xi(n,a,w,!0),a=Sn.current,a!==null){switch(a.tag){case 31:case 13:return Pn===null?Uo():a.alternate===null&&Nt===0&&(Nt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,u===xo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([u]):n.add(u),Au(t,u,w)),!1;case 22:return a.flags|=65536,u===xo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([u])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([u]):a.add(u)),Au(t,u,w)),!1}throw Error(s(435,a.tag))}return Au(t,u,w),Uo(),!1}if(nt)return n=Sn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,u!==Cc&&(t=Error(s(422),{cause:u}),Gs(In(t,a)))):(u!==Cc&&(n=Error(s(423),{cause:u}),Gs(In(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,u=In(u,a),w=su(t.stateNode,u,w),Oc(t,w),Nt!==4&&(Nt=2)),!1;var k=Error(s(520),{cause:u});if(k=In(k,a),da===null?da=[k]:da.push(k),Nt!==4&&(Nt=2),n===null)return!0;u=In(u,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=su(a.stateNode,u,t),Oc(a,t),!1;case 1:if(n=a.type,k=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ur===null||!Ur.has(k))))return a.flags|=65536,w&=-w,a.lanes|=w,w=tm(w),nm(w,t,a,u),Oc(a,w),!1}a=a.return}while(a!==null);return!1}var au=Error(s(461)),Ot=!1;function Qt(t,n,a,u){n.child=t===null?ap(n,null,a,u):gi(n,t.child,a,u)}function rm(t,n,a,u,w){a=a.render;var k=n.ref;if("ref"in u){var M={};for(var $ in u)$!=="ref"&&(M[$]=u[$])}else M=u;return hi(n),u=Fc(t,n,a,M,k,w),$=Uc(),t!==null&&!Ot?($c(t,n,w),mr(t,n,w)):(nt&&$&&Sc(n),n.flags|=1,Qt(t,n,u,w),n.child)}function im(t,n,a,u,w){if(t===null){var k=a.type;return typeof k=="function"&&!bc(k)&&k.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=k,sm(t,n,k,u,w)):(t=uo(a.type,null,u,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(k=t.child,!pu(t,w)){var M=k.memoizedProps;if(a=a.compare,a=a!==null?a:$s,a(M,u)&&t.ref===n.ref)return mr(t,n,w)}return n.flags|=1,t=cr(k,u),t.ref=n.ref,t.return=n,n.child=t}function sm(t,n,a,u,w){if(t!==null){var k=t.memoizedProps;if($s(k,u)&&t.ref===n.ref)if(Ot=!1,n.pendingProps=u=k,pu(t,w))(t.flags&131072)!==0&&(Ot=!0);else return n.lanes=t.lanes,mr(t,n,w)}return ou(t,n,a,u,w)}function am(t,n,a,u){var w=u.children,k=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((n.flags&128)!==0){if(k=k!==null?k.baseLanes|a:a,t!==null){for(u=n.child=t.child,w=0;u!==null;)w=w|u.lanes|u.childLanes,u=u.sibling;u=w&~k}else u=0,n.child=null;return om(t,n,k,a,u)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&mo(n,k!==null?k.cachePool:null),k!==null?cp(n,k):Bc(),up(n);else return u=n.lanes=536870912,om(t,n,k!==null?k.baseLanes|a:a,a,u)}else k!==null?(mo(n,k.cachePool),cp(n,k),zr(),n.memoizedState=null):(t!==null&&mo(n,null),Bc(),zr());return Qt(t,n,w,a),n.child}function ia(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function om(t,n,a,u,w){var k=Dc();return k=k===null?null:{parent:Lt._currentValue,pool:k},n.memoizedState={baseLanes:a,cachePool:k},t!==null&&mo(n,null),Bc(),up(n),t!==null&&Xi(t,n,u,!0),n.childLanes=w,null}function Do(t,n){return n=Lo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function lm(t,n,a){return gi(n,t.child,null,a),t=Do(n,n.pendingProps),t.flags|=2,wn(n),n.memoizedState=null,t}function Gy(t,n,a){var u=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(nt){if(u.mode==="hidden")return t=Do(n,u),n.lanes=536870912,ia(null,t);if(Hc(n),(t=St)?(t=yg(t,Hn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ar!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Wf(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Rr(n);return n.lanes=536870912,null}return Do(n,u)}var k=t.memoizedState;if(k!==null){var M=k.dehydrated;if(Hc(n),w)if(n.flags&256)n.flags&=-257,n=lm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(Ot||Xi(t,n,a,!1),w=(a&t.childLanes)!==0,Ot||w){if(u=bt,u!==null&&(M=Zh(u,a),M!==0&&M!==k.retryLane))throw k.retryLane=M,li(t,M),xn(u,t,M),au;Uo(),n=lm(t,n,a)}else t=k.treeContext,St=Fn(M.nextSibling),Xt=n,nt=!0,Dr=null,Hn=!1,t!==null&&Yf(n,t),n=Do(n,u),n.flags|=4096;return n}return t=cr(t.child,{mode:u.mode,children:u.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Ro(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 ou(t,n,a,u,w){return hi(n),a=Fc(t,n,a,u,void 0,w),u=Uc(),t!==null&&!Ot?($c(t,n,w),mr(t,n,w)):(nt&&u&&Sc(n),n.flags|=1,Qt(t,n,a,w),n.child)}function cm(t,n,a,u,w,k){return hi(n),n.updateQueue=null,a=hp(n,u,a,w),dp(t),u=Uc(),t!==null&&!Ot?($c(t,n,k),mr(t,n,k)):(nt&&u&&Sc(n),n.flags|=1,Qt(t,n,a,k),n.child)}function um(t,n,a,u,w){if(hi(n),n.stateNode===null){var k=Gi,M=a.contextType;typeof M=="object"&&M!==null&&(k=Zt(M)),k=new a(u,k),n.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=iu,n.stateNode=k,k._reactInternals=n,k=n.stateNode,k.props=u,k.state=n.memoizedState,k.refs={},Lc(n),M=a.contextType,k.context=typeof M=="object"&&M!==null?Zt(M):Gi,k.state=n.memoizedState,M=a.getDerivedStateFromProps,typeof M=="function"&&(ru(n,a,M,u),k.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(M=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),M!==k.state&&iu.enqueueReplaceState(k,k.state,null),Js(n,u,k,w),Qs(),k.state=n.memoizedState),typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!0}else if(t===null){k=n.stateNode;var $=n.memoizedProps,J=vi(a,$);k.props=J;var le=k.context,he=a.contextType;M=Gi,typeof he=="object"&&he!==null&&(M=Zt(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof k.getSnapshotBeforeUpdate=="function",$=n.pendingProps!==$,he||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||($||le!==M)&&Xp(n,k,u,M),Mr=!1;var ce=n.memoizedState;k.state=ce,Js(n,u,k,w),Qs(),le=n.memoizedState,$||ce!==le||Mr?(typeof xe=="function"&&(ru(n,a,xe,u),le=n.memoizedState),(J=Mr||Kp(n,a,J,u,ce,le,M))?(he||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(n.flags|=4194308)):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=u,n.memoizedState=le),k.props=u,k.state=le,k.context=M,u=J):(typeof k.componentDidMount=="function"&&(n.flags|=4194308),u=!1)}else{k=n.stateNode,Mc(t,n),M=n.memoizedProps,he=vi(a,M),k.props=he,xe=n.pendingProps,ce=k.context,le=a.contextType,J=Gi,typeof le=="object"&&le!==null&&(J=Zt(le)),$=a.getDerivedStateFromProps,(le=typeof $=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(M!==xe||ce!==J)&&Xp(n,k,u,J),Mr=!1,ce=n.memoizedState,k.state=ce,Js(n,u,k,w),Qs();var ue=n.memoizedState;M!==xe||ce!==ue||Mr||t!==null&&t.dependencies!==null&&fo(t.dependencies)?(typeof $=="function"&&(ru(n,a,$,u),ue=n.memoizedState),(he=Mr||Kp(n,a,he,u,ce,ue,J)||t!==null&&t.dependencies!==null&&fo(t.dependencies))?(le||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(u,ue,J),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(u,ue,J)),typeof k.componentDidUpdate=="function"&&(n.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=u,n.memoizedState=ue),k.props=u,k.state=ue,k.context=J,u=he):(typeof k.componentDidUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),u=!1)}return k=u,Ro(t,n),u=(n.flags&128)!==0,k||u?(k=n.stateNode,a=u&&typeof a.getDerivedStateFromError!="function"?null:k.render(),n.flags|=1,t!==null&&u?(n.child=gi(n,t.child,null,w),n.child=gi(n,null,a,w)):Qt(t,n,a,w),n.memoizedState=k.state,t=n.child):t=mr(t,n,w),t}function dm(t,n,a,u){return ui(),n.flags|=256,Qt(t,n,a,u),n.child}var lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cu(t){return{baseLanes:t,cachePool:ep()}}function uu(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=kn),t}function hm(t,n,a){var u=n.pendingProps,w=!1,k=(n.flags&128)!==0,M;if((M=k)||(M=t!==null&&t.memoizedState===null?!1:(Tt.current&2)!==0),M&&(w=!0,n.flags&=-129),M=(n.flags&32)!==0,n.flags&=-33,t===null){if(nt){if(w?Br(n):zr(),(t=St)?(t=yg(t,Hn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Ar!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=Wf(t),a.return=n,n.child=a,Xt=n,St=null)):t=null,t===null)throw Rr(n);return Gu(t)?n.lanes=32:n.lanes=536870912,null}var $=u.children;return u=u.fallback,w?(zr(),w=n.mode,$=Lo({mode:"hidden",children:$},w),u=ci(u,w,a,null),$.return=n,u.return=n,$.sibling=u,n.child=$,u=n.child,u.memoizedState=cu(a),u.childLanes=uu(t,M,a),n.memoizedState=lu,ia(null,u)):(Br(n),du(n,$))}var J=t.memoizedState;if(J!==null&&($=J.dehydrated,$!==null)){if(k)n.flags&256?(Br(n),n.flags&=-257,n=hu(t,n,a)):n.memoizedState!==null?(zr(),n.child=t.child,n.flags|=128,n=null):(zr(),$=u.fallback,w=n.mode,u=Lo({mode:"visible",children:u.children},w),$=ci($,w,a,null),$.flags|=2,u.return=n,$.return=n,u.sibling=$,n.child=u,gi(n,t.child,null,a),u=n.child,u.memoizedState=cu(a),u.childLanes=uu(t,M,a),n.memoizedState=lu,n=ia(null,u));else if(Br(n),Gu($)){if(M=$.nextSibling&&$.nextSibling.dataset,M)var le=M.dgst;M=le,u=Error(s(419)),u.stack="",u.digest=M,Gs({value:u,source:null,stack:null}),n=hu(t,n,a)}else if(Ot||Xi(t,n,a,!1),M=(a&t.childLanes)!==0,Ot||M){if(M=bt,M!==null&&(u=Zh(M,a),u!==0&&u!==J.retryLane))throw J.retryLane=u,li(t,u),xn(M,t,u),au;Wu($)||Uo(),n=hu(t,n,a)}else Wu($)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,St=Fn($.nextSibling),Xt=n,nt=!0,Dr=null,Hn=!1,t!==null&&Yf(n,t),n=du(n,u.children),n.flags|=4096);return n}return w?(zr(),$=u.fallback,w=n.mode,J=t.child,le=J.sibling,u=cr(J,{mode:"hidden",children:u.children}),u.subtreeFlags=J.subtreeFlags&65011712,le!==null?$=cr(le,$):($=ci($,w,a,null),$.flags|=2),$.return=n,u.return=n,u.sibling=$,n.child=u,ia(null,u),u=n.child,$=t.child.memoizedState,$===null?$=cu(a):(w=$.cachePool,w!==null?(J=Lt._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=ep(),$={baseLanes:$.baseLanes|a,cachePool:w}),u.memoizedState=$,u.childLanes=uu(t,M,a),n.memoizedState=lu,ia(t.child,u)):(Br(n),a=t.child,t=a.sibling,a=cr(a,{mode:"visible",children:u.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 du(t,n){return n=Lo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Lo(t,n){return t=_n(22,t,null,n),t.lanes=0,t}function hu(t,n,a){return gi(n,t.child,null,a),t=du(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function fm(t,n,a){t.lanes|=n;var u=t.alternate;u!==null&&(u.lanes|=n),jc(t.return,n,a)}function fu(t,n,a,u,w,k){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:u,tail:a,tailMode:w,treeForkCount:k}:(M.isBackwards=n,M.rendering=null,M.renderingStartTime=0,M.last=u,M.tail=a,M.tailMode=w,M.treeForkCount=k)}function pm(t,n,a){var u=n.pendingProps,w=u.revealOrder,k=u.tail;u=u.children;var M=Tt.current,$=(M&2)!==0;if($?(M=M&1|2,n.flags|=128):M&=1,P(Tt,M),Qt(t,n,u,a),u=nt?Ws:0,!$&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&fm(t,a,n);else if(t.tag===19)fm(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&&_o(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),fu(n,!1,w,a,k,u);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&_o(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}fu(n,!0,a,null,k,u);break;case"together":fu(n,!1,null,null,void 0,u);break;default:n.memoizedState=null}return n.child}function mr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),Fr|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(Xi(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=cr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=cr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function pu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&fo(t)))}function Vy(t,n,a){switch(n.tag){case 3:z(n,n.stateNode.containerInfo),Lr(n,Lt,t.memoizedState.cache),ui();break;case 27:case 5:se(n);break;case 4:z(n,n.stateNode.containerInfo);break;case 10:Lr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Hc(n),null;break;case 13:var u=n.memoizedState;if(u!==null)return u.dehydrated!==null?(Br(n),n.flags|=128,null):(a&n.child.childLanes)!==0?hm(t,n,a):(Br(n),t=mr(t,n,a),t!==null?t.sibling:null);Br(n);break;case 19:var w=(t.flags&128)!==0;if(u=(a&n.childLanes)!==0,u||(Xi(t,n,a,!1),u=(a&n.childLanes)!==0),w){if(u)return pm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),P(Tt,Tt.current),u)break;return null;case 22:return n.lanes=0,am(t,n,a,n.pendingProps);case 24:Lr(n,Lt,t.memoizedState.cache)}return mr(t,n,a)}function mm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)Ot=!0;else{if(!pu(t,a)&&(n.flags&128)===0)return Ot=!1,Vy(t,n,a);Ot=(t.flags&131072)!==0}else Ot=!1,nt&&(n.flags&1048576)!==0&&Vf(n,Ws,n.index);switch(n.lanes=0,n.tag){case 16:e:{var u=n.pendingProps;if(t=pi(n.elementType),n.type=t,typeof t=="function")bc(t)?(u=vi(t,u),n.tag=1,n=um(null,n,t,u,a)):(n.tag=0,n=ou(null,n,t,u,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=rm(null,n,t,u,a);break e}else if(w===R){n.tag=14,n=im(null,n,t,u,a);break e}}throw n=O(t)||t,Error(s(306,n,""))}}return n;case 0:return ou(t,n,n.type,n.pendingProps,a);case 1:return u=n.type,w=vi(u,n.pendingProps),um(t,n,u,w,a);case 3:e:{if(z(n,n.stateNode.containerInfo),t===null)throw Error(s(387));u=n.pendingProps;var k=n.memoizedState;w=k.element,Mc(t,n),Js(n,u,null,a);var M=n.memoizedState;if(u=M.cache,Lr(n,Lt,u),u!==k.cache&&Nc(n,[Lt],a,!0),Qs(),u=M.element,k.isDehydrated)if(k={element:u,isDehydrated:!1,cache:M.cache},n.updateQueue.baseState=k,n.memoizedState=k,n.flags&256){n=dm(t,n,u,a);break e}else if(u!==w){w=In(Error(s(424)),n),Gs(w),n=dm(t,n,u,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=Fn(t.firstChild),Xt=n,nt=!0,Dr=null,Hn=!0,a=ap(n,null,u,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ui(),u===w){n=mr(t,n,a);break e}Qt(t,n,u,a)}n=n.child}return n;case 26:return Ro(t,n),t===null?(a=Eg(n.type,null,n.pendingProps,null))?n.memoizedState=a:nt||(a=n.type,t=n.pendingProps,u=Ko(Z.current).createElement(a),u[Kt]=n,u[dn]=t,Jt(u,a,t),$t(u),n.stateNode=u):n.memoizedState=Eg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return se(n),t===null&&nt&&(u=n.stateNode=wg(n.type,n.pendingProps,Z.current),Xt=n,Hn=!0,w=St,Gr(n.type)?(Vu=w,St=Fn(u.firstChild)):St=w),Qt(t,n,n.pendingProps.children,a),Ro(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&nt&&((w=u=St)&&(u=w_(u,n.type,n.pendingProps,Hn),u!==null?(n.stateNode=u,Xt=n,St=Fn(u.firstChild),Hn=!1,w=!0):w=!1),w||Rr(n)),se(n),w=n.type,k=n.pendingProps,M=t!==null?t.memoizedProps:null,u=k.children,Uu(w,k)?u=null:M!==null&&Uu(w,M)&&(n.flags|=32),n.memoizedState!==null&&(w=Fc(t,n,zy,null,null,a),ba._currentValue=w),Ro(t,n),Qt(t,n,u,a),n.child;case 6:return t===null&&nt&&((t=a=St)&&(a=C_(a,n.pendingProps,Hn),a!==null?(n.stateNode=a,Xt=n,St=null,t=!0):t=!1),t||Rr(n)),null;case 13:return hm(t,n,a);case 4:return z(n,n.stateNode.containerInfo),u=n.pendingProps,t===null?n.child=gi(n,null,u,a):Qt(t,n,u,a),n.child;case 11:return rm(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 u=n.pendingProps,Lr(n,n.type,u.value),Qt(t,n,u.children,a),n.child;case 9:return w=n.type._context,u=n.pendingProps.children,hi(n),w=Zt(w),u=u(w),n.flags|=1,Qt(t,n,u,a),n.child;case 14:return im(t,n,n.type,n.pendingProps,a);case 15:return sm(t,n,n.type,n.pendingProps,a);case 19:return pm(t,n,a);case 31:return Gy(t,n,a);case 22:return am(t,n,a,n.pendingProps);case 24:return hi(n),u=Zt(Lt),t===null?(w=Dc(),w===null&&(w=bt,k=Tc(),w.pooledCache=k,k.refCount++,k!==null&&(w.pooledCacheLanes|=a),w=k),n.memoizedState={parent:u,cache:w},Lc(n),Lr(n,Lt,w)):((t.lanes&a)!==0&&(Mc(t,n),Js(n,null,null,a),Qs()),w=t.memoizedState,k=n.memoizedState,w.parent!==u?(w={parent:u,cache:u},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Lr(n,Lt,u)):(u=k.cache,Lr(n,Lt,u),u!==w.cache&&Nc(n,[Lt],a,!0))),Qt(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function gr(t){t.flags|=4}function mu(t,n,a,u,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(Um())t.flags|=8192;else throw mi=xo,Rc}else t.flags&=-16777217}function gm(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Dg(n))if(Um())t.flags|=8192;else throw mi=xo,Rc}function Mo(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Wl():536870912,t.lanes|=n,ls|=n)}function sa(t,n){if(!nt)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 u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function wt(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,u=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags&65011712,u|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,u|=w.subtreeFlags,u|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=u,t.childLanes=a,n}function Yy(t,n,a){var u=n.pendingProps;switch(wc(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,u=null,t!==null&&(u=t.memoizedState.cache),n.memoizedState.cache!==u&&(n.flags|=2048),hr(Lt),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Ki(n)?gr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,kc())),wt(n),null;case 26:var w=n.type,k=n.memoizedState;return t===null?(gr(n),k!==null?(wt(n),gm(n,k)):(wt(n),mu(n,w,null,u,a))):k?k!==t.memoizedState?(gr(n),wt(n),gm(n,k)):(wt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==u&&gr(n),wt(n),mu(n,w,t,u,a)),null;case 27:if(ge(n),a=Z.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&gr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}t=K.current,Ki(n)?Kf(n):(t=wg(w,u,a),n.stateNode=t,gr(n))}return wt(n),null;case 5:if(ge(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==u&&gr(n);else{if(!u){if(n.stateNode===null)throw Error(s(166));return wt(n),null}if(k=K.current,Ki(n))Kf(n);else{var M=Ko(Z.current);switch(k){case 1:k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":k=M.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":k=M.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":k=M.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof u.is=="string"?M.createElement("select",{is:u.is}):M.createElement("select"),u.multiple?k.multiple=!0:u.size&&(k.size=u.size);break;default:k=typeof u.is=="string"?M.createElement(w,{is:u.is}):M.createElement(w)}}k[Kt]=n,k[dn]=u;e:for(M=n.child;M!==null;){if(M.tag===5||M.tag===6)k.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=k;e:switch(Jt(k,w,u),w){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&gr(n)}}return wt(n),mu(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==u&&gr(n);else{if(typeof u!="string"&&n.stateNode===null)throw Error(s(166));if(t=Z.current,Ki(n)){if(t=n.stateNode,a=n.memoizedProps,u=null,w=Xt,w!==null)switch(w.tag){case 27:case 5:u=w.memoizedProps}t[Kt]=n,t=!!(t.nodeValue===a||u!==null&&u.suppressHydrationWarning===!0||hg(t.nodeValue,a)),t||Rr(n,!0)}else t=Ko(t).createTextNode(u),t[Kt]=n,n.stateNode=t}return wt(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(u=Ki(n),a!==null){if(t===null){if(!u)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Kt]=n}else ui(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),t=!1}else a=kc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(wn(n),n):(wn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return wt(n),null;case 13:if(u=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=Ki(n),u!==null&&u.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 ui(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wt(n),w=!1}else w=kc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(wn(n),n):(wn(n),null)}return wn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=u!==null,t=t!==null&&t.memoizedState!==null,a&&(u=n.child,w=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(w=u.alternate.memoizedState.cachePool.pool),k=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(k=u.memoizedState.cachePool.pool),k!==w&&(u.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),Mo(n,n.updateQueue),wt(n),null);case 4:return ae(),t===null&&Bu(n.stateNode.containerInfo),wt(n),null;case 10:return hr(n.type),wt(n),null;case 19:if(U(Tt),u=n.memoizedState,u===null)return wt(n),null;if(w=(n.flags&128)!==0,k=u.rendering,k===null)if(w)sa(u,!1);else{if(Nt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(k=_o(t),k!==null){for(n.flags|=128,sa(u,!1),t=k.updateQueue,n.updateQueue=t,Mo(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)qf(a,t),a=a.sibling;return P(Tt,Tt.current&1|2),nt&&ur(n,u.treeForkCount),n.child}t=t.sibling}u.tail!==null&&Ge()>Ho&&(n.flags|=128,w=!0,sa(u,!1),n.lanes=4194304)}else{if(!w)if(t=_o(k),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,Mo(n,t),sa(u,!0),u.tail===null&&u.tailMode==="hidden"&&!k.alternate&&!nt)return wt(n),null}else 2*Ge()-u.renderingStartTime>Ho&&a!==536870912&&(n.flags|=128,w=!0,sa(u,!1),n.lanes=4194304);u.isBackwards?(k.sibling=n.child,n.child=k):(t=u.last,t!==null?t.sibling=k:n.child=k,u.last=k)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Ge(),t.sibling=null,a=Tt.current,P(Tt,w?a&1|2:a&1),nt&&ur(n,u.treeForkCount),t):(wt(n),null);case 22:case 23:return wn(n),zc(),u=n.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(n.flags|=8192):u&&(n.flags|=8192),u?(a&536870912)!==0&&(n.flags&128)===0&&(wt(n),n.subtreeFlags&6&&(n.flags|=8192)):wt(n),a=n.updateQueue,a!==null&&Mo(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048),t!==null&&U(fi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),hr(Lt),wt(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function Ky(t,n){switch(wc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return hr(Lt),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ge(n),null;case 31:if(n.memoizedState!==null){if(wn(n),n.alternate===null)throw Error(s(340));ui()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(wn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));ui()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return U(Tt),null;case 4:return ae(),null;case 10:return hr(n.type),null;case 22:case 23:return wn(n),zc(),t!==null&&U(fi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return hr(Lt),null;case 25:return null;default:return null}}function xm(t,n){switch(wc(n),n.tag){case 3:hr(Lt),ae();break;case 26:case 27:case 5:ge(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&wn(n);break;case 13:wn(n);break;case 19:U(Tt);break;case 10:hr(n.type);break;case 22:case 23:wn(n),zc(),t!==null&&U(fi);break;case 24:hr(Lt)}}function aa(t,n){try{var a=n.updateQueue,u=a!==null?a.lastEffect:null;if(u!==null){var w=u.next;a=w;do{if((a.tag&t)===t){u=void 0;var k=a.create,M=a.inst;u=k(),M.destroy=u}a=a.next}while(a!==w)}}catch($){pt(n,n.return,$)}}function Hr(t,n,a){try{var u=n.updateQueue,w=u!==null?u.lastEffect:null;if(w!==null){var k=w.next;u=k;do{if((u.tag&t)===t){var M=u.inst,$=M.destroy;if($!==void 0){M.destroy=void 0,w=n;var J=a,le=$;try{le()}catch(he){pt(w,J,he)}}}u=u.next}while(u!==k)}}catch(he){pt(n,n.return,he)}}function vm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{lp(n,a)}catch(u){pt(t,t.return,u)}}}function bm(t,n,a){a.props=vi(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(u){pt(t,n,u)}}function oa(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof a=="function"?t.refCleanup=a(u):a.current=u}}catch(w){pt(t,n,w)}}function Jn(t,n){var a=t.ref,u=t.refCleanup;if(a!==null)if(typeof u=="function")try{u()}catch(w){pt(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){pt(t,n,w)}else a.current=null}function ym(t){var n=t.type,a=t.memoizedProps,u=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&u.focus();break e;case"img":a.src?u.src=a.src:a.srcSet&&(u.srcset=a.srcSet)}}catch(w){pt(t,t.return,w)}}function gu(t,n,a){try{var u=t.stateNode;x_(u,t.type,a,n),u[dn]=n}catch(w){pt(t,t.return,w)}}function _m(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Gr(t.type)||t.tag===4}function xu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||_m(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&&Gr(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 vu(t,n,a){var u=t.tag;if(u===5||u===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=or));else if(u!==4&&(u===27&&Gr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(vu(t,n,a),t=t.sibling;t!==null;)vu(t,n,a),t=t.sibling}function Oo(t,n,a){var u=t.tag;if(u===5||u===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(u!==4&&(u===27&&Gr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Oo(t,n,a),t=t.sibling;t!==null;)Oo(t,n,a),t=t.sibling}function Sm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var u=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);Jt(n,u,a),n[Kt]=t,n[dn]=a}catch(k){pt(t,t.return,k)}}var xr=!1,It=!1,bu=!1,wm=typeof WeakSet=="function"?WeakSet:Set,qt=null;function Xy(t,n){if(t=t.containerInfo,Pu=nl,t=Of(t),hc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var u=a.getSelection&&a.getSelection();if(u&&u.rangeCount!==0){a=u.anchorNode;var w=u.anchorOffset,k=u.focusNode;u=u.focusOffset;try{a.nodeType,k.nodeType}catch{a=null;break e}var M=0,$=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var ue;xe!==a||w!==0&&xe.nodeType!==3||($=M+w),xe!==k||u!==0&&xe.nodeType!==3||(J=M+u),xe.nodeType===3&&(M+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)ce=xe,xe=ue;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&($=M),ce===k&&++he===u&&(J=M),(ue=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=ue}a=$===-1||J===-1?null:{start:$,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(Fu={focusedElem:t,selectionRange:a},nl=!1,qt=n;qt!==null;)if(n=qt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,qt=t;else for(;qt!==null;){switch(n=qt,k=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&&k!==null){t=void 0,a=n,w=k.memoizedProps,k=k.memoizedState,u=a.stateNode;try{var je=vi(a.type,w);t=u.getSnapshotBeforeUpdate(je,k),u.__reactInternalSnapshotBeforeUpdate=t}catch(Be){pt(a,a.return,Be)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)qu(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":qu(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,qt=t;break}qt=n.return}}function Cm(t,n,a){var u=a.flags;switch(a.tag){case 0:case 11:case 15:br(t,a),u&4&&aa(5,a);break;case 1:if(br(t,a),u&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(M){pt(a,a.return,M)}else{var w=vi(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(M){pt(a,a.return,M)}}u&64&&vm(a),u&512&&oa(a,a.return);break;case 3:if(br(t,a),u&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{lp(t,n)}catch(M){pt(a,a.return,M)}}break;case 27:n===null&&u&4&&Sm(a);case 26:case 5:br(t,a),n===null&&u&4&&ym(a),u&512&&oa(a,a.return);break;case 12:br(t,a);break;case 31:br(t,a),u&4&&jm(t,a);break;case 13:br(t,a),u&4&&Nm(t,a),u&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=s_.bind(null,a),k_(t,a))));break;case 22:if(u=a.memoizedState!==null||xr,!u){n=n!==null&&n.memoizedState!==null||It,w=xr;var k=It;xr=u,(It=n)&&!k?yr(t,a,(a.subtreeFlags&8772)!==0):br(t,a),xr=w,It=k}break;case 30:break;default:br(t,a)}}function km(t){var n=t.alternate;n!==null&&(t.alternate=null,km(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Kl(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 kt=null,fn=!1;function vr(t,n,a){for(a=a.child;a!==null;)Em(t,n,a),a=a.sibling}function Em(t,n,a){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(st,a)}catch{}switch(a.tag){case 26:It||Jn(a,n),vr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:It||Jn(a,n);var u=kt,w=fn;Gr(a.type)&&(kt=a.stateNode,fn=!1),vr(t,n,a),ga(a.stateNode),kt=u,fn=w;break;case 5:It||Jn(a,n);case 6:if(u=kt,w=fn,kt=null,vr(t,n,a),kt=u,fn=w,kt!==null)if(fn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(a.stateNode)}catch(k){pt(a,n,k)}else try{kt.removeChild(a.stateNode)}catch(k){pt(a,n,k)}break;case 18:kt!==null&&(fn?(t=kt,vg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),gs(t)):vg(kt,a.stateNode));break;case 4:u=kt,w=fn,kt=a.stateNode.containerInfo,fn=!0,vr(t,n,a),kt=u,fn=w;break;case 0:case 11:case 14:case 15:Hr(2,a,n),It||Hr(4,a,n),vr(t,n,a);break;case 1:It||(Jn(a,n),u=a.stateNode,typeof u.componentWillUnmount=="function"&&bm(a,n,u)),vr(t,n,a);break;case 21:vr(t,n,a);break;case 22:It=(u=It)||a.memoizedState!==null,vr(t,n,a),It=u;break;default:vr(t,n,a)}}function jm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{gs(t)}catch(a){pt(n,n.return,a)}}}function Nm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{gs(t)}catch(a){pt(n,n.return,a)}}function Zy(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new wm),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new wm),n;default:throw Error(s(435,t.tag))}}function Io(t,n){var a=Zy(t);n.forEach(function(u){if(!a.has(u)){a.add(u);var w=a_.bind(null,t,u);u.then(w,w)}})}function pn(t,n){var a=n.deletions;if(a!==null)for(var u=0;u<a.length;u++){var w=a[u],k=t,M=n,$=M;e:for(;$!==null;){switch($.tag){case 27:if(Gr($.type)){kt=$.stateNode,fn=!1;break e}break;case 5:kt=$.stateNode,fn=!1;break e;case 3:case 4:kt=$.stateNode.containerInfo,fn=!0;break e}$=$.return}if(kt===null)throw Error(s(160));Em(k,M,w),kt=null,fn=!1,k=w.alternate,k!==null&&(k.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Tm(n,t),n=n.sibling}var Wn=null;function Tm(t,n){var a=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:pn(n,t),mn(t),u&4&&(Hr(3,t,t.return),aa(3,t),Hr(5,t,t.return));break;case 1:pn(n,t),mn(t),u&512&&(It||a===null||Jn(a,a.return)),u&64&&xr&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?u:a.concat(u))));break;case 26:var w=Wn;if(pn(n,t),mn(t),u&512&&(It||a===null||Jn(a,a.return)),u&4){var k=a!==null?a.memoizedState:null;if(u=t.memoizedState,a===null)if(u===null)if(t.stateNode===null){e:{u=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(u){case"title":k=w.getElementsByTagName("title")[0],(!k||k[Ms]||k[Kt]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=w.createElement(u),w.head.insertBefore(k,w.querySelector("head > title"))),Jt(k,u,a),k[Kt]=t,$t(k),u=k;break e;case"link":var M=Tg("link","href",w).get(u+(a.href||""));if(M){for(var $=0;$<M.length;$++)if(k=M[$],k.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&k.getAttribute("rel")===(a.rel==null?null:a.rel)&&k.getAttribute("title")===(a.title==null?null:a.title)&&k.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){M.splice($,1);break t}}k=w.createElement(u),Jt(k,u,a),w.head.appendChild(k);break;case"meta":if(M=Tg("meta","content",w).get(u+(a.content||""))){for($=0;$<M.length;$++)if(k=M[$],k.getAttribute("content")===(a.content==null?null:""+a.content)&&k.getAttribute("name")===(a.name==null?null:a.name)&&k.getAttribute("property")===(a.property==null?null:a.property)&&k.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&k.getAttribute("charset")===(a.charSet==null?null:a.charSet)){M.splice($,1);break t}}k=w.createElement(u),Jt(k,u,a),w.head.appendChild(k);break;default:throw Error(s(468,u))}k[Kt]=t,$t(k),u=k}t.stateNode=u}else Ag(w,t.type,t.stateNode);else t.stateNode=Ng(w,u,t.memoizedProps);else k!==u?(k===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):k.count--,u===null?Ag(w,t.type,t.stateNode):Ng(w,u,t.memoizedProps)):u===null&&t.stateNode!==null&&gu(t,t.memoizedProps,a.memoizedProps)}break;case 27:pn(n,t),mn(t),u&512&&(It||a===null||Jn(a,a.return)),a!==null&&u&4&&gu(t,t.memoizedProps,a.memoizedProps);break;case 5:if(pn(n,t),mn(t),u&512&&(It||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Hi(w,"")}catch(je){pt(t,t.return,je)}}u&4&&t.stateNode!=null&&(w=t.memoizedProps,gu(t,w,a!==null?a.memoizedProps:w)),u&1024&&(bu=!0);break;case 6:if(pn(n,t),mn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,a=t.stateNode;try{a.nodeValue=u}catch(je){pt(t,t.return,je)}}break;case 3:if(Qo=null,w=Wn,Wn=Xo(n.containerInfo),pn(n,t),Wn=w,mn(t),u&4&&a!==null&&a.memoizedState.isDehydrated)try{gs(n.containerInfo)}catch(je){pt(t,t.return,je)}bu&&(bu=!1,Am(t));break;case 4:u=Wn,Wn=Xo(t.stateNode.containerInfo),pn(n,t),mn(t),Wn=u;break;case 12:pn(n,t),mn(t);break;case 31:pn(n,t),mn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 13:pn(n,t),mn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(zo=Ge()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=xr,he=It;if(xr=le||w,It=he||J,pn(n,t),It=he,xr=le,mn(t),u&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||xr||It||bi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(k=J.stateNode,w)M=k.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{$=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;$.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(je){pt(J,J.return,je)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(je){pt(J,J.return,je)}}}else if(n.tag===18){if(a===null){J=n;try{var ue=J.stateNode;w?bg(ue,!0):bg(J.stateNode,!1)}catch(je){pt(J,J.return,je)}}}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}u&4&&(u=t.updateQueue,u!==null&&(a=u.retryQueue,a!==null&&(u.retryQueue=null,Io(t,a))));break;case 19:pn(n,t),mn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Io(t,u)));break;case 30:break;case 21:break;default:pn(n,t),mn(t)}}function mn(t){var n=t.flags;if(n&2){try{for(var a,u=t.return;u!==null;){if(_m(u)){a=u;break}u=u.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,k=xu(t);Oo(t,k,w);break;case 5:var M=a.stateNode;a.flags&32&&(Hi(M,""),a.flags&=-33);var $=xu(t);Oo(t,$,M);break;case 3:case 4:var J=a.stateNode.containerInfo,le=xu(t);vu(t,le,J);break;default:throw Error(s(161))}}catch(he){pt(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Am(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Am(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function br(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Cm(t,n.alternate,n),n=n.sibling}function bi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Hr(4,n,n.return),bi(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&bm(n,n.return,a),bi(n);break;case 27:ga(n.stateNode);case 26:case 5:Jn(n,n.return),bi(n);break;case 22:n.memoizedState===null&&bi(n);break;case 30:bi(n);break;default:bi(n)}t=t.sibling}}function yr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var u=n.alternate,w=t,k=n,M=k.flags;switch(k.tag){case 0:case 11:case 15:yr(w,k,a),aa(4,k);break;case 1:if(yr(w,k,a),u=k,w=u.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){pt(u,u.return,le)}if(u=k,w=u.updateQueue,w!==null){var $=u.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)op(J[w],$)}catch(le){pt(u,u.return,le)}}a&&M&64&&vm(k),oa(k,k.return);break;case 27:Sm(k);case 26:case 5:yr(w,k,a),a&&u===null&&M&4&&ym(k),oa(k,k.return);break;case 12:yr(w,k,a);break;case 31:yr(w,k,a),a&&M&4&&jm(w,k);break;case 13:yr(w,k,a),a&&M&4&&Nm(w,k);break;case 22:k.memoizedState===null&&yr(w,k,a),oa(k,k.return);break;case 30:break;default:yr(w,k,a)}n=n.sibling}}function yu(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&&Vs(a))}function _u(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vs(t))}function Gn(t,n,a,u){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Dm(t,n,a,u),n=n.sibling}function Dm(t,n,a,u){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Gn(t,n,a,u),w&2048&&aa(9,n);break;case 1:Gn(t,n,a,u);break;case 3:Gn(t,n,a,u),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vs(t)));break;case 12:if(w&2048){Gn(t,n,a,u),t=n.stateNode;try{var k=n.memoizedProps,M=k.id,$=k.onPostCommit;typeof $=="function"&&$(M,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){pt(n,n.return,J)}}else Gn(t,n,a,u);break;case 31:Gn(t,n,a,u);break;case 13:Gn(t,n,a,u);break;case 23:break;case 22:k=n.stateNode,M=n.alternate,n.memoizedState!==null?k._visibility&2?Gn(t,n,a,u):la(t,n):k._visibility&2?Gn(t,n,a,u):(k._visibility|=2,ss(t,n,a,u,(n.subtreeFlags&10256)!==0||!1)),w&2048&&yu(M,n);break;case 24:Gn(t,n,a,u),w&2048&&_u(n.alternate,n);break;default:Gn(t,n,a,u)}}function ss(t,n,a,u,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var k=t,M=n,$=a,J=u,le=M.flags;switch(M.tag){case 0:case 11:case 15:ss(k,M,$,J,w),aa(8,M);break;case 23:break;case 22:var he=M.stateNode;M.memoizedState!==null?he._visibility&2?ss(k,M,$,J,w):la(k,M):(he._visibility|=2,ss(k,M,$,J,w)),w&&le&2048&&yu(M.alternate,M);break;case 24:ss(k,M,$,J,w),w&&le&2048&&_u(M.alternate,M);break;default:ss(k,M,$,J,w)}n=n.sibling}}function la(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,u=n,w=u.flags;switch(u.tag){case 22:la(a,u),w&2048&&yu(u.alternate,u);break;case 24:la(a,u),w&2048&&_u(u.alternate,u);break;default:la(a,u)}n=n.sibling}}var ca=8192;function as(t,n,a){if(t.subtreeFlags&ca)for(t=t.child;t!==null;)Rm(t,n,a),t=t.sibling}function Rm(t,n,a){switch(t.tag){case 26:as(t,n,a),t.flags&ca&&t.memoizedState!==null&&B_(a,Wn,t.memoizedState,t.memoizedProps);break;case 5:as(t,n,a);break;case 3:case 4:var u=Wn;Wn=Xo(t.stateNode.containerInfo),as(t,n,a),Wn=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=ca,ca=16777216,as(t,n,a),ca=u):as(t,n,a));break;default:as(t,n,a)}}function Lm(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 ua(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];qt=u,Om(u,t)}Lm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Mm(t),t=t.sibling}function Mm(t){switch(t.tag){case 0:case 11:case 15:ua(t),t.flags&2048&&Hr(9,t,t.return);break;case 3:ua(t);break;case 12:ua(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Bo(t)):ua(t);break;default:ua(t)}}function Bo(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var u=n[a];qt=u,Om(u,t)}Lm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Hr(8,n,n.return),Bo(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Bo(n));break;default:Bo(n)}t=t.sibling}}function Om(t,n){for(;qt!==null;){var a=qt;switch(a.tag){case 0:case 11:case 15:Hr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var u=a.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Vs(a.memoizedState.cache)}if(u=a.child,u!==null)u.return=a,qt=u;else e:for(a=t;qt!==null;){u=qt;var w=u.sibling,k=u.return;if(km(u),u===a){qt=null;break e}if(w!==null){w.return=k,qt=w;break e}qt=k}}}var Qy={getCacheForType:function(t){var n=Zt(Lt),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return Zt(Lt).controller.signal}},Jy=typeof WeakMap=="function"?WeakMap:Map,ut=0,bt=null,Ye=null,Ze=0,ft=0,Cn=null,Pr=!1,os=!1,Su=!1,_r=0,Nt=0,Fr=0,yi=0,wu=0,kn=0,ls=0,da=null,gn=null,Cu=!1,zo=0,Im=0,Ho=1/0,Po=null,Ur=null,Ht=0,$r=null,cs=null,Sr=0,ku=0,Eu=null,Bm=null,ha=0,ju=null;function En(){return(ut&2)!==0&&Ze!==0?Ze&-Ze:V.T!==null?Lu():Qh()}function zm(){if(kn===0)if((Ze&536870912)===0||nt){var t=Ve;Ve<<=1,(Ve&3932160)===0&&(Ve=262144),kn=t}else kn=536870912;return t=Sn.current,t!==null&&(t.flags|=32),kn}function xn(t,n,a){(t===bt&&(ft===2||ft===9)||t.cancelPendingCommit!==null)&&(us(t,0),qr(t,Ze,kn,!1)),Ls(t,a),((ut&2)===0||t!==bt)&&(t===bt&&((ut&2)===0&&(yi|=a),Nt===4&&qr(t,Ze,kn,!1)),er(t))}function Hm(t,n,a){if((ut&6)!==0)throw Error(s(327));var u=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Et(t,n),w=u?n_(t,n):Tu(t,n,!0),k=u;do{if(w===0){os&&!u&&qr(t,n,0,!1);break}else{if(a=t.current.alternate,k&&!e_(a)){w=Tu(t,n,!1),k=!1;continue}if(w===2){if(k=n,t.errorRecoveryDisabledLanes&k)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){n=M;e:{var $=t;w=da;var J=$.current.memoizedState.isDehydrated;if(J&&(us($,M).flags|=256),M=Tu($,M,!1),M!==2){if(Su&&!J){$.errorRecoveryDisabledLanes|=k,yi|=k,w=4;break e}k=gn,gn=w,k!==null&&(gn===null?gn=k:gn.push.apply(gn,k))}w=M}if(k=!1,w!==2)continue}}if(w===1){us(t,0),qr(t,n,0,!0);break}e:{switch(u=t,k=w,k){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:qr(u,n,kn,!Pr);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=zo+300-Ge(),10<w)){if(qr(u,n,kn,!Pr),Rt(u,0,!0)!==0)break e;Sr=n,u.timeoutHandle=gg(Pm.bind(null,u,a,gn,Po,Cu,n,kn,yi,ls,Pr,k,"Throttled",-0,0),w);break e}Pm(u,a,gn,Po,Cu,n,kn,yi,ls,Pr,k,null,-0,0)}}break}while(!0);er(t)}function Pm(t,n,a,u,w,k,M,$,J,le,he,xe,ce,ue){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:or},Rm(n,k,xe);var je=(k&62914560)===k?zo-Ge():(k&4194048)===k?Im-Ge():0;if(je=z_(xe,je),je!==null){Sr=k,t.cancelPendingCommit=je(Ym.bind(null,t,n,k,a,u,w,M,$,J,he,xe,null,ce,ue)),qr(t,k,M,!le);return}}Ym(t,n,k,a,u,w,M,$,J)}function e_(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 u=0;u<a.length;u++){var w=a[u],k=w.getSnapshot;w=w.value;try{if(!yn(k(),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 qr(t,n,a,u){n&=~wu,n&=~yi,t.suspendedLanes|=n,t.pingedLanes&=~n,u&&(t.warmLanes|=n),u=t.expirationTimes;for(var w=n;0<w;){var k=31-$e(w),M=1<<k;u[k]=-1,w&=~M}a!==0&&Kh(t,a,n)}function Fo(){return(ut&6)===0?(fa(0),!1):!0}function Nu(){if(Ye!==null){if(ft===0)var t=Ye.return;else t=Ye,dr=di=null,qc(t),es=null,Ks=0,t=Ye;for(;t!==null;)xm(t.alternate,t),t=t.return;Ye=null}}function us(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,y_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Sr=0,Nu(),bt=t,Ye=a=cr(t.current,null),Ze=n,ft=0,Cn=null,Pr=!1,os=Et(t,n),Su=!1,ls=kn=wu=yi=Fr=Nt=0,gn=da=null,Cu=!1,(n&8)!==0&&(n|=n&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=n;0<u;){var w=31-$e(u),k=1<<w;n|=t[w],u&=~k}return _r=n,oo(),a}function Fm(t,n){Ue=null,V.H=ra,n===Ji||n===go?(n=rp(),ft=3):n===Rc?(n=rp(),ft=4):ft=n===au?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Cn=n,Ye===null&&(Nt=1,Ao(t,In(n,t.current)))}function Um(){var t=Sn.current;return t===null?!0:(Ze&4194048)===Ze?Pn===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?t===Pn:!1}function $m(){var t=V.H;return V.H=ra,t===null?ra:t}function qm(){var t=V.A;return V.A=Qy,t}function Uo(){Nt=4,Pr||(Ze&4194048)!==Ze&&Sn.current!==null||(os=!0),(Fr&134217727)===0&&(yi&134217727)===0||bt===null||qr(bt,Ze,kn,!1)}function Tu(t,n,a){var u=ut;ut|=2;var w=$m(),k=qm();(bt!==t||Ze!==n)&&(Po=null,us(t,n)),n=!1;var M=Nt;e:do try{if(ft!==0&&Ye!==null){var $=Ye,J=Cn;switch(ft){case 8:Nu(),M=6;break e;case 3:case 2:case 9:case 6:Sn.current===null&&(n=!0);var le=ft;if(ft=0,Cn=null,ds(t,$,J,le),a&&os){M=0;break e}break;default:le=ft,ft=0,Cn=null,ds(t,$,J,le)}}t_(),M=Nt;break}catch(he){Fm(t,he)}while(!0);return n&&t.shellSuspendCounter++,dr=di=null,ut=u,V.H=w,V.A=k,Ye===null&&(bt=null,Ze=0,oo()),M}function t_(){for(;Ye!==null;)Wm(Ye)}function n_(t,n){var a=ut;ut|=2;var u=$m(),w=qm();bt!==t||Ze!==n?(Po=null,Ho=Ge()+500,us(t,n)):os=Et(t,n);e:do try{if(ft!==0&&Ye!==null){n=Ye;var k=Cn;t:switch(ft){case 1:ft=0,Cn=null,ds(t,n,k,1);break;case 2:case 9:if(tp(k)){ft=0,Cn=null,Gm(n);break}n=function(){ft!==2&&ft!==9||bt!==t||(ft=7),er(t)},k.then(n,n);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:tp(k)?(ft=0,Cn=null,Gm(n)):(ft=0,Cn=null,ds(t,n,k,7));break;case 5:var M=null;switch(Ye.tag){case 26:M=Ye.memoizedState;case 5:case 27:var $=Ye;if(M?Dg(M):$.stateNode.complete){ft=0,Cn=null;var J=$.sibling;if(J!==null)Ye=J;else{var le=$.return;le!==null?(Ye=le,$o(le)):Ye=null}break t}}ft=0,Cn=null,ds(t,n,k,5);break;case 6:ft=0,Cn=null,ds(t,n,k,6);break;case 8:Nu(),Nt=6;break e;default:throw Error(s(462))}}r_();break}catch(he){Fm(t,he)}while(!0);return dr=di=null,V.H=u,V.A=w,ut=a,Ye!==null?0:(bt=null,Ze=0,oo(),Nt)}function r_(){for(;Ye!==null&&!Je();)Wm(Ye)}function Wm(t){var n=mm(t.alternate,t,_r);t.memoizedProps=t.pendingProps,n===null?$o(t):Ye=n}function Gm(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=cm(a,n,n.pendingProps,n.type,void 0,Ze);break;case 11:n=cm(a,n,n.pendingProps,n.type.render,n.ref,Ze);break;case 5:qc(n);default:xm(a,n),n=Ye=qf(n,_r),n=mm(a,n,_r)}t.memoizedProps=t.pendingProps,n===null?$o(t):Ye=n}function ds(t,n,a,u){dr=di=null,qc(n),es=null,Ks=0;var w=n.return;try{if(Wy(t,w,n,a,Ze)){Nt=1,Ao(t,In(a,t.current)),Ye=null;return}}catch(k){if(w!==null)throw Ye=w,k;Nt=1,Ao(t,In(a,t.current)),Ye=null;return}n.flags&32768?(nt||u===1?t=!0:os||(Ze&536870912)!==0?t=!1:(Pr=t=!0,(u===2||u===9||u===3||u===6)&&(u=Sn.current,u!==null&&u.tag===13&&(u.flags|=16384))),Vm(n,t)):$o(n)}function $o(t){var n=t;do{if((n.flags&32768)!==0){Vm(n,Pr);return}t=n.return;var a=Yy(n.alternate,n,_r);if(a!==null){Ye=a;return}if(n=n.sibling,n!==null){Ye=n;return}Ye=n=t}while(n!==null);Nt===0&&(Nt=5)}function Vm(t,n){do{var a=Ky(t.alternate,t);if(a!==null){a.flags&=32767,Ye=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Ye=t;return}Ye=t=a}while(t!==null);Nt=6,Ye=null}function Ym(t,n,a,u,w,k,M,$,J){t.cancelPendingCommit=null;do qo();while(Ht!==0);if((ut&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(k=n.lanes|n.childLanes,k|=xc,Ib(t,a,k,M,$,J),t===bt&&(Ye=bt=null,Ze=0),cs=n,$r=t,Sr=a,ku=k,Eu=w,Bm=u,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,o_(re,function(){return Jm(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,w=Q.p,Q.p=2,M=ut,ut|=4;try{Xy(t,n,a)}finally{ut=M,Q.p=w,V.T=u}}Ht=1,Km(),Xm(),Zm()}}function Km(){if(Ht===1){Ht=0;var t=$r,n=cs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var w=ut;ut|=4;try{Tm(n,t);var k=Fu,M=Of(t.containerInfo),$=k.focusedElem,J=k.selectionRange;if(M!==$&&$&&$.ownerDocument&&Mf($.ownerDocument.documentElement,$)){if(J!==null&&hc($)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in $)$.selectionStart=le,$.selectionEnd=Math.min(he,$.value.length);else{var xe=$.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),je=$.textContent.length,Be=Math.min(J.start,je),vt=J.end===void 0?Be:Math.min(J.end,je);!ue.extend&&Be>vt&&(M=vt,vt=Be,Be=M);var ie=Lf($,Be),ne=Lf($,vt);if(ie&&ne&&(ue.rangeCount!==1||ue.anchorNode!==ie.node||ue.anchorOffset!==ie.offset||ue.focusNode!==ne.node||ue.focusOffset!==ne.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),ue.removeAllRanges(),Be>vt?(ue.addRange(oe),ue.extend(ne.node,ne.offset)):(oe.setEnd(ne.node,ne.offset),ue.addRange(oe))}}}}for(xe=[],ue=$;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<xe.length;$++){var me=xe[$];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}nl=!!Pu,Fu=Pu=null}finally{ut=w,Q.p=u,V.T=a}}t.current=n,Ht=2}}function Xm(){if(Ht===2){Ht=0;var t=$r,n=cs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=V.T,V.T=null;var u=Q.p;Q.p=2;var w=ut;ut|=4;try{Cm(t,n.alternate,n)}finally{ut=w,Q.p=u,V.T=a}}Ht=3}}function Zm(){if(Ht===4||Ht===3){Ht=0,et();var t=$r,n=cs,a=Sr,u=Bm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ht=5:(Ht=0,cs=$r=null,Qm(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(Ur=null),Vl(a),n=n.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(st,n,void 0,(n.current.flags&128)===128)}catch{}if(u!==null){n=V.T,w=Q.p,Q.p=2,V.T=null;try{for(var k=t.onRecoverableError,M=0;M<u.length;M++){var $=u[M];k($.value,{componentStack:$.stack})}}finally{V.T=n,Q.p=w}}(Sr&3)!==0&&qo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===ju?ha++:(ha=0,ju=t):ha=0,fa(0)}}function Qm(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Vs(n)))}function qo(){return Km(),Xm(),Zm(),Jm()}function Jm(){if(Ht!==5)return!1;var t=$r,n=ku;ku=0;var a=Vl(Sr),u=V.T,w=Q.p;try{Q.p=32>a?32:a,V.T=null,a=Eu,Eu=null;var k=$r,M=Sr;if(Ht=0,cs=$r=null,Sr=0,(ut&6)!==0)throw Error(s(331));var $=ut;if(ut|=4,Mm(k.current),Dm(k,k.current,M,a),ut=$,fa(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(st,k)}catch{}return!0}finally{Q.p=w,V.T=u,Qm(t,n)}}function eg(t,n,a){n=In(a,n),n=su(t.stateNode,n,2),t=Ir(t,n,2),t!==null&&(Ls(t,2),er(t))}function pt(t,n,a){if(t.tag===3)eg(t,t,a);else for(;n!==null;){if(n.tag===3){eg(n,t,a);break}else if(n.tag===1){var u=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ur===null||!Ur.has(u))){t=In(a,t),a=tm(2),u=Ir(n,a,2),u!==null&&(nm(a,u,n,t),Ls(u,2),er(u));break}}n=n.return}}function Au(t,n,a){var u=t.pingCache;if(u===null){u=t.pingCache=new Jy;var w=new Set;u.set(n,w)}else w=u.get(n),w===void 0&&(w=new Set,u.set(n,w));w.has(a)||(Su=!0,w.add(a),t=i_.bind(null,t,n,a),n.then(t,t))}function i_(t,n,a){var u=t.pingCache;u!==null&&u.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,bt===t&&(Ze&a)===a&&(Nt===4||Nt===3&&(Ze&62914560)===Ze&&300>Ge()-zo?(ut&2)===0&&us(t,0):wu|=a,ls===Ze&&(ls=0)),er(t)}function tg(t,n){n===0&&(n=Wl()),t=li(t,n),t!==null&&(Ls(t,n),er(t))}function s_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),tg(t,a)}function a_(t,n){var a=0;switch(t.tag){case 31:case 13:var u=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(n),tg(t,a)}function o_(t,n){return fe(t,n)}var Wo=null,hs=null,Du=!1,Go=!1,Ru=!1,Wr=0;function er(t){t!==hs&&t.next===null&&(hs===null?Wo=hs=t:hs=hs.next=t),Go=!0,Du||(Du=!0,c_())}function fa(t,n){if(!Ru&&Go){Ru=!0;do for(var a=!1,u=Wo;u!==null;){if(t!==0){var w=u.pendingLanes;if(w===0)var k=0;else{var M=u.suspendedLanes,$=u.pingedLanes;k=(1<<31-$e(42|t)+1)-1,k&=w&~(M&~$),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(a=!0,sg(u,k))}else k=Ze,k=Rt(u,u===bt?k:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(k&3)===0||Et(u,k)||(a=!0,sg(u,k));u=u.next}while(a);Ru=!1}}function l_(){ng()}function ng(){Go=Du=!1;var t=0;Wr!==0&&b_()&&(t=Wr);for(var n=Ge(),a=null,u=Wo;u!==null;){var w=u.next,k=rg(u,n);k===0?(u.next=null,a===null?Wo=w:a.next=w,w===null&&(hs=a)):(a=u,(t!==0||(k&3)!==0)&&(Go=!0)),u=w}Ht!==0&&Ht!==5||fa(t),Wr!==0&&(Wr=0)}function rg(t,n){for(var a=t.suspendedLanes,u=t.pingedLanes,w=t.expirationTimes,k=t.pendingLanes&-62914561;0<k;){var M=31-$e(k),$=1<<M,J=w[M];J===-1?(($&a)===0||($&u)!==0)&&(w[M]=Yt($,n)):J<=n&&(t.expiredLanes|=$),k&=~$}if(n=bt,a=Ze,a=Rt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,a===0||t===n&&(ft===2||ft===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Le(u),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Et(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(u!==null&&Le(u),Vl(a)){case 2:case 8:a=be;break;case 32:a=re;break;case 268435456:a=Ce;break;default:a=re}return u=ig.bind(null,t),a=fe(a,u),t.callbackPriority=n,t.callbackNode=a,n}return u!==null&&u!==null&&Le(u),t.callbackPriority=2,t.callbackNode=null,2}function ig(t,n){if(Ht!==0&&Ht!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(qo()&&t.callbackNode!==a)return null;var u=Ze;return u=Rt(t,t===bt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Hm(t,u,n),rg(t,Ge()),t.callbackNode!=null&&t.callbackNode===a?ig.bind(null,t):null)}function sg(t,n){if(qo())return null;Hm(t,n,!0)}function c_(){__(function(){(ut&6)!==0?fe(de,l_):ng()})}function Lu(){if(Wr===0){var t=Zi;t===0&&(t=ze,ze<<=1,(ze&261888)===0&&(ze=256)),Wr=t}return Wr}function ag(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Ja(""+t)}function og(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,u,w){if(n==="submit"&&a&&a.stateNode===w){var k=ag((w[dn]||null).action),M=u.submitter;M&&(n=(n=M[dn]||null)?ag(n.formAction):M.getAttribute("formAction"),n!==null&&(k=n,M=null));var $=new ro("action","action",null,u,w);t.push({event:$,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Wr!==0){var J=M?og(w,M):new FormData(w);Jc(a,{pending:!0,data:J,method:w.method,action:k},null,J)}}else typeof k=="function"&&($.preventDefault(),J=M?og(w,M):new FormData(w),Jc(a,{pending:!0,data:J,method:w.method,action:k},k,J))},currentTarget:w}]})}}for(var Mu=0;Mu<gc.length;Mu++){var Ou=gc[Mu],d_=Ou.toLowerCase(),h_=Ou[0].toUpperCase()+Ou.slice(1);qn(d_,"on"+h_)}qn(zf,"onAnimationEnd"),qn(Hf,"onAnimationIteration"),qn(Pf,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(Ny,"onTransitionRun"),qn(Ty,"onTransitionStart"),qn(Ay,"onTransitionCancel"),qn(Ff,"onTransitionEnd"),Bi("onMouseEnter",["mouseout","mouseover"]),Bi("onMouseLeave",["mouseout","mouseover"]),Bi("onPointerEnter",["pointerout","pointerover"]),Bi("onPointerLeave",["pointerout","pointerover"]),ii("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ii("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ii("onBeforeInput",["compositionend","keypress","textInput","paste"]),ii("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ii("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ii("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var pa="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(" "),f_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(pa));function lg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var u=t[a],w=u.event;u=u.listeners;e:{var k=void 0;if(n)for(var M=u.length-1;0<=M;M--){var $=u[M],J=$.instance,le=$.currentTarget;if($=$.listener,J!==k&&w.isPropagationStopped())break e;k=$,w.currentTarget=le;try{k(w)}catch(he){ao(he)}w.currentTarget=null,k=J}else for(M=0;M<u.length;M++){if($=u[M],J=$.instance,le=$.currentTarget,$=$.listener,J!==k&&w.isPropagationStopped())break e;k=$,w.currentTarget=le;try{k(w)}catch(he){ao(he)}w.currentTarget=null,k=J}}}}function Ke(t,n){var a=n[Yl];a===void 0&&(a=n[Yl]=new Set);var u=t+"__bubble";a.has(u)||(cg(n,t,2,!1),a.add(u))}function Iu(t,n,a){var u=0;n&&(u|=4),cg(a,t,u,n)}var Vo="_reactListening"+Math.random().toString(36).slice(2);function Bu(t){if(!t[Vo]){t[Vo]=!0,tf.forEach(function(a){a!=="selectionchange"&&(f_.has(a)||Iu(a,!1,t),Iu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Vo]||(n[Vo]=!0,Iu("selectionchange",!1,n))}}function cg(t,n,a,u){switch(zg(n)){case 2:var w=F_;break;case 8:w=U_;break;default:w=Qu}a=w.bind(null,n,a,t),w=void 0,!rc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),u?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 zu(t,n,a,u,w){var k=u;if((n&1)===0&&(n&2)===0&&u!==null)e:for(;;){if(u===null)return;var M=u.tag;if(M===3||M===4){var $=u.stateNode.containerInfo;if($===w)break;if(M===4)for(M=u.return;M!==null;){var J=M.tag;if((J===3||J===4)&&M.stateNode.containerInfo===w)return;M=M.return}for(;$!==null;){if(M=Mi($),M===null)return;if(J=M.tag,J===5||J===6||J===26||J===27){u=k=M;continue e}$=$.parentNode}}u=u.return}pf(function(){var le=k,he=tc(a),xe=[];e:{var ce=Uf.get(t);if(ce!==void 0){var ue=ro,je=t;switch(t){case"keypress":if(to(a)===0)break e;case"keydown":case"keyup":ue=ay;break;case"focusin":je="focus",ue=oc;break;case"focusout":je="blur",ue=oc;break;case"beforeblur":case"afterblur":ue=oc;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":ue=xf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Yb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=cy;break;case zf:case Hf:case Pf:ue=Zb;break;case Ff:ue=dy;break;case"scroll":case"scrollend":ue=Gb;break;case"wheel":ue=fy;break;case"copy":case"cut":case"paste":ue=Jb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=bf;break;case"toggle":case"beforetoggle":ue=my}var Be=(n&4)!==0,vt=!Be&&(t==="scroll"||t==="scrollend"),ie=Be?ce!==null?ce+"Capture":null:ce;Be=[];for(var ne=le,oe;ne!==null;){var me=ne;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Is(ne,ie),me!=null&&Be.push(ma(ne,me,oe))),vt)break;ne=ne.return}0<Be.length&&(ce=new ue(ce,je,null,a,he),xe.push({event:ce,listeners:Be}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",ce&&a!==ec&&(je=a.relatedTarget||a.fromElement)&&(Mi(je)||je[Li]))break e;if((ue||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(je=a.relatedTarget||a.toElement,ue=le,je=je?Mi(je):null,je!==null&&(vt=h(je),Be=je.tag,je!==vt||Be!==5&&Be!==27&&Be!==6)&&(je=null)):(ue=null,je=le),ue!==je)){if(Be=xf,me="onMouseLeave",ie="onMouseEnter",ne="mouse",(t==="pointerout"||t==="pointerover")&&(Be=bf,me="onPointerLeave",ie="onPointerEnter",ne="pointer"),vt=ue==null?ce:Os(ue),oe=je==null?ce:Os(je),ce=new Be(me,ne+"leave",ue,a,he),ce.target=vt,ce.relatedTarget=oe,me=null,Mi(he)===le&&(Be=new Be(ie,ne+"enter",je,a,he),Be.target=oe,Be.relatedTarget=vt,me=Be),vt=me,ue&&je)t:{for(Be=p_,ie=ue,ne=je,oe=0,me=ie;me;me=Be(me))oe++;me=0;for(var Re=ne;Re;Re=Be(Re))me++;for(;0<oe-me;)ie=Be(ie),oe--;for(;0<me-oe;)ne=Be(ne),me--;for(;oe--;){if(ie===ne||ne!==null&&ie===ne.alternate){Be=ie;break t}ie=Be(ie),ne=Be(ne)}Be=null}else Be=null;ue!==null&&ug(xe,ce,ue,Be,!1),je!==null&&vt!==null&&ug(xe,vt,je,Be,!0)}}e:{if(ce=le?Os(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var at=jf;else if(kf(ce))if(Nf)at=ky;else{at=wy;var Te=Sy}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Jl(le.elementType)&&(at=jf):at=Cy;if(at&&(at=at(t,le))){Ef(xe,at,a,he);break e}Te&&Te(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&Ql(ce,"number",ce.value)}switch(Te=le?Os(le):window,t){case"focusin":(kf(Te)||Te.contentEditable==="true")&&($i=Te,fc=le,qs=null);break;case"focusout":qs=fc=$i=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,If(xe,a,he);break;case"selectionchange":if(jy)break;case"keydown":case"keyup":If(xe,a,he)}var qe;if(cc)e:{switch(t){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Ui?wf(t,a)&&(Qe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Qe="onCompositionStart");Qe&&(yf&&a.locale!=="ko"&&(Ui||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Ui&&(qe=mf()):(Tr=he,ic="value"in Tr?Tr.value:Tr.textContent,Ui=!0)),Te=Yo(le,Qe),0<Te.length&&(Qe=new vf(Qe,t,null,a,he),xe.push({event:Qe,listeners:Te}),qe?Qe.data=qe:(qe=Cf(a),qe!==null&&(Qe.data=qe)))),(qe=xy?vy(t,a):by(t,a))&&(Qe=Yo(le,"onBeforeInput"),0<Qe.length&&(Te=new vf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Te,listeners:Qe}),Te.data=qe)),u_(xe,t,le,a,he)}lg(xe,n)})}function ma(t,n,a){return{instance:t,listener:n,currentTarget:a}}function Yo(t,n){for(var a=n+"Capture",u=[];t!==null;){var w=t,k=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||k===null||(w=Is(t,a),w!=null&&u.unshift(ma(t,w,k)),w=Is(t,n),w!=null&&u.push(ma(t,w,k))),t.tag===3)return u;t=t.return}return[]}function p_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function ug(t,n,a,u,w){for(var k=n._reactName,M=[];a!==null&&a!==u;){var $=a,J=$.alternate,le=$.stateNode;if($=$.tag,J!==null&&J===u)break;$!==5&&$!==26&&$!==27||le===null||(J=le,w?(le=Is(a,k),le!=null&&M.unshift(ma(a,le,J))):w||(le=Is(a,k),le!=null&&M.push(ma(a,le,J)))),a=a.return}M.length!==0&&t.push({event:n,listeners:M})}var m_=/\r\n?/g,g_=/\u0000|\uFFFD/g;function dg(t){return(typeof t=="string"?t:""+t).replace(m_,`
|
|
49
|
-
`).replace(g_,"")}function hg(t,n){return n=dg(n),dg(t)===n}function xt(t,n,a,u,w,k){switch(a){case"children":typeof u=="string"?n==="body"||n==="textarea"&&u===""||Hi(t,u):(typeof u=="number"||typeof u=="bigint")&&n!=="body"&&Hi(t,""+u);break;case"className":Za(t,"class",u);break;case"tabIndex":Za(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Za(t,a,u);break;case"style":hf(t,u,k);break;case"data":if(n!=="object"){Za(t,"data",u);break}case"src":case"href":if(u===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=Ja(""+u),t.setAttribute(a,u);break;case"action":case"formAction":if(typeof u=="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 k=="function"&&(a==="formAction"?(n!=="input"&&xt(t,n,"name",w.name,w,null),xt(t,n,"formEncType",w.formEncType,w,null),xt(t,n,"formMethod",w.formMethod,w,null),xt(t,n,"formTarget",w.formTarget,w,null)):(xt(t,n,"encType",w.encType,w,null),xt(t,n,"method",w.method,w,null),xt(t,n,"target",w.target,w,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(a);break}u=Ja(""+u),t.setAttribute(a,u);break;case"onClick":u!=null&&(t.onclick=or);break;case"onScroll":u!=null&&Ke("scroll",t);break;case"onScrollEnd":u!=null&&Ke("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}a=Ja(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":u===!0?t.setAttribute(a,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(a,u):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(a,u):t.removeAttribute(a);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(a):t.setAttribute(a,u);break;case"popover":Ke("beforetoggle",t),Ke("toggle",t),Xa(t,"popover",u);break;case"xlinkActuate":ar(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ar(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ar(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ar(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ar(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ar(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ar(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ar(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ar(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Xa(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=qb.get(a)||a,Xa(t,a,u))}}function Hu(t,n,a,u,w,k){switch(a){case"style":hf(t,u,k);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(a=u.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof u=="string"?Hi(t,u):(typeof u=="number"||typeof u=="bigint")&&Hi(t,""+u);break;case"onScroll":u!=null&&Ke("scroll",t);break;case"onScrollEnd":u!=null&&Ke("scrollend",t);break;case"onClick":u!=null&&(t.onclick=or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),k=t[dn]||null,k=k!=null?k[a]:null,typeof k=="function"&&t.removeEventListener(n,k,w),typeof u=="function")){typeof k!="function"&&k!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,u,w);break e}a in t?t[a]=u:u===!0?t.setAttribute(a,""):Xa(t,a,u)}}}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":Ke("error",t),Ke("load",t);var u=!1,w=!1,k;for(k in a)if(a.hasOwnProperty(k)){var M=a[k];if(M!=null)switch(k){case"src":u=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:xt(t,n,k,M,a,null)}}w&&xt(t,n,"srcSet",a.srcSet,a,null),u&&xt(t,n,"src",a.src,a,null);return;case"input":Ke("invalid",t);var $=k=M=w=null,J=null,le=null;for(u in a)if(a.hasOwnProperty(u)){var he=a[u];if(he!=null)switch(u){case"name":w=he;break;case"type":M=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":k=he;break;case"defaultValue":$=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:xt(t,n,u,he,a,null)}}lf(t,k,$,J,le,M,w,!1);return;case"select":Ke("invalid",t),u=M=k=null;for(w in a)if(a.hasOwnProperty(w)&&($=a[w],$!=null))switch(w){case"value":k=$;break;case"defaultValue":M=$;break;case"multiple":u=$;default:xt(t,n,w,$,a,null)}n=k,a=M,t.multiple=!!u,n!=null?zi(t,!!u,n,!1):a!=null&&zi(t,!!u,a,!0);return;case"textarea":Ke("invalid",t),k=w=u=null;for(M in a)if(a.hasOwnProperty(M)&&($=a[M],$!=null))switch(M){case"value":u=$;break;case"defaultValue":w=$;break;case"children":k=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(s(91));break;default:xt(t,n,M,$,a,null)}uf(t,u,w,k);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(u=a[J],u!=null))switch(J){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:xt(t,n,J,u,a,null)}return;case"dialog":Ke("beforetoggle",t),Ke("toggle",t),Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":Ke("load",t);break;case"video":case"audio":for(u=0;u<pa.length;u++)Ke(pa[u],t);break;case"image":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"embed":case"source":case"link":Ke("error",t),Ke("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)&&(u=a[le],u!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:xt(t,n,le,u,a,null)}return;default:if(Jl(n)){for(he in a)a.hasOwnProperty(he)&&(u=a[he],u!==void 0&&Hu(t,n,he,u,a,void 0));return}}for($ in a)a.hasOwnProperty($)&&(u=a[$],u!=null&&xt(t,n,$,u,a,null))}function x_(t,n,a,u){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,k=null,M=null,$=null,J=null,le=null,he=null;for(ue in a){var xe=a[ue];if(a.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":J=xe;default:u.hasOwnProperty(ue)||xt(t,n,ue,null,u,xe)}}for(var ce in u){var ue=u[ce];if(xe=a[ce],u.hasOwnProperty(ce)&&(ue!=null||xe!=null))switch(ce){case"type":k=ue;break;case"name":w=ue;break;case"checked":le=ue;break;case"defaultChecked":he=ue;break;case"value":M=ue;break;case"defaultValue":$=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,n));break;default:ue!==xe&&xt(t,n,ce,ue,u,xe)}}Zl(t,M,$,J,le,he,k,w);return;case"select":ue=M=$=ce=null;for(k in a)if(J=a[k],a.hasOwnProperty(k)&&J!=null)switch(k){case"value":break;case"multiple":ue=J;default:u.hasOwnProperty(k)||xt(t,n,k,null,u,J)}for(w in u)if(k=u[w],J=a[w],u.hasOwnProperty(w)&&(k!=null||J!=null))switch(w){case"value":ce=k;break;case"defaultValue":$=k;break;case"multiple":M=k;default:k!==J&&xt(t,n,w,k,u,J)}n=$,a=M,u=ue,ce!=null?zi(t,!!a,ce,!1):!!u!=!!a&&(n!=null?zi(t,!!a,n,!0):zi(t,!!a,a?[]:"",!1));return;case"textarea":ue=ce=null;for($ in a)if(w=a[$],a.hasOwnProperty($)&&w!=null&&!u.hasOwnProperty($))switch($){case"value":break;case"children":break;default:xt(t,n,$,null,u,w)}for(M in u)if(w=u[M],k=a[M],u.hasOwnProperty(M)&&(w!=null||k!=null))switch(M){case"value":ce=w;break;case"defaultValue":ue=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==k&&xt(t,n,M,w,u,k)}cf(t,ce,ue);return;case"option":for(var je in a)if(ce=a[je],a.hasOwnProperty(je)&&ce!=null&&!u.hasOwnProperty(je))switch(je){case"selected":t.selected=!1;break;default:xt(t,n,je,null,u,ce)}for(J in u)if(ce=u[J],ue=a[J],u.hasOwnProperty(J)&&ce!==ue&&(ce!=null||ue!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:xt(t,n,J,ce,u,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Be in a)ce=a[Be],a.hasOwnProperty(Be)&&ce!=null&&!u.hasOwnProperty(Be)&&xt(t,n,Be,null,u,ce);for(le in u)if(ce=u[le],ue=a[le],u.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:xt(t,n,le,ce,u,ue)}return;default:if(Jl(n)){for(var vt in a)ce=a[vt],a.hasOwnProperty(vt)&&ce!==void 0&&!u.hasOwnProperty(vt)&&Hu(t,n,vt,void 0,u,ce);for(he in u)ce=u[he],ue=a[he],!u.hasOwnProperty(he)||ce===ue||ce===void 0&&ue===void 0||Hu(t,n,he,ce,u,ue);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!u.hasOwnProperty(ie)&&xt(t,n,ie,null,u,ce);for(xe in u)ce=u[xe],ue=a[xe],!u.hasOwnProperty(xe)||ce===ue||ce==null&&ue==null||xt(t,n,xe,ce,u,ue)}function fg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function v_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),u=0;u<a.length;u++){var w=a[u],k=w.transferSize,M=w.initiatorType,$=w.duration;if(k&&$&&fg(M)){for(M=0,$=w.responseEnd,u+=1;u<a.length;u++){var J=a[u],le=J.startTime;if(le>$)break;var he=J.transferSize,xe=J.initiatorType;he&&fg(xe)&&(J=J.responseEnd,M+=he*(J<$?1:($-le)/(J-le)))}if(--u,n+=8*(k+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 Pu=null,Fu=null;function Ko(t){return t.nodeType===9?t:t.ownerDocument}function pg(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 mg(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 Uu(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 $u=null;function b_(){var t=window.event;return t&&t.type==="popstate"?t===$u?!1:($u=t,!0):($u=null,!1)}var gg=typeof setTimeout=="function"?setTimeout:void 0,y_=typeof clearTimeout=="function"?clearTimeout:void 0,xg=typeof Promise=="function"?Promise:void 0,__=typeof queueMicrotask=="function"?queueMicrotask:typeof xg<"u"?function(t){return xg.resolve(null).then(t).catch(S_)}:gg;function S_(t){setTimeout(function(){throw t})}function Gr(t){return t==="head"}function vg(t,n){var a=n,u=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(u===0){t.removeChild(w),gs(n);return}u--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")u++;else if(a==="html")ga(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ga(a);for(var k=a.firstChild;k;){var M=k.nextSibling,$=k.nodeName;k[Ms]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&k.rel.toLowerCase()==="stylesheet"||a.removeChild(k),k=M}}else a==="body"&&ga(t.ownerDocument.body);a=w}while(a);gs(n)}function bg(t,n){var a=t;t=0;do{var u=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||""),u&&u.nodeType===8)if(a=u.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=u}while(a)}function qu(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":qu(a),Kl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function w_(t,n,a,u){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Ms])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(k=t.getAttribute("rel"),k==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(k!==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(k=t.getAttribute("src"),(k!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&k&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var k=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===k)return t}else return t;if(t=Fn(t.nextSibling),t===null)break}return null}function C_(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Fn(t.nextSibling),t===null))return null;return t}function yg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Fn(t.nextSibling),t===null))return null;return t}function Wu(t){return t.data==="$?"||t.data==="$~"}function Gu(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function k_(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var u=function(){n(),a.removeEventListener("DOMContentLoaded",u)};a.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Fn(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 Vu=null;function _g(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Fn(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Sg(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 wg(t,n,a){switch(n=Ko(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 ga(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Kl(t)}var Un=new Map,Cg=new Set;function Xo(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var wr=Q.d;Q.d={f:E_,r:j_,D:N_,C:T_,L:A_,m:D_,X:L_,S:R_,M:M_};function E_(){var t=wr.f(),n=Fo();return t||n}function j_(t){var n=Oi(t);n!==null&&n.tag===5&&n.type==="form"?Fp(n):wr.r(t)}var fs=typeof document>"u"?null:document;function kg(t,n,a){var u=fs;if(u&&typeof n=="string"&&n){var w=Mn(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),Cg.has(w)||(Cg.add(w),t={rel:t,crossOrigin:a,href:n},u.querySelector(w)===null&&(n=u.createElement("link"),Jt(n,"link",t),$t(n),u.head.appendChild(n)))}}function N_(t){wr.D(t),kg("dns-prefetch",t,null)}function T_(t,n){wr.C(t,n),kg("preconnect",t,n)}function A_(t,n,a){wr.L(t,n,a);var u=fs;if(u&&t&&n){var w='link[rel="preload"][as="'+Mn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+Mn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+Mn(a.imageSizes)+'"]')):w+='[href="'+Mn(t)+'"]';var k=w;switch(n){case"style":k=ps(t);break;case"script":k=ms(t)}Un.has(k)||(t=p({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),Un.set(k,t),u.querySelector(w)!==null||n==="style"&&u.querySelector(xa(k))||n==="script"&&u.querySelector(va(k))||(n=u.createElement("link"),Jt(n,"link",t),$t(n),u.head.appendChild(n)))}}function D_(t,n){wr.m(t,n);var a=fs;if(a&&t){var u=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+Mn(u)+'"][href="'+Mn(t)+'"]',k=w;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=ms(t)}if(!Un.has(k)&&(t=p({rel:"modulepreload",href:t},n),Un.set(k,t),a.querySelector(w)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(va(k)))return}u=a.createElement("link"),Jt(u,"link",t),$t(u),a.head.appendChild(u)}}}function R_(t,n,a){wr.S(t,n,a);var u=fs;if(u&&t){var w=Ii(u).hoistableStyles,k=ps(t);n=n||"default";var M=w.get(k);if(!M){var $={loading:0,preload:null};if(M=u.querySelector(xa(k)))$.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":n},a),(a=Un.get(k))&&Yu(t,a);var J=M=u.createElement("link");$t(J),Jt(J,"link",t),J._p=new Promise(function(le,he){J.onload=le,J.onerror=he}),J.addEventListener("load",function(){$.loading|=1}),J.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Zo(M,n,u)}M={type:"stylesheet",instance:M,count:1,state:$},w.set(k,M)}}}function L_(t,n){wr.X(t,n);var a=fs;if(a&&t){var u=Ii(a).hoistableScripts,w=ms(t),k=u.get(w);k||(k=a.querySelector(va(w)),k||(t=p({src:t,async:!0},n),(n=Un.get(w))&&Ku(t,n),k=a.createElement("script"),$t(k),Jt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function M_(t,n){wr.M(t,n);var a=fs;if(a&&t){var u=Ii(a).hoistableScripts,w=ms(t),k=u.get(w);k||(k=a.querySelector(va(w)),k||(t=p({src:t,async:!0,type:"module"},n),(n=Un.get(w))&&Ku(t,n),k=a.createElement("script"),$t(k),Jt(k,"link",t),a.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},u.set(w,k))}}function Eg(t,n,a,u){var w=(w=Z.current)?Xo(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=ps(a.href),a=Ii(w).hoistableStyles,u=a.get(n),u||(u={type:"style",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ps(a.href);var k=Ii(w).hoistableStyles,M=k.get(t);if(M||(w=w.ownerDocument||w,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(t,M),(k=w.querySelector(xa(t)))&&!k._p&&(M.instance=k,M.state.loading=5),Un.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},Un.set(t,a),k||O_(w,t,a,M.state))),n&&u===null)throw Error(s(528,""));return M}if(n&&u!==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=ms(a),a=Ii(w).hoistableScripts,u=a.get(n),u||(u={type:"script",instance:null,count:0,state:null},a.set(n,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function ps(t){return'href="'+Mn(t)+'"'}function xa(t){return'link[rel="stylesheet"]['+t+"]"}function jg(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function O_(t,n,a,u){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?u.loading=1:(n=t.createElement("link"),u.preload=n,n.addEventListener("load",function(){return u.loading|=1}),n.addEventListener("error",function(){return u.loading|=2}),Jt(n,"link",a),$t(n),t.head.appendChild(n))}function ms(t){return'[src="'+Mn(t)+'"]'}function va(t){return"script[async]"+t}function Ng(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var u=t.querySelector('style[data-href~="'+Mn(a.href)+'"]');if(u)return n.instance=u,$t(u),u;var w=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),$t(u),Jt(u,"style",w),Zo(u,a.precedence,t),n.instance=u;case"stylesheet":w=ps(a.href);var k=t.querySelector(xa(w));if(k)return n.state.loading|=4,n.instance=k,$t(k),k;u=jg(a),(w=Un.get(w))&&Yu(u,w),k=(t.ownerDocument||t).createElement("link"),$t(k);var M=k;return M._p=new Promise(function($,J){M.onload=$,M.onerror=J}),Jt(k,"link",u),n.state.loading|=4,Zo(k,a.precedence,t),n.instance=k;case"script":return k=ms(a.src),(w=t.querySelector(va(k)))?(n.instance=w,$t(w),w):(u=a,(w=Un.get(k))&&(u=p({},a),Ku(u,w)),t=t.ownerDocument||t,w=t.createElement("script"),$t(w),Jt(w,"link",u),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&&(u=n.instance,n.state.loading|=4,Zo(u,a.precedence,t));return n.instance}function Zo(t,n,a){for(var u=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=u.length?u[u.length-1]:null,k=w,M=0;M<u.length;M++){var $=u[M];if($.dataset.precedence===n)k=$;else if(k!==w)break}k?k.parentNode.insertBefore(t,k.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function Yu(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Ku(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Qo=null;function Tg(t,n,a){if(Qo===null){var u=new Map,w=Qo=new Map;w.set(a,u)}else w=Qo,u=w.get(a),u||(u=new Map,w.set(a,u));if(u.has(t))return u;for(u.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var k=a[w];if(!(k[Ms]||k[Kt]||t==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var M=k.getAttribute(n)||"";M=t+M;var $=u.get(M);$?$.push(k):u.set(M,[k])}}return u}function Ag(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function I_(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 Dg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function B_(t,n,a,u){if(a.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=ps(u.href),k=n.querySelector(xa(w));if(k){n=k._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Jo.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=k,$t(k);return}k=n.ownerDocument||n,u=jg(u),(w=Un.get(w))&&Yu(u,w),k=k.createElement("link"),$t(k);var M=k;M._p=new Promise(function($,J){M.onload=$,M.onerror=J}),Jt(k,"link",u),a.instance=k}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Jo.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var Xu=0;function z_(t,n){return t.stylesheets&&t.count===0&&tl(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var u=setTimeout(function(){if(t.stylesheets&&tl(t,t.stylesheets),t.unsuspend){var k=t.unsuspend;t.unsuspend=null,k()}},6e4+n);0<t.imgBytes&&Xu===0&&(Xu=62500*v_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&tl(t,t.stylesheets),t.unsuspend)){var k=t.unsuspend;t.unsuspend=null,k()}},(t.imgBytes>Xu?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(w)}}:null}function Jo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var el=null;function tl(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,el=new Map,n.forEach(H_,t),el=null,Jo.call(t))}function H_(t,n){if(!(n.state.loading&4)){var a=el.get(t);if(a)var u=a.get(null);else{a=new Map,el.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<w.length;k++){var M=w[k];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(a.set(M.dataset.precedence,M),u=M)}u&&a.set(null,u)}w=n.instance,M=w.getAttribute("data-precedence"),k=a.get(M)||u,k===u&&a.set(null,w),a.set(M,w),this.count++,u=Jo.bind(this),w.addEventListener("load",u),w.addEventListener("error",u),k?k.parentNode.insertBefore(w,k.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var ba={$$typeof:y,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function P_(t,n,a,u,w,k,M,$,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=Rs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rs(0),this.hiddenUpdates=Rs(null),this.identifierPrefix=u,this.onUncaughtError=w,this.onCaughtError=k,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Rg(t,n,a,u,w,k,M,$,J,le,he,xe){return t=new P_(t,n,a,M,J,le,he,xe,$),n=1,k===!0&&(n|=24),k=_n(3,null,null,n),t.current=k,k.stateNode=t,n=Tc(),n.refCount++,t.pooledCache=n,n.refCount++,k.memoizedState={element:u,isDehydrated:a,cache:n},Lc(k),t}function Lg(t){return t?(t=Gi,t):Gi}function Mg(t,n,a,u,w,k){w=Lg(w),u.context===null?u.context=w:u.pendingContext=w,u=Or(n),u.payload={element:a},k=k===void 0?null:k,k!==null&&(u.callback=k),a=Ir(t,u,n),a!==null&&(xn(a,t,n),Zs(a,t,n))}function Og(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function Zu(t,n){Og(t,n),(t=t.alternate)&&Og(t,n)}function Ig(t){if(t.tag===13||t.tag===31){var n=li(t,67108864);n!==null&&xn(n,t,67108864),Zu(t,67108864)}}function Bg(t){if(t.tag===13||t.tag===31){var n=En();n=Gl(n);var a=li(t,n);a!==null&&xn(a,t,n),Zu(t,n)}}var nl=!0;function F_(t,n,a,u){var w=V.T;V.T=null;var k=Q.p;try{Q.p=2,Qu(t,n,a,u)}finally{Q.p=k,V.T=w}}function U_(t,n,a,u){var w=V.T;V.T=null;var k=Q.p;try{Q.p=8,Qu(t,n,a,u)}finally{Q.p=k,V.T=w}}function Qu(t,n,a,u){if(nl){var w=Ju(u);if(w===null)zu(t,n,u,rl,a),Hg(t,u);else if(q_(w,t,n,a,u))u.stopPropagation();else if(Hg(t,u),n&4&&-1<$_.indexOf(t)){for(;w!==null;){var k=Oi(w);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var M=Ie(k.pendingLanes);if(M!==0){var $=k;for($.pendingLanes|=2,$.entangledLanes|=2;M;){var J=1<<31-$e(M);$.entanglements[1]|=J,M&=~J}er(k),(ut&6)===0&&(Ho=Ge()+500,fa(0))}}break;case 31:case 13:$=li(k,2),$!==null&&xn($,k,2),Fo(),Zu(k,2)}if(k=Ju(u),k===null&&zu(t,n,u,rl,a),k===w)break;w=k}w!==null&&u.stopPropagation()}else zu(t,n,u,null,a)}}function Ju(t){return t=tc(t),ed(t)}var rl=null;function ed(t){if(rl=null,t=Mi(t),t!==null){var n=h(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=m(n),t!==null)return t;t=null}else if(a===31){if(t=o(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 rl=t,null}function zg(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(ct()){case de:return 2;case be:return 8;case re:case _e:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var td=!1,Vr=null,Yr=null,Kr=null,ya=new Map,_a=new Map,Xr=[],$_="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 Hg(t,n){switch(t){case"focusin":case"focusout":Vr=null;break;case"dragenter":case"dragleave":Yr=null;break;case"mouseover":case"mouseout":Kr=null;break;case"pointerover":case"pointerout":ya.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":_a.delete(n.pointerId)}}function Sa(t,n,a,u,w,k){return t===null||t.nativeEvent!==k?(t={blockedOn:n,domEventName:a,eventSystemFlags:u,nativeEvent:k,targetContainers:[w]},n!==null&&(n=Oi(n),n!==null&&Ig(n)),t):(t.eventSystemFlags|=u,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function q_(t,n,a,u,w){switch(n){case"focusin":return Vr=Sa(Vr,t,n,a,u,w),!0;case"dragenter":return Yr=Sa(Yr,t,n,a,u,w),!0;case"mouseover":return Kr=Sa(Kr,t,n,a,u,w),!0;case"pointerover":var k=w.pointerId;return ya.set(k,Sa(ya.get(k)||null,t,n,a,u,w)),!0;case"gotpointercapture":return k=w.pointerId,_a.set(k,Sa(_a.get(k)||null,t,n,a,u,w)),!0}return!1}function Pg(t){var n=Mi(t.target);if(n!==null){var a=h(n);if(a!==null){if(n=a.tag,n===13){if(n=m(a),n!==null){t.blockedOn=n,Jh(t.priority,function(){Bg(a)});return}}else if(n===31){if(n=o(a),n!==null){t.blockedOn=n,Jh(t.priority,function(){Bg(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 il(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=Ju(t.nativeEvent);if(a===null){a=t.nativeEvent;var u=new a.constructor(a.type,a);ec=u,a.target.dispatchEvent(u),ec=null}else return n=Oi(a),n!==null&&Ig(n),t.blockedOn=a,!1;n.shift()}return!0}function Fg(t,n,a){il(t)&&a.delete(n)}function W_(){td=!1,Vr!==null&&il(Vr)&&(Vr=null),Yr!==null&&il(Yr)&&(Yr=null),Kr!==null&&il(Kr)&&(Kr=null),ya.forEach(Fg),_a.forEach(Fg)}function sl(t,n){t.blockedOn===n&&(t.blockedOn=null,td||(td=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,W_)))}var al=null;function Ug(t){al!==t&&(al=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){al===t&&(al=null);for(var n=0;n<t.length;n+=3){var a=t[n],u=t[n+1],w=t[n+2];if(typeof u!="function"){if(ed(u||a)===null)continue;break}var k=Oi(a);k!==null&&(t.splice(n,3),n-=3,Jc(k,{pending:!0,data:w,method:a.method,action:u},u,w))}}))}function gs(t){function n(J){return sl(J,t)}Vr!==null&&sl(Vr,t),Yr!==null&&sl(Yr,t),Kr!==null&&sl(Kr,t),ya.forEach(n),_a.forEach(n);for(var a=0;a<Xr.length;a++){var u=Xr[a];u.blockedOn===t&&(u.blockedOn=null)}for(;0<Xr.length&&(a=Xr[0],a.blockedOn===null);)Pg(a),a.blockedOn===null&&Xr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(u=0;u<a.length;u+=3){var w=a[u],k=a[u+1],M=w[dn]||null;if(typeof k=="function")M||Ug(a);else if(M){var $=null;if(k&&k.hasAttribute("formAction")){if(w=k,M=k[dn]||null)$=M.formAction;else if(ed(w)!==null)continue}else $=M.action;typeof $=="function"?a[u+1]=$:(a.splice(u,3),u-=3),Ug(a)}}}function $g(){function t(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(M){return w=M})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),u||setTimeout(a,20)}function a(){if(!u&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function nd(t){this._internalRoot=t}ol.prototype.render=nd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,u=En();Mg(a,u,t,n,null,null)},ol.prototype.unmount=nd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Mg(t.current,2,null,t,null,null),Fo(),n[Li]=null}};function ol(t){this._internalRoot=t}ol.prototype.unstable_scheduleHydration=function(t){if(t){var n=Qh();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Xr.length&&n!==0&&n<Xr[a].priority;a++);Xr.splice(a,0,t),a===0&&Pg(t)}};var qg=r.version;if(qg!=="19.2.4")throw Error(s(527,qg,"19.2.4"));Q.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 G_={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ll.isDisabled&&ll.supportsFiber)try{st=ll.inject(G_),it=ll}catch{}}return Ca.createRoot=function(t,n){if(!l(t))throw Error(s(299));var a=!1,u="",w=Zp,k=Qp,M=Jp;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(k=n.onCaughtError),n.onRecoverableError!==void 0&&(M=n.onRecoverableError)),n=Rg(t,1,!1,null,null,a,u,null,w,k,M,$g),t[Li]=n.current,Bu(t),new nd(n)},Ca.hydrateRoot=function(t,n,a){if(!l(t))throw Error(s(299));var u=!1,w="",k=Zp,M=Qp,$=Jp,J=null;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(k=a.onUncaughtError),a.onCaughtError!==void 0&&(M=a.onCaughtError),a.onRecoverableError!==void 0&&($=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Rg(t,1,!0,n,a??null,u,w,J,k,M,$,$g),n.context=Lg(null),a=n.current,u=En(),u=Gl(u),w=Or(u),w.callback=null,Ir(a,w,u),a=u,n.current.lanes=a,Ls(n,a),er(n),t[Li]=n.current,Bu(t),new ol(n)},Ca.version="19.2.4",Ca}var ex;function s1(){if(ex)return sd.exports;ex=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=i1(),sd.exports}var a1=s1();const o1=Al(a1);function l1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,l,h,m=[],o="",d=e.split("/");for(d[0]||d.shift();l=d.shift();)i=l[0],i==="*"?(m.push(i),o+=l[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=l.indexOf("?",1),h=l.indexOf(".",1),m.push(l.substring(1,~s?s:~h?h:l.length)),o+=~s&&!~h?"(?:/([^/]+?))?":"/([^/]+?)",~h&&(o+=(~s?"?":"")+"\\"+l.substring(h))):o+="/"+l;return{keys:m,pattern:new RegExp("^"+o+(r?"(?=$|/)":"/?$"),"i")}}var cd={exports:{}},ud={};/**
|
|
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 tx;function c1(){if(tx)return ud;tx=1;var e=Dl();function r(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,l=e.useEffect,h=e.useLayoutEffect,m=e.useDebugValue;function o(p,v){var S=v(),E=s({inst:{value:S,getSnapshot:v}}),C=E[0].inst,b=E[1];return h(function(){C.value=S,C.getSnapshot=v,d(C)&&b({inst:C})},[p,S,v]),l(function(){return d(C)&&b({inst:C}),p(function(){d(C)&&b({inst:C})})},[p]),m(S),S}function d(p){var v=p.getSnapshot;p=p.value;try{var S=v();return!i(p,S)}catch{return!0}}function f(p,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return ud.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,ud}var nx;function u1(){return nx||(nx=1,cd.exports=c1()),cd.exports}var d1=u1();const h1=e1.useInsertionEffect,f1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",p1=f1?F.useLayoutEffect:F.useEffect,m1=h1||p1,qv=e=>{const r=F.useRef([e,(...i)=>r[0](...i)]).current;return m1(()=>{r[0]=e}),r[1]},g1="popstate",ih="pushState",sh="replaceState",x1="hashchange",rx=[g1,ih,sh,x1],v1=e=>{for(const r of rx)addEventListener(r,e);return()=>{for(const r of rx)removeEventListener(r,e)}},Wv=(e,r)=>d1.useSyncExternalStore(v1,e,r),ix=()=>location.search,b1=({ssrSearch:e}={})=>Wv(ix,e!=null?()=>e:ix),sx=()=>location.pathname,y1=({ssrPath:e}={})=>Wv(sx,e!=null?()=>e:sx),_1=(e,{replace:r=!1,state:i=null}={})=>history[r?sh:ih](i,"",e),S1=(e={})=>[y1(e),_1],ax=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[ax]>"u"){for(const e of[ih,sh]){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,ax,{value:!0})}const w1=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",Gv=(e="")=>e==="/"?"":e,C1=(e,r)=>e[0]==="~"?e.slice(1):Gv(r)+e,k1=(e="",r)=>w1(ox(Gv(e)),ox(r)),ox=e=>{try{return decodeURI(e)}catch{return e}},Vv={hook:S1,searchHook:b1,parser:l1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},Yv=F.createContext(Vv),Ns=()=>F.useContext(Yv),Kv={},Xv=F.createContext(Kv),E1=()=>F.useContext(Xv),Rl=e=>{const[r,i]=e.hook(e);return[k1(e.base,r),qv((s,l)=>e.aroundNav(i,C1(s,e.base),l))]},Ti=()=>Rl(Ns()),ah=(e,r,i,s)=>{const{pattern:l,keys:h}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),m=l.exec(i)||[],[o,...d]=m;return o!==void 0?[!0,(()=>{const f=h!==!1?Object.fromEntries(h.map((p,v)=>[p,d[v]])):m.groups;let g={...d};return f&&Object.assign(g,f),g})(),...s?[o]:[]]:[!1,null]},oh=e=>ah(Ns().parser,e,Ti()[0]),j1=({children:e,...r})=>{var g,p,v;const i=Ns(),s=r.hook?Vv:i;let l=s;const[h,m=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];h&&(r.ssrSearch=m,r.ssrPath=h),r.hrefs=r.hrefs??((p=r.hook)==null?void 0:p.hrefs),r.searchHook=r.searchHook??((v=r.hook)==null?void 0:v.searchHook);let o=F.useRef({}),d=o.current,f=d;for(let S in s){const E=S==="base"?s[S]+(r[S]??""):r[S]??s[S];d===f&&E!==f[S]&&(o.current=f={...f}),f[S]=E,(E!==s[S]||E!==l[S])&&(l=f)}return F.createElement(Yv.Provider,{value:l,children:e})},lx=({children:e,component:r},i)=>r?F.createElement(r,{params:i}):typeof e=="function"?e(i):e,N1=e=>{let r=F.useRef(Kv);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,l])=>l!==i[s])?e:i},cl=({path:e,nest:r,match:i,...s})=>{const l=Ns(),[h]=Rl(l),[m,o,d]=i??ah(l.parser,e,h,r),f=N1({...E1(),...o});if(!m)return null;const g=d?F.createElement(j1,{base:d},lx(s,f)):lx(s,f);return F.createElement(Xv.Provider,{value:f,children:g})},An=F.forwardRef((e,r)=>{const i=Ns(),[s,l]=Rl(i),{to:h="",href:m=h,onClick:o,asChild:d,children:f,className:g,replace:p,state:v,transition:S,...E}=e,C=qv(_=>{_.ctrlKey||_.metaKey||_.altKey||_.shiftKey||_.button!==0||(o==null||o(_),_.defaultPrevented||(_.preventDefault(),l(m,e)))}),b=i.hrefs(m[0]==="~"?m.slice(1):i.base+m,i);return d&&F.isValidElement(f)?F.cloneElement(f,{onClick:C,href:b}):F.createElement("a",{...E,onClick:C,href:b,className:g!=null&&g.call?g(s===m):g,children:f,ref:r})}),Zv=e=>Array.isArray(e)?e.flatMap(r=>Zv(r&&r.type===F.Fragment?r.props.children:r)):[e],T1=({children:e,location:r})=>{const i=Ns(),[s]=Rl(i);for(const l of Zv(e)){let h=0;if(F.isValidElement(l)&&(h=ah(i.parser,l.props.path,r||s,l.props.nest))[0])return F.cloneElement(l,{match:h})}return null},cx=e=>{let r;const i=new Set,s=(f,g)=>{const p=typeof f=="function"?f(r):f;if(!Object.is(p,r)){const v=r;r=g??(typeof p!="object"||p===null)?p:Object.assign({},r,p),i.forEach(S=>S(r,v))}},l=()=>r,o={setState:s,getState:l,getInitialState:()=>d,subscribe:f=>(i.add(f),()=>i.delete(f))},d=r=e(s,l,o);return o},A1=(e=>e?cx(e):cx),D1=e=>e;function R1(e,r=D1){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 ux=e=>{const r=A1(e),i=s=>R1(r,s);return Object.assign(i,r),i},Xn=(e=>e?ux(e):ux);async function Se(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 L1(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function xl(){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 M1{constructor(r){Cr(this,"ws",null);Cr(this,"handlers",new Set);Cr(this,"statusHandler",null);Cr(this,"baseUrl");Cr(this,"isReconnecting",!1);Cr(this,"connectingPromise",null);Cr(this,"lastCloseCode",0);Cr(this,"reconnectAttempts",0);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,l)=>{try{const h=this.getUrl();this.ws=new WebSocket(h);const m=setTimeout(()=>{var o;((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING&&(this.ws.close(),l(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var o;clearTimeout(m),this.isReconnecting=!1,this.connectingPromise=null,(o=this.statusHandler)==null||o.call(this,"connected"),s()},this.ws.onclose=o=>{var d,f,g;clearTimeout(m),this.lastCloseCode=o.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(f=this.statusHandler)==null||f.call(this,"disconnected"),l(new Error(`Connection closed: ${o.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=o=>{clearTimeout(m),console.error("WebSocket error:",o),this.connectingPromise=null,l(o)},this.ws.onmessage=o=>{try{const d=JSON.parse(o.data);L1(d)&&this.handlers.forEach(f=>f(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(h){this.connectingPromise=null,l(h)}}),this.connectingPromise))}attemptReconnect(){var s;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure detected, not auto-reconnecting");return}if(this.isReconnecting)return;this.isReconnecting=!0,(s=this.statusHandler)==null||s.call(this,"reconnecting");const i=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.connect().catch(()=>{})},i)}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=xl(),l={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(l)),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 O1=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Pt=new M1(O1);let ul=[],dd=null,vl=null;function I1(){dd===null&&(dd=requestAnimationFrame(()=>{dd=null,vl==null||vl()}))}const nr=Xn()((e,r)=>(vl=()=>{if(ul.length===0)return;const i=ul;ul=[],e(s=>({logs:[...s.logs,...i]}))},{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:i=>{r().workdir!==i&&(e({workdir:i,status:null,logs:[],config:null,loading:!0}),i&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const i=r().workdir;if(i)try{const l=await(await Se(`/api/dev-server?workdir=${encodeURIComponent(i)}`)).json();e({status:l,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const i=r().workdir;if(i)try{const l=await(await Se(`/api/dev-server/config?workdir=${encodeURIComponent(i)}`)).json();e({config:l.config??null})}catch{}},fetchLogs:async()=>{const i=r().workdir;if(i)try{const h=(await(await Se(`/api/dev-server/logs?workdir=${encodeURIComponent(i)}`)).json()).logs.map(m=>({stream:m.stream,content:m.content}));e({logs:h})}catch{}},start:async()=>{const i=r().workdir;if(i)try{const l=await(await Se(`/api/dev-server/start?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:l,logs:[]})}catch{}},stop:async()=>{const i=r().workdir;if(i)try{const l=await(await Se(`/api/dev-server/stop?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:l})}catch{}},restart:async()=>{const i=r().workdir;if(i)try{const l=await(await Se(`/api/dev-server/restart?workdir=${encodeURIComponent(i)}`,{method:"POST"})).json();e({status:l,logs:[]})}catch{}},saveConfig:async i=>{const s=r().workdir;if(s)try{const h=await(await Se(`/api/dev-server/config?workdir=${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})).json();e({config:h.config??i}),r().fetchStatus()}catch{}},handleMessage:i=>{const s=r().workdir;if(s)switch(i.type){case"devServer.output":{const l=i.payload;if(l.workdir!==s)return;ul.push({stream:l.stream,content:l.content}),I1();break}case"devServer.state":{const l=i.payload;if(l.workdir!==s)return;e(h=>({status:h.status?{...h.status,state:l.state,errorMessage:l.errorMessage}:h.status}));break}}}})),B1=3e4;function z1(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"auto":return"Auto";case"unknown":return""}}const Gt=Xn((e,r)=>({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 Se("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({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 Se("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),h=Ee.getState().currentSession;if(h!=null&&h.providerId&&h.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:l}=r();if(i===s)return!0;e({activating:!0,error:null});try{const h=await Se(`/api/providers/${i}/activate`,{method:"POST"});if(!h.ok){const o=await h.json();throw new Error(o.error??"Failed to activate provider")}const m=await h.json();return e({activeProviderId:m.activeProviderId,model:m.model,backend:m.backend,providers:l.map(o=>({...o,isActive:o.id===m.activeProviderId})),activating:!1}),!0}catch(h){return e({error:h instanceof Error?h.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:l}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:l.map(h=>({...h,isActive:h.id===i}))})},updateModelContext:async(i,s,l)=>{e({activating:!0,error:null});try{const h=await Se(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:l})});if(!h.ok){const d=await h.json();throw new Error(d.error??"Failed to update model context")}const m=await h.json(),{providers:o}=r();return e({providers:o.map(d=>d.id===i?{...d,models:d.models.map(f=>f.id===s?{...f,contextWindow:l,source:"user"}:f)}:d),activating:!1}),m.contextState&&Ee.getState().updateContextState(m.contextState),!0}catch(h){return e({error:h instanceof Error?h.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await Se(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const m=await s.json();throw new Error(m.error??"Failed to refresh models")}const l=await s.json(),{providers:h}=r();return e({providers:h.map(m=>m.id===i?{...m,models:l.models}:m),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 l=setInterval(()=>{s()},B1);e({autoRefreshInterval:l})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(l=>l.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:l}=r(),h=s.find(o=>o.id===l);if(!h)return 2e5;const m=h.models.find(o=>o.id===i);return(m==null?void 0:m.contextWindow)??2e5}})),Ft=Xn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Se("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const l=await Se("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!l.ok)return null;const h=await l.json();return await r().listProjects(),h.project}catch{return null}},loadProject:async i=>{try{const s=await Se(`/api/projects/${i}`);if(!s.ok)return null;const l=await s.json();return e({currentProject:l.project}),r().projects.length===0&&await r().listProjects(),l.project}catch{return null}},updateProject:async(i,s)=>{var l;try{const h=await Se(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!h.ok)return null;const m=await h.json();return((l=r().currentProject)==null?void 0:l.id)===i&&e({currentProject:m.project}),await r().listProjects(),m.project}catch{return null}},deleteProject:async i=>{var s;try{return(await Se(`/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})}})),Jr={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"},ei=Xn(e=>({settings:{},loading:{},getSetting:async r=>{e(i=>({loading:{...i.loading,[r]:!0}}));try{const s=await(await Se(`/api/settings/${r}`)).json();return e(l=>({settings:{...l.settings,[r]:s.value??""},loading:{...l.loading,[r]:!1}})),s.value}catch{return e(i=>({loading:{...i.loading,[r]:!1}})),null}},setSetting:async(r,i)=>{e(s=>({loading:{...s.loading,[r]:!0}}));try{const l=await(await Se(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(h=>({settings:{...h.settings,[r]:l.value??""},loading:{...h.loading,[r]:!1}}))}catch{e(s=>({loading:{...s.loading,[r]:!1}}))}}})),dx=[{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"}],H1=[{key:"planner",label:"Planner"},{key:"build",label:"Builder"},{key:"sub-agent",label:"Sub-agent"}],P1=[{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"}],lh={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"},rr={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},Pd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...rr},waiting_for_user:{...rr},phase_done:{...rr},phase_blocked:{...rr},new_message:{...rr}},agentOverrides:{}};function Qv(e,r,i){var h;const s=e.events[r];if(!i)return s;const l=(h=e.agentOverrides[i])==null?void 0:h[r];return l?{soundEnabled:l.soundEnabled??s.soundEnabled,browserNotification:l.browserNotification??s.browserNotification,customSoundUrl:l.customSoundUrl!==void 0?l.customSoundUrl:s.customSoundUrl}:s}const ki=Xn((e,r)=>({settings:Pd,loaded:!1,load:()=>{ei.getState().getSetting(Jr.NOTIFICATION_SETTINGS);const s=ei.subscribe(h=>{const m=h.settings[Jr.NOTIFICATION_SETTINGS];if(m!==void 0)try{const o=JSON.parse(m);e({settings:hx(o),loaded:!0})}catch{e({loaded:!0})}}),l=ei.getState().settings[Jr.NOTIFICATION_SETTINGS];if(l)try{const h=JSON.parse(l);e({settings:hx(h),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),hd(i)},updateEvent:(i,s)=>{const l=r().settings,h={...l,events:{...l.events,[i]:{...l.events[i],...s}}};e({settings:h}),hd(h)},updateAgentOverride:(i,s,l)=>{var d;const h=r().settings,m={...h.agentOverrides};if(l===null){if(m[i]){const f={...m[i]};delete f[s],Object.keys(f).length===0?delete m[i]:m[i]=f}}else m[i]={...m[i],[s]:{...((d=m[i])==null?void 0:d[s])??{},...l}};const o={...h,agentOverrides:m};e({settings:o}),hd(o)}}));function hd(e){ei.getState().setSetting(Jr.NOTIFICATION_SETTINGS,JSON.stringify(e))}function hx(e){var r,i,s,l,h;return{soundEnabled:e.soundEnabled??Pd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Pd.browserNotificationEnabled,events:{complete:{...rr,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...rr,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...rr,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...rr,...(l=e.events)==null?void 0:l.phase_blocked},new_message:{...rr,...(h=e.events)==null?void 0:h.new_message}},agentOverrides:e.agentOverrides??{}}}const fx=new Map;function F1(e){let r=fx.get(e);return r||(r=new Audio(e),r.volume=.5,fx.set(e,r)),r}let Jv=typeof Notification<"u"?Notification.permission:"denied";function U1(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(Jv=e,e))}const $1={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},q1={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 W1(e){typeof Notification>"u"||Jv==="granted"&&(document.hasFocus()||new Notification($1[e],{body:q1[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function qa(e,r){const{settings:i}=ki.getState(),s=Qv(i,e,r);if(i.soundEnabled&&s.soundEnabled){const l=s.customSoundUrl??lh[e],h=F1(l);h.currentTime=0,h.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&W1(e)}const G1=e=>qa("complete",e),V1=e=>qa("phase_done",e),Y1=e=>qa("phase_blocked",e),px=e=>qa("waiting_for_user",e),mx=e=>qa("new_message",e);let fd=!1;const ka=new Set,Bt={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let ks=null,nn=null;function pd(){ks===null&&(ks=requestAnimationFrame(()=>{ks=null,nn==null||nn()}))}function _i(){ks!==null&&(cancelAnimationFrame(ks),ks=null)}function Dt(e,r){return r!==null&&e.sessionId===r}function K1(e,r,i){return e.id!==void 0||Dt(e,r)||i===!0&&e.sessionId!==void 0}function X1(e,r){return e.includes(r)?e:[...e,r]}function Ea(e,r){return e.filter(i=>i!==r)}function Z1(e,r){const i=e.find(l=>l.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(l=>l.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(l=>l.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(l=>l.id===r.id?s:l):[s,...e]}function Q1(e,r,i){return e.map(s=>{const l=(i==null?void 0:i.id)===s.id?i:null,h=r.find(m=>m.id===s.id);return{...s,title:s.title??(h==null?void 0:h.title),mode:(l==null?void 0:l.mode)??(h==null?void 0:h.mode)??s.mode,phase:(l==null?void 0:l.phase)??(h==null?void 0:h.phase)??s.phase,isRunning:(l==null?void 0:l.isRunning)??(h==null?void 0:h.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const gx=new Map;function ws(e,r){var h;const i=r===((h=e.currentSession)==null?void 0:h.id)?e.currentSession:null,s=e.sessions.find(m=>m.id===r),l=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return l==="planner"?"planner":l==="builder"?"build":"planner"}function J1(e,r){if(e.type==="chat.done"){const i=e.payload,s=ws(r,e.sessionId);i.reason==="complete"&&G1(s),i.reason==="waiting_for_user"&&px(s);return}if(e.type==="chat.path_confirmation"){const i=ws(r,e.sessionId);px(i);return}if(e.type==="task.completed"){const i=ws(r,e.sessionId);V1(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=gx.get(e.sessionId)??null;if(gx.set(e.sessionId,i.phase),s===i.phase)return;const l=ws(r,e.sessionId);i.phase==="blocked"&&Y1(l)}}const Ee=Xn((e,r)=>(nn=()=>{const i=Bt;if(!i.messageId)return;const s=i.deltaContent.length>0,l=i.thinkingContent.length>0,h=i.toolOutput.length>0;if(!s&&!l&&!h)return;const m=i.deltaContent,o=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(f=>{var p;const g=f.streamingMessage;if(g&&g.id===i.messageId){let v={...g};if(s&&(v.content=v.content+m),l&&(v.thinkingContent=(v.thinkingContent??"")+o),h){const S=new Set;v.toolCalls=(p=v.toolCalls)==null?void 0:p.map(C=>{const b=d.filter(_=>_.callId===C.id);return b.length===0?C:(S.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...b.map(_=>({stream:_.stream,content:_.content}))]})});const E=d.filter(C=>!S.has(C.callId));E.length>0&&Bt.toolOutput.push(...E)}return{streamingMessage:v}}if(h){const v=new Set,S=f.messages.map(C=>{var _;if(C.id!==i.messageId)return C;const b=(_=C.toolCalls)==null?void 0:_.map(x=>{const y=d.filter(j=>j.callId===x.id);return y.length===0?x:(v.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...y.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:b}}),E=d.filter(C=>!v.has(C.callId));return E.length>0&&Bt.toolOutput.push(...E),{messages:S}}return f})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,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 Se("/api/auth")).json()).requiresAuth}catch{}if(s&&!Pt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Pt.onStatusChange(l=>{e({connectionStatus:l}),l==="connected"&&r().listSessions(void 0)});try{if(await Pt.connect(),!fd){fd=!0;const l=r().handleServerMessage;Pt.subscribe(l)}}catch(l){console.error("Failed to connect:",l);const h=Pt.getLastCloseCode();if(!Pt.hasToken()&&(h===1006||h===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}e({connectionStatus:"disconnected"})}},disconnect:()=>{Pt.disconnect(),fd=!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:l}=await s.json();Pt.setToken(l),e({showPasswordModal:!1,connectionStatus:"disconnected"});const{listProjects:h}=Ft.getState(),{fetchConfig:m}=Gt.getState();h(),m(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Pt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const l=await Se("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!l.ok)return e({pendingSessionCreate:!1}),null;const h=await l.json();return Pt.send("session.load",{sessionId:h.session.id}),h.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(_i(),e({currentSession:null,unreadSessionIds:Ea(r().unreadSessionIds,i),messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Ea(r().unreadSessionIds,i)});const l=await Se(`/api/sessions/${i}`);if(!l.ok)return;const h=await l.json();e({currentSession:h.session,messages:h.messages??[],contextState:h.contextState,queuedMessages:h.queueState??[]}),Pt.send("session.load",{sessionId:i})}catch{}},listSessions:async(i,s=20)=>{try{const l=new URLSearchParams;l.set("limit",String(s)),i&&l.set("projectId",i);const m=await(await Se(`/api/sessions?${l.toString()}`)).json();e({sessions:m.sessions??[],sessionsHasMore:i?m.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const l=new URLSearchParams;l.set("limit","20"),l.set("offset",String(s.sessions.length)),l.set("projectId",i);const m=await(await Se(`/api/sessions?${l.toString()}`)).json();e(o=>({sessions:[...o.sessions,...m.sessions??[]],sessionsHasMore:m.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await Se(`/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 Se(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{_i(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Ea(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,l)=>{var m;const h=(m=r().currentSession)==null?void 0:m.id;if(h){e({streamingMessageId:null});try{const d=await(await Se(`/api/sessions/${h}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l==null?void 0:l.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error sending message:",o)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){_i(),nn==null||nn(),e({abortInProgress:!0});try{await Se(`/api/sessions/${i}/stop`,{method:"POST"})}catch(l){console.error("Error stopping generation:",l)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await Se(`/api/sessions/${i}/continue`,{method:"POST"})}catch(l){console.error("Error continuing generation:",l)}}},launchRunner:(i,s,l)=>{e({streamingMessageId:null});const h={};i!=null&&i.trim()&&(h.content=i),s&&s.length>0&&(h.attachments=s),l&&(h.workflowId=l),Pt.send("runner.launch",h)},switchMode:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const h=await Se(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!h.ok){console.error("Failed to switch mode:",await h.json());return}const m=await h.json();m.session&&e({currentSession:m.session})}catch(h){console.error("Error switching mode:",h)}},switchDangerLevel:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const h=await Se(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!h.ok){console.error("Failed to switch danger level:",await h.json());return}const m=await h.json();m.session&&e({currentSession:m.session})}catch(h){console.error("Error switching danger level:",h)}},acceptAndBuild:(i,s,l)=>{e({streamingMessageId:null});const h={};i&&(h.workflowId=i),s!=null&&s.trim()&&(h.content=s),l&&l.length>0&&(h.attachments=l),Pt.send("mode.accept",h)},editCriteria:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const h=await Se(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});h.ok||console.error("Failed to update criteria:",await h.json())}catch(h){console.error("Error updating criteria:",h)}},compactContext:()=>{Pt.send("context.compact",{})},setSessionProvider:async(i,s)=>{var l;try{const h=(l=r().currentSession)==null?void 0:l.id;if(!h)return null;const m=await Se(`/api/sessions/${h}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!m.ok)return null;const o=await m.json();return e({currentSession:o.session,messages:o.messages??[],contextState:o.contextState}),o.session}catch{return null}},updateContextState:i=>{e({contextState:i})},confirmPath:async(i,s,l=!1)=>{var m;const h=(m=r().currentSession)==null?void 0:m.id;if(h)try{await Se(`/api/sessions/${h}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:l})})}catch(o){console.error("Error confirming path:",o)}},answerQuestion:async(i,s)=>{var h;const l=(h=r().currentSession)==null?void 0:h.id;if(l){try{await Se(`/api/sessions/${l}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(m){console.error("Error answering question:",m)}e({pendingQuestion:null})}},queueAsap:async(i,s,l)=>{var m;const h=(m=r().currentSession)==null?void 0:m.id;if(h)try{const d=await(await Se(`/api/sessions/${h}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error queueing ASAP message:",o)}},queueCompletion:async(i,s,l)=>{var m;const h=(m=r().currentSession)==null?void 0:m.id;if(h)try{const d=await(await Se(`/api/sessions/${h}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:l})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(o){console.error("Error queueing completion message:",o)}},cancelQueued:async i=>{var l;const s=(l=r().currentSession)==null?void 0:l.id;if(s)try{const m=await(await Se(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();m.queueState&&e({queuedMessages:m.queueState})}catch(h){console.error("Error canceling queued message:",h)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var m,o,d,f,g,p,v,S,E,C,b,_,x,y,j,A,N,R,T,B,H,G,Y,q;const s=r();J1(i,s);const l=((m=s.currentSession)==null?void 0:m.id)??null,h=()=>{const O=i.sessionId;!O||O===l||e(W=>({unreadSessionIds:X1(W.unreadSessionIds,O)}))};switch(i.type){case"session.state":{const O=i.payload;if(!K1(i,l,s.pendingSessionCreate))break;_i();const W=O.messages.find(D=>D.isStreaming)??null,V=r().pendingSessionCreate===!0,Q=O.pendingConfirmations??[],L=s.pendingPathConfirmation??(Q.length>0?Q[0]??null:null);if(e({currentSession:O.session,sessions:Z1(r().sessions,O.session),unreadSessionIds:Ea(r().unreadSessionIds,O.session.id),messages:O.messages,streamingMessageId:(W==null?void 0:W.id)??null,streamingMessage:W,currentTodos:[],pendingPathConfirmation:L,error:null,...V?{pendingSessionCreate:O.session.id}:{}}),O.session.providerId&&O.session.providerModel){const D=Gt.getState();D.providers.find(U=>U.id===O.session.providerId)&&D.syncFromSession(O.session.providerId,O.session.providerModel)}break}case"session.list":{const O=i.payload;e(W=>({sessions:Q1(O.sessions,W.sessions,W.currentSession)}));break}case"session.deleted":{const O=i.payload;e(W=>({unreadSessionIds:Ea(W.unreadSessionIds,O.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const O=i.payload,W=i.sessionId,V=(o=r().currentSession)==null?void 0:o.id,Q=W&&W!==V;e(ee=>({sessions:ee.sessions.map(L=>L.id===W?{...L,isRunning:O.isRunning}:L)})),Q||e(ee=>({currentSession:ee.currentSession?{...ee.currentSession,isRunning:O.isRunning}:null,...O.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!Dt(i,((d=r().currentSession)==null?void 0:d.id)??null)){h();break}const O=i.payload;e(W=>W.messages.some(V=>V.id===O.message.id)?W:{messages:[...W.messages,O.message],streamingMessageId:O.message.isStreaming?O.message.id:W.streamingMessageId,streamingMessage:O.message.isStreaming?O.message:W.streamingMessage});break}case"chat.message_updated":{if(!Dt(i,((f=r().currentSession)==null?void 0:f.id)??null)){h();break}const O=i.payload,W=O.updates.isStreaming===!1&&r().streamingMessageId===O.messageId;W&&(_i(),nn==null||nn()),e(V=>{const Q=V.streamingMessage,ee=W;if(Q&&Q.id===O.messageId){const L={...Q,...O.updates};return{messages:V.messages.map(D=>D.id===O.messageId?L:D),streamingMessageId:ee?null:V.streamingMessageId,streamingMessage:ee?null:{...Q,...O.updates}}}return{messages:V.messages.map(L=>L.id===O.messageId?{...L,...O.updates}:L),streamingMessageId:ee?null:V.streamingMessageId}});break}case"chat.delta":{if(!Dt(i,((g=r().currentSession)==null?void 0:g.id)??null)){h();break}const O=i.payload;if(!ka.has(O.messageId)){ka.add(O.messageId);const W=ws(r(),i.sessionId);mx(W)}Bt.messageId=O.messageId,Bt.deltaContent+=O.content,pd();break}case"chat.thinking":{if(!Dt(i,((p=r().currentSession)==null?void 0:p.id)??null)){h();break}const O=i.payload;if(!ka.has(O.messageId)){ka.add(O.messageId);const W=ws(r(),i.sessionId);mx(W)}Bt.messageId=O.messageId,Bt.thinkingContent+=O.content,pd();break}case"chat.tool_preparing":{if(!Dt(i,((v=r().currentSession)==null?void 0:v.id)??null)){h();break}const O=i.payload;e(W=>{const V=W.streamingMessage;return V&&V.id===O.messageId?{streamingMessage:{...V,preparingToolCalls:[...V.preparingToolCalls??[],{index:O.index,name:O.name}]}}:{messages:W.messages.map(Q=>Q.id===O.messageId?{...Q,preparingToolCalls:[...Q.preparingToolCalls??[],{index:O.index,name:O.name}]}:Q)}});break}case"chat.tool_call":{if(!Dt(i,((S=r().currentSession)==null?void 0:S.id)??null)){h();break}const O=i.payload,W=V=>{var L;const Q=(L=V.preparingToolCalls)==null?void 0:L.filter((D,I)=>{var U;return D.name===O.tool?(U=V.preparingToolCalls)==null?void 0:U.slice(0,I).some(K=>K.name===O.tool):!0}),ee=Bt.toolOutput.filter(D=>D.callId===O.callId);return ee.length>0&&(Bt.toolOutput=Bt.toolOutput.filter(D=>D.callId!==O.callId)),{...V,toolCalls:[...V.toolCalls??[],{id:O.callId,name:O.tool,arguments:O.args,startedAt:Date.now(),...ee.length>0?{streamingOutput:ee.map(D=>({stream:D.stream,content:D.content}))}:{}}],...Q&&Q.length>0?{preparingToolCalls:Q}:{preparingToolCalls:void 0}}};e(V=>{const Q=V.streamingMessage;return Q&&Q.id===O.messageId?{streamingMessage:W(Q)}:{messages:V.messages.map(ee=>ee.id===O.messageId?W(ee):ee)}});break}case"chat.tool_output":{if(!Dt(i,((E=r().currentSession)==null?void 0:E.id)??null)){h();break}const O=i.payload;Bt.messageId=O.messageId,Bt.toolOutput.push({messageId:O.messageId,callId:O.callId,stream:O.stream,content:O.output}),pd();break}case"chat.tool_result":{if(!Dt(i,((C=r().currentSession)==null?void 0:C.id)??null)){h();break}const O=i.payload,W=V=>{var ee;const Q=(ee=V.toolCalls)==null?void 0:ee.map(L=>L.id===O.callId?{...L,result:O.result}:L);return{...V,toolCalls:Q}};e(V=>{const Q=V.streamingMessage;return Q&&Q.id===O.messageId?{streamingMessage:W(Q)}:{messages:V.messages.map(ee=>ee.id===O.messageId?W(ee):ee)}});break}case"chat.vision_fallback":{if(!Dt(i,((b=r().currentSession)==null?void 0:b.id)??null)){h();break}const O=i.payload;e(W=>{const V=`${O.messageId}-${O.attachmentId}`,Q={...W.visionFallbackByMessage};return Q[V]={type:O.type,attachmentId:O.attachmentId,filename:O.filename,description:O.description},{visionFallbackByMessage:Q}});break}case"chat.todo":{if(!Dt(i,((_=r().currentSession)==null?void 0:_.id)??null)){h();break}const O=i.payload;e({currentTodos:O.todos});break}case"chat.summary":{if(!Dt(i,((x=r().currentSession)==null?void 0:x.id)??null)){h();break}const O=i.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,summary:O.summary}:null}));break}case"chat.progress":{if(!Dt(i,((y=r().currentSession)==null?void 0:y.id)??null)){h();break}const O=i.payload;console.log("Progress:",O.message,O.phase);break}case"chat.format_retry":{if(!Dt(i,((j=r().currentSession)==null?void 0:j.id)??null)){h();break}const O=i.payload;console.log("Format retry:",O.attempt,"/",O.maxAttempts);break}case"chat.done":{if(!Dt(i,((A=r().currentSession)==null?void 0:A.id)??null)){h();break}_i(),nn==null||nn();const O=i.payload,W=O.stats;Bt.messageId=null,Bt.deltaContent="",Bt.thinkingContent="",Bt.toolOutput=[],ka.delete(O.messageId),e(V=>{const Q=V.streamingMessage,ee=Q&&Q.id===O.messageId?{...Q,isStreaming:!1,stats:W??Q.stats}:null;return{messages:V.messages.map(L=>L.id===O.messageId?ee??{...L,isStreaming:!1,stats:W??L.stats}:L),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!Dt(i,((N=r().currentSession)==null?void 0:N.id)??null)){h();break}_i(),nn==null||nn();const O=i.payload;console.error("Chat error:",O.error,"recoverable:",O.recoverable),O.recoverable||(Bt.messageId=null,Bt.deltaContent="",Bt.thinkingContent="",Bt.toolOutput=[]),e(W=>({error:{code:"CHAT_ERROR",message:O.error},streamingMessageId:O.recoverable?W.streamingMessageId:null,...O.recoverable?{}:{messages:W.streamingMessage?W.messages.map(V=>V.id===W.streamingMessage.id?W.streamingMessage:V):W.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!Dt(i,((R=r().currentSession)==null?void 0:R.id)??null)){h();break}const O=i.payload;e({pendingPathConfirmation:{callId:O.callId,tool:O.tool,paths:O.paths,workdir:O.workdir,reason:O.reason}});break}case"chat.ask_user":{if(!Dt(i,((T=r().currentSession)==null?void 0:T.id)??null)){h();return}const O=i.payload;e({pendingQuestion:{callId:O.callId,question:O.question}});break}case"mode.changed":{if(!Dt(i,((B=r().currentSession)==null?void 0:B.id)??null)){h();break}const O=i.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,mode:O.mode}:null}));break}case"phase.changed":{const O=i.payload,W=i.sessionId,V=(H=r().currentSession)==null?void 0:H.id,Q=W&&W!==V;e(ee=>({sessions:ee.sessions.map(L=>L.id===W?{...L,phase:O.phase}:L)})),Q||e(ee=>({currentSession:ee.currentSession?{...ee.currentSession,phase:O.phase}:null}));break}case"criteria.updated":{if(!Dt(i,((G=r().currentSession)==null?void 0:G.id)??null)){h();break}const O=i.payload;e(W=>({currentSession:W.currentSession?{...W.currentSession,criteria:O.criteria}:null}));break}case"context.state":{if(!Dt(i,((Y=r().currentSession)==null?void 0:Y.id)??null)){h();break}const O=i.payload;console.log("[session.handleServerMessage.context.state] Received context state:",O.context),e({contextState:O.context});break}case"session.name_generated":{const O=i.payload,W=i.sessionId,V=(q=r().currentSession)==null?void 0:q.id;e(Q=>{const ee=Q.sessions.map(D=>D.id===W?{...D,title:O.name,updatedAt:new Date().toISOString()}:D),L=V===W?Q.currentSession?{...Q.currentSession,title:O.name,updatedAt:new Date().toISOString()}:null:Q.currentSession;return{sessions:ee,currentSession:L}});break}case"queue.state":{const O=i.payload;e({queuedMessages:O.messages});break}case"devServer.output":case"devServer.state":{nr.getState().handleMessage(i);break}case"error":{const O=i.payload;console.error("Server error:",O),e({error:{code:O.code,message:O.message},streamingMessageId:null});break}}}}));function e0(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function eS(){return Ee(e=>e.queuedMessages)}function tS(){return Ee(e=>e.abortInProgress)}function nS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=ki(s=>s.load);return F.useEffect(()=>{e()},[e]),F.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Fd(){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 xx(e,r){const i=Pt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Fd(),type:e,payload:r}))}const ir=Xn((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 Se("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const l=Pt.ws;if(l&&l.readyState===WebSocket.OPEN)for(const h of s)l.send(JSON.stringify({id:Fd(),type:"terminal.subscribe",payload:{sessionId:h.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Se("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const l=await s.json();e(m=>({sessions:[...m.sessions,l]}));const h=Pt.ws;h&&h.readyState===WebSocket.OPEN&&h.send(JSON.stringify({id:Fd(),type:"terminal.subscribe",payload:{sessionId:l.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{xx("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,l)=>{xx("terminal.resize",{sessionId:i,cols:s,rows:l})},killSession:async i=>{try{(await Se(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(l=>({sessions:l.sessions.filter(h=>h.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(l=>{const h=l.sessions.filter(m=>m.id!==s);return h.length===0&&l.isOpen?{sessions:[],isOpen:!1}:{sessions:h}});break}}}}));Pt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&ir.getState().handleMessage(e)});var ch=$v();function un({isOpen:e,onClose:r,title:i,children:s,size:l="md"}){const h=F.useRef(null),m=F.useRef(null),o=F.useCallback(f=>{f.key==="Escape"&&r()},[r]);if(F.useEffect(()=>{var f,g;return e?(m.current=document.activeElement,(f=h.current)==null||f.focus(),document.body.style.overflow="hidden"):((g=m.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),F.useEffect(()=>{if(e)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e,o]),!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 ch.createPortal(c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[c.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),c.jsxs("div",{ref:h,tabIndex:-1,className:`relative w-full ${d[l]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[c.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),c.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const ht=F.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...l},h)=>{const m="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",o={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 c.jsx("button",{ref:h,className:`${m} ${o[e]} ${d[r]} ${i}`,...l,children:s})});ht.displayName="Button";function rS(e){const r=new Audio(e);r.volume=.5,r.play().catch(()=>{})}function t0({value:e,defaultUrl:r,disabled:i,onChange:s}){const l=e??r;return c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("select",{value:l,disabled:i,onChange:h=>{const m=h.target.value;s(m===r?null:m)},className:"px-2 py-1 text-xs bg-bg-tertiary border border-border rounded focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40",children:P1.map(({url:h,label:m})=>c.jsxs("option",{value:h,children:[m,h===r?" (default)":""]},h))}),c.jsx("button",{onClick:()=>rS(l),disabled:i,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary disabled:opacity-40 disabled:cursor-not-allowed transition-colors",title:"Preview sound",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072M17.95 6.05a8 8 0 010 11.9M6.5 8.8h-2a1 1 0 00-1 1v4.4a1 1 0 001 1h2l4.5 3.5V5.3L6.5 8.8z"})})})]})}function iS(){const e=ki(d=>d.settings),r=ki(d=>d.update),i=ki(d=>d.updateEvent),s=ki(d=>d.updateAgentOverride),l=ki(d=>d.load),[h,m]=F.useState(null);F.useEffect(()=>{l()},[l]);const o=async()=>{await U1()==="granted"&&r({...e,browserNotificationEnabled:!0})};return c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),c.jsx(vx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),c.jsx(vx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?o():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&c.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Event Configuration"}),dx.map(({key:d,label:f,description:g})=>c.jsx(sS,{event:d,label:f,description:g,config:e.events[d],onUpdate:p=>i(d,p),soundMasterEnabled:e.soundEnabled,browserMasterEnabled:e.browserNotificationEnabled},d))]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Per-Agent Overrides"}),c.jsx("p",{className:"text-xs text-text-muted",children:"Override notification settings for specific agent types. Unconfigured events use the global defaults above."}),H1.map(({key:d,label:f})=>c.jsxs("div",{className:"border border-border rounded",children:[c.jsxs("button",{className:"w-full flex items-center justify-between px-3 py-2 text-sm text-text-secondary hover:bg-bg-tertiary transition-colors rounded",onClick:()=>m(h===d?null:d),children:[c.jsx("span",{className:"font-medium",children:f}),c.jsx("svg",{className:`w-4 h-4 transition-transform ${h===d?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h===d&&c.jsx("div",{className:"px-3 pb-3 space-y-3 border-t border-border pt-2",children:dx.map(({key:g,label:p})=>{var b;const v=(b=e.agentOverrides[d])==null?void 0:b[g],S=v!==void 0,E=Qv(e,g,d),C=lh[g];return c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("input",{type:"checkbox",checked:S,onChange:_=>{_.target.checked?s(d,g,{soundEnabled:E.soundEnabled,browserNotification:E.browserNotification}):s(d,g,null)},className:"rounded border-border"}),c.jsx("span",{className:`flex-1 ${S?"text-text-primary":"text-text-muted"}`,children:p}),S&&c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:E.soundEnabled,onChange:_=>s(d,g,{soundEnabled:_.target.checked}),className:"rounded border-border"}),"Sound"]}),c.jsxs("label",{className:"flex items-center gap-1 text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:E.browserNotification,onChange:_=>s(d,g,{browserNotification:_.target.checked}),className:"rounded border-border"}),"Browser"]})]})]}),S&&E.soundEnabled&&c.jsx("div",{className:"ml-6",children:c.jsx(t0,{value:(v==null?void 0:v.customSoundUrl)??null,defaultUrl:C,onChange:_=>s(d,g,{customSoundUrl:_})})})]},g)})})]},d))]})]})}function vx({label:e,description:r,checked:i,onChange:s}){return c.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[c.jsx("div",{className:"pt-0.5",children:c.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:l=>{l.preventDefault(),s(!i)},children:c.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"}`})})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),c.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}function sS({event:e,label:r,description:i,config:s,onUpdate:l,soundMasterEnabled:h,browserMasterEnabled:m}){return c.jsxs("div",{className:"border border-border rounded px-3 py-2 space-y-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm text-text-primary",children:r}),c.jsx("div",{className:"text-xs text-text-muted",children:i})]}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:s.soundEnabled,onChange:o=>l({soundEnabled:o.target.checked}),disabled:!h,className:"rounded border-border"}),"Sound ",!h&&c.jsx("span",{className:"text-text-muted",children:"(master off)"})]}),c.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("input",{type:"checkbox",checked:s.browserNotification,onChange:o=>l({browserNotification:o.target.checked}),disabled:!m,className:"rounded border-border"}),"Browser notification ",!m&&c.jsx("span",{className:"text-text-muted",children:"(master off)"})]})]}),s.soundEnabled&&c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs text-text-muted",children:"Sound:"}),c.jsx(t0,{value:s.customSoundUrl,defaultUrl:lh[e],disabled:!h,onChange:o=>l({customSoundUrl:o})})]})]})}const n0=F.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},l)=>c.jsx("button",{ref:l,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:c.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));n0.displayName="IconButton";const aS="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",ni=F.forwardRef((e,r)=>c.jsx(n0,{ref:r,icon:aS,title:"Edit",...e}));ni.displayName="EditButton";const Vn=Xn((e,r)=>({skills:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await Se("/api/skills/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchSkills:async()=>{e({loading:!0});try{const s=await(await Se("/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 l=await(await Se(`/api/skills/${i}/toggle`,{method:"POST"})).json();e({skills:r().skills.map(h=>h.id===i?{...h,enabled:l.enabled}:h)})}catch{}},fetchSkill:async i=>{try{const s=await Se(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{try{const s=await Se("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateSkill:async(i,s)=>{try{const l=await Se(`/api/skills/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteSkill:async i=>{try{return(await Se(`/api/skills/${i}`,{method:"DELETE"})).ok?(e({skills:r().skills.filter(l=>l.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await Se(`/api/skills/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await Se("/api/skills/restore-all-defaults",{method:"POST"})).ok?(await r().fetchSkills(),!0):!1}catch{return!1}}}));function oS(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function lS({isOpen:e}){const r=Vn(Z=>Z.skills),i=Vn(Z=>Z.modifiedIds),s=Vn(Z=>Z.loading),l=Vn(Z=>Z.fetchSkills),h=Vn(Z=>Z.toggleSkill),m=Vn(Z=>Z.fetchSkill),o=Vn(Z=>Z.createSkill),d=Vn(Z=>Z.updateSkill),f=Vn(Z=>Z.deleteSkill),g=Vn(Z=>Z.restoreDefault),p=Vn(Z=>Z.restoreAllDefaults),[v,S]=F.useState("list"),[E,C]=F.useState(null),[b,_]=F.useState(null),[x,y]=F.useState(""),[j,A]=F.useState(""),[N,R]=F.useState(""),[T,B]=F.useState("1.0.0"),[H,G]=F.useState(""),[Y,q]=F.useState(""),[O,W]=F.useState(!1),[V,Q]=F.useState(null),[ee,L]=F.useState(!1);F.useEffect(()=>{e&&(l(),S("list"),C(null),_(null),Q(null),L(!1))},[e,l]);const D=()=>{C(null),y(""),A(""),R(""),B("1.0.0"),G(""),q(""),S("edit")},I=async Z=>{const X=await m(Z);X&&(C(Z),y(X.metadata.name),A(X.metadata.id),R(X.metadata.description),B(X.metadata.version),G(X.prompt),q(""),S("edit"))},U=async Z=>{await f(Z),_(null)},P=async()=>{const Z=E??j;if(!Z||!x||!H){q("Name and prompt are required.");return}W(!0),q("");const X={metadata:{id:Z,name:x,description:N,version:T||"1.0.0"},prompt:H},z=E?await d(E,X):await o(X);if(W(!1),!z.success){q(z.error??"Failed to save skill.");return}S("list")},K=()=>{S("list")},te=Z=>{y(Z),E||A(oS(Z))};return v==="edit"?c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("button",{onClick:K,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Back to list",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),c.jsx("span",{className:"text-sm font-medium text-text-primary",children:E?"Edit Skill":"New Skill"})]}),Y&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:Y}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:x,onChange:Z=>te(Z.target.value),placeholder:"My Skill",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",E&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:j,onChange:Z=>!E&&A(Z.target.value),readOnly:!!E,placeholder:"my-skill",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${E?"opacity-60":""}`})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),c.jsx("input",{value:N,onChange:Z=>R(Z.target.value),placeholder:"Short description of what this skill provides",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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Version"}),c.jsx("input",{value:T,onChange:Z=>B(Z.target.value),placeholder:"1.0.0",className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary"})]})]})]}),c.jsxs("div",{className:"flex-1 min-h-[150px] mt-3 overflow-hidden",children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),c.jsx("textarea",{value:H,onChange:Z=>G(Z.target.value),placeholder:"Instructions the agent receives when this skill is loaded...",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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[c.jsx(ht,{variant:"secondary",onClick:K,children:"Cancel"}),c.jsx(ht,{variant:"primary",onClick:P,disabled:O||!x||!H,children:O?"Saving...":"Save"})]})]}):c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Skills provide domain-specific knowledge that agents can load on demand."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[i.length>0&&(ee?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await p(),L(!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"}),c.jsx("button",{onClick:()=>L(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>L(!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 skills to defaults",children:"Restore Defaults"})),c.jsx(ht,{variant:"primary",size:"sm",onClick:D,children:"+ New"})]})]}),s&&r.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading skills..."}):r.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No skills installed."}):c.jsx("div",{className:"space-y-2",children:r.map(Z=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:Z.name}),c.jsxs("span",{className:"text-text-muted text-xs",children:["v",Z.version]}),i.includes(Z.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:Z.description})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i.includes(Z.id)&&(V===Z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await g(Z.id),Q(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"}),c.jsx("button",{onClick:()=>Q(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Q(Z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(ni,{onClick:()=>I(Z.id)}),b===Z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>U(Z.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:()=>_(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>_(Z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete skill",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("button",{onClick:()=>h(Z.id),className:`relative w-9 h-5 rounded-full transition-colors flex-shrink-0 ml-1 ${Z.enabled?"bg-accent-primary":"bg-bg-primary"}`,title:Z.enabled?"Disable skill":"Enable skill",children:c.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Z.enabled?"translate-x-4":"translate-x-0"}`})})]})]},Z.id))})]})}function cS({isOpen:e,onClose:r}){const[i,s]=F.useState("instructions");return c.jsx(un,{isOpen:e,onClose:r,title:"Settings",size:"lg",children:c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[c.jsx(md,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),c.jsx(md,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),c.jsx(md,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")})]}),i==="instructions"&&c.jsx(uS,{isOpen:e}),i==="skills"&&c.jsx(lS,{isOpen:e}),i==="notifications"&&c.jsx(iS,{})]})})}function md({label:e,active:r,onClick:i}){return c.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=ei(b=>b.settings),i=ei(b=>b.loading),s=ei(b=>b.getSetting),l=ei(b=>b.setSetting),h=r[Jr.GLOBAL_INSTRUCTIONS]??"",m=i[Jr.GLOBAL_INSTRUCTIONS]??!1,[o,d]=F.useState(h),[f,g]=F.useState(!1),[p,v]=F.useState(!1);F.useEffect(()=>{e&&s(Jr.GLOBAL_INSTRUCTIONS)},[e,s]),F.useEffect(()=>{d(h),g(!1)},[h]);const S=async()=>{v(!0),l(Jr.GLOBAL_INSTRUCTIONS,o),v(!1),g(!1)},E=()=>{d(h),g(!1)},C=m||p;return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),c.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),c.jsx("textarea",{value:o,onChange:b=>{d(b.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})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(ht,{variant:"secondary",onClick:E,disabled:!f,children:"Discard"}),c.jsx(ht,{variant:"primary",onClick:S,disabled:!f||C,children:p?"Saving...":"Save"})]})]})}var gd={exports:{}},bx;function dS(){return bx||(bx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(m,o,d){var f=this&&this.__decorate||function(x,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,j,A);else for(var B=x.length-1;B>=0;B--)(N=x[B])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(x,y){return function(j,A){y(j,A,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const p=d(9042),v=d(9924),S=d(844),E=d(4725),C=d(2585),b=d(3656);let _=o.AccessibilityManager=class extends S.Disposable{constructor(x,y,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 v.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,b.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 y=0;y<x;y++)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+=p.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,y){this._liveRegionDebouncer.refresh(x,y,this._terminal.rows)}_renderRows(x,y){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=x;N<=y;N++){const R=j.lines.get(j.ydisp+N),T=[],B=(R==null?void 0:R.translateToString(!0,void 0,void 0,T))||"",H=(j.ydisp+N+1).toString(),G=this._rowElements[N];G&&(B.length===0?(G.innerText=" ",this._rowColumns.set(G,[0,1])):(G.textContent=B,this._rowColumns.set(G,T)),G.setAttribute("aria-posinset",H),G.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,y){const j=x.target,A=this._rowElements[y===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==A)return;let N,R;if(y===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),y===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(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var B;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 y={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((y.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===j.node&&y.offset>j.offset)&&([y,j]=[j,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.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:((B=A.textContent)==null?void 0:B.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:H,offset:G})=>{const Y=H instanceof Text?H.parentNode:H;let q=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(Y);if(!O)return console.warn("columns is null. Race condition?"),null;let W=G<O.length?O[G]:O.slice(-1)[0]+1;return W>=this._terminal.cols&&(++q,W=0),{row:q,column:W}},R=N(y),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 y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);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`}};o.AccessibilityManager=_=f([g(1,C.IInstantiationService),g(2,E.ICoreBrowserService),g(3,E.IRenderService)],_)},3614:(m,o)=>{function d(v){return v.replace(/\r?\n/g,"\r")}function f(v,S){return S?"\x1B[200~"+v+"\x1B[201~":v}function g(v,S,E,C){v=f(v=d(v),E.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),E.triggerDataEvent(v,!0),S.value=""}function p(v,S,E){const C=E.getBoundingClientRect(),b=v.clientX-C.left-10,_=v.clientY-C.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${b}px`,S.style.top=`${_}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=d,o.bracketTextForPaste=f,o.copyHandler=function(v,S){v.clipboardData&&v.clipboardData.setData("text/plain",S.selectionText),v.preventDefault()},o.handlePasteEvent=function(v,S,E,C){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),S,E,C)},o.paste=g,o.moveTextAreaUnderMouseCursor=p,o.rightClickHandler=function(v,S,E,C,b){p(v,S,E),b&&C.rightClickSelect(v),S.value=C.selectionText,S.select()}},7239:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=d(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,p,v){this._css.set(g,p,v)}getCss(g,p){return this._css.get(g,p)}setColor(g,p,v){this._color.set(g,p,v)}getColor(g,p){return this._color.get(g,p)}clear(){this._color.clear(),this._css.clear()}}},3656:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(d,f,g,p){d.addEventListener(f,g,p);let v=!1;return{dispose:()=>{v||(v=!0,d.removeEventListener(f,g,p))}}}},3551:function(m,o,d){var f=this&&this.__decorate||function(_,x,y,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,x,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(R=(N<3?A(R):N>3?A(x,y,R):A(x,y))||R);return N>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(_,x){return function(y,j){x(y,j,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const p=d(3656),v=d(8460),S=d(844),E=d(2585),C=d(4725);let b=o.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(_,x,y,j,A){super(),this._element=_,this._mouseService=x,this._renderService=y,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.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,p.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const x=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const y=_.composedPath();for(let j=0;j<y.length;j++){const A=y[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(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,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);let y=!1;for(const[N,R]of this._linkProviderService.linkProviders.entries())x?(A=this._activeProviderReplies)!=null&&A.get(N)&&(y=this._checkLinkProviderResult(N,_,y)):R.provideLinks(_.y,(T=>{var H,G;if(this._isMouseOut)return;const B=T==null?void 0:T.map((Y=>({link:Y})));(H=this._activeProviderReplies)==null||H.set(N,B),y=this._checkLinkProviderResult(N,_,y),((G=this._activeProviderReplies)==null?void 0:G.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,x){const y=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<_?0:R.link.range.start.x,B=R.link.range.end.y>_?this._bufferService.cols:R.link.range.end.x;for(let H=T;H<=B;H++){if(y.has(H)){A.splice(N--,1);break}y.add(H)}}}}_checkLinkProviderResult(_,x,y){var N;if(!this._activeProviderReplies)return y;const j=this._activeProviderReplies.get(_);let A=!1;for(let R=0;R<_;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&&(y=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let R=0;R<this._activeProviderReplies.size;R++){const T=(N=this._activeProviderReplies.get(R))==null?void 0:N.find((B=>this._linkAtPosition(B.link,x)));if(T){y=!0,this._handleNewLink(T);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const x=this._positionFromMouseEvent(_,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,x){this._currentLink&&this._lastMouseEvent&&(!_||!x||this._currentLink.link.range.start.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(_){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(_.link,x)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.pointerCursor},set:y=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,j;return(j=(y=this._currentLink)==null?void 0:y.state)==null?void 0:j.decorations.underline},set:y=>{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)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const j=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+y.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(_,x,y){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&&_.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(y,x.text)}_fireUnderlineEvent(_,x){const y=_.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-j-1,y.end.x,y.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(_,x,y){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&&_.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(y,x.text)}_linkAtPosition(_,x){const y=_.range.start.y*this._bufferService.cols+_.range.start.x,j=_.range.end.y*this._bufferService.cols+_.range.end.x,A=x.y*this._bufferService.cols+x.x;return y<=A&&A<=j}_positionFromMouseEvent(_,x,y){const j=y.getCoords(_,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,x,y,j,A){return{x1:_,y1:x,x2:y,y2:j,cols:this._bufferService.cols,fg:A}}};o.Linkifier=b=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,E.IBufferService),g(4,C.ILinkProviderService)],b)},9042:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(m,o,d){var f=this&&this.__decorate||function(C,b,_,x){var y,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,_,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,_,A):y(b,_))||A);return j>3&&A&&Object.defineProperty(b,_,A),A},g=this&&this.__param||function(C,b){return function(_,x){b(_,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const p=d(511),v=d(2585);let S=o.OscLinkProvider=class{constructor(C,b,_){this._bufferService=C,this._optionsService=b,this._oscLinkService=_}provideLinks(C,b){var B;const _=this._bufferService.buffer.lines.get(C-1);if(!_)return void b(void 0);const x=[],y=this._optionsService.rawOptions.linkHandler,j=new p.CellData,A=_.getTrimmedLength();let N=-1,R=-1,T=!1;for(let H=0;H<A;H++)if(R!==-1||_.hasContent(H)){if(_.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(R===-1){R=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else R!==-1&&(T=!0);if(T||R!==-1&&H===A-1){const G=(B=this._oscLinkService.getLinkData(N))==null?void 0:B.uri;if(G){const Y={start:{x:R+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let q=!1;if(!(y!=null&&y.allowNonHttpProtocols))try{const O=new URL(G);["http:","https:"].includes(O.protocol)||(q=!0)}catch{q=!0}q||x.push({text:G,range:Y,activate:(O,W)=>y?y.activate(O,W,Y):E(0,W),hover:(O,W)=>{var V;return(V=y==null?void 0:y.hover)==null?void 0:V.call(y,O,W,Y)},leave:(O,W)=>{var V;return(V=y==null?void 0:y.leave)==null?void 0:V.call(y,O,W,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(R=H,N=j.extended.urlId):(R=-1,N=-1)}}b(x)}};function E(C,b){if(confirm(`Do you want to navigate to ${b}?
|
|
60
|
-
|
|
61
|
-
WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=S=f([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.IOscLinkService)],S)},6193:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.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:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=d(3614),g=d(3656),p=d(3551),v=d(9042),S=d(3730),E=d(1680),C=d(3107),b=d(5744),_=d(2950),x=d(1296),y=d(428),j=d(4269),A=d(5114),N=d(8934),R=d(3230),T=d(9312),B=d(4725),H=d(6731),G=d(8055),Y=d(8969),q=d(8460),O=d(844),W=d(6114),V=d(8437),Q=d(2584),ee=d(7399),L=d(5941),D=d(9074),I=d(2585),U=d(5435),P=d(4567),K=d(779);class te 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(X={}){super(X),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new O.MutableDisposable),this._onCursorMove=this.register(new q.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new q.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new q.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new q.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new q.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new q.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new q.EventEmitter),this._onBlur=this.register(new q.EventEmitter),this._onA11yCharEmitter=this.register(new q.EventEmitter),this._onA11yTabEmitter=this.register(new q.EventEmitter),this._onWillOpen=this.register(new q.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(D.DecorationService),this._instantiationService.setService(I.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(K.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(S.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((z,ae)=>this.refresh(z,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),this.register((0,q.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,q.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,q.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((z=>this._afterResize(z.cols,z.rows)))),this.register((0,O.toDisposable)((()=>{var z,ae;this._customKeyEventHandler=void 0,(ae=(z=this.element)==null?void 0:z.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const z of X){let ae,se="";switch(z.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;"+z.index}switch(z.type){case 0:const ge=G.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${se};${(0,L.toRgbString)(ge)}${Q.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((ve=>ve.ansi[z.index]=G.channels.toColor(...z.color)));else{const ve=ae;this._themeService.modifyColors((Ne=>Ne[ve]=G.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(P.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.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 X=this.buffer.ybase+this.buffer.y,z=this.buffer.lines.get(X);if(!z)return;const ae=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ge=z.getWidth(ae),ve=this._renderService.dimensions.css.cell.width*ge,Ne=this.buffer.y*this._renderService.dimensions.css.cell.height,De=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=De+"px",this.textarea.style.top=Ne+"px",this.textarea.style.width=ve+"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",(z=>{this.hasSelection()&&(0,f.copyHandler)(z,this._selectionService)})));const X=z=>(0,f.handlePasteEvent)(z,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),W.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(z=>{z.button===2&&(0,f.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,f.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,f.moveTextAreaUnderMouseCursor)(z,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ae;if(!X)throw new Error("Terminal requires a parent element.");if(X.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=X.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"),X.appendChild(this.element);const z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.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),z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),W.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(A.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(B.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(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(H.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(j.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.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(_.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(p.Linkifier,this.screenElement)),this.element.appendChild(z);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(E.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(B.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(P.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.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 X=this,z=this.element;function ae(ve){const Ne=X._mouseService.getMouseReportCoords(ve,X.screenElement);if(!Ne)return!1;let De,Oe;switch(ve.overrideType||ve.type){case"mousemove":Oe=32,ve.buttons===void 0?(De=3,ve.button!==void 0&&(De=ve.button<3?ve.button:3)):De=1&ve.buttons?0:4&ve.buttons?1:2&ve.buttons?2:3;break;case"mouseup":Oe=0,De=ve.button<3?ve.button:3;break;case"mousedown":Oe=1,De=ve.button<3?ve.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ve)===!1||X.viewport.getLinesScrolled(ve)===0)return!1;Oe=ve.deltaY<0?0:1,De=4;break;default:return!1}return!(Oe===void 0||De===void 0||De>4)&&X.coreMouseService.triggerMouseEvent({col:Ne.col,row:Ne.row,x:Ne.x,y:Ne.y,button:De,action:Oe,ctrl:ve.ctrlKey,alt:ve.altKey,shift:ve.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:ve=>(ae(ve),ve.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(ve)),wheel:ve=>(ae(ve),this.cancel(ve,!0)),mousedrag:ve=>{ve.buttons&&ae(ve)},mousemove:ve=>{ve.buttons||ae(ve)}};this.register(this.coreMouseService.onProtocolChange((ve=>{ve?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ve)),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&ve?se.mousemove||(z.addEventListener("mousemove",ge.mousemove),se.mousemove=ge.mousemove):(z.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&ve?se.wheel||(z.addEventListener("wheel",ge.wheel,{passive:!1}),se.wheel=ge.wheel):(z.removeEventListener("wheel",se.wheel),se.wheel=null),2&ve?se.mouseup||(se.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&ve?se.mousedrag||(se.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(z,"mousedown",(ve=>{if(ve.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ve))return ae(ve),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(ve)}))),this.register((0,g.addDisposableDomListener)(z,"wheel",(ve=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ve)===!1)return!1;if(!this.buffer.hasScrollback){const Ne=this.viewport.getLinesScrolled(ve);if(Ne===0)return;const De=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ve.deltaY<0?"A":"B");let Oe="";for(let Fe=0;Fe<Math.abs(Ne);Fe++)Oe+=De;return this.coreService.triggerDataEvent(Oe,!0),this.cancel(ve,!0)}return this.viewport.handleWheel(ve)?this.cancel(ve):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(z,"touchstart",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ve),this.cancel(ve)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(z,"touchmove",(ve=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ve)?void 0:this.cancel(ve)}),{passive:!1}))}refresh(X,z){var ae;(ae=this._renderService)==null||ae.refreshRows(X,z)}updateCursorStyle(X){var z;(z=this._selectionService)!=null&&z.shouldColumnSelect(X)?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(X,z,ae=0){var se;ae===1?(super.scrollLines(X,z,ae),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines(X)}paste(X){(0,f.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const z=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),z}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,z,ae){this._selectionService.setSelection(X,z,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 X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,z){var ae;(ae=this._selectionService)==null||ae.selectLines(X,z)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!z&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,ee.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ae.type===3||ae.type===2){const se=this.rows-1;return this.scrollLines(ae.type===2?-se:se),this.cancel(X,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ae.cancel&&this.cancel(X,!0),!ae.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==Q.C0.ETX&&ae.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,z){const ae=X.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||X.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||X.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?ae:ae&&(!z.keyCode||z.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)z=X.charCode;else if(X.which===null||X.which===void 0)z=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;z=X.which}return!(!z||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const z=X.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(X),!0}return!1}resize(X,z){X!==this.cols||z!==this.rows?super.resize(X,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,z){var ae,se;(ae=this._charSizeService)==null||ae.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var X;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 z=1;z<this.rows;z++)this.buffer.lines.push(this.buffer.getBlankLine(V.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var z,ae;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.reset(),this._decorationService.reset(),(ae=this.viewport)==null||ae.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Q.C0.ESC+"[I"):this.coreService.triggerDataEvent(Q.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[4;${ae};${z}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[6;${ge};${se}t`)}}cancel(X,z){if(this.options.cancelEvents||z)return X.preventDefault(),X.stopPropagation(),!1}}o.Terminal=te},9924:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.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 p=Date.now();if(p-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=p,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=p-this._lastRefreshMs,S=this._debounceThresholdMS-v;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(m,o,d){var f=this&&this.__decorate||function(_,x,y,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,x,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(R=(N<3?A(R):N>3?A(x,y,R):A(x,y))||R);return N>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(_,x){return function(y,j){x(y,j,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const p=d(3656),v=d(4725),S=d(8460),E=d(844),C=d(2585);let b=o.Viewport=class extends E.Disposable{constructor(_,x,y,j,A,N,R,T){super(),this._viewportElement=_,this._scrollArea=x,this._bufferService=y,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,p.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((B=>this._activeBuffer=B.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((B=>this._renderDimensions=B))),this._handleThemeChange(T.colors),this.register(T.onChangeColors((B=>this._handleThemeChange(B)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(_){this._viewportElement.style.backgroundColor=_.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(_){if(_)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 _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){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 _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<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(_,x){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&y<this._lastRecordedBufferHeight)||(_.cancelable&&_.preventDefault(),!1)}handleWheel(_){const x=this._getPixelsScrolled(_);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(_,x))}scrollLines(_){if(_!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const x=_*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:_,suppressScrollEvent:!1})}_getPixelsScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let x=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_LINE?x*=this._currentRowHeight:_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._currentRowHeight*this._bufferService.rows),x}getBufferElements(_,x){var T;let y,j="";const A=[],N=x??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let B=_;B<N;B++){const H=R.get(B);if(!H)continue;const G=(T=R.get(B+1))==null?void 0:T.isWrapped;if(j+=H.translateToString(!G),!G||B===R.length-1){const Y=document.createElement("div");Y.textContent=j,A.push(Y),j.length>0&&(y=Y),j=""}}return{bufferElements:A,cursorElement:y}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let x=this._applyScrollModifier(_.deltaY,_);return _.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):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(_,x){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&x.altKey||y==="ctrl"&&x.ctrlKey||y==="shift"&&x.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const x=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(_,x))}};o.Viewport=b=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],b)},3107:function(m,o,d){var f=this&&this.__decorate||function(C,b,_,x){var y,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,_,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,_,A):y(b,_))||A);return j>3&&A&&Object.defineProperty(b,_,A),A},g=this&&this.__param||function(C,b){return function(_,x){b(_,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const p=d(4725),v=d(844),S=d(2585);let E=o.BufferDecorationRenderer=class extends v.Disposable{constructor(C,b,_,x,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=_,this._decorationService=x,this._renderService=y,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,v.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 b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=C.options.x??0;return _&&_>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let _=this._decorationElements.get(C);_||(_=this._createElement(C),C.element=_,this._decorationElements.set(C,_),this._container.appendChild(_),C.onDispose((()=>{this._decorationElements.delete(C),_.remove()}))),_.style.top=b*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(_)}}_refreshXPosition(C,b=C.element){if(!b)return;const _=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=E=f([g(1,S.IBufferService),g(2,p.ICoreBrowserService),g(3,S.IDecorationService),g(4,p.IRenderService)],E)},5871:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.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(m,o,d){var f=this&&this.__decorate||function(y,j,A,N){var R,T=arguments.length,B=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(R=y[H])&&(B=(T<3?R(B):T>3?R(j,A,B):R(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const p=d(5871),v=d(4725),S=d(844),E=d(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,j,A,N,R,T,B){var G;super(),this._viewportElement=y,this._screenElement=j,this._bufferService=A,this._decorationService=N,this._renderService=R,this._optionsService=T,this._coreBrowserService=B,this._colorZoneStore=new p.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(),(G=this._viewportElement.parentElement)==null||G.insertBefore(this._canvas,this._viewportElement);const H=this._canvas.getContext("2d");if(!H)throw new Error("Ctx cannot be null");this._ctx=H,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 y=Math.floor(this._canvas.width/3),j=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=j,b.right=y,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=b.left,_.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,j=Math.round(Math.max(Math.min(y,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 y=this._colorZoneStore.zones;for(const j of y)j.position!=="full"&&this._renderColorZone(j);for(const j of y)j.position==="full"&&this._renderColorZone(j);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(_[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,j){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=j||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([g(2,E.IBufferService),g(3,E.IDecorationService),g(4,v.IRenderService),g(5,E.IOptionsService),g(6,v.ICoreBrowserService)],x)},2950:function(m,o,d){var f=this&&this.__decorate||function(C,b,_,x){var y,j=arguments.length,A=j<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,b,_,x);else for(var N=C.length-1;N>=0;N--)(y=C[N])&&(A=(j<3?y(A):j>3?y(b,_,A):y(b,_))||A);return j>3&&A&&Object.defineProperty(b,_,A),A},g=this&&this.__param||function(C,b){return function(_,x){b(_,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const p=d(4725),v=d(2585),S=d(2584);let E=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,_,x,y,j){this._textarea=C,this._compositionView=b,this._bufferService=_,this._optionsService=x,this._coreService=y,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 b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,_=b.replace(C,"");this._dataAlreadySent=_,b.length>C.length?this._coreService.triggerDataEvent(_,!0):b.length<C.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):b.length===C.length&&b!==C&&this._coreService.triggerDataEvent(b,!0)}}),0)}updateCompositionElements(C){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),_=this._renderService.dimensions.css.cell.height,x=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=b*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=x+"px",this._compositionView.style.height=_+"px",this._compositionView.style.lineHeight=_+"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=y+"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)}}};o.CompositionHelper=E=f([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,p.IRenderService)],E)},9806:(m,o)=>{function d(f,g,p){const v=p.getBoundingClientRect(),S=f.getComputedStyle(p),E=parseInt(S.getPropertyValue("padding-left")),C=parseInt(S.getPropertyValue("padding-top"));return[g.clientX-v.left-E,g.clientY-v.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=d,o.getCoords=function(f,g,p,v,S,E,C,b,_){if(!E)return;const x=d(f,g,p);return x?(x[0]=Math.ceil((x[0]+(_?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),v+(_?1:0)),x[1]=Math.min(Math.max(x[1],1),S),x):void 0}},9504:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=d(2584);function g(b,_,x,y){const j=b-p(b,x),A=_-p(_,x),N=Math.abs(j-A)-(function(R,T,B){let H=0;const G=R-p(R,B),Y=T-p(T,B);for(let q=0;q<Math.abs(G-Y);q++){const O=v(R,T)==="A"?-1:1,W=B.buffer.lines.get(G+O*q);W!=null&&W.isWrapped&&H++}return H})(b,_,x);return C(N,E(v(b,_),y))}function p(b,_){let x=0,y=_.buffer.lines.get(b),j=y==null?void 0:y.isWrapped;for(;j&&b>=0&&b<_.rows;)x++,y=_.buffer.lines.get(--b),j=y==null?void 0:y.isWrapped;return x}function v(b,_){return b>_?"A":"B"}function S(b,_,x,y,j,A){let N=b,R=_,T="";for(;N!==x||R!==y;)N+=j?1:-1,j&&N>A.cols-1?(T+=A.buffer.translateBufferLineToString(R,!1,b,N),N=0,b=0,R++):!j&&N<0&&(T+=A.buffer.translateBufferLineToString(R,!1,0,b+1),N=A.cols-1,b=N,R--);return T+A.buffer.translateBufferLineToString(R,!1,b,N)}function E(b,_){const x=_?"O":"[";return f.C0.ESC+x+b}function C(b,_){b=Math.floor(b);let x="";for(let y=0;y<b;y++)x+=_;return x}o.moveToCellSequence=function(b,_,x,y){const j=x.buffer.x,A=x.buffer.y;if(!x.buffer.hasScrollback)return(function(T,B,H,G,Y,q){return g(B,G,Y,q).length===0?"":C(S(T,B,T,B-p(B,Y),!1,Y).length,E("D",q))})(j,A,0,_,x,y)+g(A,_,x,y)+(function(T,B,H,G,Y,q){let O;O=g(B,G,Y,q).length>0?G-p(G,Y):B;const W=G,V=(function(Q,ee,L,D,I,U){let P;return P=g(L,D,I,U).length>0?D-p(D,I):ee,Q<L&&P<=D||Q>=L&&P<D?"C":"D"})(T,B,H,G,Y,q);return C(S(T,O,H,W,V==="C",Y).length,E(V,q))})(j,A,b,_,x,y);let N;if(A===_)return N=j>b?"D":"C",C(Math.abs(j-b),E(N,y));N=A>_?"D":"C";const R=Math.abs(A-_);return C((function(T,B){return B.cols-T})(A>_?b:j,x)+(R-1)*x.cols+1+((A>_?j:b)-1),E(N,y))}},1296:function(m,o,d){var f=this&&this.__decorate||function(q,O,W,V){var Q,ee=arguments.length,L=ee<3?O:V===null?V=Object.getOwnPropertyDescriptor(O,W):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(q,O,W,V);else for(var D=q.length-1;D>=0;D--)(Q=q[D])&&(L=(ee<3?Q(L):ee>3?Q(O,W,L):Q(O,W))||L);return ee>3&&L&&Object.defineProperty(O,W,L),L},g=this&&this.__param||function(q,O){return function(W,V){O(W,V,q)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const p=d(3787),v=d(2550),S=d(2223),E=d(6171),C=d(6052),b=d(4725),_=d(8055),x=d(8460),y=d(844),j=d(2585),A="xterm-dom-renderer-owner-",N="xterm-rows",R="xterm-fg-",T="xterm-bg-",B="xterm-focus",H="xterm-selection";let G=1,Y=o.DomRenderer=class extends y.Disposable{constructor(q,O,W,V,Q,ee,L,D,I,U,P,K,te){super(),this._terminal=q,this._document=O,this._element=W,this._screenElement=V,this._viewportElement=Q,this._helperContainer=ee,this._linkifier2=L,this._charSizeService=I,this._optionsService=U,this._bufferService=P,this._coreBrowserService=K,this._themeService=te,this._terminalClass=G++,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(H),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,E.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Z=>this._injectCss(Z)))),this._injectCss(this._themeService.colors),this._rowFactory=D.createInstance(p.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Z=>this._handleLinkHover(Z)))),this.register(this._linkifier2.onHideLinkUnderline((Z=>this._handleLinkLeave(Z)))),this.register((0,y.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 v.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 q=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*q,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*q),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/q),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/q),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const O=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=O,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(q){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let O=`${this._terminalSelector} .${N} { color: ${q.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;O+=`${this._terminalSelector} .${N} .xterm-dim { color: ${_.color.multiplyOpacity(q.foreground,.5).css};}`,O+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const W=`blink_underline_${this._terminalClass}`,V=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;O+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,O+=`@keyframes ${V} { 50% { box-shadow: none; }}`,O+=`@keyframes ${Q} { 0% { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css}; } 50% { background-color: inherit; color: ${q.cursor.css}; }}`,O+=`${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${q.cursor.css}; color: ${q.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${q.cursor.css} !important; color: ${q.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${q.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${q.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${q.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,O+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${q.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${q.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,L]of q.ansi.entries())O+=`${this._terminalSelector} .${R}${ee} { color: ${L.css}; }${this._terminalSelector} .${R}${ee}.xterm-dim { color: ${_.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${T}${ee} { background-color: ${L.css}; }`;O+=`${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque(q.background).css}; }${this._terminalSelector} .${R}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque(q.background),.5).css}; }${this._terminalSelector} .${T}${S.INVERTED_DEFAULT_COLOR} { background-color: ${q.foreground.css}; }`,this._themeStyleElement.textContent=O}_setDefaultSpacing(){const q=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${q}px`,this._rowFactory.defaultSpacing=q}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(q,O){for(let W=this._rowElements.length;W<=O;W++){const V=this._document.createElement("div");this._rowContainer.appendChild(V),this._rowElements.push(V)}for(;this._rowElements.length>O;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(q,O){this._refreshRowElements(q,O),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(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(q,O,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(q,O,W),this.renderRows(0,this._bufferService.rows-1),!q||!O)return;this._selectionRenderModel.update(this._terminal,q,O,W);const V=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||L<0)return;const D=this._document.createDocumentFragment();if(W){const I=q[0]>O[0];D.appendChild(this._createSelectionElement(ee,I?O[0]:q[0],I?q[0]:O[0],L-ee+1))}else{const I=V===ee?q[0]:0,U=ee===Q?O[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(ee,I,U));const P=L-ee-1;if(D.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,P)),ee!==L){const K=Q===L?O[0]:this._bufferService.cols;D.appendChild(this._createSelectionElement(L,0,K))}}this._selectionContainer.appendChild(D)}_createSelectionElement(q,O,W,V=1){const Q=this._document.createElement("div"),ee=O*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(W-O);return ee+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-ee),Q.style.height=V*this.dimensions.css.cell.height+"px",Q.style.top=q*this.dimensions.css.cell.height+"px",Q.style.left=`${ee}px`,Q.style.width=`${L}px`,Q}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 q of this._rowElements)q.replaceChildren()}renderRows(q,O){const W=this._bufferService.buffer,V=W.ybase+W.y,Q=Math.min(W.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,D=this._optionsService.rawOptions.cursorInactiveStyle;for(let I=q;I<=O;I++){const U=I+W.ydisp,P=this._rowElements[I],K=W.lines.get(U);if(!P||!K)break;P.replaceChildren(...this._rowFactory.createRow(K,U,U===V,L,D,Q,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!0)}_handleLinkLeave(q){this._setCellUnderline(q.x1,q.x2,q.y1,q.y2,q.cols,!1)}_setCellUnderline(q,O,W,V,Q,ee){W<0&&(q=0),V<0&&(O=0);const L=this._bufferService.rows-1;W=Math.max(Math.min(W,L),0),V=Math.max(Math.min(V,L),0),Q=Math.min(Q,this._bufferService.cols);const D=this._bufferService.buffer,I=D.ybase+D.y,U=Math.min(D.x,Q-1),P=this._optionsService.rawOptions.cursorBlink,K=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let Z=W;Z<=V;++Z){const X=Z+D.ydisp,z=this._rowElements[Z],ae=D.lines.get(X);if(!z||!ae)break;z.replaceChildren(...this._rowFactory.createRow(ae,X,X===I,K,te,U,P,this.dimensions.css.cell.width,this._widthCache,ee?Z===W?q:0:-1,ee?(Z===V?O:Q)-1:-1))}}};o.DomRenderer=Y=f([g(7,j.IInstantiationService),g(8,b.ICharSizeService),g(9,j.IOptionsService),g(10,j.IBufferService),g(11,b.ICoreBrowserService),g(12,b.IThemeService)],Y)},3787:function(m,o,d){var f=this&&this.__decorate||function(N,R,T,B){var H,G=arguments.length,Y=G<3?R:B===null?B=Object.getOwnPropertyDescriptor(R,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(N,R,T,B);else for(var q=N.length-1;q>=0;q--)(H=N[q])&&(Y=(G<3?H(Y):G>3?H(R,T,Y):H(R,T))||Y);return G>3&&Y&&Object.defineProperty(R,T,Y),Y},g=this&&this.__param||function(N,R){return function(T,B){R(T,B,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const p=d(2223),v=d(643),S=d(511),E=d(2585),C=d(8055),b=d(4725),_=d(4269),x=d(6171),y=d(3734);let j=o.DomRendererRowFactory=class{constructor(N,R,T,B,H,G,Y){this._document=N,this._characterJoinerService=R,this._optionsService=T,this._coreBrowserService=B,this._coreService=H,this._decorationService=G,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,B,H,G,Y,q,O,W,V){const Q=[],ee=this._characterJoinerService.getJoinedCharacters(R),L=this._themeService.colors;let D,I=N.getNoBgTrimmedLength();T&&I<G+1&&(I=G+1);let U=0,P="",K=0,te=0,Z=0,X=!1,z=0,ae=!1,se=0;const ge=[],ve=W!==-1&&V!==-1;for(let Ne=0;Ne<I;Ne++){N.loadCell(Ne,this._workCell);let De=this._workCell.getWidth();if(De===0)continue;let Oe=!1,Fe=Ne,ke=this._workCell;if(ee.length>0&&Ne===ee[0][0]){Oe=!0;const Ae=ee.shift();ke=new _.JoinedCellData(this._workCell,N.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),Fe=Ae[1]-1,De=ke.getWidth()}const lt=this._isCellInSelection(Ne,R),dt=T&&Ne===G,fe=ve&&Ne>=W&&Ne<=V;let Le=!1;this._decorationService.forEachDecorationAtCell(Ne,R,void 0,(Ae=>{Le=!0}));let Je=ke.getChars()||v.WHITESPACE_CELL_CHAR;if(Je===" "&&(ke.isUnderline()||ke.isOverline())&&(Je=" "),se=De*q-O.get(Je,ke.isBold(),ke.isItalic()),D){if(U&&(lt&&ae||!lt&&!ae&&ke.bg===K)&&(lt&&ae&&L.selectionForeground||ke.fg===te)&&ke.extended.ext===Z&&fe===X&&se===z&&!dt&&!Oe&&!Le){ke.isInvisible()?P+=v.WHITESPACE_CELL_CHAR:P+=Je,U++;continue}U&&(D.textContent=P),D=this._document.createElement("span"),U=0,P=""}else D=this._document.createElement("span");if(K=ke.bg,te=ke.fg,Z=ke.extended.ext,X=fe,z=se,ae=lt,Oe&&G>=Ne&&G<=Fe&&(G=Ne),!this._coreService.isCursorHidden&&dt&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)Y&&ge.push("xterm-cursor-blink"),ge.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(ke.isBold()&&ge.push("xterm-bold"),ke.isItalic()&&ge.push("xterm-italic"),ke.isDim()&&ge.push("xterm-dim"),P=ke.isInvisible()?v.WHITESPACE_CELL_CHAR:ke.getChars()||v.WHITESPACE_CELL_CHAR,ke.isUnderline()&&(ge.push(`xterm-underline-${ke.extended.underlineStyle}`),P===" "&&(P=" "),!ke.isUnderlineColorDefault()))if(ke.isUnderlineColorRGB())D.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(ke.getUnderlineColor()).join(",")})`;else{let Ae=ke.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ke.isBold()&&Ae<8&&(Ae+=8),D.style.textDecorationColor=L.ansi[Ae].css}ke.isOverline()&&(ge.push("xterm-overline"),P===" "&&(P=" ")),ke.isStrikethrough()&&ge.push("xterm-strikethrough"),fe&&(D.style.textDecoration="underline");let et=ke.getFgColor(),Ge=ke.getFgColorMode(),ct=ke.getBgColor(),de=ke.getBgColorMode();const be=!!ke.isInverse();if(be){const Ae=et;et=ct,ct=Ae;const st=Ge;Ge=de,de=st}let re,_e,Ce,He=!1;switch(this._decorationService.forEachDecorationAtCell(Ne,R,void 0,(Ae=>{Ae.options.layer!=="top"&&He||(Ae.backgroundColorRGB&&(de=50331648,ct=Ae.backgroundColorRGB.rgba>>8&16777215,re=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(Ge=50331648,et=Ae.foregroundColorRGB.rgba>>8&16777215,_e=Ae.foregroundColorRGB),He=Ae.options.layer==="top")})),!He&<&&(re=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,ct=re.rgba>>8&16777215,de=50331648,He=!0,L.selectionForeground&&(Ge=50331648,et=L.selectionForeground.rgba>>8&16777215,_e=L.selectionForeground)),He&&ge.push("xterm-decoration-top"),de){case 16777216:case 33554432:Ce=L.ansi[ct],ge.push(`xterm-bg-${ct}`);break;case 50331648:Ce=C.channels.toColor(ct>>16,ct>>8&255,255&ct),this._addStyle(D,`background-color:#${A((ct>>>0).toString(16),"0",6)}`);break;default:be?(Ce=L.foreground,ge.push(`xterm-bg-${p.INVERTED_DEFAULT_COLOR}`)):Ce=L.background}switch(re||ke.isDim()&&(re=C.color.multiplyOpacity(Ce,.5)),Ge){case 16777216:case 33554432:ke.isBold()&&et<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(et+=8),this._applyMinimumContrast(D,Ce,L.ansi[et],ke,re,void 0)||ge.push(`xterm-fg-${et}`);break;case 50331648:const Ae=C.channels.toColor(et>>16&255,et>>8&255,255&et);this._applyMinimumContrast(D,Ce,Ae,ke,re,_e)||this._addStyle(D,`color:#${A(et.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(D,Ce,L.foreground,ke,re,_e)||be&&ge.push(`xterm-fg-${p.INVERTED_DEFAULT_COLOR}`)}ge.length&&(D.className=ge.join(" "),ge.length=0),dt||Oe||Le?D.textContent=P:U++,se!==this.defaultSpacing&&(D.style.letterSpacing=`${se}px`),Q.push(D),Ne=Fe}return D&&U&&(D.textContent=P),Q}_applyMinimumContrast(N,R,T,B,H,G){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const Y=this._getContrastCache(B);let q;if(H||G||(q=Y.getColor(R.rgba,T.rgba)),q===void 0){const O=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);q=C.color.ensureContrastRatio(H||R,G||T,O),Y.setColor((H||R).rgba,(G||T).rgba,q??null)}return!!q&&(this._addStyle(N,`color:${q.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,B=this._selectionEnd;return!(!T||!B)&&(this._columnSelectMode?T[0]<=B[0]?N>=T[0]&&R>=T[1]&&N<B[0]&&R<=B[1]:N<T[0]&&R>=T[1]&&N>=B[0]&&R<=B[1]:R>T[1]&&R<B[1]||T[1]===B[1]&&R===T[1]&&N>=T[0]&&N<B[0]||T[1]<B[1]&&R===B[1]&&N<B[0]||T[1]<B[1]&&R===T[1]&&N>=T[0])}};function A(N,R,T){for(;N.length<T;)N=R+N;return N}o.DomRendererRowFactory=j=f([g(1,b.ICharacterJoinerService),g(2,E.IOptionsService),g(3,b.ICoreBrowserService),g(4,E.ICoreService),g(5,E.IDecorationService),g(6,b.IThemeService)],j)},2550:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.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 p=d.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold";const v=d.createElement("span");v.classList.add("xterm-char-measure-element"),v.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,p,v,S],this._container.appendChild(g),this._container.appendChild(p),this._container.appendChild(v),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,p){d===this._font&&f===this._fontSize&&g===this._weight&&p===this._weightBold||(this._font=d,this._fontSize=f,this._weight=g,this._weightBold=p,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${p}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${p}`,this.clear())}get(d,f,g){let p=0;if(!f&&!g&&d.length===1&&(p=d.charCodeAt(0))<256){if(this._flat[p]!==-9999)return this._flat[p];const E=this._measure(d,0);return E>0&&(this._flat[p]=E),E}let v=d;f&&(v+="B"),g&&(v+="I");let S=this._holey.get(v);if(S===void 0){let E=0;f&&(E|=1),g&&(E|=2),S=this._measure(d,E),S>0&&this._holey.set(v,S)}return S}_measure(d,f){const g=this._measureElements[f];return g.textContent=d.repeat(32),g.offsetWidth/32}}},2223:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=d(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(m,o)=>{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(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},o.isPowerlineGlyph=d,o.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},o.isEmoji=f,o.allowRescaling=function(g,p,v,S){return p===1&&v>Math.ceil(1.5*S)&&g!==void 0&&g>255&&!f(g)&&!d(g)&&!(function(E){return 57344<=E&&E<=63743})(g)},o.treatGlyphAsBackgroundColor=function(g){return d(g)||(function(p){return 9472<=p&&p<=9631})(g)},o.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}}}},o.computeNextVariantOffset=function(g,p,v=0){return(g-(2*Math.round(p)-v))%(2*Math.round(p))}},6052:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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,p,v,S=!1){if(this.selectionStart=p,this.selectionEnd=v,!p||!v||p[0]===v[0]&&p[1]===v[1])return void this.clear();const E=g.buffers.active.ydisp,C=p[1]-E,b=v[1]-E,_=Math.max(C,0),x=Math.min(b,g.rows-1);_>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=_,this.viewportCappedEndRow=x,this.startCol=p[0],this.endCol=v[0])}isCellSelected(g,p,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?p>=this.startCol&&v>=this.viewportCappedStartRow&&p<this.endCol&&v<=this.viewportCappedEndRow:p<this.startCol&&v>=this.viewportCappedStartRow&&p>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&p>=this.startCol&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&p<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&p>=this.startCol)}}o.createSelectionRenderModel=function(){return new d}},456:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.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(m,o,d){var f=this&&this.__decorate||function(x,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,j,A);else for(var B=x.length-1;B>=0;B--)(N=x[B])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(x,y){return function(j,A){y(j,A,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const p=d(2585),v=d(8460),S=d(844);let E=o.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,y,j){super(),this._optionsService=j,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,y,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())}};o.CharSizeService=E=f([g(2,p.IOptionsService)],E);class C extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,j){y!==void 0&&y>0&&j!==void 0&&j>0&&(this._result.width=y,this._result.height=j)}}class b extends C{constructor(y,j,A){super(),this._document=y,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 _ extends C{constructor(y){super(),this._optionsService=y,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 y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(m,o,d){var f=this&&this.__decorate||function(_,x,y,j){var A,N=arguments.length,R=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,y):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,x,y,j);else for(var T=_.length-1;T>=0;T--)(A=_[T])&&(R=(N<3?A(R):N>3?A(x,y,R):A(x,y))||R);return N>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(_,x){return function(y,j){x(y,j,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const p=d(3734),v=d(643),S=d(511),E=d(2585);class C extends p.AttributeData{constructor(x,y,j){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=y,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()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class r0{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(x){const y={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(y),y.id}deregister(x){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===x)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(x){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(x);if(!y||y.length===0)return[];const j=[],A=y.translateToString(!0);let N=0,R=0,T=0,B=y.getFg(0),H=y.getBg(0);for(let G=0;G<y.getTrimmedLength();G++)if(y.loadCell(G,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==H){if(G-N>1){const Y=this._getJoinedRanges(A,T,R,y,N);for(let q=0;q<Y.length;q++)j.push(Y[q])}N=G,T=R,B=this._workCell.fg,H=this._workCell.bg}R+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const G=this._getJoinedRanges(A,T,R,y,N);for(let Y=0;Y<G.length;Y++)j.push(G[Y])}return j}_getJoinedRanges(x,y,j,A,N){const R=x.substring(y,j);let T=[];try{T=this._characterJoiners[0].handler(R)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const H=this._characterJoiners[B].handler(R);for(let G=0;G<H.length;G++)r0._mergeRanges(T,H[G])}catch(H){console.error(H)}return this._stringRangesToCellRanges(T,A,N),T}_stringRangesToCellRanges(x,y,j){let A=0,N=!1,R=0,T=x[A];if(T){for(let B=j;B<this._bufferService.cols;B++){const H=y.getWidth(B),G=y.getString(B).length||v.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!N&&T[0]<=R&&(T[0]=B,N=!0),T[1]<=R){if(T[1]=B,T=x[++A],!T)break;T[0]<=R?(T[0]=B,N=!0):N=!1}R+=G}}T&&(T[1]=this._bufferService.cols)}}static _mergeRanges(x,y){let j=!1;for(let A=0;A<x.length;A++){const N=x[A];if(j){if(y[1]<=N[0])return x[A-1][1]=y[1],x;if(y[1]<=N[1])return x[A-1][1]=Math.max(y[1],N[1]),x.splice(A,1),x;x.splice(A,1),A--}else{if(y[1]<=N[0])return x.splice(A,0,y),x;if(y[1]<=N[1])return N[0]=Math.min(y[0],N[0]),x;y[0]<N[1]&&(N[0]=Math.min(y[0],N[0]),j=!0)}}return j?x[x.length-1][1]=y[1]:x.push(y),x}};o.CharacterJoinerService=b=f([g(0,E.IBufferService)],b)},5114:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=d(844),g=d(8460),p=d(3656);class v extends f.Disposable{constructor(C,b,_){super(),this._textarea=C,this._window=b,this.mainDocument=_,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}}o.CoreBrowserService=v;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,p.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:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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(v){return this.linkProviders.push(v),{dispose:()=>{const S=this.linkProviders.indexOf(v);S!==-1&&this.linkProviders.splice(S,1)}}}}o.LinkProviderService=g},8934:function(m,o,d){var f=this&&this.__decorate||function(E,C,b,_){var x,y=arguments.length,j=y<3?C:_===null?_=Object.getOwnPropertyDescriptor(C,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(E,C,b,_);else for(var A=E.length-1;A>=0;A--)(x=E[A])&&(j=(y<3?x(j):y>3?x(C,b,j):x(C,b))||j);return y>3&&j&&Object.defineProperty(C,b,j),j},g=this&&this.__param||function(E,C){return function(b,_){C(b,_,E)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const p=d(4725),v=d(9806);let S=o.MouseService=class{constructor(E,C){this._renderService=E,this._charSizeService=C}getCoords(E,C,b,_,x){return(0,v.getCoords)(window,E,C,b,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(E,C){const b=(0,v.getCoordsRelativeToElement)(window,E,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};o.MouseService=S=f([g(0,p.IRenderService),g(1,p.ICharSizeService)],S)},3230:function(m,o,d){var f=this&&this.__decorate||function(x,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,j,A);else for(var B=x.length-1;B>=0;B--)(N=x[B])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(x,y){return function(j,A){y(j,A,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const p=d(6193),v=d(4725),S=d(8460),E=d(844),C=d(7226),b=d(2585);let _=o.RenderService=class extends E.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,y,j,A,N,R,T,B){super(),this._rowCount=x,this._charSizeService=A,this._renderer=this.register(new E.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new E.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 p.RenderDebouncer(((H,G)=>this._renderRows(H,G)),T),this.register(this._renderDebouncer),this.register(T.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var H;return(H=this._renderer.value)==null?void 0:H.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(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(T.window,y),this.register(T.onWindowChange((H=>this._registerIntersectionObserver(H,y))))}_registerIntersectionObserver(x,y){if("IntersectionObserver"in x){const j=new x.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});j.observe(y),this._observerDisposable.value=(0,E.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,y,j=!1){this._isPaused?this._needsFullRefresh=!0:(j||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,y,this._rowCount))}_renderRows(x,y){this._renderer.value&&(x=Math.min(x,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(x,y),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:y}),this._onRender.fire({start:x,end:y}),this._isNextRenderRedrawOnly=!0)}resize(x,y){this._rowCount=y,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((y=>this.refreshRows(y.start,y.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,y;this._renderer.value&&((y=(x=this._renderer.value).clearTextureAtlas)==null||y.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var j;return(j=this._renderer.value)==null?void 0:j.handleResize(x,y)})):this._renderer.value.handleResize(x,y),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,y,j){var A;this._selectionState.start=x,this._selectionState.end=y,this._selectionState.columnSelectMode=j,(A=this._renderer.value)==null||A.handleSelectionChanged(x,y,j)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=_=f([g(2,b.IOptionsService),g(3,v.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],_)},9312:function(m,o,d){var f=this&&this.__decorate||function(T,B,H,G){var Y,q=arguments.length,O=q<3?B:G===null?G=Object.getOwnPropertyDescriptor(B,H):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(T,B,H,G);else for(var W=T.length-1;W>=0;W--)(Y=T[W])&&(O=(q<3?Y(O):q>3?Y(B,H,O):Y(B,H))||O);return q>3&&O&&Object.defineProperty(B,H,O),O},g=this&&this.__param||function(T,B){return function(H,G){B(H,G,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const p=d(9806),v=d(9504),S=d(456),E=d(4725),C=d(8460),b=d(844),_=d(6114),x=d(4841),y=d(511),j=d(2585),A=" ",N=new RegExp(A,"g");let R=o.SelectionService=class extends b.Disposable{constructor(T,B,H,G,Y,q,O,W,V){super(),this._element=T,this._screenElement=B,this._linkifier=H,this._bufferService=G,this._coreService=Y,this._mouseService=q,this._optionsService=O,this._renderService=W,this._coreBrowserService=V,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.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=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new S.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.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,B=this._model.finalSelectionEnd;return!(!T||!B||T[0]===B[0]&&T[1]===B[1])}get selectionText(){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!T||!B)return"";const H=this._bufferService.buffer,G=[];if(this._activeSelectionMode===3){if(T[0]===B[0])return"";const Y=T[0]<B[0]?T[0]:B[0],q=T[0]<B[0]?B[0]:T[0];for(let O=T[1];O<=B[1];O++){const W=H.translateBufferLineToString(O,!0,Y,q);G.push(W)}}else{const Y=T[1]===B[1]?B[0]:void 0;G.push(H.translateBufferLineToString(T[1],!0,T[0],Y));for(let q=T[1]+1;q<=B[1]-1;q++){const O=H.lines.get(q),W=H.translateBufferLineToString(q,!0);O!=null&&O.isWrapped?G[G.length-1]+=W:G.push(W)}if(T[1]!==B[1]){const q=H.lines.get(B[1]),O=H.translateBufferLineToString(B[1],!0,0,B[0]);q&&q.isWrapped?G[G.length-1]+=O:G.push(O)}}return G.map((Y=>Y.replace(N," "))).join(_.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()))),_.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 B=this._getMouseBufferCoords(T),H=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!!(H&&G&&B)&&this._areCoordsInSelection(B,H,G)}isCellInSelection(T,B){const H=this._model.finalSelectionStart,G=this._model.finalSelectionEnd;return!(!H||!G)&&this._areCoordsInSelection([T,B],H,G)}_areCoordsInSelection(T,B,H){return T[1]>B[1]&&T[1]<H[1]||B[1]===H[1]&&T[1]===B[1]&&T[0]>=B[0]&&T[0]<H[0]||B[1]<H[1]&&T[1]===H[1]&&T[0]<H[0]||B[1]<H[1]&&T[1]===B[1]&&T[0]>=B[0]}_selectWordAtCursor(T,B){var Y,q;const H=(q=(Y=this._linkifier.currentLink)==null?void 0:Y.link)==null?void 0:q.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(H,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const G=this._getMouseBufferCoords(T);return!!G&&(this._selectWordAt(G,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(T,B){this._model.clearSelection(),T=Math.max(T,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,T],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(T){this._model.handleTrim(T)&&this.refresh()}_getMouseBufferCoords(T){const B=this._mouseService.getCoords(T,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(T){let B=(0,p.getCoordsRelativeToElement)(this._coreBrowserService.window,T,this._screenElement)[1];const H=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=H?0:(B>H&&(B-=H),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(T){return _.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 B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(T){this._selectWordAtCursor(T,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(T){const B=this._getMouseBufferCoords(T);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(T){return T.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(T){if(T.stopImmediatePropagation(),!this._model.selectionStart)return;const B=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 H=this._bufferService.buffer;if(this._model.selectionEnd[1]<H.lines.length){const G=H.lines.get(this._model.selectionEnd[1]);G&&G.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}B&&B[0]===this._model.selectionEnd[0]&&B[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 B=T.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&T.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const H=this._mouseService.getCoords(T,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(H&&H[0]!==void 0&&H[1]!==void 0){const G=(0,v.moveToCellSequence)(H[0]-1,H[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(G,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,H=!(!T||!B||T[0]===B[0]&&T[1]===B[1]);H?T&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&T[0]===this._oldSelectionStart[0]&&T[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(T,B,H)):this._oldHasSelection&&this._fireOnSelectionChange(T,B,H)}_fireOnSelectionChange(T,B,H){this._oldSelectionStart=T,this._oldSelectionEnd=B,this._oldHasSelection=H,this._onSelectionChange.fire()}_handleBufferActivate(T){this.clearSelection(),this._trimListener.dispose(),this._trimListener=T.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(T,B){let H=B;for(let G=0;B>=G;G++){const Y=T.loadCell(G,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:Y>1&&B!==G&&(H+=Y-1)}return H}setSelection(T,B,H){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[T,B],this._model.selectionStartLength=H,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(T){this._isClickInSelection(T)||(this._selectWordAtCursor(T,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(T,B,H=!0,G=!0){if(T[0]>=this._bufferService.cols)return;const Y=this._bufferService.buffer,q=Y.lines.get(T[1]);if(!q)return;const O=Y.translateBufferLineToString(T[1],!1);let W=this._convertViewportColToCharacterIndex(q,T[0]),V=W;const Q=T[0]-W;let ee=0,L=0,D=0,I=0;if(O.charAt(W)===" "){for(;W>0&&O.charAt(W-1)===" ";)W--;for(;V<O.length&&O.charAt(V+1)===" ";)V++}else{let K=T[0],te=T[0];q.getWidth(K)===0&&(ee++,K--),q.getWidth(te)===2&&(L++,te++);const Z=q.getString(te).length;for(Z>1&&(I+=Z-1,V+=Z-1);K>0&&W>0&&!this._isCharWordSeparator(q.loadCell(K-1,this._workCell));){q.loadCell(K-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,K--):X>1&&(D+=X-1,W-=X-1),W--,K--}for(;te<q.length&&V+1<O.length&&!this._isCharWordSeparator(q.loadCell(te+1,this._workCell));){q.loadCell(te+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,te++):X>1&&(I+=X-1,V+=X-1),V++,te++}}V++;let U=W+Q-ee+D,P=Math.min(this._bufferService.cols,V-W+ee+L-D-I);if(B||O.slice(W,V).trim()!==""){if(H&&U===0&&q.getCodePoint(0)!==32){const K=Y.lines.get(T[1]-1);if(K&&q.isWrapped&&K.getCodePoint(this._bufferService.cols-1)!==32){const te=this._getWordAt([this._bufferService.cols-1,T[1]-1],!1,!0,!1);if(te){const Z=this._bufferService.cols-te.start;U-=Z,P+=Z}}}if(G&&U+P===this._bufferService.cols&&q.getCodePoint(this._bufferService.cols-1)!==32){const K=Y.lines.get(T[1]+1);if(K!=null&&K.isWrapped&&K.getCodePoint(0)!==32){const te=this._getWordAt([0,T[1]+1],!1,!1,!0);te&&(P+=te.length)}}return{start:U,length:P}}}_selectWordAt(T,B){const H=this._getWordAt(T,B);if(H){for(;H.start<0;)H.start+=this._bufferService.cols,T[1]--;this._model.selectionStart=[H.start,T[1]],this._model.selectionStartLength=H.length}}_selectToWordAt(T){const B=this._getWordAt(T,!0);if(B){let H=T[1];for(;B.start<0;)B.start+=this._bufferService.cols,H--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,H++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,H]}}_isCharWordSeparator(T){return T.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(T.getChars())>=0}_selectLineAt(T){const B=this._bufferService.buffer.getWrappedRangeForLine(T),H={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(H,this._bufferService.cols)}};o.SelectionService=R=f([g(3,j.IBufferService),g(4,j.ICoreService),g(5,E.IMouseService),g(6,j.IOptionsService),g(7,E.IRenderService),g(8,E.ICoreBrowserService)],R)},4725:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const f=d(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(m,o,d){var f=this&&this.__decorate||function(R,T,B,H){var G,Y=arguments.length,q=Y<3?T:H===null?H=Object.getOwnPropertyDescriptor(T,B):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(R,T,B,H);else for(var O=R.length-1;O>=0;O--)(G=R[O])&&(q=(Y<3?G(q):Y>3?G(T,B,q):G(T,B))||q);return Y>3&&q&&Object.defineProperty(T,B,q),q},g=this&&this.__param||function(R,T){return function(B,H){T(B,H,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const p=d(7239),v=d(8055),S=d(8460),E=d(844),C=d(2585),b=v.css.toColor("#ffffff"),_=v.css.toColor("#000000"),x=v.css.toColor("#ffffff"),y=v.css.toColor("#000000"),j={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],T=[0,95,135,175,215,255];for(let B=0;B<216;B++){const H=T[B/36%6|0],G=T[B/6%6|0],Y=T[B%6];R.push({css:v.channels.toCss(H,G,Y),rgba:v.channels.toRgba(H,G,Y)})}for(let B=0;B<24;B++){const H=8+10*B;R.push({css:v.channels.toCss(H,H,H),rgba:v.channels.toRgba(H,H,H)})}return R})());let A=o.ThemeService=class extends E.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new p.ColorContrastCache,this._halfContrastCache=new p.ColorContrastCache,this._onChangeColors=this.register(new S.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:_,cursor:x,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:j,selectionBackgroundOpaque:v.color.blend(_,j),selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:v.color.blend(_,j),ansi:o.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,b),T.background=N(R.background,_),T.cursor=N(R.cursor,x),T.cursorAccent=N(R.cursorAccent,y),T.selectionBackgroundTransparent=N(R.selectionBackground,j),T.selectionBackgroundOpaque=v.color.blend(T.background,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundTransparent=N(R.selectionInactiveBackground,T.selectionBackgroundTransparent),T.selectionInactiveBackgroundOpaque=v.color.blend(T.background,T.selectionInactiveBackgroundTransparent),T.selectionForeground=R.selectionForeground?N(R.selectionForeground,v.NULL_COLOR):void 0,T.selectionForeground===v.NULL_COLOR&&(T.selectionForeground=void 0),v.color.isOpaque(T.selectionBackgroundTransparent)&&(T.selectionBackgroundTransparent=v.color.opacity(T.selectionBackgroundTransparent,.3)),v.color.isOpaque(T.selectionInactiveBackgroundTransparent)&&(T.selectionInactiveBackgroundTransparent=v.color.opacity(T.selectionInactiveBackgroundTransparent,.3)),T.ansi=o.DEFAULT_ANSI_COLORS.slice(),T.ansi[0]=N(R.black,o.DEFAULT_ANSI_COLORS[0]),T.ansi[1]=N(R.red,o.DEFAULT_ANSI_COLORS[1]),T.ansi[2]=N(R.green,o.DEFAULT_ANSI_COLORS[2]),T.ansi[3]=N(R.yellow,o.DEFAULT_ANSI_COLORS[3]),T.ansi[4]=N(R.blue,o.DEFAULT_ANSI_COLORS[4]),T.ansi[5]=N(R.magenta,o.DEFAULT_ANSI_COLORS[5]),T.ansi[6]=N(R.cyan,o.DEFAULT_ANSI_COLORS[6]),T.ansi[7]=N(R.white,o.DEFAULT_ANSI_COLORS[7]),T.ansi[8]=N(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),T.ansi[9]=N(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),T.ansi[10]=N(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),T.ansi[11]=N(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),T.ansi[12]=N(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),T.ansi[13]=N(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),T.ansi[14]=N(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),T.ansi[15]=N(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const B=Math.min(T.ansi.length-16,R.extendedAnsi.length);for(let H=0;H<B;H++)T.ansi[H+16]=N(R.extendedAnsi[H],o.DEFAULT_ANSI_COLORS[H+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 v.css.toColor(R)}catch{}return T}o.ThemeService=A=f([g(0,C.IOptionsService)],A)},6349:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=d(8460),g=d(844);class p 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 E=new Array(S);for(let C=0;C<Math.min(S,this.length);C++)E[C]=this._array[this._getCyclicIndex(C)];this._array=E,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let E=this._length;E<S;E++)this._array[E]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,E){this._array[this._getCyclicIndex(S)]=E}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,E,...C){if(E){for(let b=S;b<this._length-E;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+E)];this._length-=E,this.onDeleteEmitter.fire({index:S,amount:E})}for(let b=this._length-1;b>=S;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<C.length;b++)this._array[this._getCyclicIndex(S+b)]=C[b];if(C.length&&this.onInsertEmitter.fire({index:S,amount:C.length}),this._length+C.length>this._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}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,E,C){if(!(E<=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 _=E-1;_>=0;_--)this.set(S+_+C,this.get(S+_));const b=S+E+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<E;b++)this.set(S+b+C,this.get(S+b))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}o.CircularList=p},1439:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function d(f,g=5){if(typeof f!="object")return f;const p=Array.isArray(f)?[]:{};for(const v in f)p[v]=g<=1?f[v]:f[v]&&d(f[v],g-1);return p}},8055:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let d=0,f=0,g=0,p=0;var v,S,E,C,b;function _(y){const j=y.toString(16);return j.length<2?"0"+j:j}function x(y,j){return y<j?(j+.05)/(y+.05):(y+.05)/(j+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(j,A,N,R){return R!==void 0?`#${_(j)}${_(A)}${_(N)}${_(R)}`:`#${_(j)}${_(A)}${_(N)}`},y.toRgba=function(j,A,N,R=255){return(j<<24|A<<16|N<<8|R)>>>0},y.toColor=function(j,A,N,R){return{css:y.toCss(j,A,N,R),rgba:y.toRgba(j,A,N,R)}}})(v||(o.channels=v={})),(function(y){function j(A,N){return p=Math.round(255*N),[d,f,g]=b.toChannels(A.rgba),{css:v.toCss(d,f,g,p),rgba:v.toRgba(d,f,g,p)}}y.blend=function(A,N){if(p=(255&N.rgba)/255,p===1)return{css:N.css,rgba:N.rgba};const R=N.rgba>>24&255,T=N.rgba>>16&255,B=N.rgba>>8&255,H=A.rgba>>24&255,G=A.rgba>>16&255,Y=A.rgba>>8&255;return d=H+Math.round((R-H)*p),f=G+Math.round((T-G)*p),g=Y+Math.round((B-Y)*p),{css:v.toCss(d,f,g),rgba:v.toRgba(d,f,g)}},y.isOpaque=function(A){return(255&A.rgba)==255},y.ensureContrastRatio=function(A,N,R){const T=b.ensureContrastRatio(A.rgba,N.rgba,R);if(T)return v.toColor(T>>24&255,T>>16&255,T>>8&255)},y.opaque=function(A){const N=(255|A.rgba)>>>0;return[d,f,g]=b.toChannels(N),{css:v.toCss(d,f,g),rgba:N}},y.opacity=j,y.multiplyOpacity=function(A,N){return p=255&A.rgba,j(A,p*N/255)},y.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(S||(o.color=S={})),(function(y){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{}y.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),v.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),p=parseInt(N.slice(4,5).repeat(2),16),v.toColor(d,f,g,p);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]),p=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),v.toColor(d,f,g,p);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,p]=j.getImageData(0,0,1,1).data,p!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(d,f,g,p),css:N}}})(E||(o.css=E={})),(function(y){function j(A,N,R){const T=A/255,B=N/255,H=R/255;return .2126*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(H<=.03928?H/12.92:Math.pow((H+.055)/1.055,2.4))}y.relativeLuminance=function(A){return j(A>>16&255,A>>8&255,255&A)},y.relativeLuminance2=j})(C||(o.rgb=C={})),(function(y){function j(N,R,T){const B=N>>24&255,H=N>>16&255,G=N>>8&255;let Y=R>>24&255,q=R>>16&255,O=R>>8&255,W=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(B,H,G));for(;W<T&&(Y>0||q>0||O>0);)Y-=Math.max(0,Math.ceil(.1*Y)),q-=Math.max(0,Math.ceil(.1*q)),O-=Math.max(0,Math.ceil(.1*O)),W=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(B,H,G));return(Y<<24|q<<16|O<<8|255)>>>0}function A(N,R,T){const B=N>>24&255,H=N>>16&255,G=N>>8&255;let Y=R>>24&255,q=R>>16&255,O=R>>8&255,W=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(B,H,G));for(;W<T&&(Y<255||q<255||O<255);)Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),q=Math.min(255,q+Math.ceil(.1*(255-q))),O=Math.min(255,O+Math.ceil(.1*(255-O))),W=x(C.relativeLuminance2(Y,q,O),C.relativeLuminance2(B,H,G));return(Y<<24|q<<16|O<<8|255)>>>0}y.blend=function(N,R){if(p=(255&R)/255,p===1)return R;const T=R>>24&255,B=R>>16&255,H=R>>8&255,G=N>>24&255,Y=N>>16&255,q=N>>8&255;return d=G+Math.round((T-G)*p),f=Y+Math.round((B-Y)*p),g=q+Math.round((H-q)*p),v.toRgba(d,f,g)},y.ensureContrastRatio=function(N,R,T){const B=C.relativeLuminance(N>>8),H=C.relativeLuminance(R>>8);if(x(B,H)<T){if(H<B){const q=j(N,R,T),O=x(B,C.relativeLuminance(q>>8));if(O<T){const W=A(N,R,T);return O>x(B,C.relativeLuminance(W>>8))?q:W}return q}const G=A(N,R,T),Y=x(B,C.relativeLuminance(G>>8));if(Y<T){const q=j(N,R,T);return Y>x(B,C.relativeLuminance(q>>8))?G:q}return G}},y.reduceLuminance=j,y.increaseLuminance=A,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(b||(o.rgba=b={})),o.toPaddedHex=_,o.contrastRatio=x},8969:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=d(844),g=d(2585),p=d(4348),v=d(7866),S=d(744),E=d(7302),C=d(6975),b=d(8460),_=d(1753),x=d(1480),y=d(7994),j=d(9282),A=d(5435),N=d(5981),R=d(2660);let T=!1;class B extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((G=>{var Y;(Y=this._onScrollApi)==null||Y.fire(G.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(G){for(const Y in G)this.optionsService.options[Y]=G[Y]}constructor(G){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new p.InstantiationService,this.optionsService=this.register(new E.OptionsService(G)),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(v.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(_.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(y.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,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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,q)=>this._inputHandler.parse(Y,q)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(G,Y){this._writeBuffer.write(G,Y)}writeSync(G,Y){this._logService.logLevel<=g.LogLevelEnum.WARN&&!T&&(this._logService.warn("writeSync is unreliable and will be removed soon."),T=!0),this._writeBuffer.writeSync(G,Y)}input(G,Y=!0){this.coreService.triggerDataEvent(G,Y)}resize(G,Y){isNaN(G)||isNaN(Y)||(G=Math.max(G,S.MINIMUM_COLS),Y=Math.max(Y,S.MINIMUM_ROWS),this._bufferService.resize(G,Y))}scroll(G,Y=!1){this._bufferService.scroll(G,Y)}scrollLines(G,Y,q){this._bufferService.scrollLines(G,Y,q)}scrollPages(G){this.scrollLines(G*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(G){const Y=G-this._bufferService.buffer.ydisp;Y!==0&&this.scrollLines(Y)}registerEscHandler(G,Y){return this._inputHandler.registerEscHandler(G,Y)}registerDcsHandler(G,Y){return this._inputHandler.registerDcsHandler(G,Y)}registerCsiHandler(G,Y){return this._inputHandler.registerCsiHandler(G,Y)}registerOscHandler(G,Y){return this._inputHandler.registerOscHandler(G,Y)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let G=!1;const Y=this.optionsService.rawOptions.windowsPty;Y&&Y.buildNumber!==void 0&&Y.buildNumber!==void 0?G=Y.backend==="conpty"&&Y.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(G=!0),G?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const G=[];G.push(this.onLineFeed(j.updateWindowsModeWrappedState.bind(null,this._bufferService))),G.push(this.registerCsiHandler({final:"H"},(()=>((0,j.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const Y of G)Y.dispose()}))}}}o.CoreTerminal=B},8460:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.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 p=0;p<this._listeners.length;p++)g.push(this._listeners[p]);for(let p=0;p<g.length;p++)g[p].call(void 0,d,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(d,f){return d((g=>f.fire(g)))},o.runAndSubscribe=function(d,f){return f(void 0),d((g=>f(g)))}},5435:function(m,o,d){var f=this&&this.__decorate||function(ee,L,D,I){var U,P=arguments.length,K=P<3?L:I===null?I=Object.getOwnPropertyDescriptor(L,D):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(ee,L,D,I);else for(var te=ee.length-1;te>=0;te--)(U=ee[te])&&(K=(P<3?U(K):P>3?U(L,D,K):U(L,D))||K);return P>3&&K&&Object.defineProperty(L,D,K),K},g=this&&this.__param||function(ee,L){return function(D,I){L(D,I,ee)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const p=d(2584),v=d(7116),S=d(2015),E=d(844),C=d(482),b=d(8437),_=d(8460),x=d(643),y=d(511),j=d(3734),A=d(2585),N=d(1480),R=d(6242),T=d(6351),B=d(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},G=131072;function Y(ee,L){if(ee>24)return L.setWinLines||!1;switch(ee){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var q;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(q||(o.WindowsOptionsReportType=q={}));let O=0;class W extends E.Disposable{getAttrData(){return this._curAttrData}constructor(L,D,I,U,P,K,te,Z,X=new S.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=D,this._coreService=I,this._logService=U,this._optionsService=P,this._oscLinkService=K,this._coreMouseService=te,this._unicodeService=Z,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.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 V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:ae.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,ae,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:ae,data:se})})),this._parser.setDcsHandlerFallback(((z,ae,se)=>{ae==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:ae,payload:se})})),this._parser.setPrintHandler(((z,ae,se)=>this.print(z,ae,se))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!1))),this._parser.setExecuteHandler(p.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(p.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(p.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(p.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(p.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(p.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(p.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(p.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(p.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(p.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new R.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new R.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new R.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new R.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new R.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new R.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new R.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new R.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new R.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new R.OscHandler((z=>this.restoreCursorColor(z)))),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 z in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new T.DcsHandler(((z,ae)=>this.requestStatusString(z,ae))))}_preserveStack(L,D,I,U){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=D,this._parseStack.decodedLength=I,this._parseStack.position=U}_logSlowResolvingAsync(L){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([L,new Promise(((D,I)=>setTimeout((()=>I("#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(L,D){let I,U=this._activeBuffer.x,P=this._activeBuffer.y,K=0;const te=this._parseStack.paused;if(te){if(I=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,D))return this._logSlowResolvingAsync(I),I;U=this._parseStack.cursorStartX,P=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>G&&(K=this._parseStack.position+G)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(z=>String.fromCharCode(z))).join("")}"`),typeof L=="string"?L.split("").map((z=>z.charCodeAt(0))):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<G&&(this._parseBuffer=new Uint32Array(Math.min(L.length,G))),te||this._dirtyRowTracker.clearRange(),L.length>G)for(let z=K;z<L.length;z+=G){const ae=z+G<L.length?z+G:L.length,se=typeof L=="string"?this._stringDecoder.decode(L.substring(z,ae),this._parseBuffer):this._utf8Decoder.decode(L.subarray(z,ae),this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,se))return this._preserveStack(U,P,se,z),this._logSlowResolvingAsync(I),I}else if(!te){const z=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(I=this._parser.parse(this._parseBuffer,z))return this._preserveStack(U,P,z,0),this._logSlowResolvingAsync(I),I}this._activeBuffer.x===U&&this._activeBuffer.y===P||this._onCursorMove.fire();const Z=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(Z,this._bufferService.rows-1))}print(L,D,I){let U,P;const K=this._charsetService.charset,te=this._optionsService.rawOptions.screenReaderMode,Z=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,z=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&&I-D>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ge=this._parser.precedingJoinState;for(let ve=D;ve<I;++ve){if(U=L[ve],U<127&&K){const Fe=K[String.fromCharCode(U)];Fe&&(U=Fe.charCodeAt(0))}const Ne=this._unicodeService.charProperties(U,ge);P=N.UnicodeService.extractWidth(Ne);const De=N.UnicodeService.extractShouldJoin(Ne),Oe=De?N.UnicodeService.extractWidth(ge):0;if(ge=Ne,te&&this._onA11yChar.fire((0,C.stringFromCodePoint)(U)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+P-Oe>Z){if(X){const Fe=se;let ke=this._activeBuffer.x-Oe;for(this._activeBuffer.x=Oe,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),Oe>0&&se instanceof b.BufferLine&&se.copyCellsFrom(Fe,ke,0,Oe,!1);ke<Z;)Fe.setCellFromCodepoint(ke++,0,1,ae)}else if(this._activeBuffer.x=Z-1,P===2)continue}if(De&&this._activeBuffer.x){const Fe=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-Fe,U,P);for(let ke=P-Oe;--ke>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(z&&(se.insertCells(this._activeBuffer.x,P-Oe,this._activeBuffer.getNullCell(ae)),se.getWidth(Z-1)===2&&se.setCellFromCodepoint(Z-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ae)),se.setCellFromCodepoint(this._activeBuffer.x++,U,P,ae),P>0)for(;--P;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ge,this._activeBuffer.x<Z&&I-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(L,D){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,D):this._parser.registerCsiHandler(L,(I=>!Y(I.params[0],this._optionsService.rawOptions.windowOptions)||D(I)))}registerDcsHandler(L,D){return this._parser.registerDcsHandler(L,new T.DcsHandler(D))}registerEscHandler(L,D){return this._parser.registerEscHandler(L,D)}registerOscHandler(L,D){return this._parser.registerOscHandler(L,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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.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 L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,D){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+D):(this._activeBuffer.x=L,this._activeBuffer.y=D),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,D){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+D)}cursorUp(L){const D=this._activeBuffer.y-this._activeBuffer.scrollTop;return D>=0?this._moveCursor(0,-Math.min(D,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const D=this._activeBuffer.scrollBottom-this._activeBuffer.y;return D>=0?this._moveCursor(0,Math.min(D,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const D=L.params[0];return D===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:D===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=L.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let D=L.params[0]||1;for(;D--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const D=L.params[0];return D===1&&(this._curAttrData.bg|=536870912),D!==2&&D!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,D,I,U=!1,P=!1){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);K.replaceCells(D,I,this._activeBuffer.getNullCell(this._eraseAttrData()),P),U&&(K.isWrapped=!1)}_resetBufferLine(L,D=!1){const I=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);I&&(I.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),D),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),I.isWrapped=!1)}eraseInDisplay(L,D=!1){let I;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,D);I<this._bufferService.rows;I++)this._resetBufferLine(I,D);this._dirtyRowTracker.markDirty(I);break;case 1:for(I=this._activeBuffer.y,this._dirtyRowTracker.markDirty(I),this._eraseInBufferLine(I,0,this._activeBuffer.x+1,!0,D),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(I+1).isWrapped=!1);I--;)this._resetBufferLine(I,D);this._dirtyRowTracker.markDirty(0);break;case 2:for(I=this._bufferService.rows,this._dirtyRowTracker.markDirty(I-1);I--;)this._resetBufferLine(I,D);this._dirtyRowTracker.markDirty(0);break;case 3:const U=this._activeBuffer.lines.length-this._bufferService.rows;U>0&&(this._activeBuffer.lines.trimStart(U),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-U,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-U,0),this._onScroll.fire(0))}return!0}eraseInLine(L,D=!1){switch(this._restrictCursor(this._bufferService.cols),L.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(L){this._restrictCursor();let D=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y,U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-U+1;for(;D--;)this._activeBuffer.lines.splice(P-1,1),this._activeBuffer.lines.splice(I,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let D=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const I=this._activeBuffer.ybase+this._activeBuffer.y;let U;for(U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-U;D--;)this._activeBuffer.lines.splice(I,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let D=L.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(L){let D=L.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(b.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);U.deleteCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);U.insertCells(0,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);U.insertCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=L.params[0]||1;for(let I=this._activeBuffer.scrollTop;I<=this._activeBuffer.scrollBottom;++I){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);U.deleteCells(this._activeBuffer.x,D,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return D&&(D.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const D=this._parser.precedingJoinState;if(!D)return!0;const I=L.params[0]||1,U=N.UnicodeService.extractWidth(D),P=this._activeBuffer.x-U,K=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(P),te=new Uint32Array(K.length*I);let Z=0;for(let z=0;z<K.length;){const ae=K.codePointAt(z)||0;te[Z++]=ae,z+=ae>65535?2:1}let X=Z;for(let z=1;z<I;++z)te.copyWithin(X,0,Z),X+=Z;return this.print(te,0,X),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(p.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(p.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(p.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(p.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(p.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.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(L){for(let D=0;D<L.length;D++)switch(L.params[D]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let D=0;D<L.length;D++)switch(L.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(),L.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(L,D){const I=this._coreService.decPrivateModes,{activeProtocol:U,activeEncoding:P}=this._coreMouseService,K=this._coreService,{buffers:te,cols:Z}=this._bufferService,{active:X,alt:z}=te,ae=this._optionsService.rawOptions,se=De=>De?1:2,ge=L.params[0];return ve=ge,Ne=D?ge===2?4:ge===4?se(K.modes.insertMode):ge===12?3:ge===20?se(ae.convertEol):0:ge===1?se(I.applicationCursorKeys):ge===3?ae.windowOptions.setWinLines?Z===80?2:Z===132?1:0:0:ge===6?se(I.origin):ge===7?se(I.wraparound):ge===8?3:ge===9?se(U==="X10"):ge===12?se(ae.cursorBlink):ge===25?se(!K.isCursorHidden):ge===45?se(I.reverseWraparound):ge===66?se(I.applicationKeypad):ge===67?4:ge===1e3?se(U==="VT200"):ge===1002?se(U==="DRAG"):ge===1003?se(U==="ANY"):ge===1004?se(I.sendFocus):ge===1005?4:ge===1006?se(P==="SGR"):ge===1015?4:ge===1016?se(P==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?se(X===z):ge===2004?se(I.bracketedPasteMode):0,K.triggerDataEvent(`${p.C0.ESC}[${D?"":"?"}${ve};${Ne}$y`),!0;var ve,Ne}_updateAttrColor(L,D,I,U,P){return D===2?(L|=50331648,L&=-16777216,L|=j.AttributeData.fromColorRGB([I,U,P])):D===5&&(L&=-50331904,L|=33554432|255&I),L}_extractColor(L,D,I){const U=[0,0,-1,0,0,0];let P=0,K=0;do{if(U[K+P]=L.params[D+K],L.hasSubParams(D+K)){const te=L.getSubParams(D+K);let Z=0;do U[1]===5&&(P=1),U[K+Z+1+P]=te[Z];while(++Z<te.length&&Z+K+1+P<U.length);break}if(U[1]===5&&K+P>=2||U[1]===2&&K+P>=5)break;U[1]&&(P=1)}while(++K+D<L.length&&K+P<U.length);for(let te=2;te<U.length;++te)U[te]===-1&&(U[te]=0);switch(U[0]){case 38:I.fg=this._updateAttrColor(I.fg,U[1],U[3],U[4],U[5]);break;case 48:I.bg=this._updateAttrColor(I.bg,U[1],U[3],U[4],U[5]);break;case 58:I.extended=I.extended.clone(),I.extended.underlineColor=this._updateAttrColor(I.extended.underlineColor,U[1],U[3],U[4],U[5])}return K}_processUnderline(L,D){D.extended=D.extended.clone(),(!~L||L>5)&&(L=1),D.extended.underlineStyle=L,D.fg|=268435456,L===0&&(D.fg&=-268435457),D.updateExtended()}_processSGR0(L){L.fg=b.DEFAULT_ATTR_DATA.fg,L.bg=b.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const D=L.length;let I;const U=this._curAttrData;for(let P=0;P<D;P++)I=L.params[P],I>=30&&I<=37?(U.fg&=-50331904,U.fg|=16777216|I-30):I>=40&&I<=47?(U.bg&=-50331904,U.bg|=16777216|I-40):I>=90&&I<=97?(U.fg&=-50331904,U.fg|=16777224|I-90):I>=100&&I<=107?(U.bg&=-50331904,U.bg|=16777224|I-100):I===0?this._processSGR0(U):I===1?U.fg|=134217728:I===3?U.bg|=67108864:I===4?(U.fg|=268435456,this._processUnderline(L.hasSubParams(P)?L.getSubParams(P)[0]:1,U)):I===5?U.fg|=536870912:I===7?U.fg|=67108864:I===8?U.fg|=1073741824:I===9?U.fg|=2147483648:I===2?U.bg|=134217728:I===21?this._processUnderline(2,U):I===22?(U.fg&=-134217729,U.bg&=-134217729):I===23?U.bg&=-67108865:I===24?(U.fg&=-268435457,this._processUnderline(0,U)):I===25?U.fg&=-536870913:I===27?U.fg&=-67108865:I===28?U.fg&=-1073741825:I===29?U.fg&=2147483647:I===39?(U.fg&=-67108864,U.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):I===49?(U.bg&=-67108864,U.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):I===38||I===48||I===58?P+=this._extractColor(L,P,U):I===53?U.bg|=1073741824:I===55?U.bg&=-1073741825:I===59?(U.extended=U.extended.clone(),U.extended.underlineColor=-1,U.updateExtended()):I===100?(U.fg&=-67108864,U.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,U.bg&=-67108864,U.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",I);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${p.C0.ESC}[0n`);break;case 6:const D=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[${D};${I}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const D=this._activeBuffer.y+1,I=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${p.C0.ESC}[?${D};${I}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.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(L){const D=L.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 I=D%2==1;return this._optionsService.options.cursorBlink=I,!0}setScrollRegion(L){const D=L.params[0]||1;let I;return(L.length<2||(I=L.params[1])>this._bufferService.rows||I===0)&&(I=this._bufferService.rows),I>D&&(this._activeBuffer.scrollTop=D-1,this._activeBuffer.scrollBottom=I-1,this._setCursor(0,0)),!0}windowOptions(L){if(!Y(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const D=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire(q.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(q.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${p.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(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const D=[],I=L.split(";");for(;I.length>1;){const U=I.shift(),P=I.shift();if(/^\d+$/.exec(U)){const K=parseInt(U);if(Q(K))if(P==="?")D.push({type:0,index:K});else{const te=(0,B.parseColor)(P);te&&D.push({type:1,index:K,color:te})}}}return D.length&&this._onColor.fire(D),!0}setHyperlink(L){const D=L.split(";");return!(D.length<2)&&(D[1]?this._createHyperlink(D[0],D[1]):!D[0]&&this._finishHyperlink())}_createHyperlink(L,D){this._getCurrentLinkId()&&this._finishHyperlink();const I=L.split(":");let U;const P=I.findIndex((K=>K.startsWith("id=")));return P!==-1&&(U=I[P].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:U,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(L,D){const I=L.split(";");for(let U=0;U<I.length&&!(D>=this._specialColors.length);++U,++D)if(I[U]==="?")this._onColor.fire([{type:0,index:this._specialColors[D]}]);else{const P=(0,B.parseColor)(I[U]);P&&this._onColor.fire([{type:1,index:this._specialColors[D],color:P}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const D=[],I=L.split(";");for(let U=0;U<I.length;++U)if(/^\d+$/.exec(I[U])){const P=parseInt(I[U]);Q(P)&&D.push({type:2,index:P})}return D.length&&this._onColor.fire(D),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){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,v.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(H[L[0]],v.CHARSETS[L[1]]||v.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 L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new y.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let D=0;D<this._bufferService.rows;++D){const I=this._activeBuffer.ybase+this._activeBuffer.y+D,U=this._activeBuffer.lines.get(I);U&&(U.fill(L),U.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,D){const I=this._bufferService.buffer,U=this._optionsService.rawOptions;return(P=>(this._coreService.triggerDataEvent(`${p.C0.ESC}${P}${p.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${I.scrollTop+1};${I.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[U.cursorStyle]-(U.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,D){this._dirtyRowTracker.markRangeDirty(L,D)}}o.InputHandler=W;let V=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){ee<this.start?this.start=ee:ee>this.end&&(this.end=ee)}markRangeDirty(ee,L){ee>L&&(O=ee,ee=L,L=O),ee<this.start&&(this.start=ee),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(ee){return 0<=ee&&ee<256}V=f([g(0,A.IBufferService)],V)},844:(m,o)=>{function d(f){for(const g of f)g.dispose();f.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.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)}},o.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}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=d,o.getDisposeArrayDisposable=function(f){return{dispose:()=>d(f)}}},1505:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class d{constructor(){this._data={}}set(g,p,v){this._data[g]||(this._data[g]={}),this._data[g][p]=v}get(g,p){return this._data[g]?this._data[g][p]:void 0}clear(){this._data={}}}o.TwoKeyMap=d,o.FourKeyMap=class{constructor(){this._data=new d}set(f,g,p,v,S){this._data.get(f,g)||this._data.set(f,g,new d),this._data.get(f,g).set(p,v,S)}get(f,g,p,v){var S;return(S=this._data.get(f,g))==null?void 0:S.get(p,v)}clear(){this._data.clear()}}},6114:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const d=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=d.includes("Firefox"),o.isLegacyEdge=d.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(d),o.getSafariVersion=function(){if(!o.isSafari)return 0;const g=d.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(d)},6106:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let d=0;o.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,p=this._array.length-1;for(;p>=g;){let v=g+p>>1;const S=this._getKey(this._array[v]);if(S>f)p=v-1;else{if(!(S<f)){for(;v>0&&this._getKey(this._array[v-1])===f;)v--;return v}g=v+1}}return g}}},7226:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.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 E=0,C=0,b=S.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(E=Date.now(),this._tasks[this._i]()||this._i++,E=Math.max(1,Date.now()-E),C=Math.max(E,C),_=S.timeRemaining(),1.5*C>_)return b-E<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-E))}ms`),void this._start();b=_}this.clear()}}class p extends g{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const E=Date.now()+S;return{timeRemaining:()=>Math.max(0,E-Date.now())}}}o.PriorityTaskQueue=p,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:p,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=d(643);o.updateWindowsModeWrappedState=function(g){const p=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),v=p==null?void 0:p.get(g.cols-1),S=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);S&&v&&(S.isWrapped=v[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&v[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class d{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(p){return[p>>>16&255,p>>>8&255,255&p]}static fromColorRGB(p){return(255&p[0])<<16|(255&p[1])<<8|255&p[2]}clone(){const p=new d;return p.fg=this.fg,p.bg=this.bg,p.extended=this.extended.clone(),p}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}}o.AttributeData=d;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(p){this._ext=p}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(p){this._ext&=-469762049,this._ext|=p<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(p){this._ext&=-67108864,this._ext|=67108863&p}get urlId(){return this._urlId}set urlId(p){this._urlId=p}get underlineVariantOffset(){const p=(3758096384&this._ext)>>29;return p<0?4294967288^p:p}set underlineVariantOffset(p){this._ext&=536870911,this._ext|=p<<29&3758096384}constructor(p=0,v=0){this._ext=0,this._urlId=0,this._ext=p,this._urlId=v}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=d(6349),g=d(7226),p=d(3734),v=d(8437),S=d(4634),E=d(511),C=d(643),b=d(4863),_=d(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,y,j){this._hasScrollback=x,this._optionsService=y,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=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=E.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=E.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 p.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 p.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,y){return new v.BufferLine(this._bufferService.cols,this.getNullCell(x),y)}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 y=x+this._optionsService.rawOptions.scrollback;return y>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=v.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)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,y){const j=this.getNullCell(v.DEFAULT_ATTR_DATA);let A=0;const N=this._getCorrectBufferLength(y);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<y)for(let T=this._rows;T<y;T++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.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 v.BufferLine(x,j)));else for(let T=this._rows;T>y;T--)this.lines.length>y+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,y-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(x,y),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=y,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 y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>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,y){this._cols!==x&&(x>this._cols?this._reflowLarger(x,y):this._reflowSmaller(x,y))}_reflowLarger(x,y){const j=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(v.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,y,A.countRemoved)}}_reflowLargerAdjustViewport(x,y,j){const A=this.getNullCell(v.DEFAULT_ATTR_DATA);let N=j;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new v.BufferLine(x,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-j,0)}_reflowSmaller(x,y){const j=this.getNullCell(v.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 B=[T];for(;T.isWrapped&&R>0;)T=this.lines.get(--R),B.unshift(T);const H=this.ybase+this.y;if(H>=R&&H<R+B.length)continue;const G=B[B.length-1].getTrimmedLength(),Y=(0,S.reflowSmallerGetNewLineLengths)(B,this._cols,x),q=Y.length-B.length;let O;O=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+q):Math.max(0,this.lines.length-this.lines.maxLength+q);const W=[];for(let I=0;I<q;I++){const U=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);W.push(U)}W.length>0&&(A.push({start:R+B.length+N,newLines:W}),N+=W.length),B.push(...W);let V=Y.length-1,Q=Y[V];Q===0&&(V--,Q=Y[V]);let ee=B.length-q-1,L=G;for(;ee>=0;){const I=Math.min(L,Q);if(B[V]===void 0)break;if(B[V].copyCellsFrom(B[ee],L-I,Q-I,I,!0),Q-=I,Q===0&&(V--,Q=Y[V]),L-=I,L===0){ee--;const U=Math.max(ee,0);L=(0,S.getWrappedLineTrimmedLength)(B,U,this._cols)}}for(let I=0;I<B.length;I++)Y[I]<x&&B[I].setCell(Y[I],j);let D=q-O;for(;D-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+N)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+q,this.ybase+y-1)}if(A.length>0){const R=[],T=[];for(let V=0;V<this.lines.length;V++)T.push(this.lines.get(V));const B=this.lines.length;let H=B-1,G=0,Y=A[G];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+N);let q=0;for(let V=Math.min(this.lines.maxLength-1,B+N-1);V>=0;V--)if(Y&&Y.start>H+q){for(let Q=Y.newLines.length-1;Q>=0;Q--)this.lines.set(V--,Y.newLines[Q]);V++,R.push({index:H+1,amount:Y.newLines.length}),q+=Y.newLines.length,Y=A[++G]}else this.lines.set(V,T[H--]);let O=0;for(let V=R.length-1;V>=0;V--)R[V].index+=O,this.lines.onInsertEmitter.fire(R[V]),O+=R[V].amount;const W=Math.max(0,B+N-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(x,y,j=0,A){const N=this.lines.get(x);return N?N.translateToString(y,j,A):""}getWrappedRangeForLine(x){let y=x,j=x;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;j+1<this.lines.length&&this.lines.get(j+1).isWrapped;)j++;return{first:y,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 y=0;y<this.markers.length;y++)this.markers[y].line===x&&(this.markers[y].dispose(),this.markers.splice(y--,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 y=new b.Marker(x);return this.markers.push(y),y.register(this.lines.onTrim((j=>{y.line-=j,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((j=>{y.line>=j.index&&(y.line+=j.amount)}))),y.register(this.lines.onDelete((j=>{y.line>=j.index&&y.line<j.index+j.amount&&y.dispose(),y.line>j.index&&(y.line-=j.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=d(3734),g=d(511),p=d(643),v=d(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let S=0;class E{constructor(b,_,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=_||g.CellData.fromCharData([0,p.NULL_CELL_CHAR,p.NULL_CELL_WIDTH,p.NULL_CELL_CODE]);for(let j=0;j<b;++j)this.setCell(j,y);this.length=b}get(b){const _=this._data[3*b+0],x=2097151&_;return[this._data[3*b+1],2097152&_?this._combined[b]:x?(0,v.stringFromCodePoint)(x):"",_>>22,2097152&_?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,_){this._data[3*b+1]=_[p.CHAR_DATA_ATTR_INDEX],_[p.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=_[1],this._data[3*b+0]=2097152|b|_[p.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=_[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[p.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const _=this._data[3*b+0];return 2097152&_?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&_}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const _=this._data[3*b+0];return 2097152&_?this._combined[b]:2097151&_?(0,v.stringFromCodePoint)(2097151&_):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,_){return S=3*b,_.content=this._data[S+0],_.fg=this._data[S+1],_.bg=this._data[S+2],2097152&_.content&&(_.combinedData=this._combined[b]),268435456&_.bg&&(_.extended=this._extendedAttrs[b]),_}setCell(b,_){2097152&_.content&&(this._combined[b]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[b]=_.extended),this._data[3*b+0]=_.content,this._data[3*b+1]=_.fg,this._data[3*b+2]=_.bg}setCellFromCodepoint(b,_,x,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=_|x<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,_,x){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,v.stringFromCodePoint)(_):2097151&y?(this._combined[b]=(0,v.stringFromCodePoint)(2097151&y)+(0,v.stringFromCodePoint)(_),y&=-2097152,y|=2097152):y=_|4194304,x&&(y&=-12582913,y|=x<<22),this._data[3*b+0]=y}insertCells(b,_,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),_<this.length-b){const y=new g.CellData;for(let j=this.length-b-_-1;j>=0;--j)this.setCell(b+_+j,this.loadCell(b+j,y));for(let j=0;j<_;++j)this.setCell(b+j,x)}else for(let y=b;y<this.length;++y)this.setCell(y,x);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,x)}deleteCells(b,_,x){if(b%=this.length,_<this.length-b){const y=new g.CellData;for(let j=0;j<this.length-b-_;++j)this.setCell(b+j,this.loadCell(b+_+j,y));for(let j=this.length-_;j<this.length;++j)this.setCell(j,x)}else for(let y=b;y<this.length;++y)this.setCell(y,x);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,x)}replaceCells(b,_,x,y=!1){if(y)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,x),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,x);b<_&&b<this.length;)this.isProtected(b)||this.setCell(b,x),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,x);b<_&&b<this.length;)this.setCell(b++,x)}resize(b,_){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const x=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const y=new Uint32Array(x);y.set(this._data),this._data=y}for(let y=this.length;y<b;++y)this.setCell(y,_)}else{this._data=this._data.subarray(0,x);const y=Object.keys(this._combined);for(let A=0;A<y.length;A++){const N=parseInt(y[A],10);N>=b&&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>=b&&delete this._extendedAttrs[N]}}return this.length=b,4*x*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,_=!1){if(_)for(let x=0;x<this.length;++x)this.isProtected(x)||this.setCell(x,b);else{this._combined={},this._extendedAttrs={};for(let x=0;x<this.length;++x)this.setCell(x,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const _ in b._combined)this._combined[_]=b._combined[_];this._extendedAttrs={};for(const _ in b._extendedAttrs)this._extendedAttrs[_]=b._extendedAttrs[_];this.isWrapped=b.isWrapped}clone(){const b=new E(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const _ in this._combined)b._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)b._extendedAttrs[_]=this._extendedAttrs[_];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,_,x,y,j){const A=b._data;if(j)for(let R=y-1;R>=0;R--){for(let T=0;T<3;T++)this._data[3*(x+R)+T]=A[3*(_+R)+T];268435456&A[3*(_+R)+2]&&(this._extendedAttrs[x+R]=b._extendedAttrs[_+R])}else for(let R=0;R<y;R++){for(let T=0;T<3;T++)this._data[3*(x+R)+T]=A[3*(_+R)+T];268435456&A[3*(_+R)+2]&&(this._extendedAttrs[x+R]=b._extendedAttrs[_+R])}const N=Object.keys(b._combined);for(let R=0;R<N.length;R++){const T=parseInt(N[R],10);T>=_&&(this._combined[T-_+x]=b._combined[T])}}translateToString(b,_,x,y){_=_??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),y&&(y.length=0);let j="";for(;_<x;){const A=this._data[3*_+0],N=2097151&A,R=2097152&A?this._combined[_]:N?(0,v.stringFromCodePoint)(N):p.WHITESPACE_CELL_CHAR;if(j+=R,y)for(let T=0;T<R.length;++T)y.push(_);_+=A>>22||1}return y&&y.push(_),j}}o.BufferLine=E},4841:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.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:(m,o)=>{function d(f,g,p){if(g===f.length-1)return f[g].getTrimmedLength();const v=!f[g].hasContent(p-1)&&f[g].getWidth(p-1)===1,S=f[g+1].getWidth(0)===2;return v&&S?p-1:p}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(f,g,p,v,S){const E=[];for(let C=0;C<f.length-1;C++){let b=C,_=f.get(++b);if(!_.isWrapped)continue;const x=[f.get(C)];for(;b<f.length&&_.isWrapped;)x.push(_),_=f.get(++b);if(v>=C&&v<b){C+=x.length-1;continue}let y=0,j=d(x,y,g),A=1,N=0;for(;A<x.length;){const T=d(x,A,g),B=T-N,H=p-j,G=Math.min(B,H);x[y].copyCellsFrom(x[A],N,j,G,!1),j+=G,j===p&&(y++,j=0),N+=G,N===T&&(A++,N=0),j===0&&y!==0&&x[y-1].getWidth(p-1)===2&&(x[y].copyCellsFrom(x[y-1],p-1,j++,1,!1),x[y-1].setCell(p-1,S))}x[y].replaceCells(j,p,S);let R=0;for(let T=x.length-1;T>0&&(T>y||x[T].getTrimmedLength()===0);T--)R++;R>0&&(E.push(C+x.length-R),E.push(R)),C+=x.length-1}return E},o.reflowLargerCreateNewLayout=function(f,g){const p=[];let v=0,S=g[v],E=0;for(let C=0;C<f.length;C++)if(S===C){const b=g[++v];f.onDeleteEmitter.fire({index:C-E,amount:b}),C+=b-1,E+=b,S=g[++v]}else p.push(C);return{layout:p,countRemoved:E}},o.reflowLargerApplyNewLayout=function(f,g){const p=[];for(let v=0;v<g.length;v++)p.push(f.get(g[v]));for(let v=0;v<p.length;v++)f.set(v,p[v]);f.length=g.length},o.reflowSmallerGetNewLineLengths=function(f,g,p){const v=[],S=f.map(((_,x)=>d(f,x,g))).reduce(((_,x)=>_+x));let E=0,C=0,b=0;for(;b<S;){if(S-b<p){v.push(S-b);break}E+=p;const _=d(f,C,g);E>_&&(E-=_,C++);const x=f[C].getWidth(E-1)===2;x&&E--;const y=x?p-1:p;v.push(y),b+=y}return v},o.getWrappedLineTrimmedLength=d},5295:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=d(8460),g=d(844),p=d(9092);class v extends g.Disposable{constructor(E,C){super(),this._optionsService=E,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 p.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new p.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(E){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(E),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(E,C){this._normal.resize(E,C),this._alt.resize(E,C),this.setupTabStops(E)}setupTabStops(E){this._normal.setupTabStops(E),this._alt.setupTabStops(E)}}o.BufferSet=v},511:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=d(482),g=d(643),p=d(3734);class v extends p.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new p.ExtendedAttrs,this.combinedData=""}static fromCharData(E){const C=new v;return C.setFromCharData(E),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(E){this.fg=E[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(E[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(E[g.CHAR_DATA_CHAR_INDEX].length===2){const b=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const _=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(b-55296)+_-56320+65536|E[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=E[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|E[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=E[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|E[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=v},643:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=d(8460),g=d(844);class p{get id(){return this._id}constructor(S){this.line=S,this.isDisposed=!1,this._disposables=[],this._id=p._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}}o.Marker=p,p._nextId=1},7116:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(m,o)=>{var d,f,g;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(p){p.NUL="\0",p.SOH="",p.STX="",p.ETX="",p.EOT="",p.ENQ="",p.ACK="",p.BEL="\x07",p.BS="\b",p.HT=" ",p.LF=`
|
|
64
|
-
`,p.VT="\v",p.FF="\f",p.CR="\r",p.SO="",p.SI="",p.DLE="",p.DC1="",p.DC2="",p.DC3="",p.DC4="",p.NAK="",p.SYN="",p.ETB="",p.CAN="",p.EM="",p.SUB="",p.ESC="\x1B",p.FS="",p.GS="",p.RS="",p.US="",p.SP=" ",p.DEL=""})(d||(o.C0=d={})),(function(p){p.PAD="",p.HOP="",p.BPH="",p.NBH="",p.IND="",p.NEL="
",p.SSA="",p.ESA="",p.HTS="",p.HTJ="",p.VTS="",p.PLD="",p.PLU="",p.RI="",p.SS2="",p.SS3="",p.DCS="",p.PU1="",p.PU2="",p.STS="",p.CCH="",p.MW="",p.SPA="",p.EPA="",p.SOS="",p.SGCI="",p.SCI="",p.CSI="",p.ST="",p.OSC="",p.PM="",p.APC=""})(f||(o.C1=f={})),(function(p){p.ST=`${d.ESC}\\`})(g||(o.C1_ESCAPED=g={}))},7399:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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:["'",'"']};o.evaluateKeyboardEvent=function(p,v,S,E){const C={type:0,cancel:!1,key:void 0},b=(p.shiftKey?1:0)|(p.altKey?2:0)|(p.ctrlKey?4:0)|(p.metaKey?8:0);switch(p.keyCode){case 0:p.key==="UIKeyInputUpArrow"?C.key=v?f.C0.ESC+"OA":f.C0.ESC+"[A":p.key==="UIKeyInputLeftArrow"?C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D":p.key==="UIKeyInputRightArrow"?C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C":p.key==="UIKeyInputDownArrow"&&(C.key=v?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=p.ctrlKey?"\b":f.C0.DEL,p.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(p.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=p.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,p.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(p.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(S?"b":"[1;5D"))):C.key=v?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(p.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(S?"f":"[1;5C"))):C.key=v?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(p.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",S||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=v?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(p.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",S||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=v?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:p.shiftKey||p.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":v?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":v?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:p.shiftKey?C.type=2:p.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:p.shiftKey?C.type=3:p.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+1)+"~":f.C0.ESC+"[24~";break;default:if(!p.ctrlKey||p.shiftKey||p.altKey||p.metaKey)if(S&&!E||!p.altKey||p.metaKey)!S||p.altKey||p.ctrlKey||p.shiftKey||!p.metaKey?p.key&&!p.ctrlKey&&!p.altKey&&!p.metaKey&&p.keyCode>=48&&p.key.length===1?C.key=p.key:p.key&&p.ctrlKey&&(p.key==="_"&&(C.key=f.C0.US),p.key==="@"&&(C.key=f.C0.NUL)):p.keyCode===65&&(C.type=1);else{const _=g[p.keyCode],x=_==null?void 0:_[p.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(p.keyCode>=65&&p.keyCode<=90){const y=p.ctrlKey?p.keyCode-64:p.keyCode+32;let j=String.fromCharCode(y);p.shiftKey&&(j=j.toUpperCase()),C.key=f.C0.ESC+j}else if(p.keyCode===32)C.key=f.C0.ESC+(p.ctrlKey?f.C0.NUL:" ");else if(p.key==="Dead"&&p.code.startsWith("Key")){let y=p.code.slice(3,4);p.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else p.keyCode>=65&&p.keyCode<=90?C.key=String.fromCharCode(p.keyCode-64):p.keyCode===32?C.key=f.C0.NUL:p.keyCode>=51&&p.keyCode<=55?C.key=String.fromCharCode(p.keyCode-51+27):p.keyCode===56?C.key=f.C0.DEL:p.keyCode===219?C.key=f.C0.ESC:p.keyCode===220?C.key=f.C0.FS:p.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(d){return d>65535?(d-=65536,String.fromCharCode(55296+(d>>10))+String.fromCharCode(d%1024+56320)):String.fromCharCode(d)},o.utf32ToString=function(d,f=0,g=d.length){let p="";for(let v=f;v<g;++v){let S=d[v];S>65535?(S-=65536,p+=String.fromCharCode(55296+(S>>10))+String.fromCharCode(S%1024+56320)):p+=String.fromCharCode(S)}return p},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(d,f){const g=d.length;if(!g)return 0;let p=0,v=0;if(this._interim){const S=d.charCodeAt(v++);56320<=S&&S<=57343?f[p++]=1024*(this._interim-55296)+S-56320+65536:(f[p++]=this._interim,f[p++]=S),this._interim=0}for(let S=v;S<g;++S){const E=d.charCodeAt(S);if(55296<=E&&E<=56319){if(++S>=g)return this._interim=E,p;const C=d.charCodeAt(S);56320<=C&&C<=57343?f[p++]=1024*(E-55296)+C-56320+65536:(f[p++]=E,f[p++]=C)}else E!==65279&&(f[p++]=E)}return p}},o.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 p,v,S,E,C=0,b=0,_=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,B=T-R;for(;_<B;){if(_>=g)return 0;if(N=d[_++],(192&N)!=128){_--,j=!0;break}this.interim[R++]=N,A<<=6,A|=63&N}j||(T===2?A<128?_--: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(;y<g;){for(;!(!(y<x)||128&(p=d[y])||128&(v=d[y+1])||128&(S=d[y+2])||128&(E=d[y+3]));)f[C++]=p,f[C++]=v,f[C++]=S,f[C++]=E,y+=4;if(p=d[y++],p<128)f[C++]=p;else if((224&p)==192){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(b=(31&p)<<6|63&v,b<128){y--;continue}f[C++]=b}else if((240&p)==224){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,C;if(S=d[y++],(192&S)!=128){y--;continue}if(b=(15&p)<<12|(63&v)<<6|63&S,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&p)==240){if(y>=g)return this.interim[0]=p,C;if(v=d[y++],(192&v)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,C;if(S=d[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=p,this.interim[1]=v,this.interim[2]=S,C;if(E=d[y++],(192&E)!=128){y--;continue}if(b=(7&p)<<18|(63&v)<<12|(63&S)<<6|63&E,b<65536||b>1114111)continue;f[C++]=b}}return C}}},225:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.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]],p=[[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 v;o.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let S=0;S<g.length;++S)v.fill(0,g[S][0],g[S][1]+1)}}wcwidth(S){return S<32?0:S<127?1:S<65536?v[S]:(function(E,C){let b,_=0,x=C.length-1;if(E<C[0][0]||E>C[x][1])return!1;for(;x>=_;)if(b=_+x>>1,E>C[b][1])_=b+1;else{if(!(E<C[b][0]))return!0;x=b-1}return!1})(S,p)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,E){let C=this.wcwidth(S),b=C===0&&E!==0;if(b){const _=f.UnicodeService.extractWidth(E);_===0?b=!1:_>C&&(C=_)}return f.UnicodeService.createPropertyValue(0,C,b)}}},5981:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=d(8460),g=d(844);class p 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,E){if(E!==void 0&&this._syncCalls>E)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 b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,E){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(E),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(E)}_innerWrite(S=0,E=!0){const C=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],_=this._action(b,E);if(_){const y=j=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,j))):this._innerWrite(C,j);return void _.catch((j=>(queueMicrotask((()=>{throw j})),Promise.resolve(!1)))).then(y)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.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()}}o.WriteBuffer=p},5941:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.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(p,v){const S=p.toString(16),E=S.length<2?"0"+S:S;switch(v){case 4:return S[0];case 8:return E;case 12:return(E+E).slice(0,3);default:return E+E}}o.parseColor=function(p){if(!p)return;let v=p.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const S=d.exec(v);if(S){const E=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/E*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/E*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/E*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),f.exec(v)&&[3,6,9,12].includes(v.length))){const S=v.length/3,E=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(v.slice(S*C,S*C+S),16);E[C]=S===1?b<<4:S===2?b:S===3?b>>4:b>>8}return E}},o.toRgbString=function(p,v=16){const[S,E,C]=p;return`rgb:${g(S,v)}/${g(E,v)}/${g(C,v)}`}},5770:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=d(482),g=d(8742),p=d(5770),v=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(E,C){this._handlers[E]===void 0&&(this._handlers[E]=[]);const b=this._handlers[E];return b.push(C),{dispose:()=>{const _=b.indexOf(C);_!==-1&&b.splice(_,1)}}}clearHandler(E){this._handlers[E]&&delete this._handlers[E]}setHandlerFallback(E){this._handlerFb=E}reset(){if(this._active.length)for(let E=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;E>=0;--E)this._active[E].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(E,C){if(this.reset(),this._ident=E,this._active=this._handlers[E]||v,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(E,C,b){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(E,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(E,C,b))}unhook(E,C=!0){if(this._active.length){let b=!1,_=this._active.length-1,x=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;_>=0&&(b=this._active[_].unhook(E),b!==!0);_--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,b;_--}for(;_>=0;_--)if(b=this._active[_].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",E);this._active=v,this._ident=0}};const S=new g.Params;S.addParam(0),o.DcsHandler=class{constructor(E){this._handler=E,this._data="",this._params=S,this._hitLimit=!1}hook(E){this._params=E.length>1||E.params[0]?E.clone():S,this._data="",this._hitLimit=!1}put(E,C,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(E,C,b),this._data.length>p.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(E){let C=!1;if(this._hitLimit)C=!1;else if(E&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=S,this._data="",this._hitLimit=!1,b)));return this._params=S,this._data="",this._hitLimit=!1,C}}},2015:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=d(844),g=d(8742),p=d(6242),v=d(6351);class S{constructor(_){this.table=new Uint8Array(_)}setDefault(_,x){this.table.fill(_<<4|x)}add(_,x,y,j){this.table[x<<8|_]=y<<4|j}addMany(_,x,y,j){for(let A=0;A<_.length;A++)this.table[x<<8|_[A]]=y<<4|j}}o.TransitionTable=S;const E=160;o.VT500_TRANSITION_TABLE=(function(){const b=new S(4095),_=Array.apply(null,Array(256)).map(((R,T)=>T)),x=(R,T)=>_.slice(R,T),y=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 b.setDefault(1,0),b.addMany(y,0,2,0),A)b.addMany([24,26,153,154],N,3,0),b.addMany(x(128,144),N,3,0),b.addMany(x(144,152),N,3,0),b.add(156,N,0,0),b.add(27,N,11,1),b.add(157,N,4,8),b.addMany([152,158,159],N,0,7),b.add(155,N,11,3),b.add(144,N,11,9);return b.addMany(j,0,3,0),b.addMany(j,1,3,1),b.add(127,1,0,1),b.addMany(j,8,0,8),b.addMany(j,3,3,3),b.add(127,3,0,3),b.addMany(j,4,3,4),b.add(127,4,0,4),b.addMany(j,6,3,6),b.addMany(j,5,3,5),b.add(127,5,0,5),b.addMany(j,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,7,0,7),b.addMany(j,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(j,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(j,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(j,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(j,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(j,13,13,13),b.addMany(y,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(E,0,2,0),b.add(E,8,5,8),b.add(E,6,0,6),b.add(E,11,0,11),b.add(E,13,13,13),b})();class C extends f.Disposable{constructor(_=o.VT500_TRANSITION_TABLE){super(),this._transitions=_,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,y,j)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,y)=>{},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 p.OscParser),this._dcsParser=this.register(new v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,x=[64,126]){let y=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=_.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<_.intermediates.length;++A){const N=_.intermediates.charCodeAt(A);if(32>N||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(_.final.length!==1)throw new Error("final must be a single byte");const j=_.final.charCodeAt(0);if(x[0]>j||j>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return y<<=8,y|=j,y}identToString(_){const x=[];for(;_;)x.push(String.fromCharCode(255&_)),_>>=8;return x.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,x){const y=this._identifier(_,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const j=this._escHandlers[y];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,x){this._executeHandlers[_.charCodeAt(0)]=x}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,x){const y=this._identifier(_);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const j=this._csiHandlers[y];return j.push(x),{dispose:()=>{const A=j.indexOf(x);A!==-1&&j.splice(A,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,x){return this._dcsParser.registerHandler(this._identifier(_),x)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,x){return this._oscParser.registerHandler(_,x)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}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(_,x,y,j,A){this._parseStack.state=_,this._parseStack.handlers=x,this._parseStack.handlerPos=y,this._parseStack.transition=j,this._parseStack.chunkPos=A}parse(_,x,y){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(y===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 B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&B>-1){for(;B>=0&&(j=T[B](this._params),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 4:if(y===!1&&B>-1){for(;B>=0&&(j=T[B](),j!==!0);B--)if(j instanceof Promise)return this._parseStack.handlerPos=B,j}this._parseStack.handlers=[];break;case 6:if(A=_[this._parseStack.chunkPos],j=this._dcsParser.unhook(A!==24&&A!==26,y),j)return j;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=_[this._parseStack.chunkPos],j=this._oscParser.end(A!==24&&A!==26,y),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=_[T],N=this._transitions.table[this.currentState<<8|(A<160?A:E)],N>>4){case 2:for(let q=T+1;;++q){if(q>=x||(A=_[q])<32||A>126&&A<E){this._printHandler(_,T,q),T=q-1;break}if(++q>=x||(A=_[q])<32||A>126&&A<E){this._printHandler(_,T,q),T=q-1;break}if(++q>=x||(A=_[q])<32||A>126&&A<E){this._printHandler(_,T,q),T=q-1;break}if(++q>=x||(A=_[q])<32||A>126&&A<E){this._printHandler(_,T,q),T=q-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 B=this._csiHandlers[this._collect<<8|A];let H=B?B.length-1:-1;for(;H>=0&&(j=B[H](this._params),j!==!0);H--)if(j instanceof Promise)return this._preserveStack(3,B,H,N,T),j;H<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=_[T])>47&&A<60);T--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const G=this._escHandlers[this._collect<<8|A];let Y=G?G.length-1:-1;for(;Y>=0&&(j=G[Y](),j!==!0);Y--)if(j instanceof Promise)return this._preserveStack(4,G,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 q=T+1;;++q)if(q>=x||(A=_[q])===24||A===26||A===27||A>127&&A<E){this._dcsParser.put(_,T,q),T=q-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 q=T+1;;q++)if(q>=x||(A=_[q])<32||A>127&&A<E){this._oscParser.put(_,T,q),T=q-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}}}o.EscapeSequenceParser=C},6242:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=d(5770),g=d(482),p=[];o.OscParser=class{constructor(){this._state=0,this._active=p,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,S){this._handlers[v]===void 0&&(this._handlers[v]=[]);const E=this._handlers[v];return E.push(S),{dispose:()=>{const C=E.indexOf(S);C!==-1&&E.splice(C,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=p,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||p,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,S,E){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(v,S,E);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,S,E))}start(){this.reset(),this._state=1}put(v,S,E){if(this._state!==3){if(this._state===1)for(;S<E;){const C=v[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&&E-S>0&&this._put(v,S,E)}}end(v,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let E=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,E=S,b=this._stack.fallThrough,this._stack.paused=!1),!b&&E===!1){for(;C>=0&&(E=this._active[C].end(v),E!==!0);C--)if(E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,E;C--}for(;C>=0;C--)if(E=this._active[C].end(!1),E instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,E}else this._handlerFb(this._id,"END",v);this._active=p,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,S,E){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,S,E),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let S=!1;if(this._hitLimit)S=!1;else if(v&&(S=this._handler(this._data),S instanceof Promise))return S.then((E=>(this._data="",this._hitLimit=!1,E)));return this._data="",this._hitLimit=!1,S}}},8742:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const d=2147483647;class f{static fromArray(p){const v=new f;if(!p.length)return v;for(let S=Array.isArray(p[0])?1:0;S<p.length;++S){const E=p[S];if(Array.isArray(E))for(let C=0;C<E.length;++C)v.addSubParam(E[C]);else v.addParam(E)}return v}constructor(p=32,v=32){if(this.maxLength=p,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(p),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(p),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const p=new f(this.maxLength,this.maxSubParamsLength);return p.params.set(this.params),p.length=this.length,p._subParams.set(this._subParams),p._subParamsLength=this._subParamsLength,p._subParamsIdx.set(this._subParamsIdx),p._rejectDigits=this._rejectDigits,p._rejectSubDigits=this._rejectSubDigits,p._digitIsSub=this._digitIsSub,p}toArray(){const p=[];for(let v=0;v<this.length;++v){p.push(this.params[v]);const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-S>0&&p.push(Array.prototype.slice.call(this._subParams,S,E))}return p}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(p){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=p>d?d:p}}addSubParam(p){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(p<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=p>d?d:p,this._subParamsIdx[this.length-1]++}}hasSubParams(p){return(255&this._subParamsIdx[p])-(this._subParamsIdx[p]>>8)>0}getSubParams(p){const v=this._subParamsIdx[p]>>8,S=255&this._subParamsIdx[p];return S-v>0?this._subParams.subarray(v,S):null}getSubParamsAll(){const p={};for(let v=0;v<this.length;++v){const S=this._subParamsIdx[v]>>8,E=255&this._subParamsIdx[v];E-S>0&&(p[v]=this._subParams.slice(S,E))}return p}addDigit(p){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const S=this._digitIsSub?this._subParams:this.params,E=S[v-1];S[v-1]=~E?Math.min(10*E+p,d):p}}o.Params=f},5741:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.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:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=d(3785),g=d(511);o.BufferApiView=class{constructor(p,v){this._buffer=p,this.type=v}init(p){return this._buffer=p,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(p){const v=this._buffer.lines.get(p);if(v)return new f.BufferLineApiView(v)}getNullCell(){return new g.CellData}}},3785:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=d(511);o.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,p){if(!(g<0||g>=this._line.length))return p?(this._line.loadCell(g,p),p):this._line.loadCell(g,new f.CellData)}translateToString(g,p,v){return this._line.translateToString(g,p,v)}}},8285:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=d(8771),g=d(8460),p=d(844);class v extends p.Disposable{constructor(E){super(),this._core=E,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)}}o.BufferNamespaceApi=v},7975:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.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,p)=>f(g,p.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:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.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(m,o,d){var f=this&&this.__decorate||function(b,_,x,y){var j,A=arguments.length,N=A<3?_:y===null?y=Object.getOwnPropertyDescriptor(_,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,x,y);else for(var R=b.length-1;R>=0;R--)(j=b[R])&&(N=(A<3?j(N):A>3?j(_,x,N):j(_,x))||N);return A>3&&N&&Object.defineProperty(_,x,N),N},g=this&&this.__param||function(b,_){return function(x,y){_(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const p=d(8460),v=d(844),S=d(5295),E=d(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new p.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(b,this))}resize(b,_){this.cols=b,this.rows=_,this.buffers.resize(b,_),this._onResize.fire({cols:b,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,_=!1){const x=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=x.getBlankLine(b,_),this._cachedBlankLine=y),y.isWrapped=_;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(y):x.lines.push(y.clone()):x.lines.splice(A+1,0,y.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,y.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,_,x){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const j=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),j!==y.ydisp&&(_||this._onScroll.fire(y.ydisp))}};o.BufferService=C=f([g(0,E.IOptionsService)],C)},7994:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.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(m,o,d){var f=this&&this.__decorate||function(y,j,A,N){var R,T=arguments.length,B=T<3?j:N===null?N=Object.getOwnPropertyDescriptor(j,A):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,j,A,N);else for(var H=y.length-1;H>=0;H--)(R=y[H])&&(B=(T<3?R(B):T>3?R(j,A,B):R(j,A))||B);return T>3&&B&&Object.defineProperty(j,A,B),B},g=this&&this.__param||function(y,j){return function(A,N){j(A,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const p=d(2585),v=d(8460),S=d(844),E={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function C(y,j){let A=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(A|=64,A|=y.action):(A|=3&y.button,4&y.button&&(A|=64),8&y.button&&(A|=128),y.action===32?A|=32:y.action!==0||j||(A|=3)),A}const b=String.fromCharCode,_={DEFAULT:y=>{const j=[C(y,!1)+32,y.col+32,y.row+32];return j[0]>255||j[1]>255||j[2]>255?"":`\x1B[M${b(j[0])}${b(j[1])}${b(j[2])}`},SGR:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${j}`},SGR_PIXELS:y=>{const j=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${j}`}};let x=o.CoreMouseService=class extends S.Disposable{constructor(y,j){super(),this._bufferService=y,this._coreService=j,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(E))this.addProtocol(A,E[A]);for(const A of Object.keys(_))this.addEncoding(A,_[A]);this.reset()}addProtocol(y,j){this._protocols[y]=j}addEncoding(y,j){this._encodings[y]=j}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const j=this._encodings[this._activeEncoding](y);return j&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(j):this._coreService.triggerDataEvent(j,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,j,A){if(A){if(y.x!==j.x||y.y!==j.y)return!1}else if(y.col!==j.col||y.row!==j.row)return!1;return y.button===j.button&&y.action===j.action&&y.ctrl===j.ctrl&&y.alt===j.alt&&y.shift===j.shift}};o.CoreMouseService=x=f([g(0,p.IBufferService),g(1,p.ICoreService)],x)},6975:function(m,o,d){var f=this&&this.__decorate||function(x,y,j,A){var N,R=arguments.length,T=R<3?y:A===null?A=Object.getOwnPropertyDescriptor(y,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,y,j,A);else for(var B=x.length-1;B>=0;B--)(N=x[B])&&(T=(R<3?N(T):R>3?N(y,j,T):N(y,j))||T);return R>3&&T&&Object.defineProperty(y,j,T),T},g=this&&this.__param||function(x,y){return function(j,A){y(j,A,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const p=d(1439),v=d(8460),S=d(844),E=d(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=o.CoreService=class extends S.Disposable{constructor(x,y,j){super(),this._bufferService=x,this._logService=y,this._optionsService=j,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,p.clone)(C),this.decPrivateModes=(0,p.clone)(b)}reset(){this.modes=(0,p.clone)(C),this.decPrivateModes=(0,p.clone)(b)}triggerDataEvent(x,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const j=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&j.ybase!==j.ydisp&&this._onRequestScrollToBottom.fire(),y&&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((y=>y.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=_=f([g(0,E.IBufferService),g(1,E.ILogService),g(2,E.IOptionsService)],_)},9074:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=d(8055),g=d(8460),p=d(844),v=d(6106);let S=0,E=0;class C extends p.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.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,p.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const y=new b(x);if(y){const j=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),j.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,y,j){let A=0,N=0;for(const R of this._decorations.getKeyIterator(y))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,y,j,A){this._decorations.forEachByKey(y,(N=>{S=N.options.x??0,E=S+(N.options.width??1),x>=S&&x<E&&(!j||(N.options.layer??"bottom")===j)&&A(N)}))}}o.DecorationService=C;class b extends p.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:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=d(2585),g=d(8343);class p{constructor(...S){this._entries=new Map;for(const[E,C]of S)this.set(E,C)}set(S,E){const C=this._entries.get(S);return this._entries.set(S,E),C}forEach(S){for(const[E,C]of this._entries.entries())S(E,C)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}o.ServiceCollection=p,o.InstantiationService=class{constructor(){this._services=new p,this._services.set(f.IInstantiationService,this)}setService(v,S){this._services.set(v,S)}getService(v){return this._services.get(v)}createInstance(v,...S){const E=(0,g.getServiceDependencies)(v).sort(((_,x)=>_.index-x.index)),C=[];for(const _ of E){const x=this._services.get(_.id);if(!x)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${_.id}.`);C.push(x)}const b=E.length>0?E[0].index:S.length;if(S.length!==b)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${b+1} conflicts with ${S.length} static arguments`);return new v(...S,...C)}}},7866:function(m,o,d){var f=this&&this.__decorate||function(b,_,x,y){var j,A=arguments.length,N=A<3?_:y===null?y=Object.getOwnPropertyDescriptor(_,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,x,y);else for(var R=b.length-1;R>=0;R--)(j=b[R])&&(N=(A<3?j(N):A>3?j(_,x,N):j(_,x))||N);return A>3&&N&&Object.defineProperty(_,x,N),N},g=this&&this.__param||function(b,_){return function(x,y){_(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const p=d(844),v=d(2585),S={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let E,C=o.LogService=class extends p.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),E=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let _=0;_<b.length;_++)typeof b[_]=="function"&&(b[_]=b[_]())}_log(b,_,x){this._evalLazyOptionalParams(x),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...x)}trace(b,..._){var x;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,b,_)}debug(b,..._){var x;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,b,_)}info(b,..._){var x;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,b,_)}warn(b,..._){var x;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,b,_)}error(b,..._){var x;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,b,_)}};o.LogService=C=f([g(0,v.IOptionsService)],C),o.setTraceLogger=function(b){E=b},o.traceCall=function(b,_,x){if(typeof x.value!="function")throw new Error("not supported");const y=x.value;x.value=function(...j){if(E.logLevel!==v.LogLevelEnum.TRACE)return y.apply(this,j);E.trace(`GlyphRenderer#${y.name}(${j.map((N=>JSON.stringify(N))).join(", ")})`);const A=y.apply(this,j);return E.trace(`GlyphRenderer#${y.name} return`,A),A}}},7302:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=d(8460),g=d(844),p=d(6114);o.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:p.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["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 b={...o.DEFAULT_OPTIONS};for(const _ in C)if(_ in b)try{const x=C[_];b[_]=this._sanitizeAndValidateOption(_,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((_=>{_===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((_=>{C.indexOf(_)!==-1&&b()}))}_setupOptions(){const C=_=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},b=(_,x)=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);x=this._sanitizeAndValidateOption(_,x),this.rawOptions[_]!==x&&(this.rawOptions[_]=x,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const x={get:C.bind(this,_),set:b.bind(this,_)};Object.defineProperty(this.options,_,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=v.includes(b)?b:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=S},2660:function(m,o,d){var f=this&&this.__decorate||function(S,E,C,b){var _,x=arguments.length,y=x<3?E:b===null?b=Object.getOwnPropertyDescriptor(E,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(S,E,C,b);else for(var j=S.length-1;j>=0;j--)(_=S[j])&&(y=(x<3?_(y):x>3?_(E,C,y):_(E,C))||y);return x>3&&y&&Object.defineProperty(E,C,y),y},g=this&&this.__param||function(S,E){return function(C,b){E(C,b,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const p=d(2585);let v=o.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const E=this._bufferService.buffer;if(S.id===void 0){const j=E.addMarker(E.ybase+E.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,b=this._getEntryIdKey(C),_=this._entriesWithId.get(b);if(_)return this.addLineToLink(_.id,E.ybase+E.y),_.id;const x=E.addMarker(E.ybase+E.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(y,x))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(S,E){const C=this._dataByLinkId.get(S);if(C&&C.lines.every((b=>b.line!==E))){const b=this._bufferService.buffer.addMarker(E);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(S){var E;return(E=this._dataByLinkId.get(S))==null?void 0:E.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,E){const C=S.lines.indexOf(E);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)))}};o.OscLinkService=v=f([g(0,p.IBufferService)],v)},8343:(m,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const d="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(g){return g[f]||[]},o.createDecorator=function(g){if(o.serviceRegistry.has(g))return o.serviceRegistry.get(g);const p=function(v,S,E){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,_){b[d]===b?b[f].push({id:C,index:_}):(b[f]=[{id:C,index:_}],b[d]=b)})(p,v,E)};return p.toString=()=>g,o.serviceRegistry.set(g,p),p}},2585:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const f=d(8343);var g;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(p){p[p.TRACE=0]="TRACE",p[p.DEBUG=1]="DEBUG",p[p.INFO=2]="INFO",p[p.WARN=3]="WARN",p[p.ERROR=4]="ERROR",p[p.OFF=5]="OFF"})(g||(o.LogLevelEnum=g={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(m,o,d)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=d(8460),g=d(225);class p{static extractShouldJoin(S){return(1&S)!=0}static extractWidth(S){return S>>1&3}static extractCharKind(S){return S>>3}static createPropertyValue(S,E,C=!1){return(16777215&S)<<3|(3&E)<<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 E=0,C=0;const b=S.length;for(let _=0;_<b;++_){let x=S.charCodeAt(_);if(55296<=x&&x<=56319){if(++_>=b)return E+this.wcwidth(x);const A=S.charCodeAt(_);56320<=A&&A<=57343?x=1024*(x-55296)+A-56320+65536:E+=this.wcwidth(A)}const y=this.charProperties(x,C);let j=p.extractWidth(y);p.extractShouldJoin(y)&&(j-=p.extractWidth(C)),E+=j,C=y}return E}charProperties(S,E){return this._activeProvider.charProperties(S,E)}}o.UnicodeService=p}},s={};function l(m){var o=s[m];if(o!==void 0)return o.exports;var d=s[m]={exports:{}};return i[m].call(d.exports,d,d.exports,l),d.exports}var h={};return(()=>{var m=h;Object.defineProperty(m,"__esModule",{value:!0}),m.Terminal=void 0;const o=l(9042),d=l(3236),f=l(844),g=l(5741),p=l(8285),v=l(7975),S=l(7090),E=["cols","rows"];class C extends f.Disposable{constructor(_){super(),this._core=this.register(new d.Terminal(_)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=j=>this._core.options[j],y=(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:y.bind(this,j)};Object.defineProperty(this._publicOptions,j,A)}}_checkReadonlyOptions(_){if(E.includes(_))throw new Error(`Option "${_}" 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 v.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 p.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=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:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const x in _)this._publicOptions[x]=_[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,x=!0){this._core.input(_,x)}resize(_,x){this._verifyIntegers(_,x),this._core.resize(_,x)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,x,y){this._verifyIntegers(_,x,y),this._core.select(_,x,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,x){this._verifyIntegers(_,x),this._core.selectLines(_,x)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,x){this._core.write(_,x)}writeln(_,x){this._core.write(_),this._core.write(`\r
|
|
65
|
-
`,x)}paste(_){this._core.paste(_)}refresh(_,x){this._verifyIntegers(_,x),this._core.refresh(_,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return o}_verifyIntegers(..._){for(const x of _)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const x of _)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}m.Terminal=C})(),h})()))})(gd)),gd.exports}var hS=dS();/**
|
|
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 fS=2,pS=1,mS=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 p;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:((p=this._terminal.options.overviewRuler)==null?void 0:p.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),m={top:parseInt(h.getPropertyValue("padding-top")),bottom:parseInt(h.getPropertyValue("padding-bottom")),right:parseInt(h.getPropertyValue("padding-right")),left:parseInt(h.getPropertyValue("padding-left"))},o=m.top+m.bottom,d=m.right+m.left,f=s-o,g=l-d-r;return{cols:Math.max(fS,Math.floor(g/e.css.cell.width)),rows:Math.max(pS,Math.floor(f/e.css.cell.height))}}};function gS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const l=F.useRef(null),h=F.useRef(e),m=F.useRef(null),o=F.useRef(null),d=ir(g=>g.writeSession),f=ir(g=>g.resizeSession);return F.useEffect(()=>{h.current=e},[e]),F.useEffect(()=>{if(!i)return;const g=p=>{(p.key==="²"||p.key==="`")&&(p.preventDefault(),p.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),F.useEffect(()=>{if(!l.current)return;const g=new hS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),p=new mS;g.loadAddon(p),m.current={term:g,fitAddon:p},l.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(l.current);const v=l.current.querySelector(".xterm");v&&(v.style.padding="8px"),p.fit(),s&&setTimeout(()=>{g.focus()},150);const S=new ResizeObserver(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{requestAnimationFrame(()=>{var b;p.fit&&p.fit();const C=(b=m.current)==null?void 0:b.term;C&&C.cols>0&&C.rows>0&&f(h.current,C.cols,C.rows)})},100)});S.observe(l.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(h.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const E=Pt.subscribe(C=>{var b,_;if(C.type==="terminal.output"&&((b=C.payload)==null?void 0:b.sessionId)===h.current){const x=(_=C.payload)==null?void 0:_.data;x&&g.write(x)}});return()=>{E(),S.disconnect(),o.current&&clearTimeout(o.current),g.dispose(),m.current=null}},[e,d,f]),c.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[c.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[c.jsx("div",{}),c.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.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"})})})]}),c.jsx("div",{ref:l,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function xS(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 vS({isOpen:e,onClose:r,onFocusChat:i}){const s=ir(C=>C.createSession),l=ir(C=>C.killSession),h=ir(C=>C.sessions),m=ir(C=>C.setWorkdir),o=ir(C=>C.fetchSessions),d=Ft(C=>C.currentProject),[f,g]=F.useState(!0),p=F.useRef(null),v=F.useRef(!1),S=F.useRef(!1),E=F.useCallback(()=>{r(),i()},[r,i]);return F.useEffect(()=>{d!=null&&d.workdir&&m(d.workdir)},[d==null?void 0:d.workdir,m]),F.useEffect(()=>{e&&(g(!0),o().finally(()=>g(!1)))},[e,o]),F.useEffect(()=>{e&&h.length===0&&!f&&!S.current&&(S.current=!0,s())},[e,h.length,f,s]),F.useEffect(()=>{e?(v.current=!0,setTimeout(()=>{var C;(C=p.current)==null||C.focus(),setTimeout(()=>{v.current=!1},200)},100)):S.current=!1},[e]),F.useEffect(()=>{if(!e)return;const C=b=>{v.current||(b.key==="Escape"||b.key==="²"||b.key==="`")&&(b.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-40 bg-black/40",style:{pointerEvents:"auto"},onClick:E}),c.jsxs("div",{ref:p,tabIndex:-1,className:"fixed inset-x-0 top-0 z-50 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(),E())},children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.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:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})}),c.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:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})})]})]}),c.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:f?c.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):h.length===0?c.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:c.jsxs("div",{className:"text-center",children:[c.jsx("p",{className:"mb-4",children:"No terminal sessions"}),c.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"})]})}):c.jsx("div",{className:`grid ${xS(h.length)} gap-2 h-full auto-rows-fr`,children:h.map(C=>c.jsx(gS,{sessionId:C.id,onClose:()=>l(C.id),onEscape:E,autoFocus:h.length===1},C.id))})})]})]}):null}function Wa({items:e,trigger:r,minWidth:i="120px"}){const[s,l]=F.useState(!1),[h,m]=F.useState(null),o=F.useRef(null),d=F.useRef(null);F.useEffect(()=>{function v(S){d.current&&!d.current.contains(S.target)&&l(!1)}return s&&document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[s]);const f=F.useCallback(()=>{if(!o.current)return;const v=o.current.getBoundingClientRect(),S=200,C=window.innerHeight-v.bottom<S;m({top:C?v.top-S-4:v.bottom+4,left:v.left,alignToTop:C})},[]),g=v=>{v.stopPropagation(),s||f(),l(!s)},p=h&&c.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${h.alignToTop?"mb-1":"mt-1"}`,style:{top:h.top,left:h.left,minWidth:i},children:e.map((v,S)=>{const E=c.jsxs(c.Fragment,{children:[v.icon&&c.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:v.icon}),v.label]});return v.href?c.jsx("a",{href:v.href,onClick:C=>{var b;(b=v.onClick)==null||b.call(v,C),l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S):c.jsx("button",{onClick:C=>{var b;(b=v.onClick)==null||b.call(v,C),v.closeOnClick!==!1&&l(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${v.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${S!==e.length-1?"border-b border-border":""}`,children:E},S)})});return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"relative",children:c.jsx("div",{ref:o,onClick:g,children:r})}),s&&ch.createPortal(p,document.body)]})}function i0(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],l=r.getFullYear(),h=String(r.getMonth()+1).padStart(2,"0"),m=String(r.getDate()).padStart(2,"0");return`${s} ${l}/${h}/${m}`}function uh(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function bS(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()),h=Math.floor((s.getTime()-l.getTime())/(1e3*60*60*24)),m=uh(e);if(h===0)return`today ${m}`;if(h===1)return`yesterday ${m}`;if(h<7)return`${h} days ago ${m}`;{const o=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${o}/${d}/${f} ${m}`}}function yS(e){const r=new Date(e),i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),l=String(r.getDate()).padStart(2,"0");return`${i}-${s}-${l}`}function s0(e){const r=new Map;for(const l of e){const h=yS(l.updatedAt);r.has(h)||r.set(h,[]),r.get(h).push(l)}for(const[l,h]of r)h.sort((m,o)=>{const d=new Date(m.updatedAt).getTime();return new Date(o.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((l,h)=>h.localeCompare(l)),s=new Map;for(const l of i)s.set(l,r.get(l));return s}function _S({projects:e,currentProject:r}){const i=Ft(h=>h.loadProject),l=[...e].sort((h,m)=>h.name.localeCompare(m.name)).map(h=>({label:h.name,icon:h.id===r.id?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0,href:`/p/${h.id}`,onClick:()=>{i(h.id)}}));return c.jsx(Wa,{items:l,trigger:c.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,c.jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),minWidth:"250px"})}function SS({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){const[l,h]=F.useState(!1),m=F.useRef(null);if(F.useEffect(()=>{function f(g){m.current&&!m.current.contains(g.target)&&h(!1)}if(l)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),!(e!=null&&e.id)||e.id!==s)return null;const o=r.filter(f=>f.projectId===e.id).sort((f,g)=>new Date(g.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),d=[];d.push({label:c.jsxs(An,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[c.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),c.jsx("span",{className:"text-sm",children:"New Session"})]}),onClick:()=>{}});for(const f of o)d.push({label:c.jsx(An,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:c.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(i==null?void 0:i.id)?c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0,onClick:()=>{}});return d.push({label:c.jsxs(An,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"text-sm",children:"Projects"})]}),onClick:()=>{}}),c.jsxs("div",{className:"relative",ref:m,children:[c.jsxs("button",{type:"button",onClick:()=>h(!l),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",children:[c.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e==null?void 0:e.name}),c.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&d.length>0&&c.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:d.map((f,g)=>{if(f.label&&typeof f.label=="object"&&f.label.type===An){const p=f.label,v=p.props.href||"";return c.jsxs(An,{href:v,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,p.props.children]},g)}return f.href?c.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},g):c.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),h(!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:[f.icon,f.label]},g)})})]})}function wS({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ee(f=>f.loadSession),l=e.filter(f=>f.projectId===r.id).slice(0,15),h=s0(l),m=[];m.push({label:c.jsxs(An,{href:`/p/${r.id}/new`,className:"flex items-center gap-2 px-3 py-2 min-w-[160px]","data-testid":"session-dropdown-new-session",children:[c.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),c.jsx("span",{className:"text-sm",children:"New session"})]}),onClick:()=>{}});for(const[f,g]of h){const p=g[0];if(p){m.push({label:c.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:i0(p.updatedAt)}),onClick:()=>{}});for(const v of g)m.push({label:c.jsxs("div",{className:"min-w-[160px]",children:[c.jsx("div",{className:"truncate text-sm",children:v.title??v.id.slice(0,8)}),c.jsx("div",{className:"text-text-muted text-xs",children:uh(v.updatedAt)})]}),icon:v.id===(i==null?void 0:i.id)?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0,href:`/p/${r.id}/s/${v.id}`,onClick:()=>{s(v.id)}})}}const o=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return c.jsx(Wa,{items:m,trigger:c.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:o,"data-testid":"header-session-dropdown",children:[o,c.jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),minWidth:"280px"})}function CS({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=F.useState(!1),[l]=Ti(),h=l.startsWith("/p/"),m=/^\/p\/[^/]+\/s\/[^/]+$/.test(l),o=Ee(b=>b.currentSession),d=Ee(b=>b.sessions),f=Ft(b=>b.currentProject),g=Ft(b=>b.projects),p=Gt(b=>b.startAutoRefresh),v=Gt(b=>b.stopAutoRefresh),S=ir(b=>b.setOpen),E=ir(b=>b.isOpen),C=F.useCallback(()=>{const b=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');b&&b.focus()},[]);return F.useEffect(()=>{const b=_=>{(_.key==="²"||_.key==="`")&&(_.preventDefault(),E||S(!0))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[E,S]),F.useEffect(()=>(p(),()=>v()),[p,v]),c.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&h&&c.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:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),c.jsx(An,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),f&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),c.jsx("span",{className:"hidden md:inline",children:c.jsx(_S,{projects:g,currentProject:f})}),c.jsx("span",{className:"md:hidden",children:c.jsx(SS,{currentProject:f,sessions:d,currentSession:o,projectIdFromUrl:h&&l.split("/")[2]||null},f==null?void 0:f.id)}),c.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),c.jsx("span",{className:"hidden md:inline",children:c.jsx(wS,{sessions:d,currentProject:f,currentSession:o})})]})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h&&c.jsx("button",{onClick:()=>S(!E),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${E?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})}),c.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:c.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.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"}),c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),c.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:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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&&m&&c.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:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),c.jsx(cS,{isOpen:i,onClose:()=>s(!1)}),c.jsx(vS,{isOpen:E,onClose:()=>S(!1),onFocusChat:C})]})}function kS({isOpen:e,onClose:r,title:i,label:s,description:l,placeholder:h,value:m,isLoading:o=!1,onSave:d}){const[f,g]=F.useState(m),[p,v]=F.useState(!1),[S,E]=F.useState(!1);F.useEffect(()=>{g(m),v(!1)},[m]);const C=y=>{g(y.target.value),v(!0)},b=async()=>{E(!0),await d(f),E(!1),v(!1),r()},_=()=>{g(m),v(!1),r()},x=o||S;return c.jsx(un,{isOpen:e,onClose:_,title:i,size:"lg",children:c.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[c.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),c.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:l}),c.jsx("div",{className:"flex-1 min-h-[150px]",children:c.jsx("textarea",{value:f,onChange:C,placeholder:h,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})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[c.jsx(ht,{variant:"secondary",onClick:_,children:"Cancel"}),c.jsx(ht,{variant:"primary",onClick:b,disabled:!p||x,children:S?"Saving...":"Save"})]})]})})}function ES({isOpen:e,onClose:r,project:i}){const s=Ft(h=>h.updateProject),l=async h=>{s(i.id,{customInstructions:h||null}),await new Promise(m=>setTimeout(m,100))};return c.jsx(kS,{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:l})}function a0({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=Ti(),[l,h]=F.useState(!1),m=Ee(j=>j.sessions),o=Ee(j=>j.currentSession),d=Ee(j=>j.unreadSessionIds),f=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),p=Ee(j=>j.loadMoreSessions),v=Ee(j=>j.sessionsHasMore),S=Ee(j=>j.sessionsPaginationLoading),E=Ft(j=>j.currentProject),C=F.useRef(null),b=F.useCallback(()=>{v&&!S&&E&&p(E.id)},[v,S,E,p]);F.useEffect(()=>{if(!C.current||!v)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&b()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[v,b]);const _=m.filter(j=>j.projectId===(E==null?void 0:E.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(f(j),(o==null?void 0:o.id)===j&&s(`/p/${e}`))},y=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return c.jsxs(c.Fragment,{children:[r&&i&&c.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),c.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:[c.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[c.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"}),c.jsx(Wa,{items:[{label:"Edit project settings",onClick:()=>h(!0)},{label:"Delete all sessions",onClick:y,danger:!0}],trigger:c.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:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&c.jsx("button",{onClick:i,className:"md:hidden flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close sidebar",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),E&&c.jsx(ES,{isOpen:l,onClose:()=>h(!1),project:E}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?c.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"divide-y divide-border",children:jS(_,o,d,x,e)}),S&&c.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),c.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function jS(e,r,i,s,l){const h=s0(e);return Array.from(h).map(([m,o])=>{const d=o[0];return d?c.jsxs("div",{children:[c.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:i0(d.updatedAt)}),o.map(f=>{const g=(r==null?void 0:r.id)===f.id,p=i.includes(f.id),v=f.isRunning;return c.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:c.jsxs(An,{href:`/p/${l}/s/${f.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[c.jsxs("div",{className:"flex justify-between items-center mb-1",children:[c.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:f.title??f.id.slice(0,6)}),c.jsx(Wa,{items:[{label:"Delete session",onClick:S=>s(f.id,S),danger:!0}],trigger:c.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:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v?c.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:[c.jsx("title",{children:"Running"}),c.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),c.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):p&&!g?c.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,c.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:uh(f.updatedAt)}),c.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[f.messageCount," messages"]})]})]})},f.id)})]},m):null})}const yx=["⠋","⠙","⠹","⠸","⠼","⠴"];function NS(){var o;const e=Ft(d=>d.currentProject),r=Ee(d=>d.currentSession),i=e0(),s=!1,l=F.useRef(0),h=F.useRef(null);F.useEffect(()=>(i?(h.current=window.setInterval(()=>{l.current=(l.current+1)%yx.length,m()},150),m()):(h.current&&(clearInterval(h.current),h.current=null),m()),()=>{h.current&&(clearInterval(h.current),h.current=null)}),[i,e,r,s]);const m=()=>{var p;const f=(p=r==null?void 0:r.metadata)==null?void 0:p.title,g=i?`${yx[l.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"&&((o=r==null?void 0:r.metadata)!=null&&o.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Ll=F.forwardRef(({className:e="",...r},i)=>c.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}));Ll.displayName="Input";function TS({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const l=()=>{s(),r()};return c.jsx(un,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",c.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(ht,{variant:"secondary",onClick:r,children:"Cancel"}),c.jsx(ht,{variant:"danger",onClick:l,children:"Delete"})]})]})})}function AS(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 DS({isOpen:e,onClose:r}){const[,i]=Ti(),[s,l]=F.useState(""),[h,m]=F.useState(null),[o,d]=F.useState(!1),[f,g]=F.useState(""),p=F.useRef(null);F.useEffect(()=>{e&&(Se("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),l(""),m(null),d(!1),setTimeout(()=>{var C;(C=p.current)==null||C.focus()},100))},[e]);const v=F.useCallback(async C=>{C.preventDefault();const b=AS(s);if(!b.valid){m(b.error);return}d(!0),m(null);const _=`${f}/${s}`;try{const x=await Se("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:_})});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){m(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[s,i,r,f]),S=F.useCallback(()=>{l(""),m(null),r()},[r]),E=s?`${f}/${s}`:"";return c.jsx(un,{isOpen:e,onClose:S,title:"Create New Project",size:"sm",children:c.jsxs("form",{onSubmit:v,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),c.jsx(Ll,{ref:p,id:"project-name",value:s,onChange:C=>{l(C.target.value),m(null)},placeholder:"my-project",disabled:o,className:"w-full"}),s&&c.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",c.jsx("span",{className:"font-mono",children:E})]}),h&&c.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:h})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(ht,{type:"button",variant:"secondary",onClick:S,disabled:o,children:"Cancel"}),c.jsx(ht,{type:"submit",variant:"primary",disabled:o||!s.trim(),className:"min-w-[100px]",children:o?c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[c.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),c.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"})]})]})})}function RS({isOpen:e,onClose:r}){const[,i]=Ti(),[s,l]=F.useState(!1),[h,m]=F.useState(""),[o,d]=F.useState(null),[f,g]=F.useState(!1),[p,v]=F.useState(null),S=Ft(L=>L.projects),E=Ft(L=>L.createProject),C=Ft(L=>L.listProjects),b=Ft(L=>L.deleteProject),[_,x]=F.useState(null),[y,j]=F.useState(-1),[A,N]=F.useState(null),R=F.useRef([]);F.useEffect(()=>{Se("/api/config").then(L=>L.json()).then(L=>{L.workdir&&v(L.workdir)})},[]);const T=F.useCallback(async L=>{g(!0);try{const D=L?`/api/directories?path=${encodeURIComponent(L)}`:p?`/api/directories?path=${encodeURIComponent(p)}`:"/api/directories",U=await(await Se(D)).json();d(U)}catch(D){console.error("Failed to load directories:",D)}finally{g(!1)}},[p]);F.useEffect(()=>{e&&p&&(T(p),C())},[e,p,T,C]);const B=(o==null?void 0:o.directories.filter(L=>h===""||L.name.toLowerCase().includes(h.toLowerCase())))??[],H=[...o!=null&&o.parent&&!h?[{type:"parent",path:o.parent,name:".."}]:[],...B.map(L=>({type:"directory",path:L.path,name:L.name}))],G=L=>{i(`/p/${L}`),r()},Y=(L,D)=>{D.stopPropagation(),N(L)},q=()=>{A&&(b(A.id),N(null))},O=L=>{const D=L.split("/").filter(Boolean).pop()??"";E(D,L),C(),x(L)};F.useEffect(()=>{if(_){const L=S.find(D=>D.workdir===_);L&&(i(`/p/${L.id}`),r(),x(null))}},[S,_,i,r]),F.useEffect(()=>{j(H.length>0?0:-1)},[h,H.length]);const W=L=>{m(""),T(L)},V=F.useCallback(L=>{if(!e)return;if(L.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(L.key))return;const D=document.activeElement;if(!(!D||D.tagName!=="INPUT")){if(L.preventDefault(),L.key==="ArrowDown")j(I=>{const U=I+1;return U>=H.length?0:U});else if(L.key==="ArrowUp")j(I=>{const U=I-1;return U<0?H.length-1:U});else if(L.key==="Enter"&&y>=0&&y<H.length){const I=H[y];(I==null?void 0:I.type)==="parent"?W(I.path):I&&O(I.path)}}},[e,H.length,y,W,O,r]);F.useEffect(()=>{if(e)return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[e,V]),F.useEffect(()=>{y>=0&&R.current[y]&&R.current[y].scrollIntoView({behavior:"smooth",block:"nearest"})},[y]);const ee=(()=>{if(!o)return[];const L=o.current.split("/").filter(Boolean),D=[];let I="";for(const U of L)I+="/"+U,D.push({name:U,path:I});return D})();return e?c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[c.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:[c.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[c.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),c.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),c.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[c.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[c.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:c.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:S.length===0?c.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):c.jsx("div",{className:"divide-y divide-border",children:S.map(L=>c.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[c.jsxs("button",{onClick:()=>G(L.id),className:"flex-1 flex items-center gap-3 text-left",children:[c.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:L.name}),c.jsx("div",{className:"text-xs text-text-muted truncate",children:L.workdir})]})]}),c.jsx("button",{onClick:D=>Y(L,D),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},L.id))})})]}),c.jsxs("div",{className:"w-1/2 flex flex-col",children:[c.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:c.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"})}),c.jsx("div",{className:"p-3 border-b border-border",children:c.jsxs("div",{className:"relative",children:[c.jsx(Ll,{value:h,onChange:L=>m(L.target.value),placeholder:"Type to filter directories...",className:"w-full pl-9"}),c.jsx("svg",{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]})}),c.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:c.jsx("div",{className:"flex items-center text-xs overflow-x-auto",children:ee.map((L,D)=>c.jsxs("span",{className:"flex items-center flex-shrink-0",children:[c.jsx("span",{className:"text-text-muted",children:"/"}),D===ee.length-1?c.jsx("span",{className:"text-accent-primary font-medium px-1",children:L.name}):c.jsx("button",{onClick:()=>W(L.path),className:"text-text-secondary hover:text-accent-primary px-1",children:L.name})]},L.path))})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:f?c.jsx("div",{className:"p-8 text-center text-text-muted",children:c.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):H.length===0?c.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:h?"No matching directories":"No subdirectories"}):c.jsx("div",{className:"divide-y divide-border",children:H.map((L,D)=>c.jsxs("button",{ref:I=>{R.current[D]=I},onClick:()=>L.type==="parent"?W(L.path):O(L.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${D===y?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[c.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"flex-1",children:L.name})]},L.path))})})]})]}),c.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[c.jsx(ht,{variant:"secondary",onClick:()=>l(!0),children:"Create Project"}),c.jsx(ht,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&c.jsx(DS,{isOpen:s,onClose:()=>l(!1)}),A&&c.jsx(TS,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:q})]}):null}function LS(){const[e,r]=F.useState(!1),i=Ee(g=>g.sessions),s=Ft(g=>g.projects),l=Ft(g=>g.listProjects),h=Ee(g=>g.listSessions),m=Ee(g=>g.connectionStatus);F.useEffect(()=>{m==="connected"&&(l(),h())},[m,l,h]);const o=[...s].sort((g,p)=>{const v=i.filter(b=>b.workdir.startsWith(g.workdir)),S=i.filter(b=>b.workdir.startsWith(p.workdir)),E=v.length>0?new Date(v.reduce((b,_)=>new Date(_.updatedAt)>new Date(b.updatedAt)?_:b).updatedAt).getTime():new Date(g.updatedAt).getTime();return(S.length>0?new Date(S.reduce((b,_)=>new Date(_.updatedAt)>new Date(b.updatedAt)?_:b).updatedAt).getTime():new Date(p.updatedAt).getTime())-E}),d=g=>{const p=s.find(v=>v.id===g);return p?i.filter(v=>v.workdir.startsWith(p.workdir)).sort((v,S)=>new Date(S.updatedAt).getTime()-new Date(v.updatedAt).getTime()).slice(0,5):[]},f=()=>{r(!0)};return c.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[c.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[c.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),c.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),c.jsx(ht,{variant:"primary",onClick:f,children:"Open Project"})]}),o.map(g=>{const p=d(g.id);return c.jsx("div",{className:"mb-6 md:mb-8",children:c.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[c.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[c.jsxs(An,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[c.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),c.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"})]}),c.jsx("div",{className:"divide-y divide-border",children:p.length>0?p.map(v=>{const S=s.find(C=>v.workdir.startsWith(C.workdir)),E=S?`/p/${S.id}/s/${v.id}`:"#";return c.jsx(An,{href:E,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:c.jsx("div",{className:"flex-1 min-w-0",children:c.jsx("div",{className:"text-sm text-text-muted truncate",children:v.title??v.id.slice(0,8)})})}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsx("span",{className:"text-text-muted text-xs",children:bS(v.updatedAt)}),c.jsxs("span",{className:"text-text-muted text-xs",children:[v.messageCount," msgs"]})]})]})},v.id)}):c.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),o.length===0&&c.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&c.jsx(RS,{isOpen:e,onClose:()=>r(!1)})]})}const MS={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function dh({size:e="md",className:r=""}){return c.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${MS[e]} ${r}`})}function OS({text:e,...r}){return c.jsxs("div",{className:"text-center",children:[c.jsx(dh,{...r,className:"mx-auto mb-4"}),e&&c.jsx("div",{className:"text-text-secondary",children:e})]})}function IS(){const[,e]=oh("/p/:projectId/new"),[,r]=Ti(),i=e==null?void 0:e.projectId,s=Ee(l=>l.createSession);return F.useEffect(()=>{i&&(async()=>{const h=await s(i);r(h?`/p/${i}/s/${h.id}`:`/p/${i}`)})()},[i,s,r]),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(dh,{})})}function BS(){const e=Ft(r=>r.currentProject);return c.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:c.jsxs("div",{className:"max-w-md",children:[c.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),c.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),c.jsxs("div",{className:"flex flex-col gap-3",children:[e&&c.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"}),c.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const ja=e=>Math.round(e*10)/10;function Ud(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function zS(e){return`${e.providerId}::${e.model}`}function HS(e){return`${e.providerName} > ${e.model}`}function _x(e){let r=0,i=0,s=0,l=0,h=0,m=0;const o=[],d=[];let f=0;for(const[v,S]of e.entries()){const E=S.stats,C=Ud(E);r+=E.totalTime,i+=E.toolTime,s+=E.prefillTokens,l+=E.generationTokens;const b=E.prefillSpeed>0?E.prefillTokens/E.prefillSpeed:0,_=E.generationSpeed>0?E.generationTokens/E.generationSpeed:0;h+=b,m+=_,o.push({messageId:S.id,timestamp:S.timestamp,...C,mode:E.mode,responseIndex:v+1,prefillTokens:E.prefillTokens,generationTokens:E.generationTokens,prefillSpeed:E.prefillSpeed,generationSpeed:E.generationSpeed,totalTime:E.totalTime,aiTime:E.totalTime-E.toolTime,toolTime:E.toolTime});const x=E.llmCalls??[];for(const y of x)f+=1,d.push({messageId:S.id,timestamp:y.timestamp??S.timestamp,providerId:y.providerId,providerName:y.providerName,backend:y.backend,model:y.model,mode:E.mode,responseIndex:v+1,sessionCallIndex:f,callIndex:y.callIndex,promptTokens:y.promptTokens,completionTokens:y.completionTokens,ttft:y.ttft,completionTime:y.completionTime,prefillSpeed:y.prefillSpeed,generationSpeed:y.generationSpeed,totalTime:y.totalTime})}const g=h>0?ja(s/h):0,p=m>0?ja(l/m):0;return{totalTime:ja(r),aiTime:ja(r-i),toolTime:ja(i),prefillTokens:s,generationTokens:l,avgPrefillSpeed:g,avgGenerationSpeed:p,responseCount:e.length,llmCallCount:d.length,dataPoints:o,callDataPoints:d}}function PS(e){const r=e.filter(l=>l.stats!==void 0&&l.stats!==null).sort((l,h)=>new Date(l.timestamp).getTime()-new Date(h.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const l of r){const h=zS(Ud(l.stats)),m=i.get(h)??[];i.set(h,[...m,l])}const s=Array.from(i.entries()).map(([l,h])=>{const m=Ud(h[0].stats),o=_x(h);return{...m,key:l,label:HS(m),...o}});return{..._x(r),modelGroups:s}}function FS(e){return F.useMemo(()=>PS(e),[e])}function US(e){const[r,i]=F.useState(null),[s,l]=F.useState(!0),[h,m]=F.useState(null),o=e||"";return F.useEffect(()=>{if(!o){l(!1);return}let d=!0,f=null;const g=async()=>{try{const v=await(await Se(`/api/branch?workdir=${encodeURIComponent(o)}`)).json();d&&(i(v.branch),m(v.error||null),l(!1))}catch(p){d&&(m(p instanceof Error?p.message:"Failed to fetch branch"),l(!1))}};return g(),f=setInterval(g,3e3),()=>{d=!1,f&&clearInterval(f)}},[o]),{branch:r,loading:s,error:h}}function Sx(e){return e.toLocaleString("en-US").replace(/,/g," ")}function wx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function $S(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 qS="modulepreload",WS=function(e){return"/"+e},Cx={},GS=function(r,i,s){let l=Promise.resolve();if(i&&i.length>0){let m=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),d=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));l=m(i.map(f=>{if(f=WS(f),f in Cx)return;Cx[f]=!0;const g=f.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":qS,g||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),g)return new Promise((S,E)=>{v.addEventListener("load",S),v.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function h(m){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=m,window.dispatchEvent(o),!o.defaultPrevented)throw m}return l.then(m=>{for(const o of m||[])o.status==="rejected"&&h(o.reason);return r().catch(h)})},kx=["▁","▂","▃","▄","▅","▆","▇","█"];function VS(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 YS(e,r){if(e===r){const l=Math.max(Math.abs(e)*.05,1);return{minY:e-l,maxY:r+l}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function KS(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((p,v)=>p.x-v.x),s=i[0].x,l=i[i.length-1].x,h=Math.min(...i.map(p=>p.y)),m=Math.max(...i.map(p=>p.y)),{minY:o,maxY:d}=YS(h,m),f=Array.from({length:r},()=>" "),g=new Map;for(const p of i){const v=l===s?0:Math.round((p.x-s)/(l-s)*(r-1)),S=g.get(v)??[];g.set(v,[...S,p.y])}for(const[p,v]of g){const S=Math.max(...v);f[p]=kx[VS(S,o,d)]??kx[0]}return{blocks:f.join(""),minX:s,maxX:l,minY:o,maxY:d}}function Ex(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function jx({data:e,width:r=60,height:i=78,label:s,xLabel:l,yLabel:h,showAxes:m=!0,formatY:o=Ex,formatX:d=Ex}){const f=F.useMemo(()=>{const g=KS(e,r),p=Math.max(r*6,240),v=10,S=8,C=[...e].sort((y,j)=>y.x-j.x).map(y=>{const j=g.maxX===g.minX?p/2:v+(y.x-g.minX)/(g.maxX-g.minX)*(p-v*2),A=g.maxY===g.minY?i/2:S+(g.maxY-y.y)/(g.maxY-g.minY)*(i-S*2);return{...y,cx:j,cy:A,leftPercent:j/p*100,topPercent:A/i*100}}),b=C.map((y,j)=>`${j===0?"M":"L"} ${y.cx.toFixed(1)} ${y.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(y=>({value:y,y:g.maxY===g.minY?i/2:S+(g.maxY-y)/(g.maxY-g.minY)*(i-S*2)}));return{...g,chartWidth:p,points:C,path:b,gridLines:x}},[e,i,r]);return e.length===0?c.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&c.jsx("div",{className:"mb-1",children:s}),c.jsx("div",{children:"No data"})]}):c.jsxs("div",{className:"font-mono text-xs",children:[s&&c.jsx("div",{className:"text-text-secondary mb-2",children:s}),c.jsxs("div",{className:"flex gap-3",children:[m&&c.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:f.gridLines.map(g=>c.jsx("span",{children:o(g.value)},`${g.value}-${g.y}`))}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"relative h-[78px]",children:[c.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=>c.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=>c.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&&c.jsx("path",{d:f.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),f.points.map(g=>c.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${o(g.y)}`,children:c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),m&&c.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[c.jsx("span",{className:"w-12"}),c.jsxs("span",{className:"flex-1 flex justify-between",children:[c.jsx("span",{children:d(f.minX)}),c.jsx("span",{children:l}),c.jsx("span",{children:d(f.maxX)})]})]}),h&&m&&c.jsx("div",{className:"text-text-muted mt-1 text-center",children:h})]})}function XS({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:l=60}){const h=e.map(o=>({x:o.x,y:o.ppSpeed})),m=e.map(o=>({x:o.x,y:o.tgSpeed}));return c.jsxs("div",{className:"space-y-5",children:[c.jsx(jx,{data:h,width:l,label:r,xLabel:s}),c.jsx(jx,{data:m,width:l,label:i,xLabel:s})]})}function ZS(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((l,h)=>l.callIndex-h.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function QS(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 JS(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 ew(e){return e.callDataPoints.length>0?JS(e):QS(e)}function xd(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 Ei(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function La(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function tw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Ei(r)} ctx`:`${Ei(r)}-${Ei(i)} ctx`}function wl(e){return`${La(e)} t/s`}function o0(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function nw(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 rw({isOpen:e,onClose:r,stats:i}){const s=F.useRef(null),[l,h]=F.useState({}),[m,o]=F.useState(()=>{var E;return((E=i.modelGroups[0])==null?void 0:E.key)??""});F.useEffect(()=>{var E;i.modelGroups.some(C=>C.key===m)||o(((E=i.modelGroups[0])==null?void 0:E.key)??"")},[m,i.modelGroups]);const d=F.useMemo(()=>i.modelGroups.find(E=>E.key===m)??i.modelGroups[0],[m,i.modelGroups]),f=F.useMemo(()=>d?ZS(d):[],[d]),g=F.useMemo(()=>d?ew(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),p=F.useCallback(E=>{h(C=>({...C,[E]:!C[E]}))},[]),v=F.useCallback(()=>{if(!d)return;const E=nw(d);navigator.clipboard.writeText(JSON.stringify(E,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),S=F.useCallback(async()=>{if(s.current)try{const E=(await GS(async()=>{const{default:_}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:_}},[])).default,C=await E(s.current,{backgroundColor:"#1a1a1a",scale:2}),b=document.createElement("a");b.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,b.href=C.toDataURL("image/png"),b.click()}catch(E){console.error("Failed to export PNG:",E),v()}},[v]);return c.jsx(un,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:c.jsxs("div",{ref:s,className:"space-y-6",children:[c.jsx("section",{children:c.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(E=>c.jsx("button",{onClick:()=>o(E.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${E.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:E.label,children:E.label},E.key))})}),d&&c.jsxs("section",{children:[c.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[c.jsx(kr,{label:"AI Time",value:xd(d.aiTime)}),c.jsx(kr,{label:"Total Time",value:xd(d.totalTime)}),c.jsx(kr,{label:"Tool Time",value:xd(d.toolTime)}),c.jsx(kr,{label:"Responses",value:d.responseCount.toString()}),c.jsx(kr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),c.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[c.jsx(kr,{label:"Prefill Tokens",value:Ei(d.prefillTokens),subValue:`@ ${La(d.avgPrefillSpeed)} tok/s`}),c.jsx(kr,{label:"Gen Tokens",value:Ei(d.generationTokens),subValue:`@ ${La(d.avgGenerationSpeed)} tok/s`}),c.jsx(kr,{label:"Avg PP Speed",value:`${La(d.avgPrefillSpeed)}`,subValue:"tok/s"}),c.jsx(kr,{label:"Avg TG Speed",value:`${La(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{onClick:v,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),c.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"})]})]}),c.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:c.jsx(XS,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&c.jsxs("section",{children:[c.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),c.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:c.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[c.jsxs("colgroup",{children:[c.jsx("col",{className:"w-[7%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[10%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[14%]"}),c.jsx("col",{className:"w-[11%]"}),c.jsx("col",{className:"w-[2%]"})]}),c.jsx("thead",{children:c.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[c.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),c.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),c.jsx("th",{className:"px-2 py-2"})]})}),c.jsx("tbody",{children:f.map((E,C)=>c.jsxs(F.Fragment,{children:[c.jsx(iw,{row:E,index:C,isExpanded:l[E.messageId]??!1,onToggle:E.isExpandable?()=>p(E.messageId):void 0}),(l[E.messageId]??!1)&&E.calls.map((b,_)=>c.jsx(sw,{dataPoint:b,index:_},`${b.messageId}-${b.callIndex}`))]},E.messageId))})]})})]})]})})}function kr({label:e,value:r,subValue:i}){return c.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[c.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),c.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&c.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function iw({row:e,index:r,isExpanded:i,onToggle:s}){const l=e.calls.length>0?tw(e.calls.map(h=>h.promptTokens)):`${Ei(e.prefillTokens)} ctx`;return c.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[c.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:o0(e.timestamp)}),c.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:l.replace(/ ctx$/,"")}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:wl(e.prefillSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:wl(e.generationSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function sw({dataPoint:e,index:r}){return c.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[c.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]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:o0(e.timestamp)}),c.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Ei(e.promptTokens)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:wl(e.prefillSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:wl(e.generationSpeed)}),c.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),c.jsx("td",{className:"px-2 py-2"})]})}const aw={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"}},ow=F.memo(function({criteria:r}){if(r.length===0)return c.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 l of r){const h=l.status.type;h in i&&i[h]++}const s=Object.keys(i).filter(l=>i[l]>0);return c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),c.jsx("span",{className:"text-text-secondary",children:r.length})]}),c.jsx("div",{className:"space-y-1",children:s.map(l=>{const h=aw[l];return c.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{className:`${h.color} ${h.animate?"animate-pulse":""} text-sm leading-tight`,children:h.icon}),c.jsxs("span",{className:"text-text-muted",children:[h.label,":"]}),c.jsx("span",{className:"text-text-primary font-medium",children:i[l]})]},l)})})]})});function lw({isOpen:e,onClose:r}){const i=nr(S=>S.config),s=nr(S=>S.saveConfig),[l,h]=F.useState(""),[m,o]=F.useState(""),[d,f]=F.useState(!1),[g,p]=F.useState(!1);F.useEffect(()=>{e&&(h((i==null?void 0:i.command)??""),o((i==null?void 0:i.url)??""),f((i==null?void 0:i.hotReload)??!1))},[e,i]);const v=async()=>{!l.trim()||!m.trim()||(p(!0),await s({command:l.trim(),url:m.trim(),hotReload:d}),p(!1),r())};return c.jsx(un,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),c.jsx("input",{className:"input w-full",type:"text",value:l,onChange:S=>h(S.target.value),placeholder:"npm run dev"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),c.jsx("input",{className:"input w-full",type:"text",value:m,onChange:S=>o(S.target.value),placeholder:"http://localhost:3000"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:S=>f(S.target.checked),className:"rounded border-border bg-bg-tertiary"}),c.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),c.jsx("button",{className:"btn btn-primary",onClick:v,disabled:g||!l.trim()||!m.trim(),children:g?"Saving...":"Save"})]})]})})}const Nx={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"},cw={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"},Tx={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},uw="text-text-primary";function dw(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,l="text-text-primary",h;try{for(;(h=i.exec(e))!==null;){if(h.index>s){const f=e.slice(s,h.index);f&&r.push({text:f,className:l})}const m=h[1];if(!m)continue;const o=m.split(";").map(Number);if(o.length===0||o[0]===0){l="text-text-primary";continue}const d=[];for(const f of o)if(f>=30&&f<=37){const g=Nx[f];g&&d.push(g)}else if(f>=40&&f<=47){const g=cw[f];g&&d.push(g)}else if(f>=90&&f<=97){const g=Nx[f];g&&d.push(g)}else if(f in Tx){const g=Tx[f];g&&d.push(g)}else f===39?d.push(uw):f===49&&(l=l.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(l=d.join(" ")),s=i.lastIndex}if(s<e.length){const m=e.slice(s);m&&r.push({text:m,className:l})}return r}catch(m){return console.warn("ANSI parsing failed, stripping codes:",m),[{text:hw(e),className:"text-text-primary"}]}}function hw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Cl(e){var i,s;const r=dw(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((l,h)=>ln.createElement("span",{key:h,className:l.className},l.text))}const fw=F.memo(function({logs:r,onClose:i}){const s=F.useRef(null);return F.useEffect(()=>{const l=h=>{h.key==="Escape"&&i()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[i]),F.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[r]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:i,children:c.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:l=>l.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server Logs"}),c.jsx("button",{onClick:i,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:c.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:c.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"})})})]}),c.jsx("pre",{ref:s,className:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary",children:r.length===0?c.jsx("span",{className:"text-text-muted",children:"No output yet"}):r.map((l,h)=>c.jsx("span",{className:l.stream==="stderr"?"text-accent-warning":"",children:Cl(l.content)},h))})]})})}),pw=F.memo(function({workdir:r}){const i=nr(y=>y.setWorkdir),s=nr(y=>y.status),l=nr(y=>y.config),h=nr(y=>y.logs),m=nr(y=>y.start),o=nr(y=>y.stop),d=nr(y=>y.fetchLogs),[f,g]=F.useState(!1),[p,v]=F.useState(!1),S=F.useRef(null),E=(s==null?void 0:s.state)??"off",C=l!==null,b=E==="running"||E==="warning";F.useEffect(()=>{i(r??null)},[r,i]),F.useEffect(()=>{b&&d()},[b,d]),F.useEffect(()=>{S.current&&b&&(S.current.scrollTop=S.current.scrollHeight)},[h,b]);const _=()=>{b?o():m()},x=c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.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 c.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${E==="running"?"bg-accent-success":E==="warning"?"bg-accent-warning":E==="error"?"bg-accent-error":"bg-text-muted"}`}),c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),c.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:x})]}),C?c.jsxs(c.Fragment,{children:[E==="running"||E==="warning"?c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{onClick:_,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:[c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:c.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&c.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:[c.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[c.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"}),c.jsx("path",{d:"M9.5 2h4.5v4.5"}),c.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):c.jsx("button",{onClick:_,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"}),b&&c.jsxs("div",{className:"relative",children:[c.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:h.length===0?c.jsx("span",{className:"text-text-muted",children:"No output yet"}):h.map((y,j)=>c.jsx("span",{className:y.stream==="stderr"?"text-accent-warning":"",children:Cl(y.content)},j))}),c.jsx("button",{onClick:()=>v(!0),className:"absolute bottom-2 right-2 p-1 rounded bg-bg-tertiary/80 hover:bg-bg-tertiary text-text-muted transition-colors",title:"Expand logs",children:c.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h4a1 1 0 010 2H5v3a1 1 0 01-2 0V4zm12-1a1 1 0 00-1 1v3a1 1 0 102 0V5h3a1 1 0 100-2h-4zm-9 12a1 1 0 011 1v3h3a1 1 0 110 2H4a1 1 0 01-1-1v-4a1 1 0 011-1zm12 0a1 1 0 011 1v4a1 1 0 01-1 1h-4a1 1 0 110-2h3v-3a1 1 0 011-1z",clipRule:"evenodd"})})})]})]}):c.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"}),c.jsx(lw,{isOpen:f,onClose:()=>g(!1)}),p&&c.jsx(fw,{logs:h,onClose:()=>v(!1)})]})});function Ax({summary:e,messages:r,workdir:i}){const[s,l]=F.useState(!1),h=FS(r),{branch:m}=US(i),o=Ee(d=>d.currentSession);return c.jsxs("div",{className:"flex flex-col h-full",children:[h&&c.jsxs("div",{className:"mb-4",children:[c.jsx("button",{onClick:()=>l(!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:c.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[c.jsx("span",{className:"text-text-secondary",children:$S(h.aiTime)}),c.jsx("span",{className:"w-px h-3 bg-border"}),c.jsx("span",{className:"text-text-secondary",children:wx(h.avgPrefillSpeed)}),c.jsx("span",{children:"pp"}),c.jsx("span",{className:"w-px h-3 bg-border"}),c.jsx("span",{className:"text-text-secondary",children:wx(h.avgGenerationSpeed)}),c.jsx("span",{children:"tg"})]})}),c.jsx(rw,{isOpen:s,onClose:()=>l(!1),stats:h})]}),c.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[c.jsx("div",{className:"flex items-center justify-between mb-2",children:c.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?c.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):c.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),c.jsxs("div",{className:"mt-4",children:[c.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),c.jsx(ow,{criteria:(o==null?void 0:o.criteria)??[]})]})]}),m&&c.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[c.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:c.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"})}),c.jsx("span",{className:"truncate text-text-secondary",title:m,children:m})]}),c.jsx(pw,{workdir:i})]})}function mw({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const l=Ee(h=>h.currentSession);return c.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&c.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),c.jsxs("div",{className:"flex h-full",children:[c.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?c.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:c.jsx(Ax,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})}):c.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),c.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:c.jsx(Ax,{summary:(l==null?void 0:l.summary)??null,messages:s,workdir:l==null?void 0:l.workdir})})]})]})}function gw(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Dx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function xw(){const e=Ee(f=>f.contextState),r=Ee(f=>f.currentSession),i=Ee(f=>f.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:l,compactionCount:h,dangerZone:m}=e,o=Math.round(s/l*100),d=r.isRunning;return c.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:c.jsx("div",{className:"flex items-center justify-between gap-4",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[c.jsx("span",{className:"text-text-muted",children:"Context:"}),c.jsxs("span",{className:Dx(o,m),children:[Sx(s)," / ",Sx(l)]}),c.jsxs("span",{className:Dx(o,m),children:["(",o,"%)"]})]}),c.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full overflow-hidden w-20",children:c.jsx("div",{className:`h-full transition-all duration-300 ${gw(o,m)}`,style:{width:`${Math.min(o,100)}%`}})}),m&&c.jsx("span",{className:"text-[10px] text-accent-error font-medium animate-pulse",children:"Low!"}),h>0&&c.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[h,"x"]}),c.jsx(ht,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:m?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Rx(e){const r=[],i=String(e||"");let s=i.indexOf(","),l=0,h=!1;for(;!h;){s===-1&&(s=i.length,h=!0);const m=i.slice(l,s).trim();(m||!h)&&r.push(m),l=s+1,s=i.indexOf(",",l)}return r}function vw(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const bw=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_w={};function Lx(e,r){return(_w.jsx?yw:bw).test(e)}const Sw=/[ \t\n\f\r]/g;function ww(e){return typeof e=="object"?e.type==="text"?Mx(e.value):!1:Mx(e)}function Mx(e){return e.replace(Sw,"")===""}class Ga{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}Ga.prototype.normal={};Ga.prototype.property={};Ga.prototype.space=void 0;function l0(e,r){const i={},s={};for(const l of e)Object.assign(i,l.property),Object.assign(s,l.normal);return new Ga(i,s,r)}function za(e){return e.toLowerCase()}class bn{constructor(r,i){this.attribute=i,this.property=r}}bn.prototype.attribute="";bn.prototype.booleanish=!1;bn.prototype.boolean=!1;bn.prototype.commaOrSpaceSeparated=!1;bn.prototype.commaSeparated=!1;bn.prototype.defined=!1;bn.prototype.mustUseProperty=!1;bn.prototype.number=!1;bn.prototype.overloadedBoolean=!1;bn.prototype.property="";bn.prototype.spaceSeparated=!1;bn.prototype.space=void 0;let Cw=0;const We=Ai(),zt=Ai(),$d=Ai(),ye=Ai(),_t=Ai(),Es=Ai(),Nn=Ai();function Ai(){return 2**++Cw}const qd=Object.freeze(Object.defineProperty({__proto__:null,boolean:We,booleanish:zt,commaOrSpaceSeparated:Nn,commaSeparated:Es,number:ye,overloadedBoolean:$d,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),vd=Object.keys(qd);class hh extends bn{constructor(r,i,s,l){let h=-1;if(super(r,i),Ox(this,"space",l),typeof s=="number")for(;++h<vd.length;){const m=vd[h];Ox(this,vd[h],(s&qd[m])===qd[m])}}}hh.prototype.defined=!0;function Ox(e,r,i){i&&(e[r]=i)}function Ts(e){const r={},i={};for(const[s,l]of Object.entries(e.properties)){const h=new hh(s,e.transform(e.attributes||{},s),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(h.mustUseProperty=!0),r[s]=h,i[za(s)]=s,i[za(h.attribute)]=s}return new Ga(r,i,e.space)}const c0=Ts({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:ye,ariaColIndex:ye,ariaColSpan:ye,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:_t,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:ye,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:ye,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:_t,ariaRowCount:ye,ariaRowIndex:ye,ariaRowSpan:ye,ariaSelected:zt,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 u0(e,r){return r in e?e[r]:r}function d0(e,r){return u0(e,r.toLowerCase())}const kw=Ts({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Es,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:_t,autoFocus:We,autoPlay:We,blocking:_t,capture:null,charSet:null,checked:We,cite:null,className:_t,cols:ye,colSpan:null,content:null,contentEditable:zt,controls:We,controlsList:_t,coords:ye|Es,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:$d,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:_t,height:ye,hidden:$d,high:ye,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:_t,itemRef:_t,itemScope:We,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:ye,manifest:null,max:null,maxLength:ye,media:null,method:null,min:null,minLength:ye,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:ye,pattern:null,ping:_t,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:_t,required:We,reversed:We,rows:ye,rowSpan:ye,sandbox:_t,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shape:null,size:ye,sizes:null,slot:null,span:ye,spellCheck:zt,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:We,useMap:null,value:zt,width:ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,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:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:ye,leftMargin:ye,link:null,longDesc:null,lowSrc:null,marginHeight:ye,marginWidth:ye,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:ye,rules:null,scheme:null,scrolling:zt,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:We,disableRemotePlayback:We,prefix:null,property:null,results:ye,security:null,unselectable:null},space:"html",transform:d0}),Ew=Ts({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:Nn,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:_t,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:We,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:Es,g2:Es,glyphName:Es,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:Nn,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:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ye,pointsAtY:ye,pointsAtZ:ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nn,rev:Nn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nn,requiredFeatures:Nn,requiredFonts:Nn,requiredFormats:Nn,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:Nn,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:Nn,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:Nn,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:u0}),h0=Ts({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()}}),f0=Ts({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:d0}),p0=Ts({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),jw={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"},Nw=/[A-Z]/g,Ix=/-[a-z]/g,Tw=/^data[-\w.:]+$/i;function m0(e,r){const i=za(r);let s=r,l=bn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&Tw.test(r)){if(r.charAt(4)==="-"){const h=r.slice(5).replace(Ix,Dw);s="data"+h.charAt(0).toUpperCase()+h.slice(1)}else{const h=r.slice(4);if(!Ix.test(h)){let m=h.replace(Nw,Aw);m.charAt(0)!=="-"&&(m="-"+m),r="data"+m}}l=hh}return new l(s,r)}function Aw(e){return"-"+e.toLowerCase()}function Dw(e){return e.charAt(1).toUpperCase()}const g0=l0([c0,kw,h0,f0,p0],"html"),Ml=l0([c0,Ew,h0,f0,p0],"svg");function Bx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function Rw(e){return e.join(" ").trim()}var xs={},bd,zx;function Lw(){if(zx)return bd;zx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,h=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,m=/^[;\s]*/,o=/^\s+|\s+$/g,d=`
|
|
91
|
-
`,f="/",g="*",p="",v="comment",S="declaration";function E(b,_){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];_=_||{};var x=1,y=1;function j(O){var W=O.match(r);W&&(x+=W.length);var V=O.lastIndexOf(d);y=~V?O.length-V:y+O.length}function A(){var O={line:x,column:y};return function(W){return W.position=new N(O),B(),W}}function N(O){this.start=O,this.end={line:x,column:y},this.source=_.source}N.prototype.content=b;function R(O){var W=new Error(_.source+":"+x+":"+y+": "+O);if(W.reason=O,W.filename=_.source,W.line=x,W.column=y,W.source=b,!_.silent)throw W}function T(O){var W=O.exec(b);if(W){var V=W[0];return j(V),b=b.slice(V.length),W}}function B(){T(i)}function H(O){var W;for(O=O||[];W=G();)W!==!1&&O.push(W);return O}function G(){var O=A();if(!(f!=b.charAt(0)||g!=b.charAt(1))){for(var W=2;p!=b.charAt(W)&&(g!=b.charAt(W)||f!=b.charAt(W+1));)++W;if(W+=2,p===b.charAt(W-1))return R("End of comment missing");var V=b.slice(2,W-2);return y+=2,j(V),b=b.slice(W),y+=2,O({type:v,comment:V})}}function Y(){var O=A(),W=T(s);if(W){if(G(),!T(l))return R("property missing ':'");var V=T(h),Q=O({type:S,property:C(W[0].replace(e,p)),value:V?C(V[0].replace(e,p)):p});return T(m),Q}}function q(){var O=[];H(O);for(var W;W=Y();)W!==!1&&(O.push(W),H(O));return O}return B(),q()}function C(b){return b?b.replace(o,p):p}return bd=E,bd}var Hx;function Mw(){if(Hx)return xs;Hx=1;var e=xs&&xs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(xs,"__esModule",{value:!0}),xs.default=i;const r=e(Lw());function i(s,l){let h=null;if(!s||typeof s!="string")return h;const m=(0,r.default)(s),o=typeof l=="function";return m.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:g}=d;o?l(f,g,d):g&&(h=h||{},h[f]=g)}),h}return xs}var Na={},Px;function Ow(){if(Px)return Na;Px=1,Object.defineProperty(Na,"__esModule",{value:!0}),Na.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,h=function(f){return!f||i.test(f)||e.test(f)},m=function(f,g){return g.toUpperCase()},o=function(f,g){return"".concat(g,"-")},d=function(f,g){return g===void 0&&(g={}),h(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(l,o):f=f.replace(s,o),f.replace(r,m))};return Na.camelCase=d,Na}var Ta,Fx;function Iw(){if(Fx)return Ta;Fx=1;var e=Ta&&Ta.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},r=e(Mw()),i=Ow();function s(l,h){var m={};return!l||typeof l!="string"||(0,r.default)(l,function(o,d){o&&d&&(m[(0,i.camelCase)(o,h)]=d)}),m}return s.default=s,Ta=s,Ta}var Bw=Iw();const zw=Al(Bw),x0=v0("end"),fh=v0("start");function v0(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 Hw(e){const r=fh(e),i=x0(e);if(r&&i)return{start:r,end:i}}function Ma(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ux(e.position):"start"in e||"end"in e?Ux(e):"line"in e||"column"in e?Wd(e):""}function Wd(e){return $x(e&&e.line)+":"+$x(e&&e.column)}function Ux(e){return Wd(e&&e.start)+"-"+Wd(e&&e.end)}function $x(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 l="",h={},m=!1;if(i&&("line"in i&&"column"in i?h={place:i}:"start"in i&&"end"in i?h={place:i}:"type"in i?h={ancestors:[i],place:i.position}:h={...i}),typeof r=="string"?l=r:!h.cause&&r&&(m=!0,l=r.message,h.cause=r),!h.ruleId&&!h.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?h.ruleId=s:(h.source=s.slice(0,d),h.ruleId=s.slice(d+1))}if(!h.place&&h.ancestors&&h.ancestors){const d=h.ancestors[h.ancestors.length-1];d&&(h.place=d.position)}const o=h.place&&"start"in h.place?h.place.start:h.place;this.ancestors=h.ancestors||void 0,this.cause=h.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=o?o.line:void 0,this.name=Ma(h.place)||"1:1",this.place=h.place||void 0,this.reason=this.message,this.ruleId=h.ruleId||void 0,this.source=h.source||void 0,this.stack=m&&h.cause&&typeof h.cause.stack=="string"?h.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 ph={}.hasOwnProperty,Pw=new Map,Fw=/[A-Z]/g,Uw=new Set(["table","tbody","thead","tfoot","tr"]),$w=new Set(["td","th"]),b0="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qw(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=Qw(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=Zw(i,r.jsx,r.jsxs)}const l={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"?Ml:g0,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},h=y0(l,e,void 0);return h&&typeof h!="string"?h:l.create(e,l.Fragment,{children:h||void 0},void 0)}function y0(e,r,i){if(r.type==="element")return Ww(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return Gw(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return Yw(e,r,i);if(r.type==="mdxjsEsm")return Vw(e,r);if(r.type==="root")return Kw(e,r,i);if(r.type==="text")return Xw(e,r)}function Ww(e,r,i){const s=e.schema;let l=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(l=Ml,e.schema=l),e.ancestors.push(r);const h=S0(e,r.tagName,!1),m=Jw(e,r);let o=gh(e,r);return Uw.has(r.tagName)&&(o=o.filter(function(d){return typeof d=="string"?!ww(d):!0})),_0(e,m,h,r),mh(m,o),e.ancestors.pop(),e.schema=s,e.create(r,h,m,i)}function Gw(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)}Ha(e,r.position)}function Vw(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Ha(e,r.position)}function Yw(e,r,i){const s=e.schema;let l=s;r.name==="svg"&&s.space==="html"&&(l=Ml,e.schema=l),e.ancestors.push(r);const h=r.name===null?e.Fragment:S0(e,r.name,!0),m=e2(e,r),o=gh(e,r);return _0(e,m,h,r),mh(m,o),e.ancestors.pop(),e.schema=s,e.create(r,h,m,i)}function Kw(e,r,i){const s={};return mh(s,gh(e,r)),e.create(r,e.Fragment,s,i)}function Xw(e,r){return r.value}function _0(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function mh(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function Zw(e,r,i){return s;function s(l,h,m,o){const f=Array.isArray(m.children)?i:r;return o?f(h,m,o):f(h,m)}}function Qw(e,r){return i;function i(s,l,h,m){const o=Array.isArray(h.children),d=fh(s);return r(l,h,m,o,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function Jw(e,r){const i={};let s,l;for(l in r.properties)if(l!=="children"&&ph.call(r.properties,l)){const h=t2(e,l,r.properties[l]);if(h){const[m,o]=h;e.tableCellAlignToStyle&&m==="align"&&typeof o=="string"&&$w.has(r.tagName)?s=o:i[m]=o}}if(s){const h=i.style||(i.style={});h[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function e2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const h=s.data.estree.body[0];h.type;const m=h.expression;m.type;const o=m.properties[0];o.type,Object.assign(i,e.evaluater.evaluateExpression(o.argument))}else Ha(e,r.position);else{const l=s.name;let h;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const o=s.value.data.estree.body[0];o.type,h=e.evaluater.evaluateExpression(o.expression)}else Ha(e,r.position);else h=s.value===null?!0:s.value;i[l]=h}return i}function gh(e,r){const i=[];let s=-1;const l=e.passKeys?new Map:Pw;for(;++s<r.children.length;){const h=r.children[s];let m;if(e.passKeys){const d=h.type==="element"?h.tagName:h.type==="mdxJsxFlowElement"||h.type==="mdxJsxTextElement"?h.name:void 0;if(d){const f=l.get(d)||0;m=d+"-"+f,l.set(d,f+1)}}const o=y0(e,h,m);o!==void 0&&i.push(o)}return i}function t2(e,r,i){const s=m0(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?vw(i):Rw(i)),s.property==="style"){let l=typeof i=="object"?i:n2(e,String(i));return e.stylePropertyNameCase==="css"&&(l=r2(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&s.space?jw[s.property]||s.property:s.attribute,i]}}function n2(e,r){try{return zw(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,l=new an("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=b0+"#cannot-parse-style-attribute",l}}function S0(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const l=r.split(".");let h=-1,m;for(;++h<l.length;){const o=Lx(l[h])?{type:"Identifier",name:l[h]}:{type:"Literal",value:l[h]};m=m?{type:"MemberExpression",object:m,property:o,computed:!!(h&&o.type==="Literal"),optional:!1}:o}s=m}else s=Lx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const l=s.value;return ph.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ha(e)}function Ha(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=b0+"#cannot-handle-mdx-estrees-without-createevaluater",i}function r2(e){const r={};let i;for(i in e)ph.call(e,i)&&(r[i2(i)]=e[i]);return r}function i2(e){let r=e.replace(Fw,s2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function s2(e){return"-"+e.toLowerCase()}const yd={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"]},a2={};function xh(e,r){const i=a2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return w0(e,s,l)}function w0(e,r,i){if(o2(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 qx(e.children,r,i)}return Array.isArray(e)?qx(e,r,i):""}function qx(e,r,i){const s=[];let l=-1;for(;++l<e.length;)s[l]=w0(e[l],r,i);return s.join("")}function o2(e){return!!(e&&typeof e=="object")}const Wx=document.createElement("i");function Pa(e){const r="&"+e+";";Wx.innerHTML=r;const i=Wx.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Dn(e,r,i,s){const l=e.length;let h=0,m;if(r<0?r=-r>l?0:l+r:r=r>l?l:r,i=i>0?i:0,s.length<1e4)m=Array.from(s),m.unshift(r,i),e.splice(...m);else for(i&&e.splice(r,i);h<s.length;)m=s.slice(h,h+1e4),m.unshift(r,0),e.splice(...m),h+=1e4,r+=1e4}function $n(e,r){return e.length>0?(Dn(e,e.length,0,r),e):r}const Gx={}.hasOwnProperty;function C0(e){const r={};let i=-1;for(;++i<e.length;)l2(r,e[i]);return r}function l2(e,r){let i;for(i in r){const l=(Gx.call(e,i)?e[i]:void 0)||(e[i]={}),h=r[i];let m;if(h)for(m in h){Gx.call(l,m)||(l[m]=[]);const o=h[m];c2(l[m],Array.isArray(o)?o:o?[o]:[])}}}function c2(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 k0(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=ri(/[A-Za-z]/),sn=ri(/[\dA-Za-z]/),u2=ri(/[#-'*+\--9=?A-Z^-~]/);function kl(e){return e!==null&&(e<32||e===127)}const Gd=ri(/\d/),d2=ri(/[\dA-Fa-f]/),h2=ri(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Xe(e){return e===-2||e===-1||e===32}const Ol=ri(new RegExp("\\p{P}|\\p{S}","u")),Ni=ri(/\s/);function ri(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function As(e){const r=[];let i=-1,s=0,l=0;for(;++i<e.length;){const h=e.charCodeAt(i);let m="";if(h===37&&sn(e.charCodeAt(i+1))&&sn(e.charCodeAt(i+2)))l=2;else if(h<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(h))||(m=String.fromCharCode(h));else if(h>55295&&h<57344){const o=e.charCodeAt(i+1);h<56320&&o>56319&&o<57344?(m=String.fromCharCode(h,o),l=1):m="�"}else m=String.fromCharCode(h);m&&(r.push(e.slice(s,i),encodeURIComponent(m)),s=i+l+1,m=""),l&&(i+=l,l=0)}return r.join("")+e.slice(s)}function rt(e,r,i,s){const l=s?s-1:Number.POSITIVE_INFINITY;let h=0;return m;function m(d){return Xe(d)?(e.enter(i),o(d)):r(d)}function o(d){return Xe(d)&&h++<l?(e.consume(d),o):(e.exit(i),r(d))}}const f2={tokenize:p2};function p2(e){const r=e.attempt(this.parser.constructs.contentInitial,s,l);let i;return r;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),rt(e,r,"linePrefix")}function l(o){return e.enter("paragraph"),h(o)}function h(o){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,m(o)}function m(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Me(o)?(e.consume(o),e.exit("chunkText"),h):(e.consume(o),m)}}const m2={tokenize:g2},Vx={tokenize:x2};function g2(e){const r=this,i=[];let s=0,l,h,m;return o;function o(y){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,f)(y)}return f(y)}function d(y){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,l&&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}_(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(y)}return o(y)}function f(y){if(s===i.length){if(!l)return v(y);if(l.currentConstruct&&l.currentConstruct.concrete)return E(y);r.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(Vx,g,p)(y)}function g(y){return l&&x(),_(s),v(y)}function p(y){return r.parser.lazy[r.now().line]=s!==i.length,m=r.now().offset,E(y)}function v(y){return r.containerState={},e.attempt(Vx,S,E)(y)}function S(y){return s++,i.push([r.currentConstruct,r.containerState]),v(y)}function E(y){if(y===null){l&&x(),_(0),e.consume(y);return}return l=l||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:h}),C(y)}function C(y){if(y===null){b(e.exit("chunkFlow"),!0),_(0),e.consume(y);return}return Me(y)?(e.consume(y),b(e.exit("chunkFlow")),s=0,r.interrupt=void 0,o):(e.consume(y),C)}function b(y,j){const A=r.sliceStream(y);if(j&&A.push(null),y.previous=h,h&&(h.next=y),h=y,l.defineSkip(y.start),l.write(A),r.parser.lazy[y.start.line]){let N=l.events.length;for(;N--;)if(l.events[N][1].start.offset<m&&(!l.events[N][1].end||l.events[N][1].end.offset>m))return;const R=r.events.length;let T=R,B,H;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(B){H=r.events[T][1].end;break}B=!0}for(_(s),N=R;N<r.events.length;)r.events[N][1].end={...H},N++;Dn(r.events,T+1,0,r.events.slice(R)),r.events.length=N}}function _(y){let j=i.length;for(;j-- >y;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=y}function x(){l.write([null]),h=void 0,l=void 0,r.containerState._closeFlow=void 0}}function x2(e,r,i){return rt(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function js(e){if(e===null||yt(e)||Ni(e))return 1;if(Ol(e))return 2}function Il(e,r,i){const s=[];let l=-1;for(;++l<e.length;){const h=e[l].resolveAll;h&&!s.includes(h)&&(r=h(r,i),s.push(h))}return r}const Vd={name:"attention",resolveAll:v2,tokenize:b2};function v2(e,r){let i=-1,s,l,h,m,o,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 p={...e[s][1].end},v={...e[i][1].start};Yx(p,-d),Yx(v,d),m={type:d>1?"strongSequence":"emphasisSequence",start:p,end:{...e[s][1].end}},o={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:v},h={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},l={type:d>1?"strong":"emphasis",start:{...m.start},end:{...o.end}},e[s][1].end={...m.start},e[i][1].start={...o.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",l,r],["enter",m,r],["exit",m,r],["enter",h,r]]),f=$n(f,Il(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),f=$n(f,[["exit",h,r],["enter",o,r],["exit",o,r],["exit",l,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 b2(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,l=js(s);let h;return m;function m(d){return h=d,e.enter("attentionSequence"),o(d)}function o(d){if(d===h)return e.consume(d),o;const f=e.exit("attentionSequence"),g=js(d),p=!g||g===2&&l||i.includes(d),v=!l||l===2&&g||i.includes(s);return f._open=!!(h===42?p:p&&(l||!v)),f._close=!!(h===42?v:v&&(g||!p)),r(d)}}function Yx(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const y2={name:"autolink",tokenize:_2};function _2(e,r,i){let s=0;return l;function l(S){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(S),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),h}function h(S){return cn(S)?(e.consume(S),m):S===64?i(S):f(S)}function m(S){return S===43||S===45||S===46||sn(S)?(s=1,o(S)):f(S)}function o(S){return S===58?(e.consume(S),s=0,d):(S===43||S===45||S===46||sn(S))&&s++<32?(e.consume(S),o):(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||kl(S)?i(S):(e.consume(S),d)}function f(S){return S===64?(e.consume(S),g):u2(S)?(e.consume(S),f):i(S)}function g(S){return sn(S)?p(S):i(S)}function p(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):v(S)}function v(S){if((S===45||sn(S))&&s++<63){const E=S===45?v:p;return e.consume(S),E}return i(S)}}const Va={partial:!0,tokenize:S2};function S2(e,r,i){return s;function s(h){return Xe(h)?rt(e,l,"linePrefix")(h):l(h)}function l(h){return h===null||Me(h)?r(h):i(h)}}const E0={continuation:{tokenize:C2},exit:k2,name:"blockQuote",tokenize:w2};function w2(e,r,i){const s=this;return l;function l(m){if(m===62){const o=s.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(m),e.exit("blockQuoteMarker"),h}return i(m)}function h(m){return Xe(m)?(e.enter("blockQuotePrefixWhitespace"),e.consume(m),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(m))}}function C2(e,r,i){const s=this;return l;function l(m){return Xe(m)?rt(e,h,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):h(m)}function h(m){return e.attempt(E0,r,i)(m)}}function k2(e){e.exit("blockQuote")}const j0={name:"characterEscape",tokenize:E2};function E2(e,r,i){return s;function s(h){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(h),e.exit("escapeMarker"),l}function l(h){return h2(h)?(e.enter("characterEscapeValue"),e.consume(h),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(h)}}const N0={name:"characterReference",tokenize:j2};function j2(e,r,i){const s=this;let l=0,h,m;return o;function o(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),d}function d(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),h=31,m=sn,g(p))}function f(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),h=6,m=d2,g):(e.enter("characterReferenceValue"),h=7,m=Gd,g(p))}function g(p){if(p===59&&l){const v=e.exit("characterReferenceValue");return m===sn&&!Pa(s.sliceSerialize(v))?i(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return m(p)&&l++<h?(e.consume(p),g):i(p)}}const Kx={partial:!0,tokenize:T2},Xx={concrete:!0,name:"codeFenced",tokenize:N2};function N2(e,r,i){const s=this,l={partial:!0,tokenize:A};let h=0,m=0,o;return d;function d(N){return f(N)}function f(N){const R=s.events[s.events.length-1];return h=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,o=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===o?(m++,e.consume(N),g):m<3?i(N):(e.exit("codeFencedFenceSequence"),Xe(N)?rt(e,p,"whitespace")(N):p(N))}function p(N){return N===null||Me(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(Kx,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(N)):Xe(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),rt(e,S,"whitespace")(N)):N===96&&N===o?i(N):(e.consume(N),v)}function S(N){return N===null||Me(N)?p(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(N))}function E(N){return N===null||Me(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(N)):N===96&&N===o?i(N):(e.consume(N),E)}function C(N){return e.attempt(l,j,b)(N)}function b(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),_}function _(N){return h>0&&Xe(N)?rt(e,x,"linePrefix",h+1)(N):x(N)}function x(N){return N===null||Me(N)?e.check(Kx,C,j)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||Me(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),y)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,R,T){let B=0;return H;function H(W){return N.enter("lineEnding"),N.consume(W),N.exit("lineEnding"),G}function G(W){return N.enter("codeFencedFence"),Xe(W)?rt(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):Y(W)}function Y(W){return W===o?(N.enter("codeFencedFenceSequence"),q(W)):T(W)}function q(W){return W===o?(B++,N.consume(W),q):B>=m?(N.exit("codeFencedFenceSequence"),Xe(W)?rt(N,O,"whitespace")(W):O(W)):T(W)}function O(W){return W===null||Me(W)?(N.exit("codeFencedFence"),R(W)):T(W)}}}function T2(e,r,i){const s=this;return l;function l(m){return m===null?i(m):(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h)}function h(m){return s.parser.lazy[s.now().line]?i(m):r(m)}}const _d={name:"codeIndented",tokenize:D2},A2={partial:!0,tokenize:R2};function D2(e,r,i){const s=this;return l;function l(f){return e.enter("codeIndented"),rt(e,h,"linePrefix",5)(f)}function h(f){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?m(f):i(f)}function m(f){return f===null?d(f):Me(f)?e.attempt(A2,m,d)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Me(f)?(e.exit("codeFlowValue"),m(f)):(e.consume(f),o)}function d(f){return e.exit("codeIndented"),r(f)}}function R2(e,r,i){const s=this;return l;function l(m){return s.parser.lazy[s.now().line]?i(m):Me(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):rt(e,h,"linePrefix",5)(m)}function h(m){const o=s.events[s.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(m):Me(m)?l(m):i(m)}}const L2={name:"codeText",previous:O2,resolve:M2,tokenize:I2};function M2(e){let r=e.length-4,i=3,s,l;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;)l===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(l=s):(s===r||e[s][1].type==="lineEnding")&&(e[l][1].type="codeTextData",s!==l+2&&(e[l][1].end=e[s-1][1].end,e.splice(l+2,s-l-2),r-=s-l-2,s=l+2),l=void 0);return e}function O2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function I2(e,r,i){let s=0,l,h;return m;function m(p){return e.enter("codeText"),e.enter("codeTextSequence"),o(p)}function o(p){return p===96?(e.consume(p),s++,o):(e.exit("codeTextSequence"),d(p))}function d(p){return p===null?i(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),d):p===96?(h=e.enter("codeTextSequence"),l=0,g(p)):Me(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(p))}function f(p){return p===null||p===32||p===96||Me(p)?(e.exit("codeTextData"),d(p)):(e.consume(p),f)}function g(p){return p===96?(e.consume(p),l++,g):l===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(p)):(h.type="codeTextData",f(p))}}class B2{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 l=i||0;this.setCursor(Math.trunc(r));const h=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return s&&Aa(this.left,s),h.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),Aa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Aa(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);Aa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Aa(this.left,i.reverse())}}}function Aa(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 T0(e){const r={};let i=-1,s,l,h,m,o,d,f;const g=new B2(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,h=0,h<d.length&&d[h][1].type==="lineEndingBlank"&&(h+=2),h<d.length&&d[h][1].type==="content"))for(;++h<d.length&&d[h][1].type!=="content";)d[h][1].type==="chunkText"&&(d[h][1]._isInFirstContentOfListItem=!0,h++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,z2(g,i)),i=r[i],f=!0);else if(s[1]._container){for(h=i,l=void 0;h--;)if(m=g.get(h),m[1].type==="lineEnding"||m[1].type==="lineEndingBlank")m[0]==="enter"&&(l&&(g.get(l)[1].type="lineEndingBlank"),m[1].type="lineEnding",l=h);else if(!(m[1].type==="linePrefix"||m[1].type==="listItemIndent"))break;l&&(s[1].end={...g.get(l)[1].start},o=g.slice(l,i),o.unshift(s),g.splice(l,i-l+1,o))}}return Dn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!f}function z2(e,r){const i=e.get(r)[1],s=e.get(r)[2];let l=r-1;const h=[];let m=i._tokenizer;m||(m=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(m._contentTypeTextTrailing=!0));const o=m.events,d=[],f={};let g,p,v=-1,S=i,E=0,C=0;const b=[C];for(;S;){for(;e.get(++l)[1]!==S;);h.push(l),S._tokenizer||(g=s.sliceStream(S),S.next||g.push(null),p&&m.defineSkip(S.start),S._isInFirstContentOfListItem&&(m._gfmTasklistFirstContentOfListItem=!0),m.write(g),S._isInFirstContentOfListItem&&(m._gfmTasklistFirstContentOfListItem=void 0)),p=S,S=S.next}for(S=i;++v<o.length;)o[v][0]==="exit"&&o[v-1][0]==="enter"&&o[v][1].type===o[v-1][1].type&&o[v][1].start.line!==o[v][1].end.line&&(C=v+1,b.push(C),S._tokenizer=void 0,S.previous=void 0,S=S.next);for(m.events=[],S?(S._tokenizer=void 0,S.previous=void 0):b.pop(),v=b.length;v--;){const _=o.slice(b[v],b[v+1]),x=h.pop();d.push([x,x+_.length-1]),e.splice(x,2,_)}for(d.reverse(),v=-1;++v<d.length;)f[E+d[v][0]]=E+d[v][1],E+=d[v][1]-d[v][0]-1;return f}const H2={resolve:F2,tokenize:U2},P2={partial:!0,tokenize:$2};function F2(e){return T0(e),e}function U2(e,r){let i;return s;function s(o){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),l(o)}function l(o){return o===null?h(o):Me(o)?e.check(P2,m,h)(o):(e.consume(o),l)}function h(o){return e.exit("chunkContent"),e.exit("content"),r(o)}function m(o){return e.consume(o),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,l}}function $2(e,r,i){const s=this;return l;function l(m){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),rt(e,h,"linePrefix")}function h(m){if(m===null||Me(m))return i(m);const o=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?r(m):e.interrupt(s.parser.constructs.flow,i,r)(m)}}function A0(e,r,i,s,l,h,m,o,d){const f=d||Number.POSITIVE_INFINITY;let g=0;return p;function p(_){return _===60?(e.enter(s),e.enter(l),e.enter(h),e.consume(_),e.exit(h),v):_===null||_===32||_===41||kl(_)?i(_):(e.enter(s),e.enter(m),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(_))}function v(_){return _===62?(e.enter(h),e.consume(_),e.exit(h),e.exit(l),e.exit(s),r):(e.enter(o),e.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===62?(e.exit("chunkString"),e.exit(o),v(_)):_===null||_===60||Me(_)?i(_):(e.consume(_),_===92?E:S)}function E(_){return _===60||_===62||_===92?(e.consume(_),S):S(_)}function C(_){return!g&&(_===null||_===41||yt(_))?(e.exit("chunkString"),e.exit(o),e.exit(m),e.exit(s),r(_)):g<f&&_===40?(e.consume(_),g++,C):_===41?(e.consume(_),g--,C):_===null||_===32||_===40||kl(_)?i(_):(e.consume(_),_===92?b:C)}function b(_){return _===40||_===41||_===92?(e.consume(_),C):C(_)}}function D0(e,r,i,s,l,h){const m=this;let o=0,d;return f;function f(S){return e.enter(s),e.enter(l),e.consume(S),e.exit(l),e.enter(h),g}function g(S){return o>999||S===null||S===91||S===93&&!d||S===94&&!o&&"_hiddenFootnoteSupport"in m.parser.constructs?i(S):S===93?(e.exit(h),e.enter(l),e.consume(S),e.exit(l),e.exit(s),r):Me(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),p(S))}function p(S){return S===null||S===91||S===93||Me(S)||o++>999?(e.exit("chunkString"),g(S)):(e.consume(S),d||(d=!Xe(S)),S===92?v:p)}function v(S){return S===91||S===92||S===93?(e.consume(S),o++,p):p(S)}}function R0(e,r,i,s,l,h){let m;return o;function o(v){return v===34||v===39||v===40?(e.enter(s),e.enter(l),e.consume(v),e.exit(l),m=v===40?41:v,d):i(v)}function d(v){return v===m?(e.enter(l),e.consume(v),e.exit(l),e.exit(s),r):(e.enter(h),f(v))}function f(v){return v===m?(e.exit(h),d(m)):v===null?i(v):Me(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),rt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===m||v===null||Me(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?p:g)}function p(v){return v===m||v===92?(e.consume(v),g):g(v)}}function Oa(e,r){let i;return s;function s(l){return Me(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,s):Xe(l)?rt(e,s,i?"linePrefix":"lineSuffix")(l):r(l)}}const q2={name:"definition",tokenize:G2},W2={partial:!0,tokenize:V2};function G2(e,r,i){const s=this;let l;return h;function h(S){return e.enter("definition"),m(S)}function m(S){return D0.call(s,e,o,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(S)}function o(S){return l=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 yt(S)?Oa(e,f)(S):f(S)}function f(S){return A0(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(S)}function g(S){return e.attempt(W2,p,p)(S)}function p(S){return Xe(S)?rt(e,v,"whitespace")(S):v(S)}function v(S){return S===null||Me(S)?(e.exit("definition"),s.parser.defined.push(l),r(S)):i(S)}}function V2(e,r,i){return s;function s(o){return yt(o)?Oa(e,l)(o):i(o)}function l(o){return R0(e,h,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function h(o){return Xe(o)?rt(e,m,"whitespace")(o):m(o)}function m(o){return o===null||Me(o)?r(o):i(o)}}const Y2={name:"hardBreakEscape",tokenize:K2};function K2(e,r,i){return s;function s(h){return e.enter("hardBreakEscape"),e.consume(h),l}function l(h){return Me(h)?(e.exit("hardBreakEscape"),r(h)):i(h)}}const X2={name:"headingAtx",resolve:Z2,tokenize:Q2};function Z2(e,r){let i=e.length-2,s=3,l,h;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&&(l={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},h={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Dn(e,s,i-s+1,[["enter",l,r],["enter",h,r],["exit",h,r],["exit",l,r]])),e}function Q2(e,r,i){let s=0;return l;function l(g){return e.enter("atxHeading"),h(g)}function h(g){return e.enter("atxHeadingSequence"),m(g)}function m(g){return g===35&&s++<6?(e.consume(g),m):g===null||yt(g)?(e.exit("atxHeadingSequence"),o(g)):i(g)}function o(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||Me(g)?(e.exit("atxHeading"),r(g)):Xe(g)?rt(e,o,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),o(g))}function f(g){return g===null||g===35||yt(g)?(e.exit("atxHeadingText"),o(g)):(e.consume(g),f)}}const J2=["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"],Zx=["pre","script","style","textarea"],eC={concrete:!0,name:"htmlFlow",resolveTo:rC,tokenize:iC},tC={partial:!0,tokenize:aC},nC={partial:!0,tokenize:sC};function rC(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 iC(e,r,i){const s=this;let l,h,m,o,d;return f;function f(P){return g(P)}function g(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),p}function p(P){return P===33?(e.consume(P),v):P===47?(e.consume(P),h=!0,C):P===63?(e.consume(P),l=3,s.interrupt?r:D):cn(P)?(e.consume(P),m=String.fromCharCode(P),b):i(P)}function v(P){return P===45?(e.consume(P),l=2,S):P===91?(e.consume(P),l=5,o=0,E):cn(P)?(e.consume(P),l=4,s.interrupt?r:D):i(P)}function S(P){return P===45?(e.consume(P),s.interrupt?r:D):i(P)}function E(P){const K="CDATA[";return P===K.charCodeAt(o++)?(e.consume(P),o===K.length?s.interrupt?r:Y:E):i(P)}function C(P){return cn(P)?(e.consume(P),m=String.fromCharCode(P),b):i(P)}function b(P){if(P===null||P===47||P===62||yt(P)){const K=P===47,te=m.toLowerCase();return!K&&!h&&Zx.includes(te)?(l=1,s.interrupt?r(P):Y(P)):J2.includes(m.toLowerCase())?(l=6,K?(e.consume(P),_):s.interrupt?r(P):Y(P)):(l=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(P):h?x(P):y(P))}return P===45||sn(P)?(e.consume(P),m+=String.fromCharCode(P),b):i(P)}function _(P){return P===62?(e.consume(P),s.interrupt?r:Y):i(P)}function x(P){return Xe(P)?(e.consume(P),x):H(P)}function y(P){return P===47?(e.consume(P),H):P===58||P===95||cn(P)?(e.consume(P),j):Xe(P)?(e.consume(P),y):H(P)}function j(P){return P===45||P===46||P===58||P===95||sn(P)?(e.consume(P),j):A(P)}function A(P){return P===61?(e.consume(P),N):Xe(P)?(e.consume(P),A):y(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?i(P):P===34||P===39?(e.consume(P),d=P,R):Xe(P)?(e.consume(P),N):T(P)}function R(P){return P===d?(e.consume(P),d=null,B):P===null||Me(P)?i(P):(e.consume(P),R)}function T(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||yt(P)?A(P):(e.consume(P),T)}function B(P){return P===47||P===62||Xe(P)?y(P):i(P)}function H(P){return P===62?(e.consume(P),G):i(P)}function G(P){return P===null||Me(P)?Y(P):Xe(P)?(e.consume(P),G):i(P)}function Y(P){return P===45&&l===2?(e.consume(P),V):P===60&&l===1?(e.consume(P),Q):P===62&&l===4?(e.consume(P),I):P===63&&l===3?(e.consume(P),D):P===93&&l===5?(e.consume(P),L):Me(P)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(tC,U,q)(P)):P===null||Me(P)?(e.exit("htmlFlowData"),q(P)):(e.consume(P),Y)}function q(P){return e.check(nC,O,U)(P)}function O(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),W}function W(P){return P===null||Me(P)?q(P):(e.enter("htmlFlowData"),Y(P))}function V(P){return P===45?(e.consume(P),D):Y(P)}function Q(P){return P===47?(e.consume(P),m="",ee):Y(P)}function ee(P){if(P===62){const K=m.toLowerCase();return Zx.includes(K)?(e.consume(P),I):Y(P)}return cn(P)&&m.length<8?(e.consume(P),m+=String.fromCharCode(P),ee):Y(P)}function L(P){return P===93?(e.consume(P),D):Y(P)}function D(P){return P===62?(e.consume(P),I):P===45&&l===2?(e.consume(P),D):Y(P)}function I(P){return P===null||Me(P)?(e.exit("htmlFlowData"),U(P)):(e.consume(P),I)}function U(P){return e.exit("htmlFlow"),r(P)}}function sC(e,r,i){const s=this;return l;function l(m){return Me(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),h):i(m)}function h(m){return s.parser.lazy[s.now().line]?i(m):r(m)}}function aC(e,r,i){return s;function s(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(Va,r,i)}}const oC={name:"htmlText",tokenize:lC};function lC(e,r,i){const s=this;let l,h,m;return o;function o(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),y):cn(D)?(e.consume(D),T):i(D)}function f(D){return D===45?(e.consume(D),g):D===91?(e.consume(D),h=0,E):cn(D)?(e.consume(D),x):i(D)}function g(D){return D===45?(e.consume(D),S):i(D)}function p(D){return D===null?i(D):D===45?(e.consume(D),v):Me(D)?(m=p,Q(D)):(e.consume(D),p)}function v(D){return D===45?(e.consume(D),S):p(D)}function S(D){return D===62?V(D):D===45?v(D):p(D)}function E(D){const I="CDATA[";return D===I.charCodeAt(h++)?(e.consume(D),h===I.length?C:E):i(D)}function C(D){return D===null?i(D):D===93?(e.consume(D),b):Me(D)?(m=C,Q(D)):(e.consume(D),C)}function b(D){return D===93?(e.consume(D),_):C(D)}function _(D){return D===62?V(D):D===93?(e.consume(D),_):C(D)}function x(D){return D===null||D===62?V(D):Me(D)?(m=x,Q(D)):(e.consume(D),x)}function y(D){return D===null?i(D):D===63?(e.consume(D),j):Me(D)?(m=y,Q(D)):(e.consume(D),y)}function j(D){return D===62?V(D):y(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)?(m=R,Q(D)):Xe(D)?(e.consume(D),R):V(D)}function T(D){return D===45||sn(D)?(e.consume(D),T):D===47||D===62||yt(D)?B(D):i(D)}function B(D){return D===47?(e.consume(D),V):D===58||D===95||cn(D)?(e.consume(D),H):Me(D)?(m=B,Q(D)):Xe(D)?(e.consume(D),B):V(D)}function H(D){return D===45||D===46||D===58||D===95||sn(D)?(e.consume(D),H):G(D)}function G(D){return D===61?(e.consume(D),Y):Me(D)?(m=G,Q(D)):Xe(D)?(e.consume(D),G):B(D)}function Y(D){return D===null||D===60||D===61||D===62||D===96?i(D):D===34||D===39?(e.consume(D),l=D,q):Me(D)?(m=Y,Q(D)):Xe(D)?(e.consume(D),Y):(e.consume(D),O)}function q(D){return D===l?(e.consume(D),l=void 0,W):D===null?i(D):Me(D)?(m=q,Q(D)):(e.consume(D),q)}function O(D){return D===null||D===34||D===39||D===60||D===61||D===96?i(D):D===47||D===62||yt(D)?B(D):(e.consume(D),O)}function W(D){return D===47||D===62||yt(D)?B(D):i(D)}function V(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),r):i(D)}function Q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ee}function ee(D){return Xe(D)?rt(e,L,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):L(D)}function L(D){return e.enter("htmlTextData"),m(D)}}const vh={name:"labelEnd",resolveAll:hC,resolveTo:fC,tokenize:pC},cC={tokenize:mC},uC={tokenize:gC},dC={tokenize:xC};function hC(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 l=s.type==="labelImage"?4:2;s.type="data",r+=l}}return e.length!==i.length&&Dn(e,0,e.length,i),e}function fC(e,r){let i=e.length,s=0,l,h,m,o;for(;i--;)if(l=e[i][1],h){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[i][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(m){if(e[i][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(h=i,l.type!=="labelLink")){s=2;break}}else l.type==="labelEnd"&&(m=i);const d={type:e[h][1].type==="labelLink"?"link":"image",start:{...e[h][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[h][1].start},end:{...e[m][1].end}},g={type:"labelText",start:{...e[h+s+2][1].end},end:{...e[m-2][1].start}};return o=[["enter",d,r],["enter",f,r]],o=$n(o,e.slice(h+1,h+s+3)),o=$n(o,[["enter",g,r]]),o=$n(o,Il(r.parser.constructs.insideSpan.null,e.slice(h+s+4,m-3),r)),o=$n(o,[["exit",g,r],e[m-2],e[m-1],["exit",f,r]]),o=$n(o,e.slice(m+1)),o=$n(o,[["exit",d,r]]),Dn(e,h,e.length,o),e}function pC(e,r,i){const s=this;let l=s.events.length,h,m;for(;l--;)if((s.events[l][1].type==="labelImage"||s.events[l][1].type==="labelLink")&&!s.events[l][1]._balanced){h=s.events[l][1];break}return o;function o(v){return h?h._inactive?p(v):(m=s.parser.defined.includes(Kn(s.sliceSerialize({start:h.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):i(v)}function d(v){return v===40?e.attempt(cC,g,m?g:p)(v):v===91?e.attempt(uC,g,m?f:p)(v):m?g(v):p(v)}function f(v){return e.attempt(dC,g,p)(v)}function g(v){return r(v)}function p(v){return h._balanced=!0,i(v)}}function mC(e,r,i){return s;function s(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),l}function l(p){return yt(p)?Oa(e,h)(p):h(p)}function h(p){return p===41?g(p):A0(e,m,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function m(p){return yt(p)?Oa(e,d)(p):g(p)}function o(p){return i(p)}function d(p){return p===34||p===39||p===40?R0(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):g(p)}function f(p){return yt(p)?Oa(e,g)(p):g(p)}function g(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),r):i(p)}}function gC(e,r,i){const s=this;return l;function l(o){return D0.call(s,e,h,m,"reference","referenceMarker","referenceString")(o)}function h(o){return s.parser.defined.includes(Kn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(o):i(o)}function m(o){return i(o)}}function xC(e,r,i){return s;function s(h){return e.enter("reference"),e.enter("referenceMarker"),e.consume(h),e.exit("referenceMarker"),l}function l(h){return h===93?(e.enter("referenceMarker"),e.consume(h),e.exit("referenceMarker"),e.exit("reference"),r):i(h)}}const vC={name:"labelStartImage",resolveAll:vh.resolveAll,tokenize:bC};function bC(e,r,i){const s=this;return l;function l(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),h}function h(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),m):i(o)}function m(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(o):r(o)}}const yC={name:"labelStartLink",resolveAll:vh.resolveAll,tokenize:_C};function _C(e,r,i){const s=this;return l;function l(m){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelLink"),h}function h(m){return m===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(m):r(m)}}const Sd={name:"lineEnding",tokenize:SC};function SC(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),rt(e,r,"linePrefix")}}const bl={name:"thematicBreak",tokenize:wC};function wC(e,r,i){let s=0,l;return h;function h(f){return e.enter("thematicBreak"),m(f)}function m(f){return l=f,o(f)}function o(f){return f===l?(e.enter("thematicBreakSequence"),d(f)):s>=3&&(f===null||Me(f))?(e.exit("thematicBreak"),r(f)):i(f)}function d(f){return f===l?(e.consume(f),s++,d):(e.exit("thematicBreakSequence"),Xe(f)?rt(e,o,"whitespace")(f):o(f))}}const vn={continuation:{tokenize:jC},exit:TC,name:"list",tokenize:EC},CC={partial:!0,tokenize:AC},kC={partial:!0,tokenize:NC};function EC(e,r,i){const s=this,l=s.events[s.events.length-1];let h=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,m=0;return o;function o(S){const E=s.containerState.type||(S===42||S===43||S===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||S===s.containerState.marker:Gd(S)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),S===42||S===45?e.check(bl,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 Gd(S)&&++m<10?(e.consume(S),d):(!s.interrupt||m<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(Va,s.interrupt?i:g,e.attempt(CC,v,p))}function g(S){return s.containerState.initialBlankLine=!0,h++,v(S)}function p(S){return Xe(S)?(e.enter("listItemPrefixWhitespace"),e.consume(S),e.exit("listItemPrefixWhitespace"),v):i(S)}function v(S){return s.containerState.size=h+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(S)}}function jC(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(Va,l,h);function l(o){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,rt(e,r,"listItemIndent",s.containerState.size+1)(o)}function h(o){return s.containerState.furtherBlankLines||!Xe(o)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,m(o)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(kC,r,m)(o))}function m(o){return s.containerState._closeFlow=!0,s.interrupt=void 0,rt(e,e.attempt(vn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function NC(e,r,i){const s=this;return rt(e,l,"listItemIndent",s.containerState.size+1);function l(h){const m=s.events[s.events.length-1];return m&&m[1].type==="listItemIndent"&&m[2].sliceSerialize(m[1],!0).length===s.containerState.size?r(h):i(h)}}function TC(e){e.exit(this.containerState.type)}function AC(e,r,i){const s=this;return rt(e,l,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(h){const m=s.events[s.events.length-1];return!Xe(h)&&m&&m[1].type==="listItemPrefixWhitespace"?r(h):i(h)}}const Qx={name:"setextUnderline",resolveTo:DC,tokenize:RC};function DC(e,r){let i=e.length,s,l,h;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(l=i)}else e[i][1].type==="content"&&e.splice(i,1),!h&&e[i][1].type==="definition"&&(h=i);const m={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",h?(e.splice(l,0,["enter",m,r]),e.splice(h+1,0,["exit",e[s][1],r]),e[s][1].end={...e[h][1].end}):e[s][1]=m,e.push(["exit",m,r]),e}function RC(e,r,i){const s=this;let l;return h;function h(f){let g=s.events.length,p;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){p=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||p)?(e.enter("setextHeadingLine"),l=f,m(f)):i(f)}function m(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===l?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),Xe(f)?rt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Me(f)?(e.exit("setextHeadingLine"),r(f)):i(f)}}const LC={tokenize:MC};function MC(e){const r=this,i=e.attempt(Va,s,e.attempt(this.parser.constructs.flowInitial,l,rt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(H2,l)),"linePrefix")));return i;function s(h){if(h===null){e.consume(h);return}return e.enter("lineEndingBlank"),e.consume(h),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function l(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const OC={resolveAll:M0()},IC=L0("string"),BC=L0("text");function L0(e){return{resolveAll:M0(e==="text"?zC:void 0),tokenize:r};function r(i){const s=this,l=this.parser.constructs[e],h=i.attempt(l,m,o);return m;function m(g){return f(g)?h(g):o(g)}function o(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"),h(g)):(i.consume(g),d)}function f(g){if(g===null)return!0;const p=l[g];let v=-1;if(p)for(;++v<p.length;){const S=p[v];if(!S.previous||S.previous.call(s,s.previous))return!0}return!1}}}function M0(e){return r;function r(i,s){let l=-1,h;for(;++l<=i.length;)h===void 0?i[l]&&i[l][1].type==="data"&&(h=l,l++):(!i[l]||i[l][1].type!=="data")&&(l!==h+2&&(i[h][1].end=i[l-1][1].end,i.splice(h+2,l-h-2),l=h+2),h=void 0);return e?e(i,s):i}}function zC(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],l=r.sliceStream(s);let h=l.length,m=-1,o=0,d;for(;h--;){const f=l[h];if(typeof f=="string"){for(m=f.length;f.charCodeAt(m-1)===32;)o++,m--;if(m)break;m=-1}else if(f===-2)d=!0,o++;else if(f!==-1){h++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(o=0),o){const f={type:i===e.length||d||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:h?m:s.start._bufferIndex+m,_index:s.start._index+h,line:s.end.line,column:s.end.column-o,offset:s.end.offset-o},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 HC={42:vn,43:vn,45:vn,48:vn,49:vn,50:vn,51:vn,52:vn,53:vn,54:vn,55:vn,56:vn,57:vn,62:E0},PC={91:q2},FC={[-2]:_d,[-1]:_d,32:_d},UC={35:X2,42:bl,45:[Qx,bl],60:eC,61:Qx,95:bl,96:Xx,126:Xx},$C={38:N0,92:j0},qC={[-5]:Sd,[-4]:Sd,[-3]:Sd,33:vC,38:N0,42:Vd,60:[y2,oC],91:yC,92:[Y2,j0],93:vh,95:Vd,96:L2},WC={null:[Vd,OC]},GC={null:[42,95]},VC={null:[]},YC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:GC,contentInitial:PC,disable:VC,document:HC,flow:UC,flowInitial:FC,insideSpan:WC,string:$C,text:qC},Symbol.toStringTag,{value:"Module"}));function KC(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 l={},h=[];let m=[],o=[];const d={attempt:R(A),check:R(N),consume:x,enter:y,exit:j,interrupt:R(N,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:E,parser:e,previous:null,sliceSerialize:v,sliceStream:S,write:p};let g=r.tokenize.call(f,d);return r.resolveAll&&h.push(r),f;function p(G){return m=$n(m,G),b(),m[m.length-1]!==null?[]:(T(r,0),f.events=Il(h,f.events,f),f.events)}function v(G,Y){return ZC(S(G),Y)}function S(G){return XC(m,G)}function E(){const{_bufferIndex:G,_index:Y,line:q,column:O,offset:W}=s;return{_bufferIndex:G,_index:Y,line:q,column:O,offset:W}}function C(G){l[G.line]=G.column,H()}function b(){let G;for(;s._index<m.length;){const Y=m[s._index];if(typeof Y=="string")for(G=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===G&&s._bufferIndex<Y.length;)_(Y.charCodeAt(s._bufferIndex));else _(Y)}}function _(G){g=g(G)}function x(G){Me(G)?(s.line++,s.column=1,s.offset+=G===-3?2:1,H()):G!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===m[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=G}function y(G,Y){const q=Y||{};return q.type=G,q.start=E(),f.events.push(["enter",q,f]),o.push(q),q}function j(G){const Y=o.pop();return Y.end=E(),f.events.push(["exit",Y,f]),Y}function A(G,Y){T(G,Y.from)}function N(G,Y){Y.restore()}function R(G,Y){return q;function q(O,W,V){let Q,ee,L,D;return Array.isArray(O)?U(O):"tokenize"in O?U([O]):I(O);function I(Z){return X;function X(z){const ae=z!==null&&Z[z],se=z!==null&&Z.null,ge=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(se)?se:se?[se]:[]];return U(ge)(z)}}function U(Z){return Q=Z,ee=0,Z.length===0?V:P(Z[ee])}function P(Z){return X;function X(z){return D=B(),L=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?te():Z.tokenize.call(Y?Object.assign(Object.create(f),Y):f,d,K,te)(z)}}function K(Z){return G(L,D),W}function te(Z){return D.restore(),++ee<Q.length?P(Q[ee]):V}}}function T(G,Y){G.resolveAll&&!h.includes(G)&&h.push(G),G.resolve&&Dn(f.events,Y,f.events.length-Y,G.resolve(f.events.slice(Y),f)),G.resolveTo&&(f.events=G.resolveTo(f.events,f))}function B(){const G=E(),Y=f.previous,q=f.currentConstruct,O=f.events.length,W=Array.from(o);return{from:O,restore:V};function V(){s=G,f.previous=Y,f.currentConstruct=q,f.events.length=O,o=W,H()}}function H(){s.line in l&&s.column<2&&(s.column=l[s.line],s.offset+=l[s.line]-1)}}function XC(e,r){const i=r.start._index,s=r.start._bufferIndex,l=r.end._index,h=r.end._bufferIndex;let m;if(i===l)m=[e[i].slice(s,h)];else{if(m=e.slice(i,l),s>-1){const o=m[0];typeof o=="string"?m[0]=o.slice(s):m.shift()}h>0&&m.push(e[l].slice(0,h))}return m}function ZC(e,r){let i=-1;const s=[];let l;for(;++i<e.length;){const h=e[i];let m;if(typeof h=="string")m=h;else switch(h){case-5:{m="\r";break}case-4:{m=`
|
|
92
|
-
`;break}case-3:{m=`\r
|
|
93
|
-
`;break}case-2:{m=r?" ":" ";break}case-1:{if(!r&&l)continue;m=" ";break}default:m=String.fromCharCode(h)}l=h===-2,s.push(m)}return s.join("")}function QC(e){const s={constructs:C0([YC,...(e||{}).extensions||[]]),content:l(f2),defined:[],document:l(m2),flow:l(LC),lazy:{},string:l(IC),text:l(BC)};return s;function l(h){return m;function m(o){return KC(s,h,o)}}}function JC(e){for(;!T0(e););return e}const Jx=/[\0\t\n\r]/g;function ek(){let e=1,r="",i=!0,s;return l;function l(h,m,o){const d=[];let f,g,p,v,S;for(h=r+(typeof h=="string"?h.toString():new TextDecoder(m||void 0).decode(h)),p=0,r="",i&&(h.charCodeAt(0)===65279&&p++,i=void 0);p<h.length;){if(Jx.lastIndex=p,f=Jx.exec(h),v=f&&f.index!==void 0?f.index:h.length,S=h.charCodeAt(v),!f){r=h.slice(p);break}if(S===10&&p===v&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),p<v&&(d.push(h.slice(p,v)),e+=v-p),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}p=v+1}return o&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const tk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nk(e){return e.replace(tk,rk)}function rk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),h=l===120||l===88;return k0(i.slice(h?2:1),h?16:10)}return Pa(i)||e}const O0={}.hasOwnProperty;function ik(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),sk(i)(JC(QC(i).document().write(ek()(e,r,!0))))}function sk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:h(dt),autolinkProtocol:B,autolinkEmail:B,atxHeading:h(Oe),blockQuote:h(se),characterEscape:B,characterReference:B,codeFenced:h(ge),codeFencedFenceInfo:m,codeFencedFenceMeta:m,codeIndented:h(ge,m),codeText:h(ve,m),codeTextData:B,data:B,codeFlowValue:B,definition:h(Ne),definitionDestinationString:m,definitionLabelString:m,definitionTitleString:m,emphasis:h(De),hardBreakEscape:h(Fe),hardBreakTrailing:h(Fe),htmlFlow:h(ke,m),htmlFlowData:B,htmlText:h(ke,m),htmlTextData:B,image:h(lt),label:m,link:h(dt),listItem:h(Le),listItemValue:v,listOrdered:h(fe,p),listUnordered:h(fe),paragraph:h(Je),reference:P,referenceString:m,resourceDestinationString:m,resourceTitleString:m,setextHeading:h(Oe),strong:h(et),thematicBreak:h(ct)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:z,blockQuote:d(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:Z,characterReference:X,codeFenced:d(b),codeFencedFence:C,codeFencedFenceInfo:S,codeFencedFenceMeta:E,codeFlowValue:H,codeIndented:d(_),codeText:d(W),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:y,emphasis:d(),hardBreakEscape:d(Y),hardBreakTrailing:d(Y),htmlFlow:d(q),htmlFlowData:H,htmlText:d(O),htmlTextData:H,image:d(Q),label:L,labelText:ee,lineEnding:G,link:d(V),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:K,resourceDestinationString:D,resourceTitleString:I,resource:U,setextHeading:d(T),setextHeadingLineSequence:R,setextHeadingText:N,strong:d(),thematicBreak:d()}};I0(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(de){let be={type:"root",children:[]};const re={stack:[be],tokenStack:[],config:r,enter:o,exit:f,buffer:m,resume:g,data:i},_e=[];let Ce=-1;for(;++Ce<de.length;)if(de[Ce][1].type==="listOrdered"||de[Ce][1].type==="listUnordered")if(de[Ce][0]==="enter")_e.push(Ce);else{const He=_e.pop();Ce=l(de,He,Ce)}for(Ce=-1;++Ce<de.length;){const He=r[de[Ce][0]];O0.call(He,de[Ce][1].type)&&He[de[Ce][1].type].call(Object.assign({sliceSerialize:de[Ce][2].sliceSerialize},re),de[Ce][1])}if(re.tokenStack.length>0){const He=re.tokenStack[re.tokenStack.length-1];(He[1]||ev).call(re,void 0,He[0])}for(be.position={start:Qr(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:Qr(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<r.transforms.length;)be=r.transforms[Ce](be)||be;return be}function l(de,be,re){let _e=be-1,Ce=-1,He=!1,Ae,st,it,Ct;for(;++_e<=re;){const $e=de[_e];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?Ce++:Ce--,Ct=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(Ae&&!Ct&&!Ce&&!it&&(it=_e),Ct=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ct=void 0}if(!Ce&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||Ce===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(Ae){let Rn=_e;for(st=void 0;Rn--;){const pe=de[Rn];if(pe[1].type==="lineEnding"||pe[1].type==="lineEndingBlank"){if(pe[0]==="exit")continue;st&&(de[st][1].type="lineEndingBlank",He=!0),pe[1].type="lineEnding",st=Rn}else if(!(pe[1].type==="linePrefix"||pe[1].type==="blockQuotePrefix"||pe[1].type==="blockQuotePrefixWhitespace"||pe[1].type==="blockQuoteMarker"||pe[1].type==="listItemIndent"))break}it&&(!st||it<st)&&(Ae._spread=!0),Ae.end=Object.assign({},st?de[st][1].start:$e[1].end),de.splice(st||_e,0,["exit",Ae,$e[2]]),_e++,re++}if($e[1].type==="listItemPrefix"){const Rn={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};Ae=Rn,de.splice(_e,0,["enter",Rn,$e[2]]),_e++,re++,it=void 0,Ct=!0}}}return de[be][1]._spread=He,re}function h(de,be){return re;function re(_e){o.call(this,de(_e),_e),be&&be.call(this,_e)}}function m(){this.stack.push({type:"fragment",children:[]})}function o(de,be,re){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([be,re||void 0]),de.position={start:Qr(be.start),end:void 0}}function d(de){return be;function be(re){de&&de.call(this,re),f.call(this,re)}}function f(de,be){const re=this.stack.pop(),_e=this.tokenStack.pop();if(_e)_e[0].type!==de.type&&(be?be.call(this,de,_e[0]):(_e[1]||ev).call(this,de,_e[0]));else throw new Error("Cannot close `"+de.type+"` ("+Ma({start:de.start,end:de.end})+"): it’s not open");re.position.end=Qr(de.end)}function g(){return xh(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function v(de){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function S(){const de=this.resume(),be=this.stack[this.stack.length-1];be.lang=de}function E(){const de=this.resume(),be=this.stack[this.stack.length-1];be.meta=de}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de.replace(/(\r?\n|\r)$/g,"")}function x(de){const be=this.resume(),re=this.stack[this.stack.length-1];re.label=be,re.identifier=Kn(this.sliceSerialize(de)).toLowerCase()}function y(){const de=this.resume(),be=this.stack[this.stack.length-1];be.title=de}function j(){const de=this.resume(),be=this.stack[this.stack.length-1];be.url=de}function A(de){const be=this.stack[this.stack.length-1];if(!be.depth){const re=this.sliceSerialize(de).length;be.depth=re}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function R(de){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function B(de){const re=this.stack[this.stack.length-1].children;let _e=re[re.length-1];(!_e||_e.type!=="text")&&(_e=Ge(),_e.position={start:Qr(de.start),end:void 0},re.push(_e)),this.stack.push(_e)}function H(de){const be=this.stack.pop();be.value+=this.sliceSerialize(de),be.position.end=Qr(de.end)}function G(de){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=be.children[be.children.length-1];re.position.end=Qr(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(be.type)&&(B.call(this,de),H.call(this,de))}function Y(){this.data.atHardBreak=!0}function q(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function O(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function W(){const de=this.resume(),be=this.stack[this.stack.length-1];be.value=de}function V(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=be,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function Q(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=be,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function ee(de){const be=this.sliceSerialize(de),re=this.stack[this.stack.length-2];re.label=nk(be),re.identifier=Kn(be).toLowerCase()}function L(){const de=this.stack[this.stack.length-1],be=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const _e=de.children;re.children=_e}else re.alt=be}function D(){const de=this.resume(),be=this.stack[this.stack.length-1];be.url=de}function I(){const de=this.resume(),be=this.stack[this.stack.length-1];be.title=de}function U(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function K(de){const be=this.resume(),re=this.stack[this.stack.length-1];re.label=be,re.identifier=Kn(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function te(de){this.data.characterReferenceType=de.type}function Z(de){const be=this.sliceSerialize(de),re=this.data.characterReferenceType;let _e;re?(_e=k0(be,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):_e=Pa(be);const Ce=this.stack[this.stack.length-1];Ce.value+=_e}function X(de){const be=this.stack.pop();be.position.end=Qr(de.end)}function z(de){H.call(this,de);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(de)}function ae(de){H.call(this,de);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(de)}function se(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function Ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function ke(){return{type:"html",value:""}}function lt(){return{type:"image",title:null,url:"",alt:null}}function dt(){return{type:"link",title:null,url:"",children:[]}}function fe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function Le(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function et(){return{type:"strong",children:[]}}function Ge(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function Qr(e){return{line:e.line,column:e.column,offset:e.offset}}function I0(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?I0(e,s):ak(e,s)}}function ak(e,r){let i;for(i in r)if(O0.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 ev(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Ma({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Ma({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Ma({start:r.start,end:r.end})+") is still open")}function ok(e){const r=this;r.parser=i;function i(s){return ik(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function lk(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 ck(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
94
|
-
`}]}function uk(e,r){const i=r.value?r.value+`
|
|
95
|
-
`:"",s={},l=r.lang?r.lang.split(/\s+/):[];l.length>0&&(s.className=["language-"+l[0]]);let h={type:"element",tagName:"code",properties:s,children:[{type:"text",value:i}]};return r.meta&&(h.data={meta:r.meta}),e.patch(r,h),h=e.applyData(r,h),h={type:"element",tagName:"pre",properties:{},children:[h]},e.patch(r,h),h}function dk(e,r){const i={type:"element",tagName:"del",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function hk(e,r){const i={type:"element",tagName:"em",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function fk(e,r){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(r.identifier).toUpperCase(),l=As(s.toLowerCase()),h=e.footnoteOrder.indexOf(s);let m,o=e.footnoteCounts.get(s);o===void 0?(o=0,e.footnoteOrder.push(s),m=e.footnoteOrder.length):m=h+1,o+=1,e.footnoteCounts.set(s,o);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+l,id:i+"fnref-"+l+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(m)}]};e.patch(r,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(r,f),e.applyData(r,f)}function pk(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 mk(e,r){if(e.options.allowDangerousHtml){const i={type:"raw",value:r.value};return e.patch(r,i),e.applyData(r,i)}}function B0(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 l=e.all(r),h=l[0];h&&h.type==="text"?h.value="["+h.value:l.unshift({type:"text",value:"["});const m=l[l.length-1];return m&&m.type==="text"?m.value+=s:l.push({type:"text",value:s}),l}function gk(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return B0(e,r);const l={src:As(s.url||""),alt:r.alt};s.title!==null&&s.title!==void 0&&(l.title=s.title);const h={type:"element",tagName:"img",properties:l,children:[]};return e.patch(r,h),e.applyData(r,h)}function xk(e,r){const i={src:As(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 vk(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 bk(e,r){const i=String(r.identifier).toUpperCase(),s=e.definitionById.get(i);if(!s)return B0(e,r);const l={href:As(s.url||"")};s.title!==null&&s.title!==void 0&&(l.title=s.title);const h={type:"element",tagName:"a",properties:l,children:e.all(r)};return e.patch(r,h),e.applyData(r,h)}function yk(e,r){const i={href:As(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 _k(e,r,i){const s=e.all(r),l=i?Sk(i):z0(r),h={},m=[];if(typeof r.checked=="boolean"){const g=s[0];let p;g&&g.type==="element"&&g.tagName==="p"?p=g:(p={type:"element",tagName:"p",properties:{},children:[]},s.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),h.className=["task-list-item"]}let o=-1;for(;++o<s.length;){const g=s[o];(l||o!==0||g.type!=="element"||g.tagName!=="p")&&m.push({type:"text",value:`
|
|
96
|
-
`}),g.type==="element"&&g.tagName==="p"&&!l?m.push(...g.children):m.push(g)}const d=s[s.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&m.push({type:"text",value:`
|
|
97
|
-
`});const f={type:"element",tagName:"li",properties:h,children:m};return e.patch(r,f),e.applyData(r,f)}function Sk(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=z0(i[s])}return r}function z0(e){const r=e.spread;return r??e.children.length>1}function wk(e,r){const i={},s=e.all(r);let l=-1;for(typeof r.start=="number"&&r.start!==1&&(i.start=r.start);++l<s.length;){const m=s[l];if(m.type==="element"&&m.tagName==="li"&&m.properties&&Array.isArray(m.properties.className)&&m.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const h={type:"element",tagName:r.ordered?"ol":"ul",properties:i,children:e.wrap(s,!0)};return e.patch(r,h),e.applyData(r,h)}function Ck(e,r){const i={type:"element",tagName:"p",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function kk(e,r){const i={type:"root",children:e.wrap(e.all(r))};return e.patch(r,i),e.applyData(r,i)}function Ek(e,r){const i={type:"element",tagName:"strong",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}function jk(e,r){const i=e.all(r),s=i.shift(),l=[];if(s){const m={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(r.children[0],m),l.push(m)}if(i.length>0){const m={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},o=fh(r.children[1]),d=x0(r.children[r.children.length-1]);o&&d&&(m.position={start:o,end:d}),l.push(m)}const h={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(r,h),e.applyData(r,h)}function Nk(e,r,i){const s=i?i.children:void 0,h=(s?s.indexOf(r):1)===0?"th":"td",m=i&&i.type==="table"?i.align:void 0,o=m?m.length:r.children.length;let d=-1;const f=[];for(;++d<o;){const p=r.children[d],v={},S=m?m[d]:void 0;S&&(v.align=S);let E={type:"element",tagName:h,properties:v,children:[]};p&&(E.children=e.all(p),e.patch(p,E),E=e.applyData(p,E)),f.push(E)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(r,g),e.applyData(r,g)}function Tk(e,r){const i={type:"element",tagName:"td",properties:{},children:e.all(r)};return e.patch(r,i),e.applyData(r,i)}const tv=9,nv=32;function Ak(e){const r=String(e),i=/\r?\n|\r/g;let s=i.exec(r),l=0;const h=[];for(;s;)h.push(rv(r.slice(l,s.index),l>0,!0),s[0]),l=s.index+s[0].length,s=i.exec(r);return h.push(rv(r.slice(l),l>0,!1)),h.join("")}function rv(e,r,i){let s=0,l=e.length;if(r){let h=e.codePointAt(s);for(;h===tv||h===nv;)s++,h=e.codePointAt(s)}if(i){let h=e.codePointAt(l-1);for(;h===tv||h===nv;)l--,h=e.codePointAt(l-1)}return l>s?e.slice(s,l):""}function Dk(e,r){const i={type:"text",value:Ak(String(r.value))};return e.patch(r,i),e.applyData(r,i)}function Rk(e,r){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(r,i),e.applyData(r,i)}const Lk={blockquote:lk,break:ck,code:uk,delete:dk,emphasis:hk,footnoteReference:fk,heading:pk,html:mk,imageReference:gk,image:xk,inlineCode:vk,linkReference:bk,link:yk,listItem:_k,list:wk,paragraph:Ck,root:kk,strong:Ek,table:jk,tableCell:Tk,tableRow:Nk,text:Dk,thematicBreak:Rk,toml:dl,yaml:dl,definition:dl,footnoteDefinition:dl};function dl(){}const H0=-1,Bl=0,Ia=1,El=2,bh=3,yh=4,_h=5,Sh=6,P0=7,F0=8,iv=typeof self=="object"?self:globalThis,Mk=(e,r)=>{const i=(l,h)=>(e.set(h,l),l),s=l=>{if(e.has(l))return e.get(l);const[h,m]=r[l];switch(h){case Bl:case H0:return i(m,l);case Ia:{const o=i([],l);for(const d of m)o.push(s(d));return o}case El:{const o=i({},l);for(const[d,f]of m)o[s(d)]=s(f);return o}case bh:return i(new Date(m),l);case yh:{const{source:o,flags:d}=m;return i(new RegExp(o,d),l)}case _h:{const o=i(new Map,l);for(const[d,f]of m)o.set(s(d),s(f));return o}case Sh:{const o=i(new Set,l);for(const d of m)o.add(s(d));return o}case P0:{const{name:o,message:d}=m;return i(new iv[o](d),l)}case F0:return i(BigInt(m),l);case"BigInt":return i(Object(BigInt(m)),l);case"ArrayBuffer":return i(new Uint8Array(m).buffer,m);case"DataView":{const{buffer:o}=new Uint8Array(m);return i(new DataView(o),m)}}return i(new iv[h](m),l)};return s},sv=e=>Mk(new Map,e)(0),vs="",{toString:Ok}={},{keys:Ik}=Object,Da=e=>{const r=typeof e;if(r!=="object"||!e)return[Bl,r];const i=Ok.call(e).slice(8,-1);switch(i){case"Array":return[Ia,vs];case"Object":return[El,vs];case"Date":return[bh,vs];case"RegExp":return[yh,vs];case"Map":return[_h,vs];case"Set":return[Sh,vs];case"DataView":return[Ia,i]}return i.includes("Array")?[Ia,i]:i.includes("Error")?[P0,i]:[El,i]},hl=([e,r])=>e===Bl&&(r==="function"||r==="symbol"),Bk=(e,r,i,s)=>{const l=(m,o)=>{const d=s.push(m)-1;return i.set(o,d),d},h=m=>{if(i.has(m))return i.get(m);let[o,d]=Da(m);switch(o){case Bl:{let g=m;switch(d){case"bigint":o=F0,g=m.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);g=null;break;case"undefined":return l([H0],m)}return l([o,g],m)}case Ia:{if(d){let v=m;return d==="DataView"?v=new Uint8Array(m.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(m)),l([d,[...v]],m)}const g=[],p=l([o,g],m);for(const v of m)g.push(h(v));return p}case El:{if(d)switch(d){case"BigInt":return l([d,m.toString()],m);case"Boolean":case"Number":case"String":return l([d,m.valueOf()],m)}if(r&&"toJSON"in m)return h(m.toJSON());const g=[],p=l([o,g],m);for(const v of Ik(m))(e||!hl(Da(m[v])))&&g.push([h(v),h(m[v])]);return p}case bh:return l([o,m.toISOString()],m);case yh:{const{source:g,flags:p}=m;return l([o,{source:g,flags:p}],m)}case _h:{const g=[],p=l([o,g],m);for(const[v,S]of m)(e||!(hl(Da(v))||hl(Da(S))))&&g.push([h(v),h(S)]);return p}case Sh:{const g=[],p=l([o,g],m);for(const v of m)(e||!hl(Da(v)))&&g.push(h(v));return p}}const{message:f}=m;return l([o,{name:d,message:f}],m)};return h},av=(e,{json:r,lossy:i}={})=>{const s=[];return Bk(!(r||i),!!r,new Map,s)(e),s},jl=typeof structuredClone=="function"?(e,r)=>r&&("json"in r||"lossy"in r)?sv(av(e,r)):structuredClone(e):(e,r)=>sv(av(e,r));function zk(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 Hk(e,r){return"Back to reference "+(e+1)+(r>1?"-"+r:"")}function Pk(e){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||zk,s=e.options.footnoteBackLabel||Hk,l=e.options.footnoteLabel||"Footnotes",h=e.options.footnoteLabelTagName||"h2",m=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const g=e.all(f),p=String(f.identifier).toUpperCase(),v=As(p.toLowerCase());let S=0;const E=[],C=e.footnoteCounts.get(p);for(;C!==void 0&&++S<=C;){E.length>0&&E.push({type:"text",value:" "});let x=typeof i=="string"?i:i(d,S);typeof x=="string"&&(x={type:"text",value:x}),E.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+v+(S>1?"-"+S:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,S),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...E)}else g.push(...E);const _={type:"element",tagName:"li",properties:{id:r+"fn-"+v},children:e.wrap(g,!0)};e.patch(f,_),o.push(_)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:h,properties:{...jl(m),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
98
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:`
|
|
99
|
-
`}]}}const zl=(function(e){if(e==null)return qk;if(typeof e=="function")return Hl(e);if(typeof e=="object")return Array.isArray(e)?Fk(e):Uk(e);if(typeof e=="string")return $k(e);throw new Error("Expected function, string, or object as test")});function Fk(e){const r=[];let i=-1;for(;++i<e.length;)r[i]=zl(e[i]);return Hl(s);function s(...l){let h=-1;for(;++h<r.length;)if(r[h].apply(this,l))return!0;return!1}}function Uk(e){const r=e;return Hl(i);function i(s){const l=s;let h;for(h in e)if(l[h]!==r[h])return!1;return!0}}function $k(e){return Hl(r);function r(i){return i&&i.type===e}}function Hl(e){return r;function r(i,s,l){return!!(Wk(i)&&e.call(this,i,typeof s=="number"?s:void 0,l||void 0))}}function qk(){return!0}function Wk(e){return e!==null&&typeof e=="object"&&"type"in e}const U0=[],Gk=!0,Yd=!1,Vk="skip";function $0(e,r,i,s){let l;typeof r=="function"&&typeof i!="function"?(s=i,i=r):l=r;const h=zl(l),m=s?-1:1;o(e,void 0,[])();function o(d,f,g){const p=d&&typeof d=="object"?d:{};if(typeof p.type=="string"){const S=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(S?"<"+S+">":""))+")"})}return v;function v(){let S=U0,E,C,b;if((!r||h(d,f,g[g.length-1]||void 0))&&(S=Yk(i(d,g)),S[0]===Yd))return S;if("children"in d&&d.children){const _=d;if(_.children&&S[0]!==Vk)for(C=(s?_.children.length:-1)+m,b=g.concat(_);C>-1&&C<_.children.length;){const x=_.children[C];if(E=o(x,C,b)(),E[0]===Yd)return E;C=typeof E[1]=="number"?E[1]:C+m}}return S}}}function Yk(e){return Array.isArray(e)?e:typeof e=="number"?[Gk,e]:e==null?U0:[e]}function wh(e,r,i,s){let l,h,m;typeof r=="function"&&typeof i!="function"?(h=void 0,m=r,l=i):(h=r,m=i,l=s),$0(e,h,o,l);function o(d,f){const g=f[f.length-1],p=g?g.children.indexOf(d):void 0;return m(d,p,g)}}const Kd={}.hasOwnProperty,Kk={};function Xk(e,r){const i=r||Kk,s=new Map,l=new Map,h=new Map,m={...Lk,...i.handlers},o={all:f,applyData:Qk,definitionById:s,footnoteById:l,footnoteCounts:h,footnoteOrder:[],handlers:m,one:d,options:i,patch:Zk,wrap:eE};return wh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const p=g.type==="definition"?s:l,v=String(g.identifier).toUpperCase();p.has(v)||p.set(v,g)}}),o;function d(g,p){const v=g.type,S=o.handlers[v];if(Kd.call(o.handlers,v)&&S)return S(o,g,p);if(o.options.passThrough&&o.options.passThrough.includes(v)){if("children"in g){const{children:C,...b}=g,_=jl(b);return _.children=o.all(g),_}return jl(g)}return(o.options.unknownHandler||Jk)(o,g,p)}function f(g){const p=[];if("children"in g){const v=g.children;let S=-1;for(;++S<v.length;){const E=o.one(v[S],g);if(E){if(S&&v[S-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=ov(E.value)),!Array.isArray(E)&&E.type==="element")){const C=E.children[0];C&&C.type==="text"&&(C.value=ov(C.value))}Array.isArray(E)?p.push(...E):p.push(E)}}}return p}}function Zk(e,r){e.position&&(r.position=Hw(e))}function Qk(e,r){let i=r;if(e&&e.data){const s=e.data.hName,l=e.data.hChildren,h=e.data.hProperties;if(typeof s=="string")if(i.type==="element")i.tagName=s;else{const m="children"in i?i.children:[i];i={type:"element",tagName:s,properties:{},children:m}}i.type==="element"&&h&&Object.assign(i.properties,jl(h)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function Jk(e,r){const i=r.data||{},s="value"in r&&!(Kd.call(i,"hProperties")||Kd.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 eE(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 ov(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function lv(e,r){const i=Xk(e,r),s=i.one(e,void 0),l=Pk(i),h=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&h.children.push({type:"text",value:`
|
|
103
|
-
`},l),h}function tE(e,r){return e&&"run"in e?async function(i,s){const l=lv(i,{file:s,...r});await e.run(l,s)}:function(i,s){return lv(i,{file:s,...e||r})}}function cv(e){if(e)throw e}var wd,uv;function nE(){if(uv)return wd;uv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):r.call(f)==="[object Array]"},h=function(f){if(!f||r.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),p=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!p)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},m=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},o=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(s)return s(f,g).value}else return;return f[g]};return wd=function d(){var f,g,p,v,S,E,C=arguments[0],b=1,_=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});b<_;++b)if(f=arguments[b],f!=null)for(g in f)p=o(C,g),v=o(f,g),C!==v&&(x&&v&&(h(v)||(S=l(v)))?(S?(S=!1,E=p&&l(p)?p:[]):E=p&&h(p)?p:{},m(C,{name:g,newValue:d(x,E,v)})):typeof v<"u"&&m(C,{name:g,newValue:v}));return C},wd}var rE=nE();const Cd=Al(rE);function Xd(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 iE(){const e=[],r={run:i,use:s};return r;function i(...l){let h=-1;const m=l.pop();if(typeof m!="function")throw new TypeError("Expected function as last argument, not "+m);o(null,...l);function o(d,...f){const g=e[++h];let p=-1;if(d){m(d);return}for(;++p<l.length;)(f[p]===null||f[p]===void 0)&&(f[p]=l[p]);l=f,g?sE(g,o)(...f):m(null,...f)}}function s(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),r}}function sE(e,r){let i;return s;function s(...m){const o=e.length>m.length;let d;o&&m.push(l);try{d=e.apply(this,m)}catch(f){const g=f;if(o&&i)throw g;return l(g)}o||(d&&d.then&&typeof d.then=="function"?d.then(h,l):d instanceof Error?l(d):h(d))}function l(m,...o){i||(i=!0,r(m,...o))}function h(m){l(null,m)}}const tr={basename:aE,dirname:oE,extname:lE,join:cE,sep:"/"};function aE(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Ya(e);let i=0,s=-1,l=e.length,h;if(r===void 0||r.length===0||r.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(h){i=l+1;break}}else s<0&&(h=!0,s=l+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let m=-1,o=r.length-1;for(;l--;)if(e.codePointAt(l)===47){if(h){i=l+1;break}}else m<0&&(h=!0,m=l+1),o>-1&&(e.codePointAt(l)===r.codePointAt(o--)?o<0&&(s=l):(o=-1,s=m));return i===s?s=m:s<0&&(s=e.length),e.slice(i,s)}function oE(e){if(Ya(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 lE(e){Ya(e);let r=e.length,i=-1,s=0,l=-1,h=0,m;for(;r--;){const o=e.codePointAt(r);if(o===47){if(m){s=r+1;break}continue}i<0&&(m=!0,i=r+1),o===46?l<0?l=r:h!==1&&(h=1):l>-1&&(h=-1)}return l<0||i<0||h===0||h===1&&l===i-1&&l===s+1?"":e.slice(l,i)}function cE(...e){let r=-1,i;for(;++r<e.length;)Ya(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":uE(i)}function uE(e){Ya(e);const r=e.codePointAt(0)===47;let i=dE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function dE(e,r){let i="",s=0,l=-1,h=0,m=-1,o,d;for(;++m<=e.length;){if(m<e.length)o=e.codePointAt(m);else{if(o===47)break;o=47}if(o===47){if(!(l===m-1||h===1))if(l!==m-1&&h===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("/")),l=m,h=0;continue}}else if(i.length>0){i="",s=0,l=m,h=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(l+1,m):i=e.slice(l+1,m),s=m-l-1;l=m,h=0}else o===46&&h>-1?h++:h=-1}return i}function Ya(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const hE={cwd:fE};function fE(){return"/"}function Zd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pE(e){if(typeof e=="string")e=new URL(e);else if(!Zd(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 mE(e)}function mE(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 l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(r)}const kd=["history","path","basename","stem","extname","dirname"];class q0{constructor(r){let i;r?Zd(r)?i={path:r}:typeof r=="string"||gE(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":hE.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<kd.length;){const h=kd[s];h in i&&i[h]!==void 0&&i[h]!==null&&(this[h]=h==="history"?[...i[h]]:i[h])}let l;for(l in i)kd.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?tr.basename(this.path):void 0}set basename(r){jd(r,"basename"),Ed(r,"basename"),this.path=tr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?tr.dirname(this.path):void 0}set dirname(r){dv(this.basename,"dirname"),this.path=tr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?tr.extname(this.path):void 0}set extname(r){if(Ed(r,"extname"),dv(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=tr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Zd(r)&&(r=pE(r)),jd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?tr.basename(this.path,this.extname):void 0}set stem(r){jd(r,"stem"),Ed(r,"stem"),this.path=tr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const l=this.message(r,i,s);throw l.fatal=!0,l}info(r,i,s){const l=this.message(r,i,s);return l.fatal=void 0,l}message(r,i,s){const l=new an(r,i,s);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Ed(e,r){if(e&&e.includes(tr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+tr.sep+"`")}function jd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function dv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function gE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xE=(function(e){const s=this.constructor.prototype,l=s[e],h=function(){return l.apply(h,arguments)};return Object.setPrototypeOf(h,s),h}),vE={}.hasOwnProperty;class Ch extends xE{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=iE()}copy(){const r=new Ch;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(Cd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(Ad("data",this.frozen),this.namespace[r]=i,this):vE.call(this.namespace,r)&&this.namespace[r]||void 0:r?(Ad("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 l=i.call(r,...s);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=fl(r),s=this.parser||this.Parser;return Nd("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Nd("process",this.parser||this.Parser),Td("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(h,m){const o=fl(r),d=s.parse(o);s.run(d,o,function(g,p,v){if(g||!p||!v)return f(g);const S=p,E=s.stringify(S,v);_E(E)?v.value=E:v.result=E,f(g,v)});function f(g,p){g||!p?m(g):h?h(p):i(void 0,p)}}}processSync(r){let i=!1,s;return this.freeze(),Nd("processSync",this.parser||this.Parser),Td("processSync",this.compiler||this.Compiler),this.process(r,l),fv("processSync","process",i),s;function l(h,m){i=!0,cv(h),s=m}}run(r,i,s){hv(r),this.freeze();const l=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?h(void 0,s):new Promise(h);function h(m,o){const d=fl(i);l.run(r,d,f);function f(g,p,v){const S=p||r;g?o(g):m?m(S):s(void 0,S,v)}}}runSync(r,i){let s=!1,l;return this.run(r,i,h),fv("runSync","run",s),l;function h(m,o){cv(m),l=o,s=!0}}stringify(r,i){this.freeze();const s=fl(i),l=this.compiler||this.Compiler;return Td("stringify",l),hv(r),l(r,s)}use(r,...i){const s=this.attachers,l=this.namespace;if(Ad("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?o(r):m(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function h(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[g,...p]=f;d(g,p)}else m(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function m(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");o(f.plugins),f.settings&&(l.settings=Cd(!0,l.settings,f.settings))}function o(f){let g=-1;if(f!=null)if(Array.isArray(f))for(;++g<f.length;){const p=f[g];h(p)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,g){let p=-1,v=-1;for(;++p<s.length;)if(s[p][0]===f){v=p;break}if(v===-1)s.push([f,...g]);else if(g.length>0){let[S,...E]=g;const C=s[v][1];Xd(C)&&Xd(S)&&(S=Cd(!0,C,S)),s[v]=[f,S,...E]}}}}const bE=new Ch().freeze();function Nd(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Td(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ad(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 hv(e){if(!Xd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function fv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function fl(e){return yE(e)?e:new q0(e)}function yE(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _E(e){return typeof e=="string"||SE(e)}function SE(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",pv=[],mv={allowDangerousHtml:!0},CE=/^(https?|ircs?|mailto|xmpp)$/i,kE=[{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 EE(e){const r=jE(e),i=NE(e);return TE(r.runSync(r.parse(i),i),e)}function jE(e){const r=e.rehypePlugins||pv,i=e.remarkPlugins||pv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mv}:mv;return bE().use(ok).use(i).use(tE,s).use(r)}function NE(e){const r=e.children||"",i=new q0;return typeof r=="string"&&(i.value=r),i}function TE(e,r){const i=r.allowedElements,s=r.allowElement,l=r.components,h=r.disallowedElements,m=r.skipHtml,o=r.unwrapDisallowed,d=r.urlTransform||AE;for(const g of kE)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+wE+g.id,void 0);return wh(e,f),qw(e,{Fragment:c.Fragment,components:l,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function f(g,p,v){if(g.type==="raw"&&v&&typeof p=="number")return m?v.children.splice(p,1):v.children[p]={type:"text",value:g.value},p;if(g.type==="element"){let S;for(S in yd)if(Object.hasOwn(yd,S)&&Object.hasOwn(g.properties,S)){const E=g.properties[S],C=yd[S];(C===null||C.includes(g.tagName))&&(g.properties[S]=d(String(E||""),S,g))}}if(g.type==="element"){let S=i?!i.includes(g.tagName):h?h.includes(g.tagName):!1;if(!S&&s&&typeof p=="number"&&(S=!s(g,p,v)),S&&v&&typeof p=="number")return o&&g.children?v.children.splice(p,1,...g.children):v.children.splice(p,1),p}}}function AE(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),l=e.indexOf("/");return r===-1||l!==-1&&r>l||i!==-1&&r>i||s!==-1&&r>s||CE.test(e.slice(0,r))?e:""}function gv(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,l=i.indexOf(r);for(;l!==-1;)s++,l=i.indexOf(r,l+r.length);return s}function DE(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RE(e,r,i){const l=zl((i||{}).ignore||[]),h=LE(r);let m=-1;for(;++m<h.length;)$0(e,"text",o);function o(f,g){let p=-1,v;for(;++p<g.length;){const S=g[p],E=v?v.children:void 0;if(l(S,E?E.indexOf(S):void 0,v))return;v=S}if(v)return d(f,g)}function d(f,g){const p=g[g.length-1],v=h[m][0],S=h[m][1];let E=0;const b=p.children.indexOf(f);let _=!1,x=[];v.lastIndex=0;let y=v.exec(f.value);for(;y;){const j=y.index,A={index:y.index,input:y.input,stack:[...g,f]};let N=S(...y,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?v.lastIndex=j+1:(E!==j&&x.push({type:"text",value:f.value.slice(E,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),E=j+y[0].length,_=!0),!v.global)break;y=v.exec(f.value)}return _?(E<f.value.length&&x.push({type:"text",value:f.value.slice(E)}),p.children.splice(b,1,...x)):x=[f],b+x.length}}function LE(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 l=i[s];r.push([ME(l[0]),OE(l[1])])}return r}function ME(e){return typeof e=="string"?new RegExp(DE(e),"g"):e}function OE(e){return typeof e=="function"?e:function(){return e}}const Dd="phrasing",Rd=["autolink","link","image","label"];function IE(){return{transforms:[$E],enter:{literalAutolink:zE,literalAutolinkEmail:Ld,literalAutolinkHttp:Ld,literalAutolinkWww:Ld},exit:{literalAutolink:UE,literalAutolinkEmail:FE,literalAutolinkHttp:HE,literalAutolinkWww:PE}}}function BE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Rd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Dd,notInConstruct:Rd},{character:":",before:"[ps]",after:"\\/",inConstruct:Dd,notInConstruct:Rd}]}}function zE(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ld(e){this.config.enter.autolinkProtocol.call(this,e)}function HE(e){this.config.exit.autolinkProtocol.call(this,e)}function PE(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 FE(e){this.config.exit.autolinkEmail.call(this,e)}function UE(e){this.exit(e)}function $E(e){RE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),WE]],{ignore:["link","linkReference"]})}function qE(e,r,i,s,l){let h="";if(!W0(l)||(/^w/i.test(r)&&(i=r+i,r="",h="http://"),!GE(i)))return!1;const m=VE(i+s);if(!m[0])return!1;const o={type:"link",title:null,url:h+r+m[0],children:[{type:"text",value:r+m[0]}]};return m[1]?[o,{type:"text",value:m[1]}]:o}function WE(e,r,i,s){return!W0(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function GE(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 VE(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 l=gv(e,"(");let h=gv(e,")");for(;s!==-1&&l>h;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),h++;return[e,i]}function W0(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ni(i)||Ol(i))&&(!r||i!==47)}G0.peek=nj;function YE(){this.buffer()}function KE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function XE(){this.buffer()}function ZE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function QE(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 JE(e){this.exit(e)}function ej(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 tj(e){this.exit(e)}function nj(){return"["}function G0(e,r,i,s){const l=i.createTracker(s);let h=l.move("[^");const m=i.enter("footnoteReference"),o=i.enter("reference");return h+=l.move(i.safe(i.associationId(e),{after:"]",before:h})),o(),m(),h+=l.move("]"),h}function rj(){return{enter:{gfmFootnoteCallString:YE,gfmFootnoteCall:KE,gfmFootnoteDefinitionLabelString:XE,gfmFootnoteDefinition:ZE},exit:{gfmFootnoteCallString:QE,gfmFootnoteCall:JE,gfmFootnoteDefinitionLabelString:ej,gfmFootnoteDefinition:tj}}}function ij(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:G0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,l,h,m){const o=h.createTracker(m);let d=o.move("[^");const f=h.enter("footnoteDefinition"),g=h.enter("label");return d+=o.move(h.safe(h.associationId(s),{before:d,after:"]"})),g(),d+=o.move("]:"),s.children&&s.children.length>0&&(o.shift(4),d+=o.move((r?`
|
|
104
|
-
`:" ")+h.indentLines(h.containerFlow(s,o.current()),r?V0:sj))),f(),d}}function sj(e,r,i){return r===0?e:V0(e,r,i)}function V0(e,r,i){return(i?"":" ")+e}const aj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Y0.peek=dj;function oj(){return{canContainEols:["delete"],enter:{strikethrough:cj},exit:{strikethrough:uj}}}function lj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:aj}],handlers:{delete:Y0}}}function cj(e){this.enter({type:"delete",children:[]},e)}function uj(e){this.exit(e)}function Y0(e,r,i,s){const l=i.createTracker(s),h=i.enter("strikethrough");let m=l.move("~~");return m+=i.containerPhrasing(e,{...l.current(),before:m,after:"~"}),m+=l.move("~~"),h(),m}function dj(){return"~"}function hj(e){return e.length}function fj(e,r){const i=r||{},s=(i.align||[]).concat(),l=i.stringLength||hj,h=[],m=[],o=[],d=[];let f=0,g=-1;for(;++g<e.length;){const C=[],b=[];let _=-1;for(e[g].length>f&&(f=e[g].length);++_<e[g].length;){const x=pj(e[g][_]);if(i.alignDelimiters!==!1){const y=l(x);b[_]=y,(d[_]===void 0||y>d[_])&&(d[_]=y)}C.push(x)}m[g]=C,o[g]=b}let p=-1;if(typeof s=="object"&&"length"in s)for(;++p<f;)h[p]=xv(s[p]);else{const C=xv(s);for(;++p<f;)h[p]=C}p=-1;const v=[],S=[];for(;++p<f;){const C=h[p];let b="",_="";C===99?(b=":",_=":"):C===108?b=":":C===114&&(_=":");let x=i.alignDelimiters===!1?1:Math.max(1,d[p]-b.length-_.length);const y=b+"-".repeat(x)+_;i.alignDelimiters!==!1&&(x=b.length+x+_.length,x>d[p]&&(d[p]=x),S[p]=x),v[p]=y}m.splice(1,0,v),o.splice(1,0,S),g=-1;const E=[];for(;++g<m.length;){const C=m[g],b=o[g];p=-1;const _=[];for(;++p<f;){const x=C[p]||"";let y="",j="";if(i.alignDelimiters!==!1){const A=d[p]-(b[p]||0),N=h[p];N===114?y=" ".repeat(A):N===99?A%2?(y=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(y=" ".repeat(A/2),j=y):j=" ".repeat(A)}i.delimiterStart!==!1&&!p&&_.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&x==="")&&(i.delimiterStart!==!1||p)&&_.push(" "),i.alignDelimiters!==!1&&_.push(y),_.push(x),i.alignDelimiters!==!1&&_.push(j),i.padding!==!1&&_.push(" "),(i.delimiterEnd!==!1||p!==f-1)&&_.push("|")}E.push(i.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return E.join(`
|
|
105
|
-
`)}function pj(e){return e==null?"":String(e)}function xv(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 mj(e,r,i,s){const l=i.enter("blockquote"),h=i.createTracker(s);h.move("> "),h.shift(2);const m=i.indentLines(i.containerFlow(e,h.current()),gj);return l(),m}function gj(e,r,i){return">"+(i?"":" ")+e}function xj(e,r){return vv(e,r.inConstruct,!0)&&!vv(e,r.notInConstruct,!1)}function vv(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 bv(e,r,i,s){let l=-1;for(;++l<i.unsafe.length;)if(i.unsafe[l].character===`
|
|
106
|
-
`&&xj(i.stack,i.unsafe[l]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
107
|
-
`}function vj(e,r){const i=String(e);let s=i.indexOf(r),l=s,h=0,m=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===l?++h>m&&(m=h):h=1,l=s+r.length,s=i.indexOf(r,l);return m}function bj(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 yj(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 _j(e,r,i,s){const l=yj(i),h=e.value||"",m=l==="`"?"GraveAccent":"Tilde";if(bj(e,i)){const p=i.enter("codeIndented"),v=i.indentLines(h,Sj);return p(),v}const o=i.createTracker(s),d=l.repeat(Math.max(vj(h,l)+1,3)),f=i.enter("codeFenced");let g=o.move(d);if(e.lang){const p=i.enter(`codeFencedLang${m}`);g+=o.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...o.current()})),p()}if(e.lang&&e.meta){const p=i.enter(`codeFencedMeta${m}`);g+=o.move(" "),g+=o.move(i.safe(e.meta,{before:g,after:`
|
|
108
|
-
`,encode:["`"],...o.current()})),p()}return g+=o.move(`
|
|
109
|
-
`),h&&(g+=o.move(h+`
|
|
110
|
-
`)),g+=o.move(d),f(),g}function Sj(e,r,i){return(i?"":" ")+e}function kh(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 wj(e,r,i,s){const l=kh(i),h=l==='"'?"Quote":"Apostrophe",m=i.enter("definition");let o=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("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=i.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(i.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(o=i.enter("destinationRaw"),f+=d.move(i.safe(e.url,{before:f,after:e.title?" ":`
|
|
111
|
-
`,...d.current()}))),o(),e.title&&(o=i.enter(`title${h}`),f+=d.move(" "+l),f+=d.move(i.safe(e.title,{before:f,after:l,...d.current()})),f+=d.move(l),o()),m(),f}function Cj(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 Fa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Nl(e,r,i){const s=js(e),l=js(r);return s===void 0?l===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}K0.peek=kj;function K0(e,r,i,s){const l=Cj(i),h=i.enter("emphasis"),m=i.createTracker(s),o=m.move(l);let d=m.move(i.containerPhrasing(e,{after:l,before:o,...m.current()}));const f=d.charCodeAt(0),g=Nl(s.before.charCodeAt(s.before.length-1),f,l);g.inside&&(d=Fa(f)+d.slice(1));const p=d.charCodeAt(d.length-1),v=Nl(s.after.charCodeAt(0),p,l);v.inside&&(d=d.slice(0,-1)+Fa(p));const S=m.move(l);return h(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},o+d+S}function kj(e,r,i){return i.options.emphasis||"*"}function Ej(e,r){let i=!1;return wh(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return i=!0,Yd}),!!((!e.depth||e.depth<3)&&xh(e)&&(r.options.setext||i))}function jj(e,r,i,s){const l=Math.max(Math.min(6,e.depth||1),1),h=i.createTracker(s);if(Ej(e,i)){const g=i.enter("headingSetext"),p=i.enter("phrasing"),v=i.containerPhrasing(e,{...h.current(),before:`
|
|
112
|
-
`,after:`
|
|
113
|
-
`});return p(),g(),v+`
|
|
114
|
-
`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
115
|
-
`))+1))}const m="#".repeat(l),o=i.enter("headingAtx"),d=i.enter("phrasing");h.move(m+" ");let f=i.containerPhrasing(e,{before:"# ",after:`
|
|
116
|
-
`,...h.current()});return/^[\t ]/.test(f)&&(f=Fa(f.charCodeAt(0))+f.slice(1)),f=f?m+" "+f:m,i.options.closeAtx&&(f+=" "+m),d(),o(),f}X0.peek=Nj;function X0(e){return e.value||""}function Nj(){return"<"}Z0.peek=Tj;function Z0(e,r,i,s){const l=kh(i),h=l==='"'?"Quote":"Apostrophe",m=i.enter("image");let o=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("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=i.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(i.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(o=i.enter("destinationRaw"),f+=d.move(i.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),o(),e.title&&(o=i.enter(`title${h}`),f+=d.move(" "+l),f+=d.move(i.safe(e.title,{before:f,after:l,...d.current()})),f+=d.move(l),o()),f+=d.move(")"),m(),f}function Tj(){return"!"}Q0.peek=Aj;function Q0(e,r,i,s){const l=e.referenceType,h=i.enter("imageReference");let m=i.enter("label");const o=i.createTracker(s);let d=o.move("![");const f=i.safe(e.alt,{before:d,after:"]",...o.current()});d+=o.move(f+"]["),m();const g=i.stack;i.stack=[],m=i.enter("reference");const p=i.safe(i.associationId(e),{before:d,after:"]",...o.current()});return m(),i.stack=g,h(),l==="full"||!f||f!==p?d+=o.move(p+"]"):l==="shortcut"?d=d.slice(0,-1):d+=o.move("]"),d}function Aj(){return"!"}J0.peek=Dj;function J0(e,r,i){let s=e.value||"",l="`",h=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(s);)l+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++h<i.unsafe.length;){const m=i.unsafe[h],o=i.compilePattern(m);let d;if(m.atBreak)for(;d=o.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 l+s+l}function Dj(){return"`"}function eb(e,r){const i=xh(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))}tb.peek=Rj;function tb(e,r,i,s){const l=kh(i),h=l==='"'?"Quote":"Apostrophe",m=i.createTracker(s);let o,d;if(eb(e,i)){const g=i.stack;i.stack=[],o=i.enter("autolink");let p=m.move("<");return p+=m.move(i.containerPhrasing(e,{before:p,after:">",...m.current()})),p+=m.move(">"),o(),i.stack=g,p}o=i.enter("link"),d=i.enter("label");let f=m.move("[");return f+=m.move(i.containerPhrasing(e,{before:f,after:"](",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(i.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=i.enter("destinationRaw"),f+=m.move(i.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=i.enter(`title${h}`),f+=m.move(" "+l),f+=m.move(i.safe(e.title,{before:f,after:l,...m.current()})),f+=m.move(l),d()),f+=m.move(")"),o(),f}function Rj(e,r,i){return eb(e,i)?"<":"["}nb.peek=Lj;function nb(e,r,i,s){const l=e.referenceType,h=i.enter("linkReference");let m=i.enter("label");const o=i.createTracker(s);let d=o.move("[");const f=i.containerPhrasing(e,{before:d,after:"]",...o.current()});d+=o.move(f+"]["),m();const g=i.stack;i.stack=[],m=i.enter("reference");const p=i.safe(i.associationId(e),{before:d,after:"]",...o.current()});return m(),i.stack=g,h(),l==="full"||!f||f!==p?d+=o.move(p+"]"):l==="shortcut"?d=d.slice(0,-1):d+=o.move("]"),d}function Lj(){return"["}function Eh(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 Mj(e){const r=Eh(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 Oj(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 rb(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 Ij(e,r,i,s){const l=i.enter("list"),h=i.bulletCurrent;let m=e.ordered?Oj(i):Eh(i);const o=e.ordered?m==="."?")":".":Mj(i);let d=r&&i.bulletLastUsed?m===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((m==="*"||m==="-")&&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),rb(i)===m&&g){let p=-1;for(;++p<e.children.length;){const v=e.children[p];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(m=o),i.bulletCurrent=m;const f=i.containerFlow(e,s);return i.bulletLastUsed=m,i.bulletCurrent=h,l(),f}function Bj(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 zj(e,r,i,s){const l=Bj(i);let h=i.bulletCurrent||Eh(i);r&&r.type==="list"&&r.ordered&&(h=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+h);let m=h.length+1;(l==="tab"||l==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(m=Math.ceil(m/4)*4);const o=i.createTracker(s);o.move(h+" ".repeat(m-h.length)),o.shift(m);const d=i.enter("listItem"),f=i.indentLines(i.containerFlow(e,o.current()),g);return d(),f;function g(p,v,S){return v?(S?"":" ".repeat(m))+p:(S?h:h+" ".repeat(m-h.length))+p}}function Hj(e,r,i,s){const l=i.enter("paragraph"),h=i.enter("phrasing"),m=i.containerPhrasing(e,s);return h(),l(),m}const Pj=zl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Fj(e,r,i,s){return(e.children.some(function(m){return Pj(m)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function Uj(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}ib.peek=$j;function ib(e,r,i,s){const l=Uj(i),h=i.enter("strong"),m=i.createTracker(s),o=m.move(l+l);let d=m.move(i.containerPhrasing(e,{after:l,before:o,...m.current()}));const f=d.charCodeAt(0),g=Nl(s.before.charCodeAt(s.before.length-1),f,l);g.inside&&(d=Fa(f)+d.slice(1));const p=d.charCodeAt(d.length-1),v=Nl(s.after.charCodeAt(0),p,l);v.inside&&(d=d.slice(0,-1)+Fa(p));const S=m.move(l+l);return h(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},o+d+S}function $j(e,r,i){return i.options.strong||"*"}function qj(e,r,i,s){return i.safe(e.value,s)}function Wj(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 Gj(e,r,i){const s=(rb(i)+(i.options.ruleSpaces?" ":"")).repeat(Wj(i));return i.options.ruleSpaces?s.slice(0,-1):s}const sb={blockquote:mj,break:bv,code:_j,definition:wj,emphasis:K0,hardBreak:bv,heading:jj,html:X0,image:Z0,imageReference:Q0,inlineCode:J0,link:tb,linkReference:nb,list:Ij,listItem:zj,paragraph:Hj,root:Fj,strong:ib,text:qj,thematicBreak:Gj};function Vj(){return{enter:{table:Yj,tableData:yv,tableHeader:yv,tableRow:Xj},exit:{codeText:Zj,table:Kj,tableData:Md,tableHeader:Md,tableRow:Md}}}function Yj(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 Kj(e){this.exit(e),this.data.inTable=void 0}function Xj(e){this.enter({type:"tableRow",children:[]},e)}function Md(e){this.exit(e)}function yv(e){this.enter({type:"tableCell",children:[]},e)}function Zj(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,Qj));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function Qj(e,r){return r==="|"?r:e}function Jj(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,l=r.stringLength,h=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:v,table:m,tableCell:d,tableRow:o}};function m(S,E,C,b){return f(g(S,C,b),S.align)}function o(S,E,C,b){const _=p(S,C,b),x=f([_]);return x.slice(0,x.indexOf(`
|
|
118
|
-
`))}function d(S,E,C,b){const _=C.enter("tableCell"),x=C.enter("phrasing"),y=C.containerPhrasing(S,{...b,before:h,after:h});return x(),_(),y}function f(S,E){return fj(S,{align:E,alignDelimiters:s,padding:i,stringLength:l})}function g(S,E,C){const b=S.children;let _=-1;const x=[],y=E.enter("table");for(;++_<b.length;)x[_]=p(b[_],E,C);return y(),x}function p(S,E,C){const b=S.children;let _=-1;const x=[],y=E.enter("tableRow");for(;++_<b.length;)x[_]=d(b[_],S,E,C);return y(),x}function v(S,E,C){let b=sb.inlineCode(S,E,C);return C.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function e5(){return{exit:{taskListCheckValueChecked:_v,taskListCheckValueUnchecked:_v,paragraph:n5}}}function t5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:r5}}}function _v(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function n5(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 l=r.children;let h=-1,m;for(;++h<l.length;){const o=l[h];if(o.type==="paragraph"){m=o;break}}m===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 r5(e,r,i,s){const l=e.children[0],h=typeof e.checked=="boolean"&&l&&l.type==="paragraph",m="["+(e.checked?"x":" ")+"] ",o=i.createTracker(s);h&&o.move(m);let d=sb.listItem(e,r,i,{...s,...o.current()});return h&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(g){return g+m}}function i5(){return[IE(),rj(),oj(),Vj(),e5()]}function s5(e){return{extensions:[BE(),ij(e),lj(),Jj(e),t5()]}}const a5={tokenize:h5,partial:!0},ab={tokenize:f5,partial:!0},ob={tokenize:p5,partial:!0},lb={tokenize:m5,partial:!0},o5={tokenize:g5,partial:!0},cb={name:"wwwAutolink",tokenize:u5,previous:db},ub={name:"protocolAutolink",tokenize:d5,previous:hb},jr={name:"emailAutolink",tokenize:c5,previous:fb},sr={};function l5(){return{text:sr}}let Si=48;for(;Si<123;)sr[Si]=jr,Si++,Si===58?Si=65:Si===91&&(Si=97);sr[43]=jr;sr[45]=jr;sr[46]=jr;sr[95]=jr;sr[72]=[jr,ub];sr[104]=[jr,ub];sr[87]=[jr,cb];sr[119]=[jr,cb];function c5(e,r,i){const s=this;let l,h;return m;function m(p){return!Qd(p)||!fb.call(s,s.previous)||jh(s.events)?i(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(p))}function o(p){return Qd(p)?(e.consume(p),o):p===64?(e.consume(p),d):i(p)}function d(p){return p===46?e.check(o5,g,f)(p):p===45||p===95||sn(p)?(h=!0,e.consume(p),d):g(p)}function f(p){return e.consume(p),l=!0,d}function g(p){return h&&l&&cn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(p)):i(p)}}function u5(e,r,i){const s=this;return l;function l(m){return m!==87&&m!==119||!db.call(s,s.previous)||jh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(a5,e.attempt(ab,e.attempt(ob,h),i),i)(m))}function h(m){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(m)}}function d5(e,r,i){const s=this;let l="",h=!1;return m;function m(p){return(p===72||p===104)&&hb.call(s,s.previous)&&!jh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(p),e.consume(p),o):i(p)}function o(p){if(cn(p)&&l.length<5)return l+=String.fromCodePoint(p),e.consume(p),o;if(p===58){const v=l.toLowerCase();if(v==="http"||v==="https")return e.consume(p),d}return i(p)}function d(p){return p===47?(e.consume(p),h?f:(h=!0,d)):i(p)}function f(p){return p===null||kl(p)||yt(p)||Ni(p)||Ol(p)?i(p):e.attempt(ab,e.attempt(ob,g),i)(p)}function g(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(p)}}function h5(e,r,i){let s=0;return l;function l(m){return(m===87||m===119)&&s<3?(s++,e.consume(m),l):m===46&&s===3?(e.consume(m),h):i(m)}function h(m){return m===null?i(m):r(m)}}function f5(e,r,i){let s,l,h;return m;function m(f){return f===46||f===95?e.check(lb,d,o)(f):f===null||yt(f)||Ni(f)||f!==45&&Ol(f)?d(f):(h=!0,e.consume(f),m)}function o(f){return f===95?s=!0:(l=s,s=void 0),e.consume(f),m}function d(f){return l||s||!h?i(f):r(f)}}function p5(e,r){let i=0,s=0;return l;function l(m){return m===40?(i++,e.consume(m),l):m===41&&s<i?h(m):m===33||m===34||m===38||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===60||m===63||m===93||m===95||m===126?e.check(lb,r,h)(m):m===null||yt(m)||Ni(m)?r(m):(e.consume(m),l)}function h(m){return m===41&&s++,e.consume(m),l}}function m5(e,r,i){return s;function s(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),s):o===38?(e.consume(o),h):o===93?(e.consume(o),l):o===60||o===null||yt(o)||Ni(o)?r(o):i(o)}function l(o){return o===null||o===40||o===91||yt(o)||Ni(o)?r(o):s(o)}function h(o){return cn(o)?m(o):i(o)}function m(o){return o===59?(e.consume(o),s):cn(o)?(e.consume(o),m):i(o)}}function g5(e,r,i){return s;function s(h){return e.consume(h),l}function l(h){return sn(h)?i(h):r(h)}}function db(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function hb(e){return!cn(e)}function fb(e){return!(e===47||Qd(e))}function Qd(e){return e===43||e===45||e===46||e===95||sn(e)}function jh(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 x5={tokenize:k5,partial:!0};function v5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:S5,continuation:{tokenize:w5},exit:C5}},text:{91:{name:"gfmFootnoteCall",tokenize:_5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:b5,resolveTo:y5}}}}function b5(e,r,i){const s=this;let l=s.events.length;const h=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let m;for(;l--;){const d=s.events[l][1];if(d.type==="labelImage"){m=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return o;function o(d){if(!m||!m._balanced)return i(d);const f=Kn(s.sliceSerialize({start:m.end,end:s.now()}));return f.codePointAt(0)!==94||!h.includes(f.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function y5(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)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const h={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},m={type:"chunkString",contentType:"string",start:Object.assign({},h.start),end:Object.assign({},h.end)},o=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",l,r],["exit",l,r],["enter",h,r],["enter",m,r],["exit",m,r],["exit",h,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...o),e}function _5(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let h=0,m;return o;function o(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),d}function d(p){return p!==94?i(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(p){if(h>999||p===93&&!m||p===null||p===91||yt(p))return i(p);if(p===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return l.includes(Kn(s.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(p)}return yt(p)||(m=!0),h++,e.consume(p),p===92?g:f}function g(p){return p===91||p===92||p===93?(e.consume(p),h++,f):f(p)}}function S5(e,r,i){const s=this,l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let h,m=0,o;return d;function d(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(E)}function g(E){if(m>999||E===93&&!o||E===null||E===91||yt(E))return i(E);if(E===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return h=Kn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return yt(E)||(o=!0),m++,e.consume(E),E===92?p:g}function p(E){return E===91||E===92||E===93?(e.consume(E),m++,g):g(E)}function v(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),l.includes(h)||l.push(h),rt(e,S,"gfmFootnoteDefinitionWhitespace")):i(E)}function S(E){return r(E)}}function w5(e,r,i){return e.check(Va,r,e.attempt(x5,r,i))}function C5(e){e.exit("gfmFootnoteDefinition")}function k5(e,r,i){const s=this;return rt(e,l,"gfmFootnoteDefinitionIndent",5);function l(h){const m=s.events[s.events.length-1];return m&&m[1].type==="gfmFootnoteDefinitionIndent"&&m[2].sliceSerialize(m[1],!0).length===4?r(h):i(h)}}function E5(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:h,resolveAll:l};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function l(m,o){let d=-1;for(;++d<m.length;)if(m[d][0]==="enter"&&m[d][1].type==="strikethroughSequenceTemporary"&&m[d][1]._close){let f=d;for(;f--;)if(m[f][0]==="exit"&&m[f][1].type==="strikethroughSequenceTemporary"&&m[f][1]._open&&m[d][1].end.offset-m[d][1].start.offset===m[f][1].end.offset-m[f][1].start.offset){m[d][1].type="strikethroughSequence",m[f][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},m[f][1].start),end:Object.assign({},m[d][1].end)},p={type:"strikethroughText",start:Object.assign({},m[f][1].end),end:Object.assign({},m[d][1].start)},v=[["enter",g,o],["enter",m[f][1],o],["exit",m[f][1],o],["enter",p,o]],S=o.parser.constructs.insideSpan.null;S&&Dn(v,v.length,0,Il(S,m.slice(f+1,d),o)),Dn(v,v.length,0,[["exit",p,o],["enter",m[d][1],o],["exit",m[d][1],o],["exit",g,o]]),Dn(m,f-1,d-f+3,v),d=f+v.length-2;break}}for(d=-1;++d<m.length;)m[d][1].type==="strikethroughSequenceTemporary"&&(m[d][1].type="data");return m}function h(m,o,d){const f=this.previous,g=this.events;let p=0;return v;function v(E){return f===126&&g[g.length-1][1].type!=="characterEscape"?d(E):(m.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const C=js(f);if(E===126)return p>1?d(E):(m.consume(E),p++,S);if(p<2&&!i)return d(E);const b=m.exit("strikethroughSequenceTemporary"),_=js(E);return b._open=!_||_===2&&!!C,b._close=!C||C===2&&!!_,o(E)}}}class j5{constructor(){this.map=[]}add(r,i,s){N5(this,r,i,s)}consume(r){if(this.map.sort(function(h,m){return h[0]-m[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 l=s.pop();for(;l;){for(const h of l)r.push(h);l=s.pop()}this.map.length=0}}function N5(e,r,i,s){let l=0;if(!(i===0&&s.length===0)){for(;l<e.map.length;){if(e.map[l][0]===r){e.map[l][1]+=i,e.map[l][2].push(...s);return}l+=1}e.map.push([r,i,s])}}function T5(e,r){let i=!1;const s=[];for(;r<e.length;){const l=e[r];if(i){if(l[0]==="enter")l[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const h=s.length-1;s[h]=s[h]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function A5(){return{flow:{null:{name:"table",tokenize:D5,resolveAll:R5}}}}function D5(e,r,i){const s=this;let l=0,h=0,m;return o;function o(H){let G=s.events.length-1;for(;G>-1;){const O=s.events[G][1].type;if(O==="lineEnding"||O==="linePrefix")G--;else break}const Y=G>-1?s.events[G][1].type:null,q=Y==="tableHead"||Y==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?i(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),f(H)}function f(H){return H===124||(m=!0,h+=1),g(H)}function g(H){return H===null?i(H):Me(H)?h>1?(h=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),S):i(H):Xe(H)?rt(e,g,"whitespace")(H):(h+=1,m&&(m=!1,l+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),m=!0,g):(e.enter("data"),p(H)))}function p(H){return H===null||H===124||yt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?v:p)}function v(H){return H===92||H===124?(e.consume(H),p):p(H)}function S(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),m=!1,Xe(H)?rt(e,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):E(H))}function E(H){return H===45||H===58?b(H):H===124?(m=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return Xe(H)?rt(e,b,"whitespace")(H):b(H)}function b(H){return H===58?(h+=1,m=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),_):H===45?(h+=1,_(H)):H===null||Me(H)?j(H):A(H)}function _(H){return H===45?(e.enter("tableDelimiterFiller"),x(H)):A(H)}function x(H){return H===45?(e.consume(H),x):H===58?(m=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(H))}function y(H){return Xe(H)?rt(e,j,"whitespace")(H):j(H)}function j(H){return H===124?E(H):H===null||Me(H)?!m||l!==h?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(H)):A(H)}function A(H){return i(H)}function N(H){return e.enter("tableRow"),R(H)}function R(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),R):H===null||Me(H)?(e.exit("tableRow"),r(H)):Xe(H)?rt(e,R,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||yt(H)?(e.exit("data"),R(H)):(e.consume(H),H===92?B:T)}function B(H){return H===92||H===124?(e.consume(H),T):T(H)}}function R5(e,r){let i=-1,s=!0,l=0,h=[0,0,0,0],m=[0,0,0,0],o=!1,d=0,f,g,p;const v=new j5;for(;++i<e.length;){const S=e[i],E=S[1];S[0]==="enter"?E.type==="tableHead"?(o=!1,d!==0&&(Sv(v,r,d,f,g),g=void 0,d=0),f={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",f,r]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(s=!0,p=void 0,h=[0,0,0,0],m=[0,i+1,0,0],o&&(o=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},v.add(i,0,[["enter",g,r]])),l=E.type==="tableDelimiterRow"?2:g?3:1):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(s=!1,m[2]===0&&(h[1]!==0&&(m[0]=m[1],p=pl(v,r,h,l,void 0,p),h=[0,0,0,0]),m[2]=i)):E.type==="tableCellDivider"&&(s?s=!1:(h[1]!==0&&(m[0]=m[1],p=pl(v,r,h,l,void 0,p)),h=m,m=[h[1],i,0,0])):E.type==="tableHead"?(o=!0,d=i):E.type==="tableRow"||E.type==="tableDelimiterRow"?(d=i,h[1]!==0?(m[0]=m[1],p=pl(v,r,h,l,i,p)):m[1]!==0&&(p=pl(v,r,m,l,i,p)),l=0):l&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(m[3]=i)}for(d!==0&&Sv(v,r,d,f,g),v.consume(r.events),i=-1;++i<r.events.length;){const S=r.events[i];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=T5(r.events,i))}return e}function pl(e,r,i,s,l,h){const m=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",o="tableContent";i[0]!==0&&(h.end=Object.assign({},Ss(r.events,i[0])),e.add(i[0],0,[["exit",h,r]]));const d=Ss(r.events,i[1]);if(h={type:m,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",h,r]]),i[2]!==0){const f=Ss(r.events,i[2]),g=Ss(r.events,i[3]),p={type:o,start:Object.assign({},f),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",p,r]]),s!==2){const v=r.events[i[2]],S=r.events[i[3]];if(v[1].end=Object.assign({},S[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const E=i[2]+1,C=i[3]-i[2]-1;e.add(E,C,[])}}e.add(i[3]+1,0,[["exit",p,r]])}return l!==void 0&&(h.end=Object.assign({},Ss(r.events,l)),e.add(l,0,[["exit",h,r]]),h=void 0),h}function Sv(e,r,i,s,l){const h=[],m=Ss(r.events,i);l&&(l.end=Object.assign({},m),h.push(["exit",l,r])),s.end=Object.assign({},m),h.push(["exit",s,r]),e.add(i+1,0,h)}function Ss(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const L5={name:"tasklistCheck",tokenize:O5};function M5(){return{text:{91:L5}}}function O5(e,r,i){const s=this;return l;function l(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),h)}function h(d){return yt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),m):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),m):i(d)}function m(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):i(d)}function o(d){return Me(d)?r(d):Xe(d)?e.check({tokenize:I5},r,i)(d):i(d)}}function I5(e,r,i){return rt(e,s,"whitespace");function s(l){return l===null?i(l):r(l)}}function B5(e){return C0([l5(),v5(),E5(e),A5(),M5()])}const z5={};function H5(e){const r=this,i=e||z5,s=r.data(),l=s.micromarkExtensions||(s.micromarkExtensions=[]),h=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),m=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);l.push(B5(i)),h.push(i5()),m.push(s5(i))}function P5(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 F5(e,r){if(e==null)return{};var i,s,l=P5(e,r);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(s=0;s<h.length;s++)i=h[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(l[i]=e[i])}return l}function Jd(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 U5(e){if(Array.isArray(e))return Jd(e)}function $5(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q5(e,r){if(e){if(typeof e=="string")return Jd(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)?Jd(e,r):void 0}}function W5(){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 eh(e){return U5(e)||$5(e)||q5(e)||W5()}function Ua(e){"@babel/helpers - typeof";return Ua=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},Ua(e)}function G5(e,r){if(Ua(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Ua(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function V5(e){var r=G5(e,"string");return Ua(r)=="symbol"?r:r+""}function pb(e,r,i){return(r=V5(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function th(){return th=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},th.apply(null,arguments)}function wv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function Cs(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?wv(Object(i),!0).forEach(function(s){pb(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):wv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function Y5(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 Od={};function K5(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Od[r]||(Od[r]=Y5(e)),Od[r]}function X5(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(h){return h!=="token"}),l=K5(s);return l.reduce(function(h,m){return Cs(Cs({},h),i[m])},r)}function Cv(e){return e.join(" ")}function Z5(e,r){var i=0;return function(s){return i+=1,s.map(function(l,h){return mb({node:l,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(h)})})}}function mb(e){var r=e.node,i=e.stylesheet,s=e.style,l=s===void 0?{}:s,h=e.useInlineStyles,m=e.key,o=r.properties,d=r.type,f=r.tagName,g=r.value;if(d==="text")return g;if(f){var p=Z5(i,h),v;if(!h)v=Cs(Cs({},o),{},{className:Cv(o.className)});else{var S=Object.keys(i).reduce(function(_,x){return x.split(".").forEach(function(y){_.includes(y)||_.push(y)}),_},[]),E=o.className&&o.className.includes("token")?["token"]:[],C=o.className&&E.concat(o.className.filter(function(_){return!S.includes(_)}));v=Cs(Cs({},o),{},{className:Cv(C)||void 0,style:X5(o.className,Object.assign({},o.style,l),i)})}var b=p(r.children);return ln.createElement(f,th({key:m},v),b)}}const Q5=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var J5=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function kv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),i.push.apply(i,s)}return i}function ti(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?kv(Object(i),!0).forEach(function(s){pb(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):kv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var eN=/\n/g;function tN(e){return e.match(eN)}function nN(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(l,h){var m=h+i;return ln.createElement("span",{key:"line-".concat(h),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(m):s},"".concat(m,`
|
|
120
|
-
`))})}function rN(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,l=s===void 0?{float:"left",paddingRight:"10px"}:s,h=e.numberStyle,m=h===void 0?{}:h,o=e.startingLineNumber;return ln.createElement("code",{style:Object.assign({},i,l)},nN({lines:r.replace(/\n$/,"").split(`
|
|
121
|
-
`),style:m,startingLineNumber:o}))}function iN(e){return"".concat(e.toString().length,".25em")}function gb(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 xb(e,r,i){var s={display:"inline-block",minWidth:iN(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},l=typeof e=="function"?e(r):e,h=ti(ti({},s),l);return h}function yl(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,l=e.largestLineNumber,h=e.showInlineLineNumbers,m=e.lineProps,o=m===void 0?{}:m,d=e.className,f=d===void 0?[]:d,g=e.showLineNumbers,p=e.wrapLongLines,v=e.wrapLines,S=v===void 0?!1:v,E=S?ti({},typeof o=="function"?o(i):o):{};if(E.className=E.className?[].concat(eh(E.className.trim().split(/\s+/)),eh(f)):f,i&&h){var C=xb(s,i,l);r.unshift(gb(i,C))}return p&g&&(E.style=ti({display:"flex"},E.style)),{type:"element",tagName:"span",properties:E,children:r}}function vb(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 l=e[s];if(l.type==="text")i.push(yl({children:[l],className:eh(new Set(r))}));else if(l.children){var h,m=r.concat(((h=l.properties)===null||h===void 0?void 0:h.className)||[]);vb(l.children,m).forEach(function(o){return i.push(o)})}}return i}function sN(e,r,i,s,l,h,m,o,d){var f,g=vb(e.value),p=[],v=-1,S=0;function E(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return yl({children:A,lineNumber:N,lineNumberStyle:o,largestLineNumber:m,showInlineLineNumbers:l,lineProps:i,className:R,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&l){var R=xb(o,N,m);A.unshift(gb(N,R))}return A}function b(A,N){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||R.length>0?E(A,N,R):C(A,N)}for(var _=function(){var N=g[S],R=N.children[0].value,T=tN(R);if(T){var B=R.split(`
|
|
122
|
-
`);B.forEach(function(H,G){var Y=s&&p.length+h,q={type:"text",value:"".concat(H,`
|
|
123
|
-
`)};if(G===0){var O=g.slice(v+1,S).concat(yl({children:[q],className:N.properties.className})),W=b(O,Y);p.push(W)}else if(G===B.length-1){var V=g[S+1]&&g[S+1].children&&g[S+1].children[0],Q={type:"text",value:"".concat(H)};if(V){var ee=yl({children:[Q],className:N.properties.className});g.splice(S+1,0,ee)}else{var L=[Q],D=b(L,Y,N.properties.className);p.push(D)}}else{var I=[q],U=b(I,Y,N.properties.className);p.push(U)}}),v=S}S++};S<g.length;)_();if(v!==g.length-1){var x=g.slice(v+1,g.length);if(x&&x.length){var y=s&&p.length+h,j=b(x,y);p.push(j)}}return r?p:(f=[]).concat.apply(f,p)}function aN(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(l,h){return mb({node:l,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(h)})})}function bb(e){return e&&typeof e.highlightAuto<"u"}function oN(e){var r=e.astGenerator,i=e.language,s=e.code,l=e.defaultCodeValue;if(bb(r)){var h=Q5(r,i);return i==="text"?{value:l,language:"text"}:h?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:l}}catch{return{value:l}}}function lN(e,r){return function(s){var l,h,m=s.language,o=s.children,d=s.style,f=d===void 0?r:d,g=s.customStyle,p=g===void 0?{}:g,v=s.codeTagProps,S=v===void 0?{className:m?"language-".concat(m):void 0,style:ti(ti({},f['code[class*="language-"]']),f['code[class*="language-'.concat(m,'"]')])}:v,E=s.useInlineStyles,C=E===void 0?!0:E,b=s.showLineNumbers,_=b===void 0?!1:b,x=s.showInlineLineNumbers,y=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,B=s.wrapLines,H=s.wrapLongLines,G=H===void 0?!1:H,Y=s.lineProps,q=Y===void 0?{}:Y,O=s.renderer,W=s.PreTag,V=W===void 0?"pre":W,Q=s.CodeTag,ee=Q===void 0?"code":Q,L=s.code,D=L===void 0?(Array.isArray(o)?o[0]:o)||"":L,I=s.astGenerator,U=F5(s,J5);I=I||e;var P=_?ln.createElement(rN,{containerStyle:N,codeStyle:S.style||{},numberStyle:T,startingLineNumber:A,codeString:D}):null,K=f.hljs||f['pre[class*="language-"]']||{backgroundColor:"#fff"},te=bb(I)?"hljs":"prismjs",Z=C?Object.assign({},U,{style:Object.assign({},K,p)}):Object.assign({},U,{className:U.className?"".concat(te," ").concat(U.className):te,style:Object.assign({},p)});if(G?S.style=ti({whiteSpace:"pre-wrap"},S.style):S.style=ti({whiteSpace:"pre"},S.style),!I)return ln.createElement(V,Z,P,ln.createElement(ee,S,D));(B===void 0&&O||G)&&(B=!0),O=O||aN;var X=[{type:"text",value:D}],z=oN({astGenerator:I,language:m,code:D,defaultCodeValue:X});z.language===null&&(z.value=X);var ae=(l=(h=D.match(/\n/g))===null||h===void 0?void 0:h.length)!==null&&l!==void 0?l:0,se=A+ae,ge=sN(z,B,q,_,y,A,se,T,G);return ln.createElement(V,Z,ln.createElement(ee,S,!y&&P,O({rows:ge,stylesheet:f,useInlineStyles:C})))}}const Ev=/[#.]/g;function cN(e,r){const i=e||"",s={};let l=0,h,m;for(;l<i.length;){Ev.lastIndex=l;const o=Ev.exec(i),d=i.slice(l,o?o.index:i.length);d&&(h?h==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:m=d,l+=d.length),o&&(h=o[0],l++)}return{type:"element",tagName:m||r||"div",properties:s,children:[]}}function yb(e,r,i){const s=i?fN(i):void 0;function l(h,m,...o){let d;if(h==null){d={type:"root",children:[]};const f=m;o.unshift(f)}else{d=cN(h,r);const f=d.tagName.toLowerCase(),g=s?s.get(f):void 0;if(d.tagName=g||f,uN(m))o.unshift(m);else for(const[p,v]of Object.entries(m))dN(e,d.properties,p,v)}for(const f of o)nh(d.children,f);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return l}function uN(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 l=r[s];if(l&&typeof l=="object"){if(!Array.isArray(l))return!0;const h=l;for(const m of h)if(typeof m!="number"&&typeof m!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function dN(e,r,i,s){const l=m0(e,i);let h;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;h=s}else typeof s=="boolean"?h=s:typeof s=="string"?l.spaceSeparated?h=Bx(s):l.commaSeparated?h=Rx(s):l.commaOrSpaceSeparated?h=Bx(Rx(s).join(" ")):h=jv(l,l.property,s):Array.isArray(s)?h=[...s]:h=l.property==="style"?hN(s):String(s);if(Array.isArray(h)){const m=[];for(const o of h)m.push(jv(l,l.property,o));h=m}l.property==="className"&&Array.isArray(r.className)&&(h=r.className.concat(h)),r[l.property]=h}}function nh(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)nh(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?nh(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function jv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||za(i)===za(r)))return!0}return i}function hN(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function fN(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const pN=["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"],mN=yb(g0,"div");yb(Ml,"g",pN);const gN=["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"],Nv={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 _b(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function xN(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function vN(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function Tv(e){return vN(e)||_b(e)}const bN=["","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 yN(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,l=[];let h=0,m=-1,o="",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,p=(d?d.column:0)||1,v=E(),S;for(h--;++h<=e.length;)if(S===10&&(p=(f?f[m]:0)||1),S=e.charCodeAt(h),S===38){const _=e.charCodeAt(h+1);if(_===9||_===10||_===12||_===32||_===38||_===60||Number.isNaN(_)||s&&_===s){o+=String.fromCharCode(S),p++;continue}const x=h+1;let y=x,j=x,A;if(_===35){j=++y;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++y):A="decimal"}else A="named";let N="",R="",T="";const B=A==="named"?Tv:A==="decimal"?_b:xN;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!B(q))break;T+=String.fromCharCode(q),A==="named"&&gN.includes(T)&&(N=T,R=Pa(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?Pa(T):!1;q&&(N=T,R=q)}let G=1+j-x,Y="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,G);else if(A==="named"){if(H&&!R)C(5,1);else if(N!==T&&(j=y+N.length,G=1+j-y,H=!1),!H){const q=N?1:3;if(i.attribute){const O=e.charCodeAt(j);O===61?(C(q,G),R=""):Tv(O)?R="":C(q,G)}else C(q,G)}Y=R}else{H||C(2,G);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(_N(q))C(7,G),Y="�";else if(q in Nv)C(6,G),Y=Nv[q];else{let O="";SN(q)&&C(6,G),q>65535&&(q-=65536,O+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),Y=O+String.fromCharCode(q)}}if(Y){b(),v=E(),h=j-1,p+=j-x+1,l.push(Y);const q=E();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:v,end:q},e.slice(x-1,j)),v=q}else T=e.slice(x-1,j),o+=T,p+=T.length,h=j-1}else S===10&&(g++,m++,p=0),Number.isNaN(S)?b():(o+=String.fromCharCode(S),p++);return l.join("");function E(){return{line:g,column:p,offset:h+((d?d.offset:0)||0)}}function C(_,x){let y;i.warning&&(y=E(),y.column+=x,y.offset+=x,i.warning.call(i.warningContext||void 0,bN[_],y,_))}function b(){o&&(l.push(o),i.text&&i.text.call(i.textContext||void 0,o,{start:v,end:E()}),o="")}}function _N(e){return e>=55296&&e<=57343||e>1114111}function SN(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 wN=0,ml={},Wt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++wN}),e.__id},clone:function e(r,i){i=i||{};var s,l;switch(Wt.util.type(r)){case"Object":if(l=Wt.util.objId(r),i[l])return i[l];s={},i[l]=s;for(var h in r)r.hasOwnProperty(h)&&(s[h]=e(r[h],i));return s;case"Array":return l=Wt.util.objId(r),i[l]?i[l]:(s=[],i[l]=s,r.forEach(function(m,o){s[o]=e(m,i)}),s);default:return r}}},languages:{plain:ml,plaintext:ml,text:ml,txt:ml,extend:function(e,r){var i=Wt.util.clone(Wt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Wt.languages;var l=s[e],h={};for(var m in l)if(l.hasOwnProperty(m)){if(m==r)for(var o in i)i.hasOwnProperty(o)&&(h[o]=i[o]);i.hasOwnProperty(m)||(h[m]=l[m])}var d=s[e];return s[e]=h,Wt.languages.DFS(Wt.languages,function(f,g){g===d&&f!=e&&(this[f]=h)}),h},DFS:function e(r,i,s,l){l=l||{};var h=Wt.util.objId;for(var m in r)if(r.hasOwnProperty(m)){i.call(r,m,r[m],s||m);var o=r[m],d=Wt.util.type(o);d==="Object"&&!l[h(o)]?(l[h(o)]=!0,e(o,i,null,l)):d==="Array"&&!l[h(o)]&&(l[h(o)]=!0,e(o,i,m,l))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Wt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Wt.tokenize(s.code,s.grammar),Wt.hooks.run("after-tokenize",s),Ba.stringify(Wt.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 l=new CN;return _l(l,l.head,e),Sb(e,l,r,l.head,0),EN(l)},hooks:{all:{},add:function(e,r){var i=Wt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Wt.hooks.all[e];if(!(!i||!i.length))for(var s=0,l;l=i[s++];)l(r)}},Token:Ba};function Ba(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function Av(e,r,i,s){e.lastIndex=r;var l=e.exec(i);if(l&&s&&l[1]){var h=l[1].length;l.index+=h,l[0]=l[0].slice(h)}return l}function Sb(e,r,i,s,l,h){for(var m in i)if(!(!i.hasOwnProperty(m)||!i[m])){var o=i[m];o=Array.isArray(o)?o:[o];for(var d=0;d<o.length;++d){if(h&&h.cause==m+","+d)return;var f=o[d],g=f.inside,p=!!f.lookbehind,v=!!f.greedy,S=f.alias;if(v&&!f.pattern.global){var E=f.pattern.toString().match(/[imsuy]*$/)[0];f.pattern=RegExp(f.pattern.source,E+"g")}for(var C=f.pattern||f,b=s.next,_=l;b!==r.tail&&!(h&&_>=h.reach);_+=b.value.length,b=b.next){var x=b.value;if(r.length>e.length)return;if(!(x instanceof Ba)){var y=1,j;if(v){if(j=Av(C,_,e,p),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=_;for(N+=b.value.length;T>=N;)b=b.next,N+=b.value.length;if(N-=b.value.length,_=N,b.value instanceof Ba)continue;for(var R=b;R!==r.tail&&(N<A||typeof R.value=="string");R=R.next)y++,N+=R.value.length;y--,x=e.slice(_,N),j.index-=_}else if(j=Av(C,0,x,p),!j)continue;var T=j.index,B=j[0],H=x.slice(0,T),G=x.slice(T+B.length),Y=_+x.length;h&&Y>h.reach&&(h.reach=Y);var q=b.prev;H&&(q=_l(r,q,H),_+=H.length),kN(r,q,y);var O=new Ba(m,g?Wt.tokenize(B,g):B,S,B);if(b=_l(r,q,O),G&&_l(r,b,G),y>1){var W={cause:m+","+d,reach:Y};Sb(e,r,i,b.prev,_,W),h&&W.reach>h.reach&&(h.reach=W.reach)}}}}}}function CN(){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 _l(e,r,i){var s=r.next,l={value:i,prev:r,next:s};return r.next=l,s.prev=l,e.length++,l}function kN(e,r,i){for(var s=r.next,l=0;l<i&&s!==e.tail;l++)s=s.next;r.next=s,s.prev=r,e.length-=l}function EN(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const wb=Wt;function Cb(){}Cb.prototype=wb;const Ut=new Cb;Ut.highlight=jN;Ut.register=NN;Ut.alias=TN;Ut.registered=AN;Ut.listLanguages=DN;Ut.util.encode=RN;Ut.Token.stringify=rh;function jN(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(Ut.languages,s))i=Ut.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:wb.highlight.call(Ut,e,i,s)}}function NN(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Ut.languages,e.displayName)||e(Ut)}function TN(e,r){const i=Ut.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let l;for(l in s)if(Object.hasOwn(s,l)){const h=s[l],m=typeof h=="string"?[h]:h;let o=-1;for(;++o<m.length;)i[m[o]]=i[l]}}function AN(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Ut.languages,e)}function DN(){const e=Ut.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function rh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let l=-1;for(;++l<e.length;)e[l]!==null&&e[l]!==void 0&&e[l]!==""&&s.push(rh(e[l],r));return s}const i={attributes:{},classes:["token",e.type],content:rh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Ut.hooks.run("wrap",i),mN(i.tag+"."+i.classes.join("."),LN(i.attributes),i.content)}function RN(e){return e}function LN(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=yN(e[r]));return e}var mt=lN(Ut,{});mt.registerLanguage=function(e,r){return Ut.register(r)};mt.alias=function(e,r){return Ut.alias(e,r)};Di.displayName="markup";Di.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Di(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(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var l={};l["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},l.cdata=/^<!\[CDATA\[|\]\]>$/i;var h={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:l}};h["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var m={};m[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:h},e.languages.insertBefore("markup","cdata",m)}}),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}Pl.displayName="css";Pl.aliases=[];function Pl(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)}Ri.displayName="clike";Ri.aliases=[];function Ri(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:/[{}[\];(),.:]/}}Ka.displayName="javascript";Ka.aliases=["js"];function Ka(e){e.register(Ri),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}Nh.displayName="sql";Nh.aliases=[];function Nh(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:/[;[\]()`,.]/}}Fl.displayName="c";Fl.aliases=[];function Fl(e){e.register(Ri),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}Th.displayName="cpp";Th.aliases=[];function Th(e){e.register(Fl),(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)}Ah.displayName="bash";Ah.aliases=["sh","shell"];function Ah(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},l={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:l},{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:l},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:l.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:l.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 h=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],m=l.variable[1].inside,o=0;o<h.length;o++)m[h[o]]=r.languages.bash[h[o]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Dh.displayName="yaml";Dh.aliases=["yml"];function Dh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,l="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",h=/(?:[^\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}),m=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(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 l}).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 l})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return l}).replace(/<<key>>/g,function(){return"(?:"+h+"|"+m+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\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:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(m),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?: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)}Rh.displayName="markdown";Rh.aliases=["md"];function Rh(e){e.register(Di),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(o){return o=o.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var l=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,h=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return l}),m=/\|?[ \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("^"+h+m+"(?:"+h+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+h+m+")(?:"+h+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(l),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+h+")"+m+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+h+"$"),inside:{"table-header":{pattern:RegExp(l),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(o){["url","bold","italic","strike","code-snippet"].forEach(function(d){o!==d&&(r.languages.markdown[o].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var g=0,p=f.length;g<p;g++){var v=f[g];if(v.type!=="code"){d(v.content);continue}var S=v.content[1],E=v.content[3];if(S&&E&&S.type==="code-language"&&E.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 b="language-"+C;E.alias?typeof E.alias=="string"?E.alias=[E.alias,b]:E.alias.push(b):E.alias=[b]}}}d(o.tokens)}),r.hooks.add("wrap",function(o){if(o.type==="code-block"){for(var d="",f=0,g=o.classes.length;f<g;f++){var p=o.classes[f],v=/language-(.+)/.exec(p);if(v){d=v[1];break}}var S=r.languages[d];if(S)o.content=r.highlight(o.content.value,S,d);else if(d&&d!=="none"&&r.plugins.autoloader){var E="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);o.attributes.id=E,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(E);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)}Lh.displayName="ruby";Lh.aliases=["rb"];function Lh(e){e.register(Ri),(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("|")+")",l=/(?:"(?:\\.|[^"\\\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+l),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+l+/(?=:(?!:))/.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)}Mh.displayName="diff";Mh.aliases=[];function Mh(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 l=i[s],h=[];/^\w+$/.test(s)||h.push(/\w+/.exec(s)[0]),s==="diff"&&h.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+l+`].*(?:\r
|
|
124
|
-
?|
|
|
125
|
-
|(?![\\s\\S])))+`,"m"),alias:h,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)}Oh.displayName="docker";Oh.aliases=["dockerfile"];function Oh(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}),l=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,h=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return l}),m={pattern:RegExp(l),greedy:!0},o={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(f,g){return f=f.replace(/<OPT>/g,function(){return h}).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:[m,{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:o,string:m,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:o},r.languages.dockerfile=r.languages.docker})(e)}Ih.displayName="go";Ih.aliases=[];function Ih(e){e.register(Ri),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"]}Bh.displayName="graphql";Bh.aliases=[];function Bh(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(b){return typeof b!="string"&&b.type!=="comment"&&b.type!=="scalar"}),l=0;function h(b){return s[l+b]}function m(b,_){_=_||0;for(var x=0;x<b.length;x++){var y=h(x+_);if(!y||y.type!==b[x])return!1}return!0}function o(b,_){for(var x=1,y=l;y<s.length;y++){var j=s[y],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(b.test(A))x++;else if(_.test(A)&&(x--,x===0))return y}}return-1}function d(b,_){var x=b.alias;x?Array.isArray(x)||(b.alias=x=[x]):b.alias=x=[],x.push(_)}for(;l<s.length;){var f=s[l++];if(f.type==="keyword"&&f.content==="mutation"){var g=[];if(m(["definition-mutation","punctuation"])&&h(1).content==="("){l+=2;var p=o(/^\($/,/^\)$/);if(p===-1)continue;for(;l<p;l++){var v=h(0);v.type==="variable"&&(d(v,"variable-input"),g.push(v.content))}l=p+1}if(m(["punctuation","property-query"])&&h(0).content==="{"&&(l++,d(h(0),"property-mutation"),g.length>0)){var S=o(/^\{$/,/^\}$/);if(S===-1)continue;for(var E=l;E<S;E++){var C=s[E];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}zh.displayName="scss";zh.aliases=[];function zh(e){e.register(Pl),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}Hh.displayName="json";Hh.aliases=["webmanifest"];function Hh(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}Ph.displayName="java";Ph.aliases=[];function Ph(e){e.register(Ri),(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,l={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":[l,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:l.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:l.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":l,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:l.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:l.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)}Ul.displayName="typescript";Ul.aliases=["ts"];function Ul(e){e.register(Ka),(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)}Fh.displayName="python";Fh.aliases=["py"];function Fh(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://,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}$l.displayName="jsx";$l.aliases=[];function $l(e){e.register(Ka),e.register(Di),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,l=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,h=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function m(f,g){return f=f.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return l}).replace(/<SPREAD>/g,function(){return h}),RegExp(f,g)}h=m(h).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=m(/<\/?(?:[\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:m(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:m(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var o=function(f){return f?typeof f=="string"?f:typeof f.content=="string"?f.content:f.content.map(o).join(""):""},d=function(f){for(var g=[],p=0;p<f.length;p++){var v=f[p],S=!1;if(typeof v!="string"&&(v.type==="tag"&&v.content[0]&&v.content[0].type==="tag"?v.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===o(v.content[0].content[1])&&g.pop():v.content[v.content.length-1].content==="/>"||g.push({tagName:o(v.content[0].content[1]),openedBraces:0}):g.length>0&&v.type==="punctuation"&&v.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&v.type==="punctuation"&&v.content==="}"?g[g.length-1].openedBraces--:S=!0),(S||typeof v=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var E=o(v);p<f.length-1&&(typeof f[p+1]=="string"||f[p+1].type==="plain-text")&&(E+=o(f[p+1]),f.splice(p+1,1)),p>0&&(typeof f[p-1]=="string"||f[p-1].type==="plain-text")&&(E=o(f[p-1])+E,f.splice(p-1,1),p--),f[p]=new r.Token("plain-text",E,null,E)}v.content&&typeof v.content!="string"&&d(v.content)}};r.hooks.add("after-tokenize",function(f){f.language!=="jsx"&&f.language!=="tsx"||d(f.tokens)})})(e)}Uh.displayName="tsx";Uh.aliases=[];function Uh(e){e.register($l),e.register(Ul),(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)}$h.displayName="rust";$h.aliases=[];function $h(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)}qh.displayName="toml";qh.aliases=[];function qh(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(l){return l.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 Sl={'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%)"}};mt.registerLanguage("typescript",Ul);mt.registerLanguage("javascript",Ka);mt.registerLanguage("tsx",Uh);mt.registerLanguage("jsx",$l);mt.registerLanguage("python",Fh);mt.registerLanguage("bash",Ah);mt.registerLanguage("json",Hh);mt.registerLanguage("css",Pl);mt.registerLanguage("html",Di);mt.registerLanguage("markup",Di);mt.registerLanguage("xml",Di);mt.registerLanguage("sql",Nh);mt.registerLanguage("yaml",Dh);mt.registerLanguage("markdown",Rh);mt.registerLanguage("diff",Mh);mt.registerLanguage("rust",$h);mt.registerLanguage("go",Ih);mt.registerLanguage("java",Ph);mt.registerLanguage("c",Fl);mt.registerLanguage("cpp",Th);mt.registerLanguage("ruby",Lh);mt.registerLanguage("toml",qh);mt.registerLanguage("scss",zh);mt.registerLanguage("graphql",Bh);mt.registerLanguage("docker",Oh);const MN={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
|
|
126
|
-
`))return c.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...i,children:r});const h=(s==null?void 0:s[1])||"text",m=String(r).replace(/\n$/,""),[o,d]=F.useState(!1),f=async()=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(m);else{const g=document.createElement("textarea");g.value=m,g.style.position="fixed",g.style.left="-9999px",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}d(!0),setTimeout(()=>d(!1),2e3)}catch(g){console.error("Failed to copy:",g)}};return c.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[c.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:[c.jsx("span",{children:h}),c.jsx("button",{type:"button",onClick:g=>{g.preventDefault(),g.stopPropagation(),f()},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:o?c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]}),c.jsx("div",{className:"overflow-x-auto",children:c.jsx(mt,{style:Sl,language:h,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:m})})]})},p({children:e}){return c.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return c.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return c.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return c.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return c.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return c.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return c.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 c.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 c.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return c.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return c.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 c.jsx("div",{className:"overflow-x-auto my-1.5",children:c.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return c.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 c.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return c.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return c.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},Ds=F.memo(function({content:r,className:i=""}){const s=F.useMemo(()=>{let l=ON(r);return l=IN(l),l},[r]);return c.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:c.jsx(EE,{remarkPlugins:[H5],components:MN,children:s})})});function ON(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function IN(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const l=e.lastIndexOf("```");return e.slice(l+3).includes(`
|
|
127
|
-
`),e+"\n```"}return e}const BN=F.memo(function({content:r,variant:i="default"}){return i==="labeled"?c.jsxs("div",{className:"text-text-muted text-sm italic feed-item",children:[c.jsx("span",{className:"text-purple-400",children:"thinking:"}),c.jsx("div",{className:"ml-1.5 mt-0.5",children:c.jsx(Ds,{content:r})})]}):c.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 kb({tool:e,className:r="w-4 h-4 text-text-muted flex-shrink-0"}){return e==="glob"||e==="grep"?c.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"?c.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}):c.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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 zN={...Sl,'pre[class*="language-"]':{...Sl['pre[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflowX:"hidden"},'code[class*="language-"]':{...Sl['code[class*="language-"]'],background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"}},HN={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 ql(e){var l;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=(l=r.split(".").pop())==null?void 0:l.toLowerCase();return s?HN[s]??"text":"text"}const Eb={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},PN={...Eb,display:"inline"},FN={margin:0,padding:0,borderRadius:0,fontSize:"0.875rem",lineHeight:"1.5rem",background:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word"},$a=F.memo(function({code:r,language:i,variant:s}){const l=s==="inline"?"span":s==="block-nowrap"?"div":"pre",h=s==="inline"?PN:s==="block-nowrap"?Eb:FN;return c.jsx(mt,{style:zN,language:i,PreTag:l,customStyle:h,children:r})});function jb({src:e,alt:r,isOpen:i,onClose:s}){const l=F.useRef(null);F.useEffect(()=>{if(!i)return;const m=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,s]);const h=m=>{m.target===m.currentTarget&&s()};return i?c.jsx("div",{ref:l,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:h,role:"dialog","aria-modal":"true","aria-label":"Image viewer",children:c.jsxs("div",{className:"relative max-w-[95vw] max-h-[95vh] flex items-center justify-center",children:[c.jsx("button",{onClick:s,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors p-2","aria-label":"Close image viewer",children:c.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),c.jsx("img",{src:e,alt:r,className:"max-w-full max-h-[90vh] object-contain rounded-lg shadow-2xl"})]})}):null}const UN=F.memo(function({oldString:r,newString:i,filePath:s}){const l=F.useMemo(()=>ql(s),[s]),h=r.split(`
|
|
128
|
-
`),m=i.split(`
|
|
129
|
-
`),o=r.length>0,d=i.length>0;return!o&&!d?c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):c.jsxs("div",{className:"rounded overflow-hidden border border-border grid grid-cols-[3px_1.5rem_1fr]",children:[o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"bg-red-400/60"}),c.jsx("div",{className:"bg-red-950/30 text-red-400/70 text-sm font-mono text-center",children:h.map((f,g)=>c.jsx("div",{className:"leading-[1.5rem]",children:"-"},g))}),c.jsx("div",{className:"bg-red-950/30 pr-2 line-through decoration-red-400/30 overflow-x-auto min-w-0",children:c.jsx($a,{code:r,language:l,variant:"block-nowrap"})})]}),d&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"bg-green-400/60"}),c.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:m.map((f,g)=>c.jsx("div",{className:"leading-[1.5rem]",children:"+"},g))}),c.jsx("div",{className:"bg-green-950/30 pr-2 overflow-x-auto min-w-0",children:c.jsx($a,{code:i,language:l,variant:"block-nowrap"})})]})]})}),$N=F.memo(function({content:r,filePath:i}){const s=F.useMemo(()=>ql(i),[i]);return c.jsx("div",{className:"rounded overflow-hidden border border-border max-h-[45vh] overflow-y-auto",children:c.jsxs("div",{className:"grid grid-cols-[3px_1.5rem_1fr]",children:[c.jsx("div",{className:"bg-green-400/60"}),c.jsx("div",{className:"bg-green-950/30 text-green-400/70 text-sm font-mono text-center",children:r.split(`
|
|
130
|
-
`).map((l,h)=>c.jsx("div",{className:"leading-[1.5rem]",children:"+"},h))}),c.jsx("div",{className:"bg-green-950/30 pr-2 min-w-0 overflow-x-hidden",children:c.jsx($a,{code:r,language:s,variant:"block"})})]})})}),qN=F.memo(function({regions:r,filePath:i}){const s=F.useMemo(()=>ql(i),[i]);return r.length===0?c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"No changes"}):c.jsx("div",{className:"space-y-2",children:r.map((l,h)=>c.jsx(WN,{region:l,language:s},h))})}),WN=F.memo(function({region:r,language:i}){const s=GN(r),l=Math.max(...r.beforeContext.map(m=>m.lineNumber),...r.afterContext.map(m=>m.lineNumber),...r.edits.flatMap(m=>[m.startLine,m.endLine])),h=String(l).length;return c.jsx("div",{className:"rounded overflow-hidden border border-border font-mono text-sm",children:s.map((m,o)=>c.jsx(VN,{item:m,language:i,lineNumWidth:h},o))})});function GN(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 h=0;h<s.length;h++)r.push({type:"removed",lineNumber:i.startLine+h,content:s[h]});const l=i.newContent.split(`
|
|
132
|
-
`);for(let h=0;h<l.length;h++)r.push({type:"added",lineNumber:i.startLine+h,content:l[h]})}for(const i of e.afterContext)r.push({type:"context",lineNumber:i.lineNumber,content:i.content});return r}const VN=F.memo(function({item:r,language:i,lineNumWidth:s}){const l=String(r.lineNumber).padStart(s," "),h=r.type==="context"?"bg-bg-secondary":r.type==="removed"?"bg-red-950/30":"bg-green-950/30",m=r.type==="context"?"text-text-muted":r.type==="removed"?"text-red-400/70":"text-green-400/70",o=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 c.jsxs("div",{className:`grid grid-cols-[3px_auto_1.25rem_1fr] ${h}`,children:[c.jsx("div",{className:f}),c.jsx("div",{className:"px-2 text-text-muted text-right select-none leading-[1.5rem]",children:l}),c.jsx("div",{className:`text-center select-none leading-[1.5rem] ${m}`,children:o}),c.jsx("div",{className:`pr-2 overflow-x-auto min-w-0 ${d}`,children:c.jsx($a,{code:r.content||" ",language:i,variant:"inline"})})]})}),YN=F.memo(function({result:r,metadata:i,filePath:s,heightExpanded:l=!1}){const[h,m]=F.useState(!1),o=F.useMemo(()=>ql(s),[s]),d=i==null?void 0:i.mimeType,f=i==null?void 0:i.base64Data;if(d!=null&&d.startsWith("image/")&&f){const v=`data:${d};base64,${f}`;return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} flex items-center justify-center cursor-pointer hover:border-accent-primary transition-colors`,onClick:()=>m(!0),children:c.jsx("img",{src:v,alt:s,className:"max-w-full max-h-[45vh] object-contain"})}),c.jsx(jb,{src:v,alt:s,isOpen:h,onClose:()=>m(!1)})]})}if(!r)return c.jsx("div",{className:"text-xs text-text-muted italic p-2",children:"Empty file"});const g=r.split(`
|
|
133
|
-
`),p=g.filter(v=>!v.startsWith(`
|
|
134
|
-
[`)&&!v.startsWith("[")).map(v=>v.replace(/^\d+: /,"")).join(`
|
|
135
|
-
`);return c.jsx("div",{className:`rounded overflow-hidden border border-border ${l?"":"max-h-[45vh]"} overflow-y-auto`,children:c.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[c.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(v=>!v.startsWith(`
|
|
136
|
-
[`)&&!v.startsWith("[")).map((v,S)=>{const E=v.match(/^(\d+): /);return c.jsx("div",{className:"leading-[1.5rem]",children:E?E[1]:S+1},S)})}),c.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:c.jsx($a,{code:p,language:o,variant:"block"})})]})})}),KN={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"}},Dv=F.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(h=>h.severity==="error"),s=r.filter(h=>h.severity==="warning"),l=r.filter(h=>h.severity==="info"||h.severity==="hint");return c.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[c.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[c.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&c.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&c.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),l.length>0&&c.jsxs("span",{className:"text-xs text-text-muted",children:[l.length," info"]})]}),c.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((h,m)=>{const o=KN[h.severity];return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${o.bg} border-b border-border last:border-b-0`,children:[c.jsx("span",{className:`${o.color} text-xs flex-shrink-0 w-4 text-center`,children:o.icon}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",h.range.start.line+1,":",h.range.start.character+1]}),h.code&&c.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",h.code,"]"]})]}),c.jsx("div",{className:"text-xs text-text-primary break-words",children:h.message})]})]},m)})})]})}),XN=F.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:l,status:h,result:m,error:o,durationMs:d}){const f=F.useRef(null),[g,p]=F.useState(0);F.useEffect(()=>{f.current&&h==="pending"&&(f.current.scrollTop=f.current.scrollHeight)},[l,h]),F.useEffect(()=>{if(h!=="pending"||!s)return;const C=setInterval(()=>{p(Date.now()-s)},100);return()=>clearInterval(C)},[h,s]);const v=i/1e3,S=h==="pending"?g/1e3:(d??0)/1e3,E=h==="pending"?(l==null?void 0:l.map(C=>C.content).join(""))??"":m??"";return c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[c.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),c.jsx("code",{className:"text-text-primary break-all",children:r})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[h==="pending"&&c.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),h==="interrupted"&&c.jsx("span",{className:"text-red-400",children:"interrupted"}),c.jsxs("span",{className:h==="pending"?"text-text-secondary":"text-text-muted",children:[S.toFixed(1),"s / ",v,"s"]})]})]}),h==="pending"&&c.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:c.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(E||h==="pending")&&c.jsx("pre",{ref:f,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${h==="pending"?"border border-accent-warning/30":""}`,children:h==="pending"&&l?l.map((C,b)=>c.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Cl(C.content)},b)):Cl(E)}),h==="error"&&o&&c.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:o}),h!=="pending"&&d!==void 0&&c.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function ZN(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 QN({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:l,description:h}=ZN(e.reason),m=e.reason==="sensitive_file"||e.reason==="both",o=m?"border-red-500/50":"border-amber-500/50",d=m?"bg-red-500/10":"bg-amber-500/10",f=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return c.jsxs("div",{className:`border ${o} ${d} rounded p-3 my-2`,children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("svg",{className:`w-4 h-4 ${m?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:`text-sm font-medium ${m?"text-red-400":"text-amber-400"}`,children:l}),c.jsx("div",{className:"text-xs text-text-muted",children:h})]})]}),c.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[c.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),c.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:c.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,p)=>c.jsx("li",{className:`text-xs font-mono ${m?"text-red-300":"text-amber-300"} break-all`,children:g},p))})}),c.jsxs("div",{className:"flex gap-2",children:[c.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"}),c.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"}),c.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 JN(e,r){if(e==="read_file"){const s=String(r.path??""),l=r.offset,h=r.limit,m=[];return l!==void 0&&l!==1&&m.push(`offset=${l}`),h!==void 0&&m.push(`limit=${h}`),m.length>0?`${s} [${m.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 Rv(e,r,i){return JN(e,r)}function e3(e){return JSON.stringify(e,null,2)}const t3={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}},n3=F.memo(function({tool:r,args:i,status:s,variant:l="compact",result:h,error:m,durationMs:o,diagnostics:d,editContext:f,startedAt:g,streamingOutput:p,metadata:v,callId:S}){const E=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",b=r==="read_file",_=r==="return_value",[x,y]=F.useState(E||C||_),j=t3[s],A=Ee(R=>R.pendingPathConfirmation),N=s==="pending"&&A&&S&&A.callId===S?A:null;return l==="compact"?c.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[c.jsx(kb,{tool:r}),c.jsx("span",{className:"text-accent-primary font-medium",children:r}),c.jsx("span",{className:"text-text-muted truncate flex-1",children:Rv(r,i)}),c.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):c.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[c.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>y(!x),children:[c.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),c.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),c.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Rv(r,i)}),c.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&c.jsx(QN,{confirmation:N}),(x||b)&&c.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&c.jsx(XN,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:p,status:s,result:h,error:m,durationMs:o}),r==="edit_file"&&s==="success"&&c.jsxs(c.Fragment,{children:[f&&f.regions.length>0?c.jsx(qN,{regions:f.regions,filePath:String(i.path??"")}):c.jsx(UN,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),d&&d.length>0&&c.jsx(Dv,{diagnostics:d})]}),r==="write_file"&&s==="success"&&c.jsxs(c.Fragment,{children:[c.jsx($N,{content:String(i.content??""),filePath:String(i.path??"")}),d&&d.length>0&&c.jsx(Dv,{diagnostics:d})]}),r==="read_file"&&s==="success"&&c.jsx(YN,{result:h,metadata:v,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const R=(p==null?void 0:p.map(B=>B.content).join(""))??"",T=s==="pending"&&R?R:String(i.content??"");return c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),c.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:c.jsx(Ds,{content:T})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:e3(i)})]}),s==="success"&&h!==void 0&&c.jsxs("div",{children:[c.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",o!==void 0&&` (${o}ms)`,":"]}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:h||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&o!==void 0&&c.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",o,"ms"]}),s==="error"&&m&&r!=="run_command"&&c.jsxs("div",{children:[c.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),c.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:m})]})]})]})}),r3={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 i3(e){return r3[e]??`Preparing ${e}`}const s3=F.memo(function({name:r}){const i=i3(r);return c.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:c.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[c.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),c.jsx(kb,{tool:r}),c.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),c.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),a3={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},o3=F.memo(function({todos:r}){return Array.isArray(r)?r.length===0?c.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):c.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[c.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:c.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),c.jsx("div",{children:r.map((i,s)=>{const l=a3[i.status];return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[c.jsx("span",{className:`${(l==null?void 0:l.color)??"text-text-muted"} ${l!=null&&l.animate?"animate-pulse":""} text-sm leading-tight`,children:(l==null?void 0:l.icon)??"○"}),c.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):c.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Lv={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"}},Nb=F.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(l=>[l.id,l]))??[]);return c.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[c.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:c.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),c.jsx("div",{children:r.map((l,h)=>{const m=l.arguments.action,o=m&&Lv[m]?Lv[m]:{icon:"○",color:"text-text-muted"},d=l.arguments,f=d.id,g=d.description,p=f?s.get(f):void 0,v=g??(p==null?void 0:p.description)??"Criterion updated",S=d.reason,E=m==="remove",C=m==="fail";return c.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${h>0?"border-t border-border":""}`,children:[c.jsx("span",{className:`${o.color} text-sm leading-tight flex-shrink-0`,children:o.icon}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:E?"line-through text-text-muted":"",children:c.jsx(Ds,{content:v})}),S&&c.jsxs("div",{className:`mt-1 text-sm ${C?"text-accent-error":"text-text-muted"}`,children:[c.jsx("span",{className:"text-text-muted",children:"└ "}),'"',S,'"']})]})]},l.id??h)})})]})});function l3(e){return e==="criterion"}const c3="#6b7280";function Tl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??c3}const rn=Xn((e,r)=>({agents:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await Se("/api/agents/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchAgents:async()=>{e({loading:!0});try{const s=await(await Se("/api/agents")).json();e({agents:s.agents??[],defaultIds:s.defaultIds??r().defaultIds,modifiedIds:s.modifiedIds??[],loading:!1})}catch{e({loading:!1})}},fetchAgent:async i=>{try{const s=await Se(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{try{const s=await Se("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchAgents(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateAgent:async(i,s)=>{try{const l=await Se(`/api/agents/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await r().fetchAgents(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteAgent:async i=>{try{return(await Se(`/api/agents/${i}`,{method:"DELETE"})).ok?(e({agents:r().agents.filter(l=>l.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await Se(`/api/agents/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await Se("/api/agents/restore-all-defaults",{method:"POST"})).ok?(await r().fetchAgents(),!0):!1}catch{return!1}}}));function u3(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const l of e)l.type==="tool_call"&&l3(l.toolCall.name)?i.push(l.toolCall):(s(),r.push(l));return s(),r}function d3(e,r){if(e.segments&&e.segments.length>0)return h3(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 h3(e,r,i,s,l){const h=[],m=new Map(r.map(o=>[o.id,o]));for(const o of e)switch(o.type){case"text":h.push({type:"text",content:o.content});break;case"thinking":o.content&&o.content.trim().length>0&&h.push({type:"thinking",content:o.content});break;case"tool_call":{const d=m.get(o.toolCallId);d&&h.push({type:"tool_call",toolCall:d});break}}for(const o of i)h.push({type:"preparing_tool_call",preparing:o});return l&&s&&h.push({type:"stats",stats:s}),h}const Wh=F.memo(function({message:r,showStats:i=!0}){const s=Ee(o=>{var d;return(d=o.currentSession)==null?void 0:d.criteria}),l=rn(o=>o.agents),h=d3(r,i),m=u3(h);return m.length===0?null:c.jsx("div",{className:"feed-item",children:c.jsxs("div",{className:"min-w-0",children:[m.map((o,d)=>{var f,g;switch(o.type){case"thinking":return c.jsx(BN,{content:o.content},d);case"text":return c.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:c.jsx(Ds,{content:o.content})},d);case"preparing_tool_call":return c.jsx(s3,{name:o.preparing.name},`preparing-${o.preparing.index}`);case"tool_call":{const p=o.toolCall,v=p.result;if(p.name==="todo_write"){const C=p.arguments.todos,b=Array.isArray(C)?C:[];return c.jsx(o3,{todos:b},d)}const S=(f=v==null?void 0:v.output)==null?void 0:f.includes("[interrupted by user]"),E=v?S?"interrupted":v.success?"success":"error":"pending";return c.jsx(n3,{tool:p.name,args:p.arguments,status:E,variant:"expandable",result:v==null?void 0:v.output,error:v==null?void 0:v.error,durationMs:v==null?void 0:v.durationMs,diagnostics:v==null?void 0:v.diagnostics,editContext:v==null?void 0:v.editContext,startedAt:p.startedAt,streamingOutput:p.streamingOutput,metadata:v==null?void 0:v.metadata,callId:p.id},d)}case"criteria_group":return c.jsx(Nb,{toolCalls:o.toolCalls,criteria:s},d);case"stats":{const p=o.stats,v=((g=p.model.split("/").pop())==null?void 0:g.split("-").slice(0,2).join("-"))??p.model,S=Tl(l,p.mode),E=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toString(),C=b=>b>=1e3?`${(b/1e3).toFixed(1)}k`:b.toFixed(1);return c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[c.jsx("span",{className:"flex-1 h-px bg-border"}),c.jsx("span",{className:"text-text-secondary",children:v}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsx("span",{style:{color:S},children:p.mode}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[p.totalTime.toFixed(1),"s"]}),p.toolTime>0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[p.toolTime.toFixed(1),"s tools"]})]}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[E(p.prefillTokens)," @ ",C(p.prefillSpeed)," pp"]}),c.jsx("span",{className:"text-text-muted",children:"·"}),c.jsxs("span",{children:[E(p.generationTokens)," @ ",C(p.generationSpeed)," tg"]}),c.jsx("span",{className:"flex-1 h-px bg-border"})]},d)}}}),r.partial&&c.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[c.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{children:"Aborted"})]})]})})}),Vt=Xn((e,r)=>({workflows:[],defaultIds:[],modifiedIds:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Se("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchDefaultIds:async()=>{try{const s=await(await Se("/api/workflows/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Se("/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 Se(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{try{const s=await Se("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateWorkflow:async(i,s)=>{try{const l=await Se(`/api/workflows/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteWorkflow:async i=>{try{return(await Se(`/api/workflows/${i}`,{method:"DELETE"})).ok?(e({workflows:r().workflows.filter(l=>l.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await Se(`/api/workflows/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await Se("/api/workflows/restore-all-defaults",{method:"POST"})).ok?(await r().fetchWorkflows(),!0):!1}catch{return!1}}}));function f3(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 p3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Mv(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${l},${r})`}const m3=F.memo(function({data:r}){var l;const s=((l=Vt(h=>h.workflows).find(h=>h.id===r.workflowId))==null?void 0:l.color)??r.workflowColor??"#8b949e";return c.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Mv(s,.3),backgroundColor:Mv(s,.08)},children:[c.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:s,viewBox:"0 0 24 24",children:c.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"})}),c.jsx("span",{className:"text-sm font-medium",style:{color:s},children:r.workflowName??"Task Completed"})]}),c.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[c.jsx(Ra,{label:"Iterations",value:String(r.iterations)}),c.jsx(Ra,{label:"Total time",value:f3(r.totalTimeSeconds)}),c.jsx(Ra,{label:"Tool calls",value:String(r.totalToolCalls)}),c.jsx(Ra,{label:"Tokens",value:p3(r.totalTokensGenerated)}),c.jsx(Ra,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ra({label:e,value:r}){return c.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[c.jsx("div",{className:"text-sm text-text-muted",children:e}),c.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}function Ov(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),l=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${l},${r})`}const g3=F.memo(function({data:r}){var l;const s=((l=Vt(h=>h.workflows).find(h=>h.id===r.workflowId))==null?void 0:l.color)??r.workflowColor??"#6b7280";return c.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Ov(s,.3),backgroundColor:Ov(s,.08)},children:[c.jsx("svg",{className:"w-3 h-3 shrink-0",fill:s,viewBox:"0 0 24 24",children:c.jsx("path",{d:"M8 5v14l11-7z"})}),c.jsx("span",{className:"text-sm font-medium",style:{color:s},children:r.workflowName}),c.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function x3({attachments:e,messageId:r}){const[i,s]=F.useState(null),l=Ee(g=>g.visionFallbackByMessage),h=Ee(g=>g.messages),m=F.useMemo(()=>{const g=h.findIndex(p=>p.id===r);if(g===-1)return null;for(let p=g+1;p<h.length;p++){const v=h[p];if(v&&v.role==="assistant")return v.id}return null},[h,r]),o=g=>{s(g)},d=()=>{s(null)},f=g=>{const p=`${r}-${g}`;if(l[p])return l[p];if(m){const v=`${m}-${g}`;return l[v]}return null};return e.length===0?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const p=f(g.id);return c.jsxs("div",{className:"relative inline-block",children:[c.jsxs("button",{onClick:()=>o(g.data),className:"group relative inline-block",title:g.filename,disabled:(p==null?void 0:p.type)==="start",children:[c.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"}),(p==null?void 0:p.type)==="start"&&c.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:c.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(p==null?void 0:p.type)==="done"&&p.description&&c.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[p.description.slice(0,200),p.description.length>200?"...":""]})]},g.id)})}),i&&c.jsx(jb,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function v3({isOpen:e,onClose:r,promptContext:i}){const[s,l]=F.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),h=m=>{l(o=>({...o,[m]:!o[m]}))};return c.jsx(un,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(bs,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>h("userMessage"),children:c.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&&c.jsx(bs,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>h("messages"),children:c.jsx("div",{className:"space-y-2",children:i.messages.map((m,o)=>c.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[c.jsx("span",{className:"font-mono text-text-primary",children:m.role}),c.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:m.source}),m.toolCallId&&c.jsx("span",{className:"font-mono",children:m.toolCallId}),m.attachments&&m.attachments.length>0&&c.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[m.attachments.length," attachment",m.attachments.length===1?"":"s"]})]}),m.attachments&&m.attachments.length>0&&c.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:m.attachments.map(d=>d.filename).join(", ")}),c.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:m.content||"(empty)"})]},`${m.role}-${o}`))})}),c.jsx(bs,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>h("tools"),children:c.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&c.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((m,o)=>c.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"font-mono text-sm text-text-primary",children:m.name}),c.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),c.jsx("div",{className:"text-sm text-text-secondary",children:m.description}),c.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(m.parameters,null,2)})]},`${m.name}-${o}`))]})}),c.jsx(bs,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>h("requestOptions"),children:c.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&&c.jsx(bs,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>h("injectedFiles"),children:c.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((m,o)=>c.jsx(b3,{file:m,expanded:s[`file-${o}`]??!1,onToggle:()=>h(`file-${o}`)},o))})}),c.jsx(bs,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>h("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:c.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 b3({file:e,expanded:r,onToggle:i}){return c.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[c.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[c.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:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),c.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}),c.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&c.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&c.jsx("div",{className:"border-t border-border/50 p-2",children:c.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function bs({title:e,expanded:r,onToggle:i,badge:s,children:l}){return c.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[c.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:c.jsxs("div",{className:"flex items-center gap-2",children:[c.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:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),c.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&c.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&c.jsx("div",{className:"p-3 border-t border-border",children:l})]})}function y3({content:e,promptContext:r,align:i="right"}){const[s,l]=F.useState(!1),[h,m]=F.useState(!1),[o,d]=F.useState(!1),f=F.useRef(null);F.useEffect(()=>{const v=S=>{f.current&&!f.current.contains(S.target)&&l(!1)};return s&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const v=document.createElement("textarea");v.value=e,v.style.position="fixed",v.style.left="-999999px",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)}d(!0),l(!1),window.setTimeout(()=>d(!1),1500)}catch(v){console.error("Failed to copy:",v)}},p=i==="right";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`flex items-start gap-1.5 ${p?"":"order-first"}`,children:[o&&c.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),c.jsxs("div",{ref:f,className:"relative",children:[c.jsx("button",{onClick:()=>l(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:c.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("circle",{cx:"12",cy:"5",r:"2"}),c.jsx("circle",{cx:"12",cy:"12",r:"2"}),c.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&c.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${p?"right-0":"left-0"}`,children:[c.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:[c.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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&&c.jsxs("button",{onClick:()=>{m(!0),l(!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:[c.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),c.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&&c.jsx(v3,{isOpen:h,onClose:()=>m(!1),promptContext:r})]})}function _3({message:e}){const[r,i]=F.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,l=(s==null?void 0:s.color)??"#6b7280",h=(s==null?void 0:s.name)??"Agent",m=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[m]??"injected",f=m==="workflow"||m==="subagent";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[c.jsx("span",{className:"flex-1 h-px bg-border"}),c.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${f?"":"cursor-pointer"}`,style:{backgroundColor:l},onClick:()=>!f&&i(!0)}),c.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:l},onClick:()=>!f&&i(!0),children:h}),c.jsx("span",{children:"·"}),c.jsx("span",{className:f?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!f&&i(!0),children:d}),c.jsx("span",{className:"flex-1 h-px bg-border"})]}),f&&c.jsx("div",{className:"flex justify-center feed-item mb-4",children:c.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${l}`},children:c.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),c.jsx(un,{isOpen:r,onClose:()=>i(!1),title:`${h} Prompt`,size:"lg",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:l}}),c.jsx("span",{className:"text-sm text-text-primary font-medium",children:h}),c.jsxs("span",{className:"text-xs text-text-muted",children:["(",m,")"]})]}),c.jsx("div",{className:"h-full min-h-96",children:c.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 S3({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",l=e.isSystemGenerated;return c.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!l&&c.jsx(y3,{content:e.content,promptContext:r,align:"right"}),c.jsxs("div",{className:`max-w-[75%] rounded p-2 ${l?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:[l&&c.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"}),c.jsx("div",{className:`whitespace-pre-wrap text-sm ${l?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&c.jsx(x3,{attachments:e.attachments,messageId:e.id})]})]})}const Tb=F.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const l=r.role==="user",h=r.role==="assistant",m=r.role==="system",o=r.role==="tool";if(h)return c.jsx(Wh,{message:r,showStats:i});if(m&&r.isCompacted)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[c.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),c.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
|
|
137
|
-
`,"")})]});if(o)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[c.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),c.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(o)return c.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[c.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),c.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 c.jsx(g3,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return c.jsx(m3,{data:d})}catch{}return r.messageKind==="context-reset"?c.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[c.jsx("div",{className:"flex-1 border-t border-border"}),c.jsx("span",{children:r.content}),c.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?c.jsx(_3,{message:r}):l?c.jsx(S3,{message:r,promptContext:s}):c.jsx("div",{className:"flex justify-start feed-item",children:c.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:c.jsx(Ds,{content:r.content})})})}),w3={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function C3(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}const k3=F.memo(function({messages:r,subAgentType:i,isStreaming:s}){const l=F.useRef(null),h=F.useRef(null),[m,o]=F.useState(!1),[d,f]=F.useState(!1),g=rn(y=>y.agents),p=F.useCallback(()=>{const y=!d;f(y),y&&setTimeout(()=>{var j;(j=l.current)==null||j.scrollIntoView({block:"start",behavior:"smooth"})},220)},[d]),v=F.useCallback(()=>{const y=h.current;y&&(y.scrollTop=y.scrollHeight)},[]),S=F.useCallback(y=>{const j=h.current;j&&(y.deltaY<0?o(!0):y.deltaY>0&&m&&requestAnimationFrame(()=>{j.scrollHeight-j.scrollTop-j.clientHeight<50&&o(!1)}))},[m]);F.useEffect(()=>{m||v()},[r,m,v]),F.useEffect(()=>{s||o(!1)},[s]);const E=g.find(y=>y.id===i),C=(E==null?void 0:E.name)??w3[i]??i,b=Tl(g,i),_=C3(b),x=r.filter(y=>y.role!=="tool");return c.jsxs("div",{ref:l,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[c.jsxs("button",{className:"w-full flex items-center justify-between px-2 py-1 text-xs font-medium border-b hover:opacity-80 transition-opacity",style:_,onClick:p,children:[c.jsx("span",{children:C}),c.jsx("span",{className:"text-[10px]",children:d?"▼":"▶"})]}),c.jsx("div",{ref:h,onWheel:S,className:`${d?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:x.map(y=>y.role==="assistant"?c.jsx(Wh,{message:y,showStats:!0},y.id):c.jsx(Tb,{message:y,isLastAssistantMessage:!1},y.id))})]})});function E3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function j3({isOpen:e,onClose:r,initialEditId:i}){const s=rn(fe=>fe.agents),l=rn(fe=>fe.modifiedIds),h=rn(fe=>fe.loading),m=rn(fe=>fe.fetchAgents),o=rn(fe=>fe.fetchAgent),d=rn(fe=>fe.createAgent),f=rn(fe=>fe.updateAgent),g=rn(fe=>fe.deleteAgent),p=rn(fe=>fe.restoreDefault),v=rn(fe=>fe.restoreAllDefaults),[S,E]=F.useState("list"),[C,b]=F.useState(null),[_,x]=F.useState(null),[y,j]=F.useState(""),[A,N]=F.useState(""),[R,T]=F.useState(""),[B,H]=F.useState(!0),[G,Y]=F.useState([]),[q,O]=F.useState("#6b7280"),[W,V]=F.useState(""),[Q,ee]=F.useState(""),[L,D]=F.useState(!1),[I,U]=F.useState(null),[P,K]=F.useState(!1),[te,Z]=F.useState([]);function X(fe){const Le=new Map;for(const Je of fe){const et=Je.indexOf(":");if(et===-1)Le.set(Je,new Set);else{const Ge=Je.slice(0,et),de=Je.slice(et+1).split(",").filter(Boolean);Le.set(Ge,new Set(de))}}return Le}function z(fe){const Le=[];for(const[Je,et]of fe)et.size===0?Le.push(Je):Le.push(`${Je}:${[...et].join(",")}`);return Le}const ae=X(G),se=(fe,Le)=>{const Je=new Map(ae),et=Je.get(fe)||new Set,Ge=new Set(et);Ge.has(Le)?Ge.delete(Le):Ge.add(Le),Ge.size===0?Je.set(fe,new Set):Je.set(fe,Ge),Y(z(Je))};F.useEffect(()=>{e&&(m(),Se("/api/tools").then(fe=>fe.json()).then(fe=>Z(fe.tools||[])).catch(()=>Z([])),x(null),U(null),K(!1),i?(E("edit"),b(i),ee(""),o(i).then(fe=>{fe&&(j(fe.metadata.name),N(fe.metadata.id),T(fe.metadata.description),H(fe.metadata.subagent),Y(fe.metadata.allowedTools),O(fe.metadata.color??"#6b7280"),V(fe.prompt))})):(E("list"),b(null)))},[e,m,o,i]);const ge=()=>{b(null),j(""),N(""),T(""),H(!0),Y(["read_file"]),O("#6b7280"),V(""),ee(""),E("edit")},ve=async fe=>{const Le=await o(fe);Le&&(b(fe),j(Le.metadata.name),N(Le.metadata.id),T(Le.metadata.description),H(Le.metadata.subagent),Y(Le.metadata.allowedTools),O(Le.metadata.color??"#6b7280"),V(Le.prompt),ee(""),E("edit"))},Ne=async fe=>{await g(fe),x(null)},De=async()=>{const fe=C??A;if(!fe||!y||!W){ee("Name and prompt are required.");return}D(!0),ee("");const Le={metadata:{id:fe,name:y,description:R,subagent:B,allowedTools:G,color:q},prompt:W},Je=C?await f(C,Le):await d(Le);if(D(!1),!Je.success){ee(Je.error??"Failed to save agent.");return}i?r():E("list")},Oe=()=>{i?r():E("list")},Fe=fe=>{j(fe),C||N(E3(fe))},ke=fe=>{const Le=new Map(ae);Le.has(fe)?Le.delete(fe):Le.set(fe,new Set),Y(z(Le))};if(S==="edit")return c.jsx(un,{isOpen:e,onClose:Oe,title:C?"Edit Agent":"New Agent",size:"xl",children:c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"space-y-3",children:[Q&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:Q}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:y,onChange:fe=>Fe(fe.target.value),placeholder:"My Agent",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:A,onChange:fe=>!C&&N(fe.target.value),readOnly:!!C,placeholder:"my_agent",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Description"}),c.jsx("input",{value:R,onChange:fe=>T(fe.target.value),placeholder:"What this agent does",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"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),c.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[c.jsx("button",{onClick:()=>H(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${B?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"}`,children:"Sub-agent"}),c.jsx("button",{onClick:()=>H(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${B?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"}`,children:"Top-level"}),c.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[c.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),c.jsx("input",{type:"color",value:q,onChange:fe=>O(fe.target.value),className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),c.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:te.map(fe=>{const Le=ae.has(fe.name),Je=fe.actions.length>0,et=ae.get(fe.name)||new Set,Ge=c.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Le?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:[c.jsx("span",{children:fe.name}),Je&&c.jsx("span",{className:`text-[10px] ${Le&&et.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},fe.name);return Je?c.jsx(Wa,{trigger:Ge,minWidth:"160px",items:[...fe.actions.map(ct=>({label:c.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${fe.name}-${ct}`,children:[c.jsx("input",{type:"checkbox",id:`${fe.name}-${ct}`,checked:et.has(ct),onChange:()=>se(fe.name,ct),className:"w-3 h-3 rounded accent-accent-primary"}),c.jsx("span",{children:ct})]}),closeOnClick:!1})),{label:Le?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Le)ke(fe.name);else{const ct=new Map(ae);ct.set(fe.name,new Set(fe.actions)),Y(z(ct))}}}]},fe.name):c.jsx("button",{onClick:()=>ke(fe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Le?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"}`,children:c.jsx("span",{children:fe.name})},fe.name)})})]})]}),c.jsxs("div",{className:"flex-1 min-h-[150px] mt-5 overflow-hidden",children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),c.jsx("textarea",{value:W,onChange:fe=>V(fe.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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-5 border-t border-border flex-shrink-0",children:[c.jsx(ht,{variant:"secondary",onClick:Oe,children:"Cancel"}),c.jsx(ht,{variant:"primary",onClick:De,disabled:L||!y||!W,children:L?"Saving...":"Save"})]})]})});const lt=s.filter(fe=>fe.subagent),dt=s.filter(fe=>!fe.subagent);return c.jsxs(un,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(P?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await v(),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"}),c.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"})]}):c.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"})),c.jsx(ht,{variant:"primary",size:"sm",onClick:ge,children:"+ New"})]})]}),h&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):c.jsxs("div",{className:"space-y-4",children:[dt.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Top-level"}),c.jsx("div",{className:"space-y-2",children:dt.map(fe=>c.jsx(Iv,{agent:fe,confirmDeleteId:_,isModified:l.includes(fe.id),confirmRestoreId:I,onRestore:async()=>{await p(fe.id),U(null)},onConfirmRestore:()=>U(fe.id),onCancelRestore:()=>U(null),onEdit:()=>ve(fe.id),onDelete:()=>Ne(fe.id),onConfirmDelete:()=>x(fe.id),onCancelDelete:()=>x(null)},fe.id))})]}),lt.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),c.jsx("div",{className:"space-y-2",children:lt.map(fe=>c.jsx(Iv,{agent:fe,confirmDeleteId:_,isModified:l.includes(fe.id),confirmRestoreId:I,onRestore:async()=>{await p(fe.id),U(null)},onConfirmRestore:()=>U(fe.id),onCancelRestore:()=>U(null),onEdit:()=>ve(fe.id),onDelete:()=>Ne(fe.id),onConfirmDelete:()=>x(fe.id),onCancelDelete:()=>x(null)},fe.id))})]})]})]})}function Iv({agent:e,confirmDeleteId:r,isModified:i,confirmRestoreId:s,onRestore:l,onConfirmRestore:h,onCancelRestore:m,onEdit:o,onDelete:d,onConfirmDelete:f,onCancelDelete:g}){return c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),c.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),c.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),i&&c.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&&c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),c.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(p=>c.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:p},p)),e.allowedTools.length>5&&c.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[i&&(s===e.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:l,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"}),c.jsx("button",{onClick:m,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:h,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(ni,{onClick:o}),r===e.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:d,className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:g,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:f,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete agent",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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 N3(){const e=Ee(C=>{var b;return(b=C.currentSession)==null?void 0:b.mode}),r=Ee(C=>C.switchMode),i=rn(C=>C.agents),s=rn(C=>C.fetchAgents),[l,h]=F.useState(!1),[m,o]=F.useState(!1),[d,f]=F.useState(null),g=F.useRef(null);if(F.useEffect(()=>{s()},[s]),F.useEffect(()=>{function C(b){g.current&&!g.current.contains(b.target)&&h(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[]),!e)return null;const p=i.filter(C=>!C.subagent),v=p.find(C=>C.id===e),S=(v==null?void 0:v.name)??e,E=Tl(i,e);return c.jsxs("div",{className:"relative",ref:g,children:[c.jsxs("button",{type:"button",onClick:()=>h(!l),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[c.jsx("span",{className:"text-sm font-medium",style:{color:E},children:S}),c.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&p.length>0&&c.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:[p.map(C=>{const b=C.id===e,_=Tl(i,C.id);return c.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${b?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[c.jsxs("button",{type:"button",onClick:()=>{b||r(C.id),h(!1)},className:"flex-1 text-left flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",style:{color:_},children:C.name}),b&&c.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:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),c.jsx(ni,{className:"opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),h(!1),f(C.id),o(!0)}})]},C.id)}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:()=>{h(!1),o(!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..."})})]}),c.jsx(j3,{isOpen:m,onClose:()=>{o(!1),f(null)},initialEditId:d})]})}function T3(){const e=Ee(s=>s.currentSession),r=Ee(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return c.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[c.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"}),c.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 A3({question:e}){const r=Ee(f=>f.answerQuestion),i=F.useRef(null),s=F.useRef(null),[l,h]=F.useState(""),m=F.useCallback(f=>{f.key},[]);F.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=""}},[]),F.useEffect(()=>(document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)),[m]);const o=()=>{r(e.callId,l)},d=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),o())};return ch.createPortal(c.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[c.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),c.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:[c.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})}),c.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),c.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[c.jsx("p",{className:"text-sm text-text-primary",children:e.question}),c.jsx("textarea",{value:l,onChange:f=>h(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})]}),c.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[c.jsx(ht,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),c.jsx(ht,{variant:"primary",size:"sm",onClick:o,children:"Send Answer"})]})]})]}),document.body)}function D3(){const e=tS(),r=e?"bg-amber-400":"bg-accent-primary";return c.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsxs("span",{className:"flex gap-0.5",children:[c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),c.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),c.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&c.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function R3({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return c.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[c.jsx("button",{onClick:()=>r(e.id),className:"absolute -top-2 -right-2 w-5 h-5 bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors","aria-label":`Remove ${e.filename}`,children:c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),c.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),c.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),c.jsx("div",{className:"text-[10px] text-text-muted",children:i(e.size)})]})}function L3({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:l}){const h=F.useRef(null),m=F.useRef(null);F.useEffect(()=>{m.current&&h.current&&m.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const o=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(),l("up");break;case"ArrowDown":f.preventDefault(),l("down");break}},d=f=>{i(f)};return c.jsx("div",{ref:h,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:o,children:e.map((f,g)=>c.jsxs("div",{ref:g===r?m:null,role:"listitem",onClick:()=>d(f.content),className:`
|
|
138
|
-
p-2 rounded cursor-pointer transition-colors
|
|
139
|
-
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
140
|
-
`,children:[c.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[f.formattedTimestamp,f.sessionName&&c.jsxs(c.Fragment,{children:[" | ",c.jsx("span",{className:"text-accent-primary font-medium",children:f.sessionName})]})]}),c.jsx("div",{className:"text-sm text-text-primary mt-1",children:f.trimmedContent})]},f.id))})}const M3={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function Id(e,r={}){const i={...M3,...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 l=await e.arrayBuffer(),h=F3(l),m=`data:${e.type};base64,${h}`,o=await Ab(m);return{dataUrl:m,mimeType:e.type,size:e.size,width:o.width,height:o.height}}return await O3(e,i)}async function O3(e,r){const i=await B3(e),s=await Ab(i),{width:l,height:h}=I3(s.width,s.height,r.maxWidth,r.maxHeight),m=z3();m.width=l,m.height=h;const o=m.getContext("2d");if(!o)throw new Error("Failed to get canvas context");o.imageSmoothingEnabled=!0,o.imageSmoothingQuality="high",o.drawImage(s,0,0,l,h);let d=r.quality,f;do{if(f=m.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Bv(f)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Bv(f);return{dataUrl:f,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:l,height:h}}function I3(e,r,i,s){const l=e/r;return e>r&&e>i?{width:i,height:Math.round(i/l)}:r>e&&r>s?{width:Math.round(s*l),height:s}:{width:e,height:r}}function B3(e){return new Promise((r,i)=>{const s=P3(),l=new s;l.onload=()=>r(l.result),l.onerror=()=>i(new Error("Failed to read file")),l.readAsDataURL(e)})}function Ab(e){return new Promise((r,i)=>{const s=H3(),l=new s;l.onload=()=>r(l),l.onerror=()=>i(new Error("Failed to load image")),l.src=e})}function z3(){var r;const e=Gh();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function H3(){const e=Gh();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function P3(){const e=Gh();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function Gh(){return globalThis}function F3(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const l=r[s];l!==void 0&&(i+=String.fromCharCode(l))}return btoa(i)}function Bv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function Bd(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function zd(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${zv(e.size)}). Maximum size is ${zv(r)}.`}:{valid:!0}}function zv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function U3(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 $3({isOpen:e,onClose:r,providerId:i,model:s}){const[l,h]=F.useState(s.contextWindow),[m,o]=F.useState(!1),d=Gt(p=>p.updateModelContext);if(F.useEffect(()=>{h(s.contextWindow)},[s]),!e)return null;const f=async()=>{l<1024||l>1e7||(o(!0),await d(i,s.id,l),o(!1),r())},g=()=>{h(s.contextWindow),r()};return c.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:c.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[c.jsx("div",{className:"px-6 py-4 border-b border-border",children:c.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),c.jsxs("div",{className:"px-6 py-4 space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),c.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),c.jsx("input",{type:"number",min:1024,max:1e7,value:l,onChange:p=>h(parseInt(p.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"}),c.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),c.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"]})]})]}),c.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[c.jsx("button",{type:"button",onClick:g,disabled:m,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),c.jsx("button",{type:"button",onClick:f,disabled:m||l<1024||l>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:m?"Saving...":"Save"})]})]})})}function q3(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function W3(){var q;const e=Ee(O=>O.currentSession),r=Ee(O=>O.setSessionProvider),[i,s]=F.useState(!1),[l,h]=F.useState([]),[m,o]=F.useState(null),d=F.useRef(null),[f,g]=F.useState(null),p=F.useRef(new Set),v=Gt(O=>O.providers),S=Gt(O=>O.activeProviderId),E=Gt(O=>O.model);Gt(O=>O.backend);const C=Gt(O=>O.llmStatus),b=Gt(O=>O.activating),_=Gt(O=>O.activateProvider),x=Gt(O=>O.refreshModel),y=Gt(O=>O.refreshProviderModels);F.useEffect(()=>{function O(W){d.current&&!d.current.contains(W.target)&&(s(!1),h([]),p.current=new Set)}return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]),F.useEffect(()=>{if(i){const O=v.map(W=>W.id);h(O),O.forEach(W=>{p.current.has(W)||(p.current.add(W),N(W))})}},[i,v]),v.find(O=>O.id===S);const j=C==="disconnected",A=E?((q=E.split("/").pop())==null?void 0:q.replace(/-/g," "))??E:"detecting...",N=async O=>{o(O);try{await y(O)}catch{}finally{o(null)}},R=async O=>{if(O.id===S){l.includes(O.id)?h(l.filter(W=>W!==O.id)):(h([...l,O.id]),N(O.id));return}e?(r(O.id,void 0),Gt.getState().syncFromSession(O.id,""),s(!1),h([])):await _(O.id)&&(s(!1),h([]))},T=O=>{l.includes(O.id)?h(l.filter(W=>W!==O.id)):(h([...l,O.id]),N(O.id))},B=async(O,W)=>{O.stopPropagation(),p.current.delete(W),await y(W),await N(W)},H=(O,W)=>{g({providerId:O,model:W})},G=()=>{g(null)},Y=async(O,W)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",O,"model:",W),e){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),r(O,W),Gt.getState().syncFromSession(O,W),h([]),s(!1);return}o("activating");try{(await Se(`/api/providers/${O}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:W})})).ok&&(await Gt.getState().fetchConfig(),h([]),s(!1))}catch{}finally{o(null)}};return v.length===0?c.jsxs("button",{type:"button",onClick:()=>x(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:j?"LLM server is offline. Click to retry.":E??"Click to refresh model",children:[j?c.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):c.jsx("span",{className:"text-sm text-accent-primary",children:A}),c.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):c.jsxs("div",{className:"relative",ref:d,children:[c.jsxs("button",{type:"button",onClick:()=>s(!i),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:[j?c.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):c.jsx("span",{className:"text-sm text-accent-primary",children:A}),c.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${i?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&c.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:[c.jsx("div",{className:"py-1",children:v.map(O=>{var W;return c.jsxs("div",{children:[c.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${O.id===S?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${b?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[c.jsxs("div",{onClick:()=>!b&&R(O),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[c.jsx("span",{className:`text-sm font-medium truncate ${O.id===S?"text-accent-primary":"text-text-primary"}`,children:O.name}),c.jsx("span",{className:"text-xs text-text-muted truncate",children:O.backend!=="auto"&&z1(O.backend)})]}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[O.id===S?c.jsx("span",{className:"text-accent-success",title:"Active",children:c.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:c.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"})})}):c.jsx("span",{className:"w-4"}),c.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),B(V,O.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:c.jsx("svg",{className:`w-4 h-4 ${m===O.id?"animate-spin":""} ${O.id===S?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("button",{type:"button",onClick:V=>{V.stopPropagation(),T(O)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:c.jsx("svg",{className:`w-4 h-4 transition-transform ${l.includes(O.id)?"rotate-180":""} ${O.id===S?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),l.includes(O.id)&&c.jsx("div",{className:"bg-bg-primary border-t border-border",children:m===O.id?c.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(W=O.models)!=null&&W.length?O.models.map(V=>{var Q;return c.jsxs("button",{type:"button",onClick:()=>Y(O.id,V.id),disabled:m==="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 ${m==="activating"?"opacity-50 cursor-wait":""} ${E===V.id?"text-accent-primary":"text-text-secondary"}`,children:[c.jsx("span",{className:"truncate flex-1",children:((Q=V.id.split("/").pop())==null?void 0:Q.replace(/-/g," "))??V.id}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[c.jsx("span",{className:"text-xs text-text-muted",children:q3(V.contextWindow)}),c.jsx("button",{type:"button",onClick:ee=>{ee.stopPropagation(),H(O.id,V)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:c.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]}),E===V.id&&c.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:c.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"})})})]},V.id)}):c.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},O.id)})}),c.jsx("div",{className:"border-t border-border px-3 py-2",children:c.jsxs("p",{className:"text-xs text-text-muted",children:["Use ",c.jsx("code",{className:"bg-bg-tertiary px-1 rounded",children:"openfox provider add"})," to add more providers"]})})]}),f&&c.jsx($3,{isOpen:!0,onClose:G,providerId:f.providerId,model:f.model})]})}const Tn=Xn((e,r)=>({commands:[],defaultIds:[],modifiedIds:[],loading:!1,fetchDefaultIds:async()=>{try{const s=await(await Se("/api/commands/default-ids")).json();e({defaultIds:s.ids??[]})}catch{}},fetchCommands:async()=>{e({loading:!0});try{const s=await(await Se("/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 Se(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{try{const s=await Se("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}},updateCommand:async(i,s)=>{try{const l=await Se(`/api/commands/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return l.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:(await l.json()).error}}catch{return{success:!1,error:"Network error"}}},deleteCommand:async i=>{try{return(await Se(`/api/commands/${i}`,{method:"DELETE"})).ok?(e({commands:r().commands.filter(l=>l.id!==i)}),!0):!1}catch{return!1}},restoreDefault:async i=>{try{return(await Se(`/api/commands/${i}/restore-default`,{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}},restoreAllDefaults:async()=>{try{return(await Se("/api/commands/restore-all-defaults",{method:"POST"})).ok?(await r().fetchCommands(),!0):!1}catch{return!1}}}));function G3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Db({isOpen:e,onClose:r,initialEditId:i}){const s=Tn(z=>z.commands),l=Tn(z=>z.modifiedIds),h=Tn(z=>z.loading),m=Tn(z=>z.fetchCommands),o=Tn(z=>z.fetchCommand),d=Tn(z=>z.createCommand),f=Tn(z=>z.updateCommand),g=Tn(z=>z.deleteCommand),p=Tn(z=>z.restoreDefault),v=Tn(z=>z.restoreAllDefaults),[S,E]=F.useState("list"),[C,b]=F.useState(null),[_,x]=F.useState(null),y=rn(z=>z.agents),j=rn(z=>z.fetchAgents),A=y.filter(z=>!z.subagent),[N,R]=F.useState(""),[T,B]=F.useState(""),[H,G]=F.useState(""),[Y,q]=F.useState(""),[O,W]=F.useState(""),[V,Q]=F.useState(!1),[ee,L]=F.useState(null),[D,I]=F.useState(!1);F.useEffect(()=>{e&&(m(),j(),x(null),L(null),I(!1),i?(E("edit"),b(i),W(""),o(i).then(z=>{z&&(R(z.metadata.name),B(z.metadata.id),G(z.prompt),q(z.metadata.agentMode??""))})):(E("list"),b(null)))},[e,m,j,o,i]);const U=()=>{b(null),R(""),B(""),G(""),q(""),W(""),E("edit")},P=async z=>{const ae=await o(z);ae&&(b(z),R(ae.metadata.name),B(ae.metadata.id),G(ae.prompt),q(ae.metadata.agentMode??""),W(""),E("edit"))},K=async z=>{await g(z),x(null)},te=async()=>{const z=C??T;if(!z||!N||!H){W("Name and message are required.");return}Q(!0),W("");const ae={metadata:{id:z,name:N,...Y?{agentMode:Y}:{}},prompt:H},se=C?await f(C,ae):await d(ae);if(Q(!1),!se.success){W(se.error??"Failed to save command.");return}i?r():E("list")},Z=()=>{i?r():E("list")},X=z=>{R(z),C||B(G3(z))};return S==="edit"?c.jsx(un,{isOpen:e,onClose:Z,title:C?"Edit Command":"New Command",size:"xl",children:c.jsxs("div",{className:"space-y-3",children:[O&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:O}),c.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),c.jsx("input",{value:N,onChange:z=>X(z.target.value),placeholder:"My Command",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"})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["ID ",C&&c.jsx("span",{className:"text-text-muted",children:"(read-only)"})]}),c.jsx("input",{value:T,onChange:z=>!C&&B(z.target.value),readOnly:!!C,placeholder:"my-command",className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm font-mono focus:outline-none focus:ring-1 focus:ring-accent-primary ${C?"opacity-60":""}`})]})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",c.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),c.jsxs("select",{value:Y,onChange:z=>q(z.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:[c.jsx("option",{value:"",children:"None (keep current mode)"}),A.map(z=>c.jsx("option",{value:z.id,children:z.name},z.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),c.jsx("textarea",{value:H,onChange:z=>G(z.target.value),placeholder:"The message that will be sent when this command is triggered...",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"})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[c.jsx(ht,{variant:"secondary",onClick:Z,children:"Cancel"}),c.jsx(ht,{variant:"primary",onClick:te,disabled:V||!N||!H,children:V?"Saving...":"Save"})]})]})}):c.jsxs(un,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Commands are pre-defined messages you can send with a single click."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(D?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await v(),I(!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"}),c.jsx("button",{onClick:()=>I(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>I(!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 commands to defaults",children:"Restore Defaults"})),c.jsx(ht,{variant:"primary",size:"sm",onClick:U,children:"+ New"})]})]}),h&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading commands..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No commands created yet."}):c.jsx("div",{className:"space-y-2",children:s.map(z=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsx("div",{className:"min-w-0 flex-1 mr-3",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:z.name}),l.includes(z.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]})}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.includes(z.id)&&(ee===z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await p(z.id),L(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"}),c.jsx("button",{onClick:()=>L(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>L(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(ni,{onClick:()=>P(z.id)}),_===z.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>K(z.id),className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs hover:bg-accent-error/30 transition-colors",children:"Delete"}),c.jsx("button",{onClick:()=>x(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>x(z.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete command",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})]})]},z.id))})]})}function V3({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[l,h]=F.useState(!1),[m,o]=F.useState(""),[d,f]=F.useState(0),[g,p]=F.useState(null),v=F.useRef(null),S=F.useRef(null),E=Tn(j=>j.commands),C=Tn(j=>j.fetchCommands);F.useEffect(()=>{l&&(C(),o(""),f(0),requestAnimationFrame(()=>{var j;return(j=S.current)==null?void 0:j.focus()}))},[l,C]),F.useEffect(()=>{if(!l)return;const j=A=>{v.current&&!v.current.contains(A.target)&&h(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[l]);const b=E.filter(j=>{if(!m)return!0;const A=m.toLowerCase();return j.name.toLowerCase().includes(A)}),_=j=>{switch(j.key){case"ArrowDown":j.preventDefault(),f(A=>Math.min(A+1,b.length-1));break;case"ArrowUp":j.preventDefault(),f(A=>Math.max(A-1,0));break;case"Enter":j.preventDefault(),b[d]&&x(b[d].id);break;case"Escape":j.preventDefault(),h(!1);break}},x=async j=>{const A=await Tn.getState().fetchCommand(j);A&&e(A.prompt,A.metadata.agentMode,i,s),h(!1)},y=()=>{h(!1),r()};return c.jsxs("div",{ref:v,className:"relative",children:[c.jsxs("button",{type:"button",onClick:()=>h(j=>!j),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Commands",c.jsx("svg",{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&c.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:_,children:[c.jsx("div",{className:"p-2 border-b border-border",children:c.jsx("input",{ref:S,value:m,onChange:j=>{o(j.target.value),f(0)},placeholder:"Search commands...",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"})}),c.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:b.length===0?c.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:E.length===0?"No commands yet":"No matches"}):b.map((j,A)=>c.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${A===d?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[c.jsx("button",{type:"button",onClick:()=>x(j.id),className:"flex-1 text-left",children:c.jsx("div",{className:"text-sm text-text-primary font-medium",children:j.name})}),c.jsx(ni,{className:"opacity-0 group-hover:opacity-100",onClick:N=>{N.stopPropagation(),h(!1),p(j.id)}})]},j.id))}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:y,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 Commands..."})})]}),c.jsx(Db,{isOpen:!!g,onClose:()=>p(null),initialEditId:g})]})}function Y3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function K3(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const X3=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],Rb={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"},Lb=[{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)"}],wi=150,Er=54,ys=80,jn=30,_s=70,Hv=100,Ci=50,gl=50,Pv=4;function Vh(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 Z3(e,r,i,s){const l=gl+Ci+wi+Hv+wi+Ci+gl,h=l/2,m=gl+Ci+wi/2,o=gl+Ci+wi+Hv+wi/2,d=[],f=[],g=new Map,p=e.filter(O=>O.type==="agent"||O.type==="shell"),v=e.filter(O=>O.type==="sub_agent"),S=v.length>0,E=S?m:h,C=p.length>0?o:h,b=Ci+jn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:E,cy:b,w:ys,h:jn}),g.set("$start",{cx:E,cy:b,w:ys,h:jn}),e.length===0){const O=b+jn/2+_s*2+jn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:O,w:ys,h:jn}),g.set("$done",{cx:E,cy:O,w:ys,h:jn}),{nodes:d,edges:f,width:l,height:O+jn/2+Ci,posMap:g}}const _=b+jn/2+_s,x=(O,W)=>{O.forEach((V,Q)=>{const ee=_+Q*(Er+_s)+Er/2,{name:L,color:D}=Vh(V,s);d.push({id:V.id,type:"step",label:L,color:D,cx:W,cy:ee,w:wi,h:Er}),g.set(V.id,{cx:W,cy:ee,w:wi,h:Er})})};x(p,E),x(v,C);const y=p.length>0?_+(p.length-1)*(Er+_s)+Er/2:b,j=S?_+(v.length-1)*(Er+_s)+Er/2:b,A=Math.max(y,j)+Er/2+_s+jn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:E,cy:A,w:ys,h:jn}),g.set("$done",{cx:E,cy:A,w:ys,h:jn});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 O of e)O.transitions.forEach((W,V)=>{if(!W.goto||!g.has(W.goto))return;const Q=g.get(O.id),ee=g.get(W.goto),L=W.when.type==="step_result"?`${W.when.result}`:Rb[W.when.type]??W.when.type,D=O.id===W.goto;let I;D?I="back":ee.cy>Q.cy+1?I="down":ee.cy<Q.cy-1?I="back":I="same",N.push({from:O.id,to:W.goto,label:L,edgeKey:`${O.id}:${V}`,direction:I,backEdgeIndex:I==="back"?R++:0})});const T=new Map,B=new Map,H=new Map,G=new Map;for(const O of N)O.direction==="down"&&(T.set(O.from,(T.get(O.from)??0)+1),B.set(O.to,(B.get(O.to)??0)+1));const Y=new Map,q=new Map;for(const O of N){if(O.direction!=="same")continue;const W=[O.from,O.to].sort().join("|");Y.set(W,(Y.get(W)??0)+1)}for(const O of N){if(O.direction==="back"||O.direction==="same"){let I=0;if(O.direction==="same"){const U=[O.from,O.to].sort().join("|");I=q.get(U)??0,q.set(U,I+1)}f.push({...O,fromPort:0,toPort:0,sameEdgeIndex:I});continue}const W=T.get(O.from)??1,V=B.get(O.to)??1,Q=H.get(O.from)??0,ee=G.get(O.to)??0;H.set(O.from,Q+1),G.set(O.to,ee+1);const L=W===1?0:-.6+1.2*Q/(W-1),D=V===1?0:-.6+1.2*ee/(V-1);f.push({...O,fromPort:L,toPort:D,sameEdgeIndex:0})}return{nodes:d,edges:f,width:l,height:A+jn/2+Ci,posMap:g}}function Q3({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:l,agentTypes:h,onSelectNode:m,onSelectEdge:o,onRemoveStep:d,onCreateTransition:f,onReconnectTo:g,onReconnectFrom:p,onDeleteTransition:v}){const S=F.useRef(null),E=F.useRef(!1),[C,b]=F.useState(null),[_,x]=F.useState(null),[y,j]=F.useState(null),{nodes:A,edges:N,width:R,height:T,posMap:B}=F.useMemo(()=>Z3(e,r,l,h),[e,r,l,h]),H=F.useCallback(K=>{var ae;const te=S.current;if(!te)return{x:0,y:0};const Z=te.createSVGPoint();Z.x=K.clientX,Z.y=K.clientY;const X=(ae=te.getScreenCTM())==null?void 0:ae.inverse();if(!X)return{x:0,y:0};const z=Z.matrixTransform(X);return{x:z.x,y:z.y}},[]),G=F.useCallback(K=>!K||!_||K==="$start"?!1:_.type==="reconnect-from"?K!=="$done":!0,[_]),Y=F.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Z=H(K);x({type:"new",fromNodeId:te,mouseX:Z.x,mouseY:Z.y})},[H]),q=F.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Z=H(K);x({type:"reconnect-to",fromNodeId:te.from,edgeKey:te.edgeKey,mouseX:Z.x,mouseY:Z.y})},[H]),O=F.useCallback((K,te)=>{K.stopPropagation(),K.preventDefault();const Z=H(K);x({type:"reconnect-from",fromNodeId:te.from,fixedTargetId:te.to,edgeKey:te.edgeKey,mouseX:Z.x,mouseY:Z.y})},[H]),W=F.useCallback(K=>{if(!_)return;const te=H(K);x(Z=>Z?{...Z,mouseX:te.x,mouseY:te.y}:null)},[_,H]),V=F.useCallback(()=>{_&&(E.current=!0,y&&G(y)&&(_.type==="new"?f(_.fromNodeId,y):_.type==="reconnect-to"?g(_.edgeKey,y):_.type==="reconnect-from"&&p(_.edgeKey,y)),x(null),j(null))},[_,y,G,f,g,p]),Q=F.useCallback(()=>{if(E.current){E.current=!1;return}m(null),o(null)},[m,o]);F.useEffect(()=>{const K=te=>{te.target instanceof HTMLInputElement||te.target instanceof HTMLTextAreaElement||te.target instanceof HTMLSelectElement||(te.key==="Delete"||te.key==="Backspace")&&s&&s!=="start"&&(te.preventDefault(),v(s),o(null))};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[s,v,o]);const ee=K=>{const te=B.get(K.from),Z=B.get(K.to);if(!te||!Z)return null;let X,z,ae,se="middle",ge,ve;if(K.direction==="down"){const Ne=te.cx+K.fromPort*(te.w/2-10),De=te.cy+te.h/2,Oe=Z.cx+K.toPort*(Z.w/2-10),Fe=Z.cy-Z.h/2,ke=Fe-De,lt=Oe-Ne;X=`M ${Ne} ${De} C ${Ne} ${De+ke*.4}, ${Oe-lt*.2} ${Fe-ke*.1}, ${Oe} ${Fe}`,z=Ne+(Oe-Ne)*.5,ae=De+ke*.6,ge={x:Ne,y:De},ve={x:Oe,y:Fe}}else if(K.direction==="back"){const Ne=K.from===K.to,De=te.cx>=R/2,Oe=K.backEdgeIndex*16,Fe=De?R-20-Oe:20+Oe;if(Ne){const ke=te.cx>=R/2,lt=30+K.backEdgeIndex*14,dt=te.cy-te.h/2,fe=ke?te.cx+te.w/2:te.cx-te.w/2,Le=ke?fe+lt:fe-lt,Je=te.cx+(ke?te.w/4:-te.w/4),et=dt-20-K.backEdgeIndex*10;X=`M ${fe} ${te.cy} C ${Le} ${te.cy}, ${Le} ${et}, ${Je} ${dt}`,z=Le+10,ae=et+4,se="middle",ge={x:fe,y:te.cy},ve={x:Je,y:dt}}else{const ke=De?te.cx+te.w/2:te.cx-te.w/2,lt=Z.cx+(De?Z.w/4:-Z.w/4),dt=Math.min(te.cy,Z.cy)-Z.h/2-18-K.backEdgeIndex*14;X=`M ${ke} ${te.cy} L ${Fe} ${te.cy} L ${Fe} ${dt} L ${lt} ${dt} L ${lt} ${Z.cy-Z.h/2}`,z=Fe,ae=(te.cy+dt)/2,se=De?"start":"end",ge={x:ke,y:te.cy},ve={x:lt,y:Z.cy-Z.h/2}}}else{const Ne=Z.cx>te.cx,De=K.sameEdgeIndex===0?-12:12,Oe=Ne?te.cx+te.w/2:te.cx-te.w/2,Fe=Ne?Z.cx-Z.w/2:Z.cx+Z.w/2,ke=te.cy+De,lt=Z.cy+De,dt=(Oe+Fe)/2;X=`M ${Oe} ${ke} C ${dt} ${ke}, ${dt} ${lt}, ${Fe} ${lt}`,z=dt,ae=(ke+lt)/2-6,ge={x:Oe,y:ke},ve={x:Fe,y:lt}}return{path:X,labelX:z,labelY:ae,labelAnchor:se,fromPt:ge,toPt:ve}},L=(K,te)=>{const Z=ee(K);if(!Z)return null;const{path:X,labelX:z,labelY:ae,labelAnchor:se}=Z,ge=s===K.edgeKey,ve=K.label&&!(K.from==="$start"&&K.label==="Always");return c.jsxs("g",{children:[c.jsx("path",{d:X,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Ne=>{Ne.stopPropagation(),o(ge?null:K.edgeKey)}}),c.jsx("path",{d:X,fill:"none",stroke:ge?"#58a6ff":"#484f58",strokeWidth:ge?2.2:1.2,markerEnd:ge?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),ve&&c.jsx("text",{x:z+(se==="start"?5:se==="end"?-5:0),y:ae+3,textAnchor:se,className:"text-[8px]",fill:ge?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:K.label})]},te)},D=()=>{if(!s||_)return null;const K=N.find(ae=>ae.edgeKey===s);if(!K)return null;const te=ee(K);if(!te)return null;const{fromPt:Z,toPt:X}=te,z=6;return c.jsxs(c.Fragment,{children:[K.edgeKey!=="start"&&c.jsx("circle",{cx:Z.x,cy:Z.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>O(ae,K)}),c.jsx("circle",{cx:X.x,cy:X.y,r:z,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ae=>q(ae,K)})]})},I=()=>{if(!_)return null;let K,te,Z,X;if(_.type==="reconnect-from"){const se=B.get(_.fixedTargetId);if(!se)return null;K=_.mouseX,te=_.mouseY,Z=se.cx,X=se.cy-se.h/2}else{const se=B.get(_.fromNodeId);if(!se)return null;K=se.cx,te=se.cy+se.h/2,Z=_.mouseX,X=_.mouseY}const z=X-te,ae=Math.abs(z)>10?`M ${K} ${te} C ${K} ${te+z*.4}, ${Z} ${X-z*.4}, ${Z} ${X}`:`M ${K} ${te} L ${Z} ${X}`;return c.jsx("path",{d:ae,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},U=K=>{const te=K.cy+K.h/2,Z=(_==null?void 0:_.fromNodeId)===K.id;return c.jsx("circle",{cx:K.cx,cy:te,r:Pv,fill:Z?"#58a6ff":"#1c2128",stroke:Z?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:Z?1:.5,className:"cursor-crosshair",onMouseDown:X=>Y(X,K.id)})},P=K=>{const te=K.cy-K.h/2,Z=_&&y===K.id&&G(K.id);return c.jsx("circle",{cx:K.cx,cy:te,r:Pv,fill:Z?"#3fb950":"#1c2128",stroke:Z?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:Z?1:.5})};return c.jsxs("svg",{ref:S,viewBox:`0 0 ${R} ${T}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:W,onMouseUp:V,onClick:Q,children:[c.jsxs("defs",{children:[c.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:c.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),c.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:c.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),N.map((K,te)=>L(K,te)),A.map(K=>{const te=i===K.id,Z=K.cx-K.w/2,X=K.cy-K.h/2,z=C===K.id,ae=_&&y===K.id&&G(K.id);if(K.type==="terminal"){const ge=K.id==="$start",ve=ge?"#58a6ff":"#3fb950",Ne=ge,De=!ge;return c.jsxs("g",{onClick:Oe=>{Oe.stopPropagation(),ge&&o("start")},className:ge?"cursor-pointer":void 0,children:[ae&&c.jsx("rect",{x:Z-3,y:X-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ge&&s==="start"&&c.jsx("rect",{x:Z-3,y:X-3,width:K.w+6,height:K.h+6,rx:K.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),c.jsx("rect",{x:Z,y:X,width:K.w,height:K.h,rx:K.h/2,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.4,strokeWidth:1.5}),c.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:ve,className:"text-[10px] font-medium",pointerEvents:"none",children:K.label}),Ne&&U(K),De&&P(K)]},K.id)}const se=K.color??"#6b7280";return c.jsxs("g",{onClick:ge=>{ge.stopPropagation(),m(te?null:K.id)},onMouseEnter:()=>b(K.id),onMouseLeave:()=>b(null),className:"cursor-pointer",children:[ae&&c.jsx("rect",{x:Z-3,y:X-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),te&&c.jsx("rect",{x:Z-3,y:X-3,width:K.w+6,height:K.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),c.jsx("rect",{x:Z,y:X,width:K.w,height:K.h,rx:10,fill:se,fillOpacity:.08,stroke:se,strokeOpacity:.6,strokeWidth:te?2:1.5}),c.jsx("text",{x:K.cx,y:K.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:K.label}),U(K),P(K),z&&!_&&c.jsxs("g",{onClick:ge=>{ge.stopPropagation(),d(K.id)},className:"cursor-pointer",children:[c.jsx("circle",{cx:Z+K.w-2,cy:X+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),c.jsx("line",{x1:Z+K.w-5,y1:X-1,x2:Z+K.w+1,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),c.jsx("line",{x1:Z+K.w+1,y1:X-1,x2:Z+K.w-5,y2:X+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},K.id)}),_&&A.map(K=>G(K.id)?c.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:te=>{te.stopPropagation(),V()}},`drop-${K.id}`):null),I(),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",ji="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 J3({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:l,onUpdateCondition:h,onDelete:m}){const o=s&&(s.type==="sub_agent"||s.type==="agent")?l.find(f=>f.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(o==null?void 0:o.results)&&o.results.length>0;return c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),c.jsx("button",{onClick:m,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("span",{className:"font-medium text-text-primary",children:e}),c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),c.jsx("span",{className:"font-medium text-text-primary",children:r})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Condition"}),c.jsx("select",{value:i.type,onChange:f=>{h(f.target.value==="step_result"?{type:"step_result",result:"success"}:{type:f.target.value})},className:ji,children:Lb.map(f=>c.jsx("option",{value:f.value,children:f.label},f.value))})]}),i.type==="step_result"&&c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Result"}),d?c.jsx("select",{value:i.result??o.results[0],onChange:f=>{h({type:"step_result",result:f.target.value})},className:ji,children:o.results.map(f=>c.jsx("option",{value:f,children:f},f))}):c.jsx("input",{type:"text",value:i.result??"success",onChange:f=>h({type:"step_result",result:f.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})]}),c.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Hd({variables:e,onInsert:r}){return e.length===0?null:c.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>c.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 eT({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:l,onUpdate:h,onRemove:m,onSetEntry:o}){const{color:d,name:f}=Vh(e,i);return c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:f}),r&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[!r&&c.jsx("button",{onClick:o,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),c.jsx("button",{onClick:m,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Type"}),c.jsx("select",{value:e.type,onChange:g=>{const p=g.target.value,v=p==="sub_agent"?"verification":"build";if(p==="agent"){const S=i.find(E=>!E.subagent);h({...e,type:p,phase:v,toolMode:(S==null?void 0:S.id)??"builder",name:(S==null?void 0:S.name)??"Agent"})}else if(p==="sub_agent"){const S=i.find(E=>E.subagent);h({...e,type:p,phase:v,subAgentType:(S==null?void 0:S.id)??"",name:(S==null?void 0:S.name)??"Sub-Agent"})}else h({...e,type:p,phase:v,name:"Shell"})},className:ji,children:X3.map(g=>c.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Agent Type"}),c.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const p=i.find(v=>v.id===g.target.value);h({...e,toolMode:g.target.value,name:(p==null?void 0:p.name)??g.target.value})},className:ji,children:i.filter(g=>!g.subagent).map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Sub-Agent Type"}),c.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const p=i.find(v=>v.id===g.target.value);h({...e,subAgentType:g.target.value,name:(p==null?void 0:p.name)??g.target.value})},className:ji,children:[c.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Prompt"}),c.jsx("textarea",{value:e.prompt??"",onChange:g=>h({...e,prompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on first entry..."}),c.jsx(Hd,{variables:l,onInsert:g=>h({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Nudge Prompt"}),c.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>h({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Yn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),c.jsx(Hd,{variables:l,onInsert:g=>h({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Command"}),c.jsx("textarea",{value:e.command??"",onChange:g=>h({...e,command:g.target.value}),rows:3,className:`${Yn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),c.jsx(Hd,{variables:l,onInsert:g=>h({...e,command:(e.command??"")+`{{${g}}}`})})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Timeout (ms)"}),c.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>h({...e,timeout:Number(g.target.value)}),className:`${Yn} font-mono text-xs`})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Success Codes"}),c.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>h({...e,successExitCodes:g.target.value.split(",").map(p=>Number(p.trim())).filter(p=>!isNaN(p))}),className:`${Yn} font-mono text-xs`})]})]})]}),c.jsx("div",{className:"pt-1 border-t border-border/50",children:c.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const Fv=[];function Mb({isOpen:e,onClose:r,initialEditId:i}){const s=Vt(pe=>pe.workflows),l=Vt(pe=>pe.modifiedIds),h=Vt(pe=>pe.loading),m=Vt(pe=>pe.templateVariables),o=Vt(pe=>pe.fetchWorkflows),d=Vt(pe=>pe.fetchWorkflow),f=Vt(pe=>pe.fetchTemplateVariables),g=Vt(pe=>pe.createWorkflow),p=Vt(pe=>pe.updateWorkflow),v=Vt(pe=>pe.deleteWorkflow),S=Vt(pe=>pe.restoreDefault),E=Vt(pe=>pe.restoreAllDefaults),[C,b]=F.useState("list"),[_,x]=F.useState(null),[y,j]=F.useState(null),[A,N]=F.useState(null),[R,T]=F.useState(null),[B,H]=F.useState(""),[G,Y]=F.useState(""),[q,O]=F.useState(""),[W,V]=F.useState("1.0.0"),[Q,ee]=F.useState("#3b82f6"),[L,D]=F.useState(""),[I,U]=F.useState(50),[P,K]=F.useState(Fv),[te,Z]=F.useState({type:"always"}),[X,z]=F.useState(""),[ae,se]=F.useState(!1),[ge,ve]=F.useState([]),[Ne,De]=F.useState(null),[Oe,Fe]=F.useState(!1);F.useEffect(()=>{e&&(o(),f(),Se("/api/agents").then(pe=>pe.json()).then(pe=>ve(pe.agents??[])).catch(()=>{}),j(null),De(null),Fe(!1),N(null),T(null),i?(b("edit"),x(i),z(""),d(i).then(pe=>{pe&&(H(pe.metadata.name),Y(pe.metadata.id),O(pe.metadata.description),V(pe.metadata.version),ee(pe.metadata.color??"#3b82f6"),D(pe.entryStep),U(pe.settings.maxIterations),K(pe.steps),Z(pe.startCondition??{type:"always"}))})):(b("list"),x(null)))},[e,o,d,f,i]);const ke=()=>{x(null),H(""),Y(""),O(""),V("1.0.0"),ee("#3b82f6"),D(""),U(50),K(structuredClone(Fv)),Z({type:"always"}),z(""),N(null),T(null),b("edit")},lt=async pe=>{const we=await d(pe);we&&(x(pe),H(we.metadata.name),Y(we.metadata.id),O(we.metadata.description),V(we.metadata.version),ee(we.metadata.color??"#3b82f6"),D(we.entryStep),U(we.settings.maxIterations),K(we.steps),Z(we.startCondition??{type:"always"}),z(""),N(null),T(null),b("edit"))},dt=async()=>{var tt;const pe=_??G;if(!pe||!B)return z("Name is required."),!1;if(P.length===0)return z("Add at least one step."),!1;let we=L;if(!we||!P.some(Ie=>Ie.id===we)){if(we=((tt=P.find(Ie=>Ie.id))==null?void 0:tt.id)??"",!we)return z("All steps need an ID."),!1;D(we)}se(!0),z("");const ze={metadata:{id:pe,name:B,description:q,version:W||"1.0.0",color:Q},entryStep:we,settings:{maxIterations:I},steps:P,startCondition:te},Ve=_?await p(_,ze):await g(ze);return se(!1),Ve.success?(_||x(pe),!0):(z(Ve.error??"Failed to save."),!1)},fe=async()=>{await dt()},Le=async()=>{await dt()&&(i?r():b("list"))},Je=()=>{i?r():b("list")},et=pe=>{H(pe),_||Y(Y3(pe))},Ge=F.useCallback(pe=>{N(pe),T(null)},[]),ct=F.useCallback(pe=>{T(pe),N(null)},[]),de=A!==null?Number(A):-1,be=de>=0?P[de]??null:null,re=F.useCallback(pe=>{K(we=>we.map((ze,Ve)=>Ve===de?pe:ze))},[de]),_e=te.type==="step_result"?`${te.result}`:Rb[te.type]??te.type,Ce=()=>{const pe=P.length,we=K3(P),ze=ge.find(Ve=>!Ve.subagent);K([...P,{id:we,name:(ze==null?void 0:ze.name)??"Agent",type:"agent",phase:"build",toolMode:(ze==null?void 0:ze.id)??"builder",transitions:[]}]),L||D(we),Ge(String(pe))},He=F.useCallback((pe,we)=>{pe==="$start"?(D(we),ct("start")):K(ze=>{const Ve=ze.find(Ie=>Ie.id===pe),tt=Ve?Ve.transitions.length:0;return ct(`${pe}:${tt}`),ze.map(Ie=>Ie.id===pe?{...Ie,transitions:[...Ie.transitions,{when:{type:"always"},goto:we}]}:Ie)})},[ct]),Ae=F.useCallback((pe,we)=>{if(pe==="start")D(we);else{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Ie=>Ie.map(Rt=>Rt.id===Ve?{...Rt,transitions:Rt.transitions.map((Et,Yt)=>Yt===tt?{...Et,goto:we}:Et)}:Rt))}},[]),st=F.useCallback((pe,we)=>{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Ie=>{const Rt=Ie.find(Yt=>Yt.id===Ve);if(!Rt)return Ie;const Et=Rt.transitions[tt];return Et?Ie.map(Yt=>Yt.id===Ve?{...Yt,transitions:Yt.transitions.filter((Wl,Rs)=>Rs!==tt)}:Yt.id===we?{...Yt,transitions:[...Yt.transitions,Et]}:Yt):Ie}),T(null)},[]),it=F.useCallback(pe=>{if(pe==="start")D("");else{const we=pe.lastIndexOf(":"),ze=pe.slice(0,we),Ve=parseInt(pe.slice(we+1));K(tt=>tt.map(Ie=>Ie.id===ze?{...Ie,transitions:Ie.transitions.filter((Rt,Et)=>Et!==Ve)}:Ie))}T(null)},[]),Ct=F.useCallback((pe,we)=>{if(pe==="start")Z(we);else{const ze=pe.lastIndexOf(":"),Ve=pe.slice(0,ze),tt=parseInt(pe.slice(ze+1));K(Ie=>Ie.map(Rt=>Rt.id===Ve?{...Rt,transitions:Rt.transitions.map((Et,Yt)=>Yt===tt?{...Et,when:we}:Et)}:Rt))}},[]),$e=pe=>Vh(pe,ge).name,Rn=()=>{if(!R)return null;if(R==="start"){const Et=P.find(Yt=>Yt.id===L);return{type:"start",fromLabel:"Start",toLabel:Et?$e(Et):"(none)",condition:te}}const pe=R.lastIndexOf(":"),we=R.slice(0,pe),ze=parseInt(R.slice(pe+1)),Ve=P.find(Et=>Et.id===we);if(!Ve)return null;const tt=Ve.transitions[ze];if(!tt)return null;const Ie=P.find(Et=>Et.id===tt.goto),Rt=tt.goto==="$done"?"Done":Ie?$e(Ie):tt.goto;return{type:"step",fromLabel:$e(Ve),toLabel:Rt,condition:tt.when}};if(C==="edit"){const pe=Rn();return c.jsxs(un,{isOpen:e,onClose:Je,title:_?"Edit Workflow":"New Workflow",size:"full",children:[X&&c.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:X}),c.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[c.jsxs("div",{className:"min-w-[140px]",children:[c.jsx("label",{className:en,children:"Name"}),c.jsx("input",{value:B,onChange:we=>et(we.target.value),placeholder:"Workflow name",className:Yn})]}),c.jsxs("div",{className:"min-w-[100px]",children:[c.jsx("label",{className:en,children:"ID"}),c.jsx("input",{value:G,onChange:we=>!_&&Y(we.target.value),readOnly:!!_,className:`${Yn} font-mono ${_?"opacity-50":""}`})]}),c.jsxs("div",{className:"flex-1 min-w-[140px]",children:[c.jsx("label",{className:en,children:"Description"}),c.jsx("input",{value:q,onChange:we=>O(we.target.value),placeholder:"What does this workflow do?",className:Yn})]}),c.jsxs("div",{className:"w-20",children:[c.jsx("label",{className:en,children:"Max Iter."}),c.jsx("input",{type:"number",value:I,onChange:we=>U(Number(we.target.value)),className:`${Yn} font-mono`})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Color"}),c.jsx("input",{type:"color",value:Q,onChange:we=>ee(we.target.value),className:"w-8 h-8 rounded border border-border cursor-pointer bg-transparent"})]})]}),c.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[c.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[c.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),c.jsx("button",{onClick:Ce,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),c.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[c.jsx(Q3,{steps:P,entryStep:L,selectedNodeId:(be==null?void 0:be.id)??null,selectedEdgeKey:R,startConditionLabel:_e,agentTypes:ge,onSelectNode:we=>{if(we===null){Ge(null);return}const ze=P.findIndex(Ve=>Ve.id===we);Ge(ze>=0?String(ze):null)},onSelectEdge:ct,onRemoveStep:we=>{var Ve;const ze=P.findIndex(tt=>tt.id===we);if(K(tt=>tt.filter(Ie=>Ie.id!==we)),de===ze&&Ge(null),L===we){const tt=P.filter(Ie=>Ie.id!==we);D(((Ve=tt[0])==null?void 0:Ve.id)??"")}},onCreateTransition:He,onReconnectTo:Ae,onReconnectFrom:st,onDeleteTransition:it}),P.length===0&&c.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[c.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),c.jsx("button",{onClick:Ce,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"})]})]})]}),c.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[c.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:c.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),c.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:pe?pe.type==="start"?c.jsxs("div",{className:"space-y-3 text-sm",children:[c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),L&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[c.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),c.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),c.jsx("span",{className:"text-text-primary font-medium",children:pe.toLabel})]}),c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Activation Condition"}),c.jsx("select",{value:te.type,onChange:we=>Z(we.target.value==="step_result"?{type:"step_result",result:"success"}:{type:we.target.value}),className:ji,children:Lb.map(we=>c.jsx("option",{value:we.value,children:we.label},we.value))})]}),te.type==="step_result"&&c.jsxs("div",{children:[c.jsx("label",{className:en,children:"Result"}),L&&(()=>{const we=P.find(Ie=>Ie.id===L),ze=we&&(we.type==="sub_agent"||we.type==="agent")?ge.find(Ie=>Ie.id===(we.type==="sub_agent"?we.subAgentType:we.toolMode)):void 0,Ve=(ze==null?void 0:ze.results)&&ze.results.length>0,tt=(ze==null?void 0:ze.results)??[];return Ve?c.jsx("select",{value:te.result??tt[0],onChange:Ie=>Z({type:"step_result",result:Ie.target.value}),className:ji,children:tt.map(Ie=>c.jsx("option",{value:Ie,children:Ie},Ie))}):c.jsx("input",{type:"text",value:te.result??"success",onChange:Ie=>Z({type:"step_result",result:Ie.target.value}),placeholder:"e.g. success, passed, failed",className:Yn})})()]}),c.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."})]}):c.jsx(J3,{fromLabel:pe.fromLabel,toLabel:pe.toLabel,condition:pe.condition,fromStep:pe.type==="step"?P.find(we=>we.id===pe.fromLabel):void 0,agentTypes:ge,onUpdateCondition:we=>Ct(R,we),onDelete:()=>it(R)}):be?c.jsx(eT,{step:be,isEntry:be.id===L,agentTypes:ge,transitionCount:be.transitions.length,templateVariables:m,onUpdate:re,onRemove:()=>{var we;if(be&&(K(P.filter((ze,Ve)=>Ve!==de)),Ge(null),L===be.id)){const ze=P.filter((Ve,tt)=>tt!==de);D(((we=ze[0])==null?void 0:we.id)??"")}},onSetEntry:()=>D(be.id)}):c.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",c.jsx("br",{}),"Drag from a port to connect."]})})]})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[c.jsx(ht,{variant:"secondary",onClick:Je,children:"Cancel"}),c.jsx(ht,{variant:"secondary",onClick:fe,disabled:ae||!B,children:ae?"Saving...":"Save"}),c.jsx(ht,{variant:"primary",onClick:Le,disabled:ae||!B,children:"Save & Close"})]})]})}return c.jsxs(un,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),c.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:[l.length>0&&(Oe?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await E(),Fe(!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"}),c.jsx("button",{onClick:()=>Fe(!1),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>Fe(!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"})),c.jsx(ht,{variant:"primary",size:"sm",onClick:ke,children:"+ New"})]})]}),h&&s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0?c.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):c.jsx("div",{className:"space-y-2",children:s.map(pe=>c.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[c.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-text-primary text-sm font-medium",children:pe.name}),c.jsxs("span",{className:"text-text-muted text-xs",children:["v",pe.version]}),l.includes(pe.id)&&c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/15 text-amber-400",children:"modified"})]}),c.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:pe.description})]}),c.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[l.includes(pe.id)&&(Ne===pe.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:async()=>{await S(pe.id),De(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"}),c.jsx("button",{onClick:()=>De(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]}):c.jsx("button",{onClick:()=>De(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-amber-400 transition-colors",title:"Restore default",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})})),c.jsx(ni,{onClick:()=>lt(pe.id)}),pe.id!=="default"&&(y===pe.id?c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>{v(pe.id),j(null)},className:"px-1.5 py-0.5 rounded bg-accent-error/20 text-accent-error text-xs",children:"Delete"}),c.jsx("button",{onClick:()=>j(null),className:"px-1.5 py-0.5 rounded text-text-muted text-xs",children:"Cancel"})]}):c.jsx("button",{onClick:()=>j(pe.id),className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}))]})]},pe.id))})]})}function tT(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(l=>l.status==="failed").length>=4);case"step_result":return null;default:return null}}function nT({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,l]=F.useState(!1),[h,m]=F.useState(""),[o,d]=F.useState(0),[f,g]=F.useState(null),p=F.useRef(null),v=F.useRef(null),S=Vt(y=>y.workflows),E=Vt(y=>y.fetchWorkflows);F.useEffect(()=>{s&&(E(),m(""),d(0),requestAnimationFrame(()=>{var y;return(y=v.current)==null?void 0:y.focus()}))},[s,E]),F.useEffect(()=>{if(!s)return;const y=j=>{p.current&&!p.current.contains(j.target)&&l(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const C=S.filter(y=>{if(!h)return!0;const j=h.toLowerCase();return y.name.toLowerCase().includes(j)}),b=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),d(j=>Math.min(j+1,C.length-1));break;case"ArrowUp":y.preventDefault(),d(j=>Math.max(j-1,0));break;case"Enter":y.preventDefault(),C[o]&&_(C[o].id);break;case"Escape":y.preventDefault(),l(!1);break}},_=y=>{e(y),l(!1)},x=()=>{l(!1),r()};return c.jsxs("div",{ref:p,className:"relative",children:[c.jsxs("button",{type:"button",onClick:()=>l(y=>!y),className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors",children:["Workflows",c.jsx("svg",{className:`w-3 h-3 transition-transform ${s?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&c.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:b,children:[c.jsx("div",{className:"p-2 border-b border-border",children:c.jsx("input",{ref:v,value:h,onChange:y=>{m(y.target.value),d(0)},placeholder:"Search workflows...",className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})}),c.jsx("div",{className:"overflow-y-auto max-h-64 p-1",children:C.length===0?c.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:S.length===0?"No workflows yet":"No matches"}):C.map((y,j)=>{const A=tT(y,i),N=y.color??"#3b82f6";return c.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${j===o?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[c.jsxs("button",{type:"button",onClick:()=>_(y.id),className:"flex-1 text-left flex items-center gap-2",children:[c.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:N}}),c.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:y.name}),A!==null&&c.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:A?"#22c55e":"#6b7280"},title:A?"Entry condition met":"Entry condition not met"})]}),c.jsx(ni,{className:"opacity-0 group-hover:opacity-100",onClick:R=>{R.stopPropagation(),l(!1),g(y.id)}})]},y.id)})}),c.jsx("div",{className:"border-t border-border p-1",children:c.jsx("button",{type:"button",onClick:x,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 Workflows..."})})]}),c.jsx(Mb,{isOpen:!!f,onClose:()=>g(null),initialEditId:f})]})}function rT(e){return e==="criterion"}function iT(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=>rT(s.name))}function sT(e,r=[]){const i=[];let s=null,l=[],h,m=1;const o=new Map,d=new Map,f=[];for(const S of r)S.type==="message"?o.set(S.message.id,S):S.type==="subagent"?d.set(S.subAgentId,S):S.type==="criteria-batch"&&f.push(S);let g=0;const p=()=>{if(l.length>0){const S=f[g];S&&S.type==="criteria-batch"&&S.toolCalls.length===l.length&&S.toolCalls.every((C,b)=>{var _;return C.id===((_=l[b])==null?void 0:_.id)})?i.push(S):i.push({type:"criteria-batch",toolCalls:[...l]}),g++,l=[]}},v=()=>{if(!s)return;const S=s,E=d.get(S.subAgentId);E&&E.type==="subagent"&&E.messages.length===S.messages.length&&E.messages.every((b,_)=>b===S.messages[_])?i.push(E):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&&h&&S.contextWindowId!==h&&(p(),v(),m++,i.push({type:"context-divider",windowSequence:m})),h=S.contextWindowId,iT(S)){v();for(const E of S.toolCalls)l.push(E);continue}if(p(),S.subAgentId&&S.subAgentType)s&&s.subAgentId===S.subAgentId?s.messages.push(S):(v(),s={subAgentId:S.subAgentId,subAgentType:S.subAgentType,messages:[S]});else{v();const E=o.get(S.id);E&&E.type==="message"&&E.message===S?i.push(E):i.push({type:"message",message:S})}}return p(),v(),i}function aT(e){const r=new Date(e),i=r.getFullYear(),s=String(r.getMonth()+1).padStart(2,"0"),l=String(r.getDate()).padStart(2,"0"),h=String(r.getHours()).padStart(2,"0"),m=String(r.getMinutes()).padStart(2,"0");return`${i}/${s}/${l} ${h}:${m}`}function oT(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const lT=10,cT=150;function uT(e,r,i){const s=[],l=e.filter(o=>o.role==="user"&&!o.isSystemGenerated&&o.messageKind!=="auto-prompt");for(const o of l)s.push({id:o.id,content:o.content,timestamp:o.timestamp,sessionId:i,sessionName:"This session"});for(const o of r)if(!(i&&o.id===i)&&o.recentUserPrompts)for(const d of o.recentUserPrompts)s.push({id:d.id,content:d.content,timestamp:d.timestamp,sessionId:o.id,sessionName:o.title||o.id});s.sort((o,d)=>new Date(d.timestamp).getTime()-new Date(o.timestamp).getTime());const h=s.slice(0,lT);h.reverse();const m=[];for(const o of h)m.push({id:o.id,content:o.content,timestamp:o.timestamp,formattedTimestamp:aT(o.timestamp),trimmedContent:oT(o.content,cT),sessionId:o.sessionId||void 0,sessionName:o.sessionName});return m}function dT(e,r=[],i=null){const[s,l]=F.useState(0),[h,m]=F.useState(!1),o=F.useMemo(()=>uT(e,r,i),[e,r,i]),d=F.useCallback(()=>{o.length>0&&(l(o.length-1),m(!0))},[o.length]),f=F.useCallback(()=>{m(!1),l(0)},[]),g=F.useCallback(()=>{l(S=>o.length===0?S:S===0?o.length-1:S-1)},[o.length]),p=F.useCallback(()=>{l(S=>o.length===0?S:S===o.length-1?0:S+1)},[o.length]),v=F.useCallback(()=>{if(o.length===0||!h)return null;const S=o[s];return(S==null?void 0:S.content)??null},[o,s,h]);return{history:o,selectedIndex:s,showHistory:h,openHistory:d,closeHistory:f,navigateUp:g,navigateDown:p,selectCurrent:v}}const hT=(e,r)=>{let i,s=!1,l=!1,h=!1,m=!1;const o=()=>{m=!0;const f=e.current;f&&(f.scrollTop=f.scrollHeight),setTimeout(()=>{m=!1},100)},d=()=>{i=requestAnimationFrame(o),setTimeout(()=>{i=requestAnimationFrame(o)},250),setTimeout(()=>{i=requestAnimationFrame(o)},500),setTimeout(()=>{i=requestAnimationFrame(o)},1e3)};return F.useEffect(()=>{const f=e.current;if(!f)return;const g=new MutationObserver(()=>{if(s||l){cancelAnimationFrame(i);return}i=requestAnimationFrame(o)});d(),g.observe(f,{childList:!0,subtree:!0,characterData:!0});const p=setInterval(()=>{if(s||l){cancelAnimationFrame(i);return}o()},1e3),v=C=>{if(h||m)return;f.scrollHeight-f.scrollTop-f.offsetHeight>50?(cancelAnimationFrame(i),s=!0,console.log("Scroll detected!",C)):s=!1},S=()=>l=!0,E=()=>l=!1;return f.addEventListener("wheel",v,{passive:!0}),f.addEventListener("touchstart",S,{passive:!0}),f.addEventListener("touchend",E,{passive:!0}),()=>{f.removeEventListener("wheel",v),f.removeEventListener("touchstart",S),f.removeEventListener("touchend",E),g.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{s=!1,l=!1,h=!0,o(),setTimeout(()=>o(),250),setTimeout(()=>o(),500),setTimeout(()=>o(),750),setTimeout(()=>o(),1e3),setTimeout(()=>{h=!1},1250)}}};function fT({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,l]=F.useState(""),[h,m]=F.useState([]),[o,d]=F.useState(!1),[f,g]=F.useState(null),[p,v]=F.useState(!1),[S,E]=F.useState(!1),C=F.useRef(null),b=F.useRef(null),_=F.useRef(null),x=Ee(re=>re.currentSession),y=Ee(re=>re.messages),j=Ee(re=>re.streamingMessage),A=Ee(re=>re.sessions),N=Ee(re=>re.error),R=Ee(re=>re.pendingQuestion),T=e0(),B=Ee(re=>re.sendMessage),H=Ee(re=>re.clearError),G=Ee(re=>re.acceptAndBuild),Y=Ee(re=>re.stopGeneration),q=Ee(re=>re.launchRunner),O=Ee(re=>re.cancelQueued),W=eS(),V=Vt(re=>re.workflows),Q=Vt(re=>re.fetchWorkflows);F.useEffect(()=>{Q()},[Q]);const{history:ee,selectedIndex:L,showHistory:D,openHistory:I,closeHistory:U,navigateUp:P,navigateDown:K,selectCurrent:te}=dT(y,A,x==null?void 0:x.id),Z=F.useMemo(()=>j?y.map(re=>re.id===j.id?j:re):y,[y,j]),X=F.useRef([]),z=F.useMemo(()=>{const re=sT(Z,X.current);return X.current=re,re},[Z]),ae=F.useMemo(()=>U3(y),[y]),{force_scroll_to_bottom:se}=hT(C,x),ge=F.useCallback(()=>{const re=b.current;if(!re)return;re.style.height="auto";const _e=Math.min(200,re.scrollHeight);re.style.height=`${_e}px`},[]);F.useEffect(()=>{if(!(x!=null&&x.id))return;const re=`openfox:draft:${x.id}`,_e=localStorage.getItem(re);_e!==null&&l(_e)},[x==null?void 0:x.id]),F.useEffect(()=>{var re;(re=b.current)==null||re.focus(),ge()},[x==null?void 0:x.id,ge]),F.useEffect(()=>{if(!(x!=null&&x.id))return;const re=`openfox:draft:${x.id}`,_e=setTimeout(()=>{s?localStorage.setItem(re,s):localStorage.removeItem(re)},500);return()=>clearTimeout(_e)},[x==null?void 0:x.id,s]),F.useEffect(()=>{ge()},[s,ge]),F.useEffect(()=>{const re=_e=>{_e.key==="Escape"&&T&&Y()};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[T,Y]),F.useEffect(()=>{const re=b.current;if(!re)return;const _e=Ce=>{var Ae;if(document.activeElement!==re)return;const He=(Ae=Ce.clipboardData)==null?void 0:Ae.items;if(He){for(const st of Array.from(He))if(st.type.startsWith("image/")){Ce.preventDefault();const it=st.getAsFile();if(!it)continue;(async()=>{try{if(!Bd(it)){g("Only PNG, JPG, and GIF images are supported.");return}const Ct=zd(it,50*1024*1024);if(!Ct.valid){g(Ct.error??"Image file is too large");return}const $e=await Id(it,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),Rn={id:xl(),filename:"pasted-image",mimeType:$e.mimeType,size:$e.size,data:$e.dataUrl};m(pe=>[...pe,Rn])}catch(Ct){const $e=Ct instanceof Error?Ct.message??"Failed to process image":"Failed to process image";g($e)}})()}}};return re.addEventListener("paste",_e),()=>re.removeEventListener("paste",_e)},[]);const ve=()=>{l(""),m([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},Ne=async re=>{re.preventDefault(),!(!s.trim()&&h.length===0)&&(se(),B(s,h.length>0?h:void 0),ve())},De=re=>{if(D)switch(re.key){case"Enter":re.preventDefault();const _e=te();_e&&(l(_e),U());return;case"Escape":re.preventDefault(),U(),T&&Y();return;case"ArrowUp":re.preventDefault(),P();return;case"ArrowDown":re.preventDefault(),K();return}if(re.key==="ArrowUp"&&s.trim()===""&&!D){re.preventDefault(),I();return}re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),Ne(re))},Oe=F.useCallback(async re=>{const _e=re.target.files;if(!(!_e||_e.length===0)){g(null);for(const Ce of Array.from(_e))try{if(!Bd(Ce)){g(`Unsupported file type: ${Ce.type}. Only PNG, JPG, and GIF are supported.`);continue}const He=zd(Ce,50*1024*1024);if(!He.valid){g(He.error??"Image file is too large");continue}const Ae=await Id(Ce,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),st={id:xl(),filename:Ce.name,mimeType:Ae.mimeType,size:Ae.size,data:Ae.dataUrl};m(it=>[...it,st])}catch(He){const Ae=He instanceof Error?He.message??"Failed to process image":"Failed to process image";g(Ae)}_.current&&(_.current.value="")}},[]),Fe=F.useCallback(re=>{re.preventDefault(),re.stopPropagation(),d(!0)},[]),ke=F.useCallback(re=>{re.preventDefault(),re.stopPropagation(),d(!1)},[]),lt=F.useCallback(async re=>{re.preventDefault(),re.stopPropagation(),d(!1),g(null);const _e=re.dataTransfer.files;if(!(!_e||_e.length===0))for(const Ce of Array.from(_e))try{if(!Bd(Ce)){g(`Unsupported file type: ${Ce.type}. Only PNG, JPG, and GIF are supported.`);continue}const He=zd(Ce,50*1024*1024);if(!He.valid){g(He.error??"Image file is too large");continue}const Ae=await Id(Ce,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),st={id:xl(),filename:Ce.name,mimeType:Ae.mimeType,size:Ae.size,data:Ae.dataUrl};m(it=>[...it,st])}catch(He){const Ae=He instanceof Error?He.message??"Failed to process image":"Failed to process image";g(Ae)}},[]),dt=F.useCallback(re=>{m(_e=>_e.filter(Ce=>Ce.id!==re))},[]),fe=F.useCallback(()=>{var re;(re=_.current)==null||re.click()},[]),Le=(x==null?void 0:x.mode)==="planner",Je=(x==null?void 0:x.mode)==="builder",et=((x==null?void 0:x.criteria.length)??0)>0,Ge=(x==null?void 0:x.phase)==="done",ct=z.some(re=>re.type==="message"&&re.message.role==="assistant"),de=Le&&et&&!T&&ct&&!Ge,be=re=>{const _e=s.trim()?s:void 0,Ce=h.length>0?h:void 0;Le?G(re,_e,Ce):Je&&q(_e,Ce,re),ve()};return c.jsxs(mw,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:Z,children:[R&&c.jsx(A3,{question:R}),c.jsx(xw,{}),c.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto",children:[c.jsx("div",{className:"pt-4",children:z.map((re,_e)=>{if(re.type==="context-divider")return c.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[c.jsx("div",{className:"flex-1 border-t border-border"}),c.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),c.jsx("div",{className:"flex-1 border-t border-border"})]},_e);if(re.type==="subagent"){const He=re.messages.some(Ae=>Ae.isStreaming);return c.jsx("div",{className:"px-2 md:px-4",children:c.jsx(k3,{messages:re.messages,subAgentType:re.subAgentType,isStreaming:He})},_e)}if(re.type==="criteria-batch")return c.jsx("div",{className:"feed-item px-2 md:px-4",children:c.jsx(Nb,{toolCalls:re.toolCalls,criteria:x==null?void 0:x.criteria})},_e);const Ce=re.message;return Ce.role==="assistant"?c.jsx("div",{className:"px-2 md:px-4",children:c.jsx(Wh,{message:Ce,showStats:!0})},_e):c.jsx("div",{className:"px-2 md:px-4",children:c.jsx(Tb,{message:Ce,isLastAssistantMessage:!1,promptContext:Ce.role==="user"?ae[Ce.id]:void 0})},_e)})}),c.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&c.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-red-400 text-sm font-medium",children:N.code}),c.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),c.jsx("button",{onClick:H,className:"text-red-400 hover:text-red-300 p-0.5","aria-label":"Dismiss error",children:c.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),de&&c.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:V.map(re=>{const _e=re.color??"#3b82f6",Ce=parseInt(_e.slice(1,3),16),He=parseInt(_e.slice(3,5),16),Ae=parseInt(_e.slice(5,7),16),st=`rgba(${Ce},${He},${Ae},0.12)`,it=`rgba(${Ce},${He},${Ae},0.22)`,Ct=`rgba(${Ce},${He},${Ae},0.25)`;return c.jsxs("button",{onClick:()=>G(re.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:st,color:_e,border:`1px solid ${Ct}`},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=it},onMouseLeave:$e=>{$e.currentTarget.style.backgroundColor=st},children:["▶ ",re.name]},re.id)})}),T&&c.jsx(D3,{})]})]}),c.jsxs("form",{onSubmit:Ne,className:"p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[c.jsx("input",{ref:_,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:Oe,className:"hidden",multiple:!0}),f&&c.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:f}),h.length>0&&c.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:h.map(re=>c.jsx(R3,{attachment:re,onRemove:dt},re.id))}),D&&c.jsx(L3,{history:ee,selectedIndex:L,onSelect:re=>{l(re),U()},onEscape:U,onNavigate:re=>{re==="up"?P():K()}}),W.length>0&&c.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:W.map(re=>c.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${re.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:[c.jsxs("span",{className:"font-medium",children:[re.mode==="asap"?"ASAP":"Queue",":"]}),c.jsx("span",{className:"truncate max-w-[200px]",children:re.content}),c.jsx("button",{type:"button",onClick:()=>O(re.queueId),className:"hover:text-white transition-colors",children:c.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},re.queueId))}),c.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${o?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:Fe,onDragLeave:ke,onDrop:lt,children:[c.jsx("button",{type:"button",onClick:fe,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:c.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:c.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"})})}),c.jsx("textarea",{ref:b,value:s,onChange:re=>{l(re.target.value),D&&U()},onKeyDown:De,placeholder:Le?"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"}}),c.jsxs("div",{className:"flex flex-col items-end gap-1",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(V3,{onSendCommand:(re,_e,Ce,He)=>{var st;_e&&(x==null?void 0:x.mode)!==_e&&Ee.getState().switchMode(_e);const Ae=Ce&&Ce.trim()?`${Ce.trim()}
|
|
141
|
-
|
|
142
|
-
${re}`:re;(st=C.current)==null||st.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),B(Ae,He!=null&&He.length?He:void 0,{messageKind:"command",isSystemGenerated:!0}),ve()},onOpenManager:()=>v(!0),textareaContent:s,attachments:h.length>0?h:void 0}),c.jsx(nT,{onSelectWorkflow:be,onOpenManager:()=>E(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),c.jsx("div",{className:"flex items-center gap-2",children:c.jsx("button",{type:"button",onClick:()=>{var re;!s.trim()&&h.length===0||((re=C.current)==null||re.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),B(s,h),ve())},disabled:!s.trim()&&h.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"})})]})]}),c.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(N3,{}),c.jsx(T3,{})]}),c.jsx(W3,{})]})]}),c.jsx(Db,{isOpen:p,onClose:()=>v(!1)}),c.jsx(Mb,{isOpen:S,onClose:()=>E(!1)})]})}F.memo(function({item:r}){const[i,s]=F.useState(!1);return r.type==="start"?c.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:[c.jsx("span",{className:"animate-pulse",children:"●"}),c.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&c.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):c.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[c.jsx("span",{className:"text-accent-success",children:"✓"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),c.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&&c.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:c.jsx(Ds,{content:r.description})})]})]})});function Uv({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[l,h]=F.useState(""),m=F.useRef(null);F.useEffect(()=>{e&&(h(""),setTimeout(()=>{var d;return(d=m.current)==null?void 0:d.focus()},100))},[e]);const o=d=>{d.preventDefault(),l.trim()&&i(l)};return c.jsx(un,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:c.jsxs("form",{onSubmit:o,className:"space-y-4",children:[c.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."}),c.jsx(Ll,{ref:m,type:"password",value:l,onChange:d=>h(d.target.value),placeholder:"Enter password",autoFocus:!0}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(ht,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),c.jsx(ht,{type:"submit",disabled:!l.trim(),children:r?"Try Again":"Connect"})]})]})})}function Yh(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function Ob(){return c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(dh,{})})}function pT({sidebarOpen:e,onSidebarToggle:r}){const[,i]=oh("/p/:projectId"),s=i==null?void 0:i.projectId,l=Ee(p=>p.connectionStatus),h=Ee(p=>p.listSessions),m=Ee(p=>p.clearSession),o=Ft(p=>p.currentProject),d=Ft(p=>p.loadProject),f=Yh(),g=l==="connected"||f;return F.useEffect(()=>{g&&s&&((o==null?void 0:o.id)!==s&&d(s),h(s),m())},[g,s,o==null?void 0:o.id,d,h,m]),!o||o.id!==s?c.jsx(Ob,{}):c.jsxs(c.Fragment,{children:[c.jsx(a0,{projectId:s,isOpen:e,onClose:r}),c.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:c.jsx(BS,{})})]})}function mT({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,l]=oh("/p/:projectId/s/:sessionId"),h=l==null?void 0:l.projectId,m=l==null?void 0:l.sessionId,[,o]=Ti(),d=Ee(y=>y.connectionStatus),f=Ee(y=>y.currentSession),g=Ee(y=>y.loadSession),p=Ee(y=>y.listSessions),v=Ee(y=>y.pendingSessionCreate),S=Ee(y=>y.error),E=Ee(y=>y.clearError),C=Ft(y=>y.currentProject),b=Ft(y=>y.loadProject),_=Yh(),x=d==="connected"||_;return F.useEffect(()=>{x&&h&&(C==null?void 0:C.id)!==h&&b(h)},[x,h,C==null?void 0:C.id,b]),F.useEffect(()=>{x&&m&&(f==null?void 0:f.id)!==m&&!v&&g(m),x&&h&&p(h)},[x,m,f==null?void 0:f.id,g,p,v,h]),F.useEffect(()=>{(S==null?void 0:S.code)==="NOT_FOUND"&&h&&(E(),o(`/p/${h}`))},[S,h,E,o]),!C||C.id!==h?c.jsx(Ob,{}):c.jsxs(c.Fragment,{children:[c.jsx(a0,{projectId:h,isOpen:e,onClose:r}),c.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:c.jsx(fT,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function gT(){const{connectionStatus:e}=nS(),r=Gt(R=>R.fetchConfig),i=Yh(),s=()=>{const R=localStorage.getItem("openfox:leftSidebar");return R!==null?R==="true":!1},l=()=>{const R=localStorage.getItem("openfox:rightSidebar");return R!==null?R==="true":!0},[h,m]=F.useState(s),[o,d]=F.useState(l),[f,g]=F.useState(!1),[p,v]=F.useState(!1),[S,E]=F.useState(!1);F.useEffect(()=>{const R=()=>{E(window.innerWidth<768)};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]);const C=S?f:h,b=S?p:o,_=()=>{S?g(!f):m(!h)},x=()=>{S?v(!p):d(!o)};F.useEffect(()=>{S||localStorage.setItem("openfox:leftSidebar",String(h))},[h,S]),F.useEffect(()=>{S||localStorage.setItem("openfox:rightSidebar",String(o))},[o,S]),F.useEffect(()=>{(e==="connected"||i)&&r()},[e,r,i]);const y=Ee(R=>R.showPasswordModal),j=Ee(R=>R.passwordModalRetry),A=Ee(R=>R.submitPassword),N=Ee(R=>R.cancelPassword);return e!=="connected"&&!y&&!i?c.jsxs(c.Fragment,{children:[c.jsx(Uv,{isOpen:!0,isRetry:j,onSubmit:A,onCancel:N}),c.jsx("div",{className:"h-screen flex items-center justify-center",children:c.jsx(OS,{text:"Connecting to server..."})})]}):c.jsxs(c.Fragment,{children:[c.jsx(Uv,{isOpen:y,isRetry:j,onSubmit:A,onCancel:N}),c.jsxs("div",{className:"h-screen flex flex-col",children:[c.jsx(NS,{}),c.jsx(CS,{onMenuClick:_,onCriteriaToggle:x}),c.jsx("div",{className:"flex-1 flex overflow-hidden",children:c.jsxs(T1,{children:[c.jsx(cl,{path:"/p/:projectId/s/:sessionId",children:c.jsx(mT,{sidebarOpen:C,onSidebarToggle:_,rightSidebarOpen:b,onRightSidebarToggle:x})}),c.jsx(cl,{path:"/p/:projectId/new",children:c.jsx(IS,{})}),c.jsx(cl,{path:"/p/:projectId",children:c.jsx(pT,{sidebarOpen:C,onSidebarToggle:_})}),c.jsx(cl,{path:"/",children:c.jsx(LS,{})})]})})]})]})}o1.createRoot(document.getElementById("root")).render(c.jsx(ln.StrictMode,{children:c.jsx(gT,{})}));
|