plotlink-ows 1.0.23 → 1.0.25

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Kg;function _x(){if(Kg)return ql;Kg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return ql.Fragment=t,ql.jsx=n,ql.jsxs=n,ql}var Xg;function gx(){return Xg||(Xg=1,Fh.exports=_x()),Fh.exports}var S=gx(),qh={exports:{}},Ce={};/**
9
+ */var $g;function vx(){if($g)return ql;$g=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,a,o){var c=null;if(o!==void 0&&(c=""+o),a.key!==void 0&&(c=""+a.key),"key"in a){o={};for(var f in a)f!=="key"&&(o[f]=a[f])}else o=a;return a=o.ref,{$$typeof:e,type:s,key:c,ref:a!==void 0?a:null,props:o}}return ql.Fragment=t,ql.jsx=n,ql.jsxs=n,ql}var Gg;function yx(){return Gg||(Gg=1,Fh.exports=vx()),Fh.exports}var S=yx(),qh={exports:{}},Ce={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var $g;function vx(){if($g)return Ce;$g=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,L={};function R(D,V,C){this.props=D,this.context=V,this.refs=L,this.updater=C||x}R.prototype.isReactComponent={},R.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,V,"setState")},R.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=R.prototype;function I(D,V,C){this.props=D,this.context=V,this.refs=L,this.updater=C||x}var Z=I.prototype=new $;Z.constructor=I,E(Z,R.prototype),Z.isPureReactComponent=!0;var Y=Array.isArray;function O(){}var J={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function de(D,V,C){var ee=C.ref;return{$$typeof:e,type:D,key:V,ref:ee!==void 0?ee:null,props:C}}function F(D,V){return de(D.type,V,D.props)}function le(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function H(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(C){return V[C]})}var T=/\/+/g;function B(D,V){return typeof D=="object"&&D!==null&&D.key!=null?H(""+D.key):V.toString(36)}function N(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(O,O):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function A(D,V,C,ee,pe){var he=typeof D;(he==="undefined"||he==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(he){case"bigint":case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case e:case t:be=!0;break;case g:return be=D._init,A(be(D._payload),V,C,ee,pe)}}if(be)return pe=pe(D),be=ee===""?"."+B(D,0):ee,Y(pe)?(C="",be!=null&&(C=be.replace(T,"$&/")+"/"),A(pe,V,C,"",function(Ht){return Ht})):pe!=null&&(le(pe)&&(pe=F(pe,C+(pe.key==null||D&&D.key===pe.key?"":(""+pe.key).replace(T,"$&/")+"/")+be)),V.push(pe)),1;be=0;var Ue=ee===""?".":ee+":";if(Y(D))for(var Se=0;Se<D.length;Se++)ee=D[Se],he=Ue+B(ee,Se),be+=A(ee,V,C,he,pe);else if(Se=y(D),typeof Se=="function")for(D=Se.call(D),Se=0;!(ee=D.next()).done;)ee=ee.value,he=Ue+B(ee,Se++),be+=A(ee,V,C,he,pe);else if(he==="object"){if(typeof D.then=="function")return A(N(D),V,C,ee,pe);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return be}function j(D,V,C){if(D==null)return D;var ee=[],pe=0;return A(D,ee,"","",function(he){return V.call(C,he,pe++)}),ee}function P(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(C){(D._status===0||D._status===-1)&&(D._status=1,D._result=C)},function(C){(D._status===0||D._status===-1)&&(D._status=2,D._result=C)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var se=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},k={map:j,forEach:function(D,V,C){j(D,function(){V.apply(this,arguments)},C)},count:function(D){var V=0;return j(D,function(){V++}),V},toArray:function(D){return j(D,function(V){return V})||[]},only:function(D){if(!le(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ce.Activity=_,Ce.Children=k,Ce.Component=R,Ce.Fragment=n,Ce.Profiler=a,Ce.PureComponent=I,Ce.StrictMode=s,Ce.Suspense=p,Ce.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,Ce.__COMPILER_RUNTIME={__proto__:null,c:function(D){return J.H.useMemoCache(D)}},Ce.cache=function(D){return function(){return D.apply(null,arguments)}},Ce.cacheSignal=function(){return null},Ce.cloneElement=function(D,V,C){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ee=E({},D.props),pe=D.key;if(V!=null)for(he in V.key!==void 0&&(pe=""+V.key),V)!ae.call(V,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&V.ref===void 0||(ee[he]=V[he]);var he=arguments.length-2;if(he===1)ee.children=C;else if(1<he){for(var be=Array(he),Ue=0;Ue<he;Ue++)be[Ue]=arguments[Ue+2];ee.children=be}return de(D.type,pe,ee)},Ce.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:o,_context:D},D},Ce.createElement=function(D,V,C){var ee,pe={},he=null;if(V!=null)for(ee in V.key!==void 0&&(he=""+V.key),V)ae.call(V,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(pe[ee]=V[ee]);var be=arguments.length-2;if(be===1)pe.children=C;else if(1<be){for(var Ue=Array(be),Se=0;Se<be;Se++)Ue[Se]=arguments[Se+2];pe.children=Ue}if(D&&D.defaultProps)for(ee in be=D.defaultProps,be)pe[ee]===void 0&&(pe[ee]=be[ee]);return de(D,he,pe)},Ce.createRef=function(){return{current:null}},Ce.forwardRef=function(D){return{$$typeof:f,render:D}},Ce.isValidElement=le,Ce.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:P}},Ce.memo=function(D,V){return{$$typeof:h,type:D,compare:V===void 0?null:V}},Ce.startTransition=function(D){var V=J.T,C={};J.T=C;try{var ee=D(),pe=J.S;pe!==null&&pe(C,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(O,se)}catch(he){se(he)}finally{V!==null&&C.types!==null&&(V.types=C.types),J.T=V}},Ce.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},Ce.use=function(D){return J.H.use(D)},Ce.useActionState=function(D,V,C){return J.H.useActionState(D,V,C)},Ce.useCallback=function(D,V){return J.H.useCallback(D,V)},Ce.useContext=function(D){return J.H.useContext(D)},Ce.useDebugValue=function(){},Ce.useDeferredValue=function(D,V){return J.H.useDeferredValue(D,V)},Ce.useEffect=function(D,V){return J.H.useEffect(D,V)},Ce.useEffectEvent=function(D){return J.H.useEffectEvent(D)},Ce.useId=function(){return J.H.useId()},Ce.useImperativeHandle=function(D,V,C){return J.H.useImperativeHandle(D,V,C)},Ce.useInsertionEffect=function(D,V){return J.H.useInsertionEffect(D,V)},Ce.useLayoutEffect=function(D,V){return J.H.useLayoutEffect(D,V)},Ce.useMemo=function(D,V){return J.H.useMemo(D,V)},Ce.useOptimistic=function(D,V){return J.H.useOptimistic(D,V)},Ce.useReducer=function(D,V,C){return J.H.useReducer(D,V,C)},Ce.useRef=function(D){return J.H.useRef(D)},Ce.useState=function(D){return J.H.useState(D)},Ce.useSyncExternalStore=function(D,V,C){return J.H.useSyncExternalStore(D,V,C)},Ce.useTransition=function(){return J.H.useTransition()},Ce.version="19.2.3",Ce}var Gg;function Sd(){return Gg||(Gg=1,qh.exports=vx()),qh.exports}var ie=Sd();const yx=gu(ie);var Wh={exports:{}},Wl={},Yh={exports:{}},Vh={};/**
17
+ */var Zg;function bx(){if(Zg)return Ce;Zg=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,L={};function R(D,V,w){this.props=D,this.context=V,this.refs=L,this.updater=w||x}R.prototype.isReactComponent={},R.prototype.setState=function(D,V){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,V,"setState")},R.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=R.prototype;function I(D,V,w){this.props=D,this.context=V,this.refs=L,this.updater=w||x}var Z=I.prototype=new $;Z.constructor=I,k(Z,R.prototype),Z.isPureReactComponent=!0;var Y=Array.isArray;function O(){}var J={H:null,A:null,T:null,S:null},ce=Object.prototype.hasOwnProperty;function pe(D,V,w){var ie=w.ref;return{$$typeof:e,type:D,key:V,ref:ie!==void 0?ie:null,props:w}}function F(D,V){return pe(D.type,V,D.props)}function se(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function H(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(w){return V[w]})}var E=/\/+/g;function B(D,V){return typeof D=="object"&&D!==null&&D.key!=null?H(""+D.key):V.toString(36)}function N(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(O,O):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function A(D,V,w,ie,ae){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var ge=!1;if(D===null)ge=!0;else switch(le){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(D.$$typeof){case e:case t:ge=!0;break;case g:return ge=D._init,A(ge(D._payload),V,w,ie,ae)}}if(ge)return ae=ae(D),ge=ie===""?"."+B(D,0):ie,Y(ae)?(w="",ge!=null&&(w=ge.replace(E,"$&/")+"/"),A(ae,V,w,"",function(Ze){return Ze})):ae!=null&&(se(ae)&&(ae=F(ae,w+(ae.key==null||D&&D.key===ae.key?"":(""+ae.key).replace(E,"$&/")+"/")+ge)),V.push(ae)),1;ge=0;var Ee=ie===""?".":ie+":";if(Y(D))for(var Se=0;Se<D.length;Se++)ie=D[Se],le=Ee+B(ie,Se),ge+=A(ie,V,w,le,ae);else if(Se=y(D),typeof Se=="function")for(D=Se.call(D),Se=0;!(ie=D.next()).done;)ie=ie.value,le=Ee+B(ie,Se++),ge+=A(ie,V,w,le,ae);else if(le==="object"){if(typeof D.then=="function")return A(N(D),V,w,ie,ae);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ge}function j(D,V,w){if(D==null)return D;var ie=[],ae=0;return A(D,ie,"","",function(le){return V.call(w,le,ae++)}),ie}function P(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(w){(D._status===0||D._status===-1)&&(D._status=1,D._result=w)},function(w){(D._status===0||D._status===-1)&&(D._status=2,D._result=w)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var oe=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},T={map:j,forEach:function(D,V,w){j(D,function(){V.apply(this,arguments)},w)},count:function(D){var V=0;return j(D,function(){V++}),V},toArray:function(D){return j(D,function(V){return V})||[]},only:function(D){if(!se(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ce.Activity=_,Ce.Children=T,Ce.Component=R,Ce.Fragment=n,Ce.Profiler=a,Ce.PureComponent=I,Ce.StrictMode=s,Ce.Suspense=p,Ce.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,Ce.__COMPILER_RUNTIME={__proto__:null,c:function(D){return J.H.useMemoCache(D)}},Ce.cache=function(D){return function(){return D.apply(null,arguments)}},Ce.cacheSignal=function(){return null},Ce.cloneElement=function(D,V,w){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ie=k({},D.props),ae=D.key;if(V!=null)for(le in V.key!==void 0&&(ae=""+V.key),V)!ce.call(V,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&V.ref===void 0||(ie[le]=V[le]);var le=arguments.length-2;if(le===1)ie.children=w;else if(1<le){for(var ge=Array(le),Ee=0;Ee<le;Ee++)ge[Ee]=arguments[Ee+2];ie.children=ge}return pe(D.type,ae,ie)},Ce.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:o,_context:D},D},Ce.createElement=function(D,V,w){var ie,ae={},le=null;if(V!=null)for(ie in V.key!==void 0&&(le=""+V.key),V)ce.call(V,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(ae[ie]=V[ie]);var ge=arguments.length-2;if(ge===1)ae.children=w;else if(1<ge){for(var Ee=Array(ge),Se=0;Se<ge;Se++)Ee[Se]=arguments[Se+2];ae.children=Ee}if(D&&D.defaultProps)for(ie in ge=D.defaultProps,ge)ae[ie]===void 0&&(ae[ie]=ge[ie]);return pe(D,le,ae)},Ce.createRef=function(){return{current:null}},Ce.forwardRef=function(D){return{$$typeof:f,render:D}},Ce.isValidElement=se,Ce.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:P}},Ce.memo=function(D,V){return{$$typeof:h,type:D,compare:V===void 0?null:V}},Ce.startTransition=function(D){var V=J.T,w={};J.T=w;try{var ie=D(),ae=J.S;ae!==null&&ae(w,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(O,oe)}catch(le){oe(le)}finally{V!==null&&w.types!==null&&(V.types=w.types),J.T=V}},Ce.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},Ce.use=function(D){return J.H.use(D)},Ce.useActionState=function(D,V,w){return J.H.useActionState(D,V,w)},Ce.useCallback=function(D,V){return J.H.useCallback(D,V)},Ce.useContext=function(D){return J.H.useContext(D)},Ce.useDebugValue=function(){},Ce.useDeferredValue=function(D,V){return J.H.useDeferredValue(D,V)},Ce.useEffect=function(D,V){return J.H.useEffect(D,V)},Ce.useEffectEvent=function(D){return J.H.useEffectEvent(D)},Ce.useId=function(){return J.H.useId()},Ce.useImperativeHandle=function(D,V,w){return J.H.useImperativeHandle(D,V,w)},Ce.useInsertionEffect=function(D,V){return J.H.useInsertionEffect(D,V)},Ce.useLayoutEffect=function(D,V){return J.H.useLayoutEffect(D,V)},Ce.useMemo=function(D,V){return J.H.useMemo(D,V)},Ce.useOptimistic=function(D,V){return J.H.useOptimistic(D,V)},Ce.useReducer=function(D,V,w){return J.H.useReducer(D,V,w)},Ce.useRef=function(D){return J.H.useRef(D)},Ce.useState=function(D){return J.H.useState(D)},Ce.useSyncExternalStore=function(D,V,w){return J.H.useSyncExternalStore(D,V,w)},Ce.useTransition=function(){return J.H.useTransition()},Ce.version="19.2.3",Ce}var Qg;function wd(){return Qg||(Qg=1,qh.exports=bx()),qh.exports}var Q=wd();const Sx=gu(Q);var Wh={exports:{}},Wl={},Yh={exports:{}},Vh={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Zg;function bx(){return Zg||(Zg=1,(function(e){function t(A,j){var P=A.length;A.push(j);e:for(;0<P;){var se=P-1>>>1,k=A[se];if(0<a(k,j))A[se]=j,A[P]=k,P=se;else break e}}function n(A){return A.length===0?null:A[0]}function s(A){if(A.length===0)return null;var j=A[0],P=A.pop();if(P!==j){A[0]=P;e:for(var se=0,k=A.length,D=k>>>1;se<D;){var V=2*(se+1)-1,C=A[V],ee=V+1,pe=A[ee];if(0>a(C,P))ee<k&&0>a(pe,C)?(A[se]=pe,A[ee]=P,se=ee):(A[se]=C,A[V]=P,se=V);else if(ee<k&&0>a(pe,P))A[se]=pe,A[ee]=P,se=ee;else break e}}return j}function a(A,j){var P=A.sortIndex-j.sortIndex;return P!==0?P:A.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],h=[],g=1,_=null,b=3,y=!1,x=!1,E=!1,L=!1,R=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function Z(A){for(var j=n(h);j!==null;){if(j.callback===null)s(h);else if(j.startTime<=A)s(h),j.sortIndex=j.expirationTime,t(p,j);else break;j=n(h)}}function Y(A){if(E=!1,Z(A),!x)if(n(p)!==null)x=!0,O||(O=!0,H());else{var j=n(h);j!==null&&N(Y,j.startTime-A)}}var O=!1,J=-1,ae=5,de=-1;function F(){return L?!0:!(e.unstable_now()-de<ae)}function le(){if(L=!1,O){var A=e.unstable_now();de=A;var j=!0;try{e:{x=!1,E&&(E=!1,$(J),J=-1),y=!0;var P=b;try{t:{for(Z(A),_=n(p);_!==null&&!(_.expirationTime>A&&F());){var se=_.callback;if(typeof se=="function"){_.callback=null,b=_.priorityLevel;var k=se(_.expirationTime<=A);if(A=e.unstable_now(),typeof k=="function"){_.callback=k,Z(A),j=!0;break t}_===n(p)&&s(p),Z(A)}else s(p);_=n(p)}if(_!==null)j=!0;else{var D=n(h);D!==null&&N(Y,D.startTime-A),j=!1}}break e}finally{_=null,b=P,y=!1}j=void 0}}finally{j?H():O=!1}}}var H;if(typeof I=="function")H=function(){I(le)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,B=T.port2;T.port1.onmessage=le,H=function(){B.postMessage(null)}}else H=function(){R(le,0)};function N(A,j){J=R(function(){A(e.unstable_now())},j)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var j=3;break;default:j=b}var P=b;b=j;try{return A()}finally{b=P}},e.unstable_requestPaint=function(){L=!0},e.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var P=b;b=A;try{return j()}finally{b=P}},e.unstable_scheduleCallback=function(A,j,P){var se=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?se+P:se):P=se,A){case 1:var k=-1;break;case 2:k=250;break;case 5:k=1073741823;break;case 4:k=1e4;break;default:k=5e3}return k=P+k,A={id:g++,callback:j,priorityLevel:A,startTime:P,expirationTime:k,sortIndex:-1},P>se?(A.sortIndex=P,t(h,A),n(p)===null&&A===n(h)&&(E?($(J),J=-1):E=!0,N(Y,P-se))):(A.sortIndex=k,t(p,A),x||y||(x=!0,O||(O=!0,H()))),A},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(A){var j=b;return function(){var P=b;b=j;try{return A.apply(this,arguments)}finally{b=P}}}})(Vh)),Vh}var Qg;function Sx(){return Qg||(Qg=1,Yh.exports=bx()),Yh.exports}var Kh={exports:{}},Kt={};/**
25
+ */var Jg;function xx(){return Jg||(Jg=1,(function(e){function t(A,j){var P=A.length;A.push(j);e:for(;0<P;){var oe=P-1>>>1,T=A[oe];if(0<a(T,j))A[oe]=j,A[P]=T,P=oe;else break e}}function n(A){return A.length===0?null:A[0]}function s(A){if(A.length===0)return null;var j=A[0],P=A.pop();if(P!==j){A[0]=P;e:for(var oe=0,T=A.length,D=T>>>1;oe<D;){var V=2*(oe+1)-1,w=A[V],ie=V+1,ae=A[ie];if(0>a(w,P))ie<T&&0>a(ae,w)?(A[oe]=ae,A[ie]=P,oe=ie):(A[oe]=w,A[V]=P,oe=V);else if(ie<T&&0>a(ae,P))A[oe]=ae,A[ie]=P,oe=ie;else break e}}return j}function a(A,j){var P=A.sortIndex-j.sortIndex;return P!==0?P:A.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],h=[],g=1,_=null,b=3,y=!1,x=!1,k=!1,L=!1,R=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function Z(A){for(var j=n(h);j!==null;){if(j.callback===null)s(h);else if(j.startTime<=A)s(h),j.sortIndex=j.expirationTime,t(p,j);else break;j=n(h)}}function Y(A){if(k=!1,Z(A),!x)if(n(p)!==null)x=!0,O||(O=!0,H());else{var j=n(h);j!==null&&N(Y,j.startTime-A)}}var O=!1,J=-1,ce=5,pe=-1;function F(){return L?!0:!(e.unstable_now()-pe<ce)}function se(){if(L=!1,O){var A=e.unstable_now();pe=A;var j=!0;try{e:{x=!1,k&&(k=!1,$(J),J=-1),y=!0;var P=b;try{t:{for(Z(A),_=n(p);_!==null&&!(_.expirationTime>A&&F());){var oe=_.callback;if(typeof oe=="function"){_.callback=null,b=_.priorityLevel;var T=oe(_.expirationTime<=A);if(A=e.unstable_now(),typeof T=="function"){_.callback=T,Z(A),j=!0;break t}_===n(p)&&s(p),Z(A)}else s(p);_=n(p)}if(_!==null)j=!0;else{var D=n(h);D!==null&&N(Y,D.startTime-A),j=!1}}break e}finally{_=null,b=P,y=!1}j=void 0}}finally{j?H():O=!1}}}var H;if(typeof I=="function")H=function(){I(se)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,B=E.port2;E.port1.onmessage=se,H=function(){B.postMessage(null)}}else H=function(){R(se,0)};function N(A,j){J=R(function(){A(e.unstable_now())},j)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ce=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var j=3;break;default:j=b}var P=b;b=j;try{return A()}finally{b=P}},e.unstable_requestPaint=function(){L=!0},e.unstable_runWithPriority=function(A,j){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var P=b;b=A;try{return j()}finally{b=P}},e.unstable_scheduleCallback=function(A,j,P){var oe=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?oe+P:oe):P=oe,A){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=P+T,A={id:g++,callback:j,priorityLevel:A,startTime:P,expirationTime:T,sortIndex:-1},P>oe?(A.sortIndex=P,t(h,A),n(p)===null&&A===n(h)&&(k?($(J),J=-1):k=!0,N(Y,P-oe))):(A.sortIndex=T,t(p,A),x||y||(x=!0,O||(O=!0,H()))),A},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(A){var j=b;return function(){var P=b;b=j;try{return A.apply(this,arguments)}finally{b=P}}}})(Vh)),Vh}var ev;function wx(){return ev||(ev=1,Yh.exports=xx()),Yh.exports}var Kh={exports:{}},Xt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Jg;function xx(){if(Jg)return Kt;Jg=1;var e=Sd();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(p,h,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:_==null?null:""+_,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Kt.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(p,h,null,g)},Kt.flushSync=function(p){var h=c.T,g=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=h,s.p=g,s.d.f()}},Kt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(p,h))},Kt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Kt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:y}):g==="script"&&s.d.X(p,{crossOrigin:_,integrity:b,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Kt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);s.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(p)},Kt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin);s.d.L(p,g,{crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Kt.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);s.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(p)},Kt.requestFormReset=function(p){s.d.r(p)},Kt.unstable_batchedUpdates=function(p,h){return p(h)},Kt.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},Kt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Kt.version="19.2.3",Kt}var ev;function wx(){if(ev)return Kh.exports;ev=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Kh.exports=xx(),Kh.exports}/**
33
+ */var tv;function Cx(){if(tv)return Xt;tv=1;var e=wd();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function o(p,h,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:_==null?null:""+_,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Xt.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(p,h,null,g)},Xt.flushSync=function(p){var h=c.T,g=s.p;try{if(c.T=null,s.p=2,p)return p()}finally{c.T=h,s.p=g,s.d.f()}},Xt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(p,h))},Xt.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},Xt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?s.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:y}):g==="script"&&s.d.X(p,{crossOrigin:_,integrity:b,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Xt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);s.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(p)},Xt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,_=f(g,h.crossOrigin);s.d.L(p,g,{crossOrigin:_,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Xt.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);s.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(p)},Xt.requestFormReset=function(p){s.d.r(p)},Xt.unstable_batchedUpdates=function(p,h){return p(h)},Xt.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},Xt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Xt.version="19.2.3",Xt}var iv;function kx(){if(iv)return Kh.exports;iv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Kh.exports=Cx(),Kh.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,15 +38,15 @@
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var tv;function Cx(){if(tv)return Wl;tv=1;var e=Sx(),t=Sd(),n=wx();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function p(i){if(o(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(s(188));return r!==i?null:i}for(var l=i,u=r;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(u=d.return,u!==null){l=u;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return p(d),i;if(m===u)return p(d),r;m=m.sibling}throw Error(s(188))}if(l.return!==u.return)l=d,u=m;else{for(var v=!1,w=d.child;w;){if(w===l){v=!0,l=d,u=m;break}if(w===u){v=!0,u=d,l=m;break}w=w.sibling}if(!v){for(w=m.child;w;){if(w===l){v=!0,l=m,u=d;break}if(w===u){v=!0,u=m,l=d;break}w=w.sibling}if(!v)throw Error(s(189))}}if(l.alternate!==u)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?i:r}function g(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=g(i),r!==null)return r;i=i.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),I=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=le&&i[le]||i["@@iterator"],typeof i=="function"?i:null)}var T=Symbol.for("react.client.reference");function B(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===T?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case R:return"Profiler";case L:return"StrictMode";case Y:return"Suspense";case O:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case I:return i.displayName||"Context";case $:return(i._context.displayName||"Context")+".Consumer";case Z:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return r=i.displayName||null,r!==null?r:B(i.type)||"Memo";case ae:r=i._payload,i=i._init;try{return B(i(r))}catch{}}return null}var N=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},se=[],k=-1;function D(i){return{current:i}}function V(i){0>k||(i.current=se[k],se[k]=null,k--)}function C(i,r){k++,se[k]=i.current,i.current=r}var ee=D(null),pe=D(null),he=D(null),be=D(null);function Ue(i,r){switch(C(he,r),C(pe,i),C(ee,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?_g(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=_g(r),i=gg(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}V(ee),C(ee,i)}function Se(){V(ee),V(pe),V(he)}function Ht(i){i.memoizedState!==null&&C(be,i);var r=ee.current,l=gg(r,i.type);r!==l&&(C(pe,i),C(ee,l))}function Qt(i){pe.current===i&&(V(ee),V(pe)),be.current===i&&(V(be),Ul._currentValue=P)}var ai,je;function yi(i){if(ai===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);ai=r&&r[1]||"",je=-1<l.stack.indexOf(`
41
+ */var nv;function Ex(){if(nv)return Wl;nv=1;var e=wx(),t=wd(),n=kx();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,l=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(l=r.return),i=r.return;while(i)}return r.tag===3?l:null}function c(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function f(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function p(i){if(o(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(s(188));return r!==i?null:i}for(var l=i,u=r;;){var d=l.return;if(d===null)break;var m=d.alternate;if(m===null){if(u=d.return,u!==null){l=u;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===l)return p(d),i;if(m===u)return p(d),r;m=m.sibling}throw Error(s(188))}if(l.return!==u.return)l=d,u=m;else{for(var v=!1,C=d.child;C;){if(C===l){v=!0,l=d,u=m;break}if(C===u){v=!0,u=d,l=m;break}C=C.sibling}if(!v){for(C=m.child;C;){if(C===l){v=!0,l=m,u=d;break}if(C===u){v=!0,u=m,l=d;break}C=C.sibling}if(!v)throw Error(s(189))}}if(l.alternate!==u)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?i:r}function g(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=g(i),r!==null)return r;i=i.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),I=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),ce=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),se=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=se&&i[se]||i["@@iterator"],typeof i=="function"?i:null)}var E=Symbol.for("react.client.reference");function B(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===E?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case R:return"Profiler";case L:return"StrictMode";case Y:return"Suspense";case O:return"SuspenseList";case pe:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case I:return i.displayName||"Context";case $:return(i._context.displayName||"Context")+".Consumer";case Z:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return r=i.displayName||null,r!==null?r:B(i.type)||"Memo";case ce:r=i._payload,i=i._init;try{return B(i(r))}catch{}}return null}var N=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},oe=[],T=-1;function D(i){return{current:i}}function V(i){0>T||(i.current=oe[T],oe[T]=null,T--)}function w(i,r){T++,oe[T]=i.current,i.current=r}var ie=D(null),ae=D(null),le=D(null),ge=D(null);function Ee(i,r){switch(w(le,r),w(ae,i),w(ie,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?vg(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=vg(r),i=yg(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}V(ie),w(ie,i)}function Se(){V(ie),V(ae),V(le)}function Ze(i){i.memoizedState!==null&&w(ge,i);var r=ie.current,l=yg(r,i.type);r!==l&&(w(ae,i),w(ie,l))}function Fe(i){ae.current===i&&(V(ie),V(ae)),ge.current===i&&(V(ge),Ul._currentValue=P)}var ai,He;function yi(i){if(ai===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);ai=r&&r[1]||"",He=-1<l.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ai+i+je}var Gr=!1;function Zr(i,r){if(!i||Gr)return"";Gr=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(X){var K=X}Reflect.construct(i,[],ne)}else{try{ne.call()}catch(X){K=X}i.call(ne.prototype)}}else{try{throw Error()}catch(X){K=X}(ne=i())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(X){if(X&&K&&typeof X.stack=="string")return[X.stack,K.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=u.DetermineComponentFrameRoot(),v=m[0],w=m[1];if(v&&w){var M=v.split(`
44
- `),W=w.split(`
43
+ `+ai+i+He}var Gr=!1;function Zr(i,r){if(!i||Gr)return"";Gr=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(X){var K=X}Reflect.construct(i,[],ne)}else{try{ne.call()}catch(X){K=X}i.call(ne.prototype)}}else{try{throw Error()}catch(X){K=X}(ne=i())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(X){if(X&&K&&typeof X.stack=="string")return[X.stack,K.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=u.DetermineComponentFrameRoot(),v=m[0],C=m[1];if(v&&C){var M=v.split(`
44
+ `),W=C.split(`
45
45
  `);for(d=u=0;u<M.length&&!M[u].includes("DetermineComponentFrameRoot");)u++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(u===M.length||d===W.length)for(u=M.length-1,d=W.length-1;1<=u&&0<=d&&M[u]!==W[d];)d--;for(;1<=u&&0<=d;u--,d--)if(M[u]!==W[d]){if(u!==1||d!==1)do if(u--,d--,0>d||M[u]!==W[d]){var G=`
46
46
  `+M[u].replace(" at new "," at ");return i.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",i.displayName)),G}while(1<=u&&0<=d);break}}}finally{Gr=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?yi(l):""}function ka(i,r){switch(i.tag){case 26:case 27:case 5:return yi(i.type);case 16:return yi("Lazy");case 13:return i.child!==r&&r!==null?yi("Suspense Fallback"):yi("Suspense");case 19:return yi("SuspenseList");case 0:case 15:return Zr(i.type,!1);case 11:return Zr(i.type.render,!1);case 1:return Zr(i.type,!0);case 31:return yi("Activity");default:return""}}function Ea(i){try{var r="",l=null;do r+=ka(i,l),l=i,i=i.return;while(i);return r}catch(u){return`
47
47
  Error generating stack: `+u.message+`
48
- `+u.stack}}var Qr=Object.prototype.hasOwnProperty,Jr=e.unstable_scheduleCallback,Zs=e.unstable_cancelCallback,Tu=e.unstable_shouldYield,Au=e.unstable_requestPaint,Jt=e.unstable_now,Du=e.unstable_getCurrentPriorityLevel,Q=e.unstable_ImmediatePriority,ce=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,Re=e.unstable_LowPriority,qe=e.unstable_IdlePriority,bi=e.log,fn=e.unstable_setDisableYieldValue,ei=null,xt=null;function oi(i){if(typeof bi=="function"&&fn(i),xt&&typeof xt.setStrictMode=="function")try{xt.setStrictMode(ei,i)}catch{}}var Ge=Math.clz32?Math.clz32:i0,Hn=Math.log,Ki=Math.LN2;function i0(i){return i>>>=0,i===0?32:31-(Hn(i)/Ki|0)|0}var Ta=256,Aa=262144,Da=4194304;function yr(i){var r=i&42;if(r!==0)return r;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Ra(i,r,l){var u=i.pendingLanes;if(u===0)return 0;var d=0,m=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=u&134217727;return w!==0?(u=w&~m,u!==0?d=yr(u):(v&=w,v!==0?d=yr(v):l||(l=w&~i,l!==0&&(d=yr(l))))):(w=u&~m,w!==0?d=yr(w):v!==0?d=yr(v):l||(l=u&~i,l!==0&&(d=yr(l)))),d===0?0:r!==0&&r!==d&&(r&m)===0&&(m=d&-d,l=r&-r,m>=l||m===32&&(l&4194048)!==0)?r:d}function Qs(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function n0(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Zd(){var i=Da;return Da<<=1,(Da&62914560)===0&&(Da=4194304),i}function Ru(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function Js(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function r0(i,r,l,u,d,m){var v=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var w=i.entanglements,M=i.expirationTimes,W=i.hiddenUpdates;for(l=v&~l;0<l;){var G=31-Ge(l),ne=1<<G;w[G]=0,M[G]=-1;var K=W[G];if(K!==null)for(W[G]=null,G=0;G<K.length;G++){var X=K[G];X!==null&&(X.lane&=-536870913)}l&=~ne}u!==0&&Qd(i,u,0),m!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=m&~(v&~r))}function Qd(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-Ge(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function Jd(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-Ge(l),d=1<<u;d&r|i[u]&r&&(i[u]|=r),l&=~d}}function ep(i,r){var l=r&-r;return l=(l&42)!==0?1:Mu(l),(l&(i.suspendedLanes|r))!==0?0:l}function Mu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Bu(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function tp(){var i=j.p;return i!==0?i:(i=window.event,i===void 0?32:Pg(i.type))}function ip(i,r){var l=j.p;try{return j.p=i,r()}finally{j.p=l}}var Un=Math.random().toString(36).slice(2),Ut="__reactFiber$"+Un,ui="__reactProps$"+Un,es="__reactContainer$"+Un,Nu="__reactEvents$"+Un,s0="__reactListeners$"+Un,l0="__reactHandles$"+Un,np="__reactResources$"+Un,el="__reactMarker$"+Un;function Lu(i){delete i[Ut],delete i[ui],delete i[Nu],delete i[s0],delete i[l0]}function ts(i){var r=i[Ut];if(r)return r;for(var l=i.parentNode;l;){if(r=l[es]||l[Ut]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=Cg(i);i!==null;){if(l=i[Ut])return l;i=Cg(i)}return r}i=l,l=i.parentNode}return null}function is(i){if(i=i[Ut]||i[es]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function tl(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function ns(i){var r=i[np];return r||(r=i[np]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function At(i){i[el]=!0}var rp=new Set,sp={};function br(i,r){rs(i,r),rs(i+"Capture",r)}function rs(i,r){for(sp[i]=r,i=0;i<r.length;i++)rp.add(r[i])}var a0=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]*$"),lp={},ap={};function o0(i){return Qr.call(ap,i)?!0:Qr.call(lp,i)?!1:a0.test(i)?ap[i]=!0:(lp[i]=!0,!1)}function Ma(i,r,l){if(o0(r))if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+l)}}function Ba(i,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+l)}}function dn(i,r,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(r,l,""+u)}}function Bi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function op(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function u0(i,r,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var d=u.get,m=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return d.call(this)},set:function(v){l=""+v,m.call(this,v)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function zu(i){if(!i._valueTracker){var r=op(i)?"checked":"value";i._valueTracker=u0(i,r,""+i[r])}}function up(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=op(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Na(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var c0=/[\n"\\]/g;function Ni(i){return i.replace(c0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ou(i,r,l,u,d,m,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),r!=null?v==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Bi(r)):i.value!==""+Bi(r)&&(i.value=""+Bi(r)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),r!=null?ju(i,v,Bi(r)):l!=null?ju(i,v,Bi(l)):u!=null&&i.removeAttribute("value"),d==null&&m!=null&&(i.defaultChecked=!!m),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+Bi(w):i.removeAttribute("name")}function cp(i,r,l,u,d,m,v,w){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||r!=null)){zu(i);return}l=l!=null?""+Bi(l):"",r=r!=null?""+Bi(r):l,w||r===i.value||(i.value=r),i.defaultValue=r}u=u??d,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=w?i.checked:!!u,i.defaultChecked=!!u,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),zu(i)}function ju(i,r,l){r==="number"&&Na(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function ss(i,r,l,u){if(i=i.options,r){r={};for(var d=0;d<l.length;d++)r["$"+l[d]]=!0;for(l=0;l<i.length;l++)d=r.hasOwnProperty("$"+i[l].value),i[l].selected!==d&&(i[l].selected=d),d&&u&&(i[l].defaultSelected=!0)}else{for(l=""+Bi(l),r=null,d=0;d<i.length;d++){if(i[d].value===l){i[d].selected=!0,u&&(i[d].defaultSelected=!0);return}r!==null||i[d].disabled||(r=i[d])}r!==null&&(r.selected=!0)}}function hp(i,r,l){if(r!=null&&(r=""+Bi(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Bi(l):""}function fp(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(N(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Bi(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),zu(i)}function ls(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var h0=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 dp(i,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,l):typeof l!="number"||l===0||h0.has(r)?r==="float"?i.cssFloat=l:i[r]=(""+l).trim():i[r]=l+"px"}function pp(i,r,l){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var d in r)u=r[d],r.hasOwnProperty(d)&&l[d]!==u&&dp(i,d,u)}else for(var m in r)r.hasOwnProperty(m)&&dp(i,m,r[m])}function Hu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 f0=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"]]),d0=/^[\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 La(i){return d0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function pn(){}var Uu=null;function Pu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var as=null,os=null;function mp(i){var r=is(i);if(r&&(i=r.stateNode)){var l=i[ui]||null;e:switch(i=r.stateNode,r.type){case"input":if(Ou(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ni(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[ui]||null;if(!d)throw Error(s(90));Ou(u,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===i.form&&up(u)}break e;case"textarea":hp(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&ss(i,!!l.multiple,r,!1)}}}var Iu=!1;function _p(i,r,l){if(Iu)return i(r,l);Iu=!0;try{var u=i(r);return u}finally{if(Iu=!1,(as!==null||os!==null)&&(xo(),as&&(r=as,i=os,os=as=null,mp(r),i)))for(r=0;r<i.length;r++)mp(i[r])}}function il(i,r){var l=i.stateNode;if(l===null)return null;var u=l[ui]||null;if(u===null)return null;l=u[r];e:switch(r){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)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(mn)try{var nl={};Object.defineProperty(nl,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",nl,nl),window.removeEventListener("test",nl,nl)}catch{Fu=!1}var Pn=null,qu=null,za=null;function gp(){if(za)return za;var i,r=qu,l=r.length,u,d="value"in Pn?Pn.value:Pn.textContent,m=d.length;for(i=0;i<l&&r[i]===d[i];i++);var v=l-i;for(u=1;u<=v&&r[l-u]===d[m-u];u++);return za=d.slice(i,1<u?1-u:void 0)}function Oa(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function ja(){return!0}function vp(){return!1}function ci(i){function r(l,u,d,m,v){this._reactName=l,this._targetInst=d,this.type=u,this.nativeEvent=m,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(l=i[w],this[w]=l?l(m):m[w]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ja:vp,this.isPropagationStopped=vp,this}return _(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ja)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ja)},persist:function(){},isPersistent:ja}),r}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ha=ci(Sr),rl=_({},Sr,{view:0,detail:0}),p0=ci(rl),Wu,Yu,sl,Ua=_({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sl&&(sl&&i.type==="mousemove"?(Wu=i.screenX-sl.screenX,Yu=i.screenY-sl.screenY):Yu=Wu=0,sl=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),yp=ci(Ua),m0=_({},Ua,{dataTransfer:0}),_0=ci(m0),g0=_({},rl,{relatedTarget:0}),Vu=ci(g0),v0=_({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),y0=ci(v0),b0=_({},Sr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),S0=ci(b0),x0=_({},Sr,{data:0}),bp=ci(x0),w0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},C0={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"},k0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function E0(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=k0[i])?!!r[i]:!1}function Ku(){return E0}var T0=_({},rl,{key:function(i){if(i.key){var r=w0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Oa(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?C0[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(i){return i.type==="keypress"?Oa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Oa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),A0=ci(T0),D0=_({},Ua,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sp=ci(D0),R0=_({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),M0=ci(R0),B0=_({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),N0=ci(B0),L0=_({},Ua,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),z0=ci(L0),O0=_({},Sr,{newState:0,oldState:0}),j0=ci(O0),H0=[9,13,27,32],Xu=mn&&"CompositionEvent"in window,ll=null;mn&&"documentMode"in document&&(ll=document.documentMode);var U0=mn&&"TextEvent"in window&&!ll,xp=mn&&(!Xu||ll&&8<ll&&11>=ll),wp=" ",Cp=!1;function kp(i,r){switch(i){case"keyup":return H0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ep(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var us=!1;function P0(i,r){switch(i){case"compositionend":return Ep(r);case"keypress":return r.which!==32?null:(Cp=!0,wp);case"textInput":return i=r.data,i===wp&&Cp?null:i;default:return null}}function I0(i,r){if(us)return i==="compositionend"||!Xu&&kp(i,r)?(i=gp(),za=qu=Pn=null,us=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return xp&&r.locale!=="ko"?null:r.data;default:return null}}var F0={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 Tp(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!F0[i.type]:r==="textarea"}function Ap(i,r,l,u){as?os?os.push(u):os=[u]:as=u,r=Do(r,"onChange"),0<r.length&&(l=new Ha("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var al=null,ol=null;function q0(i){cg(i,0)}function Pa(i){var r=tl(i);if(up(r))return i}function Dp(i,r){if(i==="change")return r}var Rp=!1;if(mn){var $u;if(mn){var Gu="oninput"in document;if(!Gu){var Mp=document.createElement("div");Mp.setAttribute("oninput","return;"),Gu=typeof Mp.oninput=="function"}$u=Gu}else $u=!1;Rp=$u&&(!document.documentMode||9<document.documentMode)}function Bp(){al&&(al.detachEvent("onpropertychange",Np),ol=al=null)}function Np(i){if(i.propertyName==="value"&&Pa(ol)){var r=[];Ap(r,ol,i,Pu(i)),_p(q0,r)}}function W0(i,r,l){i==="focusin"?(Bp(),al=r,ol=l,al.attachEvent("onpropertychange",Np)):i==="focusout"&&Bp()}function Y0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Pa(ol)}function V0(i,r){if(i==="click")return Pa(r)}function K0(i,r){if(i==="input"||i==="change")return Pa(r)}function X0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Si=typeof Object.is=="function"?Object.is:X0;function ul(i,r){if(Si(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var d=l[u];if(!Qr.call(r,d)||!Si(i[d],r[d]))return!1}return!0}function Lp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function zp(i,r){var l=Lp(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=r&&u>=r)return{node:l,offset:r-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Lp(l)}}function Op(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Op(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function jp(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Na(i.document);r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=Na(i.document)}return r}function Zu(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var $0=mn&&"documentMode"in document&&11>=document.documentMode,cs=null,Qu=null,cl=null,Ju=!1;function Hp(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ju||cs==null||cs!==Na(u)||(u=cs,"selectionStart"in u&&Zu(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}),cl&&ul(cl,u)||(cl=u,u=Do(Qu,"onSelect"),0<u.length&&(r=new Ha("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=cs)))}function xr(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var hs={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionrun:xr("Transition","TransitionRun"),transitionstart:xr("Transition","TransitionStart"),transitioncancel:xr("Transition","TransitionCancel"),transitionend:xr("Transition","TransitionEnd")},ec={},Up={};mn&&(Up=document.createElement("div").style,"AnimationEvent"in window||(delete hs.animationend.animation,delete hs.animationiteration.animation,delete hs.animationstart.animation),"TransitionEvent"in window||delete hs.transitionend.transition);function wr(i){if(ec[i])return ec[i];if(!hs[i])return i;var r=hs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in Up)return ec[i]=r[l];return i}var Pp=wr("animationend"),Ip=wr("animationiteration"),Fp=wr("animationstart"),G0=wr("transitionrun"),Z0=wr("transitionstart"),Q0=wr("transitioncancel"),qp=wr("transitionend"),Wp=new Map,tc="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(" ");tc.push("scrollEnd");function Xi(i,r){Wp.set(i,r),br(r,[i])}var Ia=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Li=[],fs=0,ic=0;function Fa(){for(var i=fs,r=ic=fs=0;r<i;){var l=Li[r];Li[r++]=null;var u=Li[r];Li[r++]=null;var d=Li[r];Li[r++]=null;var m=Li[r];if(Li[r++]=null,u!==null&&d!==null){var v=u.pending;v===null?d.next=d:(d.next=v.next,v.next=d),u.pending=d}m!==0&&Yp(l,d,m)}}function qa(i,r,l,u){Li[fs++]=i,Li[fs++]=r,Li[fs++]=l,Li[fs++]=u,ic|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function nc(i,r,l,u){return qa(i,r,l,u),Wa(i)}function Cr(i,r){return qa(i,null,null,r),Wa(i)}function Yp(i,r,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var d=!1,m=i.return;m!==null;)m.childLanes|=l,u=m.alternate,u!==null&&(u.childLanes|=l),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(d=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,d&&r!==null&&(d=31-Ge(l),i=m.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),m):null}function Wa(i){if(50<Bl)throw Bl=0,fh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var ds={};function J0(i,r,l,u){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 xi(i,r,l,u){return new J0(i,r,l,u)}function rc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function _n(i,r){var l=i.alternate;return l===null?(l=xi(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function Vp(i,r){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,r=l.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Ya(i,r,l,u,d,m){var v=0;if(u=i,typeof i=="function")rc(i)&&(v=1);else if(typeof i=="string")v=rx(i,l,ee.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=xi(31,l,r,d),i.elementType=de,i.lanes=m,i;case E:return kr(l.children,d,m,r);case L:v=8,d|=24;break;case R:return i=xi(12,l,r,d|2),i.elementType=R,i.lanes=m,i;case Y:return i=xi(13,l,r,d),i.elementType=Y,i.lanes=m,i;case O:return i=xi(19,l,r,d),i.elementType=O,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case I:v=10;break e;case $:v=9;break e;case Z:v=11;break e;case J:v=14;break e;case ae:v=16,u=null;break e}v=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=xi(v,l,r,d),r.elementType=i,r.type=u,r.lanes=m,r}function kr(i,r,l,u){return i=xi(7,i,u,r),i.lanes=l,i}function sc(i,r,l){return i=xi(6,i,null,r),i.lanes=l,i}function Kp(i){var r=xi(18,null,null,0);return r.stateNode=i,r}function lc(i,r,l){return r=xi(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Xp=new WeakMap;function zi(i,r){if(typeof i=="object"&&i!==null){var l=Xp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:Ea(r)},Xp.set(i,r),r)}return{value:i,source:r,stack:Ea(r)}}var ps=[],ms=0,Va=null,hl=0,Oi=[],ji=0,In=null,Ji=1,en="";function gn(i,r){ps[ms++]=hl,ps[ms++]=Va,Va=i,hl=r}function $p(i,r,l){Oi[ji++]=Ji,Oi[ji++]=en,Oi[ji++]=In,In=i;var u=Ji;i=en;var d=32-Ge(u)-1;u&=~(1<<d),l+=1;var m=32-Ge(r)+d;if(30<m){var v=d-d%5;m=(u&(1<<v)-1).toString(32),u>>=v,d-=v,Ji=1<<32-Ge(r)+d|l<<d|u,en=m+i}else Ji=1<<m|l<<d|u,en=i}function ac(i){i.return!==null&&(gn(i,1),$p(i,1,0))}function oc(i){for(;i===Va;)Va=ps[--ms],ps[ms]=null,hl=ps[--ms],ps[ms]=null;for(;i===In;)In=Oi[--ji],Oi[ji]=null,en=Oi[--ji],Oi[ji]=null,Ji=Oi[--ji],Oi[ji]=null}function Gp(i,r){Oi[ji++]=Ji,Oi[ji++]=en,Oi[ji++]=In,Ji=r.id,en=r.overflow,In=i}var Pt=null,et=null,Oe=!1,Fn=null,Hi=!1,uc=Error(s(519));function qn(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw fl(zi(r,i)),uc}function Zp(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[Ut]=i,r[ui]=u,l){case"dialog":Be("cancel",r),Be("close",r);break;case"iframe":case"object":case"embed":Be("load",r);break;case"video":case"audio":for(l=0;l<Ll.length;l++)Be(Ll[l],r);break;case"source":Be("error",r);break;case"img":case"image":case"link":Be("error",r),Be("load",r);break;case"details":Be("toggle",r);break;case"input":Be("invalid",r),cp(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Be("invalid",r);break;case"textarea":Be("invalid",r),fp(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||pg(r.textContent,l)?(u.popover!=null&&(Be("beforetoggle",r),Be("toggle",r)),u.onScroll!=null&&Be("scroll",r),u.onScrollEnd!=null&&Be("scrollend",r),u.onClick!=null&&(r.onclick=pn),r=!0):r=!1,r||qn(i,!0)}function Qp(i){for(Pt=i.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Hi=!1;return;case 27:case 3:Hi=!0;return;default:Pt=Pt.return}}function _s(i){if(i!==Pt)return!1;if(!Oe)return Qp(i),Oe=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Th(i.type,i.memoizedProps)),l=!l),l&&et&&qn(i),Qp(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=wg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));et=wg(i)}else r===27?(r=et,nr(i.type)?(i=Bh,Bh=null,et=i):et=r):et=Pt?Pi(i.stateNode.nextSibling):null;return!0}function Er(){et=Pt=null,Oe=!1}function cc(){var i=Fn;return i!==null&&(pi===null?pi=i:pi.push.apply(pi,i),Fn=null),i}function fl(i){Fn===null?Fn=[i]:Fn.push(i)}var hc=D(null),Tr=null,vn=null;function Wn(i,r,l){C(hc,r._currentValue),r._currentValue=l}function yn(i){i._currentValue=hc.current,V(hc)}function fc(i,r,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===l)break;i=i.return}}function dc(i,r,l,u){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var m=d.dependencies;if(m!==null){var v=d.child;m=m.firstContext;e:for(;m!==null;){var w=m;m=d;for(var M=0;M<r.length;M++)if(w.context===r[M]){m.lanes|=l,w=m.alternate,w!==null&&(w.lanes|=l),fc(m.return,l,i),u||(v=null);break e}m=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(s(341));v.lanes|=l,m=v.alternate,m!==null&&(m.lanes|=l),fc(v,l,i),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===i){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function gs(i,r,l,u){i=null;for(var d=r,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var w=d.type;Si(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===be.current){if(v=d.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Ul):i=[Ul])}d=d.return}i!==null&&dc(r,i,l,u),r.flags|=262144}function Ka(i){for(i=i.firstContext;i!==null;){if(!Si(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ar(i){Tr=i,vn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function It(i){return Jp(Tr,i)}function Xa(i,r){return Tr===null&&Ar(i),Jp(i,r)}function Jp(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},vn===null){if(i===null)throw Error(s(308));vn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else vn=vn.next=r;return l}var e1=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(l){return l()})}},t1=e.unstable_scheduleCallback,i1=e.unstable_NormalPriority,mt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pc(){return{controller:new e1,data:new Map,refCount:0}}function dl(i){i.refCount--,i.refCount===0&&t1(i1,function(){i.controller.abort()})}var pl=null,mc=0,vs=0,ys=null;function n1(i,r){if(pl===null){var l=pl=[];mc=0,vs=vh(),ys={status:"pending",value:void 0,then:function(u){l.push(u)}}}return mc++,r.then(em,em),r}function em(){if(--mc===0&&pl!==null){ys!==null&&(ys.status="fulfilled");var i=pl;pl=null,vs=0,ys=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function r1(i,r){var l=[],u={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var d=0;d<l.length;d++)(0,l[d])(r)},function(d){for(u.status="rejected",u.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),u}var tm=A.S;A.S=function(i,r){H_=Jt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&n1(i,r),tm!==null&&tm(i,r)};var Dr=D(null);function _c(){var i=Dr.current;return i!==null?i:Ze.pooledCache}function $a(i,r){r===null?C(Dr,Dr.current):C(Dr,r.pool)}function im(){var i=_c();return i===null?null:{parent:mt._currentValue,pool:i}}var bs=Error(s(460)),gc=Error(s(474)),Ga=Error(s(542)),Za={then:function(){}};function nm(i){return i=i.status,i==="fulfilled"||i==="rejected"}function rm(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(pn,pn),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,lm(i),i;default:if(typeof r.status=="string")r.then(pn,pn);else{if(i=Ze,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var d=r;d.status="fulfilled",d.value=u}},function(u){if(r.status==="pending"){var d=r;d.status="rejected",d.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,lm(i),i}throw Mr=r,bs}}function Rr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Mr=l,bs):l}}var Mr=null;function sm(){if(Mr===null)throw Error(s(459));var i=Mr;return Mr=null,i}function lm(i){if(i===bs||i===Ga)throw Error(s(483))}var Ss=null,ml=0;function Qa(i){var r=ml;return ml+=1,Ss===null&&(Ss=[]),rm(Ss,i,r)}function _l(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Ja(i,r){throw r.$$typeof===b?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function am(i){function r(U,z){if(i){var q=U.deletions;q===null?(U.deletions=[z],U.flags|=16):q.push(z)}}function l(U,z){if(!i)return null;for(;z!==null;)r(U,z),z=z.sibling;return null}function u(U){for(var z=new Map;U!==null;)U.key!==null?z.set(U.key,U):z.set(U.index,U),U=U.sibling;return z}function d(U,z){return U=_n(U,z),U.index=0,U.sibling=null,U}function m(U,z,q){return U.index=q,i?(q=U.alternate,q!==null?(q=q.index,q<z?(U.flags|=67108866,z):q):(U.flags|=67108866,z)):(U.flags|=1048576,z)}function v(U){return i&&U.alternate===null&&(U.flags|=67108866),U}function w(U,z,q,te){return z===null||z.tag!==6?(z=sc(q,U.mode,te),z.return=U,z):(z=d(z,q),z.return=U,z)}function M(U,z,q,te){var ge=q.type;return ge===E?G(U,z,q.props.children,te,q.key):z!==null&&(z.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===ae&&Rr(ge)===z.type)?(z=d(z,q.props),_l(z,q),z.return=U,z):(z=Ya(q.type,q.key,q.props,null,U.mode,te),_l(z,q),z.return=U,z)}function W(U,z,q,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=lc(q,U.mode,te),z.return=U,z):(z=d(z,q.children||[]),z.return=U,z)}function G(U,z,q,te,ge){return z===null||z.tag!==7?(z=kr(q,U.mode,te,ge),z.return=U,z):(z=d(z,q),z.return=U,z)}function ne(U,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=sc(""+z,U.mode,q),z.return=U,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case y:return q=Ya(z.type,z.key,z.props,null,U.mode,q),_l(q,z),q.return=U,q;case x:return z=lc(z,U.mode,q),z.return=U,z;case ae:return z=Rr(z),ne(U,z,q)}if(N(z)||H(z))return z=kr(z,U.mode,q,null),z.return=U,z;if(typeof z.then=="function")return ne(U,Qa(z),q);if(z.$$typeof===I)return ne(U,Xa(U,z),q);Ja(U,z)}return null}function K(U,z,q,te){var ge=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ge!==null?null:w(U,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case y:return q.key===ge?M(U,z,q,te):null;case x:return q.key===ge?W(U,z,q,te):null;case ae:return q=Rr(q),K(U,z,q,te)}if(N(q)||H(q))return ge!==null?null:G(U,z,q,te,null);if(typeof q.then=="function")return K(U,z,Qa(q),te);if(q.$$typeof===I)return K(U,z,Xa(U,q),te);Ja(U,q)}return null}function X(U,z,q,te,ge){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return U=U.get(q)||null,w(z,U,""+te,ge);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return U=U.get(te.key===null?q:te.key)||null,M(z,U,te,ge);case x:return U=U.get(te.key===null?q:te.key)||null,W(z,U,te,ge);case ae:return te=Rr(te),X(U,z,q,te,ge)}if(N(te)||H(te))return U=U.get(q)||null,G(z,U,te,ge,null);if(typeof te.then=="function")return X(U,z,q,Qa(te),ge);if(te.$$typeof===I)return X(U,z,q,Xa(z,te),ge);Ja(z,te)}return null}function me(U,z,q,te){for(var ge=null,Pe=null,_e=z,Ee=z=0,ze=null;_e!==null&&Ee<q.length;Ee++){_e.index>Ee?(ze=_e,_e=null):ze=_e.sibling;var Ie=K(U,_e,q[Ee],te);if(Ie===null){_e===null&&(_e=ze);break}i&&_e&&Ie.alternate===null&&r(U,_e),z=m(Ie,z,Ee),Pe===null?ge=Ie:Pe.sibling=Ie,Pe=Ie,_e=ze}if(Ee===q.length)return l(U,_e),Oe&&gn(U,Ee),ge;if(_e===null){for(;Ee<q.length;Ee++)_e=ne(U,q[Ee],te),_e!==null&&(z=m(_e,z,Ee),Pe===null?ge=_e:Pe.sibling=_e,Pe=_e);return Oe&&gn(U,Ee),ge}for(_e=u(_e);Ee<q.length;Ee++)ze=X(_e,U,Ee,q[Ee],te),ze!==null&&(i&&ze.alternate!==null&&_e.delete(ze.key===null?Ee:ze.key),z=m(ze,z,Ee),Pe===null?ge=ze:Pe.sibling=ze,Pe=ze);return i&&_e.forEach(function(or){return r(U,or)}),Oe&&gn(U,Ee),ge}function ye(U,z,q,te){if(q==null)throw Error(s(151));for(var ge=null,Pe=null,_e=z,Ee=z=0,ze=null,Ie=q.next();_e!==null&&!Ie.done;Ee++,Ie=q.next()){_e.index>Ee?(ze=_e,_e=null):ze=_e.sibling;var or=K(U,_e,Ie.value,te);if(or===null){_e===null&&(_e=ze);break}i&&_e&&or.alternate===null&&r(U,_e),z=m(or,z,Ee),Pe===null?ge=or:Pe.sibling=or,Pe=or,_e=ze}if(Ie.done)return l(U,_e),Oe&&gn(U,Ee),ge;if(_e===null){for(;!Ie.done;Ee++,Ie=q.next())Ie=ne(U,Ie.value,te),Ie!==null&&(z=m(Ie,z,Ee),Pe===null?ge=Ie:Pe.sibling=Ie,Pe=Ie);return Oe&&gn(U,Ee),ge}for(_e=u(_e);!Ie.done;Ee++,Ie=q.next())Ie=X(_e,U,Ee,Ie.value,te),Ie!==null&&(i&&Ie.alternate!==null&&_e.delete(Ie.key===null?Ee:Ie.key),z=m(Ie,z,Ee),Pe===null?ge=Ie:Pe.sibling=Ie,Pe=Ie);return i&&_e.forEach(function(mx){return r(U,mx)}),Oe&&gn(U,Ee),ge}function Xe(U,z,q,te){if(typeof q=="object"&&q!==null&&q.type===E&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case y:e:{for(var ge=q.key;z!==null;){if(z.key===ge){if(ge=q.type,ge===E){if(z.tag===7){l(U,z.sibling),te=d(z,q.props.children),te.return=U,U=te;break e}}else if(z.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===ae&&Rr(ge)===z.type){l(U,z.sibling),te=d(z,q.props),_l(te,q),te.return=U,U=te;break e}l(U,z);break}else r(U,z);z=z.sibling}q.type===E?(te=kr(q.props.children,U.mode,te,q.key),te.return=U,U=te):(te=Ya(q.type,q.key,q.props,null,U.mode,te),_l(te,q),te.return=U,U=te)}return v(U);case x:e:{for(ge=q.key;z!==null;){if(z.key===ge)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){l(U,z.sibling),te=d(z,q.children||[]),te.return=U,U=te;break e}else{l(U,z);break}else r(U,z);z=z.sibling}te=lc(q,U.mode,te),te.return=U,U=te}return v(U);case ae:return q=Rr(q),Xe(U,z,q,te)}if(N(q))return me(U,z,q,te);if(H(q)){if(ge=H(q),typeof ge!="function")throw Error(s(150));return q=ge.call(q),ye(U,z,q,te)}if(typeof q.then=="function")return Xe(U,z,Qa(q),te);if(q.$$typeof===I)return Xe(U,z,Xa(U,q),te);Ja(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(l(U,z.sibling),te=d(z,q),te.return=U,U=te):(l(U,z),te=sc(q,U.mode,te),te.return=U,U=te),v(U)):l(U,z)}return function(U,z,q,te){try{ml=0;var ge=Xe(U,z,q,te);return Ss=null,ge}catch(_e){if(_e===bs||_e===Ga)throw _e;var Pe=xi(29,_e,null,U.mode);return Pe.lanes=te,Pe.return=U,Pe}finally{}}}var Br=am(!0),om=am(!1),Yn=!1;function vc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Vn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Kn(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(Fe&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=Wa(i),Yp(i,null,l),r}return qa(i,u,r,l),Wa(i)}function gl(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Jd(i,l)}}function bc(i,r){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var v={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?d=m=v:m=m.next=v,l=l.next}while(l!==null);m===null?d=m=r:m=m.next=r}else d=m=r;l={baseState:u.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}var Sc=!1;function vl(){if(Sc){var i=ys;if(i!==null)throw i}}function yl(i,r,l,u){Sc=!1;var d=i.updateQueue;Yn=!1;var m=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var M=w,W=M.next;M.next=null,v===null?m=W:v.next=W,v=M;var G=i.alternate;G!==null&&(G=G.updateQueue,w=G.lastBaseUpdate,w!==v&&(w===null?G.firstBaseUpdate=W:w.next=W,G.lastBaseUpdate=M))}if(m!==null){var ne=d.baseState;v=0,G=W=M=null,w=m;do{var K=w.lane&-536870913,X=K!==w.lane;if(X?(Le&K)===K:(u&K)===K){K!==0&&K===vs&&(Sc=!0),G!==null&&(G=G.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var me=i,ye=w;K=r;var Xe=l;switch(ye.tag){case 1:if(me=ye.payload,typeof me=="function"){ne=me.call(Xe,ne,K);break e}ne=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=ye.payload,K=typeof me=="function"?me.call(Xe,ne,K):me,K==null)break e;ne=_({},ne,K);break e;case 2:Yn=!0}}K=w.callback,K!==null&&(i.flags|=64,X&&(i.flags|=8192),X=d.callbacks,X===null?d.callbacks=[K]:X.push(K))}else X={lane:K,tag:w.tag,payload:w.payload,callback:w.callback,next:null},G===null?(W=G=X,M=ne):G=G.next=X,v|=K;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;X=w,w=X.next,X.next=null,d.lastBaseUpdate=X,d.shared.pending=null}}while(!0);G===null&&(M=ne),d.baseState=M,d.firstBaseUpdate=W,d.lastBaseUpdate=G,m===null&&(d.shared.lanes=0),Qn|=v,i.lanes=v,i.memoizedState=ne}}function um(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function cm(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)um(l[i],r)}var xs=D(null),eo=D(0);function hm(i,r){i=An,C(eo,i),C(xs,r),An=i|r.baseLanes}function xc(){C(eo,An),C(xs,xs.current)}function wc(){An=eo.current,V(xs),V(eo)}var wi=D(null),Ui=null;function Xn(i){var r=i.alternate;C(ft,ft.current&1),C(wi,i),Ui===null&&(r===null||xs.current!==null||r.memoizedState!==null)&&(Ui=i)}function Cc(i){C(ft,ft.current),C(wi,i),Ui===null&&(Ui=i)}function fm(i){i.tag===22?(C(ft,ft.current),C(wi,i),Ui===null&&(Ui=i)):$n()}function $n(){C(ft,ft.current),C(wi,wi.current)}function Ci(i){V(wi),Ui===i&&(Ui=null),V(ft)}var ft=D(0);function to(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Rh(l)||Mh(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var bn=0,ke=null,Ve=null,_t=null,io=!1,ws=!1,Nr=!1,no=0,bl=0,Cs=null,s1=0;function at(){throw Error(s(321))}function kc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Si(i[l],r[l]))return!1;return!0}function Ec(i,r,l,u,d,m){return bn=m,ke=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,A.H=i===null||i.memoizedState===null?$m:Ic,Nr=!1,m=l(u,d),Nr=!1,ws&&(m=pm(r,l,u,d)),dm(i),m}function dm(i){A.H=wl;var r=Ve!==null&&Ve.next!==null;if(bn=0,_t=Ve=ke=null,io=!1,bl=0,Cs=null,r)throw Error(s(300));i===null||gt||(i=i.dependencies,i!==null&&Ka(i)&&(gt=!0))}function pm(i,r,l,u){ke=i;var d=0;do{if(ws&&(Cs=null),bl=0,ws=!1,25<=d)throw Error(s(301));if(d+=1,_t=Ve=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}A.H=Gm,m=r(l,u)}while(ws);return m}function l1(){var i=A.H,r=i.useState()[0];return r=typeof r.then=="function"?Sl(r):r,i=i.useState()[0],(Ve!==null?Ve.memoizedState:null)!==i&&(ke.flags|=1024),r}function Tc(){var i=no!==0;return no=0,i}function Ac(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Dc(i){if(io){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}io=!1}bn=0,_t=Ve=ke=null,ws=!1,bl=no=0,Cs=null}function ti(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _t===null?ke.memoizedState=_t=i:_t=_t.next=i,_t}function dt(){if(Ve===null){var i=ke.alternate;i=i!==null?i.memoizedState:null}else i=Ve.next;var r=_t===null?ke.memoizedState:_t.next;if(r!==null)_t=r,Ve=i;else{if(i===null)throw ke.alternate===null?Error(s(467)):Error(s(310));Ve=i,i={memoizedState:Ve.memoizedState,baseState:Ve.baseState,baseQueue:Ve.baseQueue,queue:Ve.queue,next:null},_t===null?ke.memoizedState=_t=i:_t=_t.next=i}return _t}function ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sl(i){var r=bl;return bl+=1,Cs===null&&(Cs=[]),i=rm(Cs,i,r),r=ke,(_t===null?r.memoizedState:_t.next)===null&&(r=r.alternate,A.H=r===null||r.memoizedState===null?$m:Ic),i}function so(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Sl(i);if(i.$$typeof===I)return It(i)}throw Error(s(438,String(i)))}function Rc(i){var r=null,l=ke.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=ke.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(d){return d.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=ro(),ke.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(i),u=0;u<i;u++)l[u]=F;return r.index++,l}function Sn(i,r){return typeof r=="function"?r(i):r}function lo(i){var r=dt();return Mc(r,Ve,i)}function Mc(i,r,l){var u=i.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=l;var d=i.baseQueue,m=u.pending;if(m!==null){if(d!==null){var v=d.next;d.next=m.next,m.next=v}r.baseQueue=d=m,u.pending=null}if(m=i.baseState,d===null)i.memoizedState=m;else{r=d.next;var w=v=null,M=null,W=r,G=!1;do{var ne=W.lane&-536870913;if(ne!==W.lane?(Le&ne)===ne:(bn&ne)===ne){var K=W.revertLane;if(K===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ne===vs&&(G=!0);else if((bn&K)===K){W=W.next,K===vs&&(G=!0);continue}else ne={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(w=M=ne,v=m):M=M.next=ne,ke.lanes|=K,Qn|=K;ne=W.action,Nr&&l(m,ne),m=W.hasEagerState?W.eagerState:l(m,ne)}else K={lane:ne,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(w=M=K,v=m):M=M.next=K,ke.lanes|=ne,Qn|=ne;W=W.next}while(W!==null&&W!==r);if(M===null?v=m:M.next=w,!Si(m,i.memoizedState)&&(gt=!0,G&&(l=ys,l!==null)))throw l;i.memoizedState=m,i.baseState=v,i.baseQueue=M,u.lastRenderedState=m}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Bc(i){var r=dt(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=i;var u=l.dispatch,d=l.pending,m=r.memoizedState;if(d!==null){l.pending=null;var v=d=d.next;do m=i(m,v.action),v=v.next;while(v!==d);Si(m,r.memoizedState)||(gt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function mm(i,r,l){var u=ke,d=dt(),m=Oe;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var v=!Si((Ve||d).memoizedState,l);if(v&&(d.memoizedState=l,gt=!0),d=d.queue,zc(vm.bind(null,u,d,i),[i]),d.getSnapshot!==r||v||_t!==null&&_t.memoizedState.tag&1){if(u.flags|=2048,ks(9,{destroy:void 0},gm.bind(null,u,d,l,r),null),Ze===null)throw Error(s(349));m||(bn&127)!==0||_m(u,r,l)}return l}function _m(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=ke.updateQueue,r===null?(r=ro(),ke.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function gm(i,r,l,u){r.value=l,r.getSnapshot=u,ym(r)&&bm(i)}function vm(i,r,l){return l(function(){ym(r)&&bm(i)})}function ym(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Si(i,l)}catch{return!0}}function bm(i){var r=Cr(i,2);r!==null&&mi(r,i,2)}function Nc(i){var r=ti();if(typeof i=="function"){var l=i;if(i=l(),Nr){oi(!0);try{l()}finally{oi(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:i},r}function Sm(i,r,l,u){return i.baseState=l,Mc(i,Ve,typeof u=="function"?u:Sn)}function a1(i,r,l,u,d){if(uo(i))throw Error(s(485));if(i=r.action,i!==null){var m={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){m.listeners.push(v)}};A.T!==null?l(!0):m.isTransition=!1,u(m),l=r.pending,l===null?(m.next=r.pending=m,xm(r,m)):(m.next=l.next,r.pending=l.next=m)}}function xm(i,r){var l=r.action,u=r.payload,d=i.state;if(r.isTransition){var m=A.T,v={};A.T=v;try{var w=l(d,u),M=A.S;M!==null&&M(v,w),wm(i,r,w)}catch(W){Lc(i,r,W)}finally{m!==null&&v.types!==null&&(m.types=v.types),A.T=m}}else try{m=l(d,u),wm(i,r,m)}catch(W){Lc(i,r,W)}}function wm(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){Cm(i,r,u)},function(u){return Lc(i,r,u)}):Cm(i,r,l)}function Cm(i,r,l){r.status="fulfilled",r.value=l,km(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,xm(i,l)))}function Lc(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,km(r),r=r.next;while(r!==u)}i.action=null}function km(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function Em(i,r){return r}function Tm(i,r){if(Oe){var l=Ze.formState;if(l!==null){e:{var u=ke;if(Oe){if(et){t:{for(var d=et,m=Hi;d.nodeType!==8;){if(!m){d=null;break t}if(d=Pi(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){et=Pi(d.nextSibling),u=d.data==="F!";break e}}qn(u)}u=!1}u&&(r=l[0])}}return l=ti(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Em,lastRenderedState:r},l.queue=u,l=Vm.bind(null,ke,u),u.dispatch=l,u=Nc(!1),m=Pc.bind(null,ke,!1,u.queue),u=ti(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=a1.bind(null,ke,d,m,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function Am(i){var r=dt();return Dm(r,Ve,i)}function Dm(i,r,l){if(r=Mc(i,r,Em)[0],i=lo(Sn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Sl(r)}catch(v){throw v===bs?Ga:v}else u=r;r=dt();var d=r.queue,m=d.dispatch;return l!==r.memoizedState&&(ke.flags|=2048,ks(9,{destroy:void 0},o1.bind(null,d,l),null)),[u,m,i]}function o1(i,r){i.action=r}function Rm(i){var r=dt(),l=Ve;if(l!==null)return Dm(r,l,i);dt(),r=r.memoizedState,l=dt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function ks(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=ke.updateQueue,r===null&&(r=ro(),ke.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,r.lastEffect=i),i}function Mm(){return dt().memoizedState}function ao(i,r,l,u){var d=ti();ke.flags|=i,d.memoizedState=ks(1|r,{destroy:void 0},l,u===void 0?null:u)}function oo(i,r,l,u){var d=dt();u=u===void 0?null:u;var m=d.memoizedState.inst;Ve!==null&&u!==null&&kc(u,Ve.memoizedState.deps)?d.memoizedState=ks(r,m,l,u):(ke.flags|=i,d.memoizedState=ks(1|r,m,l,u))}function Bm(i,r){ao(8390656,8,i,r)}function zc(i,r){oo(2048,8,i,r)}function u1(i){ke.flags|=4;var r=ke.updateQueue;if(r===null)r=ro(),ke.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function Nm(i){var r=dt().memoizedState;return u1({ref:r,nextImpl:i}),function(){if((Fe&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Lm(i,r){return oo(4,2,i,r)}function zm(i,r){return oo(4,4,i,r)}function Om(i,r){if(typeof r=="function"){i=i();var l=r(i);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function jm(i,r,l){l=l!=null?l.concat([i]):null,oo(4,4,Om.bind(null,r,i),l)}function Oc(){}function Hm(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&kc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function Um(i,r){var l=dt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&kc(r,u[1]))return u[0];if(u=i(),Nr){oi(!0);try{i()}finally{oi(!1)}}return l.memoizedState=[u,r],u}function jc(i,r,l){return l===void 0||(bn&1073741824)!==0&&(Le&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=P_(),ke.lanes|=i,Qn|=i,l)}function Pm(i,r,l,u){return Si(l,r)?l:xs.current!==null?(i=jc(i,l,u),Si(i,r)||(gt=!0),i):(bn&42)===0||(bn&1073741824)!==0&&(Le&261930)===0?(gt=!0,i.memoizedState=l):(i=P_(),ke.lanes|=i,Qn|=i,r)}function Im(i,r,l,u,d){var m=j.p;j.p=m!==0&&8>m?m:8;var v=A.T,w={};A.T=w,Pc(i,!1,r,l);try{var M=d(),W=A.S;if(W!==null&&W(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var G=r1(M,u);xl(i,r,G,Ti(i))}else xl(i,r,u,Ti(i))}catch(ne){xl(i,r,{then:function(){},status:"rejected",reason:ne},Ti())}finally{j.p=m,v!==null&&w.types!==null&&(v.types=w.types),A.T=v}}function c1(){}function Hc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=Fm(i).queue;Im(i,d,r,P,l===null?c1:function(){return qm(i),l(u)})}function Fm(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:P},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function qm(i){var r=Fm(i);r.next===null&&(r=i.alternate.memoizedState),xl(i,r.next.queue,{},Ti())}function Uc(){return It(Ul)}function Wm(){return dt().memoizedState}function Ym(){return dt().memoizedState}function h1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=Ti();i=Vn(l);var u=Kn(r,i,l);u!==null&&(mi(u,r,l),gl(u,r,l)),r={cache:pc()},i.payload=r;return}r=r.return}}function f1(i,r,l){var u=Ti();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},uo(i)?Km(r,l):(l=nc(i,r,l,u),l!==null&&(mi(l,i,u),Xm(l,r,u)))}function Vm(i,r,l){var u=Ti();xl(i,r,l,u)}function xl(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(uo(i))Km(r,d);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var v=r.lastRenderedState,w=m(v,l);if(d.hasEagerState=!0,d.eagerState=w,Si(w,v))return qa(i,r,d,0),Ze===null&&Fa(),!1}catch{}finally{}if(l=nc(i,r,d,u),l!==null)return mi(l,i,u),Xm(l,r,u),!0}return!1}function Pc(i,r,l,u){if(u={lane:2,revertLane:vh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},uo(i)){if(r)throw Error(s(479))}else r=nc(i,l,u,2),r!==null&&mi(r,i,2)}function uo(i){var r=i.alternate;return i===ke||r!==null&&r===ke}function Km(i,r){ws=io=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function Xm(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,Jd(i,l)}}var wl={readContext:It,use:so,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};wl.useEffectEvent=at;var $m={readContext:It,use:so,useCallback:function(i,r){return ti().memoizedState=[i,r===void 0?null:r],i},useContext:It,useEffect:Bm,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,ao(4194308,4,Om.bind(null,r,i),l)},useLayoutEffect:function(i,r){return ao(4194308,4,i,r)},useInsertionEffect:function(i,r){ao(4,2,i,r)},useMemo:function(i,r){var l=ti();r=r===void 0?null:r;var u=i();if(Nr){oi(!0);try{i()}finally{oi(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=ti();if(l!==void 0){var d=l(r);if(Nr){oi(!0);try{l(r)}finally{oi(!1)}}}else d=r;return u.memoizedState=u.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},u.queue=i,i=i.dispatch=f1.bind(null,ke,i),[u.memoizedState,i]},useRef:function(i){var r=ti();return i={current:i},r.memoizedState=i},useState:function(i){i=Nc(i);var r=i.queue,l=Vm.bind(null,ke,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Oc,useDeferredValue:function(i,r){var l=ti();return jc(l,i,r)},useTransition:function(){var i=Nc(!1);return i=Im.bind(null,ke,i.queue,!0,!1),ti().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=ke,d=ti();if(Oe){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),Ze===null)throw Error(s(349));(Le&127)!==0||_m(u,r,l)}d.memoizedState=l;var m={value:l,getSnapshot:r};return d.queue=m,Bm(vm.bind(null,u,m,i),[i]),u.flags|=2048,ks(9,{destroy:void 0},gm.bind(null,u,m,l,r),null),l},useId:function(){var i=ti(),r=Ze.identifierPrefix;if(Oe){var l=en,u=Ji;l=(u&~(1<<32-Ge(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=no++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=s1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Uc,useFormState:Tm,useActionState:Tm,useOptimistic:function(i){var r=ti();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Pc.bind(null,ke,!0,l),l.dispatch=r,[i,r]},useMemoCache:Rc,useCacheRefresh:function(){return ti().memoizedState=h1.bind(null,ke)},useEffectEvent:function(i){var r=ti(),l={impl:i};return r.memoizedState=l,function(){if((Fe&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Ic={readContext:It,use:so,useCallback:Hm,useContext:It,useEffect:zc,useImperativeHandle:jm,useInsertionEffect:Lm,useLayoutEffect:zm,useMemo:Um,useReducer:lo,useRef:Mm,useState:function(){return lo(Sn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return Pm(l,Ve.memoizedState,i,r)},useTransition:function(){var i=lo(Sn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:Sl(i),r]},useSyncExternalStore:mm,useId:Wm,useHostTransitionStatus:Uc,useFormState:Am,useActionState:Am,useOptimistic:function(i,r){var l=dt();return Sm(l,Ve,i,r)},useMemoCache:Rc,useCacheRefresh:Ym};Ic.useEffectEvent=Nm;var Gm={readContext:It,use:so,useCallback:Hm,useContext:It,useEffect:zc,useImperativeHandle:jm,useInsertionEffect:Lm,useLayoutEffect:zm,useMemo:Um,useReducer:Bc,useRef:Mm,useState:function(){return Bc(Sn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=dt();return Ve===null?jc(l,i,r):Pm(l,Ve.memoizedState,i,r)},useTransition:function(){var i=Bc(Sn)[0],r=dt().memoizedState;return[typeof i=="boolean"?i:Sl(i),r]},useSyncExternalStore:mm,useId:Wm,useHostTransitionStatus:Uc,useFormState:Rm,useActionState:Rm,useOptimistic:function(i,r){var l=dt();return Ve!==null?Sm(l,Ve,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Rc,useCacheRefresh:Ym};Gm.useEffectEvent=Nm;function Fc(i,r,l,u){r=i.memoizedState,l=l(u,r),l=l==null?r:_({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var qc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=Ti(),d=Vn(u);d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(mi(r,i,u),gl(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=Ti(),d=Vn(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(mi(r,i,u),gl(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=Ti(),u=Vn(l);u.tag=2,r!=null&&(u.callback=r),r=Kn(i,u,l),r!==null&&(mi(r,i,l),gl(r,i,l))}};function Zm(i,r,l,u,d,m,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,m,v):r.prototype&&r.prototype.isPureReactComponent?!ul(l,u)||!ul(d,m):!0}function Qm(i,r,l,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==i&&qc.enqueueReplaceState(r,r.state,null)}function Lr(i,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(i=i.defaultProps){l===r&&(l=_({},l));for(var d in i)l[d]===void 0&&(l[d]=i[d])}return l}function Jm(i){Ia(i)}function e_(i){console.error(i)}function t_(i){Ia(i)}function co(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function i_(i,r,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Wc(i,r,l){return l=Vn(l),l.tag=3,l.payload={element:null},l.callback=function(){co(i,r)},l}function n_(i){return i=Vn(i),i.tag=3,i}function r_(i,r,l,u){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var m=u.value;i.payload=function(){return d(m)},i.callback=function(){i_(r,l,u)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){i_(r,l,u),typeof d!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}function d1(i,r,l,u,d){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&gs(r,l,d,!0),l=wi.current,l!==null){switch(l.tag){case 31:case 13:return Ui===null?wo():l.alternate===null&&ot===0&&(ot=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===Za?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),mh(i,u,d)),!1;case 22:return l.flags|=65536,u===Za?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),mh(i,u,d)),!1}throw Error(s(435,l.tag))}return mh(i,u,d),wo(),!1}if(Oe)return r=wi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==uc&&(i=Error(s(422),{cause:u}),fl(zi(i,l)))):(u!==uc&&(r=Error(s(423),{cause:u}),fl(zi(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=zi(u,l),d=Wc(i.stateNode,u,d),bc(i,d),ot!==4&&(ot=2)),!1;var m=Error(s(520),{cause:u});if(m=zi(m,l),Ml===null?Ml=[m]:Ml.push(m),ot!==4&&(ot=2),r===null)return!0;u=zi(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Wc(l.stateNode,u,i),bc(l,i),!1;case 1:if(r=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Jn===null||!Jn.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=n_(d),r_(d,i,l,u),bc(l,d),!1}l=l.return}while(l!==null);return!1}var Yc=Error(s(461)),gt=!1;function Ft(i,r,l,u){r.child=i===null?om(r,null,l,u):Br(r,i.child,l,u)}function s_(i,r,l,u,d){l=l.render;var m=r.ref;if("ref"in u){var v={};for(var w in u)w!=="ref"&&(v[w]=u[w])}else v=u;return Ar(r),u=Ec(i,r,l,v,m,d),w=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&w&&ac(r),r.flags|=1,Ft(i,r,u,d),r.child)}function l_(i,r,l,u,d){if(i===null){var m=l.type;return typeof m=="function"&&!rc(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,a_(i,r,m,u,d)):(i=Ya(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!Jc(i,d)){var v=m.memoizedProps;if(l=l.compare,l=l!==null?l:ul,l(v,u)&&i.ref===r.ref)return xn(i,r,d)}return r.flags|=1,i=_n(m,u),i.ref=r.ref,i.return=r,r.child=i}function a_(i,r,l,u,d){if(i!==null){var m=i.memoizedProps;if(ul(m,u)&&i.ref===r.ref)if(gt=!1,r.pendingProps=u=m,Jc(i,d))(i.flags&131072)!==0&&(gt=!0);else return r.lanes=i.lanes,xn(i,r,d)}return Vc(i,r,l,u,d)}function o_(i,r,l,u){var d=u.children,m=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,i!==null){for(u=r.child=i.child,d=0;u!==null;)d=d|u.lanes|u.childLanes,u=u.sibling;u=d&~m}else u=0,r.child=null;return u_(i,r,m,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&$a(r,m!==null?m.cachePool:null),m!==null?hm(r,m):xc(),fm(r);else return u=r.lanes=536870912,u_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?($a(r,m.cachePool),hm(r,m),$n(),r.memoizedState=null):(i!==null&&$a(r,null),xc(),$n());return Ft(i,r,d,l),r.child}function Cl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function u_(i,r,l,u,d){var m=_c();return m=m===null?null:{parent:mt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&$a(r,null),xc(),fm(r),i!==null&&gs(i,r,u,!0),r.childLanes=d,null}function ho(i,r){return r=po({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function c_(i,r,l){return Br(r,i.child,null,l),i=ho(r,r.pendingProps),i.flags|=2,Ci(r),r.memoizedState=null,i}function p1(i,r,l){var u=r.pendingProps,d=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(Oe){if(u.mode==="hidden")return i=ho(r,u),r.lanes=536870912,Cl(null,i);if(Cc(r),(i=et)?(i=xg(i,Hi),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Kp(i),l.return=r,r.child=l,Pt=r,et=null)):i=null,i===null)throw qn(r);return r.lanes=536870912,null}return ho(r,u)}var m=i.memoizedState;if(m!==null){var v=m.dehydrated;if(Cc(r),d)if(r.flags&256)r.flags&=-257,r=c_(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(gt||gs(i,r,l,!1),d=(l&i.childLanes)!==0,gt||d){if(u=Ze,u!==null&&(v=ep(u,l),v!==0&&v!==m.retryLane))throw m.retryLane=v,Cr(i,v),mi(u,i,v),Yc;wo(),r=c_(i,r,l)}else i=m.treeContext,et=Pi(v.nextSibling),Pt=r,Oe=!0,Fn=null,Hi=!1,i!==null&&Gp(r,i),r=ho(r,u),r.flags|=4096;return r}return i=_n(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function fo(i,r){var l=r.ref;if(l===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(i===null||i.ref!==l)&&(r.flags|=4194816)}}function Vc(i,r,l,u,d){return Ar(r),l=Ec(i,r,l,u,void 0,d),u=Tc(),i!==null&&!gt?(Ac(i,r,d),xn(i,r,d)):(Oe&&u&&ac(r),r.flags|=1,Ft(i,r,l,d),r.child)}function h_(i,r,l,u,d,m){return Ar(r),r.updateQueue=null,l=pm(r,u,l,d),dm(i),u=Tc(),i!==null&&!gt?(Ac(i,r,m),xn(i,r,m)):(Oe&&u&&ac(r),r.flags|=1,Ft(i,r,l,m),r.child)}function f_(i,r,l,u,d){if(Ar(r),r.stateNode===null){var m=ds,v=l.contextType;typeof v=="object"&&v!==null&&(m=It(v)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=qc,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},vc(r),v=l.contextType,m.context=typeof v=="object"&&v!==null?It(v):ds,m.state=r.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Fc(r,l,v,u),m.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(v=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),v!==m.state&&qc.enqueueReplaceState(m,m.state,null),yl(r,u,m,d),vl(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var w=r.memoizedProps,M=Lr(l,w);m.props=M;var W=m.context,G=l.contextType;v=ds,typeof G=="object"&&G!==null&&(v=It(G));var ne=l.getDerivedStateFromProps;G=typeof ne=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,G||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||W!==v)&&Qm(r,m,u,v),Yn=!1;var K=r.memoizedState;m.state=K,yl(r,u,m,d),vl(),W=r.memoizedState,w||K!==W||Yn?(typeof ne=="function"&&(Fc(r,l,ne,u),W=r.memoizedState),(M=Yn||Zm(r,l,M,u,K,W,v))?(G||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=W),m.props=u,m.state=W,m.context=v,u=M):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,yc(i,r),v=r.memoizedProps,G=Lr(l,v),m.props=G,ne=r.pendingProps,K=m.context,W=l.contextType,M=ds,typeof W=="object"&&W!==null&&(M=It(W)),w=l.getDerivedStateFromProps,(W=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(v!==ne||K!==M)&&Qm(r,m,u,M),Yn=!1,K=r.memoizedState,m.state=K,yl(r,u,m,d),vl();var X=r.memoizedState;v!==ne||K!==X||Yn||i!==null&&i.dependencies!==null&&Ka(i.dependencies)?(typeof w=="function"&&(Fc(r,l,w,u),X=r.memoizedState),(G=Yn||Zm(r,l,G,u,K,X,M)||i!==null&&i.dependencies!==null&&Ka(i.dependencies))?(W||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,X,M),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,X,M)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=X),m.props=u,m.state=X,m.context=M,u=G):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,fo(i,r),u=(r.flags&128)!==0,m||u?(m=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&u?(r.child=Br(r,i.child,null,d),r.child=Br(r,null,l,d)):Ft(i,r,l,d),r.memoizedState=m.state,i=r.child):i=xn(i,r,d),i}function d_(i,r,l,u){return Er(),r.flags|=256,Ft(i,r,l,u),r.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(i){return{baseLanes:i,cachePool:im()}}function $c(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=Ei),i}function p_(i,r,l){var u=r.pendingProps,d=!1,m=(r.flags&128)!==0,v;if((v=m)||(v=i!==null&&i.memoizedState===null?!1:(ft.current&2)!==0),v&&(d=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,i===null){if(Oe){if(d?Xn(r):$n(),(i=et)?(i=xg(i,Hi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=Kp(i),l.return=r,r.child=l,Pt=r,et=null)):i=null,i===null)throw qn(r);return Mh(i)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,d?($n(),d=r.mode,w=po({mode:"hidden",children:w},d),u=kr(u,d,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(null,u)):(Xn(r),Gc(r,w))}var M=i.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(m)r.flags&256?(Xn(r),r.flags&=-257,r=Zc(i,r,l)):r.memoizedState!==null?($n(),r.child=i.child,r.flags|=128,r=null):($n(),w=u.fallback,d=r.mode,u=po({mode:"visible",children:u.children},d),w=kr(w,d,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Br(r,i.child,null,l),u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,r=Cl(null,u));else if(Xn(r),Mh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var W=v.dgst;v=W,u=Error(s(419)),u.stack="",u.digest=v,fl({value:u,source:null,stack:null}),r=Zc(i,r,l)}else if(gt||gs(i,r,l,!1),v=(l&i.childLanes)!==0,gt||v){if(v=Ze,v!==null&&(u=ep(v,l),u!==0&&u!==M.retryLane))throw M.retryLane=u,Cr(i,u),mi(v,i,u),Yc;Rh(w)||wo(),r=Zc(i,r,l)}else Rh(w)?(r.flags|=192,r.child=i.child,r=null):(i=M.treeContext,et=Pi(w.nextSibling),Pt=r,Oe=!0,Fn=null,Hi=!1,i!==null&&Gp(r,i),r=Gc(r,u.children),r.flags|=4096);return r}return d?($n(),w=u.fallback,d=r.mode,M=i.child,W=M.sibling,u=_n(M,{mode:"hidden",children:u.children}),u.subtreeFlags=M.subtreeFlags&65011712,W!==null?w=_n(W,w):(w=kr(w,d,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,Cl(null,u),u=r.child,w=i.child.memoizedState,w===null?w=Xc(l):(d=w.cachePool,d!==null?(M=mt._currentValue,d=d.parent!==M?{parent:M,pool:M}:d):d=im(),w={baseLanes:w.baseLanes|l,cachePool:d}),u.memoizedState=w,u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(i.child,u)):(Xn(r),l=i.child,i=l.sibling,l=_n(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,i!==null&&(v=r.deletions,v===null?(r.deletions=[i],r.flags|=16):v.push(i)),r.child=l,r.memoizedState=null,l)}function Gc(i,r){return r=po({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function po(i,r){return i=xi(22,i,null,r),i.lanes=0,i}function Zc(i,r,l){return Br(r,i.child,null,l),i=Gc(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function m_(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),fc(i.return,r,l)}function Qc(i,r,l,u,d,m){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:d,treeForkCount:m}:(v.isBackwards=r,v.rendering=null,v.renderingStartTime=0,v.last=u,v.tail=l,v.tailMode=d,v.treeForkCount=m)}function __(i,r,l){var u=r.pendingProps,d=u.revealOrder,m=u.tail;u=u.children;var v=ft.current,w=(v&2)!==0;if(w?(v=v&1|2,r.flags|=128):v&=1,C(ft,v),Ft(i,r,u,l),u=Oe?hl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&m_(i,l,r);else if(i.tag===19)m_(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(l=r.child,d=null;l!==null;)i=l.alternate,i!==null&&to(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),Qc(r,!1,d,l,m,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,d=r.child,r.child=null;d!==null;){if(i=d.alternate,i!==null&&to(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}Qc(r,!0,l,null,m,u);break;case"together":Qc(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function xn(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Qn|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(gs(i,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,l=_n(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=_n(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function Jc(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Ka(i)))}function m1(i,r,l){switch(r.tag){case 3:Ue(r,r.stateNode.containerInfo),Wn(r,mt,i.memoizedState.cache),Er();break;case 27:case 5:Ht(r);break;case 4:Ue(r,r.stateNode.containerInfo);break;case 10:Wn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cc(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Xn(r),r.flags|=128,null):(l&r.child.childLanes)!==0?p_(i,r,l):(Xn(r),i=xn(i,r,l),i!==null?i.sibling:null);Xn(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(gs(i,r,l,!1),u=(l&r.childLanes)!==0),d){if(u)return __(i,r,l);r.flags|=128}if(d=r.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),C(ft,ft.current),u)break;return null;case 22:return r.lanes=0,o_(i,r,l,r.pendingProps);case 24:Wn(r,mt,i.memoizedState.cache)}return xn(i,r,l)}function g_(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)gt=!0;else{if(!Jc(i,l)&&(r.flags&128)===0)return gt=!1,m1(i,r,l);gt=(i.flags&131072)!==0}else gt=!1,Oe&&(r.flags&1048576)!==0&&$p(r,hl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Rr(r.elementType),r.type=i,typeof i=="function")rc(i)?(u=Lr(i,u),r.tag=1,r=f_(null,r,i,u,l)):(r.tag=0,r=Vc(null,r,i,u,l));else{if(i!=null){var d=i.$$typeof;if(d===Z){r.tag=11,r=s_(null,r,i,u,l);break e}else if(d===J){r.tag=14,r=l_(null,r,i,u,l);break e}}throw r=B(i)||i,Error(s(306,r,""))}}return r;case 0:return Vc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Lr(u,r.pendingProps),f_(i,r,u,d,l);case 3:e:{if(Ue(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;d=m.element,yc(i,r),yl(r,u,null,l);var v=r.memoizedState;if(u=v.cache,Wn(r,mt,u),u!==m.cache&&dc(r,[mt],l,!0),vl(),u=v.element,m.isDehydrated)if(m={element:u,isDehydrated:!1,cache:v.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=d_(i,r,u,l);break e}else if(u!==d){d=zi(Error(s(424)),r),fl(d),r=d_(i,r,u,l);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(et=Pi(i.firstChild),Pt=r,Oe=!0,Fn=null,Hi=!0,l=om(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Er(),u===d){r=xn(i,r,l);break e}Ft(i,r,u,l)}r=r.child}return r;case 26:return fo(i,r),i===null?(l=Ag(r.type,null,r.pendingProps,null))?r.memoizedState=l:Oe||(l=r.type,i=r.pendingProps,u=Ro(he.current).createElement(l),u[Ut]=r,u[ui]=i,qt(u,l,i),At(u),r.stateNode=u):r.memoizedState=Ag(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ht(r),i===null&&Oe&&(u=r.stateNode=kg(r.type,r.pendingProps,he.current),Pt=r,Hi=!0,d=et,nr(r.type)?(Bh=d,et=Pi(u.firstChild)):et=d),Ft(i,r,r.pendingProps.children,l),fo(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Oe&&((d=u=et)&&(u=Y1(u,r.type,r.pendingProps,Hi),u!==null?(r.stateNode=u,Pt=r,et=Pi(u.firstChild),Hi=!1,d=!0):d=!1),d||qn(r)),Ht(r),d=r.type,m=r.pendingProps,v=i!==null?i.memoizedProps:null,u=m.children,Th(d,m)?u=null:v!==null&&Th(d,v)&&(r.flags|=32),r.memoizedState!==null&&(d=Ec(i,r,l1,null,null,l),Ul._currentValue=d),fo(i,r),Ft(i,r,u,l),r.child;case 6:return i===null&&Oe&&((i=l=et)&&(l=V1(l,r.pendingProps,Hi),l!==null?(r.stateNode=l,Pt=r,et=null,i=!0):i=!1),i||qn(r)),null;case 13:return p_(i,r,l);case 4:return Ue(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Br(r,null,u,l):Ft(i,r,u,l),r.child;case 11:return s_(i,r,r.type,r.pendingProps,l);case 7:return Ft(i,r,r.pendingProps,l),r.child;case 8:return Ft(i,r,r.pendingProps.children,l),r.child;case 12:return Ft(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Wn(r,r.type,u.value),Ft(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,Ar(r),d=It(d),u=u(d),r.flags|=1,Ft(i,r,u,l),r.child;case 14:return l_(i,r,r.type,r.pendingProps,l);case 15:return a_(i,r,r.type,r.pendingProps,l);case 19:return __(i,r,l);case 31:return p1(i,r,l);case 22:return o_(i,r,l,r.pendingProps);case 24:return Ar(r),u=It(mt),i===null?(d=_c(),d===null&&(d=Ze,m=pc(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),r.memoizedState={parent:u,cache:d},vc(r),Wn(r,mt,d)):((i.lanes&l)!==0&&(yc(i,r),yl(r,null,null,l),vl()),d=i.memoizedState,m=r.memoizedState,d.parent!==u?(d={parent:u,cache:u},r.memoizedState=d,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=d),Wn(r,mt,u)):(u=m.cache,Wn(r,mt,u),u!==d.cache&&dc(r,[mt],l,!0))),Ft(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function wn(i){i.flags|=4}function eh(i,r,l,u,d){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(W_())i.flags|=8192;else throw Mr=Za,gc}else i.flags&=-16777217}function v_(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Ng(r))if(W_())i.flags|=8192;else throw Mr=Za,gc}function mo(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Zd():536870912,i.lanes|=r,Ds|=r)}function kl(i,r){if(!Oe)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function tt(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(r)for(var d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags&65011712,u|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags,u|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=u,i.childLanes=l,r}function _1(i,r,l){var u=r.pendingProps;switch(oc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(r),null;case 1:return tt(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),yn(mt),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(_s(r)?wn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,cc())),tt(r),null;case 26:var d=r.type,m=r.memoizedState;return i===null?(wn(r),m!==null?(tt(r),v_(r,m)):(tt(r),eh(r,d,null,u,l))):m?m!==i.memoizedState?(wn(r),tt(r),v_(r,m)):(tt(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&wn(r),tt(r),eh(r,d,i,u,l)),null;case 27:if(Qt(r),l=he.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}i=ee.current,_s(r)?Zp(r):(i=kg(d,u,l),r.stateNode=i,wn(r))}return tt(r),null;case 5:if(Qt(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return tt(r),null}if(m=ee.current,_s(r))Zp(r);else{var v=Ro(he.current);switch(m){case 1:m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=v.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof u.is=="string"?v.createElement("select",{is:u.is}):v.createElement("select"),u.multiple?m.multiple=!0:u.size&&(m.size=u.size);break;default:m=typeof u.is=="string"?v.createElement(d,{is:u.is}):v.createElement(d)}}m[Ut]=r,m[ui]=u;e:for(v=r.child;v!==null;){if(v.tag===5||v.tag===6)m.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===r)break e;for(;v.sibling===null;){if(v.return===null||v.return===r)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}r.stateNode=m;e:switch(qt(m,d,u),d){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&wn(r)}}return tt(r),eh(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=he.current,_s(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=Pt,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[Ut]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||pg(i.nodeValue,l)),i||qn(r,!0)}else i=Ro(i).createTextNode(u),i[Ut]=r,r.stateNode=i}return tt(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=_s(r),l!==null){if(i===null){if(!u)throw Error(s(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[Ut]=r}else Er(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),i=!1}else l=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(Ci(r),r):(Ci(r),null);if((r.flags&128)!==0)throw Error(s(558))}return tt(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=_s(r),u!==null&&u.dehydrated!==null){if(i===null){if(!d)throw Error(s(318));if(d=r.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[Ut]=r}else Er(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),d=!1}else d=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(Ci(r),r):(Ci(r),null)}return Ci(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=r.child,d=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(d=u.alternate.memoizedState.cachePool.pool),m=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(m=u.memoizedState.cachePool.pool),m!==d&&(u.flags|=2048)),l!==i&&l&&(r.child.flags|=8192),mo(r,r.updateQueue),tt(r),null);case 4:return Se(),i===null&&xh(r.stateNode.containerInfo),tt(r),null;case 10:return yn(r.type),tt(r),null;case 19:if(V(ft),u=r.memoizedState,u===null)return tt(r),null;if(d=(r.flags&128)!==0,m=u.rendering,m===null)if(d)kl(u,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=to(i),m!==null){for(r.flags|=128,kl(u,!1),i=m.updateQueue,r.updateQueue=i,mo(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)Vp(l,i),l=l.sibling;return C(ft,ft.current&1|2),Oe&&gn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&Jt()>bo&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304)}else{if(!d)if(i=to(m),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,mo(r,i),kl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!Oe)return tt(r),null}else 2*Jt()-u.renderingStartTime>bo&&l!==536870912&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304);u.isBackwards?(m.sibling=r.child,r.child=m):(i=u.last,i!==null?i.sibling=m:r.child=m,u.last=m)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Jt(),i.sibling=null,l=ft.current,C(ft,d?l&1|2:l&1),Oe&&gn(r,u.treeForkCount),i):(tt(r),null);case 22:case 23:return Ci(r),wc(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(tt(r),r.subtreeFlags&6&&(r.flags|=8192)):tt(r),l=r.updateQueue,l!==null&&mo(r,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),i!==null&&V(Dr),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yn(mt),tt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function g1(i,r){switch(oc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return yn(mt),Se(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Qt(r),null;case 31:if(r.memoizedState!==null){if(Ci(r),r.alternate===null)throw Error(s(340));Er()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(Ci(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Er()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return V(ft),null;case 4:return Se(),null;case 10:return yn(r.type),null;case 22:case 23:return Ci(r),wc(),i!==null&&V(Dr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return yn(mt),null;case 25:return null;default:return null}}function y_(i,r){switch(oc(r),r.tag){case 3:yn(mt),Se();break;case 26:case 27:case 5:Qt(r);break;case 4:Se();break;case 31:r.memoizedState!==null&&Ci(r);break;case 13:Ci(r);break;case 19:V(ft);break;case 10:yn(r.type);break;case 22:case 23:Ci(r),wc(),i!==null&&V(Dr);break;case 24:yn(mt)}}function El(i,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){u=void 0;var m=l.create,v=l.inst;u=m(),v.destroy=u}l=l.next}while(l!==d)}}catch(w){Ye(r,r.return,w)}}function Gn(i,r,l){try{var u=r.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var m=d.next;u=m;do{if((u.tag&i)===i){var v=u.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=r;var M=l,W=w;try{W()}catch(G){Ye(d,M,G)}}}u=u.next}while(u!==m)}}catch(G){Ye(r,r.return,G)}}function b_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{cm(r,l)}catch(u){Ye(i,i.return,u)}}}function S_(i,r,l){l.props=Lr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){Ye(i,r,u)}}function Tl(i,r){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(d){Ye(i,r,d)}}function tn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){Ye(i,r,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){Ye(i,r,d)}else l.current=null}function x_(i){var r=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(d){Ye(i,i.return,d)}}function th(i,r,l){try{var u=i.stateNode;U1(u,i.type,l,r),u[ui]=r}catch(d){Ye(i,i.return,d)}}function w_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&nr(i.type)||i.tag===4}function ih(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||w_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&nr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nh(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(i),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=pn));else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(nh(i,r,l),i=i.sibling;i!==null;)nh(i,r,l),i=i.sibling}function _o(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(_o(i,r,l),i=i.sibling;i!==null;)_o(i,r,l),i=i.sibling}function C_(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);qt(r,u,l),r[Ut]=i,r[ui]=l}catch(m){Ye(i,i.return,m)}}var Cn=!1,vt=!1,rh=!1,k_=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function v1(i,r){if(i=i.containerInfo,kh=jo,i=jp(i),Zu(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var d=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var v=0,w=-1,M=-1,W=0,G=0,ne=i,K=null;t:for(;;){for(var X;ne!==l||d!==0&&ne.nodeType!==3||(w=v+d),ne!==m||u!==0&&ne.nodeType!==3||(M=v+u),ne.nodeType===3&&(v+=ne.nodeValue.length),(X=ne.firstChild)!==null;)K=ne,ne=X;for(;;){if(ne===i)break t;if(K===l&&++W===d&&(w=v),K===m&&++G===u&&(M=v),(X=ne.nextSibling)!==null)break;ne=K,K=ne.parentNode}ne=X}l=w===-1||M===-1?null:{start:w,end:M}}else l=null}l=l||{start:0,end:0}}else l=null;for(Eh={focusedElem:i,selectionRange:l},jo=!1,Dt=r;Dt!==null;)if(r=Dt,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Dt=i;else for(;Dt!==null;){switch(r=Dt,m=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)d=i[l],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,l=r,d=m.memoizedProps,m=m.memoizedState,u=l.stateNode;try{var me=Lr(l.type,d);i=u.getSnapshotBeforeUpdate(me,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(ye){Ye(l,l.return,ye)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Dh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,Dt=i;break}Dt=r.return}}function E_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:En(i,l),u&4&&El(5,l);break;case 1:if(En(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(v){Ye(l,l.return,v)}else{var d=Lr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ye(l,l.return,v)}}u&64&&b_(l),u&512&&Tl(l,l.return);break;case 3:if(En(i,l),u&64&&(i=l.updateQueue,i!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{cm(i,r)}catch(v){Ye(l,l.return,v)}}break;case 27:r===null&&u&4&&C_(l);case 26:case 5:En(i,l),r===null&&u&4&&x_(l),u&512&&Tl(l,l.return);break;case 12:En(i,l);break;case 31:En(i,l),u&4&&D_(i,l);break;case 13:En(i,l),u&4&&R_(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=T1.bind(null,l),K1(i,l))));break;case 22:if(u=l.memoizedState!==null||Cn,!u){r=r!==null&&r.memoizedState!==null||vt,d=Cn;var m=vt;Cn=u,(vt=r)&&!m?Tn(i,l,(l.subtreeFlags&8772)!==0):En(i,l),Cn=d,vt=m}break;case 30:break;default:En(i,l)}}function T_(i){var r=i.alternate;r!==null&&(i.alternate=null,T_(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Lu(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var nt=null,hi=!1;function kn(i,r,l){for(l=l.child;l!==null;)A_(i,r,l),l=l.sibling}function A_(i,r,l){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(ei,l)}catch{}switch(l.tag){case 26:vt||tn(l,r),kn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:vt||tn(l,r);var u=nt,d=hi;nr(l.type)&&(nt=l.stateNode,hi=!1),kn(i,r,l),Ol(l.stateNode),nt=u,hi=d;break;case 5:vt||tn(l,r);case 6:if(u=nt,d=hi,nt=null,kn(i,r,l),nt=u,hi=d,nt!==null)if(hi)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(l.stateNode)}catch(m){Ye(l,r,m)}else try{nt.removeChild(l.stateNode)}catch(m){Ye(l,r,m)}break;case 18:nt!==null&&(hi?(i=nt,bg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),js(i)):bg(nt,l.stateNode));break;case 4:u=nt,d=hi,nt=l.stateNode.containerInfo,hi=!0,kn(i,r,l),nt=u,hi=d;break;case 0:case 11:case 14:case 15:Gn(2,l,r),vt||Gn(4,l,r),kn(i,r,l);break;case 1:vt||(tn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&S_(l,r,u)),kn(i,r,l);break;case 21:kn(i,r,l);break;case 22:vt=(u=vt)||l.memoizedState!==null,kn(i,r,l),vt=u;break;default:kn(i,r,l)}}function D_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{js(i)}catch(l){Ye(r,r.return,l)}}}function R_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{js(i)}catch(l){Ye(r,r.return,l)}}function y1(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new k_),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new k_),r;default:throw Error(s(435,i.tag))}}function go(i,r){var l=y1(i);r.forEach(function(u){if(!l.has(u)){l.add(u);var d=A1.bind(null,i,u);u.then(d,d)}})}function fi(i,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var d=l[u],m=i,v=r,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(nr(w.type)){nt=w.stateNode,hi=!1;break e}break;case 5:nt=w.stateNode,hi=!1;break e;case 3:case 4:nt=w.stateNode.containerInfo,hi=!0;break e}w=w.return}if(nt===null)throw Error(s(160));A_(m,v,d),nt=null,hi=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)M_(r,i),r=r.sibling}var $i=null;function M_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:fi(r,i),di(i),u&4&&(Gn(3,i,i.return),El(3,i),Gn(5,i,i.return));break;case 1:fi(r,i),di(i),u&512&&(vt||l===null||tn(l,l.return)),u&64&&Cn&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var d=$i;if(fi(r,i),di(i),u&512&&(vt||l===null||tn(l,l.return)),u&4){var m=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,d=d.ownerDocument||d;t:switch(u){case"title":m=d.getElementsByTagName("title")[0],(!m||m[el]||m[Ut]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(u),d.head.insertBefore(m,d.querySelector("head > title"))),qt(m,u,l),m[Ut]=i,At(m),u=m;break e;case"link":var v=Mg("link","href",d).get(u+(l.href||""));if(v){for(var w=0;w<v.length;w++)if(m=v[w],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){v.splice(w,1);break t}}m=d.createElement(u),qt(m,u,l),d.head.appendChild(m);break;case"meta":if(v=Mg("meta","content",d).get(u+(l.content||""))){for(w=0;w<v.length;w++)if(m=v[w],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){v.splice(w,1);break t}}m=d.createElement(u),qt(m,u,l),d.head.appendChild(m);break;default:throw Error(s(468,u))}m[Ut]=i,At(m),u=m}i.stateNode=u}else Bg(d,i.type,i.stateNode);else i.stateNode=Rg(d,u,i.memoizedProps);else m!==u?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,u===null?Bg(d,i.type,i.stateNode):Rg(d,u,i.memoizedProps)):u===null&&i.stateNode!==null&&th(i,i.memoizedProps,l.memoizedProps)}break;case 27:fi(r,i),di(i),u&512&&(vt||l===null||tn(l,l.return)),l!==null&&u&4&&th(i,i.memoizedProps,l.memoizedProps);break;case 5:if(fi(r,i),di(i),u&512&&(vt||l===null||tn(l,l.return)),i.flags&32){d=i.stateNode;try{ls(d,"")}catch(me){Ye(i,i.return,me)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,th(i,d,l!==null?l.memoizedProps:d)),u&1024&&(rh=!0);break;case 6:if(fi(r,i),di(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(me){Ye(i,i.return,me)}}break;case 3:if(No=null,d=$i,$i=Mo(r.containerInfo),fi(r,i),$i=d,di(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{js(r.containerInfo)}catch(me){Ye(i,i.return,me)}rh&&(rh=!1,B_(i));break;case 4:u=$i,$i=Mo(i.stateNode.containerInfo),fi(r,i),di(i),$i=u;break;case 12:fi(r,i),di(i);break;case 31:fi(r,i),di(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 13:fi(r,i),di(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(yo=Jt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 22:d=i.memoizedState!==null;var M=l!==null&&l.memoizedState!==null,W=Cn,G=vt;if(Cn=W||d,vt=G||M,fi(r,i),vt=G,Cn=W,di(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||M||Cn||vt||zr(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){M=l=r;try{if(m=M.stateNode,d)v=m.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=M.stateNode;var ne=M.memoizedProps.style,K=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;w.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(me){Ye(M,M.return,me)}}}else if(r.tag===6){if(l===null){M=r;try{M.stateNode.nodeValue=d?"":M.memoizedProps}catch(me){Ye(M,M.return,me)}}}else if(r.tag===18){if(l===null){M=r;try{var X=M.stateNode;d?Sg(X,!0):Sg(M.stateNode,!1)}catch(me){Ye(M,M.return,me)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,go(i,l))));break;case 19:fi(r,i),di(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 30:break;case 21:break;default:fi(r,i),di(i)}}function di(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(w_(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,m=ih(i);_o(i,m,d);break;case 5:var v=l.stateNode;l.flags&32&&(ls(v,""),l.flags&=-33);var w=ih(i);_o(i,w,v);break;case 3:case 4:var M=l.stateNode.containerInfo,W=ih(i);nh(i,W,M);break;default:throw Error(s(161))}}catch(G){Ye(i,i.return,G)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function B_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;B_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function En(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)E_(i,r.alternate,r),r=r.sibling}function zr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Gn(4,r,r.return),zr(r);break;case 1:tn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&S_(r,r.return,l),zr(r);break;case 27:Ol(r.stateNode);case 26:case 5:tn(r,r.return),zr(r);break;case 22:r.memoizedState===null&&zr(r);break;case 30:zr(r);break;default:zr(r)}i=i.sibling}}function Tn(i,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,d=i,m=r,v=m.flags;switch(m.tag){case 0:case 11:case 15:Tn(d,m,l),El(4,m);break;case 1:if(Tn(d,m,l),u=m,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){Ye(u,u.return,W)}if(u=m,d=u.updateQueue,d!==null){var w=u.stateNode;try{var M=d.shared.hiddenCallbacks;if(M!==null)for(d.shared.hiddenCallbacks=null,d=0;d<M.length;d++)um(M[d],w)}catch(W){Ye(u,u.return,W)}}l&&v&64&&b_(m),Tl(m,m.return);break;case 27:C_(m);case 26:case 5:Tn(d,m,l),l&&u===null&&v&4&&x_(m),Tl(m,m.return);break;case 12:Tn(d,m,l);break;case 31:Tn(d,m,l),l&&v&4&&D_(d,m);break;case 13:Tn(d,m,l),l&&v&4&&R_(d,m);break;case 22:m.memoizedState===null&&Tn(d,m,l),Tl(m,m.return);break;case 30:break;default:Tn(d,m,l)}r=r.sibling}}function sh(i,r){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&dl(l))}function lh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i))}function Gi(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)N_(i,r,l,u),r=r.sibling}function N_(i,r,l,u){var d=r.flags;switch(r.tag){case 0:case 11:case 15:Gi(i,r,l,u),d&2048&&El(9,r);break;case 1:Gi(i,r,l,u);break;case 3:Gi(i,r,l,u),d&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i)));break;case 12:if(d&2048){Gi(i,r,l,u),i=r.stateNode;try{var m=r.memoizedProps,v=m.id,w=m.onPostCommit;typeof w=="function"&&w(v,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(M){Ye(r,r.return,M)}}else Gi(i,r,l,u);break;case 31:Gi(i,r,l,u);break;case 13:Gi(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,v=r.alternate,r.memoizedState!==null?m._visibility&2?Gi(i,r,l,u):Al(i,r):m._visibility&2?Gi(i,r,l,u):(m._visibility|=2,Es(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&sh(v,r);break;case 24:Gi(i,r,l,u),d&2048&&lh(r.alternate,r);break;default:Gi(i,r,l,u)}}function Es(i,r,l,u,d){for(d=d&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var m=i,v=r,w=l,M=u,W=v.flags;switch(v.tag){case 0:case 11:case 15:Es(m,v,w,M,d),El(8,v);break;case 23:break;case 22:var G=v.stateNode;v.memoizedState!==null?G._visibility&2?Es(m,v,w,M,d):Al(m,v):(G._visibility|=2,Es(m,v,w,M,d)),d&&W&2048&&sh(v.alternate,v);break;case 24:Es(m,v,w,M,d),d&&W&2048&&lh(v.alternate,v);break;default:Es(m,v,w,M,d)}r=r.sibling}}function Al(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=i,u=r,d=u.flags;switch(u.tag){case 22:Al(l,u),d&2048&&sh(u.alternate,u);break;case 24:Al(l,u),d&2048&&lh(u.alternate,u);break;default:Al(l,u)}r=r.sibling}}var Dl=8192;function Ts(i,r,l){if(i.subtreeFlags&Dl)for(i=i.child;i!==null;)L_(i,r,l),i=i.sibling}function L_(i,r,l){switch(i.tag){case 26:Ts(i,r,l),i.flags&Dl&&i.memoizedState!==null&&sx(l,$i,i.memoizedState,i.memoizedProps);break;case 5:Ts(i,r,l);break;case 3:case 4:var u=$i;$i=Mo(i.stateNode.containerInfo),Ts(i,r,l),$i=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Dl,Dl=16777216,Ts(i,r,l),Dl=u):Ts(i,r,l));break;default:Ts(i,r,l)}}function z_(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Rl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Dt=u,j_(u,i)}z_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)O_(i),i=i.sibling}function O_(i){switch(i.tag){case 0:case 11:case 15:Rl(i),i.flags&2048&&Gn(9,i,i.return);break;case 3:Rl(i);break;case 12:Rl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,vo(i)):Rl(i);break;default:Rl(i)}}function vo(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Dt=u,j_(u,i)}z_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Gn(8,r,r.return),vo(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,vo(r));break;default:vo(r)}i=i.sibling}}function j_(i,r){for(;Dt!==null;){var l=Dt;switch(l.tag){case 0:case 11:case 15:Gn(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:dl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Dt=u;else e:for(l=i;Dt!==null;){u=Dt;var d=u.sibling,m=u.return;if(T_(u),u===l){Dt=null;break e}if(d!==null){d.return=m,Dt=d;break e}Dt=m}}}var b1={getCacheForType:function(i){var r=It(mt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return It(mt).controller.signal}},S1=typeof WeakMap=="function"?WeakMap:Map,Fe=0,Ze=null,Me=null,Le=0,We=0,ki=null,Zn=!1,As=!1,ah=!1,An=0,ot=0,Qn=0,Or=0,oh=0,Ei=0,Ds=0,Ml=null,pi=null,uh=!1,yo=0,H_=0,bo=1/0,So=null,Jn=null,wt=0,er=null,Rs=null,Dn=0,ch=0,hh=null,U_=null,Bl=0,fh=null;function Ti(){return(Fe&2)!==0&&Le!==0?Le&-Le:A.T!==null?vh():tp()}function P_(){if(Ei===0)if((Le&536870912)===0||Oe){var i=Aa;Aa<<=1,(Aa&3932160)===0&&(Aa=262144),Ei=i}else Ei=536870912;return i=wi.current,i!==null&&(i.flags|=32),Ei}function mi(i,r,l){(i===Ze&&(We===2||We===9)||i.cancelPendingCommit!==null)&&(Ms(i,0),tr(i,Le,Ei,!1)),Js(i,l),((Fe&2)===0||i!==Ze)&&(i===Ze&&((Fe&2)===0&&(Or|=l),ot===4&&tr(i,Le,Ei,!1)),nn(i))}function I_(i,r,l){if((Fe&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||Qs(i,r),d=u?C1(i,r):ph(i,r,!0),m=u;do{if(d===0){As&&!u&&tr(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!x1(l)){d=ph(i,r,!1),m=!1;continue}if(d===2){if(m=r,i.errorRecoveryDisabledLanes&m)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){r=v;e:{var w=i;d=Ml;var M=w.current.memoizedState.isDehydrated;if(M&&(Ms(w,v).flags|=256),v=ph(w,v,!1),v!==2){if(ah&&!M){w.errorRecoveryDisabledLanes|=m,Or|=m,d=4;break e}m=pi,pi=d,m!==null&&(pi===null?pi=m:pi.push.apply(pi,m))}d=v}if(m=!1,d!==2)continue}}if(d===1){Ms(i,0),tr(i,r,0,!0);break}e:{switch(u=i,m=d,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:tr(u,r,Ei,!Zn);break e;case 2:pi=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=yo+300-Jt(),10<d)){if(tr(u,r,Ei,!Zn),Ra(u,0,!0)!==0)break e;Dn=r,u.timeoutHandle=vg(F_.bind(null,u,l,pi,So,uh,r,Ei,Or,Ds,Zn,m,"Throttled",-0,0),d);break e}F_(u,l,pi,So,uh,r,Ei,Or,Ds,Zn,m,null,-0,0)}}break}while(!0);nn(i)}function F_(i,r,l,u,d,m,v,w,M,W,G,ne,K,X){if(i.timeoutHandle=-1,ne=r.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pn},L_(r,m,ne);var me=(m&62914560)===m?yo-Jt():(m&4194048)===m?H_-Jt():0;if(me=lx(ne,me),me!==null){Dn=m,i.cancelPendingCommit=me(G_.bind(null,i,r,m,l,u,d,v,w,M,G,ne,null,K,X)),tr(i,m,v,!W);return}}G_(i,r,m,l,u,d,v,w,M)}function x1(i){for(var r=i;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var d=l[u],m=d.getSnapshot;d=d.value;try{if(!Si(m(),d))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function tr(i,r,l,u){r&=~oh,r&=~Or,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var m=31-Ge(d),v=1<<m;u[m]=-1,d&=~v}l!==0&&Qd(i,l,r)}function xo(){return(Fe&6)===0?(Nl(0),!1):!0}function dh(){if(Me!==null){if(We===0)var i=Me.return;else i=Me,vn=Tr=null,Dc(i),Ss=null,ml=0,i=Me;for(;i!==null;)y_(i.alternate,i),i=i.return;Me=null}}function Ms(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,F1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Dn=0,dh(),Ze=i,Me=l=_n(i.current,null),Le=r,We=0,ki=null,Zn=!1,As=Qs(i,r),ah=!1,Ds=Ei=oh=Or=Qn=ot=0,pi=Ml=null,uh=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var d=31-Ge(u),m=1<<d;r|=i[d],u&=~m}return An=r,Fa(),l}function q_(i,r){ke=null,A.H=wl,r===bs||r===Ga?(r=sm(),We=3):r===gc?(r=sm(),We=4):We=r===Yc?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,ki=r,Me===null&&(ot=1,co(i,zi(r,i.current)))}function W_(){var i=wi.current;return i===null?!0:(Le&4194048)===Le?Ui===null:(Le&62914560)===Le||(Le&536870912)!==0?i===Ui:!1}function Y_(){var i=A.H;return A.H=wl,i===null?wl:i}function V_(){var i=A.A;return A.A=b1,i}function wo(){ot=4,Zn||(Le&4194048)!==Le&&wi.current!==null||(As=!0),(Qn&134217727)===0&&(Or&134217727)===0||Ze===null||tr(Ze,Le,Ei,!1)}function ph(i,r,l){var u=Fe;Fe|=2;var d=Y_(),m=V_();(Ze!==i||Le!==r)&&(So=null,Ms(i,r)),r=!1;var v=ot;e:do try{if(We!==0&&Me!==null){var w=Me,M=ki;switch(We){case 8:dh(),v=6;break e;case 3:case 2:case 9:case 6:wi.current===null&&(r=!0);var W=We;if(We=0,ki=null,Bs(i,w,M,W),l&&As){v=0;break e}break;default:W=We,We=0,ki=null,Bs(i,w,M,W)}}w1(),v=ot;break}catch(G){q_(i,G)}while(!0);return r&&i.shellSuspendCounter++,vn=Tr=null,Fe=u,A.H=d,A.A=m,Me===null&&(Ze=null,Le=0,Fa()),v}function w1(){for(;Me!==null;)K_(Me)}function C1(i,r){var l=Fe;Fe|=2;var u=Y_(),d=V_();Ze!==i||Le!==r?(So=null,bo=Jt()+500,Ms(i,r)):As=Qs(i,r);e:do try{if(We!==0&&Me!==null){r=Me;var m=ki;t:switch(We){case 1:We=0,ki=null,Bs(i,r,m,1);break;case 2:case 9:if(nm(m)){We=0,ki=null,X_(r);break}r=function(){We!==2&&We!==9||Ze!==i||(We=7),nn(i)},m.then(r,r);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:nm(m)?(We=0,ki=null,X_(r)):(We=0,ki=null,Bs(i,r,m,7));break;case 5:var v=null;switch(Me.tag){case 26:v=Me.memoizedState;case 5:case 27:var w=Me;if(v?Ng(v):w.stateNode.complete){We=0,ki=null;var M=w.sibling;if(M!==null)Me=M;else{var W=w.return;W!==null?(Me=W,Co(W)):Me=null}break t}}We=0,ki=null,Bs(i,r,m,5);break;case 6:We=0,ki=null,Bs(i,r,m,6);break;case 8:dh(),ot=6;break e;default:throw Error(s(462))}}k1();break}catch(G){q_(i,G)}while(!0);return vn=Tr=null,A.H=u,A.A=d,Fe=l,Me!==null?0:(Ze=null,Le=0,Fa(),ot)}function k1(){for(;Me!==null&&!Tu();)K_(Me)}function K_(i){var r=g_(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?Co(i):Me=r}function X_(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=h_(l,r,r.pendingProps,r.type,void 0,Le);break;case 11:r=h_(l,r,r.pendingProps,r.type.render,r.ref,Le);break;case 5:Dc(r);default:y_(l,r),r=Me=Vp(r,An),r=g_(l,r,An)}i.memoizedProps=i.pendingProps,r===null?Co(i):Me=r}function Bs(i,r,l,u){vn=Tr=null,Dc(r),Ss=null,ml=0;var d=r.return;try{if(d1(i,d,r,l,Le)){ot=1,co(i,zi(l,i.current)),Me=null;return}}catch(m){if(d!==null)throw Me=d,m;ot=1,co(i,zi(l,i.current)),Me=null;return}r.flags&32768?(Oe||u===1?i=!0:As||(Le&536870912)!==0?i=!1:(Zn=i=!0,(u===2||u===9||u===3||u===6)&&(u=wi.current,u!==null&&u.tag===13&&(u.flags|=16384))),$_(r,i)):Co(r)}function Co(i){var r=i;do{if((r.flags&32768)!==0){$_(r,Zn);return}i=r.return;var l=_1(r.alternate,r,An);if(l!==null){Me=l;return}if(r=r.sibling,r!==null){Me=r;return}Me=r=i}while(r!==null);ot===0&&(ot=5)}function $_(i,r){do{var l=g1(i.alternate,i);if(l!==null){l.flags&=32767,Me=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Me=i;return}Me=i=l}while(i!==null);ot=6,Me=null}function G_(i,r,l,u,d,m,v,w,M){i.cancelPendingCommit=null;do ko();while(wt!==0);if((Fe&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=ic,r0(i,l,m,v,w,M),i===Ze&&(Me=Ze=null,Le=0),Rs=r,er=i,Dn=l,ch=m,hh=d,U_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,D1(xe,function(){return tg(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=A.T,A.T=null,d=j.p,j.p=2,v=Fe,Fe|=4;try{v1(i,r,l)}finally{Fe=v,j.p=d,A.T=u}}wt=1,Z_(),Q_(),J_()}}function Z_(){if(wt===1){wt=0;var i=er,r=Rs,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=A.T,A.T=null;var u=j.p;j.p=2;var d=Fe;Fe|=4;try{M_(r,i);var m=Eh,v=jp(i.containerInfo),w=m.focusedElem,M=m.selectionRange;if(v!==w&&w&&w.ownerDocument&&Op(w.ownerDocument.documentElement,w)){if(M!==null&&Zu(w)){var W=M.start,G=M.end;if(G===void 0&&(G=W),"selectionStart"in w)w.selectionStart=W,w.selectionEnd=Math.min(G,w.value.length);else{var ne=w.ownerDocument||document,K=ne&&ne.defaultView||window;if(K.getSelection){var X=K.getSelection(),me=w.textContent.length,ye=Math.min(M.start,me),Xe=M.end===void 0?ye:Math.min(M.end,me);!X.extend&&ye>Xe&&(v=Xe,Xe=ye,ye=v);var U=zp(w,ye),z=zp(w,Xe);if(U&&z&&(X.rangeCount!==1||X.anchorNode!==U.node||X.anchorOffset!==U.offset||X.focusNode!==z.node||X.focusOffset!==z.offset)){var q=ne.createRange();q.setStart(U.node,U.offset),X.removeAllRanges(),ye>Xe?(X.addRange(q),X.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),X.addRange(q))}}}}for(ne=[],X=w;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ne.length;w++){var te=ne[w];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}jo=!!kh,Eh=kh=null}finally{Fe=d,j.p=u,A.T=l}}i.current=r,wt=2}}function Q_(){if(wt===2){wt=0;var i=er,r=Rs,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=A.T,A.T=null;var u=j.p;j.p=2;var d=Fe;Fe|=4;try{E_(i,r.alternate,r)}finally{Fe=d,j.p=u,A.T=l}}wt=3}}function J_(){if(wt===4||wt===3){wt=0,Au();var i=er,r=Rs,l=Dn,u=U_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?wt=5:(wt=0,Rs=er=null,eg(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(Jn=null),Bu(l),r=r.stateNode,xt&&typeof xt.onCommitFiberRoot=="function")try{xt.onCommitFiberRoot(ei,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=A.T,d=j.p,j.p=2,A.T=null;try{for(var m=i.onRecoverableError,v=0;v<u.length;v++){var w=u[v];m(w.value,{componentStack:w.stack})}}finally{A.T=r,j.p=d}}(Dn&3)!==0&&ko(),nn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===fh?Bl++:(Bl=0,fh=i):Bl=0,Nl(0)}}function eg(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,dl(r)))}function ko(){return Z_(),Q_(),J_(),tg()}function tg(){if(wt!==5)return!1;var i=er,r=ch;ch=0;var l=Bu(Dn),u=A.T,d=j.p;try{j.p=32>l?32:l,A.T=null,l=hh,hh=null;var m=er,v=Dn;if(wt=0,Rs=er=null,Dn=0,(Fe&6)!==0)throw Error(s(331));var w=Fe;if(Fe|=4,O_(m.current),N_(m,m.current,v,l),Fe=w,Nl(0,!1),xt&&typeof xt.onPostCommitFiberRoot=="function")try{xt.onPostCommitFiberRoot(ei,m)}catch{}return!0}finally{j.p=d,A.T=u,eg(i,r)}}function ig(i,r,l){r=zi(l,r),r=Wc(i.stateNode,r,2),i=Kn(i,r,2),i!==null&&(Js(i,2),nn(i))}function Ye(i,r,l){if(i.tag===3)ig(i,i,l);else for(;r!==null;){if(r.tag===3){ig(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Jn===null||!Jn.has(u))){i=zi(l,i),l=n_(2),u=Kn(r,l,2),u!==null&&(r_(l,u,r,i),Js(u,2),nn(u));break}}r=r.return}}function mh(i,r,l){var u=i.pingCache;if(u===null){u=i.pingCache=new S1;var d=new Set;u.set(r,d)}else d=u.get(r),d===void 0&&(d=new Set,u.set(r,d));d.has(l)||(ah=!0,d.add(l),i=E1.bind(null,i,r,l),r.then(i,i))}function E1(i,r,l){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,Ze===i&&(Le&l)===l&&(ot===4||ot===3&&(Le&62914560)===Le&&300>Jt()-yo?(Fe&2)===0&&Ms(i,0):oh|=l,Ds===Le&&(Ds=0)),nn(i)}function ng(i,r){r===0&&(r=Zd()),i=Cr(i,r),i!==null&&(Js(i,r),nn(i))}function T1(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),ng(i,l)}function A1(i,r){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,d=i.memoizedState;d!==null&&(l=d.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),ng(i,l)}function D1(i,r){return Jr(i,r)}var Eo=null,Ns=null,_h=!1,To=!1,gh=!1,ir=0;function nn(i){i!==Ns&&i.next===null&&(Ns===null?Eo=Ns=i:Ns=Ns.next=i),To=!0,_h||(_h=!0,M1())}function Nl(i,r){if(!gh&&To){gh=!0;do for(var l=!1,u=Eo;u!==null;){if(i!==0){var d=u.pendingLanes;if(d===0)var m=0;else{var v=u.suspendedLanes,w=u.pingedLanes;m=(1<<31-Ge(42|i)+1)-1,m&=d&~(v&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,ag(u,m))}else m=Le,m=Ra(u,u===Ze?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||Qs(u,m)||(l=!0,ag(u,m));u=u.next}while(l);gh=!1}}function R1(){rg()}function rg(){To=_h=!1;var i=0;ir!==0&&I1()&&(i=ir);for(var r=Jt(),l=null,u=Eo;u!==null;){var d=u.next,m=sg(u,r);m===0?(u.next=null,l===null?Eo=d:l.next=d,d===null&&(Ns=l)):(l=u,(i!==0||(m&3)!==0)&&(To=!0)),u=d}wt!==0&&wt!==5||Nl(i),ir!==0&&(ir=0)}function sg(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var v=31-Ge(m),w=1<<v,M=d[v];M===-1?((w&l)===0||(w&u)!==0)&&(d[v]=n0(w,r)):M<=r&&(i.expiredLanes|=w),m&=~w}if(r=Ze,l=Le,l=Ra(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(We===2||We===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Zs(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||Qs(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Zs(u),Bu(l)){case 2:case 8:l=ce;break;case 32:l=xe;break;case 268435456:l=qe;break;default:l=xe}return u=lg.bind(null,i),l=Jr(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Zs(u),i.callbackPriority=2,i.callbackNode=null,2}function lg(i,r){if(wt!==0&&wt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(ko()&&i.callbackNode!==l)return null;var u=Le;return u=Ra(i,i===Ze?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(I_(i,u,r),sg(i,Jt()),i.callbackNode!=null&&i.callbackNode===l?lg.bind(null,i):null)}function ag(i,r){if(ko())return null;I_(i,r,!0)}function M1(){q1(function(){(Fe&6)!==0?Jr(Q,R1):rg()})}function vh(){if(ir===0){var i=vs;i===0&&(i=Ta,Ta<<=1,(Ta&261888)===0&&(Ta=256)),ir=i}return ir}function og(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:La(""+i)}function ug(i,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,i.id&&l.setAttribute("form",i.id),r.parentNode.insertBefore(l,r),i=new FormData(i),l.parentNode.removeChild(l),i}function B1(i,r,l,u,d){if(r==="submit"&&l&&l.stateNode===d){var m=og((d[ui]||null).action),v=u.submitter;v&&(r=(r=v[ui]||null)?og(r.formAction):v.getAttribute("formAction"),r!==null&&(m=r,v=null));var w=new Ha("action","action",null,u,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ir!==0){var M=v?ug(d,v):new FormData(d);Hc(l,{pending:!0,data:M,method:d.method,action:m},null,M)}}else typeof m=="function"&&(w.preventDefault(),M=v?ug(d,v):new FormData(d),Hc(l,{pending:!0,data:M,method:d.method,action:m},m,M))},currentTarget:d}]})}}for(var yh=0;yh<tc.length;yh++){var bh=tc[yh],N1=bh.toLowerCase(),L1=bh[0].toUpperCase()+bh.slice(1);Xi(N1,"on"+L1)}Xi(Pp,"onAnimationEnd"),Xi(Ip,"onAnimationIteration"),Xi(Fp,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(G0,"onTransitionRun"),Xi(Z0,"onTransitionStart"),Xi(Q0,"onTransitionCancel"),Xi(qp,"onTransitionEnd"),rs("onMouseEnter",["mouseout","mouseover"]),rs("onMouseLeave",["mouseout","mouseover"]),rs("onPointerEnter",["pointerout","pointerover"]),rs("onPointerLeave",["pointerout","pointerover"]),br("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),br("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),br("onBeforeInput",["compositionend","keypress","textInput","paste"]),br("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),br("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),br("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ll="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(" "),z1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ll));function cg(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],d=u.event;u=u.listeners;e:{var m=void 0;if(r)for(var v=u.length-1;0<=v;v--){var w=u[v],M=w.instance,W=w.currentTarget;if(w=w.listener,M!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=W;try{m(d)}catch(G){Ia(G)}d.currentTarget=null,m=M}else for(v=0;v<u.length;v++){if(w=u[v],M=w.instance,W=w.currentTarget,w=w.listener,M!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=W;try{m(d)}catch(G){Ia(G)}d.currentTarget=null,m=M}}}}function Be(i,r){var l=r[Nu];l===void 0&&(l=r[Nu]=new Set);var u=i+"__bubble";l.has(u)||(hg(r,i,2,!1),l.add(u))}function Sh(i,r,l){var u=0;r&&(u|=4),hg(l,i,u,r)}var Ao="_reactListening"+Math.random().toString(36).slice(2);function xh(i){if(!i[Ao]){i[Ao]=!0,rp.forEach(function(l){l!=="selectionchange"&&(z1.has(l)||Sh(l,!1,i),Sh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[Ao]||(r[Ao]=!0,Sh("selectionchange",!1,r))}}function hg(i,r,l,u){switch(Pg(r)){case 2:var d=ux;break;case 8:d=cx;break;default:d=jh}l=d.bind(null,r,l,i),d=void 0,!Fu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(d=!0),u?d!==void 0?i.addEventListener(r,l,{capture:!0,passive:d}):i.addEventListener(r,l,!0):d!==void 0?i.addEventListener(r,l,{passive:d}):i.addEventListener(r,l,!1)}function wh(i,r,l,u,d){var m=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var v=u.tag;if(v===3||v===4){var w=u.stateNode.containerInfo;if(w===d)break;if(v===4)for(v=u.return;v!==null;){var M=v.tag;if((M===3||M===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=ts(w),v===null)return;if(M=v.tag,M===5||M===6||M===26||M===27){u=m=v;continue e}w=w.parentNode}}u=u.return}_p(function(){var W=m,G=Pu(l),ne=[];e:{var K=Wp.get(i);if(K!==void 0){var X=Ha,me=i;switch(i){case"keypress":if(Oa(l)===0)break e;case"keydown":case"keyup":X=A0;break;case"focusin":me="focus",X=Vu;break;case"focusout":me="blur",X=Vu;break;case"beforeblur":case"afterblur":X=Vu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=yp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=_0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=M0;break;case Pp:case Ip:case Fp:X=y0;break;case qp:X=N0;break;case"scroll":case"scrollend":X=p0;break;case"wheel":X=z0;break;case"copy":case"cut":case"paste":X=S0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Sp;break;case"toggle":case"beforetoggle":X=j0}var ye=(r&4)!==0,Xe=!ye&&(i==="scroll"||i==="scrollend"),U=ye?K!==null?K+"Capture":null:K;ye=[];for(var z=W,q;z!==null;){var te=z;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||U===null||(te=il(z,U),te!=null&&ye.push(zl(z,te,q))),Xe)break;z=z.return}0<ye.length&&(K=new X(K,me,null,l,G),ne.push({event:K,listeners:ye}))}}if((r&7)===0){e:{if(K=i==="mouseover"||i==="pointerover",X=i==="mouseout"||i==="pointerout",K&&l!==Uu&&(me=l.relatedTarget||l.fromElement)&&(ts(me)||me[es]))break e;if((X||K)&&(K=G.window===G?G:(K=G.ownerDocument)?K.defaultView||K.parentWindow:window,X?(me=l.relatedTarget||l.toElement,X=W,me=me?ts(me):null,me!==null&&(Xe=o(me),ye=me.tag,me!==Xe||ye!==5&&ye!==27&&ye!==6)&&(me=null)):(X=null,me=W),X!==me)){if(ye=yp,te="onMouseLeave",U="onMouseEnter",z="mouse",(i==="pointerout"||i==="pointerover")&&(ye=Sp,te="onPointerLeave",U="onPointerEnter",z="pointer"),Xe=X==null?K:tl(X),q=me==null?K:tl(me),K=new ye(te,z+"leave",X,l,G),K.target=Xe,K.relatedTarget=q,te=null,ts(G)===W&&(ye=new ye(U,z+"enter",me,l,G),ye.target=q,ye.relatedTarget=Xe,te=ye),Xe=te,X&&me)t:{for(ye=O1,U=X,z=me,q=0,te=U;te;te=ye(te))q++;te=0;for(var ge=z;ge;ge=ye(ge))te++;for(;0<q-te;)U=ye(U),q--;for(;0<te-q;)z=ye(z),te--;for(;q--;){if(U===z||z!==null&&U===z.alternate){ye=U;break t}U=ye(U),z=ye(z)}ye=null}else ye=null;X!==null&&fg(ne,K,X,ye,!1),me!==null&&Xe!==null&&fg(ne,Xe,me,ye,!0)}}e:{if(K=W?tl(W):window,X=K.nodeName&&K.nodeName.toLowerCase(),X==="select"||X==="input"&&K.type==="file")var Pe=Dp;else if(Tp(K))if(Rp)Pe=K0;else{Pe=Y0;var _e=W0}else X=K.nodeName,!X||X.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?W&&Hu(W.elementType)&&(Pe=Dp):Pe=V0;if(Pe&&(Pe=Pe(i,W))){Ap(ne,Pe,l,G);break e}_e&&_e(i,K,W),i==="focusout"&&W&&K.type==="number"&&W.memoizedProps.value!=null&&ju(K,"number",K.value)}switch(_e=W?tl(W):window,i){case"focusin":(Tp(_e)||_e.contentEditable==="true")&&(cs=_e,Qu=W,cl=null);break;case"focusout":cl=Qu=cs=null;break;case"mousedown":Ju=!0;break;case"contextmenu":case"mouseup":case"dragend":Ju=!1,Hp(ne,l,G);break;case"selectionchange":if($0)break;case"keydown":case"keyup":Hp(ne,l,G)}var Ee;if(Xu)e:{switch(i){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else us?kp(i,l)&&(ze="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(ze="onCompositionStart");ze&&(xp&&l.locale!=="ko"&&(us||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&us&&(Ee=gp()):(Pn=G,qu="value"in Pn?Pn.value:Pn.textContent,us=!0)),_e=Do(W,ze),0<_e.length&&(ze=new bp(ze,i,null,l,G),ne.push({event:ze,listeners:_e}),Ee?ze.data=Ee:(Ee=Ep(l),Ee!==null&&(ze.data=Ee)))),(Ee=U0?P0(i,l):I0(i,l))&&(ze=Do(W,"onBeforeInput"),0<ze.length&&(_e=new bp("onBeforeInput","beforeinput",null,l,G),ne.push({event:_e,listeners:ze}),_e.data=Ee)),B1(ne,i,W,l,G)}cg(ne,r)})}function zl(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Do(i,r){for(var l=r+"Capture",u=[];i!==null;){var d=i,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=il(i,l),d!=null&&u.unshift(zl(i,d,m)),d=il(i,r),d!=null&&u.push(zl(i,d,m))),i.tag===3)return u;i=i.return}return[]}function O1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function fg(i,r,l,u,d){for(var m=r._reactName,v=[];l!==null&&l!==u;){var w=l,M=w.alternate,W=w.stateNode;if(w=w.tag,M!==null&&M===u)break;w!==5&&w!==26&&w!==27||W===null||(M=W,d?(W=il(l,m),W!=null&&v.unshift(zl(l,W,M))):d||(W=il(l,m),W!=null&&v.push(zl(l,W,M)))),l=l.return}v.length!==0&&i.push({event:r,listeners:v})}var j1=/\r\n?/g,H1=/\u0000|\uFFFD/g;function dg(i){return(typeof i=="string"?i:""+i).replace(j1,`
49
- `).replace(H1,"")}function pg(i,r){return r=dg(r),dg(i)===r}function Ke(i,r,l,u,d,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ls(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ls(i,""+u);break;case"className":Ba(i,"class",u);break;case"tabIndex":Ba(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ba(i,l,u);break;case"style":pp(i,u,m);break;case"data":if(r!=="object"){Ba(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.setAttribute(l,"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 m=="function"&&(l==="formAction"?(r!=="input"&&Ke(i,r,"name",d.name,d,null),Ke(i,r,"formEncType",d.formEncType,d,null),Ke(i,r,"formMethod",d.formMethod,d,null),Ke(i,r,"formTarget",d.formTarget,d,null)):(Ke(i,r,"encType",d.encType,d,null),Ke(i,r,"method",d.method,d,null),Ke(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=pn);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.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"){i.removeAttribute("xlink:href");break}l=La(""+u),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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"?i.setAttribute(l,""+u):i.removeAttribute(l);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"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Be("beforetoggle",i),Be("toggle",i),Ma(i,"popover",u);break;case"xlinkActuate":dn(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":dn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":dn(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":dn(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":dn(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":dn(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":dn(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":dn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":dn(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ma(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=f0.get(l)||l,Ma(i,l,u))}}function Ch(i,r,l,u,d,m){switch(l){case"style":pp(i,u,m);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"children":typeof u=="string"?ls(i,u):(typeof u=="number"||typeof u=="bigint")&&ls(i,""+u);break;case"onScroll":u!=null&&Be("scroll",i);break;case"onScrollEnd":u!=null&&Be("scrollend",i);break;case"onClick":u!=null&&(i.onclick=pn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sp.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),r=l.slice(2,d?l.length-7:void 0),m=i[ui]||null,m=m!=null?m[l]:null,typeof m=="function"&&i.removeEventListener(r,m,d),typeof u=="function")){typeof m!="function"&&m!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(r,u,d);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):Ma(i,l,u)}}}function qt(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",i),Be("load",i);var u=!1,d=!1,m;for(m in l)if(l.hasOwnProperty(m)){var v=l[m];if(v!=null)switch(m){case"src":u=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,m,v,l,null)}}d&&Ke(i,r,"srcSet",l.srcSet,l,null),u&&Ke(i,r,"src",l.src,l,null);return;case"input":Be("invalid",i);var w=m=v=d=null,M=null,W=null;for(u in l)if(l.hasOwnProperty(u)){var G=l[u];if(G!=null)switch(u){case"name":d=G;break;case"type":v=G;break;case"checked":M=G;break;case"defaultChecked":W=G;break;case"value":m=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,r));break;default:Ke(i,r,u,G,l,null)}}cp(i,m,w,M,W,v,d,!1);return;case"select":Be("invalid",i),u=v=m=null;for(d in l)if(l.hasOwnProperty(d)&&(w=l[d],w!=null))switch(d){case"value":m=w;break;case"defaultValue":v=w;break;case"multiple":u=w;default:Ke(i,r,d,w,l,null)}r=m,l=v,i.multiple=!!u,r!=null?ss(i,!!u,r,!1):l!=null&&ss(i,!!u,l,!0);return;case"textarea":Be("invalid",i),m=d=u=null;for(v in l)if(l.hasOwnProperty(v)&&(w=l[v],w!=null))switch(v){case"value":u=w;break;case"defaultValue":d=w;break;case"children":m=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:Ke(i,r,v,w,l,null)}fp(i,u,d,m);return;case"option":for(M in l)if(l.hasOwnProperty(M)&&(u=l[M],u!=null))switch(M){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ke(i,r,M,u,l,null)}return;case"dialog":Be("beforetoggle",i),Be("toggle",i),Be("cancel",i),Be("close",i);break;case"iframe":case"object":Be("load",i);break;case"video":case"audio":for(u=0;u<Ll.length;u++)Be(Ll[u],i);break;case"image":Be("error",i),Be("load",i);break;case"details":Be("toggle",i);break;case"embed":case"source":case"link":Be("error",i),Be("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in l)if(l.hasOwnProperty(W)&&(u=l[W],u!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ke(i,r,W,u,l,null)}return;default:if(Hu(r)){for(G in l)l.hasOwnProperty(G)&&(u=l[G],u!==void 0&&Ch(i,r,G,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&Ke(i,r,w,u,l,null))}function U1(i,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,v=null,w=null,M=null,W=null,G=null;for(X in l){var ne=l[X];if(l.hasOwnProperty(X)&&ne!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":M=ne;default:u.hasOwnProperty(X)||Ke(i,r,X,null,u,ne)}}for(var K in u){var X=u[K];if(ne=l[K],u.hasOwnProperty(K)&&(X!=null||ne!=null))switch(K){case"type":m=X;break;case"name":d=X;break;case"checked":W=X;break;case"defaultChecked":G=X;break;case"value":v=X;break;case"defaultValue":w=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,r));break;default:X!==ne&&Ke(i,r,K,X,u,ne)}}Ou(i,v,w,M,W,G,m,d);return;case"select":X=v=w=K=null;for(m in l)if(M=l[m],l.hasOwnProperty(m)&&M!=null)switch(m){case"value":break;case"multiple":X=M;default:u.hasOwnProperty(m)||Ke(i,r,m,null,u,M)}for(d in u)if(m=u[d],M=l[d],u.hasOwnProperty(d)&&(m!=null||M!=null))switch(d){case"value":K=m;break;case"defaultValue":w=m;break;case"multiple":v=m;default:m!==M&&Ke(i,r,d,m,u,M)}r=w,l=v,u=X,K!=null?ss(i,!!l,K,!1):!!u!=!!l&&(r!=null?ss(i,!!l,r,!0):ss(i,!!l,l?[]:"",!1));return;case"textarea":X=K=null;for(w in l)if(d=l[w],l.hasOwnProperty(w)&&d!=null&&!u.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ke(i,r,w,null,u,d)}for(v in u)if(d=u[v],m=l[v],u.hasOwnProperty(v)&&(d!=null||m!=null))switch(v){case"value":K=d;break;case"defaultValue":X=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&Ke(i,r,v,d,u,m)}hp(i,K,X);return;case"option":for(var me in l)if(K=l[me],l.hasOwnProperty(me)&&K!=null&&!u.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:Ke(i,r,me,null,u,K)}for(M in u)if(K=u[M],X=l[M],u.hasOwnProperty(M)&&K!==X&&(K!=null||X!=null))switch(M){case"selected":i.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:Ke(i,r,M,K,u,X)}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 ye in l)K=l[ye],l.hasOwnProperty(ye)&&K!=null&&!u.hasOwnProperty(ye)&&Ke(i,r,ye,null,u,K);for(W in u)if(K=u[W],X=l[W],u.hasOwnProperty(W)&&K!==X&&(K!=null||X!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,r));break;default:Ke(i,r,W,K,u,X)}return;default:if(Hu(r)){for(var Xe in l)K=l[Xe],l.hasOwnProperty(Xe)&&K!==void 0&&!u.hasOwnProperty(Xe)&&Ch(i,r,Xe,void 0,u,K);for(G in u)K=u[G],X=l[G],!u.hasOwnProperty(G)||K===X||K===void 0&&X===void 0||Ch(i,r,G,K,u,X);return}}for(var U in l)K=l[U],l.hasOwnProperty(U)&&K!=null&&!u.hasOwnProperty(U)&&Ke(i,r,U,null,u,K);for(ne in u)K=u[ne],X=l[ne],!u.hasOwnProperty(ne)||K===X||K==null&&X==null||Ke(i,r,ne,K,u,X)}function mg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function P1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var d=l[u],m=d.transferSize,v=d.initiatorType,w=d.duration;if(m&&w&&mg(v)){for(v=0,w=d.responseEnd,u+=1;u<l.length;u++){var M=l[u],W=M.startTime;if(W>w)break;var G=M.transferSize,ne=M.initiatorType;G&&mg(ne)&&(M=M.responseEnd,v+=G*(M<w?1:(w-W)/(M-W)))}if(--u,r+=8*(m+v)/(d.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var kh=null,Eh=null;function Ro(i){return i.nodeType===9?i:i.ownerDocument}function _g(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function gg(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Th(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ah=null;function I1(){var i=window.event;return i&&i.type==="popstate"?i===Ah?!1:(Ah=i,!0):(Ah=null,!1)}var vg=typeof setTimeout=="function"?setTimeout:void 0,F1=typeof clearTimeout=="function"?clearTimeout:void 0,yg=typeof Promise=="function"?Promise:void 0,q1=typeof queueMicrotask=="function"?queueMicrotask:typeof yg<"u"?function(i){return yg.resolve(null).then(i).catch(W1)}:vg;function W1(i){setTimeout(function(){throw i})}function nr(i){return i==="head"}function bg(i,r){var l=r,u=0;do{var d=l.nextSibling;if(i.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(d),js(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ol(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Ol(l);for(var m=l.firstChild;m;){var v=m.nextSibling,w=m.nodeName;m[el]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=v}}else l==="body"&&Ol(i.ownerDocument.body);l=d}while(l);js(r)}function Sg(i,r){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function Dh(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Dh(l),Lu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function Y1(i,r,l,u){for(;i.nodeType===1;){var d=l;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[el])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Pi(i.nextSibling),i===null)break}return null}function V1(i,r,l){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Pi(i.nextSibling),i===null))return null;return i}function xg(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Pi(i.nextSibling),i===null))return null;return i}function Rh(i){return i.data==="$?"||i.data==="$~"}function Mh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function K1(i,r){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function Pi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Bh=null;function wg(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return Pi(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function Cg(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return i;r--}else l!=="/$"&&l!=="/&"||r++}i=i.previousSibling}return null}function kg(i,r,l){switch(r=Ro(l),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Ol(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Lu(i)}var Ii=new Map,Eg=new Set;function Mo(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Rn=j.d;j.d={f:X1,r:$1,D:G1,C:Z1,L:Q1,m:J1,X:tx,S:ex,M:ix};function X1(){var i=Rn.f(),r=xo();return i||r}function $1(i){var r=is(i);r!==null&&r.tag===5&&r.type==="form"?qm(r):Rn.r(i)}var Ls=typeof document>"u"?null:document;function Tg(i,r,l){var u=Ls;if(u&&typeof r=="string"&&r){var d=Ni(r);d='link[rel="'+i+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),Eg.has(d)||(Eg.add(d),i={rel:i,crossOrigin:l,href:r},u.querySelector(d)===null&&(r=u.createElement("link"),qt(r,"link",i),At(r),u.head.appendChild(r)))}}function G1(i){Rn.D(i),Tg("dns-prefetch",i,null)}function Z1(i,r){Rn.C(i,r),Tg("preconnect",i,r)}function Q1(i,r,l){Rn.L(i,r,l);var u=Ls;if(u&&i&&r){var d='link[rel="preload"][as="'+Ni(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Ni(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Ni(l.imageSizes)+'"]')):d+='[href="'+Ni(i)+'"]';var m=d;switch(r){case"style":m=zs(i);break;case"script":m=Os(i)}Ii.has(m)||(i=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),Ii.set(m,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(jl(m))||r==="script"&&u.querySelector(Hl(m))||(r=u.createElement("link"),qt(r,"link",i),At(r),u.head.appendChild(r)))}}function J1(i,r){Rn.m(i,r);var l=Ls;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+Ni(u)+'"][href="'+Ni(i)+'"]',m=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Os(i)}if(!Ii.has(m)&&(i=_({rel:"modulepreload",href:i},r),Ii.set(m,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Hl(m)))return}u=l.createElement("link"),qt(u,"link",i),At(u),l.head.appendChild(u)}}}function ex(i,r,l){Rn.S(i,r,l);var u=Ls;if(u&&i){var d=ns(u).hoistableStyles,m=zs(i);r=r||"default";var v=d.get(m);if(!v){var w={loading:0,preload:null};if(v=u.querySelector(jl(m)))w.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":r},l),(l=Ii.get(m))&&Nh(i,l);var M=v=u.createElement("link");At(M),qt(M,"link",i),M._p=new Promise(function(W,G){M.onload=W,M.onerror=G}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Bo(v,r,u)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(m,v)}}}function tx(i,r){Rn.X(i,r);var l=Ls;if(l&&i){var u=ns(l).hoistableScripts,d=Os(i),m=u.get(d);m||(m=l.querySelector(Hl(d)),m||(i=_({src:i,async:!0},r),(r=Ii.get(d))&&Lh(i,r),m=l.createElement("script"),At(m),qt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function ix(i,r){Rn.M(i,r);var l=Ls;if(l&&i){var u=ns(l).hoistableScripts,d=Os(i),m=u.get(d);m||(m=l.querySelector(Hl(d)),m||(i=_({src:i,async:!0,type:"module"},r),(r=Ii.get(d))&&Lh(i,r),m=l.createElement("script"),At(m),qt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function Ag(i,r,l,u){var d=(d=he.current)?Mo(d):null;if(!d)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=zs(l.href),l=ns(d).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=zs(l.href);var m=ns(d).hoistableStyles,v=m.get(i);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,v),(m=d.querySelector(jl(i)))&&!m._p&&(v.instance=m,v.state.loading=5),Ii.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ii.set(i,l),m||nx(d,i,l,v.state))),r&&u===null)throw Error(s(528,""));return v}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Os(l),l=ns(d).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function zs(i){return'href="'+Ni(i)+'"'}function jl(i){return'link[rel="stylesheet"]['+i+"]"}function Dg(i){return _({},i,{"data-precedence":i.precedence,precedence:null})}function nx(i,r,l,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),qt(r,"link",l),At(r),i.head.appendChild(r))}function Os(i){return'[src="'+Ni(i)+'"]'}function Hl(i){return"script[async]"+i}function Rg(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+Ni(l.href)+'"]');if(u)return r.instance=u,At(u),u;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),At(u),qt(u,"style",d),Bo(u,l.precedence,i),r.instance=u;case"stylesheet":d=zs(l.href);var m=i.querySelector(jl(d));if(m)return r.state.loading|=4,r.instance=m,At(m),m;u=Dg(l),(d=Ii.get(d))&&Nh(u,d),m=(i.ownerDocument||i).createElement("link"),At(m);var v=m;return v._p=new Promise(function(w,M){v.onload=w,v.onerror=M}),qt(m,"link",u),r.state.loading|=4,Bo(m,l.precedence,i),r.instance=m;case"script":return m=Os(l.src),(d=i.querySelector(Hl(m)))?(r.instance=d,At(d),d):(u=l,(d=Ii.get(m))&&(u=_({},l),Lh(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),At(d),qt(d,"link",u),i.head.appendChild(d),r.instance=d);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Bo(u,l.precedence,i));return r.instance}function Bo(i,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=u.length?u[u.length-1]:null,m=d,v=0;v<u.length;v++){var w=u[v];if(w.dataset.precedence===r)m=w;else if(m!==d)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(i,r.firstChild))}function Nh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Lh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var No=null;function Mg(i,r,l){if(No===null){var u=new Map,d=No=new Map;d.set(l,u)}else d=No,u=d.get(l),u||(u=new Map,d.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),d=0;d<l.length;d++){var m=l[d];if(!(m[el]||m[Ut]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var v=m.getAttribute(r)||"";v=i+v;var w=u.get(v);w?w.push(m):u.set(v,[m])}}return u}function Bg(i,r,l){i=i.ownerDocument||i,i.head.insertBefore(l,r==="title"?i.querySelector("head > title"):null)}function rx(i,r,l){if(l===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function Ng(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function sx(i,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=zs(u.href),m=r.querySelector(jl(d));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Lo.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,At(m);return}m=r.ownerDocument||r,u=Dg(u),(d=Ii.get(d))&&Nh(u,d),m=m.createElement("link"),At(m);var v=m;v._p=new Promise(function(w,M){v.onload=w,v.onerror=M}),qt(m,"link",u),l.instance=m}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=Lo.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var zh=0;function lx(i,r){return i.stylesheets&&i.count===0&&Oo(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&Oo(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&zh===0&&(zh=62500*P1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Oo(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>zh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oo(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var zo=null;function Oo(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,zo=new Map,r.forEach(ax,i),zo=null,Lo.call(i))}function ax(i,r){if(!(r.state.loading&4)){var l=zo.get(i);if(l)var u=l.get(null);else{l=new Map,zo.set(i,l);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var v=d[m];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(l.set(v.dataset.precedence,v),u=v)}u&&l.set(null,u)}d=r.instance,v=d.getAttribute("data-precedence"),m=l.get(v)||u,m===u&&l.set(null,d),l.set(v,d),this.count++,u=Lo.bind(this),d.addEventListener("load",u),d.addEventListener("error",u),m?m.parentNode.insertBefore(d,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),r.state.loading|=4}}var Ul={$$typeof:I,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function ox(i,r,l,u,d,m,v,w,M){this.tag=1,this.containerInfo=i,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=Ru(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ru(0),this.hiddenUpdates=Ru(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Lg(i,r,l,u,d,m,v,w,M,W,G,ne){return i=new ox(i,r,l,v,M,W,G,ne,w),r=1,m===!0&&(r|=24),m=xi(3,null,null,r),i.current=m,m.stateNode=i,r=pc(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},vc(m),i}function zg(i){return i?(i=ds,i):ds}function Og(i,r,l,u,d,m){d=zg(d),u.context===null?u.context=d:u.pendingContext=d,u=Vn(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=Kn(i,u,r),l!==null&&(mi(l,i,r),gl(l,i,r))}function jg(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Oh(i,r){jg(i,r),(i=i.alternate)&&jg(i,r)}function Hg(i){if(i.tag===13||i.tag===31){var r=Cr(i,67108864);r!==null&&mi(r,i,67108864),Oh(i,67108864)}}function Ug(i){if(i.tag===13||i.tag===31){var r=Ti();r=Mu(r);var l=Cr(i,r);l!==null&&mi(l,i,r),Oh(i,r)}}var jo=!0;function ux(i,r,l,u){var d=A.T;A.T=null;var m=j.p;try{j.p=2,jh(i,r,l,u)}finally{j.p=m,A.T=d}}function cx(i,r,l,u){var d=A.T;A.T=null;var m=j.p;try{j.p=8,jh(i,r,l,u)}finally{j.p=m,A.T=d}}function jh(i,r,l,u){if(jo){var d=Hh(u);if(d===null)wh(i,r,u,Ho,l),Ig(i,u);else if(fx(d,i,r,l,u))u.stopPropagation();else if(Ig(i,u),r&4&&-1<hx.indexOf(i)){for(;d!==null;){var m=is(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var v=yr(m.pendingLanes);if(v!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var M=1<<31-Ge(v);w.entanglements[1]|=M,v&=~M}nn(m),(Fe&6)===0&&(bo=Jt()+500,Nl(0))}}break;case 31:case 13:w=Cr(m,2),w!==null&&mi(w,m,2),xo(),Oh(m,2)}if(m=Hh(u),m===null&&wh(i,r,u,Ho,l),m===d)break;d=m}d!==null&&u.stopPropagation()}else wh(i,r,u,null,l)}}function Hh(i){return i=Pu(i),Uh(i)}var Ho=null;function Uh(i){if(Ho=null,i=ts(i),i!==null){var r=o(i);if(r===null)i=null;else{var l=r.tag;if(l===13){if(i=c(r),i!==null)return i;i=null}else if(l===31){if(i=f(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Ho=i,null}function Pg(i){switch(i){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(Du()){case Q:return 2;case ce:return 8;case xe:case Re:return 32;case qe:return 268435456;default:return 32}default:return 32}}var Ph=!1,rr=null,sr=null,lr=null,Pl=new Map,Il=new Map,ar=[],hx="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 Ig(i,r){switch(i){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":lr=null;break;case"pointerover":case"pointerout":Pl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(r.pointerId)}}function Fl(i,r,l,u,d,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:m,targetContainers:[d]},r!==null&&(r=is(r),r!==null&&Hg(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,d!==null&&r.indexOf(d)===-1&&r.push(d),i)}function fx(i,r,l,u,d){switch(r){case"focusin":return rr=Fl(rr,i,r,l,u,d),!0;case"dragenter":return sr=Fl(sr,i,r,l,u,d),!0;case"mouseover":return lr=Fl(lr,i,r,l,u,d),!0;case"pointerover":var m=d.pointerId;return Pl.set(m,Fl(Pl.get(m)||null,i,r,l,u,d)),!0;case"gotpointercapture":return m=d.pointerId,Il.set(m,Fl(Il.get(m)||null,i,r,l,u,d)),!0}return!1}function Fg(i){var r=ts(i.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){i.blockedOn=r,ip(i.priority,function(){Ug(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,ip(i.priority,function(){Ug(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Uo(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=Hh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Uu=u,l.target.dispatchEvent(u),Uu=null}else return r=is(l),r!==null&&Hg(r),i.blockedOn=l,!1;r.shift()}return!0}function qg(i,r,l){Uo(i)&&l.delete(r)}function dx(){Ph=!1,rr!==null&&Uo(rr)&&(rr=null),sr!==null&&Uo(sr)&&(sr=null),lr!==null&&Uo(lr)&&(lr=null),Pl.forEach(qg),Il.forEach(qg)}function Po(i,r){i.blockedOn===r&&(i.blockedOn=null,Ph||(Ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,dx)))}var Io=null;function Wg(i){Io!==i&&(Io=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Io===i&&(Io=null);for(var r=0;r<i.length;r+=3){var l=i[r],u=i[r+1],d=i[r+2];if(typeof u!="function"){if(Uh(u||l)===null)continue;break}var m=is(l);m!==null&&(i.splice(r,3),r-=3,Hc(m,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function js(i){function r(M){return Po(M,i)}rr!==null&&Po(rr,i),sr!==null&&Po(sr,i),lr!==null&&Po(lr,i),Pl.forEach(r),Il.forEach(r);for(var l=0;l<ar.length;l++){var u=ar[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<ar.length&&(l=ar[0],l.blockedOn===null);)Fg(l),l.blockedOn===null&&ar.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var d=l[u],m=l[u+1],v=d[ui]||null;if(typeof m=="function")v||Wg(l);else if(v){var w=null;if(m&&m.hasAttribute("formAction")){if(d=m,v=m[ui]||null)w=v.formAction;else if(Uh(d)!==null)continue}else w=v.action;typeof w=="function"?l[u+1]=w:(l.splice(u,3),u-=3),Wg(l)}}}function Yg(){function i(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function r(){d!==null&&(d(),d=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),d!==null&&(d(),d=null)}}}function Ih(i){this._internalRoot=i}Fo.prototype.render=Ih.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=Ti();Og(l,u,i,r,null,null)},Fo.prototype.unmount=Ih.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Og(i.current,2,null,i,null,null),xo(),r[es]=null}};function Fo(i){this._internalRoot=i}Fo.prototype.unstable_scheduleHydration=function(i){if(i){var r=tp();i={blockedOn:null,target:i,priority:r};for(var l=0;l<ar.length&&r!==0&&r<ar[l].priority;l++);ar.splice(l,0,i),l===0&&Fg(i)}};var Vg=t.version;if(Vg!=="19.2.3")throw Error(s(527,Vg,"19.2.3"));j.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var px={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qo.isDisabled&&qo.supportsFiber)try{ei=qo.inject(px),xt=qo}catch{}}return Wl.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",d=Jm,m=e_,v=t_;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError)),r=Lg(i,1,!1,null,null,l,u,null,d,m,v,Yg),i[es]=r.current,xh(i),new Ih(r)},Wl.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",m=Jm,v=e_,w=t_,M=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(M=l.formState)),r=Lg(i,1,!0,r,l??null,u,d,M,m,v,w,Yg),r.context=zg(null),l=r.current,u=Ti(),u=Mu(u),d=Vn(u),d.callback=null,Kn(l,d,u),l=u,r.current.lanes=l,Js(r,l),nn(r),i[es]=r.current,xh(i),new Fo(r)},Wl.version="19.2.3",Wl}var iv;function kx(){if(iv)return Wh.exports;iv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wh.exports=Cx(),Wh.exports}var Ex=kx();const Tx=gu(Ex);function Ax({onLogin:e}){const[t,n]=ie.useState(""),[s,a]=ie.useState(null),[o,c]=ie.useState(!1),f=async p=>{if(p.preventDefault(),!t.trim())return;c(!0),a(null);const h=await e(t);h&&a(h),c(!1)};return S.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:S.jsxs("div",{className:"w-full max-w-sm",children:[S.jsxs("div",{className:"border-border rounded border p-6",children:[S.jsxs("div",{className:"mb-6 text-center",children:[S.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),S.jsx("p",{className:"text-muted mt-1 text-xs",children:"local writer agent"})]}),S.jsxs("form",{onSubmit:f,className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),S.jsx("input",{type:"password",value:t,onChange:p=>n(p.target.value),placeholder:"enter your passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),s&&S.jsx("p",{className:"text-error text-xs",children:s}),S.jsx("button",{type:"submit",disabled:o||!t.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:o?"authenticating...":"unlock"})]})]}),S.jsx("p",{className:"text-muted mt-4 text-center text-[10px]",children:"enter your passphrase to unlock"})]})})}function Dx({onSetup:e}){const[t,n]=ie.useState(""),[s,a]=ie.useState(""),[o,c]=ie.useState(null),[f,p]=ie.useState(!1),h=async g=>{if(g.preventDefault(),!t.trim()||t.length<4){c("Passphrase must be at least 4 characters");return}if(t!==s){c("Passphrases do not match");return}p(!0),c(null);const _=await e(t);_&&c(_),p(!1)};return S.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:S.jsx("div",{className:"w-full max-w-sm",children:S.jsxs("div",{className:"border-border rounded border p-6",children:[S.jsxs("div",{className:"mb-6 text-center",children:[S.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),S.jsx("p",{className:"text-muted mt-1 text-xs",children:"first-time setup"})]}),S.jsx("p",{className:"text-muted mb-4 text-xs leading-relaxed",children:"Choose a passphrase to protect your local writer agent. This will be used to unlock the app and secure your OWS wallet."}),S.jsxs("form",{onSubmit:h,className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),S.jsx("input",{type:"password",value:t,onChange:g=>n(g.target.value),placeholder:"choose a passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Confirm"}),S.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"repeat passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),o&&S.jsx("p",{className:"text-error text-xs",children:o}),S.jsx("button",{type:"submit",disabled:f||!t.trim()||!s.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:f?"setting up...":"create passphrase"})]})]})})})}const nv="http://localhost:7777";function Qy({token:e}){const[t,n]=ie.useState(null),[s,a]=ie.useState(!1),[o,c]=ie.useState(!1),[f,p]=ie.useState(null),h=(x,E)=>fetch(x,{...E,headers:{...E==null?void 0:E.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=()=>{h(`${nv}/api/wallet`).then(x=>x.json()).then(x=>n(x)).catch(()=>n({exists:!1,error:"Failed to load wallet"}))};ie.useEffect(()=>{g()},[]);const _=async()=>{a(!0),p(null);try{const x=await h(`${nv}/api/wallet/create`,{method:"POST"}),E=await x.json();if(!x.ok)throw new Error(E.error||"Creation failed");g()}catch(x){p(x instanceof Error?x.message:"Failed to create wallet")}a(!1)},b=()=>{t!=null&&t.address&&(navigator.clipboard.writeText(t.address),c(!0),setTimeout(()=>c(!1),2e3))},y=x=>`${x.slice(0,6)}...${x.slice(-4)}`;return S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"OWS Wallet"}),!t&&S.jsx("p",{className:"text-muted text-xs",children:"loading..."}),t&&!t.exists&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"No wallet created yet. Create one to enable autonomous transactions."}),f&&S.jsx("p",{className:"text-error text-xs",children:f}),S.jsx("button",{onClick:_,disabled:s,className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 rounded border px-4 py-2 text-xs font-medium transition-colors",children:s?"creating...":"create wallet"})]}),t&&t.exists&&t.address&&S.jsxs("div",{className:"space-y-3",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"Address (Base)"}),S.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[9px] ${t.ethBalance&&parseFloat(t.ethBalance)>0?"border-accent/30 text-accent":"border-accent-dim/30 text-accent-dim"}`,children:t.ethBalance&&parseFloat(t.ethBalance)>0?"active":"no balance"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("code",{className:"text-foreground bg-surface rounded px-2 py-1 text-xs font-mono",children:y(t.address)}),S.jsx("button",{onClick:b,className:"text-muted hover:text-accent text-xs transition-colors",children:o?"copied":"copy"})]}),S.jsxs("div",{className:"border-border space-y-1 border-t pt-3",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"ETH"}),S.jsxs("span",{className:"text-foreground font-medium",children:[t.ethBalance||"0.000000"," ETH"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"USDC"}),S.jsxs("span",{className:"text-foreground font-medium",children:["$",t.usdcBalance||"0.00"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"PLOT"}),S.jsxs("span",{className:"text-foreground font-medium",children:[t.plotBalance||"0.0000"," PLOT"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Network"}),S.jsx("span",{className:"text-foreground",children:"Base"})]})]}),S.jsxs("div",{className:"border-border border-t pt-3",children:[S.jsx("p",{className:"text-muted mb-2 text-[10px] font-medium uppercase tracking-wider",children:"Fund Wallet"}),S.jsx("p",{className:"text-muted text-[10px]",children:"Send ETH on Base for gas (~$0.01 per publish):"}),S.jsx("code",{className:"text-foreground bg-surface mt-1 block break-all rounded px-2 py-1.5 text-[10px] font-mono",children:t.address})]})]})]})}function Rx({token:e,onLogout:t}){const[n,s]=ie.useState(""),[a,o]=ie.useState(""),[c,f]=ie.useState(null),[p,h]=ie.useState(!1),[g,_]=ie.useState(!1),[b,y]=ie.useState(null),[x,E]=ie.useState("AI Writer"),[L,R]=ie.useState(""),[$,I]=ie.useState(""),[Z,Y]=ie.useState(!1),[O,J]=ie.useState(null),[ae,de]=ie.useState(""),[F,le]=ie.useState(null),[H,T]=ie.useState(!1),[B,N]=ie.useState(null),[A,j]=ie.useState(null),P=ie.useCallback((C,ee)=>fetch(C,{...ee,headers:{...ee==null?void 0:ee.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);ie.useEffect(()=>{P("/api/settings/link-status").then(C=>C.json()).then(C=>y(C)).catch(()=>y({linked:!1}))},[]);const se=async()=>{if(!x.trim()){J("Agent name is required");return}if(!L.trim()){J("Description is required");return}Y(!0),J(null);try{const C=await P("/api/settings/register-agent",{method:"POST",body:JSON.stringify({name:x,description:L,...$.trim()&&{genre:$}})}),ee=await C.json();if(!C.ok)throw new Error(ee.error||"Registration failed");y({linked:!0,agentId:ee.agentId,owsWallet:ee.owsWallet,txHash:ee.txHash})}catch(C){J(C instanceof Error?C.message:"Registration failed")}Y(!1)},k=async()=>{if(!ae.trim()||!/^0x[a-fA-F0-9]{40}$/.test(ae)){N("Enter a valid wallet address (0x...)");return}T(!0),N(null),le(null);try{const C=await P("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:ae})}),ee=await C.json();if(!C.ok)throw new Error(ee.error||"Failed to generate binding code");le(ee)}catch(C){N(C instanceof Error?C.message:"Failed to generate binding code")}T(!1)},D=async(C,ee)=>{await navigator.clipboard.writeText(C),j(ee),setTimeout(()=>j(null),2e3)},V=async()=>{if(f(null),h(!1),!n||n.length<4){f("Passphrase must be at least 4 characters");return}if(n!==a){f("Passphrases do not match");return}_(!0);try{const C=await P("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!C.ok){const ee=await C.json();throw new Error(ee.error||"Reset failed")}h(!0),s(""),o(""),setTimeout(()=>h(!1),3e3)}catch(C){f(C instanceof Error?C.message:"Reset failed")}_(!1)};return S.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-6",children:[S.jsx("h2",{className:"text-accent text-lg font-bold",children:"Settings"}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Agent Identity"}),b!=null&&b.linked?S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-medium text-accent",children:"Registered"}),S.jsxs("span",{className:"text-muted text-xs",children:["Agent #",b.agentId]})]}),b.owsWallet&&S.jsxs("p",{className:"text-muted text-xs font-mono",children:["Wallet: ",b.owsWallet.slice(0,6),"...",b.owsWallet.slice(-4)]}),b.owner&&S.jsxs("p",{className:"text-muted text-xs font-mono",children:["Owner: ",b.owner.slice(0,6),"...",b.owner.slice(-4)]}),b.txHash&&S.jsx("p",{className:"text-muted text-xs",children:S.jsx("a",{href:`https://basescan.org/tx/${b.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View transaction on BaseScan"})}),S.jsx("p",{className:"text-muted text-xs",children:S.jsx("a",{href:`https://plotlink.xyz/profile/${b.owsWallet}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View agent profile on plotlink.xyz"})})]}):S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"Register this AI writer on-chain via ERC-8004. Uses your OWS wallet's existing ETH balance for gas."}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Name"}),S.jsx("input",{value:x,onChange:C=>E(C.target.value),placeholder:"AI Writer",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Description"}),S.jsx("input",{value:L,onChange:C=>R(C.target.value),placeholder:"An AI writing assistant for fiction stories",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Genre (optional)"}),S.jsx("input",{value:$,onChange:C=>I(C.target.value),placeholder:"e.g. Fiction, Sci-Fi, Fantasy",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),O&&S.jsx("p",{className:"text-error text-xs",children:O}),S.jsx("button",{onClick:se,disabled:Z||!x.trim()||!L.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:Z?"Registering...":"Register Agent Identity"})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Link to PlotLink"}),b!=null&&b.owner?S.jsxs("p",{className:"text-muted text-xs",children:["Linked to owner ",S.jsxs("span",{className:"font-mono",children:[b.owner.slice(0,6),"...",b.owner.slice(-4)]})]}):S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"Link this OWS wallet to your PlotLink account so your stories appear under your profile on plotlink.xyz."}),S.jsxs("div",{className:"text-muted text-xs space-y-1 pl-3",children:[S.jsx("p",{children:"1. Enter your PlotLink wallet address below"}),S.jsx("p",{children:'2. Click "Generate Binding Code"'}),S.jsx("p",{children:"3. Copy the code and paste it on plotlink.xyz → Agents → Link AI Writer"})]}),S.jsx("input",{value:ae,onChange:C=>de(C.target.value),placeholder:"Your PlotLink wallet address (0x...)",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent font-mono"}),B&&S.jsx("p",{className:"text-error text-xs",children:B}),S.jsx("button",{onClick:k,disabled:H||!ae.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:H?"Generating...":"Generate Binding Code"}),F&&S.jsxs("div",{className:"space-y-3 mt-3",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Binding Code (signature)"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:F.signature}),S.jsx("button",{onClick:()=>D(F.signature,"signature"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="signature"?"Copied!":"Copy"})]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"OWS Wallet Address"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:F.owsWallet}),S.jsx("button",{onClick:()=>D(F.owsWallet,"wallet"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="wallet"?"Copied!":"Copy"})]})]}),F.agentId&&S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Agent ID"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono text-foreground pr-16",children:F.agentId}),S.jsx("button",{onClick:()=>D(String(F.agentId),"agentId"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="agentId"?"Copied!":"Copy"})]})]}),S.jsx("p",{className:"text-xs text-accent",children:'Now go to plotlink.xyz/agents and paste the values in the "Link AI Writer" section.'})]})]})]}),S.jsx(Qy,{token:e}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Reset Passphrase"}),S.jsxs("div",{className:"space-y-3",children:[S.jsx("input",{type:"password",value:n,onChange:C=>s(C.target.value),placeholder:"new passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),S.jsx("input",{type:"password",value:a,onChange:C=>o(C.target.value),placeholder:"confirm passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),c&&S.jsx("p",{className:"text-error text-xs",children:c}),p&&S.jsx("p",{className:"text-xs text-accent",children:"passphrase updated"}),S.jsx("button",{onClick:V,disabled:g||!n.trim(),className:"border-border text-muted hover:border-accent hover:text-accent disabled:opacity-40 w-full rounded border px-4 py-2 text-xs font-medium transition-colors",children:g?"updating...":"update passphrase"})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Session"}),S.jsx("button",{onClick:t,className:"border-border text-muted hover:border-error hover:text-error rounded border px-4 py-2 text-xs font-medium transition-colors",children:"logout"})]})]})}const Mx="http://localhost:7777";function Bx({token:e}){const[t,n]=ie.useState(null),s=(f,p)=>fetch(f,{...p,headers:{...p==null?void 0:p.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),a=()=>{s(`${Mx}/api/dashboard`).then(f=>f.json()).then(n)};ie.useEffect(()=>{a()},[]);const o=f=>`${f.slice(0,6)}...${f.slice(-4)}`,c=f=>{if(!f)return"Unknown date";const p=new Date(f);return isNaN(p.getTime())?"Unknown date":p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})};return t?S.jsxs("div",{className:"mx-auto max-w-2xl space-y-6 p-6",children:[S.jsx("h2",{className:"text-accent text-lg font-bold",children:"Writer Dashboard"}),S.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-accent text-lg font-bold",children:t.stories.totalPublished}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"published"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.pendingFiles}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"pending"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalStories}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"stories"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalFiles}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"files"})]})]}),t.wallet&&S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Wallet"}),S.jsxs("div",{className:"space-y-1.5",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Address"}),S.jsx("code",{className:"text-foreground font-mono text-[10px]",children:o(t.wallet.address)})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"ETH Balance"}),S.jsxs("span",{className:"text-foreground",children:[t.wallet.ethFormatted," ETH"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"USDC Balance"}),S.jsxs("span",{className:"text-foreground",children:["$",t.wallet.usdcBalance]})]})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Profit & Loss"}),S.jsxs("div",{className:"space-y-1.5",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Total costs (gas)"}),S.jsxs("span",{className:"text-error",children:["-",t.pnl.totalCostsEth," ETH (~$",t.pnl.totalCostsUsd,")"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Royalties earned"}),S.jsxs("span",{className:"text-accent",children:["+",t.pnl.totalRoyaltiesPlot," PLOT"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Unclaimed royalties"}),S.jsxs("span",{className:"text-foreground",children:[t.royalties.unclaimed," PLOT"]})]}),S.jsxs("div",{className:"border-border flex justify-between border-t pt-1.5 text-xs font-medium",children:[S.jsx("span",{className:"text-muted",children:"Net P&L (USD)"}),S.jsxs("span",{className:parseFloat(t.pnl.netPnlUsd)>=0?"text-accent":"text-error",children:[parseFloat(t.pnl.netPnlUsd)>=0?"+":"","$",t.pnl.netPnlUsd]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Stories published"}),S.jsx("span",{className:"text-foreground",children:t.costs.storiesPublished})]})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Published Stories"}),t.stories.published.length===0?S.jsx("p",{className:"text-muted text-xs",children:"no published stories yet"}):S.jsx("div",{className:"space-y-3",children:t.stories.published.map(f=>S.jsxs("div",{className:"bg-surface rounded border border-border p-4",children:[S.jsxs("div",{className:"flex items-start justify-between",children:[S.jsxs("div",{children:[f.genre&&S.jsx("span",{className:"bg-accent/10 text-accent rounded px-2 py-0.5 text-[10px] font-medium",children:f.genre}),S.jsx("h4",{className:"text-foreground mt-1 text-sm font-serif font-medium",children:f.title}),S.jsx("p",{className:"text-muted mt-0.5 text-[10px] font-mono",children:f.storyName})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[f.hasNotIndexed&&S.jsx("span",{className:"rounded border border-amber-600/30 px-1.5 py-0.5 text-[9px] text-amber-700",children:"not indexed"}),S.jsxs("span",{className:"rounded border border-green-700/30 px-1.5 py-0.5 text-[9px] text-green-700",children:[f.publishedFiles," published"]})]})]}),S.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2 text-center",children:[S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium",children:f.plotCount}),S.jsx("div",{className:"text-muted text-[9px]",children:"Plots"})]}),S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium font-mono",children:f.storylineId?`#${f.storylineId}`:"—"}),S.jsx("div",{className:"text-muted text-[9px]",children:"Storyline"})]}),S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium",children:f.totalGasCostEth??"—"}),S.jsx("div",{className:"text-muted text-[9px]",children:"Gas (ETH)"})]})]}),S.jsx("div",{className:"mt-2 space-y-1",children:f.files.map(p=>S.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("span",{className:p.status==="published-not-indexed"?"text-amber-700":"text-green-700",children:p.status==="published-not-indexed"?"⚠":"✓"}),S.jsx("span",{className:"text-muted font-mono",children:p.file})]}),p.txHash&&S.jsxs("a",{href:`https://basescan.org/tx/${p.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-accent font-mono",children:["tx:",p.txHash.slice(0,8),"..."]})]},p.file))}),S.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px]",children:[S.jsx("span",{className:"text-muted",children:c(f.latestPublishedAt)}),f.storylineId&&S.jsx("a",{href:`https://plotlink.xyz/story/${f.storylineId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"})]})]},f.id))})]}),t.stories.pendingFiles>0&&S.jsx("div",{className:"border-border rounded border p-4",children:S.jsxs("p",{className:"text-muted text-xs",children:[t.stories.pendingFiles," file(s) pending publish — go to Stories to publish them."]})})]}):S.jsx("div",{className:"flex h-full items-center justify-center",children:S.jsx("span",{className:"text-muted text-sm",children:"loading dashboard..."})})}const Nx={published:"✓","published-not-indexed":"⚠",pending:"⏳",draft:"📝"},Lx={published:"text-green-700","published-not-indexed":"text-amber-700",pending:"text-amber-700",draft:"text-muted"};function zx({authFetch:e,selectedStory:t,selectedFile:n,onSelectFile:s,onNewStory:a,untitledSessions:o=[]}){const[c,f]=ie.useState([]),[p,h]=ie.useState([]),[g,_]=ie.useState(new Set),[b,y]=ie.useState(!1),x=ie.useCallback(async()=>{try{const Y=await e("/api/stories");if(Y.ok){const O=await Y.json();f(O.stories)}}catch{}},[e]),E=ie.useCallback(async()=>{try{const Y=await e("/api/stories/archived");if(Y.ok){const O=await Y.json();h(O.stories)}}catch{}},[e]),L=ie.useCallback(async Y=>{try{(await e("/api/stories/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y})})).ok&&(E(),x())}catch{}},[e,E,x]);ie.useEffect(()=>{x();const Y=setInterval(x,5e3);return()=>clearInterval(Y)},[x]),ie.useEffect(()=>{b&&E()},[b,E]),ie.useEffect(()=>{t&&_(Y=>new Set(Y).add(t))},[t]);const R=Y=>{var J;const O=Y.map(ae=>{var de;return{file:ae.file,num:(de=ae.file.match(/^plot-(\d+)\.md$/))==null?void 0:de[1]}}).filter(ae=>ae.num!=null).sort((ae,de)=>parseInt(de.num)-parseInt(ae.num));return O.length>0?O[0].file:Y.some(ae=>ae.file==="genesis.md")?"genesis.md":Y.some(ae=>ae.file==="structure.md")?"structure.md":((J=Y[0])==null?void 0:J.file)??null},$=Y=>{_(O=>{const J=new Set(O);return J.has(Y)?J.delete(Y):J.add(Y),J})},I=Y=>{if($(Y.name),!g.has(Y.name)){const O=R(Y.files);O&&s(Y.name,O)}},Z=Y=>{const O=J=>{if(J==="structure.md")return 0;if(J==="genesis.md")return 1;const ae=J.match(/^plot-(\d+)\.md$/);return ae?2+parseInt(ae[1]):100};return[...Y].sort((J,ae)=>O(J.file)-O(ae.file))};return b?S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs font-mono text-muted",children:"Archives"}),S.jsx("span",{className:"text-xs text-muted",children:p.length})]}),S.jsx("div",{className:"px-3 py-2 border-b border-border",children:S.jsxs("button",{onClick:()=>y(!1),className:"w-full px-3 py-1.5 text-sm text-muted hover:text-foreground hover:bg-surface rounded flex items-center gap-1.5",children:[S.jsx("span",{children:"←"}),S.jsx("span",{children:"Back"})]})}),S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:p.length===0?S.jsx("div",{className:"p-3 text-sm text-muted",children:S.jsx("p",{children:"No archived stories."})}):p.map(Y=>S.jsxs("div",{className:"px-3 py-2 flex items-center justify-between hover:bg-surface",children:[S.jsx("span",{className:"text-sm font-medium truncate",title:Y.name,children:Y.title||Y.name}),S.jsx("button",{onClick:()=>L(Y.name),className:"text-xs text-accent hover:text-accent-dim flex-shrink-0 ml-2",children:"Restore"})]},Y.name))})]}):S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs font-mono text-muted",children:"Stories"}),S.jsx("span",{className:"text-xs text-muted",children:c.length})]}),a&&S.jsx("div",{className:"px-3 py-2 border-b border-border",children:S.jsxs("button",{onClick:a,className:"w-full px-3 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent-dim flex items-center justify-center gap-1.5",children:[S.jsx("span",{children:"+"}),S.jsx("span",{children:"New Story"})]})}),S.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[o.map(Y=>S.jsx("div",{children:S.jsxs("button",{onClick:()=>s(Y,""),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm ${t===Y?"bg-surface":""}`,children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-600 flex-shrink-0"}),S.jsx("span",{className:"font-medium italic text-muted",children:"Untitled"})]})},Y)),c.length===0&&o.length===0?S.jsxs("div",{className:"p-3 text-sm text-muted",children:[S.jsx("p",{children:"No stories yet."}),S.jsx("p",{className:"mt-1 text-xs",children:'Click "+ New Story" above to start writing.'})]}):c.filter(Y=>Y.name!=="_example").map(Y=>S.jsxs("div",{children:[S.jsxs("button",{onClick:()=>I(Y),className:"w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm",children:[S.jsx("span",{className:"text-xs text-muted",children:g.has(Y.name)?"▼":"▶"}),S.jsx("span",{className:"font-medium truncate",title:Y.name,children:Y.title||Y.name}),S.jsxs("span",{className:"ml-auto text-xs text-muted",children:[Y.publishedCount,"/",Y.files.length]})]}),g.has(Y.name)&&S.jsx("div",{className:"pl-4",children:Z(Y.files).map(O=>{const J=t===Y.name&&n===O.file;return S.jsxs("button",{onClick:()=>s(Y.name,O.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${J?"bg-surface font-medium":""}`,children:[S.jsx("span",{className:Lx[O.status],children:Nx[O.status]}),S.jsx("span",{className:"truncate font-mono",children:O.file})]},O.file)})})]},Y.name))]}),S.jsx("div",{className:"px-3 py-2 border-t border-border",children:S.jsx("button",{onClick:()=>y(!0),className:"w-full px-3 py-1.5 text-xs text-muted hover:text-foreground hover:bg-surface rounded flex items-center justify-center gap-1.5",children:S.jsx("span",{children:"Archives"})})})]})}/**
48
+ `+u.stack}}var Qr=Object.prototype.hasOwnProperty,Jr=e.unstable_scheduleCallback,Zs=e.unstable_cancelCallback,Tu=e.unstable_shouldYield,Au=e.unstable_requestPaint,Jt=e.unstable_now,Du=e.unstable_getCurrentPriorityLevel,ee=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,xe=e.unstable_NormalPriority,Me=e.unstable_LowPriority,We=e.unstable_IdlePriority,bi=e.log,fn=e.unstable_setDisableYieldValue,ei=null,Ct=null;function oi(i){if(typeof bi=="function"&&fn(i),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(ei,i)}catch{}}var Qe=Math.clz32?Math.clz32:r0,Hn=Math.log,Ki=Math.LN2;function r0(i){return i>>>=0,i===0?32:31-(Hn(i)/Ki|0)|0}var Ta=256,Aa=262144,Da=4194304;function yr(i){var r=i&42;if(r!==0)return r;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Ra(i,r,l){var u=i.pendingLanes;if(u===0)return 0;var d=0,m=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var C=u&134217727;return C!==0?(u=C&~m,u!==0?d=yr(u):(v&=C,v!==0?d=yr(v):l||(l=C&~i,l!==0&&(d=yr(l))))):(C=u&~m,C!==0?d=yr(C):v!==0?d=yr(v):l||(l=u&~i,l!==0&&(d=yr(l)))),d===0?0:r!==0&&r!==d&&(r&m)===0&&(m=d&-d,l=r&-r,m>=l||m===32&&(l&4194048)!==0)?r:d}function Qs(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function s0(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Jd(){var i=Da;return Da<<=1,(Da&62914560)===0&&(Da=4194304),i}function Ru(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function Js(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function l0(i,r,l,u,d,m){var v=i.pendingLanes;i.pendingLanes=l,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=l,i.entangledLanes&=l,i.errorRecoveryDisabledLanes&=l,i.shellSuspendCounter=0;var C=i.entanglements,M=i.expirationTimes,W=i.hiddenUpdates;for(l=v&~l;0<l;){var G=31-Qe(l),ne=1<<G;C[G]=0,M[G]=-1;var K=W[G];if(K!==null)for(W[G]=null,G=0;G<K.length;G++){var X=K[G];X!==null&&(X.lane&=-536870913)}l&=~ne}u!==0&&ep(i,u,0),m!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=m&~(v&~r))}function ep(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-Qe(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function tp(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-Qe(l),d=1<<u;d&r|i[u]&r&&(i[u]|=r),l&=~d}}function ip(i,r){var l=r&-r;return l=(l&42)!==0?1:Mu(l),(l&(i.suspendedLanes|r))!==0?0:l}function Mu(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Bu(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function np(){var i=j.p;return i!==0?i:(i=window.event,i===void 0?32:Fg(i.type))}function rp(i,r){var l=j.p;try{return j.p=i,r()}finally{j.p=l}}var Un=Math.random().toString(36).slice(2),Pt="__reactFiber$"+Un,ui="__reactProps$"+Un,es="__reactContainer$"+Un,Nu="__reactEvents$"+Un,a0="__reactListeners$"+Un,o0="__reactHandles$"+Un,sp="__reactResources$"+Un,el="__reactMarker$"+Un;function Lu(i){delete i[Pt],delete i[ui],delete i[Nu],delete i[a0],delete i[o0]}function ts(i){var r=i[Pt];if(r)return r;for(var l=i.parentNode;l;){if(r=l[es]||l[Pt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=Eg(i);i!==null;){if(l=i[Pt])return l;i=Eg(i)}return r}i=l,l=i.parentNode}return null}function is(i){if(i=i[Pt]||i[es]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function tl(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function ns(i){var r=i[sp];return r||(r=i[sp]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Rt(i){i[el]=!0}var lp=new Set,ap={};function br(i,r){rs(i,r),rs(i+"Capture",r)}function rs(i,r){for(ap[i]=r,i=0;i<r.length;i++)lp.add(r[i])}var u0=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]*$"),op={},up={};function c0(i){return Qr.call(up,i)?!0:Qr.call(op,i)?!1:u0.test(i)?up[i]=!0:(op[i]=!0,!1)}function Ma(i,r,l){if(c0(r))if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+l)}}function Ba(i,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+l)}}function dn(i,r,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttributeNS(r,l,""+u)}}function Bi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function cp(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function h0(i,r,l){var u=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var d=u.get,m=u.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return d.call(this)},set:function(v){l=""+v,m.call(this,v)}}),Object.defineProperty(i,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function zu(i){if(!i._valueTracker){var r=cp(i)?"checked":"value";i._valueTracker=h0(i,r,""+i[r])}}function hp(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=cp(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Na(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var f0=/[\n"\\]/g;function Ni(i){return i.replace(f0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ou(i,r,l,u,d,m,v,C){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),r!=null?v==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Bi(r)):i.value!==""+Bi(r)&&(i.value=""+Bi(r)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),r!=null?ju(i,v,Bi(r)):l!=null?ju(i,v,Bi(l)):u!=null&&i.removeAttribute("value"),d==null&&m!=null&&(i.defaultChecked=!!m),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?i.name=""+Bi(C):i.removeAttribute("name")}function fp(i,r,l,u,d,m,v,C){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||l!=null){if(!(m!=="submit"&&m!=="reset"||r!=null)){zu(i);return}l=l!=null?""+Bi(l):"",r=r!=null?""+Bi(r):l,C||r===i.value||(i.value=r),i.defaultValue=r}u=u??d,u=typeof u!="function"&&typeof u!="symbol"&&!!u,i.checked=C?i.checked:!!u,i.defaultChecked=!!u,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),zu(i)}function ju(i,r,l){r==="number"&&Na(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function ss(i,r,l,u){if(i=i.options,r){r={};for(var d=0;d<l.length;d++)r["$"+l[d]]=!0;for(l=0;l<i.length;l++)d=r.hasOwnProperty("$"+i[l].value),i[l].selected!==d&&(i[l].selected=d),d&&u&&(i[l].defaultSelected=!0)}else{for(l=""+Bi(l),r=null,d=0;d<i.length;d++){if(i[d].value===l){i[d].selected=!0,u&&(i[d].defaultSelected=!0);return}r!==null||i[d].disabled||(r=i[d])}r!==null&&(r.selected=!0)}}function dp(i,r,l){if(r!=null&&(r=""+Bi(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Bi(l):""}function pp(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(N(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Bi(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),zu(i)}function ls(i,r){if(r){var l=i.firstChild;if(l&&l===i.lastChild&&l.nodeType===3){l.nodeValue=r;return}}i.textContent=r}var d0=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 mp(i,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":u?i.setProperty(r,l):typeof l!="number"||l===0||d0.has(r)?r==="float"?i.cssFloat=l:i[r]=(""+l).trim():i[r]=l+"px"}function _p(i,r,l){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?i.setProperty(u,""):u==="float"?i.cssFloat="":i[u]="");for(var d in r)u=r[d],r.hasOwnProperty(d)&&l[d]!==u&&mp(i,d,u)}else for(var m in r)r.hasOwnProperty(m)&&mp(i,m,r[m])}function Hu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 p0=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"]]),m0=/^[\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 La(i){return m0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function pn(){}var Uu=null;function Pu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var as=null,os=null;function gp(i){var r=is(i);if(r&&(i=r.stateNode)){var l=i[ui]||null;e:switch(i=r.stateNode,r.type){case"input":if(Ou(i,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=i;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ni(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[ui]||null;if(!d)throw Error(s(90));Ou(u,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===i.form&&hp(u)}break e;case"textarea":dp(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&ss(i,!!l.multiple,r,!1)}}}var Iu=!1;function vp(i,r,l){if(Iu)return i(r,l);Iu=!0;try{var u=i(r);return u}finally{if(Iu=!1,(as!==null||os!==null)&&(xo(),as&&(r=as,i=os,os=as=null,gp(r),i)))for(r=0;r<i.length;r++)gp(i[r])}}function il(i,r){var l=i.stateNode;if(l===null)return null;var u=l[ui]||null;if(u===null)return null;l=u[r];e:switch(r){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)||(i=i.type,u=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!u;break e;default:i=!1}if(i)return null;if(l&&typeof l!="function")throw Error(s(231,r,typeof l));return l}var mn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(mn)try{var nl={};Object.defineProperty(nl,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",nl,nl),window.removeEventListener("test",nl,nl)}catch{Fu=!1}var Pn=null,qu=null,za=null;function yp(){if(za)return za;var i,r=qu,l=r.length,u,d="value"in Pn?Pn.value:Pn.textContent,m=d.length;for(i=0;i<l&&r[i]===d[i];i++);var v=l-i;for(u=1;u<=v&&r[l-u]===d[m-u];u++);return za=d.slice(i,1<u?1-u:void 0)}function Oa(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function ja(){return!0}function bp(){return!1}function ci(i){function r(l,u,d,m,v){this._reactName=l,this._targetInst=d,this.type=u,this.nativeEvent=m,this.target=v,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(l=i[C],this[C]=l?l(m):m[C]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ja:bp,this.isPropagationStopped=bp,this}return _(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ja)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ja)},persist:function(){},isPersistent:ja}),r}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ha=ci(Sr),rl=_({},Sr,{view:0,detail:0}),_0=ci(rl),Wu,Yu,sl,Ua=_({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==sl&&(sl&&i.type==="mousemove"?(Wu=i.screenX-sl.screenX,Yu=i.screenY-sl.screenY):Yu=Wu=0,sl=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),Sp=ci(Ua),g0=_({},Ua,{dataTransfer:0}),v0=ci(g0),y0=_({},rl,{relatedTarget:0}),Vu=ci(y0),b0=_({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),S0=ci(b0),x0=_({},Sr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),w0=ci(x0),C0=_({},Sr,{data:0}),xp=ci(C0),k0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E0={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"},T0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function A0(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=T0[i])?!!r[i]:!1}function Ku(){return A0}var D0=_({},rl,{key:function(i){if(i.key){var r=k0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Oa(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?E0[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(i){return i.type==="keypress"?Oa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Oa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),R0=ci(D0),M0=_({},Ua,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wp=ci(M0),B0=_({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),N0=ci(B0),L0=_({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=ci(L0),O0=_({},Ua,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),j0=ci(O0),H0=_({},Sr,{newState:0,oldState:0}),U0=ci(H0),P0=[9,13,27,32],Xu=mn&&"CompositionEvent"in window,ll=null;mn&&"documentMode"in document&&(ll=document.documentMode);var I0=mn&&"TextEvent"in window&&!ll,Cp=mn&&(!Xu||ll&&8<ll&&11>=ll),kp=" ",Ep=!1;function Tp(i,r){switch(i){case"keyup":return P0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ap(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var us=!1;function F0(i,r){switch(i){case"compositionend":return Ap(r);case"keypress":return r.which!==32?null:(Ep=!0,kp);case"textInput":return i=r.data,i===kp&&Ep?null:i;default:return null}}function q0(i,r){if(us)return i==="compositionend"||!Xu&&Tp(i,r)?(i=yp(),za=qu=Pn=null,us=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Cp&&r.locale!=="ko"?null:r.data;default:return null}}var W0={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 Dp(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!W0[i.type]:r==="textarea"}function Rp(i,r,l,u){as?os?os.push(u):os=[u]:as=u,r=Do(r,"onChange"),0<r.length&&(l=new Ha("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var al=null,ol=null;function Y0(i){fg(i,0)}function Pa(i){var r=tl(i);if(hp(r))return i}function Mp(i,r){if(i==="change")return r}var Bp=!1;if(mn){var $u;if(mn){var Gu="oninput"in document;if(!Gu){var Np=document.createElement("div");Np.setAttribute("oninput","return;"),Gu=typeof Np.oninput=="function"}$u=Gu}else $u=!1;Bp=$u&&(!document.documentMode||9<document.documentMode)}function Lp(){al&&(al.detachEvent("onpropertychange",zp),ol=al=null)}function zp(i){if(i.propertyName==="value"&&Pa(ol)){var r=[];Rp(r,ol,i,Pu(i)),vp(Y0,r)}}function V0(i,r,l){i==="focusin"?(Lp(),al=r,ol=l,al.attachEvent("onpropertychange",zp)):i==="focusout"&&Lp()}function K0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Pa(ol)}function X0(i,r){if(i==="click")return Pa(r)}function $0(i,r){if(i==="input"||i==="change")return Pa(r)}function G0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Si=typeof Object.is=="function"?Object.is:G0;function ul(i,r){if(Si(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var l=Object.keys(i),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var d=l[u];if(!Qr.call(r,d)||!Si(i[d],r[d]))return!1}return!0}function Op(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function jp(i,r){var l=Op(i);i=0;for(var u;l;){if(l.nodeType===3){if(u=i+l.textContent.length,i<=r&&u>=r)return{node:l,offset:r-i};i=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Op(l)}}function Hp(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Hp(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Up(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Na(i.document);r instanceof i.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)i=r.contentWindow;else break;r=Na(i.document)}return r}function Zu(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var Z0=mn&&"documentMode"in document&&11>=document.documentMode,cs=null,Qu=null,cl=null,Ju=!1;function Pp(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ju||cs==null||cs!==Na(u)||(u=cs,"selectionStart"in u&&Zu(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}),cl&&ul(cl,u)||(cl=u,u=Do(Qu,"onSelect"),0<u.length&&(r=new Ha("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=cs)))}function xr(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var hs={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionrun:xr("Transition","TransitionRun"),transitionstart:xr("Transition","TransitionStart"),transitioncancel:xr("Transition","TransitionCancel"),transitionend:xr("Transition","TransitionEnd")},ec={},Ip={};mn&&(Ip=document.createElement("div").style,"AnimationEvent"in window||(delete hs.animationend.animation,delete hs.animationiteration.animation,delete hs.animationstart.animation),"TransitionEvent"in window||delete hs.transitionend.transition);function wr(i){if(ec[i])return ec[i];if(!hs[i])return i;var r=hs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in Ip)return ec[i]=r[l];return i}var Fp=wr("animationend"),qp=wr("animationiteration"),Wp=wr("animationstart"),Q0=wr("transitionrun"),J0=wr("transitionstart"),e1=wr("transitioncancel"),Yp=wr("transitionend"),Vp=new Map,tc="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(" ");tc.push("scrollEnd");function Xi(i,r){Vp.set(i,r),br(r,[i])}var Ia=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Li=[],fs=0,ic=0;function Fa(){for(var i=fs,r=ic=fs=0;r<i;){var l=Li[r];Li[r++]=null;var u=Li[r];Li[r++]=null;var d=Li[r];Li[r++]=null;var m=Li[r];if(Li[r++]=null,u!==null&&d!==null){var v=u.pending;v===null?d.next=d:(d.next=v.next,v.next=d),u.pending=d}m!==0&&Kp(l,d,m)}}function qa(i,r,l,u){Li[fs++]=i,Li[fs++]=r,Li[fs++]=l,Li[fs++]=u,ic|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function nc(i,r,l,u){return qa(i,r,l,u),Wa(i)}function Cr(i,r){return qa(i,null,null,r),Wa(i)}function Kp(i,r,l){i.lanes|=l;var u=i.alternate;u!==null&&(u.lanes|=l);for(var d=!1,m=i.return;m!==null;)m.childLanes|=l,u=m.alternate,u!==null&&(u.childLanes|=l),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(d=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,d&&r!==null&&(d=31-Qe(l),i=m.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),m):null}function Wa(i){if(50<Bl)throw Bl=0,fh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var ds={};function t1(i,r,l,u){this.tag=i,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,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 xi(i,r,l,u){return new t1(i,r,l,u)}function rc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function _n(i,r){var l=i.alternate;return l===null?(l=xi(i.tag,r,i.key,i.mode),l.elementType=i.elementType,l.type=i.type,l.stateNode=i.stateNode,l.alternate=i,i.alternate=l):(l.pendingProps=r,l.type=i.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=i.flags&65011712,l.childLanes=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,r=i.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=i.sibling,l.index=i.index,l.ref=i.ref,l.refCleanup=i.refCleanup,l}function Xp(i,r){i.flags&=65011714;var l=i.alternate;return l===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=l.childLanes,i.lanes=l.lanes,i.child=l.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=l.memoizedProps,i.memoizedState=l.memoizedState,i.updateQueue=l.updateQueue,i.type=l.type,r=l.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Ya(i,r,l,u,d,m){var v=0;if(u=i,typeof i=="function")rc(i)&&(v=1);else if(typeof i=="string")v=lx(i,l,ie.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case pe:return i=xi(31,l,r,d),i.elementType=pe,i.lanes=m,i;case k:return kr(l.children,d,m,r);case L:v=8,d|=24;break;case R:return i=xi(12,l,r,d|2),i.elementType=R,i.lanes=m,i;case Y:return i=xi(13,l,r,d),i.elementType=Y,i.lanes=m,i;case O:return i=xi(19,l,r,d),i.elementType=O,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case I:v=10;break e;case $:v=9;break e;case Z:v=11;break e;case J:v=14;break e;case ce:v=16,u=null;break e}v=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=xi(v,l,r,d),r.elementType=i,r.type=u,r.lanes=m,r}function kr(i,r,l,u){return i=xi(7,i,u,r),i.lanes=l,i}function sc(i,r,l){return i=xi(6,i,null,r),i.lanes=l,i}function $p(i){var r=xi(18,null,null,0);return r.stateNode=i,r}function lc(i,r,l){return r=xi(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Gp=new WeakMap;function zi(i,r){if(typeof i=="object"&&i!==null){var l=Gp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:Ea(r)},Gp.set(i,r),r)}return{value:i,source:r,stack:Ea(r)}}var ps=[],ms=0,Va=null,hl=0,Oi=[],ji=0,In=null,Ji=1,en="";function gn(i,r){ps[ms++]=hl,ps[ms++]=Va,Va=i,hl=r}function Zp(i,r,l){Oi[ji++]=Ji,Oi[ji++]=en,Oi[ji++]=In,In=i;var u=Ji;i=en;var d=32-Qe(u)-1;u&=~(1<<d),l+=1;var m=32-Qe(r)+d;if(30<m){var v=d-d%5;m=(u&(1<<v)-1).toString(32),u>>=v,d-=v,Ji=1<<32-Qe(r)+d|l<<d|u,en=m+i}else Ji=1<<m|l<<d|u,en=i}function ac(i){i.return!==null&&(gn(i,1),Zp(i,1,0))}function oc(i){for(;i===Va;)Va=ps[--ms],ps[ms]=null,hl=ps[--ms],ps[ms]=null;for(;i===In;)In=Oi[--ji],Oi[ji]=null,en=Oi[--ji],Oi[ji]=null,Ji=Oi[--ji],Oi[ji]=null}function Qp(i,r){Oi[ji++]=Ji,Oi[ji++]=en,Oi[ji++]=In,Ji=r.id,en=r.overflow,In=i}var It=null,it=null,je=!1,Fn=null,Hi=!1,uc=Error(s(519));function qn(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw fl(zi(r,i)),uc}function Jp(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[Pt]=i,r[ui]=u,l){case"dialog":Ne("cancel",r),Ne("close",r);break;case"iframe":case"object":case"embed":Ne("load",r);break;case"video":case"audio":for(l=0;l<Ll.length;l++)Ne(Ll[l],r);break;case"source":Ne("error",r);break;case"img":case"image":case"link":Ne("error",r),Ne("load",r);break;case"details":Ne("toggle",r);break;case"input":Ne("invalid",r),fp(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ne("invalid",r);break;case"textarea":Ne("invalid",r),pp(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||_g(r.textContent,l)?(u.popover!=null&&(Ne("beforetoggle",r),Ne("toggle",r)),u.onScroll!=null&&Ne("scroll",r),u.onScrollEnd!=null&&Ne("scrollend",r),u.onClick!=null&&(r.onclick=pn),r=!0):r=!1,r||qn(i,!0)}function em(i){for(It=i.return;It;)switch(It.tag){case 5:case 31:case 13:Hi=!1;return;case 27:case 3:Hi=!0;return;default:It=It.return}}function _s(i){if(i!==It)return!1;if(!je)return em(i),je=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Th(i.type,i.memoizedProps)),l=!l),l&&it&&qn(i),em(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));it=kg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));it=kg(i)}else r===27?(r=it,nr(i.type)?(i=Bh,Bh=null,it=i):it=r):it=It?Pi(i.stateNode.nextSibling):null;return!0}function Er(){it=It=null,je=!1}function cc(){var i=Fn;return i!==null&&(pi===null?pi=i:pi.push.apply(pi,i),Fn=null),i}function fl(i){Fn===null?Fn=[i]:Fn.push(i)}var hc=D(null),Tr=null,vn=null;function Wn(i,r,l){w(hc,r._currentValue),r._currentValue=l}function yn(i){i._currentValue=hc.current,V(hc)}function fc(i,r,l){for(;i!==null;){var u=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),i===l)break;i=i.return}}function dc(i,r,l,u){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var m=d.dependencies;if(m!==null){var v=d.child;m=m.firstContext;e:for(;m!==null;){var C=m;m=d;for(var M=0;M<r.length;M++)if(C.context===r[M]){m.lanes|=l,C=m.alternate,C!==null&&(C.lanes|=l),fc(m.return,l,i),u||(v=null);break e}m=C.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(s(341));v.lanes|=l,m=v.alternate,m!==null&&(m.lanes|=l),fc(v,l,i),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===i){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function gs(i,r,l,u){i=null;for(var d=r,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(s(387));if(v=v.memoizedProps,v!==null){var C=d.type;Si(d.pendingProps.value,v.value)||(i!==null?i.push(C):i=[C])}}else if(d===ge.current){if(v=d.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Ul):i=[Ul])}d=d.return}i!==null&&dc(r,i,l,u),r.flags|=262144}function Ka(i){for(i=i.firstContext;i!==null;){if(!Si(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ar(i){Tr=i,vn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Ft(i){return tm(Tr,i)}function Xa(i,r){return Tr===null&&Ar(i),tm(i,r)}function tm(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},vn===null){if(i===null)throw Error(s(308));vn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else vn=vn.next=r;return l}var i1=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(l,u){i.push(u)}};this.abort=function(){r.aborted=!0,i.forEach(function(l){return l()})}},n1=e.unstable_scheduleCallback,r1=e.unstable_NormalPriority,gt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pc(){return{controller:new i1,data:new Map,refCount:0}}function dl(i){i.refCount--,i.refCount===0&&n1(r1,function(){i.controller.abort()})}var pl=null,mc=0,vs=0,ys=null;function s1(i,r){if(pl===null){var l=pl=[];mc=0,vs=vh(),ys={status:"pending",value:void 0,then:function(u){l.push(u)}}}return mc++,r.then(im,im),r}function im(){if(--mc===0&&pl!==null){ys!==null&&(ys.status="fulfilled");var i=pl;pl=null,vs=0,ys=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function l1(i,r){var l=[],u={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return i.then(function(){u.status="fulfilled",u.value=r;for(var d=0;d<l.length;d++)(0,l[d])(r)},function(d){for(u.status="rejected",u.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),u}var nm=A.S;A.S=function(i,r){P_=Jt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&s1(i,r),nm!==null&&nm(i,r)};var Dr=D(null);function _c(){var i=Dr.current;return i!==null?i:Je.pooledCache}function $a(i,r){r===null?w(Dr,Dr.current):w(Dr,r.pool)}function rm(){var i=_c();return i===null?null:{parent:gt._currentValue,pool:i}}var bs=Error(s(460)),gc=Error(s(474)),Ga=Error(s(542)),Za={then:function(){}};function sm(i){return i=i.status,i==="fulfilled"||i==="rejected"}function lm(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(pn,pn),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,om(i),i;default:if(typeof r.status=="string")r.then(pn,pn);else{if(i=Je,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(u){if(r.status==="pending"){var d=r;d.status="fulfilled",d.value=u}},function(u){if(r.status==="pending"){var d=r;d.status="rejected",d.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,om(i),i}throw Mr=r,bs}}function Rr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Mr=l,bs):l}}var Mr=null;function am(){if(Mr===null)throw Error(s(459));var i=Mr;return Mr=null,i}function om(i){if(i===bs||i===Ga)throw Error(s(483))}var Ss=null,ml=0;function Qa(i){var r=ml;return ml+=1,Ss===null&&(Ss=[]),lm(Ss,i,r)}function _l(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Ja(i,r){throw r.$$typeof===b?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function um(i){function r(U,z){if(i){var q=U.deletions;q===null?(U.deletions=[z],U.flags|=16):q.push(z)}}function l(U,z){if(!i)return null;for(;z!==null;)r(U,z),z=z.sibling;return null}function u(U){for(var z=new Map;U!==null;)U.key!==null?z.set(U.key,U):z.set(U.index,U),U=U.sibling;return z}function d(U,z){return U=_n(U,z),U.index=0,U.sibling=null,U}function m(U,z,q){return U.index=q,i?(q=U.alternate,q!==null?(q=q.index,q<z?(U.flags|=67108866,z):q):(U.flags|=67108866,z)):(U.flags|=1048576,z)}function v(U){return i&&U.alternate===null&&(U.flags|=67108866),U}function C(U,z,q,te){return z===null||z.tag!==6?(z=sc(q,U.mode,te),z.return=U,z):(z=d(z,q),z.return=U,z)}function M(U,z,q,te){var ve=q.type;return ve===k?G(U,z,q.props.children,te,q.key):z!==null&&(z.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===ce&&Rr(ve)===z.type)?(z=d(z,q.props),_l(z,q),z.return=U,z):(z=Ya(q.type,q.key,q.props,null,U.mode,te),_l(z,q),z.return=U,z)}function W(U,z,q,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=lc(q,U.mode,te),z.return=U,z):(z=d(z,q.children||[]),z.return=U,z)}function G(U,z,q,te,ve){return z===null||z.tag!==7?(z=kr(q,U.mode,te,ve),z.return=U,z):(z=d(z,q),z.return=U,z)}function ne(U,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=sc(""+z,U.mode,q),z.return=U,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case y:return q=Ya(z.type,z.key,z.props,null,U.mode,q),_l(q,z),q.return=U,q;case x:return z=lc(z,U.mode,q),z.return=U,z;case ce:return z=Rr(z),ne(U,z,q)}if(N(z)||H(z))return z=kr(z,U.mode,q,null),z.return=U,z;if(typeof z.then=="function")return ne(U,Qa(z),q);if(z.$$typeof===I)return ne(U,Xa(U,z),q);Ja(U,z)}return null}function K(U,z,q,te){var ve=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ve!==null?null:C(U,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case y:return q.key===ve?M(U,z,q,te):null;case x:return q.key===ve?W(U,z,q,te):null;case ce:return q=Rr(q),K(U,z,q,te)}if(N(q)||H(q))return ve!==null?null:G(U,z,q,te,null);if(typeof q.then=="function")return K(U,z,Qa(q),te);if(q.$$typeof===I)return K(U,z,Xa(U,q),te);Ja(U,q)}return null}function X(U,z,q,te,ve){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return U=U.get(q)||null,C(z,U,""+te,ve);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return U=U.get(te.key===null?q:te.key)||null,M(z,U,te,ve);case x:return U=U.get(te.key===null?q:te.key)||null,W(z,U,te,ve);case ce:return te=Rr(te),X(U,z,q,te,ve)}if(N(te)||H(te))return U=U.get(q)||null,G(z,U,te,ve,null);if(typeof te.then=="function")return X(U,z,q,Qa(te),ve);if(te.$$typeof===I)return X(U,z,q,Xa(z,te),ve);Ja(z,te)}return null}function me(U,z,q,te){for(var ve=null,Pe=null,_e=z,Te=z=0,Oe=null;_e!==null&&Te<q.length;Te++){_e.index>Te?(Oe=_e,_e=null):Oe=_e.sibling;var Ie=K(U,_e,q[Te],te);if(Ie===null){_e===null&&(_e=Oe);break}i&&_e&&Ie.alternate===null&&r(U,_e),z=m(Ie,z,Te),Pe===null?ve=Ie:Pe.sibling=Ie,Pe=Ie,_e=Oe}if(Te===q.length)return l(U,_e),je&&gn(U,Te),ve;if(_e===null){for(;Te<q.length;Te++)_e=ne(U,q[Te],te),_e!==null&&(z=m(_e,z,Te),Pe===null?ve=_e:Pe.sibling=_e,Pe=_e);return je&&gn(U,Te),ve}for(_e=u(_e);Te<q.length;Te++)Oe=X(_e,U,Te,q[Te],te),Oe!==null&&(i&&Oe.alternate!==null&&_e.delete(Oe.key===null?Te:Oe.key),z=m(Oe,z,Te),Pe===null?ve=Oe:Pe.sibling=Oe,Pe=Oe);return i&&_e.forEach(function(or){return r(U,or)}),je&&gn(U,Te),ve}function be(U,z,q,te){if(q==null)throw Error(s(151));for(var ve=null,Pe=null,_e=z,Te=z=0,Oe=null,Ie=q.next();_e!==null&&!Ie.done;Te++,Ie=q.next()){_e.index>Te?(Oe=_e,_e=null):Oe=_e.sibling;var or=K(U,_e,Ie.value,te);if(or===null){_e===null&&(_e=Oe);break}i&&_e&&or.alternate===null&&r(U,_e),z=m(or,z,Te),Pe===null?ve=or:Pe.sibling=or,Pe=or,_e=Oe}if(Ie.done)return l(U,_e),je&&gn(U,Te),ve;if(_e===null){for(;!Ie.done;Te++,Ie=q.next())Ie=ne(U,Ie.value,te),Ie!==null&&(z=m(Ie,z,Te),Pe===null?ve=Ie:Pe.sibling=Ie,Pe=Ie);return je&&gn(U,Te),ve}for(_e=u(_e);!Ie.done;Te++,Ie=q.next())Ie=X(_e,U,Te,Ie.value,te),Ie!==null&&(i&&Ie.alternate!==null&&_e.delete(Ie.key===null?Te:Ie.key),z=m(Ie,z,Te),Pe===null?ve=Ie:Pe.sibling=Ie,Pe=Ie);return i&&_e.forEach(function(gx){return r(U,gx)}),je&&gn(U,Te),ve}function $e(U,z,q,te){if(typeof q=="object"&&q!==null&&q.type===k&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case y:e:{for(var ve=q.key;z!==null;){if(z.key===ve){if(ve=q.type,ve===k){if(z.tag===7){l(U,z.sibling),te=d(z,q.props.children),te.return=U,U=te;break e}}else if(z.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===ce&&Rr(ve)===z.type){l(U,z.sibling),te=d(z,q.props),_l(te,q),te.return=U,U=te;break e}l(U,z);break}else r(U,z);z=z.sibling}q.type===k?(te=kr(q.props.children,U.mode,te,q.key),te.return=U,U=te):(te=Ya(q.type,q.key,q.props,null,U.mode,te),_l(te,q),te.return=U,U=te)}return v(U);case x:e:{for(ve=q.key;z!==null;){if(z.key===ve)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){l(U,z.sibling),te=d(z,q.children||[]),te.return=U,U=te;break e}else{l(U,z);break}else r(U,z);z=z.sibling}te=lc(q,U.mode,te),te.return=U,U=te}return v(U);case ce:return q=Rr(q),$e(U,z,q,te)}if(N(q))return me(U,z,q,te);if(H(q)){if(ve=H(q),typeof ve!="function")throw Error(s(150));return q=ve.call(q),be(U,z,q,te)}if(typeof q.then=="function")return $e(U,z,Qa(q),te);if(q.$$typeof===I)return $e(U,z,Xa(U,q),te);Ja(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(l(U,z.sibling),te=d(z,q),te.return=U,U=te):(l(U,z),te=sc(q,U.mode,te),te.return=U,U=te),v(U)):l(U,z)}return function(U,z,q,te){try{ml=0;var ve=$e(U,z,q,te);return Ss=null,ve}catch(_e){if(_e===bs||_e===Ga)throw _e;var Pe=xi(29,_e,null,U.mode);return Pe.lanes=te,Pe.return=U,Pe}finally{}}}var Br=um(!0),cm=um(!1),Yn=!1;function vc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yc(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Vn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Kn(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(qe&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=Wa(i),Kp(i,null,l),r}return qa(i,u,r,l),Wa(i)}function gl(i,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,tp(i,l)}}function bc(i,r){var l=i.updateQueue,u=i.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var d=null,m=null;if(l=l.firstBaseUpdate,l!==null){do{var v={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};m===null?d=m=v:m=m.next=v,l=l.next}while(l!==null);m===null?d=m=r:m=m.next=r}else d=m=r;l={baseState:u.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:u.shared,callbacks:u.callbacks},i.updateQueue=l;return}i=l.lastBaseUpdate,i===null?l.firstBaseUpdate=r:i.next=r,l.lastBaseUpdate=r}var Sc=!1;function vl(){if(Sc){var i=ys;if(i!==null)throw i}}function yl(i,r,l,u){Sc=!1;var d=i.updateQueue;Yn=!1;var m=d.firstBaseUpdate,v=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var M=C,W=M.next;M.next=null,v===null?m=W:v.next=W,v=M;var G=i.alternate;G!==null&&(G=G.updateQueue,C=G.lastBaseUpdate,C!==v&&(C===null?G.firstBaseUpdate=W:C.next=W,G.lastBaseUpdate=M))}if(m!==null){var ne=d.baseState;v=0,G=W=M=null,C=m;do{var K=C.lane&-536870913,X=K!==C.lane;if(X?(ze&K)===K:(u&K)===K){K!==0&&K===vs&&(Sc=!0),G!==null&&(G=G.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var me=i,be=C;K=r;var $e=l;switch(be.tag){case 1:if(me=be.payload,typeof me=="function"){ne=me.call($e,ne,K);break e}ne=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=be.payload,K=typeof me=="function"?me.call($e,ne,K):me,K==null)break e;ne=_({},ne,K);break e;case 2:Yn=!0}}K=C.callback,K!==null&&(i.flags|=64,X&&(i.flags|=8192),X=d.callbacks,X===null?d.callbacks=[K]:X.push(K))}else X={lane:K,tag:C.tag,payload:C.payload,callback:C.callback,next:null},G===null?(W=G=X,M=ne):G=G.next=X,v|=K;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;X=C,C=X.next,X.next=null,d.lastBaseUpdate=X,d.shared.pending=null}}while(!0);G===null&&(M=ne),d.baseState=M,d.firstBaseUpdate=W,d.lastBaseUpdate=G,m===null&&(d.shared.lanes=0),Qn|=v,i.lanes=v,i.memoizedState=ne}}function hm(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function fm(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)hm(l[i],r)}var xs=D(null),eo=D(0);function dm(i,r){i=An,w(eo,i),w(xs,r),An=i|r.baseLanes}function xc(){w(eo,An),w(xs,xs.current)}function wc(){An=eo.current,V(xs),V(eo)}var wi=D(null),Ui=null;function Xn(i){var r=i.alternate;w(pt,pt.current&1),w(wi,i),Ui===null&&(r===null||xs.current!==null||r.memoizedState!==null)&&(Ui=i)}function Cc(i){w(pt,pt.current),w(wi,i),Ui===null&&(Ui=i)}function pm(i){i.tag===22?(w(pt,pt.current),w(wi,i),Ui===null&&(Ui=i)):$n()}function $n(){w(pt,pt.current),w(wi,wi.current)}function Ci(i){V(wi),Ui===i&&(Ui=null),V(pt)}var pt=D(0);function to(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Rh(l)||Mh(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var bn=0,ke=null,Ke=null,vt=null,io=!1,ws=!1,Nr=!1,no=0,bl=0,Cs=null,a1=0;function ut(){throw Error(s(321))}function kc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Si(i[l],r[l]))return!1;return!0}function Ec(i,r,l,u,d,m){return bn=m,ke=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,A.H=i===null||i.memoizedState===null?Zm:Ic,Nr=!1,m=l(u,d),Nr=!1,ws&&(m=_m(r,l,u,d)),mm(i),m}function mm(i){A.H=wl;var r=Ke!==null&&Ke.next!==null;if(bn=0,vt=Ke=ke=null,io=!1,bl=0,Cs=null,r)throw Error(s(300));i===null||yt||(i=i.dependencies,i!==null&&Ka(i)&&(yt=!0))}function _m(i,r,l,u){ke=i;var d=0;do{if(ws&&(Cs=null),bl=0,ws=!1,25<=d)throw Error(s(301));if(d+=1,vt=Ke=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}A.H=Qm,m=r(l,u)}while(ws);return m}function o1(){var i=A.H,r=i.useState()[0];return r=typeof r.then=="function"?Sl(r):r,i=i.useState()[0],(Ke!==null?Ke.memoizedState:null)!==i&&(ke.flags|=1024),r}function Tc(){var i=no!==0;return no=0,i}function Ac(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Dc(i){if(io){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}io=!1}bn=0,vt=Ke=ke=null,ws=!1,bl=no=0,Cs=null}function ti(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vt===null?ke.memoizedState=vt=i:vt=vt.next=i,vt}function mt(){if(Ke===null){var i=ke.alternate;i=i!==null?i.memoizedState:null}else i=Ke.next;var r=vt===null?ke.memoizedState:vt.next;if(r!==null)vt=r,Ke=i;else{if(i===null)throw ke.alternate===null?Error(s(467)):Error(s(310));Ke=i,i={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},vt===null?ke.memoizedState=vt=i:vt=vt.next=i}return vt}function ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sl(i){var r=bl;return bl+=1,Cs===null&&(Cs=[]),i=lm(Cs,i,r),r=ke,(vt===null?r.memoizedState:vt.next)===null&&(r=r.alternate,A.H=r===null||r.memoizedState===null?Zm:Ic),i}function so(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Sl(i);if(i.$$typeof===I)return Ft(i)}throw Error(s(438,String(i)))}function Rc(i){var r=null,l=ke.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=ke.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(d){return d.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=ro(),ke.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(i),u=0;u<i;u++)l[u]=F;return r.index++,l}function Sn(i,r){return typeof r=="function"?r(i):r}function lo(i){var r=mt();return Mc(r,Ke,i)}function Mc(i,r,l){var u=i.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=l;var d=i.baseQueue,m=u.pending;if(m!==null){if(d!==null){var v=d.next;d.next=m.next,m.next=v}r.baseQueue=d=m,u.pending=null}if(m=i.baseState,d===null)i.memoizedState=m;else{r=d.next;var C=v=null,M=null,W=r,G=!1;do{var ne=W.lane&-536870913;if(ne!==W.lane?(ze&ne)===ne:(bn&ne)===ne){var K=W.revertLane;if(K===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ne===vs&&(G=!0);else if((bn&K)===K){W=W.next,K===vs&&(G=!0);continue}else ne={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(C=M=ne,v=m):M=M.next=ne,ke.lanes|=K,Qn|=K;ne=W.action,Nr&&l(m,ne),m=W.hasEagerState?W.eagerState:l(m,ne)}else K={lane:ne,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(C=M=K,v=m):M=M.next=K,ke.lanes|=ne,Qn|=ne;W=W.next}while(W!==null&&W!==r);if(M===null?v=m:M.next=C,!Si(m,i.memoizedState)&&(yt=!0,G&&(l=ys,l!==null)))throw l;i.memoizedState=m,i.baseState=v,i.baseQueue=M,u.lastRenderedState=m}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Bc(i){var r=mt(),l=r.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=i;var u=l.dispatch,d=l.pending,m=r.memoizedState;if(d!==null){l.pending=null;var v=d=d.next;do m=i(m,v.action),v=v.next;while(v!==d);Si(m,r.memoizedState)||(yt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function gm(i,r,l){var u=ke,d=mt(),m=je;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var v=!Si((Ke||d).memoizedState,l);if(v&&(d.memoizedState=l,yt=!0),d=d.queue,zc(bm.bind(null,u,d,i),[i]),d.getSnapshot!==r||v||vt!==null&&vt.memoizedState.tag&1){if(u.flags|=2048,ks(9,{destroy:void 0},ym.bind(null,u,d,l,r),null),Je===null)throw Error(s(349));m||(bn&127)!==0||vm(u,r,l)}return l}function vm(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=ke.updateQueue,r===null?(r=ro(),ke.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function ym(i,r,l,u){r.value=l,r.getSnapshot=u,Sm(r)&&xm(i)}function bm(i,r,l){return l(function(){Sm(r)&&xm(i)})}function Sm(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Si(i,l)}catch{return!0}}function xm(i){var r=Cr(i,2);r!==null&&mi(r,i,2)}function Nc(i){var r=ti();if(typeof i=="function"){var l=i;if(i=l(),Nr){oi(!0);try{l()}finally{oi(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:i},r}function wm(i,r,l,u){return i.baseState=l,Mc(i,Ke,typeof u=="function"?u:Sn)}function u1(i,r,l,u,d){if(uo(i))throw Error(s(485));if(i=r.action,i!==null){var m={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){m.listeners.push(v)}};A.T!==null?l(!0):m.isTransition=!1,u(m),l=r.pending,l===null?(m.next=r.pending=m,Cm(r,m)):(m.next=l.next,r.pending=l.next=m)}}function Cm(i,r){var l=r.action,u=r.payload,d=i.state;if(r.isTransition){var m=A.T,v={};A.T=v;try{var C=l(d,u),M=A.S;M!==null&&M(v,C),km(i,r,C)}catch(W){Lc(i,r,W)}finally{m!==null&&v.types!==null&&(m.types=v.types),A.T=m}}else try{m=l(d,u),km(i,r,m)}catch(W){Lc(i,r,W)}}function km(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){Em(i,r,u)},function(u){return Lc(i,r,u)}):Em(i,r,l)}function Em(i,r,l){r.status="fulfilled",r.value=l,Tm(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,Cm(i,l)))}function Lc(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,Tm(r),r=r.next;while(r!==u)}i.action=null}function Tm(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function Am(i,r){return r}function Dm(i,r){if(je){var l=Je.formState;if(l!==null){e:{var u=ke;if(je){if(it){t:{for(var d=it,m=Hi;d.nodeType!==8;){if(!m){d=null;break t}if(d=Pi(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){it=Pi(d.nextSibling),u=d.data==="F!";break e}}qn(u)}u=!1}u&&(r=l[0])}}return l=ti(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Am,lastRenderedState:r},l.queue=u,l=Xm.bind(null,ke,u),u.dispatch=l,u=Nc(!1),m=Pc.bind(null,ke,!1,u.queue),u=ti(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=u1.bind(null,ke,d,m,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function Rm(i){var r=mt();return Mm(r,Ke,i)}function Mm(i,r,l){if(r=Mc(i,r,Am)[0],i=lo(Sn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Sl(r)}catch(v){throw v===bs?Ga:v}else u=r;r=mt();var d=r.queue,m=d.dispatch;return l!==r.memoizedState&&(ke.flags|=2048,ks(9,{destroy:void 0},c1.bind(null,d,l),null)),[u,m,i]}function c1(i,r){i.action=r}function Bm(i){var r=mt(),l=Ke;if(l!==null)return Mm(r,l,i);mt(),r=r.memoizedState,l=mt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function ks(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=ke.updateQueue,r===null&&(r=ro(),ke.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=i.next=i:(u=l.next,l.next=i,i.next=u,r.lastEffect=i),i}function Nm(){return mt().memoizedState}function ao(i,r,l,u){var d=ti();ke.flags|=i,d.memoizedState=ks(1|r,{destroy:void 0},l,u===void 0?null:u)}function oo(i,r,l,u){var d=mt();u=u===void 0?null:u;var m=d.memoizedState.inst;Ke!==null&&u!==null&&kc(u,Ke.memoizedState.deps)?d.memoizedState=ks(r,m,l,u):(ke.flags|=i,d.memoizedState=ks(1|r,m,l,u))}function Lm(i,r){ao(8390656,8,i,r)}function zc(i,r){oo(2048,8,i,r)}function h1(i){ke.flags|=4;var r=ke.updateQueue;if(r===null)r=ro(),ke.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function zm(i){var r=mt().memoizedState;return h1({ref:r,nextImpl:i}),function(){if((qe&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Om(i,r){return oo(4,2,i,r)}function jm(i,r){return oo(4,4,i,r)}function Hm(i,r){if(typeof r=="function"){i=i();var l=r(i);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function Um(i,r,l){l=l!=null?l.concat([i]):null,oo(4,4,Hm.bind(null,r,i),l)}function Oc(){}function Pm(i,r){var l=mt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&kc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function Im(i,r){var l=mt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&kc(r,u[1]))return u[0];if(u=i(),Nr){oi(!0);try{i()}finally{oi(!1)}}return l.memoizedState=[u,r],u}function jc(i,r,l){return l===void 0||(bn&1073741824)!==0&&(ze&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=F_(),ke.lanes|=i,Qn|=i,l)}function Fm(i,r,l,u){return Si(l,r)?l:xs.current!==null?(i=jc(i,l,u),Si(i,r)||(yt=!0),i):(bn&42)===0||(bn&1073741824)!==0&&(ze&261930)===0?(yt=!0,i.memoizedState=l):(i=F_(),ke.lanes|=i,Qn|=i,r)}function qm(i,r,l,u,d){var m=j.p;j.p=m!==0&&8>m?m:8;var v=A.T,C={};A.T=C,Pc(i,!1,r,l);try{var M=d(),W=A.S;if(W!==null&&W(C,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var G=l1(M,u);xl(i,r,G,Ti(i))}else xl(i,r,u,Ti(i))}catch(ne){xl(i,r,{then:function(){},status:"rejected",reason:ne},Ti())}finally{j.p=m,v!==null&&C.types!==null&&(v.types=C.types),A.T=v}}function f1(){}function Hc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=Wm(i).queue;qm(i,d,r,P,l===null?f1:function(){return Ym(i),l(u)})}function Wm(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:P},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sn,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function Ym(i){var r=Wm(i);r.next===null&&(r=i.alternate.memoizedState),xl(i,r.next.queue,{},Ti())}function Uc(){return Ft(Ul)}function Vm(){return mt().memoizedState}function Km(){return mt().memoizedState}function d1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=Ti();i=Vn(l);var u=Kn(r,i,l);u!==null&&(mi(u,r,l),gl(u,r,l)),r={cache:pc()},i.payload=r;return}r=r.return}}function p1(i,r,l){var u=Ti();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},uo(i)?$m(r,l):(l=nc(i,r,l,u),l!==null&&(mi(l,i,u),Gm(l,r,u)))}function Xm(i,r,l){var u=Ti();xl(i,r,l,u)}function xl(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(uo(i))$m(r,d);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var v=r.lastRenderedState,C=m(v,l);if(d.hasEagerState=!0,d.eagerState=C,Si(C,v))return qa(i,r,d,0),Je===null&&Fa(),!1}catch{}finally{}if(l=nc(i,r,d,u),l!==null)return mi(l,i,u),Gm(l,r,u),!0}return!1}function Pc(i,r,l,u){if(u={lane:2,revertLane:vh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},uo(i)){if(r)throw Error(s(479))}else r=nc(i,l,u,2),r!==null&&mi(r,i,2)}function uo(i){var r=i.alternate;return i===ke||r!==null&&r===ke}function $m(i,r){ws=io=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function Gm(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,tp(i,l)}}var wl={readContext:Ft,use:so,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut};wl.useEffectEvent=ut;var Zm={readContext:Ft,use:so,useCallback:function(i,r){return ti().memoizedState=[i,r===void 0?null:r],i},useContext:Ft,useEffect:Lm,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,ao(4194308,4,Hm.bind(null,r,i),l)},useLayoutEffect:function(i,r){return ao(4194308,4,i,r)},useInsertionEffect:function(i,r){ao(4,2,i,r)},useMemo:function(i,r){var l=ti();r=r===void 0?null:r;var u=i();if(Nr){oi(!0);try{i()}finally{oi(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=ti();if(l!==void 0){var d=l(r);if(Nr){oi(!0);try{l(r)}finally{oi(!1)}}}else d=r;return u.memoizedState=u.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},u.queue=i,i=i.dispatch=p1.bind(null,ke,i),[u.memoizedState,i]},useRef:function(i){var r=ti();return i={current:i},r.memoizedState=i},useState:function(i){i=Nc(i);var r=i.queue,l=Xm.bind(null,ke,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Oc,useDeferredValue:function(i,r){var l=ti();return jc(l,i,r)},useTransition:function(){var i=Nc(!1);return i=qm.bind(null,ke,i.queue,!0,!1),ti().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=ke,d=ti();if(je){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),Je===null)throw Error(s(349));(ze&127)!==0||vm(u,r,l)}d.memoizedState=l;var m={value:l,getSnapshot:r};return d.queue=m,Lm(bm.bind(null,u,m,i),[i]),u.flags|=2048,ks(9,{destroy:void 0},ym.bind(null,u,m,l,r),null),l},useId:function(){var i=ti(),r=Je.identifierPrefix;if(je){var l=en,u=Ji;l=(u&~(1<<32-Qe(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=no++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=a1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Uc,useFormState:Dm,useActionState:Dm,useOptimistic:function(i){var r=ti();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Pc.bind(null,ke,!0,l),l.dispatch=r,[i,r]},useMemoCache:Rc,useCacheRefresh:function(){return ti().memoizedState=d1.bind(null,ke)},useEffectEvent:function(i){var r=ti(),l={impl:i};return r.memoizedState=l,function(){if((qe&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Ic={readContext:Ft,use:so,useCallback:Pm,useContext:Ft,useEffect:zc,useImperativeHandle:Um,useInsertionEffect:Om,useLayoutEffect:jm,useMemo:Im,useReducer:lo,useRef:Nm,useState:function(){return lo(Sn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=mt();return Fm(l,Ke.memoizedState,i,r)},useTransition:function(){var i=lo(Sn)[0],r=mt().memoizedState;return[typeof i=="boolean"?i:Sl(i),r]},useSyncExternalStore:gm,useId:Vm,useHostTransitionStatus:Uc,useFormState:Rm,useActionState:Rm,useOptimistic:function(i,r){var l=mt();return wm(l,Ke,i,r)},useMemoCache:Rc,useCacheRefresh:Km};Ic.useEffectEvent=zm;var Qm={readContext:Ft,use:so,useCallback:Pm,useContext:Ft,useEffect:zc,useImperativeHandle:Um,useInsertionEffect:Om,useLayoutEffect:jm,useMemo:Im,useReducer:Bc,useRef:Nm,useState:function(){return Bc(Sn)},useDebugValue:Oc,useDeferredValue:function(i,r){var l=mt();return Ke===null?jc(l,i,r):Fm(l,Ke.memoizedState,i,r)},useTransition:function(){var i=Bc(Sn)[0],r=mt().memoizedState;return[typeof i=="boolean"?i:Sl(i),r]},useSyncExternalStore:gm,useId:Vm,useHostTransitionStatus:Uc,useFormState:Bm,useActionState:Bm,useOptimistic:function(i,r){var l=mt();return Ke!==null?wm(l,Ke,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Rc,useCacheRefresh:Km};Qm.useEffectEvent=zm;function Fc(i,r,l,u){r=i.memoizedState,l=l(u,r),l=l==null?r:_({},r,l),i.memoizedState=l,i.lanes===0&&(i.updateQueue.baseState=l)}var qc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=Ti(),d=Vn(u);d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(mi(r,i,u),gl(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=Ti(),d=Vn(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=Kn(i,d,u),r!==null&&(mi(r,i,u),gl(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=Ti(),u=Vn(l);u.tag=2,r!=null&&(u.callback=r),r=Kn(i,u,l),r!==null&&(mi(r,i,l),gl(r,i,l))}};function Jm(i,r,l,u,d,m,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(u,m,v):r.prototype&&r.prototype.isPureReactComponent?!ul(l,u)||!ul(d,m):!0}function e_(i,r,l,u){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==i&&qc.enqueueReplaceState(r,r.state,null)}function Lr(i,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(i=i.defaultProps){l===r&&(l=_({},l));for(var d in i)l[d]===void 0&&(l[d]=i[d])}return l}function t_(i){Ia(i)}function i_(i){console.error(i)}function n_(i){Ia(i)}function co(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function r_(i,r,l){try{var u=i.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Wc(i,r,l){return l=Vn(l),l.tag=3,l.payload={element:null},l.callback=function(){co(i,r)},l}function s_(i){return i=Vn(i),i.tag=3,i}function l_(i,r,l,u){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var m=u.value;i.payload=function(){return d(m)},i.callback=function(){r_(r,l,u)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){r_(r,l,u),typeof d!="function"&&(Jn===null?Jn=new Set([this]):Jn.add(this));var C=u.stack;this.componentDidCatch(u.value,{componentStack:C!==null?C:""})})}function m1(i,r,l,u,d){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&gs(r,l,d,!0),l=wi.current,l!==null){switch(l.tag){case 31:case 13:return Ui===null?wo():l.alternate===null&&ct===0&&(ct=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===Za?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),mh(i,u,d)),!1;case 22:return l.flags|=65536,u===Za?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),mh(i,u,d)),!1}throw Error(s(435,l.tag))}return mh(i,u,d),wo(),!1}if(je)return r=wi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==uc&&(i=Error(s(422),{cause:u}),fl(zi(i,l)))):(u!==uc&&(r=Error(s(423),{cause:u}),fl(zi(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=zi(u,l),d=Wc(i.stateNode,u,d),bc(i,d),ct!==4&&(ct=2)),!1;var m=Error(s(520),{cause:u});if(m=zi(m,l),Ml===null?Ml=[m]:Ml.push(m),ct!==4&&(ct=2),r===null)return!0;u=zi(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Wc(l.stateNode,u,i),bc(l,i),!1;case 1:if(r=l.type,m=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Jn===null||!Jn.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=s_(d),l_(d,i,l,u),bc(l,d),!1}l=l.return}while(l!==null);return!1}var Yc=Error(s(461)),yt=!1;function qt(i,r,l,u){r.child=i===null?cm(r,null,l,u):Br(r,i.child,l,u)}function a_(i,r,l,u,d){l=l.render;var m=r.ref;if("ref"in u){var v={};for(var C in u)C!=="ref"&&(v[C]=u[C])}else v=u;return Ar(r),u=Ec(i,r,l,v,m,d),C=Tc(),i!==null&&!yt?(Ac(i,r,d),xn(i,r,d)):(je&&C&&ac(r),r.flags|=1,qt(i,r,u,d),r.child)}function o_(i,r,l,u,d){if(i===null){var m=l.type;return typeof m=="function"&&!rc(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,u_(i,r,m,u,d)):(i=Ya(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!Jc(i,d)){var v=m.memoizedProps;if(l=l.compare,l=l!==null?l:ul,l(v,u)&&i.ref===r.ref)return xn(i,r,d)}return r.flags|=1,i=_n(m,u),i.ref=r.ref,i.return=r,r.child=i}function u_(i,r,l,u,d){if(i!==null){var m=i.memoizedProps;if(ul(m,u)&&i.ref===r.ref)if(yt=!1,r.pendingProps=u=m,Jc(i,d))(i.flags&131072)!==0&&(yt=!0);else return r.lanes=i.lanes,xn(i,r,d)}return Vc(i,r,l,u,d)}function c_(i,r,l,u){var d=u.children,m=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(m=m!==null?m.baseLanes|l:l,i!==null){for(u=r.child=i.child,d=0;u!==null;)d=d|u.lanes|u.childLanes,u=u.sibling;u=d&~m}else u=0,r.child=null;return h_(i,r,m,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&$a(r,m!==null?m.cachePool:null),m!==null?dm(r,m):xc(),pm(r);else return u=r.lanes=536870912,h_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?($a(r,m.cachePool),dm(r,m),$n(),r.memoizedState=null):(i!==null&&$a(r,null),xc(),$n());return qt(i,r,d,l),r.child}function Cl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function h_(i,r,l,u,d){var m=_c();return m=m===null?null:{parent:gt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&$a(r,null),xc(),pm(r),i!==null&&gs(i,r,u,!0),r.childLanes=d,null}function ho(i,r){return r=po({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function f_(i,r,l){return Br(r,i.child,null,l),i=ho(r,r.pendingProps),i.flags|=2,Ci(r),r.memoizedState=null,i}function _1(i,r,l){var u=r.pendingProps,d=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(je){if(u.mode==="hidden")return i=ho(r,u),r.lanes=536870912,Cl(null,i);if(Cc(r),(i=it)?(i=Cg(i,Hi),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=$p(i),l.return=r,r.child=l,It=r,it=null)):i=null,i===null)throw qn(r);return r.lanes=536870912,null}return ho(r,u)}var m=i.memoizedState;if(m!==null){var v=m.dehydrated;if(Cc(r),d)if(r.flags&256)r.flags&=-257,r=f_(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(yt||gs(i,r,l,!1),d=(l&i.childLanes)!==0,yt||d){if(u=Je,u!==null&&(v=ip(u,l),v!==0&&v!==m.retryLane))throw m.retryLane=v,Cr(i,v),mi(u,i,v),Yc;wo(),r=f_(i,r,l)}else i=m.treeContext,it=Pi(v.nextSibling),It=r,je=!0,Fn=null,Hi=!1,i!==null&&Qp(r,i),r=ho(r,u),r.flags|=4096;return r}return i=_n(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function fo(i,r){var l=r.ref;if(l===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(i===null||i.ref!==l)&&(r.flags|=4194816)}}function Vc(i,r,l,u,d){return Ar(r),l=Ec(i,r,l,u,void 0,d),u=Tc(),i!==null&&!yt?(Ac(i,r,d),xn(i,r,d)):(je&&u&&ac(r),r.flags|=1,qt(i,r,l,d),r.child)}function d_(i,r,l,u,d,m){return Ar(r),r.updateQueue=null,l=_m(r,u,l,d),mm(i),u=Tc(),i!==null&&!yt?(Ac(i,r,m),xn(i,r,m)):(je&&u&&ac(r),r.flags|=1,qt(i,r,l,m),r.child)}function p_(i,r,l,u,d){if(Ar(r),r.stateNode===null){var m=ds,v=l.contextType;typeof v=="object"&&v!==null&&(m=Ft(v)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=qc,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},vc(r),v=l.contextType,m.context=typeof v=="object"&&v!==null?Ft(v):ds,m.state=r.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Fc(r,l,v,u),m.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(v=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),v!==m.state&&qc.enqueueReplaceState(m,m.state,null),yl(r,u,m,d),vl(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var C=r.memoizedProps,M=Lr(l,C);m.props=M;var W=m.context,G=l.contextType;v=ds,typeof G=="object"&&G!==null&&(v=Ft(G));var ne=l.getDerivedStateFromProps;G=typeof ne=="function"||typeof m.getSnapshotBeforeUpdate=="function",C=r.pendingProps!==C,G||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(C||W!==v)&&e_(r,m,u,v),Yn=!1;var K=r.memoizedState;m.state=K,yl(r,u,m,d),vl(),W=r.memoizedState,C||K!==W||Yn?(typeof ne=="function"&&(Fc(r,l,ne,u),W=r.memoizedState),(M=Yn||Jm(r,l,M,u,K,W,v))?(G||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=W),m.props=u,m.state=W,m.context=v,u=M):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,yc(i,r),v=r.memoizedProps,G=Lr(l,v),m.props=G,ne=r.pendingProps,K=m.context,W=l.contextType,M=ds,typeof W=="object"&&W!==null&&(M=Ft(W)),C=l.getDerivedStateFromProps,(W=typeof C=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(v!==ne||K!==M)&&e_(r,m,u,M),Yn=!1,K=r.memoizedState,m.state=K,yl(r,u,m,d),vl();var X=r.memoizedState;v!==ne||K!==X||Yn||i!==null&&i.dependencies!==null&&Ka(i.dependencies)?(typeof C=="function"&&(Fc(r,l,C,u),X=r.memoizedState),(G=Yn||Jm(r,l,G,u,K,X,M)||i!==null&&i.dependencies!==null&&Ka(i.dependencies))?(W||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,X,M),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,X,M)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=X),m.props=u,m.state=X,m.context=M,u=G):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&K===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,fo(i,r),u=(r.flags&128)!==0,m||u?(m=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&u?(r.child=Br(r,i.child,null,d),r.child=Br(r,null,l,d)):qt(i,r,l,d),r.memoizedState=m.state,i=r.child):i=xn(i,r,d),i}function m_(i,r,l,u){return Er(),r.flags|=256,qt(i,r,l,u),r.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xc(i){return{baseLanes:i,cachePool:rm()}}function $c(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=Ei),i}function __(i,r,l){var u=r.pendingProps,d=!1,m=(r.flags&128)!==0,v;if((v=m)||(v=i!==null&&i.memoizedState===null?!1:(pt.current&2)!==0),v&&(d=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,i===null){if(je){if(d?Xn(r):$n(),(i=it)?(i=Cg(i,Hi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:In!==null?{id:Ji,overflow:en}:null,retryLane:536870912,hydrationErrors:null},l=$p(i),l.return=r,r.child=l,It=r,it=null)):i=null,i===null)throw qn(r);return Mh(i)?r.lanes=32:r.lanes=536870912,null}var C=u.children;return u=u.fallback,d?($n(),d=r.mode,C=po({mode:"hidden",children:C},d),u=kr(u,d,l,null),C.return=r,u.return=r,C.sibling=u,r.child=C,u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(null,u)):(Xn(r),Gc(r,C))}var M=i.memoizedState;if(M!==null&&(C=M.dehydrated,C!==null)){if(m)r.flags&256?(Xn(r),r.flags&=-257,r=Zc(i,r,l)):r.memoizedState!==null?($n(),r.child=i.child,r.flags|=128,r=null):($n(),C=u.fallback,d=r.mode,u=po({mode:"visible",children:u.children},d),C=kr(C,d,l,null),C.flags|=2,u.return=r,C.return=r,u.sibling=C,r.child=u,Br(r,i.child,null,l),u=r.child,u.memoizedState=Xc(l),u.childLanes=$c(i,v,l),r.memoizedState=Kc,r=Cl(null,u));else if(Xn(r),Mh(C)){if(v=C.nextSibling&&C.nextSibling.dataset,v)var W=v.dgst;v=W,u=Error(s(419)),u.stack="",u.digest=v,fl({value:u,source:null,stack:null}),r=Zc(i,r,l)}else if(yt||gs(i,r,l,!1),v=(l&i.childLanes)!==0,yt||v){if(v=Je,v!==null&&(u=ip(v,l),u!==0&&u!==M.retryLane))throw M.retryLane=u,Cr(i,u),mi(v,i,u),Yc;Rh(C)||wo(),r=Zc(i,r,l)}else Rh(C)?(r.flags|=192,r.child=i.child,r=null):(i=M.treeContext,it=Pi(C.nextSibling),It=r,je=!0,Fn=null,Hi=!1,i!==null&&Qp(r,i),r=Gc(r,u.children),r.flags|=4096);return r}return d?($n(),C=u.fallback,d=r.mode,M=i.child,W=M.sibling,u=_n(M,{mode:"hidden",children:u.children}),u.subtreeFlags=M.subtreeFlags&65011712,W!==null?C=_n(W,C):(C=kr(C,d,l,null),C.flags|=2),C.return=r,u.return=r,u.sibling=C,r.child=u,Cl(null,u),u=r.child,C=i.child.memoizedState,C===null?C=Xc(l):(d=C.cachePool,d!==null?(M=gt._currentValue,d=d.parent!==M?{parent:M,pool:M}:d):d=rm(),C={baseLanes:C.baseLanes|l,cachePool:d}),u.memoizedState=C,u.childLanes=$c(i,v,l),r.memoizedState=Kc,Cl(i.child,u)):(Xn(r),l=i.child,i=l.sibling,l=_n(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,i!==null&&(v=r.deletions,v===null?(r.deletions=[i],r.flags|=16):v.push(i)),r.child=l,r.memoizedState=null,l)}function Gc(i,r){return r=po({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function po(i,r){return i=xi(22,i,null,r),i.lanes=0,i}function Zc(i,r,l){return Br(r,i.child,null,l),i=Gc(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function g_(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),fc(i.return,r,l)}function Qc(i,r,l,u,d,m){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:d,treeForkCount:m}:(v.isBackwards=r,v.rendering=null,v.renderingStartTime=0,v.last=u,v.tail=l,v.tailMode=d,v.treeForkCount=m)}function v_(i,r,l){var u=r.pendingProps,d=u.revealOrder,m=u.tail;u=u.children;var v=pt.current,C=(v&2)!==0;if(C?(v=v&1|2,r.flags|=128):v&=1,w(pt,v),qt(i,r,u,l),u=je?hl:0,!C&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&g_(i,l,r);else if(i.tag===19)g_(i,l,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(l=r.child,d=null;l!==null;)i=l.alternate,i!==null&&to(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),Qc(r,!1,d,l,m,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,d=r.child,r.child=null;d!==null;){if(i=d.alternate,i!==null&&to(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}Qc(r,!0,l,null,m,u);break;case"together":Qc(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function xn(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),Qn|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(gs(i,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,l=_n(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=_n(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function Jc(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Ka(i)))}function g1(i,r,l){switch(r.tag){case 3:Ee(r,r.stateNode.containerInfo),Wn(r,gt,i.memoizedState.cache),Er();break;case 27:case 5:Ze(r);break;case 4:Ee(r,r.stateNode.containerInfo);break;case 10:Wn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Cc(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Xn(r),r.flags|=128,null):(l&r.child.childLanes)!==0?__(i,r,l):(Xn(r),i=xn(i,r,l),i!==null?i.sibling:null);Xn(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(gs(i,r,l,!1),u=(l&r.childLanes)!==0),d){if(u)return v_(i,r,l);r.flags|=128}if(d=r.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),w(pt,pt.current),u)break;return null;case 22:return r.lanes=0,c_(i,r,l,r.pendingProps);case 24:Wn(r,gt,i.memoizedState.cache)}return xn(i,r,l)}function y_(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)yt=!0;else{if(!Jc(i,l)&&(r.flags&128)===0)return yt=!1,g1(i,r,l);yt=(i.flags&131072)!==0}else yt=!1,je&&(r.flags&1048576)!==0&&Zp(r,hl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Rr(r.elementType),r.type=i,typeof i=="function")rc(i)?(u=Lr(i,u),r.tag=1,r=p_(null,r,i,u,l)):(r.tag=0,r=Vc(null,r,i,u,l));else{if(i!=null){var d=i.$$typeof;if(d===Z){r.tag=11,r=a_(null,r,i,u,l);break e}else if(d===J){r.tag=14,r=o_(null,r,i,u,l);break e}}throw r=B(i)||i,Error(s(306,r,""))}}return r;case 0:return Vc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Lr(u,r.pendingProps),p_(i,r,u,d,l);case 3:e:{if(Ee(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;d=m.element,yc(i,r),yl(r,u,null,l);var v=r.memoizedState;if(u=v.cache,Wn(r,gt,u),u!==m.cache&&dc(r,[gt],l,!0),vl(),u=v.element,m.isDehydrated)if(m={element:u,isDehydrated:!1,cache:v.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=m_(i,r,u,l);break e}else if(u!==d){d=zi(Error(s(424)),r),fl(d),r=m_(i,r,u,l);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(it=Pi(i.firstChild),It=r,je=!0,Fn=null,Hi=!0,l=cm(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Er(),u===d){r=xn(i,r,l);break e}qt(i,r,u,l)}r=r.child}return r;case 26:return fo(i,r),i===null?(l=Rg(r.type,null,r.pendingProps,null))?r.memoizedState=l:je||(l=r.type,i=r.pendingProps,u=Ro(le.current).createElement(l),u[Pt]=r,u[ui]=i,Wt(u,l,i),Rt(u),r.stateNode=u):r.memoizedState=Rg(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ze(r),i===null&&je&&(u=r.stateNode=Tg(r.type,r.pendingProps,le.current),It=r,Hi=!0,d=it,nr(r.type)?(Bh=d,it=Pi(u.firstChild)):it=d),qt(i,r,r.pendingProps.children,l),fo(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&je&&((d=u=it)&&(u=K1(u,r.type,r.pendingProps,Hi),u!==null?(r.stateNode=u,It=r,it=Pi(u.firstChild),Hi=!1,d=!0):d=!1),d||qn(r)),Ze(r),d=r.type,m=r.pendingProps,v=i!==null?i.memoizedProps:null,u=m.children,Th(d,m)?u=null:v!==null&&Th(d,v)&&(r.flags|=32),r.memoizedState!==null&&(d=Ec(i,r,o1,null,null,l),Ul._currentValue=d),fo(i,r),qt(i,r,u,l),r.child;case 6:return i===null&&je&&((i=l=it)&&(l=X1(l,r.pendingProps,Hi),l!==null?(r.stateNode=l,It=r,it=null,i=!0):i=!1),i||qn(r)),null;case 13:return __(i,r,l);case 4:return Ee(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Br(r,null,u,l):qt(i,r,u,l),r.child;case 11:return a_(i,r,r.type,r.pendingProps,l);case 7:return qt(i,r,r.pendingProps,l),r.child;case 8:return qt(i,r,r.pendingProps.children,l),r.child;case 12:return qt(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Wn(r,r.type,u.value),qt(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,Ar(r),d=Ft(d),u=u(d),r.flags|=1,qt(i,r,u,l),r.child;case 14:return o_(i,r,r.type,r.pendingProps,l);case 15:return u_(i,r,r.type,r.pendingProps,l);case 19:return v_(i,r,l);case 31:return _1(i,r,l);case 22:return c_(i,r,l,r.pendingProps);case 24:return Ar(r),u=Ft(gt),i===null?(d=_c(),d===null&&(d=Je,m=pc(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),r.memoizedState={parent:u,cache:d},vc(r),Wn(r,gt,d)):((i.lanes&l)!==0&&(yc(i,r),yl(r,null,null,l),vl()),d=i.memoizedState,m=r.memoizedState,d.parent!==u?(d={parent:u,cache:u},r.memoizedState=d,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=d),Wn(r,gt,u)):(u=m.cache,Wn(r,gt,u),u!==d.cache&&dc(r,[gt],l,!0))),qt(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function wn(i){i.flags|=4}function eh(i,r,l,u,d){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(V_())i.flags|=8192;else throw Mr=Za,gc}else i.flags&=-16777217}function b_(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!zg(r))if(V_())i.flags|=8192;else throw Mr=Za,gc}function mo(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Jd():536870912,i.lanes|=r,Ds|=r)}function kl(i,r){if(!je)switch(i.tailMode){case"hidden":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?i.tail=null:l.sibling=null;break;case"collapsed":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:u.sibling=null}}function nt(i){var r=i.alternate!==null&&i.alternate.child===i.child,l=0,u=0;if(r)for(var d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags&65011712,u|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)l|=d.lanes|d.childLanes,u|=d.subtreeFlags,u|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=u,i.childLanes=l,r}function v1(i,r,l){var u=r.pendingProps;switch(oc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(r),null;case 1:return nt(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),yn(gt),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(_s(r)?wn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,cc())),nt(r),null;case 26:var d=r.type,m=r.memoizedState;return i===null?(wn(r),m!==null?(nt(r),b_(r,m)):(nt(r),eh(r,d,null,u,l))):m?m!==i.memoizedState?(wn(r),nt(r),b_(r,m)):(nt(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&wn(r),nt(r),eh(r,d,i,u,l)),null;case 27:if(Fe(r),l=le.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return nt(r),null}i=ie.current,_s(r)?Jp(r):(i=Tg(d,u,l),r.stateNode=i,wn(r))}return nt(r),null;case 5:if(Fe(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return nt(r),null}if(m=ie.current,_s(r))Jp(r);else{var v=Ro(le.current);switch(m){case 1:m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=v.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof u.is=="string"?v.createElement("select",{is:u.is}):v.createElement("select"),u.multiple?m.multiple=!0:u.size&&(m.size=u.size);break;default:m=typeof u.is=="string"?v.createElement(d,{is:u.is}):v.createElement(d)}}m[Pt]=r,m[ui]=u;e:for(v=r.child;v!==null;){if(v.tag===5||v.tag===6)m.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===r)break e;for(;v.sibling===null;){if(v.return===null||v.return===r)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}r.stateNode=m;e:switch(Wt(m,d,u),d){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&wn(r)}}return nt(r),eh(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&wn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=le.current,_s(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=It,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[Pt]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||_g(i.nodeValue,l)),i||qn(r,!0)}else i=Ro(i).createTextNode(u),i[Pt]=r,r.stateNode=i}return nt(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=_s(r),l!==null){if(i===null){if(!u)throw Error(s(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[Pt]=r}else Er(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;nt(r),i=!1}else l=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(Ci(r),r):(Ci(r),null);if((r.flags&128)!==0)throw Error(s(558))}return nt(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=_s(r),u!==null&&u.dehydrated!==null){if(i===null){if(!d)throw Error(s(318));if(d=r.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(s(317));d[Pt]=r}else Er(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;nt(r),d=!1}else d=cc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(Ci(r),r):(Ci(r),null)}return Ci(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,i=i!==null&&i.memoizedState!==null,l&&(u=r.child,d=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(d=u.alternate.memoizedState.cachePool.pool),m=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(m=u.memoizedState.cachePool.pool),m!==d&&(u.flags|=2048)),l!==i&&l&&(r.child.flags|=8192),mo(r,r.updateQueue),nt(r),null);case 4:return Se(),i===null&&xh(r.stateNode.containerInfo),nt(r),null;case 10:return yn(r.type),nt(r),null;case 19:if(V(pt),u=r.memoizedState,u===null)return nt(r),null;if(d=(r.flags&128)!==0,m=u.rendering,m===null)if(d)kl(u,!1);else{if(ct!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=to(i),m!==null){for(r.flags|=128,kl(u,!1),i=m.updateQueue,r.updateQueue=i,mo(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)Xp(l,i),l=l.sibling;return w(pt,pt.current&1|2),je&&gn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&Jt()>bo&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304)}else{if(!d)if(i=to(m),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,mo(r,i),kl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!je)return nt(r),null}else 2*Jt()-u.renderingStartTime>bo&&l!==536870912&&(r.flags|=128,d=!0,kl(u,!1),r.lanes=4194304);u.isBackwards?(m.sibling=r.child,r.child=m):(i=u.last,i!==null?i.sibling=m:r.child=m,u.last=m)}return u.tail!==null?(i=u.tail,u.rendering=i,u.tail=i.sibling,u.renderingStartTime=Jt(),i.sibling=null,l=pt.current,w(pt,d?l&1|2:l&1),je&&gn(r,u.treeForkCount),i):(nt(r),null);case 22:case 23:return Ci(r),wc(),u=r.memoizedState!==null,i!==null?i.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(nt(r),r.subtreeFlags&6&&(r.flags|=8192)):nt(r),l=r.updateQueue,l!==null&&mo(r,l.retryQueue),l=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),i!==null&&V(Dr),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yn(gt),nt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function y1(i,r){switch(oc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return yn(gt),Se(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Fe(r),null;case 31:if(r.memoizedState!==null){if(Ci(r),r.alternate===null)throw Error(s(340));Er()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(Ci(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Er()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return V(pt),null;case 4:return Se(),null;case 10:return yn(r.type),null;case 22:case 23:return Ci(r),wc(),i!==null&&V(Dr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return yn(gt),null;case 25:return null;default:return null}}function S_(i,r){switch(oc(r),r.tag){case 3:yn(gt),Se();break;case 26:case 27:case 5:Fe(r);break;case 4:Se();break;case 31:r.memoizedState!==null&&Ci(r);break;case 13:Ci(r);break;case 19:V(pt);break;case 10:yn(r.type);break;case 22:case 23:Ci(r),wc(),i!==null&&V(Dr);break;case 24:yn(gt)}}function El(i,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){u=void 0;var m=l.create,v=l.inst;u=m(),v.destroy=u}l=l.next}while(l!==d)}}catch(C){Ve(r,r.return,C)}}function Gn(i,r,l){try{var u=r.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var m=d.next;u=m;do{if((u.tag&i)===i){var v=u.inst,C=v.destroy;if(C!==void 0){v.destroy=void 0,d=r;var M=l,W=C;try{W()}catch(G){Ve(d,M,G)}}}u=u.next}while(u!==m)}}catch(G){Ve(r,r.return,G)}}function x_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{fm(r,l)}catch(u){Ve(i,i.return,u)}}}function w_(i,r,l){l.props=Lr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){Ve(i,r,u)}}function Tl(i,r){try{var l=i.ref;if(l!==null){switch(i.tag){case 26:case 27:case 5:var u=i.stateNode;break;case 30:u=i.stateNode;break;default:u=i.stateNode}typeof l=="function"?i.refCleanup=l(u):l.current=u}}catch(d){Ve(i,r,d)}}function tn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){Ve(i,r,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){Ve(i,r,d)}else l.current=null}function C_(i){var r=i.type,l=i.memoizedProps,u=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(d){Ve(i,i.return,d)}}function th(i,r,l){try{var u=i.stateNode;I1(u,i.type,l,r),u[ui]=r}catch(d){Ve(i,i.return,d)}}function k_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&nr(i.type)||i.tag===4}function ih(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||k_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&nr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nh(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(i,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(i),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=pn));else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(nh(i,r,l),i=i.sibling;i!==null;)nh(i,r,l),i=i.sibling}function _o(i,r,l){var u=i.tag;if(u===5||u===6)i=i.stateNode,r?l.insertBefore(i,r):l.appendChild(i);else if(u!==4&&(u===27&&nr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(_o(i,r,l),i=i.sibling;i!==null;)_o(i,r,l),i=i.sibling}function E_(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);Wt(r,u,l),r[Pt]=i,r[ui]=l}catch(m){Ve(i,i.return,m)}}var Cn=!1,bt=!1,rh=!1,T_=typeof WeakSet=="function"?WeakSet:Set,Mt=null;function b1(i,r){if(i=i.containerInfo,kh=jo,i=Up(i),Zu(i)){if("selectionStart"in i)var l={start:i.selectionStart,end:i.selectionEnd};else e:{l=(l=i.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var d=u.anchorOffset,m=u.focusNode;u=u.focusOffset;try{l.nodeType,m.nodeType}catch{l=null;break e}var v=0,C=-1,M=-1,W=0,G=0,ne=i,K=null;t:for(;;){for(var X;ne!==l||d!==0&&ne.nodeType!==3||(C=v+d),ne!==m||u!==0&&ne.nodeType!==3||(M=v+u),ne.nodeType===3&&(v+=ne.nodeValue.length),(X=ne.firstChild)!==null;)K=ne,ne=X;for(;;){if(ne===i)break t;if(K===l&&++W===d&&(C=v),K===m&&++G===u&&(M=v),(X=ne.nextSibling)!==null)break;ne=K,K=ne.parentNode}ne=X}l=C===-1||M===-1?null:{start:C,end:M}}else l=null}l=l||{start:0,end:0}}else l=null;for(Eh={focusedElem:i,selectionRange:l},jo=!1,Mt=r;Mt!==null;)if(r=Mt,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Mt=i;else for(;Mt!==null;){switch(r=Mt,m=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(l=0;l<i.length;l++)d=i[l],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,l=r,d=m.memoizedProps,m=m.memoizedState,u=l.stateNode;try{var me=Lr(l.type,d);i=u.getSnapshotBeforeUpdate(me,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(be){Ve(l,l.return,be)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Dh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=r.sibling,i!==null){i.return=r.return,Mt=i;break}Mt=r.return}}function A_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:En(i,l),u&4&&El(5,l);break;case 1:if(En(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(v){Ve(l,l.return,v)}else{var d=Lr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ve(l,l.return,v)}}u&64&&x_(l),u&512&&Tl(l,l.return);break;case 3:if(En(i,l),u&64&&(i=l.updateQueue,i!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{fm(i,r)}catch(v){Ve(l,l.return,v)}}break;case 27:r===null&&u&4&&E_(l);case 26:case 5:En(i,l),r===null&&u&4&&C_(l),u&512&&Tl(l,l.return);break;case 12:En(i,l);break;case 31:En(i,l),u&4&&M_(i,l);break;case 13:En(i,l),u&4&&B_(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=D1.bind(null,l),$1(i,l))));break;case 22:if(u=l.memoizedState!==null||Cn,!u){r=r!==null&&r.memoizedState!==null||bt,d=Cn;var m=bt;Cn=u,(bt=r)&&!m?Tn(i,l,(l.subtreeFlags&8772)!==0):En(i,l),Cn=d,bt=m}break;case 30:break;default:En(i,l)}}function D_(i){var r=i.alternate;r!==null&&(i.alternate=null,D_(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Lu(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var st=null,hi=!1;function kn(i,r,l){for(l=l.child;l!==null;)R_(i,r,l),l=l.sibling}function R_(i,r,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(ei,l)}catch{}switch(l.tag){case 26:bt||tn(l,r),kn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:bt||tn(l,r);var u=st,d=hi;nr(l.type)&&(st=l.stateNode,hi=!1),kn(i,r,l),Ol(l.stateNode),st=u,hi=d;break;case 5:bt||tn(l,r);case 6:if(u=st,d=hi,st=null,kn(i,r,l),st=u,hi=d,st!==null)if(hi)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(l.stateNode)}catch(m){Ve(l,r,m)}else try{st.removeChild(l.stateNode)}catch(m){Ve(l,r,m)}break;case 18:st!==null&&(hi?(i=st,xg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),js(i)):xg(st,l.stateNode));break;case 4:u=st,d=hi,st=l.stateNode.containerInfo,hi=!0,kn(i,r,l),st=u,hi=d;break;case 0:case 11:case 14:case 15:Gn(2,l,r),bt||Gn(4,l,r),kn(i,r,l);break;case 1:bt||(tn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&w_(l,r,u)),kn(i,r,l);break;case 21:kn(i,r,l);break;case 22:bt=(u=bt)||l.memoizedState!==null,kn(i,r,l),bt=u;break;default:kn(i,r,l)}}function M_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{js(i)}catch(l){Ve(r,r.return,l)}}}function B_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{js(i)}catch(l){Ve(r,r.return,l)}}function S1(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new T_),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new T_),r;default:throw Error(s(435,i.tag))}}function go(i,r){var l=S1(i);r.forEach(function(u){if(!l.has(u)){l.add(u);var d=R1.bind(null,i,u);u.then(d,d)}})}function fi(i,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var d=l[u],m=i,v=r,C=v;e:for(;C!==null;){switch(C.tag){case 27:if(nr(C.type)){st=C.stateNode,hi=!1;break e}break;case 5:st=C.stateNode,hi=!1;break e;case 3:case 4:st=C.stateNode.containerInfo,hi=!0;break e}C=C.return}if(st===null)throw Error(s(160));R_(m,v,d),st=null,hi=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)N_(r,i),r=r.sibling}var $i=null;function N_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:fi(r,i),di(i),u&4&&(Gn(3,i,i.return),El(3,i),Gn(5,i,i.return));break;case 1:fi(r,i),di(i),u&512&&(bt||l===null||tn(l,l.return)),u&64&&Cn&&(i=i.updateQueue,i!==null&&(u=i.callbacks,u!==null&&(l=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var d=$i;if(fi(r,i),di(i),u&512&&(bt||l===null||tn(l,l.return)),u&4){var m=l!==null?l.memoizedState:null;if(u=i.memoizedState,l===null)if(u===null)if(i.stateNode===null){e:{u=i.type,l=i.memoizedProps,d=d.ownerDocument||d;t:switch(u){case"title":m=d.getElementsByTagName("title")[0],(!m||m[el]||m[Pt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(u),d.head.insertBefore(m,d.querySelector("head > title"))),Wt(m,u,l),m[Pt]=i,Rt(m),u=m;break e;case"link":var v=Ng("link","href",d).get(u+(l.href||""));if(v){for(var C=0;C<v.length;C++)if(m=v[C],m.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&m.getAttribute("rel")===(l.rel==null?null:l.rel)&&m.getAttribute("title")===(l.title==null?null:l.title)&&m.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){v.splice(C,1);break t}}m=d.createElement(u),Wt(m,u,l),d.head.appendChild(m);break;case"meta":if(v=Ng("meta","content",d).get(u+(l.content||""))){for(C=0;C<v.length;C++)if(m=v[C],m.getAttribute("content")===(l.content==null?null:""+l.content)&&m.getAttribute("name")===(l.name==null?null:l.name)&&m.getAttribute("property")===(l.property==null?null:l.property)&&m.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&m.getAttribute("charset")===(l.charSet==null?null:l.charSet)){v.splice(C,1);break t}}m=d.createElement(u),Wt(m,u,l),d.head.appendChild(m);break;default:throw Error(s(468,u))}m[Pt]=i,Rt(m),u=m}i.stateNode=u}else Lg(d,i.type,i.stateNode);else i.stateNode=Bg(d,u,i.memoizedProps);else m!==u?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,u===null?Lg(d,i.type,i.stateNode):Bg(d,u,i.memoizedProps)):u===null&&i.stateNode!==null&&th(i,i.memoizedProps,l.memoizedProps)}break;case 27:fi(r,i),di(i),u&512&&(bt||l===null||tn(l,l.return)),l!==null&&u&4&&th(i,i.memoizedProps,l.memoizedProps);break;case 5:if(fi(r,i),di(i),u&512&&(bt||l===null||tn(l,l.return)),i.flags&32){d=i.stateNode;try{ls(d,"")}catch(me){Ve(i,i.return,me)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,th(i,d,l!==null?l.memoizedProps:d)),u&1024&&(rh=!0);break;case 6:if(fi(r,i),di(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(me){Ve(i,i.return,me)}}break;case 3:if(No=null,d=$i,$i=Mo(r.containerInfo),fi(r,i),$i=d,di(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{js(r.containerInfo)}catch(me){Ve(i,i.return,me)}rh&&(rh=!1,L_(i));break;case 4:u=$i,$i=Mo(i.stateNode.containerInfo),fi(r,i),di(i),$i=u;break;case 12:fi(r,i),di(i);break;case 31:fi(r,i),di(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 13:fi(r,i),di(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(yo=Jt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 22:d=i.memoizedState!==null;var M=l!==null&&l.memoizedState!==null,W=Cn,G=bt;if(Cn=W||d,bt=G||M,fi(r,i),bt=G,Cn=W,di(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||M||Cn||bt||zr(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){M=l=r;try{if(m=M.stateNode,d)v=m.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{C=M.stateNode;var ne=M.memoizedProps.style,K=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;C.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(me){Ve(M,M.return,me)}}}else if(r.tag===6){if(l===null){M=r;try{M.stateNode.nodeValue=d?"":M.memoizedProps}catch(me){Ve(M,M.return,me)}}}else if(r.tag===18){if(l===null){M=r;try{var X=M.stateNode;d?wg(X,!0):wg(M.stateNode,!1)}catch(me){Ve(M,M.return,me)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=i.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,go(i,l))));break;case 19:fi(r,i),di(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,go(i,u)));break;case 30:break;case 21:break;default:fi(r,i),di(i)}}function di(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(k_(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,m=ih(i);_o(i,m,d);break;case 5:var v=l.stateNode;l.flags&32&&(ls(v,""),l.flags&=-33);var C=ih(i);_o(i,C,v);break;case 3:case 4:var M=l.stateNode.containerInfo,W=ih(i);nh(i,W,M);break;default:throw Error(s(161))}}catch(G){Ve(i,i.return,G)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function L_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;L_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function En(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)A_(i,r.alternate,r),r=r.sibling}function zr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:Gn(4,r,r.return),zr(r);break;case 1:tn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&w_(r,r.return,l),zr(r);break;case 27:Ol(r.stateNode);case 26:case 5:tn(r,r.return),zr(r);break;case 22:r.memoizedState===null&&zr(r);break;case 30:zr(r);break;default:zr(r)}i=i.sibling}}function Tn(i,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,d=i,m=r,v=m.flags;switch(m.tag){case 0:case 11:case 15:Tn(d,m,l),El(4,m);break;case 1:if(Tn(d,m,l),u=m,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(W){Ve(u,u.return,W)}if(u=m,d=u.updateQueue,d!==null){var C=u.stateNode;try{var M=d.shared.hiddenCallbacks;if(M!==null)for(d.shared.hiddenCallbacks=null,d=0;d<M.length;d++)hm(M[d],C)}catch(W){Ve(u,u.return,W)}}l&&v&64&&x_(m),Tl(m,m.return);break;case 27:E_(m);case 26:case 5:Tn(d,m,l),l&&u===null&&v&4&&C_(m),Tl(m,m.return);break;case 12:Tn(d,m,l);break;case 31:Tn(d,m,l),l&&v&4&&M_(d,m);break;case 13:Tn(d,m,l),l&&v&4&&B_(d,m);break;case 22:m.memoizedState===null&&Tn(d,m,l),Tl(m,m.return);break;case 30:break;default:Tn(d,m,l)}r=r.sibling}}function sh(i,r){var l=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==l&&(i!=null&&i.refCount++,l!=null&&dl(l))}function lh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i))}function Gi(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)z_(i,r,l,u),r=r.sibling}function z_(i,r,l,u){var d=r.flags;switch(r.tag){case 0:case 11:case 15:Gi(i,r,l,u),d&2048&&El(9,r);break;case 1:Gi(i,r,l,u);break;case 3:Gi(i,r,l,u),d&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&dl(i)));break;case 12:if(d&2048){Gi(i,r,l,u),i=r.stateNode;try{var m=r.memoizedProps,v=m.id,C=m.onPostCommit;typeof C=="function"&&C(v,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(M){Ve(r,r.return,M)}}else Gi(i,r,l,u);break;case 31:Gi(i,r,l,u);break;case 13:Gi(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,v=r.alternate,r.memoizedState!==null?m._visibility&2?Gi(i,r,l,u):Al(i,r):m._visibility&2?Gi(i,r,l,u):(m._visibility|=2,Es(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&sh(v,r);break;case 24:Gi(i,r,l,u),d&2048&&lh(r.alternate,r);break;default:Gi(i,r,l,u)}}function Es(i,r,l,u,d){for(d=d&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var m=i,v=r,C=l,M=u,W=v.flags;switch(v.tag){case 0:case 11:case 15:Es(m,v,C,M,d),El(8,v);break;case 23:break;case 22:var G=v.stateNode;v.memoizedState!==null?G._visibility&2?Es(m,v,C,M,d):Al(m,v):(G._visibility|=2,Es(m,v,C,M,d)),d&&W&2048&&sh(v.alternate,v);break;case 24:Es(m,v,C,M,d),d&&W&2048&&lh(v.alternate,v);break;default:Es(m,v,C,M,d)}r=r.sibling}}function Al(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=i,u=r,d=u.flags;switch(u.tag){case 22:Al(l,u),d&2048&&sh(u.alternate,u);break;case 24:Al(l,u),d&2048&&lh(u.alternate,u);break;default:Al(l,u)}r=r.sibling}}var Dl=8192;function Ts(i,r,l){if(i.subtreeFlags&Dl)for(i=i.child;i!==null;)O_(i,r,l),i=i.sibling}function O_(i,r,l){switch(i.tag){case 26:Ts(i,r,l),i.flags&Dl&&i.memoizedState!==null&&ax(l,$i,i.memoizedState,i.memoizedProps);break;case 5:Ts(i,r,l);break;case 3:case 4:var u=$i;$i=Mo(i.stateNode.containerInfo),Ts(i,r,l),$i=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=Dl,Dl=16777216,Ts(i,r,l),Dl=u):Ts(i,r,l));break;default:Ts(i,r,l)}}function j_(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Rl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Mt=u,U_(u,i)}j_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)H_(i),i=i.sibling}function H_(i){switch(i.tag){case 0:case 11:case 15:Rl(i),i.flags&2048&&Gn(9,i,i.return);break;case 3:Rl(i);break;case 12:Rl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,vo(i)):Rl(i);break;default:Rl(i)}}function vo(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Mt=u,U_(u,i)}j_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:Gn(8,r,r.return),vo(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,vo(r));break;default:vo(r)}i=i.sibling}}function U_(i,r){for(;Mt!==null;){var l=Mt;switch(l.tag){case 0:case 11:case 15:Gn(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:dl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Mt=u;else e:for(l=i;Mt!==null;){u=Mt;var d=u.sibling,m=u.return;if(D_(u),u===l){Mt=null;break e}if(d!==null){d.return=m,Mt=d;break e}Mt=m}}}var x1={getCacheForType:function(i){var r=Ft(gt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return Ft(gt).controller.signal}},w1=typeof WeakMap=="function"?WeakMap:Map,qe=0,Je=null,Be=null,ze=0,Ye=0,ki=null,Zn=!1,As=!1,ah=!1,An=0,ct=0,Qn=0,Or=0,oh=0,Ei=0,Ds=0,Ml=null,pi=null,uh=!1,yo=0,P_=0,bo=1/0,So=null,Jn=null,kt=0,er=null,Rs=null,Dn=0,ch=0,hh=null,I_=null,Bl=0,fh=null;function Ti(){return(qe&2)!==0&&ze!==0?ze&-ze:A.T!==null?vh():np()}function F_(){if(Ei===0)if((ze&536870912)===0||je){var i=Aa;Aa<<=1,(Aa&3932160)===0&&(Aa=262144),Ei=i}else Ei=536870912;return i=wi.current,i!==null&&(i.flags|=32),Ei}function mi(i,r,l){(i===Je&&(Ye===2||Ye===9)||i.cancelPendingCommit!==null)&&(Ms(i,0),tr(i,ze,Ei,!1)),Js(i,l),((qe&2)===0||i!==Je)&&(i===Je&&((qe&2)===0&&(Or|=l),ct===4&&tr(i,ze,Ei,!1)),nn(i))}function q_(i,r,l){if((qe&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||Qs(i,r),d=u?E1(i,r):ph(i,r,!0),m=u;do{if(d===0){As&&!u&&tr(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!C1(l)){d=ph(i,r,!1),m=!1;continue}if(d===2){if(m=r,i.errorRecoveryDisabledLanes&m)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){r=v;e:{var C=i;d=Ml;var M=C.current.memoizedState.isDehydrated;if(M&&(Ms(C,v).flags|=256),v=ph(C,v,!1),v!==2){if(ah&&!M){C.errorRecoveryDisabledLanes|=m,Or|=m,d=4;break e}m=pi,pi=d,m!==null&&(pi===null?pi=m:pi.push.apply(pi,m))}d=v}if(m=!1,d!==2)continue}}if(d===1){Ms(i,0),tr(i,r,0,!0);break}e:{switch(u=i,m=d,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:tr(u,r,Ei,!Zn);break e;case 2:pi=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=yo+300-Jt(),10<d)){if(tr(u,r,Ei,!Zn),Ra(u,0,!0)!==0)break e;Dn=r,u.timeoutHandle=bg(W_.bind(null,u,l,pi,So,uh,r,Ei,Or,Ds,Zn,m,"Throttled",-0,0),d);break e}W_(u,l,pi,So,uh,r,Ei,Or,Ds,Zn,m,null,-0,0)}}break}while(!0);nn(i)}function W_(i,r,l,u,d,m,v,C,M,W,G,ne,K,X){if(i.timeoutHandle=-1,ne=r.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pn},O_(r,m,ne);var me=(m&62914560)===m?yo-Jt():(m&4194048)===m?P_-Jt():0;if(me=ox(ne,me),me!==null){Dn=m,i.cancelPendingCommit=me(Q_.bind(null,i,r,m,l,u,d,v,C,M,G,ne,null,K,X)),tr(i,m,v,!W);return}}Q_(i,r,m,l,u,d,v,C,M)}function C1(i){for(var r=i;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var d=l[u],m=d.getSnapshot;d=d.value;try{if(!Si(m(),d))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function tr(i,r,l,u){r&=~oh,r&=~Or,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var m=31-Qe(d),v=1<<m;u[m]=-1,d&=~v}l!==0&&ep(i,l,r)}function xo(){return(qe&6)===0?(Nl(0),!1):!0}function dh(){if(Be!==null){if(Ye===0)var i=Be.return;else i=Be,vn=Tr=null,Dc(i),Ss=null,ml=0,i=Be;for(;i!==null;)S_(i.alternate,i),i=i.return;Be=null}}function Ms(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,W1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Dn=0,dh(),Je=i,Be=l=_n(i.current,null),ze=r,Ye=0,ki=null,Zn=!1,As=Qs(i,r),ah=!1,Ds=Ei=oh=Or=Qn=ct=0,pi=Ml=null,uh=!1,(r&8)!==0&&(r|=r&32);var u=i.entangledLanes;if(u!==0)for(i=i.entanglements,u&=r;0<u;){var d=31-Qe(u),m=1<<d;r|=i[d],u&=~m}return An=r,Fa(),l}function Y_(i,r){ke=null,A.H=wl,r===bs||r===Ga?(r=am(),Ye=3):r===gc?(r=am(),Ye=4):Ye=r===Yc?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,ki=r,Be===null&&(ct=1,co(i,zi(r,i.current)))}function V_(){var i=wi.current;return i===null?!0:(ze&4194048)===ze?Ui===null:(ze&62914560)===ze||(ze&536870912)!==0?i===Ui:!1}function K_(){var i=A.H;return A.H=wl,i===null?wl:i}function X_(){var i=A.A;return A.A=x1,i}function wo(){ct=4,Zn||(ze&4194048)!==ze&&wi.current!==null||(As=!0),(Qn&134217727)===0&&(Or&134217727)===0||Je===null||tr(Je,ze,Ei,!1)}function ph(i,r,l){var u=qe;qe|=2;var d=K_(),m=X_();(Je!==i||ze!==r)&&(So=null,Ms(i,r)),r=!1;var v=ct;e:do try{if(Ye!==0&&Be!==null){var C=Be,M=ki;switch(Ye){case 8:dh(),v=6;break e;case 3:case 2:case 9:case 6:wi.current===null&&(r=!0);var W=Ye;if(Ye=0,ki=null,Bs(i,C,M,W),l&&As){v=0;break e}break;default:W=Ye,Ye=0,ki=null,Bs(i,C,M,W)}}k1(),v=ct;break}catch(G){Y_(i,G)}while(!0);return r&&i.shellSuspendCounter++,vn=Tr=null,qe=u,A.H=d,A.A=m,Be===null&&(Je=null,ze=0,Fa()),v}function k1(){for(;Be!==null;)$_(Be)}function E1(i,r){var l=qe;qe|=2;var u=K_(),d=X_();Je!==i||ze!==r?(So=null,bo=Jt()+500,Ms(i,r)):As=Qs(i,r);e:do try{if(Ye!==0&&Be!==null){r=Be;var m=ki;t:switch(Ye){case 1:Ye=0,ki=null,Bs(i,r,m,1);break;case 2:case 9:if(sm(m)){Ye=0,ki=null,G_(r);break}r=function(){Ye!==2&&Ye!==9||Je!==i||(Ye=7),nn(i)},m.then(r,r);break e;case 3:Ye=7;break e;case 4:Ye=5;break e;case 7:sm(m)?(Ye=0,ki=null,G_(r)):(Ye=0,ki=null,Bs(i,r,m,7));break;case 5:var v=null;switch(Be.tag){case 26:v=Be.memoizedState;case 5:case 27:var C=Be;if(v?zg(v):C.stateNode.complete){Ye=0,ki=null;var M=C.sibling;if(M!==null)Be=M;else{var W=C.return;W!==null?(Be=W,Co(W)):Be=null}break t}}Ye=0,ki=null,Bs(i,r,m,5);break;case 6:Ye=0,ki=null,Bs(i,r,m,6);break;case 8:dh(),ct=6;break e;default:throw Error(s(462))}}T1();break}catch(G){Y_(i,G)}while(!0);return vn=Tr=null,A.H=u,A.A=d,qe=l,Be!==null?0:(Je=null,ze=0,Fa(),ct)}function T1(){for(;Be!==null&&!Tu();)$_(Be)}function $_(i){var r=y_(i.alternate,i,An);i.memoizedProps=i.pendingProps,r===null?Co(i):Be=r}function G_(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=d_(l,r,r.pendingProps,r.type,void 0,ze);break;case 11:r=d_(l,r,r.pendingProps,r.type.render,r.ref,ze);break;case 5:Dc(r);default:S_(l,r),r=Be=Xp(r,An),r=y_(l,r,An)}i.memoizedProps=i.pendingProps,r===null?Co(i):Be=r}function Bs(i,r,l,u){vn=Tr=null,Dc(r),Ss=null,ml=0;var d=r.return;try{if(m1(i,d,r,l,ze)){ct=1,co(i,zi(l,i.current)),Be=null;return}}catch(m){if(d!==null)throw Be=d,m;ct=1,co(i,zi(l,i.current)),Be=null;return}r.flags&32768?(je||u===1?i=!0:As||(ze&536870912)!==0?i=!1:(Zn=i=!0,(u===2||u===9||u===3||u===6)&&(u=wi.current,u!==null&&u.tag===13&&(u.flags|=16384))),Z_(r,i)):Co(r)}function Co(i){var r=i;do{if((r.flags&32768)!==0){Z_(r,Zn);return}i=r.return;var l=v1(r.alternate,r,An);if(l!==null){Be=l;return}if(r=r.sibling,r!==null){Be=r;return}Be=r=i}while(r!==null);ct===0&&(ct=5)}function Z_(i,r){do{var l=y1(i.alternate,i);if(l!==null){l.flags&=32767,Be=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Be=i;return}Be=i=l}while(i!==null);ct=6,Be=null}function Q_(i,r,l,u,d,m,v,C,M){i.cancelPendingCommit=null;do ko();while(kt!==0);if((qe&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=ic,l0(i,l,m,v,C,M),i===Je&&(Be=Je=null,ze=0),Rs=r,er=i,Dn=l,ch=m,hh=d,I_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,M1(xe,function(){return ng(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=A.T,A.T=null,d=j.p,j.p=2,v=qe,qe|=4;try{b1(i,r,l)}finally{qe=v,j.p=d,A.T=u}}kt=1,J_(),eg(),tg()}}function J_(){if(kt===1){kt=0;var i=er,r=Rs,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=A.T,A.T=null;var u=j.p;j.p=2;var d=qe;qe|=4;try{N_(r,i);var m=Eh,v=Up(i.containerInfo),C=m.focusedElem,M=m.selectionRange;if(v!==C&&C&&C.ownerDocument&&Hp(C.ownerDocument.documentElement,C)){if(M!==null&&Zu(C)){var W=M.start,G=M.end;if(G===void 0&&(G=W),"selectionStart"in C)C.selectionStart=W,C.selectionEnd=Math.min(G,C.value.length);else{var ne=C.ownerDocument||document,K=ne&&ne.defaultView||window;if(K.getSelection){var X=K.getSelection(),me=C.textContent.length,be=Math.min(M.start,me),$e=M.end===void 0?be:Math.min(M.end,me);!X.extend&&be>$e&&(v=$e,$e=be,be=v);var U=jp(C,be),z=jp(C,$e);if(U&&z&&(X.rangeCount!==1||X.anchorNode!==U.node||X.anchorOffset!==U.offset||X.focusNode!==z.node||X.focusOffset!==z.offset)){var q=ne.createRange();q.setStart(U.node,U.offset),X.removeAllRanges(),be>$e?(X.addRange(q),X.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),X.addRange(q))}}}}for(ne=[],X=C;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ne.length;C++){var te=ne[C];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}jo=!!kh,Eh=kh=null}finally{qe=d,j.p=u,A.T=l}}i.current=r,kt=2}}function eg(){if(kt===2){kt=0;var i=er,r=Rs,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=A.T,A.T=null;var u=j.p;j.p=2;var d=qe;qe|=4;try{A_(i,r.alternate,r)}finally{qe=d,j.p=u,A.T=l}}kt=3}}function tg(){if(kt===4||kt===3){kt=0,Au();var i=er,r=Rs,l=Dn,u=I_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?kt=5:(kt=0,Rs=er=null,ig(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(Jn=null),Bu(l),r=r.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(ei,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=A.T,d=j.p,j.p=2,A.T=null;try{for(var m=i.onRecoverableError,v=0;v<u.length;v++){var C=u[v];m(C.value,{componentStack:C.stack})}}finally{A.T=r,j.p=d}}(Dn&3)!==0&&ko(),nn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===fh?Bl++:(Bl=0,fh=i):Bl=0,Nl(0)}}function ig(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,dl(r)))}function ko(){return J_(),eg(),tg(),ng()}function ng(){if(kt!==5)return!1;var i=er,r=ch;ch=0;var l=Bu(Dn),u=A.T,d=j.p;try{j.p=32>l?32:l,A.T=null,l=hh,hh=null;var m=er,v=Dn;if(kt=0,Rs=er=null,Dn=0,(qe&6)!==0)throw Error(s(331));var C=qe;if(qe|=4,H_(m.current),z_(m,m.current,v,l),qe=C,Nl(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(ei,m)}catch{}return!0}finally{j.p=d,A.T=u,ig(i,r)}}function rg(i,r,l){r=zi(l,r),r=Wc(i.stateNode,r,2),i=Kn(i,r,2),i!==null&&(Js(i,2),nn(i))}function Ve(i,r,l){if(i.tag===3)rg(i,i,l);else for(;r!==null;){if(r.tag===3){rg(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Jn===null||!Jn.has(u))){i=zi(l,i),l=s_(2),u=Kn(r,l,2),u!==null&&(l_(l,u,r,i),Js(u,2),nn(u));break}}r=r.return}}function mh(i,r,l){var u=i.pingCache;if(u===null){u=i.pingCache=new w1;var d=new Set;u.set(r,d)}else d=u.get(r),d===void 0&&(d=new Set,u.set(r,d));d.has(l)||(ah=!0,d.add(l),i=A1.bind(null,i,r,l),r.then(i,i))}function A1(i,r,l){var u=i.pingCache;u!==null&&u.delete(r),i.pingedLanes|=i.suspendedLanes&l,i.warmLanes&=~l,Je===i&&(ze&l)===l&&(ct===4||ct===3&&(ze&62914560)===ze&&300>Jt()-yo?(qe&2)===0&&Ms(i,0):oh|=l,Ds===ze&&(Ds=0)),nn(i)}function sg(i,r){r===0&&(r=Jd()),i=Cr(i,r),i!==null&&(Js(i,r),nn(i))}function D1(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),sg(i,l)}function R1(i,r){var l=0;switch(i.tag){case 31:case 13:var u=i.stateNode,d=i.memoizedState;d!==null&&(l=d.retryLane);break;case 19:u=i.stateNode;break;case 22:u=i.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),sg(i,l)}function M1(i,r){return Jr(i,r)}var Eo=null,Ns=null,_h=!1,To=!1,gh=!1,ir=0;function nn(i){i!==Ns&&i.next===null&&(Ns===null?Eo=Ns=i:Ns=Ns.next=i),To=!0,_h||(_h=!0,N1())}function Nl(i,r){if(!gh&&To){gh=!0;do for(var l=!1,u=Eo;u!==null;){if(i!==0){var d=u.pendingLanes;if(d===0)var m=0;else{var v=u.suspendedLanes,C=u.pingedLanes;m=(1<<31-Qe(42|i)+1)-1,m&=d&~(v&~C),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,ug(u,m))}else m=ze,m=Ra(u,u===Je?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||Qs(u,m)||(l=!0,ug(u,m));u=u.next}while(l);gh=!1}}function B1(){lg()}function lg(){To=_h=!1;var i=0;ir!==0&&q1()&&(i=ir);for(var r=Jt(),l=null,u=Eo;u!==null;){var d=u.next,m=ag(u,r);m===0?(u.next=null,l===null?Eo=d:l.next=d,d===null&&(Ns=l)):(l=u,(i!==0||(m&3)!==0)&&(To=!0)),u=d}kt!==0&&kt!==5||Nl(i),ir!==0&&(ir=0)}function ag(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var v=31-Qe(m),C=1<<v,M=d[v];M===-1?((C&l)===0||(C&u)!==0)&&(d[v]=s0(C,r)):M<=r&&(i.expiredLanes|=C),m&=~C}if(r=Je,l=ze,l=Ra(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(Ye===2||Ye===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Zs(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||Qs(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Zs(u),Bu(l)){case 2:case 8:l=fe;break;case 32:l=xe;break;case 268435456:l=We;break;default:l=xe}return u=og.bind(null,i),l=Jr(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Zs(u),i.callbackPriority=2,i.callbackNode=null,2}function og(i,r){if(kt!==0&&kt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(ko()&&i.callbackNode!==l)return null;var u=ze;return u=Ra(i,i===Je?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(q_(i,u,r),ag(i,Jt()),i.callbackNode!=null&&i.callbackNode===l?og.bind(null,i):null)}function ug(i,r){if(ko())return null;q_(i,r,!0)}function N1(){Y1(function(){(qe&6)!==0?Jr(ee,B1):lg()})}function vh(){if(ir===0){var i=vs;i===0&&(i=Ta,Ta<<=1,(Ta&261888)===0&&(Ta=256)),ir=i}return ir}function cg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:La(""+i)}function hg(i,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,i.id&&l.setAttribute("form",i.id),r.parentNode.insertBefore(l,r),i=new FormData(i),l.parentNode.removeChild(l),i}function L1(i,r,l,u,d){if(r==="submit"&&l&&l.stateNode===d){var m=cg((d[ui]||null).action),v=u.submitter;v&&(r=(r=v[ui]||null)?cg(r.formAction):v.getAttribute("formAction"),r!==null&&(m=r,v=null));var C=new Ha("action","action",null,u,d);i.push({event:C,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ir!==0){var M=v?hg(d,v):new FormData(d);Hc(l,{pending:!0,data:M,method:d.method,action:m},null,M)}}else typeof m=="function"&&(C.preventDefault(),M=v?hg(d,v):new FormData(d),Hc(l,{pending:!0,data:M,method:d.method,action:m},m,M))},currentTarget:d}]})}}for(var yh=0;yh<tc.length;yh++){var bh=tc[yh],z1=bh.toLowerCase(),O1=bh[0].toUpperCase()+bh.slice(1);Xi(z1,"on"+O1)}Xi(Fp,"onAnimationEnd"),Xi(qp,"onAnimationIteration"),Xi(Wp,"onAnimationStart"),Xi("dblclick","onDoubleClick"),Xi("focusin","onFocus"),Xi("focusout","onBlur"),Xi(Q0,"onTransitionRun"),Xi(J0,"onTransitionStart"),Xi(e1,"onTransitionCancel"),Xi(Yp,"onTransitionEnd"),rs("onMouseEnter",["mouseout","mouseover"]),rs("onMouseLeave",["mouseout","mouseover"]),rs("onPointerEnter",["pointerout","pointerover"]),rs("onPointerLeave",["pointerout","pointerover"]),br("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),br("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),br("onBeforeInput",["compositionend","keypress","textInput","paste"]),br("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),br("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),br("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ll="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(" "),j1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ll));function fg(i,r){r=(r&4)!==0;for(var l=0;l<i.length;l++){var u=i[l],d=u.event;u=u.listeners;e:{var m=void 0;if(r)for(var v=u.length-1;0<=v;v--){var C=u[v],M=C.instance,W=C.currentTarget;if(C=C.listener,M!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=W;try{m(d)}catch(G){Ia(G)}d.currentTarget=null,m=M}else for(v=0;v<u.length;v++){if(C=u[v],M=C.instance,W=C.currentTarget,C=C.listener,M!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=W;try{m(d)}catch(G){Ia(G)}d.currentTarget=null,m=M}}}}function Ne(i,r){var l=r[Nu];l===void 0&&(l=r[Nu]=new Set);var u=i+"__bubble";l.has(u)||(dg(r,i,2,!1),l.add(u))}function Sh(i,r,l){var u=0;r&&(u|=4),dg(l,i,u,r)}var Ao="_reactListening"+Math.random().toString(36).slice(2);function xh(i){if(!i[Ao]){i[Ao]=!0,lp.forEach(function(l){l!=="selectionchange"&&(j1.has(l)||Sh(l,!1,i),Sh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[Ao]||(r[Ao]=!0,Sh("selectionchange",!1,r))}}function dg(i,r,l,u){switch(Fg(r)){case 2:var d=hx;break;case 8:d=fx;break;default:d=jh}l=d.bind(null,r,l,i),d=void 0,!Fu||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(d=!0),u?d!==void 0?i.addEventListener(r,l,{capture:!0,passive:d}):i.addEventListener(r,l,!0):d!==void 0?i.addEventListener(r,l,{passive:d}):i.addEventListener(r,l,!1)}function wh(i,r,l,u,d){var m=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var v=u.tag;if(v===3||v===4){var C=u.stateNode.containerInfo;if(C===d)break;if(v===4)for(v=u.return;v!==null;){var M=v.tag;if((M===3||M===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;C!==null;){if(v=ts(C),v===null)return;if(M=v.tag,M===5||M===6||M===26||M===27){u=m=v;continue e}C=C.parentNode}}u=u.return}vp(function(){var W=m,G=Pu(l),ne=[];e:{var K=Vp.get(i);if(K!==void 0){var X=Ha,me=i;switch(i){case"keypress":if(Oa(l)===0)break e;case"keydown":case"keyup":X=R0;break;case"focusin":me="focus",X=Vu;break;case"focusout":me="blur",X=Vu;break;case"beforeblur":case"afterblur":X=Vu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=Sp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=v0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=N0;break;case Fp:case qp:case Wp:X=S0;break;case Yp:X=z0;break;case"scroll":case"scrollend":X=_0;break;case"wheel":X=j0;break;case"copy":case"cut":case"paste":X=w0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=wp;break;case"toggle":case"beforetoggle":X=U0}var be=(r&4)!==0,$e=!be&&(i==="scroll"||i==="scrollend"),U=be?K!==null?K+"Capture":null:K;be=[];for(var z=W,q;z!==null;){var te=z;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||U===null||(te=il(z,U),te!=null&&be.push(zl(z,te,q))),$e)break;z=z.return}0<be.length&&(K=new X(K,me,null,l,G),ne.push({event:K,listeners:be}))}}if((r&7)===0){e:{if(K=i==="mouseover"||i==="pointerover",X=i==="mouseout"||i==="pointerout",K&&l!==Uu&&(me=l.relatedTarget||l.fromElement)&&(ts(me)||me[es]))break e;if((X||K)&&(K=G.window===G?G:(K=G.ownerDocument)?K.defaultView||K.parentWindow:window,X?(me=l.relatedTarget||l.toElement,X=W,me=me?ts(me):null,me!==null&&($e=o(me),be=me.tag,me!==$e||be!==5&&be!==27&&be!==6)&&(me=null)):(X=null,me=W),X!==me)){if(be=Sp,te="onMouseLeave",U="onMouseEnter",z="mouse",(i==="pointerout"||i==="pointerover")&&(be=wp,te="onPointerLeave",U="onPointerEnter",z="pointer"),$e=X==null?K:tl(X),q=me==null?K:tl(me),K=new be(te,z+"leave",X,l,G),K.target=$e,K.relatedTarget=q,te=null,ts(G)===W&&(be=new be(U,z+"enter",me,l,G),be.target=q,be.relatedTarget=$e,te=be),$e=te,X&&me)t:{for(be=H1,U=X,z=me,q=0,te=U;te;te=be(te))q++;te=0;for(var ve=z;ve;ve=be(ve))te++;for(;0<q-te;)U=be(U),q--;for(;0<te-q;)z=be(z),te--;for(;q--;){if(U===z||z!==null&&U===z.alternate){be=U;break t}U=be(U),z=be(z)}be=null}else be=null;X!==null&&pg(ne,K,X,be,!1),me!==null&&$e!==null&&pg(ne,$e,me,be,!0)}}e:{if(K=W?tl(W):window,X=K.nodeName&&K.nodeName.toLowerCase(),X==="select"||X==="input"&&K.type==="file")var Pe=Mp;else if(Dp(K))if(Bp)Pe=$0;else{Pe=K0;var _e=V0}else X=K.nodeName,!X||X.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?W&&Hu(W.elementType)&&(Pe=Mp):Pe=X0;if(Pe&&(Pe=Pe(i,W))){Rp(ne,Pe,l,G);break e}_e&&_e(i,K,W),i==="focusout"&&W&&K.type==="number"&&W.memoizedProps.value!=null&&ju(K,"number",K.value)}switch(_e=W?tl(W):window,i){case"focusin":(Dp(_e)||_e.contentEditable==="true")&&(cs=_e,Qu=W,cl=null);break;case"focusout":cl=Qu=cs=null;break;case"mousedown":Ju=!0;break;case"contextmenu":case"mouseup":case"dragend":Ju=!1,Pp(ne,l,G);break;case"selectionchange":if(Z0)break;case"keydown":case"keyup":Pp(ne,l,G)}var Te;if(Xu)e:{switch(i){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else us?Tp(i,l)&&(Oe="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Oe="onCompositionStart");Oe&&(Cp&&l.locale!=="ko"&&(us||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&us&&(Te=yp()):(Pn=G,qu="value"in Pn?Pn.value:Pn.textContent,us=!0)),_e=Do(W,Oe),0<_e.length&&(Oe=new xp(Oe,i,null,l,G),ne.push({event:Oe,listeners:_e}),Te?Oe.data=Te:(Te=Ap(l),Te!==null&&(Oe.data=Te)))),(Te=I0?F0(i,l):q0(i,l))&&(Oe=Do(W,"onBeforeInput"),0<Oe.length&&(_e=new xp("onBeforeInput","beforeinput",null,l,G),ne.push({event:_e,listeners:Oe}),_e.data=Te)),L1(ne,i,W,l,G)}fg(ne,r)})}function zl(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Do(i,r){for(var l=r+"Capture",u=[];i!==null;){var d=i,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=il(i,l),d!=null&&u.unshift(zl(i,d,m)),d=il(i,r),d!=null&&u.push(zl(i,d,m))),i.tag===3)return u;i=i.return}return[]}function H1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function pg(i,r,l,u,d){for(var m=r._reactName,v=[];l!==null&&l!==u;){var C=l,M=C.alternate,W=C.stateNode;if(C=C.tag,M!==null&&M===u)break;C!==5&&C!==26&&C!==27||W===null||(M=W,d?(W=il(l,m),W!=null&&v.unshift(zl(l,W,M))):d||(W=il(l,m),W!=null&&v.push(zl(l,W,M)))),l=l.return}v.length!==0&&i.push({event:r,listeners:v})}var U1=/\r\n?/g,P1=/\u0000|\uFFFD/g;function mg(i){return(typeof i=="string"?i:""+i).replace(U1,`
49
+ `).replace(P1,"")}function _g(i,r){return r=mg(r),mg(i)===r}function Xe(i,r,l,u,d,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ls(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ls(i,""+u);break;case"className":Ba(i,"class",u);break;case"tabIndex":Ba(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ba(i,l,u);break;case"style":_p(i,u,m);break;case"data":if(r!=="object"){Ba(i,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){i.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){i.setAttribute(l,"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 m=="function"&&(l==="formAction"?(r!=="input"&&Xe(i,r,"name",d.name,d,null),Xe(i,r,"formEncType",d.formEncType,d,null),Xe(i,r,"formMethod",d.formMethod,d,null),Xe(i,r,"formTarget",d.formTarget,d,null)):(Xe(i,r,"encType",d.encType,d,null),Xe(i,r,"method",d.method,d,null),Xe(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=La(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=pn);break;case"onScroll":u!=null&&Ne("scroll",i);break;case"onScrollEnd":u!=null&&Ne("scrollend",i);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"multiple":i.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":i.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"){i.removeAttribute("xlink:href");break}l=La(""+u),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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"?i.setAttribute(l,""+u):i.removeAttribute(l);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"?i.setAttribute(l,""):i.removeAttribute(l);break;case"capture":case"download":u===!0?i.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?i.setAttribute(l,u):i.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?i.setAttribute(l,u):i.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?i.removeAttribute(l):i.setAttribute(l,u);break;case"popover":Ne("beforetoggle",i),Ne("toggle",i),Ma(i,"popover",u);break;case"xlinkActuate":dn(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":dn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":dn(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":dn(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":dn(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":dn(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":dn(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":dn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":dn(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ma(i,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=p0.get(l)||l,Ma(i,l,u))}}function Ch(i,r,l,u,d,m){switch(l){case"style":_p(i,u,m);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(l=u.__html,l!=null){if(d.children!=null)throw Error(s(60));i.innerHTML=l}}break;case"children":typeof u=="string"?ls(i,u):(typeof u=="number"||typeof u=="bigint")&&ls(i,""+u);break;case"onScroll":u!=null&&Ne("scroll",i);break;case"onScrollEnd":u!=null&&Ne("scrollend",i);break;case"onClick":u!=null&&(i.onclick=pn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ap.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),r=l.slice(2,d?l.length-7:void 0),m=i[ui]||null,m=m!=null?m[l]:null,typeof m=="function"&&i.removeEventListener(r,m,d),typeof u=="function")){typeof m!="function"&&m!==null&&(l in i?i[l]=null:i.hasAttribute(l)&&i.removeAttribute(l)),i.addEventListener(r,u,d);break e}l in i?i[l]=u:u===!0?i.setAttribute(l,""):Ma(i,l,u)}}}function Wt(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",i),Ne("load",i);var u=!1,d=!1,m;for(m in l)if(l.hasOwnProperty(m)){var v=l[m];if(v!=null)switch(m){case"src":u=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Xe(i,r,m,v,l,null)}}d&&Xe(i,r,"srcSet",l.srcSet,l,null),u&&Xe(i,r,"src",l.src,l,null);return;case"input":Ne("invalid",i);var C=m=v=d=null,M=null,W=null;for(u in l)if(l.hasOwnProperty(u)){var G=l[u];if(G!=null)switch(u){case"name":d=G;break;case"type":v=G;break;case"checked":M=G;break;case"defaultChecked":W=G;break;case"value":m=G;break;case"defaultValue":C=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,r));break;default:Xe(i,r,u,G,l,null)}}fp(i,m,C,M,W,v,d,!1);return;case"select":Ne("invalid",i),u=v=m=null;for(d in l)if(l.hasOwnProperty(d)&&(C=l[d],C!=null))switch(d){case"value":m=C;break;case"defaultValue":v=C;break;case"multiple":u=C;default:Xe(i,r,d,C,l,null)}r=m,l=v,i.multiple=!!u,r!=null?ss(i,!!u,r,!1):l!=null&&ss(i,!!u,l,!0);return;case"textarea":Ne("invalid",i),m=d=u=null;for(v in l)if(l.hasOwnProperty(v)&&(C=l[v],C!=null))switch(v){case"value":u=C;break;case"defaultValue":d=C;break;case"children":m=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(s(91));break;default:Xe(i,r,v,C,l,null)}pp(i,u,d,m);return;case"option":for(M in l)if(l.hasOwnProperty(M)&&(u=l[M],u!=null))switch(M){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Xe(i,r,M,u,l,null)}return;case"dialog":Ne("beforetoggle",i),Ne("toggle",i),Ne("cancel",i),Ne("close",i);break;case"iframe":case"object":Ne("load",i);break;case"video":case"audio":for(u=0;u<Ll.length;u++)Ne(Ll[u],i);break;case"image":Ne("error",i),Ne("load",i);break;case"details":Ne("toggle",i);break;case"embed":case"source":case"link":Ne("error",i),Ne("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in l)if(l.hasOwnProperty(W)&&(u=l[W],u!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Xe(i,r,W,u,l,null)}return;default:if(Hu(r)){for(G in l)l.hasOwnProperty(G)&&(u=l[G],u!==void 0&&Ch(i,r,G,u,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(u=l[C],u!=null&&Xe(i,r,C,u,l,null))}function I1(i,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,v=null,C=null,M=null,W=null,G=null;for(X in l){var ne=l[X];if(l.hasOwnProperty(X)&&ne!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":M=ne;default:u.hasOwnProperty(X)||Xe(i,r,X,null,u,ne)}}for(var K in u){var X=u[K];if(ne=l[K],u.hasOwnProperty(K)&&(X!=null||ne!=null))switch(K){case"type":m=X;break;case"name":d=X;break;case"checked":W=X;break;case"defaultChecked":G=X;break;case"value":v=X;break;case"defaultValue":C=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,r));break;default:X!==ne&&Xe(i,r,K,X,u,ne)}}Ou(i,v,C,M,W,G,m,d);return;case"select":X=v=C=K=null;for(m in l)if(M=l[m],l.hasOwnProperty(m)&&M!=null)switch(m){case"value":break;case"multiple":X=M;default:u.hasOwnProperty(m)||Xe(i,r,m,null,u,M)}for(d in u)if(m=u[d],M=l[d],u.hasOwnProperty(d)&&(m!=null||M!=null))switch(d){case"value":K=m;break;case"defaultValue":C=m;break;case"multiple":v=m;default:m!==M&&Xe(i,r,d,m,u,M)}r=C,l=v,u=X,K!=null?ss(i,!!l,K,!1):!!u!=!!l&&(r!=null?ss(i,!!l,r,!0):ss(i,!!l,l?[]:"",!1));return;case"textarea":X=K=null;for(C in l)if(d=l[C],l.hasOwnProperty(C)&&d!=null&&!u.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Xe(i,r,C,null,u,d)}for(v in u)if(d=u[v],m=l[v],u.hasOwnProperty(v)&&(d!=null||m!=null))switch(v){case"value":K=d;break;case"defaultValue":X=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&Xe(i,r,v,d,u,m)}dp(i,K,X);return;case"option":for(var me in l)if(K=l[me],l.hasOwnProperty(me)&&K!=null&&!u.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:Xe(i,r,me,null,u,K)}for(M in u)if(K=u[M],X=l[M],u.hasOwnProperty(M)&&K!==X&&(K!=null||X!=null))switch(M){case"selected":i.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:Xe(i,r,M,K,u,X)}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 l)K=l[be],l.hasOwnProperty(be)&&K!=null&&!u.hasOwnProperty(be)&&Xe(i,r,be,null,u,K);for(W in u)if(K=u[W],X=l[W],u.hasOwnProperty(W)&&K!==X&&(K!=null||X!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,r));break;default:Xe(i,r,W,K,u,X)}return;default:if(Hu(r)){for(var $e in l)K=l[$e],l.hasOwnProperty($e)&&K!==void 0&&!u.hasOwnProperty($e)&&Ch(i,r,$e,void 0,u,K);for(G in u)K=u[G],X=l[G],!u.hasOwnProperty(G)||K===X||K===void 0&&X===void 0||Ch(i,r,G,K,u,X);return}}for(var U in l)K=l[U],l.hasOwnProperty(U)&&K!=null&&!u.hasOwnProperty(U)&&Xe(i,r,U,null,u,K);for(ne in u)K=u[ne],X=l[ne],!u.hasOwnProperty(ne)||K===X||K==null&&X==null||Xe(i,r,ne,K,u,X)}function gg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function F1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var d=l[u],m=d.transferSize,v=d.initiatorType,C=d.duration;if(m&&C&&gg(v)){for(v=0,C=d.responseEnd,u+=1;u<l.length;u++){var M=l[u],W=M.startTime;if(W>C)break;var G=M.transferSize,ne=M.initiatorType;G&&gg(ne)&&(M=M.responseEnd,v+=G*(M<C?1:(C-W)/(M-W)))}if(--u,r+=8*(m+v)/(d.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var kh=null,Eh=null;function Ro(i){return i.nodeType===9?i:i.ownerDocument}function vg(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function yg(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function Th(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ah=null;function q1(){var i=window.event;return i&&i.type==="popstate"?i===Ah?!1:(Ah=i,!0):(Ah=null,!1)}var bg=typeof setTimeout=="function"?setTimeout:void 0,W1=typeof clearTimeout=="function"?clearTimeout:void 0,Sg=typeof Promise=="function"?Promise:void 0,Y1=typeof queueMicrotask=="function"?queueMicrotask:typeof Sg<"u"?function(i){return Sg.resolve(null).then(i).catch(V1)}:bg;function V1(i){setTimeout(function(){throw i})}function nr(i){return i==="head"}function xg(i,r){var l=r,u=0;do{var d=l.nextSibling;if(i.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(u===0){i.removeChild(d),js(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Ol(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Ol(l);for(var m=l.firstChild;m;){var v=m.nextSibling,C=m.nodeName;m[el]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=v}}else l==="body"&&Ol(i.ownerDocument.body);l=d}while(l);js(r)}function wg(i,r){var l=i;i=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(i===0)break;i--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||i++;l=u}while(l)}function Dh(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Dh(l),Lu(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}i.removeChild(l)}}function K1(i,r,l,u){for(;i.nodeType===1;){var d=l;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(u){if(!i[el])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Pi(i.nextSibling),i===null)break}return null}function X1(i,r,l){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Pi(i.nextSibling),i===null))return null;return i}function Cg(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Pi(i.nextSibling),i===null))return null;return i}function Rh(i){return i.data==="$?"||i.data==="$~"}function Mh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function $1(i,r){var l=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),i._reactRetry=u}}function Pi(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Bh=null;function kg(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return Pi(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function Eg(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return i;r--}else l!=="/$"&&l!=="/&"||r++}i=i.previousSibling}return null}function Tg(i,r,l){switch(r=Ro(l),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Ol(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Lu(i)}var Ii=new Map,Ag=new Set;function Mo(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Rn=j.d;j.d={f:G1,r:Z1,D:Q1,C:J1,L:ex,m:tx,X:nx,S:ix,M:rx};function G1(){var i=Rn.f(),r=xo();return i||r}function Z1(i){var r=is(i);r!==null&&r.tag===5&&r.type==="form"?Ym(r):Rn.r(i)}var Ls=typeof document>"u"?null:document;function Dg(i,r,l){var u=Ls;if(u&&typeof r=="string"&&r){var d=Ni(r);d='link[rel="'+i+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),Ag.has(d)||(Ag.add(d),i={rel:i,crossOrigin:l,href:r},u.querySelector(d)===null&&(r=u.createElement("link"),Wt(r,"link",i),Rt(r),u.head.appendChild(r)))}}function Q1(i){Rn.D(i),Dg("dns-prefetch",i,null)}function J1(i,r){Rn.C(i,r),Dg("preconnect",i,r)}function ex(i,r,l){Rn.L(i,r,l);var u=Ls;if(u&&i&&r){var d='link[rel="preload"][as="'+Ni(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Ni(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Ni(l.imageSizes)+'"]')):d+='[href="'+Ni(i)+'"]';var m=d;switch(r){case"style":m=zs(i);break;case"script":m=Os(i)}Ii.has(m)||(i=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),Ii.set(m,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(jl(m))||r==="script"&&u.querySelector(Hl(m))||(r=u.createElement("link"),Wt(r,"link",i),Rt(r),u.head.appendChild(r)))}}function tx(i,r){Rn.m(i,r);var l=Ls;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+Ni(u)+'"][href="'+Ni(i)+'"]',m=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Os(i)}if(!Ii.has(m)&&(i=_({rel:"modulepreload",href:i},r),Ii.set(m,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Hl(m)))return}u=l.createElement("link"),Wt(u,"link",i),Rt(u),l.head.appendChild(u)}}}function ix(i,r,l){Rn.S(i,r,l);var u=Ls;if(u&&i){var d=ns(u).hoistableStyles,m=zs(i);r=r||"default";var v=d.get(m);if(!v){var C={loading:0,preload:null};if(v=u.querySelector(jl(m)))C.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":r},l),(l=Ii.get(m))&&Nh(i,l);var M=v=u.createElement("link");Rt(M),Wt(M,"link",i),M._p=new Promise(function(W,G){M.onload=W,M.onerror=G}),M.addEventListener("load",function(){C.loading|=1}),M.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Bo(v,r,u)}v={type:"stylesheet",instance:v,count:1,state:C},d.set(m,v)}}}function nx(i,r){Rn.X(i,r);var l=Ls;if(l&&i){var u=ns(l).hoistableScripts,d=Os(i),m=u.get(d);m||(m=l.querySelector(Hl(d)),m||(i=_({src:i,async:!0},r),(r=Ii.get(d))&&Lh(i,r),m=l.createElement("script"),Rt(m),Wt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function rx(i,r){Rn.M(i,r);var l=Ls;if(l&&i){var u=ns(l).hoistableScripts,d=Os(i),m=u.get(d);m||(m=l.querySelector(Hl(d)),m||(i=_({src:i,async:!0,type:"module"},r),(r=Ii.get(d))&&Lh(i,r),m=l.createElement("script"),Rt(m),Wt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function Rg(i,r,l,u){var d=(d=le.current)?Mo(d):null;if(!d)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=zs(l.href),l=ns(d).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){i=zs(l.href);var m=ns(d).hoistableStyles,v=m.get(i);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,v),(m=d.querySelector(jl(i)))&&!m._p&&(v.instance=m,v.state.loading=5),Ii.has(i)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ii.set(i,l),m||sx(d,i,l,v.state))),r&&u===null)throw Error(s(528,""));return v}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Os(l),l=ns(d).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function zs(i){return'href="'+Ni(i)+'"'}function jl(i){return'link[rel="stylesheet"]['+i+"]"}function Mg(i){return _({},i,{"data-precedence":i.precedence,precedence:null})}function sx(i,r,l,u){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=i.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),Wt(r,"link",l),Rt(r),i.head.appendChild(r))}function Os(i){return'[src="'+Ni(i)+'"]'}function Hl(i){return"script[async]"+i}function Bg(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+Ni(l.href)+'"]');if(u)return r.instance=u,Rt(u),u;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Rt(u),Wt(u,"style",d),Bo(u,l.precedence,i),r.instance=u;case"stylesheet":d=zs(l.href);var m=i.querySelector(jl(d));if(m)return r.state.loading|=4,r.instance=m,Rt(m),m;u=Mg(l),(d=Ii.get(d))&&Nh(u,d),m=(i.ownerDocument||i).createElement("link"),Rt(m);var v=m;return v._p=new Promise(function(C,M){v.onload=C,v.onerror=M}),Wt(m,"link",u),r.state.loading|=4,Bo(m,l.precedence,i),r.instance=m;case"script":return m=Os(l.src),(d=i.querySelector(Hl(m)))?(r.instance=d,Rt(d),d):(u=l,(d=Ii.get(m))&&(u=_({},l),Lh(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),Rt(d),Wt(d,"link",u),i.head.appendChild(d),r.instance=d);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Bo(u,l.precedence,i));return r.instance}function Bo(i,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=u.length?u[u.length-1]:null,m=d,v=0;v<u.length;v++){var C=u[v];if(C.dataset.precedence===r)m=C;else if(m!==d)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(i,r.firstChild))}function Nh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Lh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var No=null;function Ng(i,r,l){if(No===null){var u=new Map,d=No=new Map;d.set(l,u)}else d=No,u=d.get(l),u||(u=new Map,d.set(l,u));if(u.has(i))return u;for(u.set(i,null),l=l.getElementsByTagName(i),d=0;d<l.length;d++){var m=l[d];if(!(m[el]||m[Pt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var v=m.getAttribute(r)||"";v=i+v;var C=u.get(v);C?C.push(m):u.set(v,[m])}}return u}function Lg(i,r,l){i=i.ownerDocument||i,i.head.insertBefore(l,r==="title"?i.querySelector("head > title"):null)}function lx(i,r,l){if(l===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function zg(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function ax(i,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=zs(u.href),m=r.querySelector(jl(d));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Lo.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,Rt(m);return}m=r.ownerDocument||r,u=Mg(u),(d=Ii.get(d))&&Nh(u,d),m=m.createElement("link"),Rt(m);var v=m;v._p=new Promise(function(C,M){v.onload=C,v.onerror=M}),Wt(m,"link",u),l.instance=m}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(i.count++,l=Lo.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var zh=0;function ox(i,r){return i.stylesheets&&i.count===0&&Oo(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&Oo(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&zh===0&&(zh=62500*F1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Oo(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>zh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oo(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var zo=null;function Oo(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,zo=new Map,r.forEach(ux,i),zo=null,Lo.call(i))}function ux(i,r){if(!(r.state.loading&4)){var l=zo.get(i);if(l)var u=l.get(null);else{l=new Map,zo.set(i,l);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var v=d[m];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(l.set(v.dataset.precedence,v),u=v)}u&&l.set(null,u)}d=r.instance,v=d.getAttribute("data-precedence"),m=l.get(v)||u,m===u&&l.set(null,d),l.set(v,d),this.count++,u=Lo.bind(this),d.addEventListener("load",u),d.addEventListener("error",u),m?m.parentNode.insertBefore(d,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),r.state.loading|=4}}var Ul={$$typeof:I,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function cx(i,r,l,u,d,m,v,C,M){this.tag=1,this.containerInfo=i,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=Ru(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ru(0),this.hiddenUpdates=Ru(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Og(i,r,l,u,d,m,v,C,M,W,G,ne){return i=new cx(i,r,l,v,M,W,G,ne,C),r=1,m===!0&&(r|=24),m=xi(3,null,null,r),i.current=m,m.stateNode=i,r=pc(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},vc(m),i}function jg(i){return i?(i=ds,i):ds}function Hg(i,r,l,u,d,m){d=jg(d),u.context===null?u.context=d:u.pendingContext=d,u=Vn(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=Kn(i,u,r),l!==null&&(mi(l,i,r),gl(l,i,r))}function Ug(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Oh(i,r){Ug(i,r),(i=i.alternate)&&Ug(i,r)}function Pg(i){if(i.tag===13||i.tag===31){var r=Cr(i,67108864);r!==null&&mi(r,i,67108864),Oh(i,67108864)}}function Ig(i){if(i.tag===13||i.tag===31){var r=Ti();r=Mu(r);var l=Cr(i,r);l!==null&&mi(l,i,r),Oh(i,r)}}var jo=!0;function hx(i,r,l,u){var d=A.T;A.T=null;var m=j.p;try{j.p=2,jh(i,r,l,u)}finally{j.p=m,A.T=d}}function fx(i,r,l,u){var d=A.T;A.T=null;var m=j.p;try{j.p=8,jh(i,r,l,u)}finally{j.p=m,A.T=d}}function jh(i,r,l,u){if(jo){var d=Hh(u);if(d===null)wh(i,r,u,Ho,l),qg(i,u);else if(px(d,i,r,l,u))u.stopPropagation();else if(qg(i,u),r&4&&-1<dx.indexOf(i)){for(;d!==null;){var m=is(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var v=yr(m.pendingLanes);if(v!==0){var C=m;for(C.pendingLanes|=2,C.entangledLanes|=2;v;){var M=1<<31-Qe(v);C.entanglements[1]|=M,v&=~M}nn(m),(qe&6)===0&&(bo=Jt()+500,Nl(0))}}break;case 31:case 13:C=Cr(m,2),C!==null&&mi(C,m,2),xo(),Oh(m,2)}if(m=Hh(u),m===null&&wh(i,r,u,Ho,l),m===d)break;d=m}d!==null&&u.stopPropagation()}else wh(i,r,u,null,l)}}function Hh(i){return i=Pu(i),Uh(i)}var Ho=null;function Uh(i){if(Ho=null,i=ts(i),i!==null){var r=o(i);if(r===null)i=null;else{var l=r.tag;if(l===13){if(i=c(r),i!==null)return i;i=null}else if(l===31){if(i=f(r),i!==null)return i;i=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Ho=i,null}function Fg(i){switch(i){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(Du()){case ee:return 2;case fe:return 8;case xe:case Me:return 32;case We:return 268435456;default:return 32}default:return 32}}var Ph=!1,rr=null,sr=null,lr=null,Pl=new Map,Il=new Map,ar=[],dx="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 qg(i,r){switch(i){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":sr=null;break;case"mouseover":case"mouseout":lr=null;break;case"pointerover":case"pointerout":Pl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Il.delete(r.pointerId)}}function Fl(i,r,l,u,d,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:m,targetContainers:[d]},r!==null&&(r=is(r),r!==null&&Pg(r)),i):(i.eventSystemFlags|=u,r=i.targetContainers,d!==null&&r.indexOf(d)===-1&&r.push(d),i)}function px(i,r,l,u,d){switch(r){case"focusin":return rr=Fl(rr,i,r,l,u,d),!0;case"dragenter":return sr=Fl(sr,i,r,l,u,d),!0;case"mouseover":return lr=Fl(lr,i,r,l,u,d),!0;case"pointerover":var m=d.pointerId;return Pl.set(m,Fl(Pl.get(m)||null,i,r,l,u,d)),!0;case"gotpointercapture":return m=d.pointerId,Il.set(m,Fl(Il.get(m)||null,i,r,l,u,d)),!0}return!1}function Wg(i){var r=ts(i.target);if(r!==null){var l=o(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){i.blockedOn=r,rp(i.priority,function(){Ig(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,rp(i.priority,function(){Ig(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){i.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Uo(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=Hh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Uu=u,l.target.dispatchEvent(u),Uu=null}else return r=is(l),r!==null&&Pg(r),i.blockedOn=l,!1;r.shift()}return!0}function Yg(i,r,l){Uo(i)&&l.delete(r)}function mx(){Ph=!1,rr!==null&&Uo(rr)&&(rr=null),sr!==null&&Uo(sr)&&(sr=null),lr!==null&&Uo(lr)&&(lr=null),Pl.forEach(Yg),Il.forEach(Yg)}function Po(i,r){i.blockedOn===r&&(i.blockedOn=null,Ph||(Ph=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,mx)))}var Io=null;function Vg(i){Io!==i&&(Io=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Io===i&&(Io=null);for(var r=0;r<i.length;r+=3){var l=i[r],u=i[r+1],d=i[r+2];if(typeof u!="function"){if(Uh(u||l)===null)continue;break}var m=is(l);m!==null&&(i.splice(r,3),r-=3,Hc(m,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function js(i){function r(M){return Po(M,i)}rr!==null&&Po(rr,i),sr!==null&&Po(sr,i),lr!==null&&Po(lr,i),Pl.forEach(r),Il.forEach(r);for(var l=0;l<ar.length;l++){var u=ar[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<ar.length&&(l=ar[0],l.blockedOn===null);)Wg(l),l.blockedOn===null&&ar.shift();if(l=(i.ownerDocument||i).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var d=l[u],m=l[u+1],v=d[ui]||null;if(typeof m=="function")v||Vg(l);else if(v){var C=null;if(m&&m.hasAttribute("formAction")){if(d=m,v=m[ui]||null)C=v.formAction;else if(Uh(d)!==null)continue}else C=v.action;typeof C=="function"?l[u+1]=C:(l.splice(u,3),u-=3),Vg(l)}}}function Kg(){function i(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function r(){d!==null&&(d(),d=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),d!==null&&(d(),d=null)}}}function Ih(i){this._internalRoot=i}Fo.prototype.render=Ih.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=Ti();Hg(l,u,i,r,null,null)},Fo.prototype.unmount=Ih.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Hg(i.current,2,null,i,null,null),xo(),r[es]=null}};function Fo(i){this._internalRoot=i}Fo.prototype.unstable_scheduleHydration=function(i){if(i){var r=np();i={blockedOn:null,target:i,priority:r};for(var l=0;l<ar.length&&r!==0&&r<ar[l].priority;l++);ar.splice(l,0,i),l===0&&Wg(i)}};var Xg=t.version;if(Xg!=="19.2.3")throw Error(s(527,Xg,"19.2.3"));j.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var _x={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qo.isDisabled&&qo.supportsFiber)try{ei=qo.inject(_x),Ct=qo}catch{}}return Wl.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",d=t_,m=i_,v=n_;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError)),r=Og(i,1,!1,null,null,l,u,null,d,m,v,Kg),i[es]=r.current,xh(i),new Ih(r)},Wl.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",m=t_,v=i_,C=n_,M=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(M=l.formState)),r=Og(i,1,!0,r,l??null,u,d,M,m,v,C,Kg),r.context=jg(null),l=r.current,u=Ti(),u=Mu(u),d=Vn(u),d.callback=null,Kn(l,d,u),l=u,r.current.lanes=l,Js(r,l),nn(r),i[es]=r.current,xh(i),new Fo(r)},Wl.version="19.2.3",Wl}var rv;function Tx(){if(rv)return Wh.exports;rv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Wh.exports=Ex(),Wh.exports}var Ax=Tx();const Dx=gu(Ax);function Rx({onLogin:e}){const[t,n]=Q.useState(""),[s,a]=Q.useState(null),[o,c]=Q.useState(!1),f=async p=>{if(p.preventDefault(),!t.trim())return;c(!0),a(null);const h=await e(t);h&&a(h),c(!1)};return S.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:S.jsxs("div",{className:"w-full max-w-sm",children:[S.jsxs("div",{className:"border-border rounded border p-6",children:[S.jsxs("div",{className:"mb-6 text-center",children:[S.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),S.jsx("p",{className:"text-muted mt-1 text-xs",children:"local writer agent"})]}),S.jsxs("form",{onSubmit:f,className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),S.jsx("input",{type:"password",value:t,onChange:p=>n(p.target.value),placeholder:"enter your passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),s&&S.jsx("p",{className:"text-error text-xs",children:s}),S.jsx("button",{type:"submit",disabled:o||!t.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:o?"authenticating...":"unlock"})]})]}),S.jsx("p",{className:"text-muted mt-4 text-center text-[10px]",children:"enter your passphrase to unlock"})]})})}function Mx({onSetup:e}){const[t,n]=Q.useState(""),[s,a]=Q.useState(""),[o,c]=Q.useState(null),[f,p]=Q.useState(!1),h=async g=>{if(g.preventDefault(),!t.trim()||t.length<4){c("Passphrase must be at least 4 characters");return}if(t!==s){c("Passphrases do not match");return}p(!0),c(null);const _=await e(t);_&&c(_),p(!1)};return S.jsx("div",{className:"flex h-screen items-center justify-center p-4",children:S.jsx("div",{className:"w-full max-w-sm",children:S.jsxs("div",{className:"border-border rounded border p-6",children:[S.jsxs("div",{className:"mb-6 text-center",children:[S.jsx("h1",{className:"text-accent text-lg font-bold tracking-tight",children:"PlotLink OWS"}),S.jsx("p",{className:"text-muted mt-1 text-xs",children:"first-time setup"})]}),S.jsx("p",{className:"text-muted mb-4 text-xs leading-relaxed",children:"Choose a passphrase to protect your local writer agent. This will be used to unlock the app and secure your OWS wallet."}),S.jsxs("form",{onSubmit:h,className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Passphrase"}),S.jsx("input",{type:"password",value:t,onChange:g=>n(g.target.value),placeholder:"choose a passphrase",autoFocus:!0,className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted mb-1.5 block text-xs uppercase tracking-wider",children:"Confirm"}),S.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"repeat passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),o&&S.jsx("p",{className:"text-error text-xs",children:o}),S.jsx("button",{type:"submit",disabled:f||!t.trim()||!s.trim(),className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:f?"setting up...":"create passphrase"})]})]})})})}const sv="http://localhost:7777";function eb({token:e}){const[t,n]=Q.useState(null),[s,a]=Q.useState(!1),[o,c]=Q.useState(!1),[f,p]=Q.useState(null),h=(x,k)=>fetch(x,{...k,headers:{...k==null?void 0:k.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=()=>{h(`${sv}/api/wallet`).then(x=>x.json()).then(x=>n(x)).catch(()=>n({exists:!1,error:"Failed to load wallet"}))};Q.useEffect(()=>{g()},[]);const _=async()=>{a(!0),p(null);try{const x=await h(`${sv}/api/wallet/create`,{method:"POST"}),k=await x.json();if(!x.ok)throw new Error(k.error||"Creation failed");g()}catch(x){p(x instanceof Error?x.message:"Failed to create wallet")}a(!1)},b=()=>{t!=null&&t.address&&(navigator.clipboard.writeText(t.address),c(!0),setTimeout(()=>c(!1),2e3))},y=x=>`${x.slice(0,6)}...${x.slice(-4)}`;return S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"OWS Wallet"}),!t&&S.jsx("p",{className:"text-muted text-xs",children:"loading..."}),t&&!t.exists&&S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"No wallet created yet. Create one to enable autonomous transactions."}),f&&S.jsx("p",{className:"text-error text-xs",children:f}),S.jsx("button",{onClick:_,disabled:s,className:"border-accent text-accent hover:bg-accent/10 disabled:opacity-40 rounded border px-4 py-2 text-xs font-medium transition-colors",children:s?"creating...":"create wallet"})]}),t&&t.exists&&t.address&&S.jsxs("div",{className:"space-y-3",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"Address (Base)"}),S.jsx("span",{className:`rounded border px-1.5 py-0.5 text-[9px] ${t.ethBalance&&parseFloat(t.ethBalance)>0?"border-accent/30 text-accent":"border-accent-dim/30 text-accent-dim"}`,children:t.ethBalance&&parseFloat(t.ethBalance)>0?"active":"no balance"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("code",{className:"text-foreground bg-surface rounded px-2 py-1 text-xs font-mono",children:y(t.address)}),S.jsx("button",{onClick:b,className:"text-muted hover:text-accent text-xs transition-colors",children:o?"copied":"copy"})]}),S.jsxs("div",{className:"border-border space-y-1 border-t pt-3",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"ETH"}),S.jsxs("span",{className:"text-foreground font-medium",children:[t.ethBalance||"0.000000"," ETH"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"USDC"}),S.jsxs("span",{className:"text-foreground font-medium",children:["$",t.usdcBalance||"0.00"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"PLOT"}),S.jsxs("span",{className:"text-foreground font-medium",children:[t.plotBalance||"0.0000"," PLOT"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Network"}),S.jsx("span",{className:"text-foreground",children:"Base"})]})]}),S.jsxs("div",{className:"border-border border-t pt-3",children:[S.jsx("p",{className:"text-muted mb-2 text-[10px] font-medium uppercase tracking-wider",children:"Fund Wallet"}),S.jsx("p",{className:"text-muted text-[10px]",children:"Send ETH on Base for gas (~$0.01 per publish):"}),S.jsx("code",{className:"text-foreground bg-surface mt-1 block break-all rounded px-2 py-1.5 text-[10px] font-mono",children:t.address})]})]})]})}function Bx({token:e,onLogout:t}){const[n,s]=Q.useState(""),[a,o]=Q.useState(""),[c,f]=Q.useState(null),[p,h]=Q.useState(!1),[g,_]=Q.useState(!1),[b,y]=Q.useState(null),[x,k]=Q.useState("AI Writer"),[L,R]=Q.useState(""),[$,I]=Q.useState(""),[Z,Y]=Q.useState(!1),[O,J]=Q.useState(null),[ce,pe]=Q.useState(""),[F,se]=Q.useState(null),[H,E]=Q.useState(!1),[B,N]=Q.useState(null),[A,j]=Q.useState(null),P=Q.useCallback((w,ie)=>fetch(w,{...ie,headers:{...ie==null?void 0:ie.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);Q.useEffect(()=>{P("/api/settings/link-status").then(w=>w.json()).then(w=>y(w)).catch(()=>y({linked:!1}))},[]);const oe=async()=>{if(!x.trim()){J("Agent name is required");return}if(!L.trim()){J("Description is required");return}Y(!0),J(null);try{const w=await P("/api/settings/register-agent",{method:"POST",body:JSON.stringify({name:x,description:L,...$.trim()&&{genre:$}})}),ie=await w.json();if(!w.ok)throw new Error(ie.error||"Registration failed");y({linked:!0,agentId:ie.agentId,owsWallet:ie.owsWallet,txHash:ie.txHash})}catch(w){J(w instanceof Error?w.message:"Registration failed")}Y(!1)},T=async()=>{if(!ce.trim()||!/^0x[a-fA-F0-9]{40}$/.test(ce)){N("Enter a valid wallet address (0x...)");return}E(!0),N(null),se(null);try{const w=await P("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:ce})}),ie=await w.json();if(!w.ok)throw new Error(ie.error||"Failed to generate binding code");se(ie)}catch(w){N(w instanceof Error?w.message:"Failed to generate binding code")}E(!1)},D=async(w,ie)=>{await navigator.clipboard.writeText(w),j(ie),setTimeout(()=>j(null),2e3)},V=async()=>{if(f(null),h(!1),!n||n.length<4){f("Passphrase must be at least 4 characters");return}if(n!==a){f("Passphrases do not match");return}_(!0);try{const w=await P("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!w.ok){const ie=await w.json();throw new Error(ie.error||"Reset failed")}h(!0),s(""),o(""),setTimeout(()=>h(!1),3e3)}catch(w){f(w instanceof Error?w.message:"Reset failed")}_(!1)};return S.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-6",children:[S.jsx("h2",{className:"text-accent text-lg font-bold",children:"Settings"}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Agent Identity"}),b!=null&&b.linked?S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm font-medium text-accent",children:"Registered"}),S.jsxs("span",{className:"text-muted text-xs",children:["Agent #",b.agentId]})]}),b.owsWallet&&S.jsxs("p",{className:"text-muted text-xs font-mono",children:["Wallet: ",b.owsWallet.slice(0,6),"...",b.owsWallet.slice(-4)]}),b.owner&&S.jsxs("p",{className:"text-muted text-xs font-mono",children:["Owner: ",b.owner.slice(0,6),"...",b.owner.slice(-4)]}),b.txHash&&S.jsx("p",{className:"text-muted text-xs",children:S.jsx("a",{href:`https://basescan.org/tx/${b.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View transaction on BaseScan"})}),S.jsx("p",{className:"text-muted text-xs",children:S.jsx("a",{href:`https://plotlink.xyz/profile/${b.owsWallet}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View agent profile on plotlink.xyz"})})]}):S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"Register this AI writer on-chain via ERC-8004. Uses your OWS wallet's existing ETH balance for gas."}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Name"}),S.jsx("input",{value:x,onChange:w=>k(w.target.value),placeholder:"AI Writer",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Description"}),S.jsx("input",{value:L,onChange:w=>R(w.target.value),placeholder:"An AI writing assistant for fiction stories",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Genre (optional)"}),S.jsx("input",{value:$,onChange:w=>I(w.target.value),placeholder:"e.g. Fiction, Sci-Fi, Fantasy",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"})]}),O&&S.jsx("p",{className:"text-error text-xs",children:O}),S.jsx("button",{onClick:oe,disabled:Z||!x.trim()||!L.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:Z?"Registering...":"Register Agent Identity"})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Link to PlotLink"}),b!=null&&b.owner?S.jsxs("p",{className:"text-muted text-xs",children:["Linked to owner ",S.jsxs("span",{className:"font-mono",children:[b.owner.slice(0,6),"...",b.owner.slice(-4)]})]}):S.jsxs("div",{className:"space-y-3",children:[S.jsx("p",{className:"text-muted text-xs",children:"Link this OWS wallet to your PlotLink account so your stories appear under your profile on plotlink.xyz."}),S.jsxs("div",{className:"text-muted text-xs space-y-1 pl-3",children:[S.jsx("p",{children:"1. Enter your PlotLink wallet address below"}),S.jsx("p",{children:'2. Click "Generate Binding Code"'}),S.jsx("p",{children:"3. Copy the code and paste it on plotlink.xyz → Agents → Link AI Writer"})]}),S.jsx("input",{value:ce,onChange:w=>pe(w.target.value),placeholder:"Your PlotLink wallet address (0x...)",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent font-mono"}),B&&S.jsx("p",{className:"text-error text-xs",children:B}),S.jsx("button",{onClick:T,disabled:H||!ce.trim(),className:"bg-accent text-white hover:bg-accent-dim disabled:opacity-50 w-full rounded px-4 py-2 text-sm font-medium transition-colors",children:H?"Generating...":"Generate Binding Code"}),F&&S.jsxs("div",{className:"space-y-3 mt-3",children:[S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Binding Code (signature)"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:F.signature}),S.jsx("button",{onClick:()=>D(F.signature,"signature"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="signature"?"Copied!":"Copy"})]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"OWS Wallet Address"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono break-all text-foreground pr-16",children:F.owsWallet}),S.jsx("button",{onClick:()=>D(F.owsWallet,"wallet"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="wallet"?"Copied!":"Copy"})]})]}),F.agentId&&S.jsxs("div",{children:[S.jsx("label",{className:"text-muted text-xs block mb-1",children:"Agent ID"}),S.jsxs("div",{className:"relative",children:[S.jsx("div",{className:"bg-surface border-border rounded border p-2 text-xs font-mono text-foreground pr-16",children:F.agentId}),S.jsx("button",{onClick:()=>D(String(F.agentId),"agentId"),className:"absolute top-1 right-1 text-xs px-2 py-1 rounded border border-border text-muted hover:text-accent hover:border-accent transition-colors",children:A==="agentId"?"Copied!":"Copy"})]})]}),S.jsx("p",{className:"text-xs text-accent",children:'Now go to plotlink.xyz/agents and paste the values in the "Link AI Writer" section.'})]})]})]}),S.jsx(eb,{token:e}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Reset Passphrase"}),S.jsxs("div",{className:"space-y-3",children:[S.jsx("input",{type:"password",value:n,onChange:w=>s(w.target.value),placeholder:"new passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),S.jsx("input",{type:"password",value:a,onChange:w=>o(w.target.value),placeholder:"confirm passphrase",className:"bg-surface border-border text-foreground placeholder:text-muted/50 w-full rounded border px-3 py-2 text-sm outline-none focus:border-accent"}),c&&S.jsx("p",{className:"text-error text-xs",children:c}),p&&S.jsx("p",{className:"text-xs text-accent",children:"passphrase updated"}),S.jsx("button",{onClick:V,disabled:g||!n.trim(),className:"border-border text-muted hover:border-accent hover:text-accent disabled:opacity-40 w-full rounded border px-4 py-2 text-xs font-medium transition-colors",children:g?"updating...":"update passphrase"})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Session"}),S.jsx("button",{onClick:t,className:"border-border text-muted hover:border-error hover:text-error rounded border px-4 py-2 text-xs font-medium transition-colors",children:"logout"})]})]})}const Nx="http://localhost:7777";function Lx({token:e}){const[t,n]=Q.useState(null),s=(f,p)=>fetch(f,{...p,headers:{...p==null?void 0:p.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),a=()=>{s(`${Nx}/api/dashboard`).then(f=>f.json()).then(n)};Q.useEffect(()=>{a()},[]);const o=f=>`${f.slice(0,6)}...${f.slice(-4)}`,c=f=>{if(!f)return"Unknown date";const p=new Date(f);return isNaN(p.getTime())?"Unknown date":p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})};return t?S.jsxs("div",{className:"mx-auto max-w-2xl space-y-6 p-6",children:[S.jsx("h2",{className:"text-accent text-lg font-bold",children:"Writer Dashboard"}),S.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-accent text-lg font-bold",children:t.stories.totalPublished}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"published"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.pendingFiles}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"pending"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalStories}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"stories"})]}),S.jsxs("div",{className:"border-border rounded border p-3 text-center",children:[S.jsx("div",{className:"text-foreground text-lg font-bold",children:t.stories.totalFiles}),S.jsx("div",{className:"text-muted text-[10px] uppercase tracking-wider",children:"files"})]})]}),t.wallet&&S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Wallet"}),S.jsxs("div",{className:"space-y-1.5",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Address"}),S.jsx("code",{className:"text-foreground font-mono text-[10px]",children:o(t.wallet.address)})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"ETH Balance"}),S.jsxs("span",{className:"text-foreground",children:[t.wallet.ethFormatted," ETH"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"USDC Balance"}),S.jsxs("span",{className:"text-foreground",children:["$",t.wallet.usdcBalance]})]})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Profit & Loss"}),S.jsxs("div",{className:"space-y-1.5",children:[S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Total costs (gas)"}),S.jsxs("span",{className:"text-error",children:["-",t.pnl.totalCostsEth," ETH (~$",t.pnl.totalCostsUsd,")"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Royalties earned"}),S.jsxs("span",{className:"text-accent",children:["+",t.pnl.totalRoyaltiesPlot," PLOT"]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Unclaimed royalties"}),S.jsxs("span",{className:"text-foreground",children:[t.royalties.unclaimed," PLOT"]})]}),S.jsxs("div",{className:"border-border flex justify-between border-t pt-1.5 text-xs font-medium",children:[S.jsx("span",{className:"text-muted",children:"Net P&L (USD)"}),S.jsxs("span",{className:parseFloat(t.pnl.netPnlUsd)>=0?"text-accent":"text-error",children:[parseFloat(t.pnl.netPnlUsd)>=0?"+":"","$",t.pnl.netPnlUsd]})]}),S.jsxs("div",{className:"flex justify-between text-xs",children:[S.jsx("span",{className:"text-muted",children:"Stories published"}),S.jsx("span",{className:"text-foreground",children:t.costs.storiesPublished})]})]})]}),S.jsxs("div",{className:"border-border rounded border p-4",children:[S.jsx("h3",{className:"text-accent mb-3 text-xs font-bold uppercase tracking-wider",children:"Published Stories"}),t.stories.published.length===0?S.jsx("p",{className:"text-muted text-xs",children:"no published stories yet"}):S.jsx("div",{className:"space-y-3",children:t.stories.published.map(f=>S.jsxs("div",{className:"bg-surface rounded border border-border p-4",children:[S.jsxs("div",{className:"flex items-start justify-between",children:[S.jsxs("div",{children:[f.genre&&S.jsx("span",{className:"bg-accent/10 text-accent rounded px-2 py-0.5 text-[10px] font-medium",children:f.genre}),S.jsx("h4",{className:"text-foreground mt-1 text-sm font-serif font-medium",children:f.title}),S.jsx("p",{className:"text-muted mt-0.5 text-[10px] font-mono",children:f.storyName})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[f.hasNotIndexed&&S.jsx("span",{className:"rounded border border-amber-600/30 px-1.5 py-0.5 text-[9px] text-amber-700",children:"not indexed"}),S.jsxs("span",{className:"rounded border border-green-700/30 px-1.5 py-0.5 text-[9px] text-green-700",children:[f.publishedFiles," published"]})]})]}),S.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2 text-center",children:[S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium",children:f.plotCount}),S.jsx("div",{className:"text-muted text-[9px]",children:"Plots"})]}),S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium font-mono",children:f.storylineId?`#${f.storylineId}`:"—"}),S.jsx("div",{className:"text-muted text-[9px]",children:"Storyline"})]}),S.jsxs("div",{className:"rounded bg-background p-1.5",children:[S.jsx("div",{className:"text-foreground text-sm font-medium",children:f.totalGasCostEth??"—"}),S.jsx("div",{className:"text-muted text-[9px]",children:"Gas (ETH)"})]})]}),S.jsx("div",{className:"mt-2 space-y-1",children:f.files.map(p=>S.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsx("span",{className:p.status==="published-not-indexed"?"text-amber-700":"text-green-700",children:p.status==="published-not-indexed"?"⚠":"✓"}),S.jsx("span",{className:"text-muted font-mono",children:p.file})]}),p.txHash&&S.jsxs("a",{href:`https://basescan.org/tx/${p.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted hover:text-accent font-mono",children:["tx:",p.txHash.slice(0,8),"..."]})]},p.file))}),S.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px]",children:[S.jsx("span",{className:"text-muted",children:c(f.latestPublishedAt)}),f.storylineId&&S.jsx("a",{href:`https://plotlink.xyz/story/${f.storylineId}`,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"})]})]},f.id))})]}),t.stories.pendingFiles>0&&S.jsx("div",{className:"border-border rounded border p-4",children:S.jsxs("p",{className:"text-muted text-xs",children:[t.stories.pendingFiles," file(s) pending publish — go to Stories to publish them."]})})]}):S.jsx("div",{className:"flex h-full items-center justify-center",children:S.jsx("span",{className:"text-muted text-sm",children:"loading dashboard..."})})}const zx={published:"✓","published-not-indexed":"⚠",pending:"⏳",draft:"📝"},Ox={published:"text-green-700","published-not-indexed":"text-amber-700",pending:"text-amber-700",draft:"text-muted"};function jx({authFetch:e,selectedStory:t,selectedFile:n,onSelectFile:s,onNewStory:a,untitledSessions:o=[]}){const[c,f]=Q.useState([]),[p,h]=Q.useState([]),[g,_]=Q.useState(new Set),[b,y]=Q.useState(!1),x=Q.useCallback(async()=>{try{const Y=await e("/api/stories");if(Y.ok){const O=await Y.json();f(O.stories)}}catch{}},[e]),k=Q.useCallback(async()=>{try{const Y=await e("/api/stories/archived");if(Y.ok){const O=await Y.json();h(O.stories)}}catch{}},[e]),L=Q.useCallback(async Y=>{try{(await e("/api/stories/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y})})).ok&&(k(),x())}catch{}},[e,k,x]);Q.useEffect(()=>{x();const Y=setInterval(x,5e3);return()=>clearInterval(Y)},[x]),Q.useEffect(()=>{b&&k()},[b,k]),Q.useEffect(()=>{t&&_(Y=>new Set(Y).add(t))},[t]);const R=Y=>{var J;const O=Y.map(ce=>{var pe;return{file:ce.file,num:(pe=ce.file.match(/^plot-(\d+)\.md$/))==null?void 0:pe[1]}}).filter(ce=>ce.num!=null).sort((ce,pe)=>parseInt(pe.num)-parseInt(ce.num));return O.length>0?O[0].file:Y.some(ce=>ce.file==="genesis.md")?"genesis.md":Y.some(ce=>ce.file==="structure.md")?"structure.md":((J=Y[0])==null?void 0:J.file)??null},$=Y=>{_(O=>{const J=new Set(O);return J.has(Y)?J.delete(Y):J.add(Y),J})},I=Y=>{if($(Y.name),!g.has(Y.name)){const O=R(Y.files);O&&s(Y.name,O)}},Z=Y=>{const O=J=>{if(J==="structure.md")return 0;if(J==="genesis.md")return 1;const ce=J.match(/^plot-(\d+)\.md$/);return ce?2+parseInt(ce[1]):100};return[...Y].sort((J,ce)=>O(J.file)-O(ce.file))};return b?S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs font-mono text-muted",children:"Archives"}),S.jsx("span",{className:"text-xs text-muted",children:p.length})]}),S.jsx("div",{className:"px-3 py-2 border-b border-border",children:S.jsxs("button",{onClick:()=>y(!1),className:"w-full px-3 py-1.5 text-sm text-muted hover:text-foreground hover:bg-surface rounded flex items-center gap-1.5",children:[S.jsx("span",{children:"←"}),S.jsx("span",{children:"Back"})]})}),S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:p.length===0?S.jsx("div",{className:"p-3 text-sm text-muted",children:S.jsx("p",{children:"No archived stories."})}):p.map(Y=>S.jsxs("div",{className:"px-3 py-2 flex items-center justify-between hover:bg-surface",children:[S.jsx("span",{className:"text-sm font-medium truncate",title:Y.name,children:Y.title||Y.name}),S.jsx("button",{onClick:()=>L(Y.name),className:"text-xs text-accent hover:text-accent-dim flex-shrink-0 ml-2",children:"Restore"})]},Y.name))})]}):S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs font-mono text-muted",children:"Stories"}),S.jsx("span",{className:"text-xs text-muted",children:c.length})]}),a&&S.jsx("div",{className:"px-3 py-2 border-b border-border",children:S.jsxs("button",{onClick:a,className:"w-full px-3 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent-dim flex items-center justify-center gap-1.5",children:[S.jsx("span",{children:"+"}),S.jsx("span",{children:"New Story"})]})}),S.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[o.map(Y=>S.jsx("div",{children:S.jsxs("button",{onClick:()=>s(Y,""),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm ${t===Y?"bg-surface":""}`,children:[S.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-600 flex-shrink-0"}),S.jsx("span",{className:"font-medium italic text-muted",children:"Untitled"})]})},Y)),c.length===0&&o.length===0?S.jsxs("div",{className:"p-3 text-sm text-muted",children:[S.jsx("p",{children:"No stories yet."}),S.jsx("p",{className:"mt-1 text-xs",children:'Click "+ New Story" above to start writing.'})]}):c.filter(Y=>Y.name!=="_example").map(Y=>S.jsxs("div",{children:[S.jsxs("button",{onClick:()=>I(Y),className:"w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm",children:[S.jsx("span",{className:"text-xs text-muted",children:g.has(Y.name)?"▼":"▶"}),S.jsx("span",{className:"font-medium truncate",title:Y.name,children:Y.title||Y.name}),S.jsxs("span",{className:"ml-auto text-xs text-muted",children:[Y.publishedCount,"/",Y.files.length]})]}),g.has(Y.name)&&S.jsx("div",{className:"pl-4",children:Z(Y.files).map(O=>{const J=t===Y.name&&n===O.file;return S.jsxs("button",{onClick:()=>s(Y.name,O.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${J?"bg-surface font-medium":""}`,children:[S.jsx("span",{className:Ox[O.status],children:zx[O.status]}),S.jsx("span",{className:"truncate font-mono",children:O.file})]},O.file)})})]},Y.name))]}),S.jsx("div",{className:"px-3 py-2 border-t border-border",children:S.jsx("button",{onClick:()=>y(!0),className:"w-full px-3 py-1.5 text-xs text-muted hover:text-foreground hover:bg-surface rounded flex items-center justify-center gap-1.5",children:S.jsx("span",{children:"Archives"})})})]})}/**
50
50
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
51
51
  * @license MIT
52
52
  *
@@ -57,22 +57,22 @@ Error generating stack: `+u.message+`
57
57
  * Fabrice Bellard's javascript vt100 for jslinux:
58
58
  * http://bellard.org/jslinux/
59
59
  * Copyright (c) 2011 Fabrice Bellard
60
- */var Jy=Object.defineProperty,Ox=Object.getOwnPropertyDescriptor,jx=(e,t)=>{for(var n in t)Jy(e,n,{get:t[n],enumerable:!0})},ht=(e,t,n,s)=>{for(var a=s>1?void 0:s?Ox(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(s?c(t,n,a):c(a))||a);return s&&a&&Jy(t,n,a),a},fe=(e,t)=>(n,s)=>t(n,s,e),rv="Terminal input",Tf={get:()=>rv,set:e=>rv=e},sv="Too much output to announce, navigate to rows manually to read",Af={get:()=>sv,set:e=>sv=e};function Hx(e){return e.replace(/\r?\n/g,"\r")}function Ux(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Px(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Ix(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");eb(a,t,n,s)}}function eb(e,t,n,s){e=Hx(e),e=Ux(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function tb(e,t,n){let s=n.getBoundingClientRect(),a=e.clientX-s.left-10,o=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function lv(e,t,n,s,a){tb(e,t,n),a&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function dr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vu(e,t=0,n=e.length){let s="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,s+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):s+=String.fromCharCode(o)}return s}var Fx=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,s;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[s++]=(c-55296)*1024+f-56320+65536:(t[s++]=c,t[s++]=f);continue}c!==65279&&(t[s++]=c)}return s}},qx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a,o,c,f,p=0,h=0;if(this.interim[0]){let b=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,E;for(;(E=this.interim[++x]&63)&&x<4;)y<<=6,y|=E;let L=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=L-x;for(;h<R;){if(h>=n)return 0;if(E=e[h++],(E&192)!==128){h--,b=!0;break}else this.interim[x++]=E,y<<=6,y|=E&63}b||(L===2?y<128?h--:t[s++]=y:L===3?y<2048||y>=55296&&y<=57343||y===65279||(t[s++]=y):y<65536||y>1114111||(t[s++]=y)),this.interim.fill(0)}let g=n-4,_=h;for(;_<n;){for(;_<g&&!((a=e[_])&128)&&!((o=e[_+1])&128)&&!((c=e[_+2])&128)&&!((f=e[_+3])&128);)t[s++]=a,t[s++]=o,t[s++]=c,t[s++]=f,_+=4;if(a=e[_++],a<128)t[s++]=a;else if((a&224)===192){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(a&31)<<6|o&63,p<128){_--;continue}t[s++]=p}else if((a&240)===224){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(a&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[s++]=p}else if((a&248)===240){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,s;if(f=e[_++],(f&192)!==128){_--;continue}if(p=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,p<65536||p>1114111)continue;t[s++]=p}}return s}},ib="",mr=" ",ga=class nb{constructor(){this.fg=0,this.bg=0,this.extended=new ou}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new nb;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ou=class rb{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new rb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Vi=class sb extends ga{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ou,this.combinedData=""}static fromCharData(t){let n=new sb;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},av="di$target",Df="di$dependencies",Xh=new Map;function Wx(e){return e[Df]||[]}function jt(e){if(Xh.has(e))return Xh.get(e);let t=function(n,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Yx(t,n,a)};return t._id=e,Xh.set(e,t),t}function Yx(e,t,n){t[av]===t?t[Df].push({id:e,index:n}):(t[Df]=[{id:e,index:n}],t[av]=t)}var si=jt("BufferService"),lb=jt("CoreMouseService"),Xr=jt("CoreService"),Vx=jt("CharsetService"),xd=jt("InstantiationService"),ab=jt("LogService"),li=jt("OptionsService"),ob=jt("OscLinkService"),Kx=jt("UnicodeService"),va=jt("DecorationService"),Rf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],a=this._optionsService.rawOptions.linkHandler,o=new Vi,c=n.getTrimmedLength(),f=-1,p=-1,h=!1;for(let _=0;_<c;_++)if(!(p===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=_,f=o.extended.urlId;continue}else h=o.extended.urlId!==f;else p!==-1&&(h=!0);if(h||p!==-1&&_===c-1){let b=(g=this._oscLinkService.getLinkData(f))==null?void 0:g.uri;if(b){let y={start:{x:p+1,y:e},end:{x:_+(!h&&_===c-1?1:0),y:e}},x=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let E=new URL(b);["http:","https:"].includes(E.protocol)||(x=!0)}catch{x=!0}x||s.push({text:b,range:y,activate:(E,L)=>a?a.activate(E,L,y):Xx(E,L),hover:(E,L)=>{var R;return(R=a==null?void 0:a.hover)==null?void 0:R.call(a,E,L,y)},leave:(E,L)=>{var R;return(R=a==null?void 0:a.leave)==null?void 0:R.call(a,E,L,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=_,f=o.extended.urlId):(p=-1,f=-1)}}t(s)}};Rf=ht([fe(0,si),fe(1,li),fe(2,ob)],Rf);function Xx(e,t){if(confirm(`Do you want to navigate to ${t}?
60
+ */var tb=Object.defineProperty,Hx=Object.getOwnPropertyDescriptor,Ux=(e,t)=>{for(var n in t)tb(e,n,{get:t[n],enumerable:!0})},dt=(e,t,n,s)=>{for(var a=s>1?void 0:s?Hx(t,n):t,o=e.length-1,c;o>=0;o--)(c=e[o])&&(a=(s?c(t,n,a):c(a))||a);return s&&a&&tb(t,n,a),a},de=(e,t)=>(n,s)=>t(n,s,e),lv="Terminal input",Df={get:()=>lv,set:e=>lv=e},av="Too much output to announce, navigate to rows manually to read",Rf={get:()=>av,set:e=>av=e};function Px(e){return e.replace(/\r?\n/g,"\r")}function Ix(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function Fx(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function qx(e,t,n,s){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");ib(a,t,n,s)}}function ib(e,t,n,s){e=Px(e),e=Ix(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function nb(e,t,n){let s=n.getBoundingClientRect(),a=e.clientX-s.left-10,o=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function ov(e,t,n,s,a){nb(e,t,n),a&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function dr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vu(e,t=0,n=e.length){let s="";for(let a=t;a<n;++a){let o=e[a];o>65535?(o-=65536,s+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):s+=String.fromCharCode(o)}return s}var Wx=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a=0;if(this._interim){let o=e.charCodeAt(a++);56320<=o&&o<=57343?t[s++]=(this._interim-55296)*1024+o-56320+65536:(t[s++]=this._interim,t[s++]=o),this._interim=0}for(let o=a;o<n;++o){let c=e.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=n)return this._interim=c,s;let f=e.charCodeAt(o);56320<=f&&f<=57343?t[s++]=(c-55296)*1024+f-56320+65536:(t[s++]=c,t[s++]=f);continue}c!==65279&&(t[s++]=c)}return s}},Yx=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let s=0,a,o,c,f,p=0,h=0;if(this.interim[0]){let b=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,k;for(;(k=this.interim[++x]&63)&&x<4;)y<<=6,y|=k;let L=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=L-x;for(;h<R;){if(h>=n)return 0;if(k=e[h++],(k&192)!==128){h--,b=!0;break}else this.interim[x++]=k,y<<=6,y|=k&63}b||(L===2?y<128?h--:t[s++]=y:L===3?y<2048||y>=55296&&y<=57343||y===65279||(t[s++]=y):y<65536||y>1114111||(t[s++]=y)),this.interim.fill(0)}let g=n-4,_=h;for(;_<n;){for(;_<g&&!((a=e[_])&128)&&!((o=e[_+1])&128)&&!((c=e[_+2])&128)&&!((f=e[_+3])&128);)t[s++]=a,t[s++]=o,t[s++]=c,t[s++]=f,_+=4;if(a=e[_++],a<128)t[s++]=a;else if((a&224)===192){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(a&31)<<6|o&63,p<128){_--;continue}t[s++]=p}else if((a&240)===224){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(p=(a&15)<<12|(o&63)<<6|c&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[s++]=p}else if((a&248)===240){if(_>=n)return this.interim[0]=a,s;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,s;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=n)return this.interim[0]=a,this.interim[1]=o,this.interim[2]=c,s;if(f=e[_++],(f&192)!==128){_--;continue}if(p=(a&7)<<18|(o&63)<<12|(c&63)<<6|f&63,p<65536||p>1114111)continue;t[s++]=p}}return s}},rb="",mr=" ",ga=class sb{constructor(){this.fg=0,this.bg=0,this.extended=new ou}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new sb;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ou=class lb{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new lb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Vi=class ab extends ga{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ou,this.combinedData=""}static fromCharData(t){let n=new ab;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},uv="di$target",Mf="di$dependencies",Xh=new Map;function Vx(e){return e[Mf]||[]}function Ut(e){if(Xh.has(e))return Xh.get(e);let t=function(n,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Kx(t,n,a)};return t._id=e,Xh.set(e,t),t}function Kx(e,t,n){t[uv]===t?t[Mf].push({id:e,index:n}):(t[Mf]=[{id:e,index:n}],t[uv]=t)}var si=Ut("BufferService"),ob=Ut("CoreMouseService"),Xr=Ut("CoreService"),Xx=Ut("CharsetService"),Cd=Ut("InstantiationService"),ub=Ut("LogService"),li=Ut("OptionsService"),cb=Ut("OscLinkService"),$x=Ut("UnicodeService"),va=Ut("DecorationService"),Bf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var g;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let s=[],a=this._optionsService.rawOptions.linkHandler,o=new Vi,c=n.getTrimmedLength(),f=-1,p=-1,h=!1;for(let _=0;_<c;_++)if(!(p===-1&&!n.hasContent(_))){if(n.loadCell(_,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=_,f=o.extended.urlId;continue}else h=o.extended.urlId!==f;else p!==-1&&(h=!0);if(h||p!==-1&&_===c-1){let b=(g=this._oscLinkService.getLinkData(f))==null?void 0:g.uri;if(b){let y={start:{x:p+1,y:e},end:{x:_+(!h&&_===c-1?1:0),y:e}},x=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let k=new URL(b);["http:","https:"].includes(k.protocol)||(x=!0)}catch{x=!0}x||s.push({text:b,range:y,activate:(k,L)=>a?a.activate(k,L,y):Gx(k,L),hover:(k,L)=>{var R;return(R=a==null?void 0:a.hover)==null?void 0:R.call(a,k,L,y)},leave:(k,L)=>{var R;return(R=a==null?void 0:a.leave)==null?void 0:R.call(a,k,L,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=_,f=o.extended.urlId):(p=-1,f=-1)}}t(s)}};Bf=dt([de(0,si),de(1,li),de(2,cb)],Bf);function Gx(e,t){if(confirm(`Do you want to navigate to ${t}?
61
61
 
62
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yu=jt("CharSizeService"),zn=jt("CoreBrowserService"),wd=jt("MouseService"),On=jt("RenderService"),$x=jt("SelectionService"),ub=jt("CharacterJoinerService"),Ks=jt("ThemeService"),cb=jt("LinkProviderService"),Gx=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ov.isErrorNoTelemetry(e)?new ov(e.message+`
62
+ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yu=Ut("CharSizeService"),zn=Ut("CoreBrowserService"),kd=Ut("MouseService"),On=Ut("RenderService"),Zx=Ut("SelectionService"),hb=Ut("CharacterJoinerService"),Ks=Ut("ThemeService"),fb=Ut("LinkProviderService"),Qx=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?cv.isErrorNoTelemetry(e)?new cv(e.message+`
63
63
 
64
64
  `+e.stack):new Error(e.message+`
65
65
 
66
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Zx=new Gx;function eu(e){Qx(e)||Zx.onUnexpectedError(e)}var Mf="Canceled";function Qx(e){return e instanceof Jx?!0:e instanceof Error&&e.name===Mf&&e.message===Mf}var Jx=class extends Error{constructor(){super(Mf),this.name=this.message}};function ew(e){return new Error(`Illegal argument: ${e}`)}var ov=class Bf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Bf)return t;let n=new Bf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Nf=class hb extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,hb.prototype)}};function Ai(e,t=0){return e[e.length-(1+t)]}var tw;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function s(o){return o>0}e.isGreaterThan=s;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(tw||(tw={}));function iw(e,t){let n=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(n,arguments))),a}}var fb;(e=>{function t(Z){return Z&&typeof Z=="object"&&typeof Z[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*a(Z){yield Z}e.single=a;function o(Z){return t(Z)?Z:a(Z)}e.wrap=o;function c(Z){return Z||n}e.from=c;function*f(Z){for(let Y=Z.length-1;Y>=0;Y--)yield Z[Y]}e.reverse=f;function p(Z){return!Z||Z[Symbol.iterator]().next().done===!0}e.isEmpty=p;function h(Z){return Z[Symbol.iterator]().next().value}e.first=h;function g(Z,Y){let O=0;for(let J of Z)if(Y(J,O++))return!0;return!1}e.some=g;function _(Z,Y){for(let O of Z)if(Y(O))return O}e.find=_;function*b(Z,Y){for(let O of Z)Y(O)&&(yield O)}e.filter=b;function*y(Z,Y){let O=0;for(let J of Z)yield Y(J,O++)}e.map=y;function*x(Z,Y){let O=0;for(let J of Z)yield*Y(J,O++)}e.flatMap=x;function*E(...Z){for(let Y of Z)yield*Y}e.concat=E;function L(Z,Y,O){let J=O;for(let ae of Z)J=Y(J,ae);return J}e.reduce=L;function*R(Z,Y,O=Z.length){for(Y<0&&(Y+=Z.length),O<0?O+=Z.length:O>Z.length&&(O=Z.length);Y<O;Y++)yield Z[Y]}e.slice=R;function $(Z,Y=Number.POSITIVE_INFINITY){let O=[];if(Y===0)return[O,Z];let J=Z[Symbol.iterator]();for(let ae=0;ae<Y;ae++){let de=J.next();if(de.done)return[O,e.empty()];O.push(de.value)}return[O,{[Symbol.iterator](){return J}}]}e.consume=$;async function I(Z){let Y=[];for await(let O of Z)Y.push(O);return Promise.resolve(Y)}e.asyncToArray=I})(fb||(fb={}));function Yr(e){if(fb.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function nw(...e){return rt(()=>Yr(e))}function rt(e){return{dispose:iw(()=>{e()})}}var db=class pb{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Yr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?pb.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};db.DISABLE_DISPOSED_WARNING=!1;var _r=db,De=class{constructor(){this._store=new _r,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};De.None=Object.freeze({dispose(){}});var Ys=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ln=typeof window=="object"?window:globalThis,Lf=class zf{constructor(t){this.element=t,this.next=zf.Undefined,this.prev=zf.Undefined}};Lf.Undefined=new Lf(void 0);var st=Lf,uv=class{constructor(){this._first=st.Undefined,this._last=st.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===st.Undefined}clear(){let e=this._first;for(;e!==st.Undefined;){let t=e.next;e.prev=st.Undefined,e.next=st.Undefined,e=t}this._first=st.Undefined,this._last=st.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new st(e);if(this._first===st.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==st.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==st.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==st.Undefined&&e.next!==st.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===st.Undefined&&e.next===st.Undefined?(this._first=st.Undefined,this._last=st.Undefined):e.next===st.Undefined?(this._last=this._last.prev,this._last.next=st.Undefined):e.prev===st.Undefined&&(this._first=this._first.next,this._first.prev=st.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==st.Undefined;)yield e.element,e=e.next}},rw=globalThis.performance&&typeof globalThis.performance.now=="function",sw=class mb{static create(t){return new mb(t)}constructor(t){this._now=rw&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Vt;(e=>{e.None=()=>De.None;function t(H,T){return _(H,()=>{},0,void 0,!0,void 0,T)}e.defer=t;function n(H){return(T,B=null,N)=>{let A=!1,j;return j=H(P=>{if(!A)return j?j.dispose():A=!0,T.call(B,P)},null,N),A&&j.dispose(),j}}e.once=n;function s(H,T,B){return h((N,A=null,j)=>H(P=>N.call(A,T(P)),null,j),B)}e.map=s;function a(H,T,B){return h((N,A=null,j)=>H(P=>{T(P),N.call(A,P)},null,j),B)}e.forEach=a;function o(H,T,B){return h((N,A=null,j)=>H(P=>T(P)&&N.call(A,P),null,j),B)}e.filter=o;function c(H){return H}e.signal=c;function f(...H){return(T,B=null,N)=>{let A=nw(...H.map(j=>j(P=>T.call(B,P))));return g(A,N)}}e.any=f;function p(H,T,B,N){let A=B;return s(H,j=>(A=T(A,j),A),N)}e.reduce=p;function h(H,T){let B,N={onWillAddFirstListener(){B=H(A.fire,A)},onDidRemoveLastListener(){B==null||B.dispose()}},A=new ue(N);return T==null||T.add(A),A.event}function g(H,T){return T instanceof Array?T.push(H):T&&T.add(H),H}function _(H,T,B=100,N=!1,A=!1,j,P){let se,k,D,V=0,C,ee={leakWarningThreshold:j,onWillAddFirstListener(){se=H(he=>{V++,k=T(k,he),N&&!D&&(pe.fire(k),k=void 0),C=()=>{let be=k;k=void 0,D=void 0,(!N||V>1)&&pe.fire(be),V=0},typeof B=="number"?(clearTimeout(D),D=setTimeout(C,B)):D===void 0&&(D=0,queueMicrotask(C))})},onWillRemoveListener(){A&&V>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,se.dispose()}},pe=new ue(ee);return P==null||P.add(pe),pe.event}e.debounce=_;function b(H,T=0,B){return e.debounce(H,(N,A)=>N?(N.push(A),N):[A],T,void 0,!0,void 0,B)}e.accumulate=b;function y(H,T=(N,A)=>N===A,B){let N=!0,A;return o(H,j=>{let P=N||!T(j,A);return N=!1,A=j,P},B)}e.latch=y;function x(H,T,B){return[e.filter(H,T,B),e.filter(H,N=>!T(N),B)]}e.split=x;function E(H,T=!1,B=[],N){let A=B.slice(),j=H(k=>{A?A.push(k):se.fire(k)});N&&N.add(j);let P=()=>{A==null||A.forEach(k=>se.fire(k)),A=null},se=new ue({onWillAddFirstListener(){j||(j=H(k=>se.fire(k)),N&&N.add(j))},onDidAddFirstListener(){A&&(T?setTimeout(P):P())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return N&&N.add(se),se.event}e.buffer=E;function L(H,T){return(B,N,A)=>{let j=T(new $);return H(function(P){let se=j.evaluate(P);se!==R&&B.call(N,se)},void 0,A)}}e.chain=L;let R=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(T){return this.steps.push(T),this}forEach(T){return this.steps.push(B=>(T(B),B)),this}filter(T){return this.steps.push(B=>T(B)?B:R),this}reduce(T,B){let N=B;return this.steps.push(A=>(N=T(N,A),N)),this}latch(T=(B,N)=>B===N){let B=!0,N;return this.steps.push(A=>{let j=B||!T(A,N);return B=!1,N=A,j?A:R}),this}evaluate(T){for(let B of this.steps)if(T=B(T),T===R)break;return T}}function I(H,T,B=N=>N){let N=(...se)=>P.fire(B(...se)),A=()=>H.on(T,N),j=()=>H.removeListener(T,N),P=new ue({onWillAddFirstListener:A,onDidRemoveLastListener:j});return P.event}e.fromNodeEventEmitter=I;function Z(H,T,B=N=>N){let N=(...se)=>P.fire(B(...se)),A=()=>H.addEventListener(T,N),j=()=>H.removeEventListener(T,N),P=new ue({onWillAddFirstListener:A,onDidRemoveLastListener:j});return P.event}e.fromDOMEventEmitter=Z;function Y(H){return new Promise(T=>n(H)(T))}e.toPromise=Y;function O(H){let T=new ue;return H.then(B=>{T.fire(B)},()=>{T.fire(void 0)}).finally(()=>{T.dispose()}),T.event}e.fromPromise=O;function J(H,T){return H(B=>T.fire(B))}e.forward=J;function ae(H,T,B){return T(B),H(N=>T(N))}e.runAndSubscribe=ae;class de{constructor(T,B){this._observable=T,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{T.addObserver(this)},onDidRemoveLastListener:()=>{T.removeObserver(this)}};this.emitter=new ue(N),B&&B.add(this.emitter)}beginUpdate(T){this._counter++}handlePossibleChange(T){}handleChange(T,B){this._hasChanged=!0}endUpdate(T){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(H,T){return new de(H,T).emitter.event}e.fromObservable=F;function le(H){return(T,B,N)=>{let A=0,j=!1,P={beginUpdate(){A++},endUpdate(){A--,A===0&&(H.reportChanges(),j&&(j=!1,T.call(B)))},handlePossibleChange(){},handleChange(){j=!0}};H.addObserver(P),H.reportChanges();let se={dispose(){H.removeObserver(P)}};return N instanceof _r?N.add(se):Array.isArray(N)&&N.push(se),se}}e.fromObservableLight=le})(Vt||(Vt={}));var Of=class jf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${jf._idPool++}`,jf.all.add(this)}start(t){this._stopWatch=new sw,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Of.all=new Set,Of._idPool=0;var lw=Of,aw=-1,_b=class gb{constructor(t,n,s=(gb._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let p=new cw(f,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,a]of this._stacks)(!t||n<a)&&(t=[s,a],n=a);return t}};_b._idPool=1;var ow=_b,uw=class vb{constructor(t){this.value=t}static create(){let t=new Error;return new vb(t.stack??"")}print(){console.warn(this.value.split(`
66
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Jx=new Qx;function eu(e){ew(e)||Jx.onUnexpectedError(e)}var Nf="Canceled";function ew(e){return e instanceof tw?!0:e instanceof Error&&e.name===Nf&&e.message===Nf}var tw=class extends Error{constructor(){super(Nf),this.name=this.message}};function iw(e){return new Error(`Illegal argument: ${e}`)}var cv=class Lf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Lf)return t;let n=new Lf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},zf=class db extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,db.prototype)}};function Ai(e,t=0){return e[e.length-(1+t)]}var nw;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function s(o){return o>0}e.isGreaterThan=s;function a(o){return o===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(nw||(nw={}));function rw(e,t){let n=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(n,arguments))),a}}var pb;(e=>{function t(Z){return Z&&typeof Z=="object"&&typeof Z[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function s(){return n}e.empty=s;function*a(Z){yield Z}e.single=a;function o(Z){return t(Z)?Z:a(Z)}e.wrap=o;function c(Z){return Z||n}e.from=c;function*f(Z){for(let Y=Z.length-1;Y>=0;Y--)yield Z[Y]}e.reverse=f;function p(Z){return!Z||Z[Symbol.iterator]().next().done===!0}e.isEmpty=p;function h(Z){return Z[Symbol.iterator]().next().value}e.first=h;function g(Z,Y){let O=0;for(let J of Z)if(Y(J,O++))return!0;return!1}e.some=g;function _(Z,Y){for(let O of Z)if(Y(O))return O}e.find=_;function*b(Z,Y){for(let O of Z)Y(O)&&(yield O)}e.filter=b;function*y(Z,Y){let O=0;for(let J of Z)yield Y(J,O++)}e.map=y;function*x(Z,Y){let O=0;for(let J of Z)yield*Y(J,O++)}e.flatMap=x;function*k(...Z){for(let Y of Z)yield*Y}e.concat=k;function L(Z,Y,O){let J=O;for(let ce of Z)J=Y(J,ce);return J}e.reduce=L;function*R(Z,Y,O=Z.length){for(Y<0&&(Y+=Z.length),O<0?O+=Z.length:O>Z.length&&(O=Z.length);Y<O;Y++)yield Z[Y]}e.slice=R;function $(Z,Y=Number.POSITIVE_INFINITY){let O=[];if(Y===0)return[O,Z];let J=Z[Symbol.iterator]();for(let ce=0;ce<Y;ce++){let pe=J.next();if(pe.done)return[O,e.empty()];O.push(pe.value)}return[O,{[Symbol.iterator](){return J}}]}e.consume=$;async function I(Z){let Y=[];for await(let O of Z)Y.push(O);return Promise.resolve(Y)}e.asyncToArray=I})(pb||(pb={}));function Yr(e){if(pb.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function sw(...e){return lt(()=>Yr(e))}function lt(e){return{dispose:rw(()=>{e()})}}var mb=class _b{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Yr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?_b.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};mb.DISABLE_DISPOSED_WARNING=!1;var _r=mb,Re=class{constructor(){this._store=new _r,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Re.None=Object.freeze({dispose(){}});var Ys=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ln=typeof window=="object"?window:globalThis,Of=class jf{constructor(t){this.element=t,this.next=jf.Undefined,this.prev=jf.Undefined}};Of.Undefined=new Of(void 0);var at=Of,hv=class{constructor(){this._first=at.Undefined,this._last=at.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===at.Undefined}clear(){let e=this._first;for(;e!==at.Undefined;){let t=e.next;e.prev=at.Undefined,e.next=at.Undefined,e=t}this._first=at.Undefined,this._last=at.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new at(e);if(this._first===at.Undefined)this._first=n,this._last=n;else if(t){let a=this._last;this._last=n,n.prev=a,a.next=n}else{let a=this._first;this._first=n,n.next=a,a.prev=n}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(n))}}shift(){if(this._first!==at.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==at.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==at.Undefined&&e.next!==at.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===at.Undefined&&e.next===at.Undefined?(this._first=at.Undefined,this._last=at.Undefined):e.next===at.Undefined?(this._last=this._last.prev,this._last.next=at.Undefined):e.prev===at.Undefined&&(this._first=this._first.next,this._first.prev=at.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==at.Undefined;)yield e.element,e=e.next}},lw=globalThis.performance&&typeof globalThis.performance.now=="function",aw=class gb{static create(t){return new gb(t)}constructor(t){this._now=lw&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Kt;(e=>{e.None=()=>Re.None;function t(H,E){return _(H,()=>{},0,void 0,!0,void 0,E)}e.defer=t;function n(H){return(E,B=null,N)=>{let A=!1,j;return j=H(P=>{if(!A)return j?j.dispose():A=!0,E.call(B,P)},null,N),A&&j.dispose(),j}}e.once=n;function s(H,E,B){return h((N,A=null,j)=>H(P=>N.call(A,E(P)),null,j),B)}e.map=s;function a(H,E,B){return h((N,A=null,j)=>H(P=>{E(P),N.call(A,P)},null,j),B)}e.forEach=a;function o(H,E,B){return h((N,A=null,j)=>H(P=>E(P)&&N.call(A,P),null,j),B)}e.filter=o;function c(H){return H}e.signal=c;function f(...H){return(E,B=null,N)=>{let A=sw(...H.map(j=>j(P=>E.call(B,P))));return g(A,N)}}e.any=f;function p(H,E,B,N){let A=B;return s(H,j=>(A=E(A,j),A),N)}e.reduce=p;function h(H,E){let B,N={onWillAddFirstListener(){B=H(A.fire,A)},onDidRemoveLastListener(){B==null||B.dispose()}},A=new he(N);return E==null||E.add(A),A.event}function g(H,E){return E instanceof Array?E.push(H):E&&E.add(H),H}function _(H,E,B=100,N=!1,A=!1,j,P){let oe,T,D,V=0,w,ie={leakWarningThreshold:j,onWillAddFirstListener(){oe=H(le=>{V++,T=E(T,le),N&&!D&&(ae.fire(T),T=void 0),w=()=>{let ge=T;T=void 0,D=void 0,(!N||V>1)&&ae.fire(ge),V=0},typeof B=="number"?(clearTimeout(D),D=setTimeout(w,B)):D===void 0&&(D=0,queueMicrotask(w))})},onWillRemoveListener(){A&&V>0&&(w==null||w())},onDidRemoveLastListener(){w=void 0,oe.dispose()}},ae=new he(ie);return P==null||P.add(ae),ae.event}e.debounce=_;function b(H,E=0,B){return e.debounce(H,(N,A)=>N?(N.push(A),N):[A],E,void 0,!0,void 0,B)}e.accumulate=b;function y(H,E=(N,A)=>N===A,B){let N=!0,A;return o(H,j=>{let P=N||!E(j,A);return N=!1,A=j,P},B)}e.latch=y;function x(H,E,B){return[e.filter(H,E,B),e.filter(H,N=>!E(N),B)]}e.split=x;function k(H,E=!1,B=[],N){let A=B.slice(),j=H(T=>{A?A.push(T):oe.fire(T)});N&&N.add(j);let P=()=>{A==null||A.forEach(T=>oe.fire(T)),A=null},oe=new he({onWillAddFirstListener(){j||(j=H(T=>oe.fire(T)),N&&N.add(j))},onDidAddFirstListener(){A&&(E?setTimeout(P):P())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return N&&N.add(oe),oe.event}e.buffer=k;function L(H,E){return(B,N,A)=>{let j=E(new $);return H(function(P){let oe=j.evaluate(P);oe!==R&&B.call(N,oe)},void 0,A)}}e.chain=L;let R=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(E){return this.steps.push(E),this}forEach(E){return this.steps.push(B=>(E(B),B)),this}filter(E){return this.steps.push(B=>E(B)?B:R),this}reduce(E,B){let N=B;return this.steps.push(A=>(N=E(N,A),N)),this}latch(E=(B,N)=>B===N){let B=!0,N;return this.steps.push(A=>{let j=B||!E(A,N);return B=!1,N=A,j?A:R}),this}evaluate(E){for(let B of this.steps)if(E=B(E),E===R)break;return E}}function I(H,E,B=N=>N){let N=(...oe)=>P.fire(B(...oe)),A=()=>H.on(E,N),j=()=>H.removeListener(E,N),P=new he({onWillAddFirstListener:A,onDidRemoveLastListener:j});return P.event}e.fromNodeEventEmitter=I;function Z(H,E,B=N=>N){let N=(...oe)=>P.fire(B(...oe)),A=()=>H.addEventListener(E,N),j=()=>H.removeEventListener(E,N),P=new he({onWillAddFirstListener:A,onDidRemoveLastListener:j});return P.event}e.fromDOMEventEmitter=Z;function Y(H){return new Promise(E=>n(H)(E))}e.toPromise=Y;function O(H){let E=new he;return H.then(B=>{E.fire(B)},()=>{E.fire(void 0)}).finally(()=>{E.dispose()}),E.event}e.fromPromise=O;function J(H,E){return H(B=>E.fire(B))}e.forward=J;function ce(H,E,B){return E(B),H(N=>E(N))}e.runAndSubscribe=ce;class pe{constructor(E,B){this._observable=E,this._counter=0,this._hasChanged=!1;let N={onWillAddFirstListener:()=>{E.addObserver(this)},onDidRemoveLastListener:()=>{E.removeObserver(this)}};this.emitter=new he(N),B&&B.add(this.emitter)}beginUpdate(E){this._counter++}handlePossibleChange(E){}handleChange(E,B){this._hasChanged=!0}endUpdate(E){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(H,E){return new pe(H,E).emitter.event}e.fromObservable=F;function se(H){return(E,B,N)=>{let A=0,j=!1,P={beginUpdate(){A++},endUpdate(){A--,A===0&&(H.reportChanges(),j&&(j=!1,E.call(B)))},handlePossibleChange(){},handleChange(){j=!0}};H.addObserver(P),H.reportChanges();let oe={dispose(){H.removeObserver(P)}};return N instanceof _r?N.add(oe):Array.isArray(N)&&N.push(oe),oe}}e.fromObservableLight=se})(Kt||(Kt={}));var Hf=class Uf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Uf._idPool++}`,Uf.all.add(this)}start(t){this._stopWatch=new aw,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Hf.all=new Set,Hf._idPool=0;var ow=Hf,uw=-1,vb=class yb{constructor(t,n,s=(yb._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let s=this.threshold;if(s<=0||n<s)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[o,c]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${c}):`;console.warn(f),console.warn(o);let p=new fw(f,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[s,a]of this._stacks)(!t||n<a)&&(t=[s,a],n=a);return t}};vb._idPool=1;var cw=vb,hw=class bb{constructor(t){this.value=t}static create(){let t=new Error;return new bb(t.stack??"")}print(){console.warn(this.value.split(`
67
67
  `).slice(2).join(`
68
- `))}},cw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},hw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},fw=0,$h=class{constructor(e){this.value=e,this.id=fw++}},dw=2,pw,ue=class{constructor(t){var n,s,a,o;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new ow((t==null?void 0:t.onListenerError)??eu,((s=this._options)==null?void 0:s.leakWarningThreshold)??aw):void 0,this._perfMon=(a=this._options)!=null&&a._profName?new lw(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,n,s,a;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||s.call(n),(a=this._leakageMon)==null||a.dispose())}get event(){return this._event??(this._event=(t,n,s)=>{var f,p,h,g,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let b=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(b);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new hw(`${b}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((f=this._options)==null?void 0:f.onListenerError)||eu)(x),De.None}if(this._disposed)return De.None;n&&(t=t.bind(n));let a=new $h(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=uw.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof $h?(this._deliveryQueue??(this._deliveryQueue=new mw),this._listeners=[this._listeners,a]):this._listeners.push(a):((h=(p=this._options)==null?void 0:p.onWillAddFirstListener)==null||h.call(p,this),this._listeners=a,(_=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||_.call(g,this)),this._size++;let c=rt(()=>{o==null||o(),this._removeListener(a)});return s instanceof _r?s.add(c):Array.isArray(s)&&s.push(c),c}),this._event}_removeListener(t){var o,c,f,p;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(p=(f=this._options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f,this),this._size=0;return}let n=this._listeners,s=n.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*dw<=n.length){let h=0;for(let g=0;g<n.length;g++)n[g]?n[h++]=n[g]:a&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(t,n){var a;if(!t)return;let s=((a=this._options)==null?void 0:a.onListenerError)||eu;if(!s){t.value(n);return}try{t.value(n)}catch(o){s(o)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,s,a,o;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(a=this._perfMon)==null||a.start(this._size),this._listeners)if(this._listeners instanceof $h)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},mw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Hf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Hf.INSTANCE=new Hf;var Cd=Hf;function _w(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Cd.INSTANCE.onDidChangeZoomLevel;function gw(e){return Cd.INSTANCE.getZoomFactor(e)}Cd.INSTANCE.onDidChangeFullscreen;var Xs=typeof navigator=="object"?navigator.userAgent:"",Uf=Xs.indexOf("Firefox")>=0,vw=Xs.indexOf("AppleWebKit")>=0,kd=Xs.indexOf("Chrome")>=0,yw=!kd&&Xs.indexOf("Safari")>=0;Xs.indexOf("Electron/")>=0;Xs.indexOf("Android")>=0;var Gh=!1;if(typeof Ln.matchMedia=="function"){let e=Ln.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ln.matchMedia("(display-mode: fullscreen)");Gh=e.matches,_w(Ln,e,({matches:n})=>{Gh&&t.matches||(Gh=n)})}var qs="en",Pf=!1,If=!1,tu=!1,yb=!1,Wo,iu=qs,cv=qs,bw,Zi,Wr=globalThis,Yt,$y;typeof Wr.vscode<"u"&&typeof Wr.vscode.process<"u"?Yt=Wr.vscode.process:typeof process<"u"&&typeof(($y=process==null?void 0:process.versions)==null?void 0:$y.node)=="string"&&(Yt=process);var Gy,Sw=typeof((Gy=Yt==null?void 0:Yt.versions)==null?void 0:Gy.electron)=="string",xw=Sw&&(Yt==null?void 0:Yt.type)==="renderer",Zy;if(typeof Yt=="object"){Pf=Yt.platform==="win32",If=Yt.platform==="darwin",tu=Yt.platform==="linux",tu&&Yt.env.SNAP&&Yt.env.SNAP_REVISION,Yt.env.CI||Yt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wo=qs,iu=qs;let e=Yt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wo=t.userLocale,cv=t.osLocale,iu=t.resolvedLanguage||qs,bw=(Zy=t.languagePack)==null?void 0:Zy.translationsConfigFile}catch{}yb=!0}else typeof navigator=="object"&&!xw?(Zi=navigator.userAgent,Pf=Zi.indexOf("Windows")>=0,If=Zi.indexOf("Macintosh")>=0,(Zi.indexOf("Macintosh")>=0||Zi.indexOf("iPad")>=0||Zi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tu=Zi.indexOf("Linux")>=0,(Zi==null?void 0:Zi.indexOf("Mobi"))>=0,iu=globalThis._VSCODE_NLS_LANGUAGE||qs,Wo=navigator.language.toLowerCase(),cv=Wo):console.error("Unable to resolve platform.");var bb=Pf,un=If,ww=tu,hv=yb,cn=Zi,ur=iu,Cw;(e=>{function t(){return ur}e.value=t;function n(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=n;function s(){return ur==="en"}e.isDefault=s})(Cw||(Cw={}));var kw=typeof Wr.postMessage=="function"&&!Wr.importScripts;(()=>{if(kw){let e=[];Wr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let o=e[s];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),o.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),Wr.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Ew=!!(cn&&cn.indexOf("Chrome")>=0);cn&&cn.indexOf("Firefox")>=0;!Ew&&cn&&cn.indexOf("Safari")>=0;cn&&cn.indexOf("Edg/")>=0;cn&&cn.indexOf("Android")>=0;var Hs=typeof navigator=="object"?navigator:{};hv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Hs&&Hs.clipboard&&Hs.clipboard.writeText,hv||Hs&&Hs.clipboard&&Hs.clipboard.readText;var Ed=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Zh=new Ed,fv=new Ed,dv=new Ed,Tw=new Array(230),Sb;(e=>{function t(f){return Zh.keyCodeToStr(f)}e.toString=t;function n(f){return Zh.strToKeyCode(f)}e.fromString=n;function s(f){return fv.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return dv.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return fv.strToKeyCode(f)||dv.strToKeyCode(f)}e.fromUserSettings=o;function c(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Zh.keyCodeToStr(f)}e.toElectronAccelerator=c})(Sb||(Sb={}));var Aw=class xb{constructor(t,n,s,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof xb&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${s}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Dw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Dw=class{constructor(e){if(e.length===0)throw ew("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Rw(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Sb.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Uf)switch(t){case 59:return 85;case 60:if(ww)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(un)return 57;break}else if(vw&&(un&&t===93||!un&&t===92))return 57;return Tw[t]||0}var Mw=un?256:2048,Bw=512,Nw=1024,Lw=un?2048:256,pv=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=Rw(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Mw),this.altKey&&(t|=Bw),this.shiftKey&&(t|=Nw),this.metaKey&&(t|=Lw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Aw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},mv=new WeakMap;function zw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Ow=class{static getSameOriginWindowChain(e){let t=mv.get(e);if(!t){t=[],mv.set(e,t);let n=e,s;do s=zw(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,s+=f.left}return{top:n,left:s}}},Yo=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Ow.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},_v=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(kd){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")yw&&bb?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Uf&&!un?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},wb=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),jw;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Hw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:wb})})(jw||(jw={}));var Hw=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?wb:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Td=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Nf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Nf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Uw=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Nf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=rt(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Pw;(e=>{async function t(s){let a,o=await Promise.all(s.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(s){return new Promise(async(a,o)=>{try{await s(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(Pw||(Pw={}));var gv=class qi{static fromArray(t){return new qi(n=>{n.emitMany(t)})}static fromPromise(t){return new qi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new qi(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new qi(async n=>{await Promise.all(t.map(async s=>{for await(let a of s)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new ue,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Vt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new qi(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return qi.map(this,t)}static filter(t,n){return new qi(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,n=>!!n)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return qi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};gv.EMPTY=gv.fromArray([]);var{getWindow:on,getWindowId:Iw,onDidRegisterWindow:Fw}=(function(){let e=new Map,t={window:Ln,disposables:new _r};e.set(Ln.vscodeWindowId,t);let n=new ue,s=new ue,a=new ue;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return De.None;let f=new _r,p={window:c,disposables:f.add(new _r)};return e.set(c.vscodeWindowId,p),f.add(rt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(we(c,Rt.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(p),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let f=c;if((h=f==null?void 0:f.ownerDocument)!=null&&h.defaultView)return f.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:Ln},getDocument(c){return on(c).document}}})(),qw=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function we(e,t,n,s){return new qw(e,t,n,s)}var vv=function(e,t,n,s){return we(e,t,n,s)},Ad,Ww=class extends Uw{constructor(e){super(),this.defaultTarget=e&&on(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},yv=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){eu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),s.set(o,!0);c.length>0;)c.sort(yv.sort),c.shift().execute();s.set(o,!1)};Ad=(o,c,f=0)=>{let p=Iw(o),h=new yv(c,f),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(h),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>a(p))),h}})();function Yw(e){let t=e.getBoundingClientRect(),n=on(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Rt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Vw=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=_i(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=_i(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=_i(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=_i(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=_i(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=_i(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=_i(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=_i(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=_i(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=_i(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=_i(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=_i(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=_i(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=_i(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function _i(e){return typeof e=="number"?`${e}px`:e}function aa(e){return new Vw(e)}var Cb=class{constructor(){this._hooks=new _r,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=on(e)}this._hooks.add(we(o,Rt.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(we(o,Rt.POINTER_UP,c=>this.stopMonitoring(!0)))}};function Kw(e,t,n){let s=null,a=null;if(typeof n.value=="function"?(s="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[s]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var ia=class Xt extends De{constructor(){super(),this.dispatched=!1,this.targets=new uv,this.ignoreTargets=new uv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Vt.runAndSubscribe(Fw,({window:t,disposables:n})=>{n.add(we(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(we(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(we(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Ln,disposables:this._store}))}static addTarget(t){if(!Xt.isTouchDevice())return De.None;Xt.INSTANCE||(Xt.INSTANCE=new Xt);let n=Xt.INSTANCE.targets.push(t);return rt(n)}static ignoreTarget(t){if(!Xt.isTouchDevice())return De.None;Xt.INSTANCE||(Xt.INSTANCE=new Xt);let n=Xt.INSTANCE.ignoreTargets.push(t);return rt(n)}static isTouchDevice(){return"ontouchstart"in Ln||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,a=t.targetTouches.length;s<a;s++){let o=t.targetTouches.item(s);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(ln.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let p=this.activeTouches[f.identifier],h=Date.now()-p.initialTimeStamp;if(h<Xt.HOLD_DELAY&&Math.abs(p.initialPageX-Ai(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ai(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Tap,p.initialTarget);g.pageX=Ai(p.rollingPageX),g.pageY=Ai(p.rollingPageY),this.dispatchEvent(g)}else if(h>=Xt.HOLD_DELAY&&Math.abs(p.initialPageX-Ai(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ai(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Contextmenu,p.initialTarget);g.pageX=Ai(p.rollingPageX),g.pageY=Ai(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Ai(p.rollingPageX),_=Ai(p.rollingPageY),b=Ai(p.rollingTimestamps)-p.rollingTimestamps[0],y=g-p.rollingPageX[0],x=_-p.rollingPageY[0],E=[...this.targets].filter(L=>p.initialTarget instanceof Node&&L.contains(p.initialTarget));this.inertia(t,E,s,Math.abs(y)/b,y>0?1:-1,g,Math.abs(x)/b,x>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(ln.End,p.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===ln.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>Xt.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===ln.Change||t.type===ln.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==s;)a++,o=o.parentElement;n.push([a,s])}n.sort((s,a)=>s[0]-a[0]);for(let[s,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,a,o,c,f,p,h){this.handle=Ad(t,()=>{let g=Date.now(),_=g-s,b=0,y=0,x=!0;a+=Xt.SCROLL_FRICTION*_,f+=Xt.SCROLL_FRICTION*_,a>0&&(x=!1,b=o*a*_),f>0&&(x=!1,y=p*f*_);let E=this.newGestureEvent(ln.Change);E.translationX=b,E.translationY=y,n.forEach(L=>L.dispatchEvent(E)),x||this.inertia(t,n,g,a,o,c+b,f,p,h+y)})}onTouchMove(t){let n=Date.now();for(let s=0,a=t.changedTouches.length;s<a;s++){let o=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent(ln.Change,c.initialTarget);f.translationX=o.pageX-Ai(c.rollingPageX),f.translationY=o.pageY-Ai(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ia.SCROLL_FRICTION=-.005,ia.HOLD_DELAY=700,ia.CLEAR_TAP_COUNT_TIME=400,ht([Kw],ia,"isTouchDevice",1);var Xw=ia,Dd=class extends De{onclick(e,t){this._register(we(e,Rt.CLICK,n=>t(new Yo(on(e),n))))}onmousedown(e,t){this._register(we(e,Rt.MOUSE_DOWN,n=>t(new Yo(on(e),n))))}onmouseover(e,t){this._register(we(e,Rt.MOUSE_OVER,n=>t(new Yo(on(e),n))))}onmouseleave(e,t){this._register(we(e,Rt.MOUSE_LEAVE,n=>t(new Yo(on(e),n))))}onkeydown(e,t){this._register(we(e,Rt.KEY_DOWN,n=>t(new pv(n))))}onkeyup(e,t){this._register(we(e,Rt.KEY_UP,n=>t(new pv(n))))}oninput(e,t){this._register(we(e,Rt.INPUT,t))}onblur(e,t){this._register(we(e,Rt.BLUR,t))}onfocus(e,t){this._register(we(e,Rt.FOCUS,t))}onchange(e,t){this._register(we(e,Rt.CHANGE,t))}ignoreGesture(e){return Xw.ignoreTarget(e)}},bv=11,$w=class extends Dd{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=bv+"px",this.domNode.style.height=bv+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Cb),this._register(vv(this.bgDomNode,Rt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(vv(this.domNode,Rt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Ww),this._pointerdownScheduleRepeatTimer=this._register(new Td)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,on(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Gw=class Ff{constructor(t,n,s,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>s&&(a=s-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=s,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Ff(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Ff(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let s=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:p}}},Zw=class extends De{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Gw(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new xv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=xv.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Sv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Qh(e,t){let n=t-e;return function(s){return e+n*eC(s)}}function Qw(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var xv=class qf{constructor(t,n,s,a){this.from=t,this.to=n,this.duration=a,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,s){if(Math.abs(t-n)>2.5*s){let a,o;return t<n?(a=t+.75*s,o=n-.75*s):(a=t-.75*s,o=n+.75*s),Qw(Qh(t,a),Qh(o,n),.33)}return Qh(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),a=this.scrollTop(n);return new Sv(s,a,!1)}return new Sv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return qf.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new qf(t,n,a,s)}};function Jw(e){return Math.pow(e,3)}function eC(e){return 1-Jw(1-e)}var tC=class extends De{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Td)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},iC=140,kb=class extends Dd{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new tC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Cb),this._shouldRender=!0,this.domNode=aa(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(we(this.domNode.domNode,Rt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new $w(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=aa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(we(this.slider.domNode,Rt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=Yw(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(bb&&c>iC){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Eb=class Wf{constructor(t,n,s,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Wf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,a,o){let c=Math.max(0,s-t),f=Math.max(0,c-2*n),p=a>0&&a>s;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*f/a))),g=(f-h)/(a-s),_=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Wf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},nC=class extends kb{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Eb(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},rC=class extends kb{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Eb(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},sC=500,wv=50,lC=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Yf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,s=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-s);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(kd){let n=on(t.browserEvent),s=gw(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let a=null,o=new lC(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),p=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,f),1),g=Math.max(a,c),_=Math.max(o,f);g%p===0&&_%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Yf.INSTANCE=new Yf;var aC=Yf,oC=class extends Dd{constructor(e,t,n){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=cC(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let s={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new rC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new nC(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=aa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=aa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=aa(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Td),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,un&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new _v(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new _v(n))};this._mouseWheelToDispose.push(we(this._listenOnDomNode,Rt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=aC.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!un&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=wv*o,_=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,_)}if(c){let g=wv*c,_=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(h,_)}h=this._scrollable.validateScrollPosition(h),(p.scrollLeft!==h.scrollLeft||p.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,s=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),sC)}},uC=class extends oC{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function cC(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,un&&(t.className+=" mac"),t}var Vf=class extends De{constructor(e,t,n,s,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Zw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Ad(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new uC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Vt.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(rt(()=>this._styleElement.remove())),this._register(Vt.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
69
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Vf=ht([fe(2,si),fe(3,zn),fe(4,lb),fe(5,Ks),fe(6,li),fe(7,On)],Vf);var Kf=class extends De{constructor(e,t,n,s,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=a,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(o=>this._removeDecoration(o))),this._register(rt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Kf=ht([fe(1,si),fe(2,zn),fe(3,va),fe(4,On)],Kf);var hC=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},rn={full:0,left:0,center:0,right:0},cr={full:0,left:0,center:0,right:0},Yl={full:0,left:0,center:0,right:0},uu=class extends De{constructor(e,t,n,s,a,o,c,f){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new hC,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(rt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);cr.full=this._canvas.width,cr.left=e,cr.center=t,cr.right=e,this._refreshDrawHeightConstants(),Yl.full=1,Yl.left=1,Yl.center=1+cr.left,Yl.right=1+cr.left+cr.center}_refreshDrawHeightConstants(){rn.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);rn.left=t,rn.center=t,rn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Yl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rn[e.position||"full"]/2),cr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+rn[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};uu=ht([fe(2,si),fe(3,va),fe(4,On),fe(5,li),fe(6,Ks),fe(7,zn)],uu);var re;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
70
- `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(re||(re={}));var nu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(nu||(nu={}));var Tb;(e=>e.ST=`${re.ESC}\\`)(Tb||(Tb={}));var Xf=class{constructor(e,t,n,s,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=a,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${re.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Xf=ht([fe(2,si),fe(3,li),fe(4,Xr),fe(5,On)],Xf);var Mt=0,Bt=0,Nt=0,ut=0,Cv={css:"#00000000",rgba:0},St;(e=>{function t(a,o,c,f){return f!==void 0?`#${jr(a)}${jr(o)}${jr(c)}${jr(f)}`:`#${jr(a)}${jr(o)}${jr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(St||(St={}));var it;(e=>{function t(p,h){if(ut=(h.rgba&255)/255,ut===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,b=h.rgba>>8&255,y=p.rgba>>24&255,x=p.rgba>>16&255,E=p.rgba>>8&255;Mt=y+Math.round((g-y)*ut),Bt=x+Math.round((_-x)*ut),Nt=E+Math.round((b-E)*ut);let L=St.toCss(Mt,Bt,Nt),R=St.toRgba(Mt,Bt,Nt);return{css:L,rgba:R}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=ru.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return St.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Mt,Bt,Nt]=ru.toChannels(h),{css:St.toCss(Mt,Bt,Nt),rgba:h}}e.opaque=a;function o(p,h){return ut=Math.round(h*255),[Mt,Bt,Nt]=ru.toChannels(p.rgba),{css:St.toCss(Mt,Bt,Nt,ut),rgba:St.toRgba(Mt,Bt,Nt,ut)}}e.opacity=o;function c(p,h){return ut=p.rgba&255,o(p,ut*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(it||(it={}));var lt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Mt=parseInt(a.slice(1,2).repeat(2),16),Bt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),St.toColor(Mt,Bt,Nt);case 5:return Mt=parseInt(a.slice(1,2).repeat(2),16),Bt=parseInt(a.slice(2,3).repeat(2),16),Nt=parseInt(a.slice(3,4).repeat(2),16),ut=parseInt(a.slice(4,5).repeat(2),16),St.toColor(Mt,Bt,Nt,ut);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Mt=parseInt(o[1]),Bt=parseInt(o[2]),Nt=parseInt(o[3]),ut=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),St.toColor(Mt,Bt,Nt,ut);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Mt,Bt,Nt,ut]=t.getImageData(0,0,1,1).data,ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:St.toRgba(Mt,Bt,Nt,ut),css:a}}e.toColor=s})(lt||(lt={}));var ii;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ii||(ii={}));var ru;(e=>{function t(c,f){if(ut=(f&255)/255,ut===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,b=c>>16&255,y=c>>8&255;return Mt=_+Math.round((p-_)*ut),Bt=b+Math.round((h-b)*ut),Nt=y+Math.round((g-y)*ut),St.toRgba(Mt,Bt,Nt)}e.blend=t;function n(c,f,p){let h=ii.relativeLuminance(c>>8),g=ii.relativeLuminance(f>>8);if(Mn(h,g)<p){if(g<h){let y=s(c,f,p),x=Mn(h,ii.relativeLuminance(y>>8));if(x<p){let E=a(c,f,p),L=Mn(h,ii.relativeLuminance(E>>8));return x>L?y:E}return y}let _=a(c,f,p),b=Mn(h,ii.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Mn(h,ii.relativeLuminance(y>>8));return b>x?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,E=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));for(;E<p&&(b>0||y>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),E=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,E=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));for(;E<p&&(b<255||y<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),E=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(ru||(ru={}));function jr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var fC=class extends ga{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Vi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],s=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),p=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==p){if(h-a>1){let g=this._getJoinedRanges(s,c,o,t,a);for(let _=0;_<g.length;_++)n.push(g[_])}a=h,c=o,f=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||mr.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(s,c,o,t,a);for(let g=0;g<h.length;g++)n.push(h[g])}return n}_getJoinedRanges(e,t,n,s,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let p=this._characterJoiners[f].handler(o);for(let h=0;h<p.length;h++)cu._mergeRanges(c,p[h])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,s,a),c}_stringRangesToCellRanges(e,t,n){let s=0,a=!1,o=0,c=e[s];if(c){for(let f=n;f<this._bufferService.cols;f++){let p=t.getWidth(f),h=t.getString(f).length||mr.length;if(p!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++s],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let a=e[s];if(n){if(t[1]<=a[0])return e[s-1][1]=t[1],e;if(t[1]<=a[1])return e[s-1][1]=Math.max(t[1],a[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=a[0])return e.splice(s,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};cu=ht([fe(0,si)],cu);function dC(e){return 57508<=e&&e<=57558}function pC(e){return 9472<=e&&e<=9631}function mC(e){return dC(e)||pC(e)}function _C(){return{css:{canvas:Vo(),cell:Vo()},device:{canvas:Vo(),cell:Vo(),char:{width:0,height:0,left:0,top:0}}}}function Vo(){return{width:0,height:0}}var $f=class{constructor(e,t,n,s,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new Vi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,a,o,c,f,p,h,g){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<o+1&&(x=o+1);let E,L=0,R="",$=0,I=0,Z=0,Y=0,O=!1,J=0,ae=!1,de=0,F=0,le=[],H=h!==-1&&g!==-1;for(let T=0;T<x;T++){e.loadCell(T,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let N=!1,A=T>=F,j=T,P=this._workCell;if(b.length>0&&T===b[0][0]&&A){let je=b.shift(),yi=this._isCellInSelection(je[0],t);for($=je[0]+1;$<je[1];$++)A&&(A=yi===this._isCellInSelection($,t));A&&(A=!n||o<je[0]||o>=je[1]),A?(N=!0,P=new fC(this._workCell,e.translateToString(!0,je[0],je[1]),je[1]-je[0]),j=je[1]-1,B=P.getWidth()):F=je[1]}let se=this._isCellInSelection(T,t),k=n&&T===o,D=H&&T>=h&&T<=g,V=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,je=>{V=!0});let C=P.getChars()||mr;if(C===" "&&(P.isUnderline()||P.isOverline())&&(C=" "),de=B*f-p.get(C,P.isBold(),P.isItalic()),!E)E=this._document.createElement("span");else if(L&&(se&&ae||!se&&!ae&&P.bg===I)&&(se&&ae&&y.selectionForeground||P.fg===Z)&&P.extended.ext===Y&&D===O&&de===J&&!k&&!N&&!V&&A){P.isInvisible()?R+=mr:R+=C,L++;continue}else L&&(E.textContent=R),E=this._document.createElement("span"),L=0,R="";if(I=P.bg,Z=P.fg,Y=P.extended.ext,O=D,J=de,ae=se,N&&o>=T&&o<=j&&(o=T),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(le.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&le.push("xterm-cursor-blink"),le.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":le.push("xterm-cursor-outline");break;case"block":le.push("xterm-cursor-block");break;case"bar":le.push("xterm-cursor-bar");break;case"underline":le.push("xterm-cursor-underline");break}}if(P.isBold()&&le.push("xterm-bold"),P.isItalic()&&le.push("xterm-italic"),P.isDim()&&le.push("xterm-dim"),P.isInvisible()?R=mr:R=P.getChars()||mr,P.isUnderline()&&(le.push(`xterm-underline-${P.extended.underlineStyle}`),R===" "&&(R=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${ga.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let je=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&je<8&&(je+=8),E.style.textDecorationColor=y.ansi[je].css}P.isOverline()&&(le.push("xterm-overline"),R===" "&&(R=" ")),P.isStrikethrough()&&le.push("xterm-strikethrough"),D&&(E.style.textDecoration="underline");let ee=P.getFgColor(),pe=P.getFgColorMode(),he=P.getBgColor(),be=P.getBgColorMode(),Ue=!!P.isInverse();if(Ue){let je=ee;ee=he,he=je;let yi=pe;pe=be,be=yi}let Se,Ht,Qt=!1;this._decorationService.forEachDecorationAtCell(T,t,void 0,je=>{je.options.layer!=="top"&&Qt||(je.backgroundColorRGB&&(be=50331648,he=je.backgroundColorRGB.rgba>>8&16777215,Se=je.backgroundColorRGB),je.foregroundColorRGB&&(pe=50331648,ee=je.foregroundColorRGB.rgba>>8&16777215,Ht=je.foregroundColorRGB),Qt=je.options.layer==="top")}),!Qt&&se&&(Se=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=Se.rgba>>8&16777215,be=50331648,Qt=!0,y.selectionForeground&&(pe=50331648,ee=y.selectionForeground.rgba>>8&16777215,Ht=y.selectionForeground)),Qt&&le.push("xterm-decoration-top");let ai;switch(be){case 16777216:case 33554432:ai=y.ansi[he],le.push(`xterm-bg-${he}`);break;case 50331648:ai=St.toColor(he>>16,he>>8&255,he&255),this._addStyle(E,`background-color:#${kv((he>>>0).toString(16),"0",6)}`);break;case 0:default:Ue?(ai=y.foreground,le.push("xterm-bg-257")):ai=y.background}switch(Se||P.isDim()&&(Se=it.multiplyOpacity(ai,.5)),pe){case 16777216:case 33554432:P.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(E,ai,y.ansi[ee],P,Se,void 0)||le.push(`xterm-fg-${ee}`);break;case 50331648:let je=St.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(E,ai,je,P,Se,Ht)||this._addStyle(E,`color:#${kv(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(E,ai,y.foreground,P,Se,Ht)||Ue&&le.push("xterm-fg-257")}le.length&&(E.className=le.join(" "),le.length=0),!k&&!N&&!V&&A?L++:E.textContent=R,de!==this.defaultSpacing&&(E.style.letterSpacing=`${de}px`),_.push(E),T=j}return E&&L&&(E.textContent=R),_}_applyMinimumContrast(e,t,n,s,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||mC(s.getCode()))return!1;let c=this._getContrastCache(s),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);f=it.ensureContrastRatio(a||t,o||n,p),c.setColor((a||t).rgba,(o||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};$f=ht([fe(1,ub),fe(2,li),fe(3,zn),fe(4,Xr),fe(5,va),fe(6,Ks)],$f);function kv(e,t,n){for(;e.length<n;)e=t+e;return e}var gC=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,s,a,o],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(a),this._container.appendChild(o),t.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(e,t,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},vC=class{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(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),p=Math.min(c,e.rows-1);if(f>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function yC(){return new vC}var Jh="xterm-dom-renderer-owner-",Fi="xterm-rows",Ko="xterm-fg-",Ev="xterm-bg-",Vl="xterm-focus",Xo="xterm-selection",bC=1,Gf=class extends De{constructor(e,t,n,s,a,o,c,f,p,h,g,_,b,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=h,this._bufferService=g,this._coreService=_,this._coreBrowserService=b,this._themeService=y,this._terminalClass=bC++,this._rowElements=[],this._selectionRenderModel=yC(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fi),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(Xo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=_C(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance($f,document),this._element.classList.add(Jh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(rt(()=>{this._element.classList.remove(Jh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new gC(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Fi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Fi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Fi} .xterm-dim { color: ${it.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Xo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Xo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Xo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Ko}${o} { color: ${c.css}; }${this._terminalSelector} .${Ko}${o}.xterm-dim { color: ${it.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Ev}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Ko}257 { color: ${it.opaque(e.background).css}; }${this._terminalSelector} .${Ko}257.xterm-dim { color: ${it.multiplyOpacity(it.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ev}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];f.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=s===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,p,h));let g=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let _=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,s=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${s*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,s=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let h=p+n.ydisp,g=this._rowElements[p],_=n.lines.get(h);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,h,h===s,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Jh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,a,o){n<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),s=Math.max(Math.min(s,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,p=f.ybase+f.y,h=Math.min(f.x,a-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=s;++y){let x=y+f.ydisp,E=this._rowElements[y],L=f.lines.get(x);if(!E||!L)break;E.replaceChildren(...this._rowFactory.createRow(L,x,x===p,_,b,h,g,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===s?t:a)-1:-1))}}};Gf=ht([fe(7,xd),fe(8,yu),fe(9,li),fe(10,si),fe(11,Xr),fe(12,zn),fe(13,Ks)],Gf);var Zf=class extends De{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new xC(this._optionsService))}catch{this._measureStrategy=this._register(new SC(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Zf=ht([fe(2,li)],Zf);var Ab=class extends De{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},SC=class extends Ab{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},xC=class extends Ab{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},wC=class extends De{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new CC(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Vt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(we(this._textarea,"focus",()=>this._isFocused=!0)),this._register(we(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},CC=class extends De{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ys),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=we(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},kC=class extends De{constructor(){super(),this.linkProviders=[],this._register(rt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Rd(e,t,n){let s=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-s.left-o,t.clientY-s.top-c]}function EC(e,t,n,s,a,o,c,f,p){if(!o)return;let h=Rd(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(p?c/2:0))/c),h[1]=Math.ceil(h[1]/f),h[0]=Math.min(Math.max(h[0],1),s+(p?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var Qf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,a){return EC(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=Rd(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Qf=ht([fe(0,On),fe(1,yu)],Qf);var TC=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Db={};jx(Db,{getSafariVersion:()=>DC,isChromeOS:()=>Nb,isFirefox:()=>Rb,isIpad:()=>RC,isIphone:()=>MC,isLegacyEdge:()=>AC,isLinux:()=>Md,isMac:()=>hu,isNode:()=>bu,isSafari:()=>Mb,isWindows:()=>Bb});var bu=typeof process<"u"&&"title"in process,ya=bu?"node":navigator.userAgent,ba=bu?"node":navigator.platform,Rb=ya.includes("Firefox"),AC=ya.includes("Edge"),Mb=/^((?!chrome|android).)*safari/i.test(ya);function DC(){if(!Mb)return 0;let e=ya.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var hu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ba),RC=ba==="iPad",MC=ba==="iPhone",Bb=["Windows","Win16","Win32","WinCE"].includes(ba),Md=ba.indexOf("Linux")>=0,Nb=/\bCrOS\b/.test(ya),Lb=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,n=0,s=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},BC=class extends Lb{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},NC=class extends Lb{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fu=!bu&&"requestIdleCallback"in window?NC:BC,LC=class{constructor(){this._queue=new fu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Jf=class extends De{constructor(e,t,n,s,a,o,c,f,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Ys),this._pausedResizeTask=new LC,this._observerDisposable=this._register(new Ys),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 ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new TC((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new zC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=rt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Jf=ht([fe(2,li),fe(3,yu),fe(4,Xr),fe(5,va),fe(6,si),fe(7,zn),fe(8,Ks)],Jf);var zC=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function OC(e,t,n,s){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return UC(a,o,e,t,n,s)+Su(o,t,n,s)+PC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",fa(Math.abs(a-e),ha(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=HC(o>t?e:a,n)+(f-1)*n.cols+1+jC(o>t?a:e);return fa(p,ha(c,s))}function jC(e,t){return e-1}function HC(e,t){return t.cols-e}function UC(e,t,n,s,a,o){return Su(t,s,a,o).length===0?"":fa(Ob(e,t,e,t-Vr(t,a),!1,a).length,ha("D",o))}function Su(e,t,n,s){let a=e-Vr(e,n),o=t-Vr(t,n),c=Math.abs(a-o)-IC(e,t,n);return fa(c,ha(zb(e,t),s))}function PC(e,t,n,s,a,o){let c;Su(t,s,a,o).length>0?c=s-Vr(s,a):c=t;let f=s,p=FC(e,t,n,s,a,o);return fa(Ob(e,c,n,f,p==="C",a).length,ha(p,o))}function IC(e,t,n){var c;let s=0,a=e-Vr(e,n),o=t-Vr(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=zb(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&s++}return s}function Vr(e,t){let n=0,s=t.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return n}function FC(e,t,n,s,a,o){let c;return Su(n,s,a,o).length>0?c=s-Vr(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function zb(e,t){return e>t?"A":"B"}function Ob(e,t,n,s,a,o){let c=e,f=t,p="";for(;(c!==n||f!==s)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(p+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return p+o.buffer.translateBufferLineToString(f,!1,e,c)}function ha(e,t){let n=t?"O":"[";return re.ESC+n+e}function fa(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var qC=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Tv(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ef=50,WC=15,YC=50,VC=500,KC=" ",XC=new RegExp(KC,"g"),ed=class extends De{constructor(e,t,n,s,a,o,c,f,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Vi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new qC(this._bufferService),this._activeSelectionMode=0,this._register(rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);s.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?s[s.length-1]+=f:s.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(a=>a.replace(XC," ")).join(Bb?`\r
68
+ `))}},fw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},dw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},pw=0,$h=class{constructor(e){this.value=e,this.id=pw++}},mw=2,_w,he=class{constructor(t){var n,s,a,o;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new cw((t==null?void 0:t.onListenerError)??eu,((s=this._options)==null?void 0:s.leakWarningThreshold)??uw):void 0,this._perfMon=(a=this._options)!=null&&a._profName?new ow(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var t,n,s,a;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||s.call(n),(a=this._leakageMon)==null||a.dispose())}get event(){return this._event??(this._event=(t,n,s)=>{var f,p,h,g,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let b=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(b);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new dw(`${b}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((f=this._options)==null?void 0:f.onListenerError)||eu)(x),Re.None}if(this._disposed)return Re.None;n&&(t=t.bind(n));let a=new $h(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=hw.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof $h?(this._deliveryQueue??(this._deliveryQueue=new gw),this._listeners=[this._listeners,a]):this._listeners.push(a):((h=(p=this._options)==null?void 0:p.onWillAddFirstListener)==null||h.call(p,this),this._listeners=a,(_=(g=this._options)==null?void 0:g.onDidAddFirstListener)==null||_.call(g,this)),this._size++;let c=lt(()=>{o==null||o(),this._removeListener(a)});return s instanceof _r?s.add(c):Array.isArray(s)&&s.push(c),c}),this._event}_removeListener(t){var o,c,f,p;if((c=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||c.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(p=(f=this._options)==null?void 0:f.onDidRemoveLastListener)==null||p.call(f,this),this._size=0;return}let n=this._listeners,s=n.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*mw<=n.length){let h=0;for(let g=0;g<n.length;g++)n[g]?n[h++]=n[g]:a&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(t,n){var a;if(!t)return;let s=((a=this._options)==null?void 0:a.onListenerError)||eu;if(!s){t.value(n);return}try{t.value(n)}catch(o){s(o)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,s,a,o;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(a=this._perfMon)==null||a.start(this._size),this._listeners)if(this._listeners instanceof $h)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(o=this._perfMon)==null||o.stop()}hasListeners(){return this._size>0}},gw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Pf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let s=this.getWindowId(n);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Pf.INSTANCE=new Pf;var Ed=Pf;function vw(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Ed.INSTANCE.onDidChangeZoomLevel;function yw(e){return Ed.INSTANCE.getZoomFactor(e)}Ed.INSTANCE.onDidChangeFullscreen;var Xs=typeof navigator=="object"?navigator.userAgent:"",If=Xs.indexOf("Firefox")>=0,bw=Xs.indexOf("AppleWebKit")>=0,Td=Xs.indexOf("Chrome")>=0,Sw=!Td&&Xs.indexOf("Safari")>=0;Xs.indexOf("Electron/")>=0;Xs.indexOf("Android")>=0;var Gh=!1;if(typeof Ln.matchMedia=="function"){let e=Ln.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ln.matchMedia("(display-mode: fullscreen)");Gh=e.matches,vw(Ln,e,({matches:n})=>{Gh&&t.matches||(Gh=n)})}var qs="en",Ff=!1,qf=!1,tu=!1,Sb=!1,Wo,iu=qs,fv=qs,xw,Zi,Wr=globalThis,Vt,Zy;typeof Wr.vscode<"u"&&typeof Wr.vscode.process<"u"?Vt=Wr.vscode.process:typeof process<"u"&&typeof((Zy=process==null?void 0:process.versions)==null?void 0:Zy.node)=="string"&&(Vt=process);var Qy,ww=typeof((Qy=Vt==null?void 0:Vt.versions)==null?void 0:Qy.electron)=="string",Cw=ww&&(Vt==null?void 0:Vt.type)==="renderer",Jy;if(typeof Vt=="object"){Ff=Vt.platform==="win32",qf=Vt.platform==="darwin",tu=Vt.platform==="linux",tu&&Vt.env.SNAP&&Vt.env.SNAP_REVISION,Vt.env.CI||Vt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Wo=qs,iu=qs;let e=Vt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Wo=t.userLocale,fv=t.osLocale,iu=t.resolvedLanguage||qs,xw=(Jy=t.languagePack)==null?void 0:Jy.translationsConfigFile}catch{}Sb=!0}else typeof navigator=="object"&&!Cw?(Zi=navigator.userAgent,Ff=Zi.indexOf("Windows")>=0,qf=Zi.indexOf("Macintosh")>=0,(Zi.indexOf("Macintosh")>=0||Zi.indexOf("iPad")>=0||Zi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tu=Zi.indexOf("Linux")>=0,(Zi==null?void 0:Zi.indexOf("Mobi"))>=0,iu=globalThis._VSCODE_NLS_LANGUAGE||qs,Wo=navigator.language.toLowerCase(),fv=Wo):console.error("Unable to resolve platform.");var xb=Ff,un=qf,kw=tu,dv=Sb,cn=Zi,ur=iu,Ew;(e=>{function t(){return ur}e.value=t;function n(){return ur.length===2?ur==="en":ur.length>=3?ur[0]==="e"&&ur[1]==="n"&&ur[2]==="-":!1}e.isDefaultVariant=n;function s(){return ur==="en"}e.isDefault=s})(Ew||(Ew={}));var Tw=typeof Wr.postMessage=="function"&&!Wr.importScripts;(()=>{if(Tw){let e=[];Wr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let o=e[s];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(s,1),o.callback();return}}});let t=0;return n=>{let s=++t;e.push({id:s,callback:n}),Wr.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Aw=!!(cn&&cn.indexOf("Chrome")>=0);cn&&cn.indexOf("Firefox")>=0;!Aw&&cn&&cn.indexOf("Safari")>=0;cn&&cn.indexOf("Edg/")>=0;cn&&cn.indexOf("Android")>=0;var Hs=typeof navigator=="object"?navigator:{};dv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Hs&&Hs.clipboard&&Hs.clipboard.writeText,dv||Hs&&Hs.clipboard&&Hs.clipboard.readText;var Ad=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Zh=new Ad,pv=new Ad,mv=new Ad,Dw=new Array(230),wb;(e=>{function t(f){return Zh.keyCodeToStr(f)}e.toString=t;function n(f){return Zh.strToKeyCode(f)}e.fromString=n;function s(f){return pv.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return mv.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return pv.strToKeyCode(f)||mv.strToKeyCode(f)}e.fromUserSettings=o;function c(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Zh.keyCodeToStr(f)}e.toElectronAccelerator=c})(wb||(wb={}));var Rw=class Cb{constructor(t,n,s,a,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=s,this.metaKey=a,this.keyCode=o}equals(t){return t instanceof Cb&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",s=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${n}${s}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Mw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Mw=class{constructor(e){if(e.length===0)throw iw("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Bw(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return wb.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(If)switch(t){case 59:return 85;case 60:if(kw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(un)return 57;break}else if(bw&&(un&&t===93||!un&&t===92))return 57;return Dw[t]||0}var Nw=un?256:2048,Lw=512,zw=1024,Ow=un?2048:256,_v=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=Bw(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Nw),this.altKey&&(t|=Lw),this.shiftKey&&(t|=zw),this.metaKey&&(t|=Ow),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Rw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},gv=new WeakMap;function jw(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Hw=class{static getSameOriginWindowChain(e){let t=gv.get(e);if(!t){t=[],gv.set(e,t);let n=e,s;do s=jw(n),s?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=s;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,s=0,a=this.getSameOriginWindowChain(e);for(let o of a){let c=o.window.deref();if(n+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!o.iframeElement)break;let f=o.iframeElement.getBoundingClientRect();n+=f.top,s+=f.left}return{top:n,left:s}}},Yo=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Hw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},vv=class{constructor(e,t=0,n=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let s=!1;if(Td){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,f=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*f):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?If&&!un?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Sw&&xb?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*f):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?If&&!un?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*f):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},kb=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Uw;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Pw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kb})})(Uw||(Uw={}));var Pw=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?kb:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Dd=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new zf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new zf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Iw=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new zf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=lt(()=>{n.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Fw;(e=>{async function t(s){let a,o=await Promise.all(s.map(c=>c.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return o}e.settled=t;function n(s){return new Promise(async(a,o)=>{try{await s(a,o)}catch(c){o(c)}})}e.withAsyncBody=n})(Fw||(Fw={}));var yv=class qi{static fromArray(t){return new qi(n=>{n.emitMany(t)})}static fromPromise(t){return new qi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new qi(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new qi(async n=>{await Promise.all(t.map(async s=>{for await(let a of s)n.emitOne(a)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new he,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new qi(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return qi.map(this,t)}static filter(t,n){return new qi(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return qi.filter(this,t)}static coalesce(t){return qi.filter(t,n=>!!n)}coalesce(){return qi.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return qi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};yv.EMPTY=yv.fromArray([]);var{getWindow:on,getWindowId:qw,onDidRegisterWindow:Ww}=(function(){let e=new Map,t={window:Ln,disposables:new _r};e.set(Ln.vscodeWindowId,t);let n=new he,s=new he,a=new he;function o(c,f){return(typeof c=="number"?e.get(c):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Re.None;let f=new _r,p={window:c,disposables:f.add(new _r)};return e.set(c.vscodeWindowId,p),f.add(lt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(we(c,Bt.BEFORE_UNLOAD,()=>{a.fire(c)})),n.fire(p),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:o,getWindow(c){var h;let f=c;if((h=f==null?void 0:f.ownerDocument)!=null&&h.defaultView)return f.ownerDocument.defaultView.window;let p=c;return p!=null&&p.view?p.view.window:Ln},getDocument(c){return on(c).document}}})(),Yw=class{constructor(e,t,n,s){this._node=e,this._type=t,this._handler=n,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function we(e,t,n,s){return new Yw(e,t,n,s)}var bv=function(e,t,n,s){return we(e,t,n,s)},Rd,Vw=class extends Iw{constructor(e){super(),this.defaultTarget=e&&on(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Sv=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){eu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,s=new Map,a=o=>{n.set(o,!1);let c=e.get(o)??[];for(t.set(o,c),e.set(o,[]),s.set(o,!0);c.length>0;)c.sort(Sv.sort),c.shift().execute();s.set(o,!1)};Rd=(o,c,f=0)=>{let p=qw(o),h=new Sv(c,f),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(h),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>a(p))),h}})();function Kw(e){let t=e.getBoundingClientRect(),n=on(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Bt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Xw=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=_i(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=_i(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=_i(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=_i(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=_i(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=_i(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=_i(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=_i(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=_i(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=_i(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=_i(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=_i(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=_i(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=_i(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function _i(e){return typeof e=="number"?`${e}px`:e}function aa(e){return new Xw(e)}var Eb=class{constructor(){this._hooks=new _r,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,s,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=a;let o=e;try{e.setPointerCapture(t),this._hooks.add(lt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=on(e)}this._hooks.add(we(o,Bt.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(we(o,Bt.POINTER_UP,c=>this.stopMonitoring(!0)))}};function $w(e,t,n){let s=null,a=null;if(typeof n.value=="function"?(s="value",a=n.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(s="get",a=n.get),!a)throw new Error("not supported");let o=`$memoize$${t}`;n[s]=function(...c){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,c)}),this[o]}}var ln;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ln||(ln={}));var ia=class $t extends Re{constructor(){super(),this.dispatched=!1,this.targets=new hv,this.ignoreTargets=new hv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Kt.runAndSubscribe(Ww,({window:t,disposables:n})=>{n.add(we(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(we(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(we(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Ln,disposables:this._store}))}static addTarget(t){if(!$t.isTouchDevice())return Re.None;$t.INSTANCE||($t.INSTANCE=new $t);let n=$t.INSTANCE.targets.push(t);return lt(n)}static ignoreTarget(t){if(!$t.isTouchDevice())return Re.None;$t.INSTANCE||($t.INSTANCE=new $t);let n=$t.INSTANCE.ignoreTargets.push(t);return lt(n)}static isTouchDevice(){return"ontouchstart"in Ln||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,a=t.targetTouches.length;s<a;s++){let o=t.targetTouches.item(s);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let c=this.newGestureEvent(ln.Start,o.target);c.pageX=o.pageX,c.pageY=o.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let s=Date.now(),a=Object.keys(this.activeTouches).length;for(let o=0,c=n.changedTouches.length;o<c;o++){let f=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let p=this.activeTouches[f.identifier],h=Date.now()-p.initialTimeStamp;if(h<$t.HOLD_DELAY&&Math.abs(p.initialPageX-Ai(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ai(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Tap,p.initialTarget);g.pageX=Ai(p.rollingPageX),g.pageY=Ai(p.rollingPageY),this.dispatchEvent(g)}else if(h>=$t.HOLD_DELAY&&Math.abs(p.initialPageX-Ai(p.rollingPageX))<30&&Math.abs(p.initialPageY-Ai(p.rollingPageY))<30){let g=this.newGestureEvent(ln.Contextmenu,p.initialTarget);g.pageX=Ai(p.rollingPageX),g.pageY=Ai(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Ai(p.rollingPageX),_=Ai(p.rollingPageY),b=Ai(p.rollingTimestamps)-p.rollingTimestamps[0],y=g-p.rollingPageX[0],x=_-p.rollingPageY[0],k=[...this.targets].filter(L=>p.initialTarget instanceof Node&&L.contains(p.initialTarget));this.inertia(t,k,s,Math.abs(y)/b,y>0?1:-1,g,Math.abs(x)/b,x>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(ln.End,p.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=n,s.tapCount=0,s}dispatchEvent(t){if(t.type===ln.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>$t.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===ln.Change||t.type===ln.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let n=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let a=0,o=t.initialTarget;for(;o&&o!==s;)a++,o=o.parentElement;n.push([a,s])}n.sort((s,a)=>s[0]-a[0]);for(let[s,a]of n)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,s,a,o,c,f,p,h){this.handle=Rd(t,()=>{let g=Date.now(),_=g-s,b=0,y=0,x=!0;a+=$t.SCROLL_FRICTION*_,f+=$t.SCROLL_FRICTION*_,a>0&&(x=!1,b=o*a*_),f>0&&(x=!1,y=p*f*_);let k=this.newGestureEvent(ln.Change);k.translationX=b,k.translationY=y,n.forEach(L=>L.dispatchEvent(k)),x||this.inertia(t,n,g,a,o,c+b,f,p,h+y)})}onTouchMove(t){let n=Date.now();for(let s=0,a=t.changedTouches.length;s<a;s++){let o=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let c=this.activeTouches[o.identifier],f=this.newGestureEvent(ln.Change,c.initialTarget);f.translationX=o.pageX-Ai(c.rollingPageX),f.translationY=o.pageY-Ai(c.rollingPageY),f.pageX=o.pageX,f.pageY=o.pageY,this.dispatchEvent(f),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(o.pageX),c.rollingPageY.push(o.pageY),c.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};ia.SCROLL_FRICTION=-.005,ia.HOLD_DELAY=700,ia.CLEAR_TAP_COUNT_TIME=400,dt([$w],ia,"isTouchDevice",1);var Gw=ia,Md=class extends Re{onclick(e,t){this._register(we(e,Bt.CLICK,n=>t(new Yo(on(e),n))))}onmousedown(e,t){this._register(we(e,Bt.MOUSE_DOWN,n=>t(new Yo(on(e),n))))}onmouseover(e,t){this._register(we(e,Bt.MOUSE_OVER,n=>t(new Yo(on(e),n))))}onmouseleave(e,t){this._register(we(e,Bt.MOUSE_LEAVE,n=>t(new Yo(on(e),n))))}onkeydown(e,t){this._register(we(e,Bt.KEY_DOWN,n=>t(new _v(n))))}onkeyup(e,t){this._register(we(e,Bt.KEY_UP,n=>t(new _v(n))))}oninput(e,t){this._register(we(e,Bt.INPUT,t))}onblur(e,t){this._register(we(e,Bt.BLUR,t))}onfocus(e,t){this._register(we(e,Bt.FOCUS,t))}onchange(e,t){this._register(we(e,Bt.CHANGE,t))}ignoreGesture(e){return Gw.ignoreTarget(e)}},xv=11,Zw=class extends Md{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=xv+"px",this.domNode.style.height=xv+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Eb),this._register(bv(this.bgDomNode,Bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(bv(this.domNode,Bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Vw),this._pointerdownScheduleRepeatTimer=this._register(new Dd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,on(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Qw=class Wf{constructor(t,n,s,a,o,c,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,s=s|0,a=a|0,o=o|0,c=c|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,n<0&&(n=0),a+n>s&&(a=s-n),a<0&&(a=0),o<0&&(o=0),f+o>c&&(f=c-o),f<0&&(f=0),this.width=n,this.scrollWidth=s,this.scrollLeft=a,this.height=o,this.scrollHeight=c,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Wf(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Wf(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let s=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,p=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:a,scrollLeftChanged:o,heightChanged:c,scrollHeightChanged:f,scrollTopChanged:p}}},Jw=class extends Re{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Qw(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let s;t?s=new Cv(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Cv.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},wv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Qh(e,t){let n=t-e;return function(s){return e+n*iC(s)}}function eC(e,t,n){return function(s){return s<n?e(s/n):t((s-n)/(1-n))}}var Cv=class Yf{constructor(t,n,s,a){this.from=t,this.to=n,this.duration=a,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,s){if(Math.abs(t-n)>2.5*s){let a,o;return t<n?(a=t+.75*s,o=n-.75*s):(a=t-.75*s,o=n+.75*s),eC(Qh(t,a),Qh(o,n),.33)}return Qh(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let s=this.scrollLeft(n),a=this.scrollTop(n);return new wv(s,a,!1)}return new wv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return Yf.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new Yf(t,n,a,s)}};function tC(e){return Math.pow(e,3)}function iC(e){return 1-tC(1-e)}var nC=class extends Re{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Dd)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},rC=140,Tb=class extends Md{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new nC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Eb),this._shouldRender=!0,this.domNode=aa(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(we(this.domNode.domNode,Bt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Zw(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,s){this.slider=aa(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(we(this.slider.domNode,Bt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);n<=a&&a<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let a=Kw(this.domNode.domNode);t=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let o=this._sliderOrthogonalPointerPosition(a),c=Math.abs(o-n);if(xb&&c>rC){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Ab=class Vf{constructor(t,n,s,a,o,c){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=o,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Vf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,s,a,o){let c=Math.max(0,s-t),f=Math.max(0,c-2*n),p=a>0&&a>s;if(!p)return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*f/a))),g=(f-h)/(a-s),_=o*g;return{computedAvailableSize:Math.round(c),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Vf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,s=this._scrollPosition;return n<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},sC=class extends Tb{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ab(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},lC=class extends Tb{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Ab(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},aC=500,kv=50,oC=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Kf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,s=1,a=this._rear;do{let o=a===this._front?t:Math.pow(2,-s);if(t-=o,n+=this._memory[a].score*o,a===this._front)break;a=(this._capacity+a-1)%this._capacity,s++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Td){let n=on(t.browserEvent),s=yw(n);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,s){let a=null,o=new oC(t,n,s);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,a)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),n){let a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),c=Math.abs(n.deltaX),f=Math.abs(n.deltaY),p=Math.max(Math.min(a,c),1),h=Math.max(Math.min(o,f),1),g=Math.max(a,c),_=Math.max(o,f);g%p===0&&_%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Kf.INSTANCE=new Kf;var uC=Kf,cC=class extends Md{constructor(e,t,n){super(),this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new he),this.onWillScroll=this._onWillScroll.event,this._options=fC(t),this._scrollable=n,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let s={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new lC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new sC(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=aa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=aa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=aa(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new Dd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Yr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,un&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new vv(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Yr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new vv(n))};this._mouseWheelToDispose.push(we(this._listenOnDomNode,Bt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=uC.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let f=!un&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||f)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),h={};if(o){let g=kv*o,_=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,_)}if(c){let g=kv*c,_=p.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(h,_)}h=this._scrollable.validateScrollPosition(h),(p.scrollLeft!==h.scrollLeft||p.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),n=!0)}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,s=n?" left":"",a=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${a}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),aC)}},hC=class extends cC{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function fC(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,un&&(t.className+=" mac"),t}var Xf=class extends Re{constructor(e,t,n,s,a,o,c,f){super(),this._bufferService=n,this._optionsService=c,this._renderService=f,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Jw({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Rd(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new hC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Kt.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(lt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(lt(()=>this._styleElement.remove())),this._register(Kt.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
69
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Xf=dt([de(2,si),de(3,zn),de(4,ob),de(5,Ks),de(6,li),de(7,On)],Xf);var $f=class extends Re{constructor(e,t,n,s,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=s,this._renderService=a,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(o=>this._removeDecoration(o))),this._register(lt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};$f=dt([de(1,si),de(2,zn),de(3,va),de(4,On)],$f);var dC=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},rn={full:0,left:0,center:0,right:0},cr={full:0,left:0,center:0,right:0},Yl={full:0,left:0,center:0,right:0},uu=class extends Re{constructor(e,t,n,s,a,o,c,f){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=s,this._renderService=a,this._optionsService=o,this._themeService=c,this._coreBrowserService=f,this._colorZoneStore=new dC,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(lt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);cr.full=this._canvas.width,cr.left=e,cr.center=t,cr.right=e,this._refreshDrawHeightConstants(),Yl.full=1,Yl.left=1,Yl.center=1+cr.left,Yl.right=1+cr.left+cr.center}_refreshDrawHeightConstants(){rn.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);rn.left=t,rn.center=t,rn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*rn.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Yl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rn[e.position||"full"]/2),cr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+rn[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};uu=dt([de(2,si),de(3,va),de(4,On),de(5,li),de(6,Ks),de(7,zn)],uu);var re;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
70
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(re||(re={}));var nu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(nu||(nu={}));var Db;(e=>e.ST=`${re.ESC}\\`)(Db||(Db={}));var Gf=class{constructor(e,t,n,s,a,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=s,this._coreService=a,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${re.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Gf=dt([de(2,si),de(3,li),de(4,Xr),de(5,On)],Gf);var Nt=0,Lt=0,zt=0,ht=0,Ev={css:"#00000000",rgba:0},wt;(e=>{function t(a,o,c,f){return f!==void 0?`#${jr(a)}${jr(o)}${jr(c)}${jr(f)}`:`#${jr(a)}${jr(o)}${jr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(wt||(wt={}));var rt;(e=>{function t(p,h){if(ht=(h.rgba&255)/255,ht===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,b=h.rgba>>8&255,y=p.rgba>>24&255,x=p.rgba>>16&255,k=p.rgba>>8&255;Nt=y+Math.round((g-y)*ht),Lt=x+Math.round((_-x)*ht),zt=k+Math.round((b-k)*ht);let L=wt.toCss(Nt,Lt,zt),R=wt.toRgba(Nt,Lt,zt);return{css:L,rgba:R}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=ru.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return wt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Nt,Lt,zt]=ru.toChannels(h),{css:wt.toCss(Nt,Lt,zt),rgba:h}}e.opaque=a;function o(p,h){return ht=Math.round(h*255),[Nt,Lt,zt]=ru.toChannels(p.rgba),{css:wt.toCss(Nt,Lt,zt,ht),rgba:wt.toRgba(Nt,Lt,zt,ht)}}e.opacity=o;function c(p,h){return ht=p.rgba&255,o(p,ht*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(rt||(rt={}));var ot;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Nt=parseInt(a.slice(1,2).repeat(2),16),Lt=parseInt(a.slice(2,3).repeat(2),16),zt=parseInt(a.slice(3,4).repeat(2),16),wt.toColor(Nt,Lt,zt);case 5:return Nt=parseInt(a.slice(1,2).repeat(2),16),Lt=parseInt(a.slice(2,3).repeat(2),16),zt=parseInt(a.slice(3,4).repeat(2),16),ht=parseInt(a.slice(4,5).repeat(2),16),wt.toColor(Nt,Lt,zt,ht);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Nt=parseInt(o[1]),Lt=parseInt(o[2]),zt=parseInt(o[3]),ht=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),wt.toColor(Nt,Lt,zt,ht);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Nt,Lt,zt,ht]=t.getImageData(0,0,1,1).data,ht!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:wt.toRgba(Nt,Lt,zt,ht),css:a}}e.toColor=s})(ot||(ot={}));var ii;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ii||(ii={}));var ru;(e=>{function t(c,f){if(ht=(f&255)/255,ht===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,b=c>>16&255,y=c>>8&255;return Nt=_+Math.round((p-_)*ht),Lt=b+Math.round((h-b)*ht),zt=y+Math.round((g-y)*ht),wt.toRgba(Nt,Lt,zt)}e.blend=t;function n(c,f,p){let h=ii.relativeLuminance(c>>8),g=ii.relativeLuminance(f>>8);if(Mn(h,g)<p){if(g<h){let y=s(c,f,p),x=Mn(h,ii.relativeLuminance(y>>8));if(x<p){let k=a(c,f,p),L=Mn(h,ii.relativeLuminance(k>>8));return x>L?y:k}return y}let _=a(c,f,p),b=Mn(h,ii.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Mn(h,ii.relativeLuminance(y>>8));return b>x?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,k=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));for(;k<p&&(b>0||y>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),k=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,k=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));for(;k<p&&(b<255||y<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),k=Mn(ii.relativeLuminance2(b,y,x),ii.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(ru||(ru={}));function jr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var pC=class extends ga{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Vi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],s=t.translateToString(!0),a=0,o=0,c=0,f=t.getFg(0),p=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==p){if(h-a>1){let g=this._getJoinedRanges(s,c,o,t,a);for(let _=0;_<g.length;_++)n.push(g[_])}a=h,c=o,f=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||mr.length}if(this._bufferService.cols-a>1){let h=this._getJoinedRanges(s,c,o,t,a);for(let g=0;g<h.length;g++)n.push(h[g])}return n}_getJoinedRanges(e,t,n,s,a){let o=e.substring(t,n),c=[];try{c=this._characterJoiners[0].handler(o)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let p=this._characterJoiners[f].handler(o);for(let h=0;h<p.length;h++)cu._mergeRanges(c,p[h])}catch(p){console.error(p)}return this._stringRangesToCellRanges(c,s,a),c}_stringRangesToCellRanges(e,t,n){let s=0,a=!1,o=0,c=e[s];if(c){for(let f=n;f<this._bufferService.cols;f++){let p=t.getWidth(f),h=t.getString(f).length||mr.length;if(p!==0){if(!a&&c[0]<=o&&(c[0]=f,a=!0),c[1]<=o){if(c[1]=f,c=e[++s],!c)break;c[0]<=o?(c[0]=f,a=!0):a=!1}o+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let s=0;s<e.length;s++){let a=e[s];if(n){if(t[1]<=a[0])return e[s-1][1]=t[1],e;if(t[1]<=a[1])return e[s-1][1]=Math.max(t[1],a[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=a[0])return e.splice(s,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};cu=dt([de(0,si)],cu);function mC(e){return 57508<=e&&e<=57558}function _C(e){return 9472<=e&&e<=9631}function gC(e){return mC(e)||_C(e)}function vC(){return{css:{canvas:Vo(),cell:Vo()},device:{canvas:Vo(),cell:Vo(),char:{width:0,height:0,left:0,top:0}}}}function Vo(){return{width:0,height:0}}var Zf=class{constructor(e,t,n,s,a,o,c){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=s,this._coreService=a,this._decorationService=o,this._themeService=c,this._workCell=new Vi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,s,a,o,c,f,p,h,g){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<o+1&&(x=o+1);let k,L=0,R="",$=0,I=0,Z=0,Y=0,O=!1,J=0,ce=!1,pe=0,F=0,se=[],H=h!==-1&&g!==-1;for(let E=0;E<x;E++){e.loadCell(E,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let N=!1,A=E>=F,j=E,P=this._workCell;if(b.length>0&&E===b[0][0]&&A){let He=b.shift(),yi=this._isCellInSelection(He[0],t);for($=He[0]+1;$<He[1];$++)A&&(A=yi===this._isCellInSelection($,t));A&&(A=!n||o<He[0]||o>=He[1]),A?(N=!0,P=new pC(this._workCell,e.translateToString(!0,He[0],He[1]),He[1]-He[0]),j=He[1]-1,B=P.getWidth()):F=He[1]}let oe=this._isCellInSelection(E,t),T=n&&E===o,D=H&&E>=h&&E<=g,V=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,He=>{V=!0});let w=P.getChars()||mr;if(w===" "&&(P.isUnderline()||P.isOverline())&&(w=" "),pe=B*f-p.get(w,P.isBold(),P.isItalic()),!k)k=this._document.createElement("span");else if(L&&(oe&&ce||!oe&&!ce&&P.bg===I)&&(oe&&ce&&y.selectionForeground||P.fg===Z)&&P.extended.ext===Y&&D===O&&pe===J&&!T&&!N&&!V&&A){P.isInvisible()?R+=mr:R+=w,L++;continue}else L&&(k.textContent=R),k=this._document.createElement("span"),L=0,R="";if(I=P.bg,Z=P.fg,Y=P.extended.ext,O=D,J=pe,ce=oe,N&&o>=E&&o<=j&&(o=E),!this._coreService.isCursorHidden&&T&&this._coreService.isCursorInitialized){if(se.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&se.push("xterm-cursor-blink"),se.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":se.push("xterm-cursor-outline");break;case"block":se.push("xterm-cursor-block");break;case"bar":se.push("xterm-cursor-bar");break;case"underline":se.push("xterm-cursor-underline");break}}if(P.isBold()&&se.push("xterm-bold"),P.isItalic()&&se.push("xterm-italic"),P.isDim()&&se.push("xterm-dim"),P.isInvisible()?R=mr:R=P.getChars()||mr,P.isUnderline()&&(se.push(`xterm-underline-${P.extended.underlineStyle}`),R===" "&&(R=" "),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${ga.toColorRGB(P.getUnderlineColor()).join(",")})`;else{let He=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&He<8&&(He+=8),k.style.textDecorationColor=y.ansi[He].css}P.isOverline()&&(se.push("xterm-overline"),R===" "&&(R=" ")),P.isStrikethrough()&&se.push("xterm-strikethrough"),D&&(k.style.textDecoration="underline");let ie=P.getFgColor(),ae=P.getFgColorMode(),le=P.getBgColor(),ge=P.getBgColorMode(),Ee=!!P.isInverse();if(Ee){let He=ie;ie=le,le=He;let yi=ae;ae=ge,ge=yi}let Se,Ze,Fe=!1;this._decorationService.forEachDecorationAtCell(E,t,void 0,He=>{He.options.layer!=="top"&&Fe||(He.backgroundColorRGB&&(ge=50331648,le=He.backgroundColorRGB.rgba>>8&16777215,Se=He.backgroundColorRGB),He.foregroundColorRGB&&(ae=50331648,ie=He.foregroundColorRGB.rgba>>8&16777215,Ze=He.foregroundColorRGB),Fe=He.options.layer==="top")}),!Fe&&oe&&(Se=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,le=Se.rgba>>8&16777215,ge=50331648,Fe=!0,y.selectionForeground&&(ae=50331648,ie=y.selectionForeground.rgba>>8&16777215,Ze=y.selectionForeground)),Fe&&se.push("xterm-decoration-top");let ai;switch(ge){case 16777216:case 33554432:ai=y.ansi[le],se.push(`xterm-bg-${le}`);break;case 50331648:ai=wt.toColor(le>>16,le>>8&255,le&255),this._addStyle(k,`background-color:#${Tv((le>>>0).toString(16),"0",6)}`);break;case 0:default:Ee?(ai=y.foreground,se.push("xterm-bg-257")):ai=y.background}switch(Se||P.isDim()&&(Se=rt.multiplyOpacity(ai,.5)),ae){case 16777216:case 33554432:P.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(k,ai,y.ansi[ie],P,Se,void 0)||se.push(`xterm-fg-${ie}`);break;case 50331648:let He=wt.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(k,ai,He,P,Se,Ze)||this._addStyle(k,`color:#${Tv(ie.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,ai,y.foreground,P,Se,Ze)||Ee&&se.push("xterm-fg-257")}se.length&&(k.className=se.join(" "),se.length=0),!T&&!N&&!V&&A?L++:k.textContent=R,pe!==this.defaultSpacing&&(k.style.letterSpacing=`${pe}px`),_.push(k),E=j}return k&&L&&(k.textContent=R),_}_applyMinimumContrast(e,t,n,s,a,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||gC(s.getCode()))return!1;let c=this._getContrastCache(s),f;if(!a&&!o&&(f=c.getColor(t.rgba,n.rgba)),f===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);f=rt.ensureContrastRatio(a||t,o||n,p),c.setColor((a||t).rgba,(o||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,s=this._selectionEnd;return!n||!s?!1:this._columnSelectMode?n[0]<=s[0]?e>=n[0]&&t>=n[1]&&e<s[0]&&t<=s[1]:e<n[0]&&t>=n[1]&&e>=s[0]&&t<=s[1]:t>n[1]&&t<s[1]||n[1]===s[1]&&t===n[1]&&e>=n[0]&&e<s[0]||n[1]<s[1]&&t===s[1]&&e<s[0]||n[1]<s[1]&&t===n[1]&&e>=n[0]}};Zf=dt([de(1,hb),de(2,li),de(3,zn),de(4,Xr),de(5,va),de(6,Ks)],Zf);function Tv(e,t,n){for(;e.length<n;)e=t+e;return e}var yC=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,s,a,o],this._container.appendChild(n),this._container.appendChild(s),this._container.appendChild(a),this._container.appendChild(o),t.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(e,t,n,s){e===this._font&&t===this._fontSize&&n===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,n){let s=0;if(!t&&!n&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let a=e;t&&(a+="B"),n&&(a+="I");let o=this._holey.get(a);if(o===void 0){let c=0;t&&(c|=1),n&&(c|=2),o=this._measure(e,c),o>0&&this._holey.set(a,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},bC=class{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(e,t,n,s=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let a=e.buffers.active.ydisp,o=t[1]-a,c=n[1]-a,f=Math.max(o,0),p=Math.min(c,e.rows-1);if(f>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=c,this.viewportCappedStartRow=f,this.viewportCappedEndRow=p,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function SC(){return new bC}var Jh="xterm-dom-renderer-owner-",Fi="xterm-rows",Ko="xterm-fg-",Av="xterm-bg-",Vl="xterm-focus",Xo="xterm-selection",xC=1,Qf=class extends Re{constructor(e,t,n,s,a,o,c,f,p,h,g,_,b,y){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=s,this._viewportElement=a,this._helperContainer=o,this._linkifier2=c,this._charSizeService=p,this._optionsService=h,this._bufferService=g,this._coreService=_,this._coreBrowserService=b,this._themeService=y,this._terminalClass=xC++,this._rowElements=[],this._selectionRenderModel=SC(),this.onRequestRedraw=this._register(new he).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fi),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(Xo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=vC(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Zf,document),this._element.classList.add(Jh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(lt(()=>{this._element.classList.remove(Jh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new yC(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Fi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${Fi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${Fi} .xterm-dim { color: ${rt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let n=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fi}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Xo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Xo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Xo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Ko}${o} { color: ${c.css}; }${this._terminalSelector} .${Ko}${o}.xterm-dim { color: ${rt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Av}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Ko}257 { color: ${rt.opaque(e.background).css}; }${this._terminalSelector} .${Ko}257.xterm-dim { color: ${rt.multiplyOpacity(rt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Av}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];f.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],c-o+1))}else{let p=s===o?e[0]:0,h=o===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(o,p,h));let g=c-o-1;if(f.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==c){let _=a===c?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,s=1){let a=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(n-t);return o+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-o),a.style.height=`${s*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${o}px`,a.style.width=`${c}px`,a}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,s=n.ybase+n.y,a=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let h=p+n.ydisp,g=this._rowElements[p],_=n.lines.get(h);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,h,h===s,c,f,a,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Jh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,s,a,o){n<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;n=Math.max(Math.min(n,c),0),s=Math.max(Math.min(s,c),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,p=f.ybase+f.y,h=Math.min(f.x,a-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=s;++y){let x=y+f.ydisp,k=this._rowElements[y],L=f.lines.get(x);if(!k||!L)break;k.replaceChildren(...this._rowFactory.createRow(L,x,x===p,_,b,h,g,this.dimensions.css.cell.width,this._widthCache,o?y===n?e:0:-1,o?(y===s?t:a)-1:-1))}}};Qf=dt([de(7,Cd),de(8,yu),de(9,li),de(10,si),de(11,Xr),de(12,zn),de(13,Ks)],Qf);var Jf=class extends Re{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new he),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new CC(this._optionsService))}catch{this._measureStrategy=this._register(new wC(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Jf=dt([de(2,li)],Jf);var Rb=class extends Re{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},wC=class extends Rb{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},CC=class extends Rb{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},kC=class extends Re{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new EC(this._window)),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new he),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(Kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(we(this._textarea,"focus",()=>this._isFocused=!0)),this._register(we(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},EC=class extends Re{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ys),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(lt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=we(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},TC=class extends Re{constructor(){super(),this.linkProviders=[],this._register(lt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Bd(e,t,n){let s=n.getBoundingClientRect(),a=e.getComputedStyle(n),o=parseInt(a.getPropertyValue("padding-left")),c=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-s.left-o,t.clientY-s.top-c]}function AC(e,t,n,s,a,o,c,f,p){if(!o)return;let h=Bd(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(p?c/2:0))/c),h[1]=Math.ceil(h[1]/f),h[0]=Math.min(Math.max(h[0],1),s+(p?1:0)),h[1]=Math.min(Math.max(h[1],1),a),h}var ed=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,s,a){return AC(window,e,t,n,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let n=Bd(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ed=dt([de(0,On),de(1,yu)],ed);var DC=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Mb={};Ux(Mb,{getSafariVersion:()=>MC,isChromeOS:()=>zb,isFirefox:()=>Bb,isIpad:()=>BC,isIphone:()=>NC,isLegacyEdge:()=>RC,isLinux:()=>Nd,isMac:()=>hu,isNode:()=>bu,isSafari:()=>Nb,isWindows:()=>Lb});var bu=typeof process<"u"&&"title"in process,ya=bu?"node":navigator.userAgent,ba=bu?"node":navigator.platform,Bb=ya.includes("Firefox"),RC=ya.includes("Edge"),Nb=/^((?!chrome|android).)*safari/i.test(ya);function MC(){if(!Nb)return 0;let e=ya.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var hu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ba),BC=ba==="iPad",NC=ba==="iPhone",Lb=["Windows","Win16","Win32","WinCE"].includes(ba),Nd=ba.indexOf("Linux")>=0,zb=/\bCrOS\b/.test(ya),Ob=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,n=0,s=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),a=e.timeRemaining(),n*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},LC=class extends Ob{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},zC=class extends Ob{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},fu=!bu&&"requestIdleCallback"in window?zC:LC,OC=class{constructor(){this._queue=new fu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},td=class extends Re{constructor(e,t,n,s,a,o,c,f,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=s,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Ys),this._pausedResizeTask=new OC,this._observerDisposable=this._register(new Ys),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 he),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new he),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new he),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new DC((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new jC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(lt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=lt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};td=dt([de(2,li),de(3,yu),de(4,Xr),de(5,va),de(6,si),de(7,zn),de(8,Ks)],td);var jC=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function HC(e,t,n,s){let a=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return IC(a,o,e,t,n,s)+Su(o,t,n,s)+FC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",fa(Math.abs(a-e),ha(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=PC(o>t?e:a,n)+(f-1)*n.cols+1+UC(o>t?a:e);return fa(p,ha(c,s))}function UC(e,t){return e-1}function PC(e,t){return t.cols-e}function IC(e,t,n,s,a,o){return Su(t,s,a,o).length===0?"":fa(Hb(e,t,e,t-Vr(t,a),!1,a).length,ha("D",o))}function Su(e,t,n,s){let a=e-Vr(e,n),o=t-Vr(t,n),c=Math.abs(a-o)-qC(e,t,n);return fa(c,ha(jb(e,t),s))}function FC(e,t,n,s,a,o){let c;Su(t,s,a,o).length>0?c=s-Vr(s,a):c=t;let f=s,p=WC(e,t,n,s,a,o);return fa(Hb(e,c,n,f,p==="C",a).length,ha(p,o))}function qC(e,t,n){var c;let s=0,a=e-Vr(e,n),o=t-Vr(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=jb(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&s++}return s}function Vr(e,t){let n=0,s=t.buffer.lines.get(e),a=s==null?void 0:s.isWrapped;for(;a&&e>=0&&e<t.rows;)n++,s=t.buffer.lines.get(--e),a=s==null?void 0:s.isWrapped;return n}function WC(e,t,n,s,a,o){let c;return Su(n,s,a,o).length>0?c=s-Vr(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function jb(e,t){return e>t?"A":"B"}function Hb(e,t,n,s,a,o){let c=e,f=t,p="";for(;(c!==n||f!==s)&&f>=0&&f<o.buffer.lines.length;)c+=a?1:-1,a&&c>o.cols-1?(p+=o.buffer.translateBufferLineToString(f,!1,e,c),c=0,e=0,f++):!a&&c<0&&(p+=o.buffer.translateBufferLineToString(f,!1,0,e+1),c=o.cols-1,e=c,f--);return p+o.buffer.translateBufferLineToString(f,!1,e,c)}function ha(e,t){let n=t?"O":"[";return re.ESC+n+e}function fa(e,t){e=Math.floor(e);let n="";for(let s=0;s<e;s++)n+=t;return n}var YC=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Dv(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ef=50,VC=15,KC=50,XC=500,$C=" ",GC=new RegExp($C,"g"),id=class extends Re{constructor(e,t,n,s,a,o,c,f,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=s,this._coreService=a,this._mouseService=o,this._optionsService=c,this._renderService=f,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Vi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new he),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new he),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new YC(this._bufferService),this._activeSelectionMode=0,this._register(lt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let f=n.translateBufferLineToString(c,!0,a,o);s.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;s.push(n.translateBufferLineToString(e[1],!0,e[0],a));for(let o=e[1]+1;o<=t[1]-1;o++){let c=n.lines.get(o),f=n.translateBufferLineToString(o,!0);c!=null&&c.isWrapped?s[s.length-1]+=f:s.push(f)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),c=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(a=>a.replace(GC," ")).join(Lb?`\r
71
71
  `:`
72
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Md&&e&&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(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Tv(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Rd(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ef),ef),t/=ef,t/Math.abs(t)+Math.round(t*(WC-1)))}shouldForceSelection(e){return hu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),YC)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(hu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<VC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=OC(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let a=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==s&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),p=f,h=e[0]-f,g=0,_=0,b=0,y=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let L=e[0],R=e[0];o.getWidth(L)===0&&(g++,L--),o.getWidth(R)===2&&(_++,R++);let $=o.getString(R).length;for($>1&&(y+=$-1,p+=$-1);L>0&&f>0&&!this._isCharWordSeparator(o.loadCell(L-1,this._workCell));){o.loadCell(L-1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,L--):I>1&&(b+=I-1,f-=I-1),f--,L--}for(;R<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(R+1,this._workCell));){o.loadCell(R+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,R++):I>1&&(y+=I-1,p+=I-1),p++,R++}}p++;let x=f+h-g+b,E=Math.min(this._bufferService.cols,p-f+g+_-b-y);if(!(!t&&c.slice(f,p).trim()==="")){if(n&&x===0&&o.getCodePoint(0)!==32){let L=a.lines.get(e[1]-1);if(L&&o.isWrapped&&L.getCodePoint(this._bufferService.cols-1)!==32){let R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let $=this._bufferService.cols-R.start;x-=$,E+=$}}}if(s&&x+E===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let L=a.lines.get(e[1]+1);if(L!=null&&L.isWrapped&&L.getCodePoint(0)!==32){let R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(E+=R.length)}}return{start:x,length:E}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Tv(n,this._bufferService.cols)}};ed=ht([fe(3,si),fe(4,Xr),fe(5,wd),fe(6,li),fe(7,On),fe(8,zn)],ed);var Av=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Dv=class{constructor(){this._color=new Av,this._css=new Av}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ct=Object.freeze((()=>{let e=[lt.toColor("#2e3436"),lt.toColor("#cc0000"),lt.toColor("#4e9a06"),lt.toColor("#c4a000"),lt.toColor("#3465a4"),lt.toColor("#75507b"),lt.toColor("#06989a"),lt.toColor("#d3d7cf"),lt.toColor("#555753"),lt.toColor("#ef2929"),lt.toColor("#8ae234"),lt.toColor("#fce94f"),lt.toColor("#729fcf"),lt.toColor("#ad7fa8"),lt.toColor("#34e2e2"),lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:St.toCss(s,a,o),rgba:St.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:St.toCss(s,s,s),rgba:St.toRgba(s,s,s)})}return e})()),Ir=lt.toColor("#ffffff"),na=lt.toColor("#000000"),Rv=lt.toColor("#ffffff"),Mv=na,Kl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},$C=Ir,td=class extends De{constructor(e){super(),this._optionsService=e,this._contrastCache=new Dv,this._halfContrastCache=new Dv,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ir,background:na,cursor:Rv,cursorAccent:Mv,selectionForeground:void 0,selectionBackgroundTransparent:Kl,selectionBackgroundOpaque:it.blend(na,Kl),selectionInactiveBackgroundTransparent:Kl,selectionInactiveBackgroundOpaque:it.blend(na,Kl),scrollbarSliderBackground:it.opacity(Ir,.2),scrollbarSliderHoverBackground:it.opacity(Ir,.4),scrollbarSliderActiveBackground:it.opacity(Ir,.5),overviewRulerBorder:Ir,ansi:Ct.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=$e(e.foreground,Ir),t.background=$e(e.background,na),t.cursor=it.blend(t.background,$e(e.cursor,Rv)),t.cursorAccent=it.blend(t.background,$e(e.cursorAccent,Mv)),t.selectionBackgroundTransparent=$e(e.selectionBackground,Kl),t.selectionBackgroundOpaque=it.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=$e(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=it.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?$e(e.selectionForeground,Cv):void 0,t.selectionForeground===Cv&&(t.selectionForeground=void 0),it.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=it.opacity(t.selectionBackgroundTransparent,.3)),it.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=it.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=$e(e.scrollbarSliderBackground,it.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=$e(e.scrollbarSliderHoverBackground,it.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=$e(e.scrollbarSliderActiveBackground,it.opacity(t.foreground,.5)),t.overviewRulerBorder=$e(e.overviewRulerBorder,$C),t.ansi=Ct.slice(),t.ansi[0]=$e(e.black,Ct[0]),t.ansi[1]=$e(e.red,Ct[1]),t.ansi[2]=$e(e.green,Ct[2]),t.ansi[3]=$e(e.yellow,Ct[3]),t.ansi[4]=$e(e.blue,Ct[4]),t.ansi[5]=$e(e.magenta,Ct[5]),t.ansi[6]=$e(e.cyan,Ct[6]),t.ansi[7]=$e(e.white,Ct[7]),t.ansi[8]=$e(e.brightBlack,Ct[8]),t.ansi[9]=$e(e.brightRed,Ct[9]),t.ansi[10]=$e(e.brightGreen,Ct[10]),t.ansi[11]=$e(e.brightYellow,Ct[11]),t.ansi[12]=$e(e.brightBlue,Ct[12]),t.ansi[13]=$e(e.brightMagenta,Ct[13]),t.ansi[14]=$e(e.brightCyan,Ct[14]),t.ansi[15]=$e(e.brightWhite,Ct[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=$e(e.extendedAnsi[s],Ct[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};td=ht([fe(0,li)],td);function $e(e,t){if(e!==void 0)try{return lt.toColor(e)}catch{}return t}var GC=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},ZC=class{constructor(){this._services=new GC,this._services.set(xd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Wx(e).sort((o,c)=>o.index-c.index),s=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(c)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},QC={trace:0,debug:1,info:2,warn:3,error:4,off:5},JC="xterm.js: ",id=class extends De{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=QC[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":JC)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};id=ht([fe(0,li)],id);var Bv=class extends De{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,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(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ae=3,bt=Object.freeze(new ga),$o=0,tf=2,ra=class jb{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ae);let a=n||Vi.fromCharData([0,ib,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*Ae+0],s=n&2097151;return[this._data[t*Ae+1],n&2097152?this._combined[t]:s?dr(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Ae+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ae+0]=t|2097152|n[2]<<22):this._data[t*Ae+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ae+0]>>22}hasWidth(t){return this._data[t*Ae+0]&12582912}getFg(t){return this._data[t*Ae+1]}getBg(t){return this._data[t*Ae+2]}hasContent(t){return this._data[t*Ae+0]&4194303}getCodePoint(t){let n=this._data[t*Ae+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ae+0]&2097152}getString(t){let n=this._data[t*Ae+0];return n&2097152?this._combined[t]:n&2097151?dr(n&2097151):""}isProtected(t){return this._data[t*Ae+2]&536870912}loadCell(t,n){return $o=t*Ae,n.content=this._data[$o+0],n.fg=this._data[$o+1],n.bg=this._data[$o+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ae+0]=n.content,this._data[t*Ae+1]=n.fg,this._data[t*Ae+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Ae+0]=n|s<<22,this._data[t*Ae+1]=a.fg,this._data[t*Ae+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*Ae+0];a&2097152?this._combined[t]+=dr(n):a&2097151?(this._combined[t]=dr(a&2097151)+dr(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*Ae+0]=a}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let a=new Vi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let a=new Vi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*tf<this._data.buffer.byteLength;let s=t*Ae;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let a=new Uint32Array(s);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,s);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,s*4*tf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*tf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new jb(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ae+0]&4194303)return t+(this._data[t*Ae+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ae+0]&4194303||this._data[t*Ae+2]&50331648)return t+(this._data[t*Ae+0]>>22);return 0}copyCellsFrom(t,n,s,a,o){let c=t._data;if(o)for(let p=a-1;p>=0;p--){for(let h=0;h<Ae;h++)this._data[(s+p)*Ae+h]=c[(n+p)*Ae+h];c[(n+p)*Ae+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<Ae;h++)this._data[(s+p)*Ae+h]=c[(n+p)*Ae+h];c[(n+p)*Ae+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}let f=Object.keys(t._combined);for(let p=0;p<f.length;p++){let h=parseInt(f[p],10);h>=n&&(this._combined[h-n+s]=t._combined[h])}}translateToString(t,n,s,a){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<s;){let c=this._data[n*Ae+0],f=c&2097151,p=c&2097152?this._combined[n]:f?dr(f):mr;if(o+=p,a)for(let h=0;h<p.length;++h)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function e2(e,t,n,s,a,o){let c=[];for(let f=0;f<e.length-1;f++){let p=f,h=e.get(++p);if(!h.isWrapped)continue;let g=[e.get(f)];for(;p<e.length&&h.isWrapped;)g.push(h),h=e.get(++p);if(!o&&s>=f&&s<p){f+=g.length-1;continue}let _=0,b=da(g,_,t),y=1,x=0;for(;y<g.length;){let L=da(g,y,t),R=L-x,$=n-b,I=Math.min(R,$);g[_].copyCellsFrom(g[y],x,b,I,!1),b+=I,b===n&&(_++,b=0),x+=I,x===L&&(y++,x=0),b===0&&_!==0&&g[_-1].getWidth(n-1)===2&&(g[_].copyCellsFrom(g[_-1],n-1,b++,1,!1),g[_-1].setCell(n-1,a))}g[_].replaceCells(b,n,a);let E=0;for(let L=g.length-1;L>0&&(L>_||g[L].getTrimmedLength()===0);L--)E++;E>0&&(c.push(f+g.length-E),c.push(E)),f+=g.length-1}return c}function t2(e,t){let n=[],s=0,a=t[s],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++s];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++s]}else n.push(c);return{layout:n,countRemoved:o}}function i2(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function n2(e,t,n){let s=[],a=e.map((p,h)=>da(e,h,t)).reduce((p,h)=>p+h),o=0,c=0,f=0;for(;f<a;){if(a-f<n){s.push(a-f);break}o+=n;let p=da(e,c,t);o>p&&(o-=p,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let g=h?n-1:n;s.push(g),f+=g}return s}function da(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return s&&a?n-1:n}var Hb=class Ub{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ub._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Hb._nextId=1;var r2=Hb,Tt={},Fr=Tt.B;Tt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Tt.A={"#":"£"};Tt.B=void 0;Tt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Tt.C=Tt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Tt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Tt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Tt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Tt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Tt.E=Tt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Tt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Tt.H=Tt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Tt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Nv=4294967295,Lv=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=bt.clone(),this.savedCharset=Fr,this.markers=[],this._nullCell=Vi.fromCharData([0,ib,1,0]),this._whitespaceCell=Vi.fromCharData([0,mr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Bv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ou),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ou),this._whitespaceCell}getBlankLine(e,t){return new ra(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Nv?Nv:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=bt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Bv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(bt),s=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ra(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new ra(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=e2(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(bt),n);if(s.length>0){let a=t2(this.lines,s);i2(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(bt),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ra(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(bt),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let p=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),p.unshift(f);if(!n){let I=this.ybase+this.y;if(I>=c&&I<c+p.length)continue}let h=p[p.length-1].getTrimmedLength(),g=n2(p,this._cols,e),_=g.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let y=[];for(let I=0;I<_;I++){let Z=this.getBlankLine(bt,!0);y.push(Z)}y.length>0&&(a.push({start:c+p.length+o,newLines:y}),o+=y.length),p.push(...y);let x=g.length-1,E=g[x];E===0&&(x--,E=g[x]);let L=p.length-_-1,R=h;for(;L>=0;){let I=Math.min(R,E);if(p[x]===void 0)break;if(p[x].copyCellsFrom(p[L],R-I,E-I,I,!0),E-=I,E===0&&(x--,E=g[x]),R-=I,R===0){L--;let Z=Math.max(L,0);R=da(p,Z,this._cols)}}for(let I=0;I<p.length;I++)g[I]<e&&p[I].setCell(g[I],s);let $=_-b;for(;$-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let E=0;E<this.lines.length;E++)f.push(this.lines.get(E));let p=this.lines.length,h=p-1,g=0,_=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let E=Math.min(this.lines.maxLength-1,p+o-1);E>=0;E--)if(_&&_.start>h+b){for(let L=_.newLines.length-1;L>=0;L--)this.lines.set(E--,_.newLines[L]);E++,c.push({index:h+1,amount:_.newLines.length}),b+=_.newLines.length,_=a[++g]}else this.lines.set(E,f[h--]);let y=0;for(let E=c.length-1;E>=0;E--)c[E].index+=y,this.lines.onInsertEmitter.fire(c[E]),y+=c[E].amount;let x=Math.max(0,p+o-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,n=0,s){let a=this.lines.get(e);return a?a.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new r2(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},s2=class extends De{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ue),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 Lv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Lv(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Pb=2,Ib=1,nd=class extends De{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Pb),this.rows=Math.max(e.rawOptions.rows||0,Ib),this.buffers=this._register(new s2(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(o+1,0,s.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};nd=ht([fe(0,li)],nd);var Us={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:hu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},l2=["normal","bold","100","200","300","400","500","600","700","800","900"],a2=class extends De{constructor(e){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let t={...Us};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(rt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Us))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in Us))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Us[e]),!o2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Us[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=l2.includes(t)?t:Us[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function o2(e){return e==="block"||e==="underline"||e==="bar"}function sa(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&sa(e[s],t-1);return n}var zv=Object.freeze({insertMode:!1}),Ov=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),rd=class extends De{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=sa(zv),this.decPrivateModes=sa(Ov)}reset(){this.modes=sa(zv),this.decPrivateModes=sa(Ov)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};rd=ht([fe(0,si),fe(1,ab),fe(2,li)],rd);var jv={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function nf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var rf=String.fromCharCode,Hv={DEFAULT:e=>{let t=[nf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${rf(t[0])}${rf(t[1])}${rf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.x};${e.y}${t}`}},sd=class extends De{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ue),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(jv))this.addProtocol(s,jv[s]);for(let s of Object.keys(Hv))this.addEncoding(s,Hv[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=s+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};sd=ht([fe(0,si),fe(1,Xr),fe(2,li)],sd);var sf=[[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]],u2=[[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]],kt;function c2(e,t){let n=0,s=t.length-1,a;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(a=n+s>>1,e>t[a][1])n=a+1;else if(e<t[a][0])s=a-1;else return!0;return!1}var h2=class{constructor(){if(this.version="6",!kt){kt=new Uint8Array(65536),kt.fill(1),kt[0]=0,kt.fill(0,1,32),kt.fill(0,127,160),kt.fill(2,4352,4448),kt[9001]=2,kt[9002]=2,kt.fill(2,11904,42192),kt[12351]=1,kt.fill(2,44032,55204),kt.fill(2,63744,64256),kt.fill(2,65040,65050),kt.fill(2,65072,65136),kt.fill(2,65280,65377),kt.fill(2,65504,65511);for(let e=0;e<sf.length;++e)kt.fill(0,sf[e][0],sf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?kt[e]:c2(e,u2)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let a=qr.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return qr.createPropertyValue(0,n,s)}},qr=class su{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let t=new h2;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,s=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let f=this.charProperties(c,s),p=su.extractWidth(f);su.extractShouldJoin(f)&&(p-=su.extractWidth(s)),n+=p,s=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},f2=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Uv(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Xl=2147483647,d2=256,Fb=class ld{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>d2)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new ld;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let a=t[s];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new ld(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Xl?Xl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Xl?Xl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&(t[n]=this._subParams.slice(s,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,a=s[n-1];s[n-1]=~a?Math.min(a*10+t,Xl):t}},$l=[],p2=class{constructor(){this._state=0,this._active=$l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$l}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=$l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$l,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=$l,this._id=-1,this._state=0}}},Di=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Gl=[],m2=class{constructor(){this._handlers=Object.create(null),this._active=Gl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=Gl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Gl,this._ident=0}},la=new Fb;la.addParam(0);var Pv=class{constructor(e){this._handler=e,this._data="",this._params=la,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():la,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=la,this._data="",this._hitLimit=!1,n));return this._params=la,this._data="",this._hitLimit=!1,t}},_2=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|s}},Wi=160,g2=(function(){let e=new _2(4095),t=Array.apply(null,Array(256)).map((f,p)=>p),n=(f,p)=>t.slice(f,p),s=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wi,0,2,0),e.add(Wi,8,5,8),e.add(Wi,6,0,6),e.add(Wi,11,0,11),e.add(Wi,13,13,13),e})(),v2=class extends De{constructor(e=g2){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Fb,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new p2),this._dcsParser=this._register(new m2),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,n,s,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=a}parse(e,t,n){let s=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(s=e[f],a=this._transitions.table[this.currentState<<8|(s<160?s:Wi)],a>>4){case 2:for(let b=f+1;;++b){if(b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|s],h=p?p.length-1:-1;for(;h>=0&&(c=p[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,p,h,a,f),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++f<t&&(s=e[f])>47&&s<60);f--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let g=this._escHandlers[this._collect<<8|s],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,a,f),c;_<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let b=f+1;;++b)if(b>=t||(s=e[b])===24||s===26||s===27||s>127&&s<Wi){this._dcsParser.put(e,f,b),f=b-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=f+1;;b++)if(b>=t||(s=e[b])<32||s>127&&s<Wi){this._oscParser.put(e,f,b),f=b-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},y2=/^([\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})$/,b2=/^[\da-f]+$/;function Iv(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=y2.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),b2.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);s[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return s}}function lf(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function S2(e,t=16){let[n,s,a]=e;return`rgb:${lf(n,t)}/${lf(s,t)}/${lf(a,t)}`}var x2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hr=131072,Fv=10;function qv(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Wv=5e3,Yv=0,w2=class extends De{constructor(e,t,n,s,a,o,c,f,p=new v2){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Fx,this._utf8Decoder=new qx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=bt.clone(),this._eraseAttrDataInternal=bt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),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 ad(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:_})}),this._parser.setDcsHandlerFallback((h,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:_})}),this._parser.setPrintHandler((h,g,_)=>this.print(h,g,_)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(re.BEL,()=>this.bell()),this._parser.setExecuteHandler(re.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(re.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(re.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(re.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(re.BS,()=>this.backspace()),this._parser.setExecuteHandler(re.HT,()=>this.tab()),this._parser.setExecuteHandler(re.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(re.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nu.IND,()=>this.index()),this._parser.setExecuteHandler(nu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Di(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Di(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Di(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Di(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Di(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Di(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Di(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Di(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Di(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Di(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Di(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Di(h=>this.restoreCursorColor(h))),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(let h in Tt)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Pv((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),Wv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Wv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hr&&(o=this._parseStack.position+hr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hr))),c||this._dirtyRowTracker.clearRange(),e.length>hr)for(let h=o;h<e.length;h+=hr){let g=h+hr<e.length?h+hr:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(s,a,_,h),this._logSlowResolvingAsync(n),n}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,a,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let s,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(s=e[y],s<127&&o){let R=o[String.fromCharCode(s)];R&&(s=R.charCodeAt(0))}let x=this._unicodeService.charProperties(s,b);a=qr.extractWidth(x);let E=qr.extractShouldJoin(x),L=E?qr.extractWidth(b):0;if(b=x,c&&this._onA11yChar.fire(dr(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-L>f){if(p){let R=_,$=this._activeBuffer.x-L;for(this._activeBuffer.x=L,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),L>0&&_ instanceof ra&&_.copyCellsFrom(R,$,0,L,!1);$<f;)R.setCellFromCodepoint($++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(E&&this._activeBuffer.x){let R=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-R,s,a);for(let $=a-L;--$>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(_.insertCells(this._activeBuffer.x,a-L,this._activeBuffer.getNullCell(g)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,s,a,g),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<f&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>qv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Pv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Di(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,s=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),s&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(bt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=qr.extractWidth(t),a=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;c[f++]=g,h+=g>65535?2:1}let p=f;for(let h=1;h<n;++h)c.copyWithin(p,0,f),p+=f;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(re.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(re.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(re.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(re.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(re.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Fr),this._charsetService.setgCharset(1,Fr),this._charsetService.setgCharset(2,Fr),this._charsetService.setgCharset(3,Fr);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:p}=this._bufferService,{active:h,alt:g}=f,_=this._optionsService.rawOptions,b=(E,L)=>(c.triggerDataEvent(`${re.ESC}[${t?"":"?"}${E};${L}$y`),!0),y=E=>E?1:2,x=e.params[0];return t?x===2?b(x,4):x===4?b(x,y(c.modes.insertMode)):x===12?b(x,3):x===20?b(x,y(_.convertEol)):b(x,0):x===1?b(x,y(s.applicationCursorKeys)):x===3?b(x,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):x===6?b(x,y(s.origin)):x===7?b(x,y(s.wraparound)):x===8?b(x,3):x===9?b(x,y(a==="X10")):x===12?b(x,y(_.cursorBlink)):x===25?b(x,y(!c.isCursorHidden)):x===45?b(x,y(s.reverseWraparound)):x===66?b(x,y(s.applicationKeypad)):x===67?b(x,4):x===1e3?b(x,y(a==="VT200")):x===1002?b(x,y(a==="DRAG")):x===1003?b(x,y(a==="ANY")):x===1004?b(x,y(s.sendFocus)):x===1005?b(x,4):x===1006?b(x,y(o==="SGR")):x===1015?b(x,4):x===1016?b(x,y(o==="SGR_PIXELS")):x===1048?b(x,1):x===47||x===1047||x===1049?b(x,y(h===g)):x===2004?b(x,y(s.bracketedPasteMode)):x===2026?b(x,y(s.synchronizedOutput)):b(x,0)}_updateAttrColor(e,t,n,s,a){return t===2?(e|=50331648,e&=-16777216,e|=ga.fromColorRGB([n,s,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],a=0,o=0;do{if(s[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do s[1]===5&&(a=1),s[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<s.length);break}if(s[1]===5&&o+a>=2||s[1]===2&&o+a>=5)break;s[1]&&(a=1)}while(++o+t<e.length&&o+a<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=bt.fg,e.bg=bt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,s=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=bt.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=bt.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=bt.fg&16777215,s.bg&=-67108864,s.bg|=bt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${re.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${re.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${re.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=bt.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!qv(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${re.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Fv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Fv&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),a=n.shift();if(/^\d+$/.exec(s)){let o=parseInt(s);if(Vv(o))if(a==="?")t.push({type:0,index:o});else{let c=Iv(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(s=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=Iv(n[s]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let a=parseInt(n[s]);Vv(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,Fr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(x2[e[0]],Tt[e[1]]||Fr),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=bt.clone(),this._eraseAttrDataInternal=bt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Vi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${re.ESC}${c}${re.ESC}\\`),!0),s=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ad=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Yv=e,e=t,t=Yv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ad=ht([fe(0,si)],ad);function Vv(e){return 0<=e&&e<256}var C2=5e7,Kv=12,k2=50,E2=class extends De{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>C2)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],a=this._action(s,t);if(a){let c=f=>performance.now()-n>=Kv?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=Kv)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>k2&&(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()}},od=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(p,f)),this._dataByLinkId.set(p.id,p),p.id}let n=e,s=this._getEntryIdKey(n),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};od=ht([fe(0,si)],od);var Xv=!1,T2=class extends De{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ys),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new ZC,this.optionsService=this._register(new a2(e)),this._instantiationService.setService(li,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(nd)),this._instantiationService.setService(si,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(id)),this._instantiationService.setService(ab,this._logService),this.coreService=this._register(this._instantiationService.createInstance(rd)),this._instantiationService.setService(Xr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(lb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(qr)),this._instantiationService.setService(Kx,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f2),this._instantiationService.setService(Vx,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(od),this._instantiationService.setService(ob,this._oscLinkService),this._inputHandler=this._register(new w2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Vt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Vt.forward(this._bufferService.onResize,this._onResize)),this._register(Vt.forward(this.coreService.onData,this._onData)),this._register(Vt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new E2((t,n)=>this._inputHandler.parse(t,n))),this._register(Vt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Xv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Xv=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Pb),t=Math.max(t,Ib),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Uv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Uv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=rt(()=>{for(let t of e)t.dispose()})}}},A2={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:["'",'"']};function D2(e,t,n,s){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=re.ESC+"OA":a.key=re.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=re.ESC+"OD":a.key=re.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=re.ESC+"OC":a.key=re.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=re.ESC+"OB":a.key=re.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":re.DEL,e.altKey&&(a.key=re.ESC+a.key);break;case 9:if(e.shiftKey){a.key=re.ESC+"[Z";break}a.key=re.HT,a.cancel=!0;break;case 13:a.key=e.altKey?re.ESC+re.CR:re.CR,a.cancel=!0;break;case 27:a.key=re.ESC,e.altKey&&(a.key=re.ESC+re.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"D":t?a.key=re.ESC+"OD":a.key=re.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"C":t?a.key=re.ESC+"OC":a.key=re.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"A":t?a.key=re.ESC+"OA":a.key=re.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"B":t?a.key=re.ESC+"OB":a.key=re.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=re.ESC+"[2~");break;case 46:o?a.key=re.ESC+"[3;"+(o+1)+"~":a.key=re.ESC+"[3~";break;case 36:o?a.key=re.ESC+"[1;"+(o+1)+"H":t?a.key=re.ESC+"OH":a.key=re.ESC+"[H";break;case 35:o?a.key=re.ESC+"[1;"+(o+1)+"F":t?a.key=re.ESC+"OF":a.key=re.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=re.ESC+"[5;"+(o+1)+"~":a.key=re.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=re.ESC+"[6;"+(o+1)+"~":a.key=re.ESC+"[6~";break;case 112:o?a.key=re.ESC+"[1;"+(o+1)+"P":a.key=re.ESC+"OP";break;case 113:o?a.key=re.ESC+"[1;"+(o+1)+"Q":a.key=re.ESC+"OQ";break;case 114:o?a.key=re.ESC+"[1;"+(o+1)+"R":a.key=re.ESC+"OR";break;case 115:o?a.key=re.ESC+"[1;"+(o+1)+"S":a.key=re.ESC+"OS";break;case 116:o?a.key=re.ESC+"[15;"+(o+1)+"~":a.key=re.ESC+"[15~";break;case 117:o?a.key=re.ESC+"[17;"+(o+1)+"~":a.key=re.ESC+"[17~";break;case 118:o?a.key=re.ESC+"[18;"+(o+1)+"~":a.key=re.ESC+"[18~";break;case 119:o?a.key=re.ESC+"[19;"+(o+1)+"~":a.key=re.ESC+"[19~";break;case 120:o?a.key=re.ESC+"[20;"+(o+1)+"~":a.key=re.ESC+"[20~";break;case 121:o?a.key=re.ESC+"[21;"+(o+1)+"~":a.key=re.ESC+"[21~";break;case 122:o?a.key=re.ESC+"[23;"+(o+1)+"~":a.key=re.ESC+"[23~";break;case 123:o?a.key=re.ESC+"[24;"+(o+1)+"~":a.key=re.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=re.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=re.DEL:e.keyCode===219?a.key=re.ESC:e.keyCode===220?a.key=re.FS:e.keyCode===221&&(a.key=re.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let f=(c=A2[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=re.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(p);e.shiftKey&&(h=h.toUpperCase()),a.key=re.ESC+h}else if(e.keyCode===32)a.key=re.ESC+(e.ctrlKey?re.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),a.key=re.ESC+p,a.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=re.US),e.key==="@"&&(a.key=re.NUL));break}return a}var pt=0,R2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<s.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[a]=e[t],t++):s[a]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(pt=this._search(t),pt===-1)||this._getKey(this._array[pt])!==t)return!1;do if(this._array[pt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(pt),!0;while(++pt<this._array.length&&this._getKey(this._array[pt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),s=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[s++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do yield this._array[pt];while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pt=this._search(e),!(pt<0||pt>=this._array.length)&&this._getKey(this._array[pt])===e))do t(this._array[pt]);while(++pt<this._array.length&&this._getKey(this._array[pt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,a=this._getKey(this._array[s]);if(a>e)n=s-1;else if(a<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},af=0,$v=0,M2=class extends De{constructor(){super(),this._decorations=new R2(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new B2(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let s=0,a=0;for(let o of this._decorations.getKeyIterator(t))s=o.options.x??0,a=s+(o.options.width??1),e>=s&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,a=>{af=a.options.x??0,$v=af+(a.options.width??1),e>=af&&e<$v&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},B2=class extends _r{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},N2=1e3,L2=class{constructor(e,t=N2){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=s-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Gv=20,du=class extends De{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new L2(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
73
- `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(we(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(rt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Gv+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
74
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Gv+1&&(this._liveRegion.textContent+=Af.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,s=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",p=(n.ydisp+a+1).toString(),h=this._rowElements[a];h&&(f.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",p),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==s)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((f=s.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:p,offset:h})=>{let g=p instanceof Text?p.parentNode:p,_=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(g);if(!b)return console.warn("columns is null. Race condition?"),null;let y=h<b.length?b[h]:b.slice(-1)[0]+1;return y>=this._terminal.cols&&(++_,y=0),{row:_,column:y}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};du=ht([fe(1,xd),fe(2,zn),fe(3,On)],du);var ud=class extends De{constructor(e,t,n,s,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(rt(()=>{var o;Yr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(we(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(we(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(we(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(we(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let a=n[s];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,a;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var h,g;if(this._isMouseOut)return;let p=f==null?void 0:f.map(_=>({link:_}));(h=this._activeProviderReplies)==null||h.set(o,p),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let a=t.get(s);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=f;h<=p;h++){if(n.has(h)){a.splice(o--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&s){let c=s.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(p=>this._linkAtPosition(p.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&z2(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Yr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,a,o;(s=this._currentLink)!=null&&s.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,a){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:a}}};ud=ht([fe(1,wd),fe(2,On),fe(3,si),fe(4,cb)],ud);function z2(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var O2=class extends T2{constructor(e={}){super(e),this._linkifier=this._register(new Ys),this.browser=Db,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ys),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(M2),this._instantiationService.setService(va,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(kC),this._instantiationService.setService(cb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Rf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Vt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Vt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Vt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Vt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(rt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let a=it.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${re.ESC}]${s};${S2(a)}${Tb.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=St.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=St.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(re.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(re.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(we(this.element,"copy",t=>{this.hasSelection()&&Px(t,this._selectionService)}));let e=t=>Ix(t,this.textarea,this.coreService,this.optionsService);this._register(we(this.textarea,"paste",e)),this._register(we(this.element,"paste",e)),Rb?this._register(we(this.element,"mousedown",t=>{t.button===2&&lv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(we(this.element,"contextmenu",t=>{lv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Md&&this._register(we(this.element,"auxclick",t=>{t.button===1&&tb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(we(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(we(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(we(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(we(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(we(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(we(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(we(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((a=this.element)==null?void 0:a.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(we(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Tf.get()),Nb||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(wC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(zn,this._coreBrowserService),this._register(we(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(we(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Zf,this._document,this._helperContainer),this._instantiationService.setService(yu,this._charSizeService),this._themeService=this._instantiationService.createInstance(td),this._instantiationService.setService(Ks,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cu),this._instantiationService.setService(ub,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Jf,this.rows,this.screenElement)),this._instantiationService.setService(On,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Xf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Qf),this._instantiationService.setService(wd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(ud,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(Vf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ed,this.element,this.screenElement,s)),this._instantiationService.setService($x,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Vt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Kf,this.screenElement)),this._register(we(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Gf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var h,g,_,b,y;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,f=o.button<3?o.button:3;break;case"mousedown":p=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let x=o.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(o,(b=(_=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:_.cell)==null?void 0:b.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;p=x<0?0:1,f=4;break;default:return!1}return p===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",a.mousemove),s.mousemove=a.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),s.wheel=a.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(we(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(we(t,"wheel",o=>{var c,f,p,h,g;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(p=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:p.cell)==null?void 0:h.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let _=re.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){eb(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=D2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===re.ETX||n.key===re.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(j2(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(bt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(re.ESC+"[I"):this.coreService.triggerDataEvent(re.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${re.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${re.ESC}[6;${a};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function j2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var H2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},U2=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Vi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Zv=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new U2(t)}getNullCell(){return new Vi}},P2=class extends De{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Zv(this._core.buffers.normal,"normal"),this._alternate=new Zv(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)}},I2=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},F2=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},q2=["cols","rows"],sn=0,W2=class extends De{constructor(e){super(),this._core=this._register(new O2(e)),this._addonManager=this._register(new H2),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,a)=>{this._checkReadonlyOptions(s),this._core.options[s]=a};for(let s in this._core.options){let a={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,a)}}_checkReadonlyOptions(e){if(q2.includes(e))throw new Error(`Option "${e}" 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 I2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new F2(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 P2(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
75
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Tf.get()},set promptLabel(e){Tf.set(e)},get tooMuchOutput(){return Af.get()},set tooMuchOutput(e){Af.set(e)}}}_verifyIntegers(...e){for(sn of e)if(sn===1/0||isNaN(sn)||sn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sn of e)if(sn&&(sn===1/0||isNaN(sn)||sn%1!==0||sn<0))throw new Error("This API only accepts positive integers")}};/**
72
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Nd&&e&&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(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s||!t?!1:this._areCoordsInSelection(t,n,s)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!n||!s?!1:this._areCoordsInSelection([e,t],n,s)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,o;let n=(o=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:o.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Dv(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Bd(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ef),ef),t/=ef,t/Math.abs(t)+Math.round(t*(VC-1)))}shouldForceSelection(e){return hu?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),KC)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(hu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let s=n.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<XC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let s=HC(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let s=0;t>=s;s++){let a=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:a>1&&t!==s&&(n+=a-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,o=a.lines.get(e[1]);if(!o)return;let c=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(o,e[0]),p=f,h=e[0]-f,g=0,_=0,b=0,y=0;if(c.charAt(f)===" "){for(;f>0&&c.charAt(f-1)===" ";)f--;for(;p<c.length&&c.charAt(p+1)===" ";)p++}else{let L=e[0],R=e[0];o.getWidth(L)===0&&(g++,L--),o.getWidth(R)===2&&(_++,R++);let $=o.getString(R).length;for($>1&&(y+=$-1,p+=$-1);L>0&&f>0&&!this._isCharWordSeparator(o.loadCell(L-1,this._workCell));){o.loadCell(L-1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,L--):I>1&&(b+=I-1,f-=I-1),f--,L--}for(;R<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(R+1,this._workCell));){o.loadCell(R+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,R++):I>1&&(y+=I-1,p+=I-1),p++,R++}}p++;let x=f+h-g+b,k=Math.min(this._bufferService.cols,p-f+g+_-b-y);if(!(!t&&c.slice(f,p).trim()==="")){if(n&&x===0&&o.getCodePoint(0)!==32){let L=a.lines.get(e[1]-1);if(L&&o.isWrapped&&L.getCodePoint(this._bufferService.cols-1)!==32){let R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let $=this._bufferService.cols-R.start;x-=$,k+=$}}}if(s&&x+k===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let L=a.lines.get(e[1]+1);if(L!=null&&L.isWrapped&&L.getCodePoint(0)!==32){let R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(k+=R.length)}}return{start:x,length:k}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Dv(n,this._bufferService.cols)}};id=dt([de(3,si),de(4,Xr),de(5,kd),de(6,li),de(7,On),de(8,zn)],id);var Rv=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Mv=class{constructor(){this._color=new Rv,this._css=new Rv}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Et=Object.freeze((()=>{let e=[ot.toColor("#2e3436"),ot.toColor("#cc0000"),ot.toColor("#4e9a06"),ot.toColor("#c4a000"),ot.toColor("#3465a4"),ot.toColor("#75507b"),ot.toColor("#06989a"),ot.toColor("#d3d7cf"),ot.toColor("#555753"),ot.toColor("#ef2929"),ot.toColor("#8ae234"),ot.toColor("#fce94f"),ot.toColor("#729fcf"),ot.toColor("#ad7fa8"),ot.toColor("#34e2e2"),ot.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:wt.toCss(s,a,o),rgba:wt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:wt.toCss(s,s,s),rgba:wt.toRgba(s,s,s)})}return e})()),Ir=ot.toColor("#ffffff"),na=ot.toColor("#000000"),Bv=ot.toColor("#ffffff"),Nv=na,Kl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ZC=Ir,nd=class extends Re{constructor(e){super(),this._optionsService=e,this._contrastCache=new Mv,this._halfContrastCache=new Mv,this._onChangeColors=this._register(new he),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ir,background:na,cursor:Bv,cursorAccent:Nv,selectionForeground:void 0,selectionBackgroundTransparent:Kl,selectionBackgroundOpaque:rt.blend(na,Kl),selectionInactiveBackgroundTransparent:Kl,selectionInactiveBackgroundOpaque:rt.blend(na,Kl),scrollbarSliderBackground:rt.opacity(Ir,.2),scrollbarSliderHoverBackground:rt.opacity(Ir,.4),scrollbarSliderActiveBackground:rt.opacity(Ir,.5),overviewRulerBorder:Ir,ansi:Et.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Ge(e.foreground,Ir),t.background=Ge(e.background,na),t.cursor=rt.blend(t.background,Ge(e.cursor,Bv)),t.cursorAccent=rt.blend(t.background,Ge(e.cursorAccent,Nv)),t.selectionBackgroundTransparent=Ge(e.selectionBackground,Kl),t.selectionBackgroundOpaque=rt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ge(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=rt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ge(e.selectionForeground,Ev):void 0,t.selectionForeground===Ev&&(t.selectionForeground=void 0),rt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=rt.opacity(t.selectionBackgroundTransparent,.3)),rt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=rt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ge(e.scrollbarSliderBackground,rt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ge(e.scrollbarSliderHoverBackground,rt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ge(e.scrollbarSliderActiveBackground,rt.opacity(t.foreground,.5)),t.overviewRulerBorder=Ge(e.overviewRulerBorder,ZC),t.ansi=Et.slice(),t.ansi[0]=Ge(e.black,Et[0]),t.ansi[1]=Ge(e.red,Et[1]),t.ansi[2]=Ge(e.green,Et[2]),t.ansi[3]=Ge(e.yellow,Et[3]),t.ansi[4]=Ge(e.blue,Et[4]),t.ansi[5]=Ge(e.magenta,Et[5]),t.ansi[6]=Ge(e.cyan,Et[6]),t.ansi[7]=Ge(e.white,Et[7]),t.ansi[8]=Ge(e.brightBlack,Et[8]),t.ansi[9]=Ge(e.brightRed,Et[9]),t.ansi[10]=Ge(e.brightGreen,Et[10]),t.ansi[11]=Ge(e.brightYellow,Et[11]),t.ansi[12]=Ge(e.brightBlue,Et[12]),t.ansi[13]=Ge(e.brightMagenta,Et[13]),t.ansi[14]=Ge(e.brightCyan,Et[14]),t.ansi[15]=Ge(e.brightWhite,Et[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<n;s++)t.ansi[s+16]=Ge(e.extendedAnsi[s],Et[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};nd=dt([de(0,li)],nd);function Ge(e,t){if(e!==void 0)try{return ot.toColor(e)}catch{}return t}var QC=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},JC=class{constructor(){this._services=new QC,this._services.set(Cd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Vx(e).sort((o,c)=>o.index-c.index),s=[];for(let o of n){let c=this._services.get(o.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);s.push(c)}let a=n.length>0?n[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},e2={trace:0,debug:1,info:2,warn:3,error:4,off:5},t2="xterm.js: ",rd=class extends Re{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=e2[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":t2)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};rd=dt([de(0,li)],rd);var Lv=class extends Re{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new he),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new he),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new he),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,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(e,t,...n){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+n.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<n.length;s++)this._array[this._getCyclicIndex(e+s)]=n[s];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let s=this._length+n.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let a=t-1;a>=0;a--)this.set(e+a+n,this.get(e+a));let s=e+t+n-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+n,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},De=3,xt=Object.freeze(new ga),$o=0,tf=2,ra=class Ub{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*De);let a=n||Vi.fromCharData([0,rb,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*De+0],s=n&2097151;return[this._data[t*De+1],n&2097152?this._combined[t]:s?dr(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*De+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*De+0]=t|2097152|n[2]<<22):this._data[t*De+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*De+0]>>22}hasWidth(t){return this._data[t*De+0]&12582912}getFg(t){return this._data[t*De+1]}getBg(t){return this._data[t*De+2]}hasContent(t){return this._data[t*De+0]&4194303}getCodePoint(t){let n=this._data[t*De+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*De+0]&2097152}getString(t){let n=this._data[t*De+0];return n&2097152?this._combined[t]:n&2097151?dr(n&2097151):""}isProtected(t){return this._data[t*De+2]&536870912}loadCell(t,n){return $o=t*De,n.content=this._data[$o+0],n.fg=this._data[$o+1],n.bg=this._data[$o+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*De+0]=n.content,this._data[t*De+1]=n.fg,this._data[t*De+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*De+0]=n|s<<22,this._data[t*De+1]=a.fg,this._data[t*De+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*De+0];a&2097152?this._combined[t]+=dr(n):a&2097151?(this._combined[t]=dr(a&2097151)+dr(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*De+0]=a}insertCells(t,n,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length-t){let a=new Vi;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,a));for(let o=0;o<n;++o)this.setCell(t+o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,n,s){if(t%=this.length,n<this.length-t){let a=new Vi;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,a));for(let o=this.length-n;o<this.length;++o)this.setCell(o,s)}else for(let a=t;a<this.length;++a)this.setCell(a,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,n,s,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,s);t<n&&t<this.length;)this.setCell(t++,s)}resize(t,n){if(t===this.length)return this._data.length*4*tf<this._data.buffer.byteLength;let s=t*De;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let a=new Uint32Array(s);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,n)}else{this._data=this._data.subarray(0,s);let a=Object.keys(this._combined);for(let c=0;c<a.length;c++){let f=parseInt(a[c],10);f>=t&&delete this._combined[f]}let o=Object.keys(this._extendedAttrs);for(let c=0;c<o.length;c++){let f=parseInt(o[c],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,s*4*tf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*tf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Ub(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*De+0]&4194303)return t+(this._data[t*De+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*De+0]&4194303||this._data[t*De+2]&50331648)return t+(this._data[t*De+0]>>22);return 0}copyCellsFrom(t,n,s,a,o){let c=t._data;if(o)for(let p=a-1;p>=0;p--){for(let h=0;h<De;h++)this._data[(s+p)*De+h]=c[(n+p)*De+h];c[(n+p)*De+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<De;h++)this._data[(s+p)*De+h]=c[(n+p)*De+h];c[(n+p)*De+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}let f=Object.keys(t._combined);for(let p=0;p<f.length;p++){let h=parseInt(f[p],10);h>=n&&(this._combined[h-n+s]=t._combined[h])}}translateToString(t,n,s,a){n=n??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),a&&(a.length=0);let o="";for(;n<s;){let c=this._data[n*De+0],f=c&2097151,p=c&2097152?this._combined[n]:f?dr(f):mr;if(o+=p,a)for(let h=0;h<p.length;++h)a.push(n);n+=c>>22||1}return a&&a.push(n),o}};function i2(e,t,n,s,a,o){let c=[];for(let f=0;f<e.length-1;f++){let p=f,h=e.get(++p);if(!h.isWrapped)continue;let g=[e.get(f)];for(;p<e.length&&h.isWrapped;)g.push(h),h=e.get(++p);if(!o&&s>=f&&s<p){f+=g.length-1;continue}let _=0,b=da(g,_,t),y=1,x=0;for(;y<g.length;){let L=da(g,y,t),R=L-x,$=n-b,I=Math.min(R,$);g[_].copyCellsFrom(g[y],x,b,I,!1),b+=I,b===n&&(_++,b=0),x+=I,x===L&&(y++,x=0),b===0&&_!==0&&g[_-1].getWidth(n-1)===2&&(g[_].copyCellsFrom(g[_-1],n-1,b++,1,!1),g[_-1].setCell(n-1,a))}g[_].replaceCells(b,n,a);let k=0;for(let L=g.length-1;L>0&&(L>_||g[L].getTrimmedLength()===0);L--)k++;k>0&&(c.push(f+g.length-k),c.push(k)),f+=g.length-1}return c}function n2(e,t){let n=[],s=0,a=t[s],o=0;for(let c=0;c<e.length;c++)if(a===c){let f=t[++s];e.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,a=t[++s]}else n.push(c);return{layout:n,countRemoved:o}}function r2(e,t){let n=[];for(let s=0;s<t.length;s++)n.push(e.get(t[s]));for(let s=0;s<n.length;s++)e.set(s,n[s]);e.length=t.length}function s2(e,t,n){let s=[],a=e.map((p,h)=>da(e,h,t)).reduce((p,h)=>p+h),o=0,c=0,f=0;for(;f<a;){if(a-f<n){s.push(a-f);break}o+=n;let p=da(e,c,t);o>p&&(o-=p,c++);let h=e[c].getWidth(o-1)===2;h&&o--;let g=h?n-1:n;s.push(g),f+=g}return s}function da(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,a=e[t+1].getWidth(0)===2;return s&&a?n-1:n}var Pb=class Ib{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ib._nextId++,this._onDispose=this.register(new he),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Yr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Pb._nextId=1;var l2=Pb,Dt={},Fr=Dt.B;Dt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Dt.A={"#":"£"};Dt.B=void 0;Dt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Dt.C=Dt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Dt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Dt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Dt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Dt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Dt.E=Dt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Dt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Dt.H=Dt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Dt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var zv=4294967295,Ov=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=xt.clone(),this.savedCharset=Fr,this.markers=[],this._nullCell=Vi.fromCharData([0,rb,1,0]),this._whitespaceCell=Vi.fromCharData([0,mr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new fu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Lv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ou),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ou),this._whitespaceCell}getBlankLine(e,t){return new ra(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>zv?zv:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=xt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Lv(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(xt),s=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,n);let o=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new ra(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new ra(e,n)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let c=this.lines.length-a;c>0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=i2(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(xt),n);if(s.length>0){let a=n2(this.lines,s);r2(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let s=this.getNullCell(xt),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ra(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(xt),a=[],o=0;for(let c=this.lines.length-1;c>=0;c--){let f=this.lines.get(c);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let p=[f];for(;f.isWrapped&&c>0;)f=this.lines.get(--c),p.unshift(f);if(!n){let I=this.ybase+this.y;if(I>=c&&I<c+p.length)continue}let h=p[p.length-1].getTrimmedLength(),g=s2(p,this._cols,e),_=g.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let y=[];for(let I=0;I<_;I++){let Z=this.getBlankLine(xt,!0);y.push(Z)}y.length>0&&(a.push({start:c+p.length+o,newLines:y}),o+=y.length),p.push(...y);let x=g.length-1,k=g[x];k===0&&(x--,k=g[x]);let L=p.length-_-1,R=h;for(;L>=0;){let I=Math.min(R,k);if(p[x]===void 0)break;if(p[x].copyCellsFrom(p[L],R-I,k-I,I,!0),k-=I,k===0&&(x--,k=g[x]),R-=I,R===0){L--;let Z=Math.max(L,0);R=da(p,Z,this._cols)}}for(let I=0;I<p.length;I++)g[I]<e&&p[I].setCell(g[I],s);let $=_-b;for(;$-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let c=[],f=[];for(let k=0;k<this.lines.length;k++)f.push(this.lines.get(k));let p=this.lines.length,h=p-1,g=0,_=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let k=Math.min(this.lines.maxLength-1,p+o-1);k>=0;k--)if(_&&_.start>h+b){for(let L=_.newLines.length-1;L>=0;L--)this.lines.set(k--,_.newLines[L]);k++,c.push({index:h+1,amount:_.newLines.length}),b+=_.newLines.length,_=a[++g]}else this.lines.set(k,f[h--]);let y=0;for(let k=c.length-1;k>=0;k--)c[k].index+=y,this.lines.onInsertEmitter.fire(c[k]),y+=c[k].amount;let x=Math.max(0,p+o-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,n=0,s){let a=this.lines.get(e);return a?a.translateToString(t,n,s):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new l2(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},a2=class extends Re{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new he),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 Ov(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ov(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Fb=2,qb=1,sd=class extends Re{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Fb),this.rows=Math.max(e.rawOptions.rows||0,qb),this.buffers=this._register(new a2(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=n.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let a=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let c=n.lines.isFull;o===n.lines.length-1?c?n.lines.recycle().copyFrom(s):n.lines.push(s.clone()):n.lines.splice(o+1,0,s.clone()),c?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let c=o-a+1;n.lines.shiftElements(a+1,c-1,-1),n.lines.set(o,s.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let s=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),s!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};sd=dt([de(0,li)],sd);var Us={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:hu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},o2=["normal","bold","100","200","300","400","500","600","700","800","900"],u2=class extends Re{constructor(e){super(),this._onOptionChange=this._register(new he),this.onOptionChange=this._onOptionChange.event;let t={...Us};for(let n in e)if(n in t)try{let s=e[n];t[n]=this._sanitizeAndValidateOption(n,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(lt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Us))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in Us))throw new Error(`No option with key "${n}"`);s=this._sanitizeAndValidateOption(n,s),this.rawOptions[n]!==s&&(this.rawOptions[n]=s,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let s={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Us[e]),!c2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Us[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=o2.includes(t)?t:Us[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function c2(e){return e==="block"||e==="underline"||e==="bar"}function sa(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let s in e)n[s]=t<=1?e[s]:e[s]&&sa(e[s],t-1);return n}var jv=Object.freeze({insertMode:!1}),Hv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ld=class extends Re{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new he),this.onData=this._onData.event,this._onUserInput=this._register(new he),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new he),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=sa(jv),this.decPrivateModes=sa(Hv)}reset(){this.modes=sa(jv),this.decPrivateModes=sa(Hv)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};ld=dt([de(0,si),de(1,ub),de(2,li)],ld);var Uv={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function nf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var rf=String.fromCharCode,Pv={DEFAULT:e=>{let t=[nf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${rf(t[0])}${rf(t[1])}${rf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nf(e,!0)};${e.x};${e.y}${t}`}},ad=class extends Re{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new he),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Uv))this.addProtocol(s,Uv[s]);for(let s of Object.keys(Pv))this.addEncoding(s,Pv[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let s=t/n,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=s+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};ad=dt([de(0,si),de(1,Xr),de(2,li)],ad);var sf=[[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]],h2=[[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]],Tt;function f2(e,t){let n=0,s=t.length-1,a;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=n;)if(a=n+s>>1,e>t[a][1])n=a+1;else if(e<t[a][0])s=a-1;else return!0;return!1}var d2=class{constructor(){if(this.version="6",!Tt){Tt=new Uint8Array(65536),Tt.fill(1),Tt[0]=0,Tt.fill(0,1,32),Tt.fill(0,127,160),Tt.fill(2,4352,4448),Tt[9001]=2,Tt[9002]=2,Tt.fill(2,11904,42192),Tt[12351]=1,Tt.fill(2,44032,55204),Tt.fill(2,63744,64256),Tt.fill(2,65040,65050),Tt.fill(2,65072,65136),Tt.fill(2,65280,65377),Tt.fill(2,65504,65511);for(let e=0;e<sf.length;++e)Tt.fill(0,sf[e][0],sf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Tt[e]:f2(e,h2)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),s=n===0&&t!==0;if(s){let a=qr.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return qr.createPropertyValue(0,n,s)}},qr=class su{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new he,this.onChange=this._onChange.event;let t=new d2;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,s=!1){return(t&16777215)<<3|(n&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,s=0,a=t.length;for(let o=0;o<a;++o){let c=t.charCodeAt(o);if(55296<=c&&c<=56319){if(++o>=a)return n+this.wcwidth(c);let h=t.charCodeAt(o);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let f=this.charProperties(c,s),p=su.extractWidth(f);su.extractShouldJoin(f)&&(p-=su.extractWidth(s)),n+=p,s=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},p2=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Iv(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Xl=2147483647,m2=256,Wb=class od{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>m2)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new od;if(!t.length)return n;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let a=t[s];if(Array.isArray(a))for(let o=0;o<a.length;++o)n.addSubParam(a[o]);else n.addParam(a)}return n}clone(){let t=new od(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Xl?Xl:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Xl?Xl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-n>0?this._subParams.subarray(n,s):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let s=this._subParamsIdx[n]>>8,a=this._subParamsIdx[n]&255;a-s>0&&(t[n]=this._subParams.slice(s,a))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,a=s[n-1];s[n-1]=~a?Math.min(a*10+t,Xl):t}},$l=[],_2=class{constructor(){this._state=0,this._active=$l,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$l}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=$l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$l,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].end(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=$l,this._id=-1,this._state=0}}},Di=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Gl=[],g2=class{constructor(){this._handlers=Object.create(null),this._active=Gl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,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=Gl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Gl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",vu(e,t,n));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,s=this._active.length-1,a=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,n=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&n===!1){for(;s>=0&&(n=this._active[s].unhook(e),n!==!0);s--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,n;s--}for(;s>=0;s--)if(n=this._active[s].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,n}this._active=Gl,this._ident=0}},la=new Wb;la.addParam(0);var Fv=class{constructor(e){this._handler=e,this._data="",this._params=la,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():la,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=vu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=la,this._data="",this._hitLimit=!1,n));return this._params=la,this._data="",this._hitLimit=!1,t}},v2=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,s){this.table[t<<8|e]=n<<4|s}addMany(e,t,n,s){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=n<<4|s}},Wi=160,y2=(function(){let e=new v2(4095),t=Array.apply(null,Array(256)).map((f,p)=>p),n=(f,p)=>t.slice(f,p),s=n(32,127),a=n(0,24);a.push(25),a.push.apply(a,n(28,32));let o=n(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in o)e.addMany([24,26,153,154],c,3,0),e.addMany(n(128,144),c,3,0),e.addMany(n(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Wi,0,2,0),e.add(Wi,8,5,8),e.add(Wi,6,0,6),e.add(Wi,11,0,11),e.add(Wi,13,13,13),e})(),b2=class extends Re{constructor(e=y2){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Wb,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(lt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new _2),this._dcsParser=this._register(new g2),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let o=e.intermediates.charCodeAt(a);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=s,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let s=this._escHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let s=this._csiHandlers[n];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,n,s,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=s,this._parseStack.chunkPos=a}parse(e,t,n){let s=0,a=0,o=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](this._params),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(c=f[p](),c!==!0);p--)if(c instanceof Promise)return this._parseStack.handlerPos=p,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,n),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=o;f<t;++f){switch(s=e[f],a=this._transitions.table[this.currentState<<8|(s<160?s:Wi)],a>>4){case 2:for(let b=f+1;;++b){if(b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Wi){this._printHandler(e,f,b),f=b-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|s],h=p?p.length-1:-1;for(;h>=0&&(c=p[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,p,h,a,f),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++f<t&&(s=e[f])>47&&s<60);f--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let g=this._escHandlers[this._collect<<8|s],_=g?g.length-1:-1;for(;_>=0&&(c=g[_](),c!==!0);_--)if(c instanceof Promise)return this._preserveStack(4,g,_,a,f),c;_<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let b=f+1;;++b)if(b>=t||(s=e[b])===24||s===26||s===27||s>127&&s<Wi){this._dcsParser.put(e,f,b),f=b-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=f+1;;b++)if(b>=t||(s=e[b])<32||s>127&&s<Wi){this._oscParser.put(e,f,b),f=b-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,a,f),c;s===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},S2=/^([\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})$/,x2=/^[\da-f]+$/;function qv(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=S2.exec(t);if(n){let s=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/s*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/s*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),x2.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,s=[0,0,0];for(let a=0;a<3;++a){let o=parseInt(t.slice(n*a,n*a+n),16);s[a]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return s}}function lf(e,t){let n=e.toString(16),s=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function w2(e,t=16){let[n,s,a]=e;return`rgb:${lf(n,t)}/${lf(s,t)}/${lf(a,t)}`}var C2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},hr=131072,Wv=10;function Yv(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Vv=5e3,Kv=0,k2=class extends Re{constructor(e,t,n,s,a,o,c,f,p=new b2){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=s,this._optionsService=a,this._oscLinkService=o,this._coreMouseService=c,this._unicodeService=f,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Wx,this._utf8Decoder=new Yx,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=xt.clone(),this._eraseAttrDataInternal=xt.clone(),this._onRequestBell=this._register(new he),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new he),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new he),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new he),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new he),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new he),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new he),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new he),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new he),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 ud(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:_})}),this._parser.setDcsHandlerFallback((h,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:_})}),this._parser.setPrintHandler((h,g,_)=>this.print(h,g,_)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(re.BEL,()=>this.bell()),this._parser.setExecuteHandler(re.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(re.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(re.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(re.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(re.BS,()=>this.backspace()),this._parser.setExecuteHandler(re.HT,()=>this.tab()),this._parser.setExecuteHandler(re.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(re.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(nu.IND,()=>this.index()),this._parser.setExecuteHandler(nu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(nu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Di(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Di(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Di(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Di(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Di(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Di(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Di(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Di(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Di(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Di(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Di(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Di(h=>this.restoreCursorColor(h))),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(let h in Dt)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Fv((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),Vv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Vv} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,s=this._activeBuffer.x,a=this._activeBuffer.y,o=0,c=this._parseStack.paused;if(c){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;s=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>hr&&(o=this._parseStack.position+hr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<hr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,hr))),c||this._dirtyRowTracker.clearRange(),e.length>hr)for(let h=o;h<e.length;h+=hr){let g=h+hr<e.length?h+hr:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(s,a,_,h),this._logSlowResolvingAsync(n),n}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,a,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==s||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let s,a,o=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let y=t;y<n;++y){if(s=e[y],s<127&&o){let R=o[String.fromCharCode(s)];R&&(s=R.charCodeAt(0))}let x=this._unicodeService.charProperties(s,b);a=qr.extractWidth(x);let k=qr.extractShouldJoin(x),L=k?qr.extractWidth(b):0;if(b=x,c&&this._onA11yChar.fire(dr(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-L>f){if(p){let R=_,$=this._activeBuffer.x-L;for(this._activeBuffer.x=L,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),L>0&&_ instanceof ra&&_.copyCellsFrom(R,$,0,L,!1);$<f;)R.setCellFromCodepoint($++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(k&&this._activeBuffer.x){let R=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-R,s,a);for(let $=a-L;--$>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(_.insertCells(this._activeBuffer.x,a-L,this._activeBuffer.getNullCell(g)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,s,a,g),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<f&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>Yv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Fv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Di(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,s=!1,a=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),a),s&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&s.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(xt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,s=qr.extractWidth(t),a=this._activeBuffer.x-s,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),c=new Uint32Array(o.length*n),f=0;for(let h=0;h<o.length;){let g=o.codePointAt(h)||0;c[f++]=g,h+=g>65535?2:1}let p=f;for(let h=1;h<n;++h)c.copyWithin(p,0,f),p+=f;return this.print(c,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(re.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(re.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(re.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(re.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(re.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Fr),this._charsetService.setgCharset(1,Fr),this._charsetService.setgCharset(2,Fr),this._charsetService.setgCharset(3,Fr);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let s=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:o}=this._coreMouseService,c=this._coreService,{buffers:f,cols:p}=this._bufferService,{active:h,alt:g}=f,_=this._optionsService.rawOptions,b=(k,L)=>(c.triggerDataEvent(`${re.ESC}[${t?"":"?"}${k};${L}$y`),!0),y=k=>k?1:2,x=e.params[0];return t?x===2?b(x,4):x===4?b(x,y(c.modes.insertMode)):x===12?b(x,3):x===20?b(x,y(_.convertEol)):b(x,0):x===1?b(x,y(s.applicationCursorKeys)):x===3?b(x,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):x===6?b(x,y(s.origin)):x===7?b(x,y(s.wraparound)):x===8?b(x,3):x===9?b(x,y(a==="X10")):x===12?b(x,y(_.cursorBlink)):x===25?b(x,y(!c.isCursorHidden)):x===45?b(x,y(s.reverseWraparound)):x===66?b(x,y(s.applicationKeypad)):x===67?b(x,4):x===1e3?b(x,y(a==="VT200")):x===1002?b(x,y(a==="DRAG")):x===1003?b(x,y(a==="ANY")):x===1004?b(x,y(s.sendFocus)):x===1005?b(x,4):x===1006?b(x,y(o==="SGR")):x===1015?b(x,4):x===1016?b(x,y(o==="SGR_PIXELS")):x===1048?b(x,1):x===47||x===1047||x===1049?b(x,y(h===g)):x===2004?b(x,y(s.bracketedPasteMode)):x===2026?b(x,y(s.synchronizedOutput)):b(x,0)}_updateAttrColor(e,t,n,s,a){return t===2?(e|=50331648,e&=-16777216,e|=ga.fromColorRGB([n,s,a])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let s=[0,0,-1,0,0,0],a=0,o=0;do{if(s[o+a]=e.params[t+o],e.hasSubParams(t+o)){let c=e.getSubParams(t+o),f=0;do s[1]===5&&(a=1),s[o+f+1+a]=c[f];while(++f<c.length&&f+o+1+a<s.length);break}if(s[1]===5&&o+a>=2||s[1]===2&&o+a>=5)break;s[1]&&(a=1)}while(++o+t<e.length&&o+a<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:n.fg=this._updateAttrColor(n.fg,s[1],s[3],s[4],s[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,s[1],s[3],s[4],s[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,s[1],s[3],s[4],s[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=xt.fg,e.bg=xt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,s=this._curAttrData;for(let a=0;a<t;a++)n=e.params[a],n>=30&&n<=37?(s.fg&=-50331904,s.fg|=16777216|n-30):n>=40&&n<=47?(s.bg&=-50331904,s.bg|=16777216|n-40):n>=90&&n<=97?(s.fg&=-50331904,s.fg|=16777216|n-90|8):n>=100&&n<=107?(s.bg&=-50331904,s.bg|=16777216|n-100|8):n===0?this._processSGR0(s):n===1?s.fg|=134217728:n===3?s.bg|=67108864:n===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,s)):n===5?s.fg|=536870912:n===7?s.fg|=67108864:n===8?s.fg|=1073741824:n===9?s.fg|=2147483648:n===2?s.bg|=134217728:n===21?this._processUnderline(2,s):n===22?(s.fg&=-134217729,s.bg&=-134217729):n===23?s.bg&=-67108865:n===24?(s.fg&=-268435457,this._processUnderline(0,s)):n===25?s.fg&=-536870913:n===27?s.fg&=-67108865:n===28?s.fg&=-1073741825:n===29?s.fg&=2147483647:n===39?(s.fg&=-67108864,s.fg|=xt.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=xt.bg&16777215):n===38||n===48||n===58?a+=this._extractColor(e,a,s):n===53?s.bg|=1073741824:n===55?s.bg&=-1073741825:n===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):n===100?(s.fg&=-67108864,s.fg|=xt.fg&16777215,s.bg&=-67108864,s.bg|=xt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${re.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${re.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${re.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=xt.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Yv(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${re.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Wv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Wv&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let s=n.shift(),a=n.shift();if(/^\d+$/.exec(s)){let o=parseInt(s);if(Xv(o))if(a==="?")t.push({type:0,index:o});else{let c=qv(a);c&&t.push({type:1,index:o,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(n,s):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),s,a=n.findIndex(o=>o.startsWith("id="));return a!==-1&&(s=n[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let s=0;s<n.length&&!(t>=this._specialColors.length);++s,++t)if(n[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=qv(n[s]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let s=0;s<n.length;++s)if(/^\d+$/.exec(n[s])){let a=parseInt(n[s]);Xv(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,Fr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(C2[e[0]],Dt[e[1]]||Fr),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=xt.clone(),this._eraseAttrDataInternal=xt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Vi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(n);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=c=>(this._coreService.triggerDataEvent(`${re.ESC}${c}${re.ESC}\\`),!0),s=this._bufferService.buffer,a=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ud=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Kv=e,e=t,t=Kv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ud=dt([de(0,si)],ud);function Xv(e){return 0<=e&&e<256}var E2=5e7,$v=12,T2=50,A2=class extends Re{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new he),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>E2)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],a=this._action(s,t);if(a){let c=f=>performance.now()-n>=$v?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(c);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-n>=$v)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>T2&&(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()}},cd=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(p,f)),this._dataByLinkId.set(p.id,p),p.id}let n=e,s=this._getEntryIdKey(n),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let o=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(c,o)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);n.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(n,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};cd=dt([de(0,si)],cd);var Gv=!1,D2=class extends Re{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ys),this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onData=this._register(new he),this.onData=this._onData.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new he),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new he),this._instantiationService=new JC,this.optionsService=this._register(new u2(e)),this._instantiationService.setService(li,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(si,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(rd)),this._instantiationService.setService(ub,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ld)),this._instantiationService.setService(Xr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ad)),this._instantiationService.setService(ob,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(qr)),this._instantiationService.setService($x,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p2),this._instantiationService.setService(Xx,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(cd),this._instantiationService.setService(cb,this._oscLinkService),this._inputHandler=this._register(new k2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Kt.forward(this._bufferService.onResize,this._onResize)),this._register(Kt.forward(this.coreService.onData,this._onData)),this._register(Kt.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new A2((t,n)=>this._inputHandler.parse(t,n))),this._register(Kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new he),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Gv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Gv=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Fb),t=Math.max(t,qb),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Iv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Iv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=lt(()=>{for(let t of e)t.dispose()})}}},R2={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:["'",'"']};function M2(e,t,n,s){var c;let a={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=re.ESC+"OA":a.key=re.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=re.ESC+"OD":a.key=re.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=re.ESC+"OC":a.key=re.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=re.ESC+"OB":a.key=re.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":re.DEL,e.altKey&&(a.key=re.ESC+a.key);break;case 9:if(e.shiftKey){a.key=re.ESC+"[Z";break}a.key=re.HT,a.cancel=!0;break;case 13:a.key=e.altKey?re.ESC+re.CR:re.CR,a.cancel=!0;break;case 27:a.key=re.ESC,e.altKey&&(a.key=re.ESC+re.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"D":t?a.key=re.ESC+"OD":a.key=re.ESC+"[D";break;case 39:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"C":t?a.key=re.ESC+"OC":a.key=re.ESC+"[C";break;case 38:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"A":t?a.key=re.ESC+"OA":a.key=re.ESC+"[A";break;case 40:if(e.metaKey)break;o?a.key=re.ESC+"[1;"+(o+1)+"B":t?a.key=re.ESC+"OB":a.key=re.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=re.ESC+"[2~");break;case 46:o?a.key=re.ESC+"[3;"+(o+1)+"~":a.key=re.ESC+"[3~";break;case 36:o?a.key=re.ESC+"[1;"+(o+1)+"H":t?a.key=re.ESC+"OH":a.key=re.ESC+"[H";break;case 35:o?a.key=re.ESC+"[1;"+(o+1)+"F":t?a.key=re.ESC+"OF":a.key=re.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=re.ESC+"[5;"+(o+1)+"~":a.key=re.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=re.ESC+"[6;"+(o+1)+"~":a.key=re.ESC+"[6~";break;case 112:o?a.key=re.ESC+"[1;"+(o+1)+"P":a.key=re.ESC+"OP";break;case 113:o?a.key=re.ESC+"[1;"+(o+1)+"Q":a.key=re.ESC+"OQ";break;case 114:o?a.key=re.ESC+"[1;"+(o+1)+"R":a.key=re.ESC+"OR";break;case 115:o?a.key=re.ESC+"[1;"+(o+1)+"S":a.key=re.ESC+"OS";break;case 116:o?a.key=re.ESC+"[15;"+(o+1)+"~":a.key=re.ESC+"[15~";break;case 117:o?a.key=re.ESC+"[17;"+(o+1)+"~":a.key=re.ESC+"[17~";break;case 118:o?a.key=re.ESC+"[18;"+(o+1)+"~":a.key=re.ESC+"[18~";break;case 119:o?a.key=re.ESC+"[19;"+(o+1)+"~":a.key=re.ESC+"[19~";break;case 120:o?a.key=re.ESC+"[20;"+(o+1)+"~":a.key=re.ESC+"[20~";break;case 121:o?a.key=re.ESC+"[21;"+(o+1)+"~":a.key=re.ESC+"[21~";break;case 122:o?a.key=re.ESC+"[23;"+(o+1)+"~":a.key=re.ESC+"[23~";break;case 123:o?a.key=re.ESC+"[24;"+(o+1)+"~":a.key=re.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=re.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=re.DEL:e.keyCode===219?a.key=re.ESC:e.keyCode===220?a.key=re.FS:e.keyCode===221&&(a.key=re.GS);else if((!n||s)&&e.altKey&&!e.metaKey){let f=(c=R2[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(f)a.key=re.ESC+f;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(p);e.shiftKey&&(h=h.toUpperCase()),a.key=re.ESC+h}else if(e.keyCode===32)a.key=re.ESC+(e.ctrlKey?re.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),a.key=re.ESC+p,a.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=re.US),e.key==="@"&&(a.key=re.NUL));break}return a}var _t=0,B2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new fu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new fu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,o)=>this._getKey(a)-this._getKey(o)),t=0,n=0,s=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<s.length;a++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(s[a]=e[t],t++):s[a]=this._array[n++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(_t=this._search(t),_t===-1)||this._getKey(this._array[_t])!==t)return!1;do if(this._array[_t]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(_t),!0;while(++_t<this._array.length&&this._getKey(this._array[_t])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,o)=>a-o),t=0,n=new Array(this._array.length-e.length),s=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:n[s++]=this._array[a];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_t=this._search(e),!(_t<0||_t>=this._array.length)&&this._getKey(this._array[_t])===e))do yield this._array[_t];while(++_t<this._array.length&&this._getKey(this._array[_t])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(_t=this._search(e),!(_t<0||_t>=this._array.length)&&this._getKey(this._array[_t])===e))do t(this._array[_t]);while(++_t<this._array.length&&this._getKey(this._array[_t])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let s=t+n>>1,a=this._getKey(this._array[s]);if(a>e)n=s-1;else if(a<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},af=0,Zv=0,N2=class extends Re{constructor(){super(),this._decorations=new B2(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new he),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new he),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(lt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new L2(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let s=0,a=0;for(let o of this._decorations.getKeyIterator(t))s=o.options.x??0,a=s+(o.options.width??1),e>=s&&e<a&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,s){this._decorations.forEachByKey(t,a=>{af=a.options.x??0,Zv=af+(a.options.width??1),e>=af&&e<Zv&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},L2=class extends _r{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new he),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new he),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ot.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ot.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},z2=1e3,O2=class{constructor(e,t=z2){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=s-this._lastRefreshMs,o=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Qv=20,du=class extends Re{constructor(e,t,n,s){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new O2(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
73
+ `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(we(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(lt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Qv+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
74
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Qv+1&&(this._liveRegion.textContent+=Rf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,s=n.lines.length.toString();for(let a=e;a<=t;a++){let o=n.lines.get(n.ydisp+a),c=[],f=(o==null?void 0:o.translateToString(!0,void 0,void 0,c))||"",p=(n.ydisp+a+1).toString(),h=this._rowElements[a];h&&(f.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",p),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],a=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===o||e.relatedTarget!==s)return;let c,f;if(t===0?(c=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(c=this._rowElements.shift(),f=n,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var f;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:s,offset:((f=s.textContent)==null?void 0:f.length)??0}),!this._rowContainer.contains(n.node))return;let a=({node:p,offset:h})=>{let g=p instanceof Text?p.parentNode:p,_=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(g);if(!b)return console.warn("columns is null. Race condition?"),null;let y=h<b.length?b[h]:b.slice(-1)[0]+1;return y>=this._terminal.cols&&(++_,y=0),{row:_,column:y}},o=a(t),c=a(n);if(!(!o||!c)){if(o.row>c.row||o.row===c.row&&o.column>=c.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(c.row-o.row)*this._terminal.cols-o.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var a,o;e.style.transform="";let t=e.getBoundingClientRect().width,n=(o=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:o[0];if(!n)return;let s=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};du=dt([de(1,Cd),de(2,zn),de(3,On)],du);var hd=class extends Re{constructor(e,t,n,s,a){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=s,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new he),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new he),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(lt(()=>{var o;Yr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(o=this._activeProviderReplies)==null||o.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(we(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(we(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(we(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(we(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let s=0;s<n.length;s++){let a=n[s];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,a;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(o=>{o==null||o.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[o,c]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(o)&&(n=this._checkLinkProviderResult(o,e,n)):c.provideLinks(e.y,f=>{var h,g;if(this._isMouseOut)return;let p=f==null?void 0:f.map(_=>({link:_}));(h=this._activeProviderReplies)==null||h.set(o,p),n=this._checkLinkProviderResult(o,e,n),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let s=0;s<t.size;s++){let a=t.get(s);if(a)for(let o=0;o<a.length;o++){let c=a[o],f=c.link.range.start.y<e?0:c.link.range.start.x,p=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=f;h<=p;h++){if(n.has(h)){a.splice(o--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){var o;if(!this._activeProviderReplies)return n;let s=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&s){let c=s.find(f=>this._linkAtPosition(f.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let f=(o=this._activeProviderReplies.get(c))==null?void 0:o.find(p=>this._linkAtPosition(p.link,t));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&j2(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Yr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.pointerCursor},set:n=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,s;return(s=(n=this._currentLink)==null?void 0:n.state)==null?void 0:s.decorations.underline},set:n=>{var s,a,o;(s=this._currentLink)!=null&&s.state&&((o=(a=this._currentLink)==null?void 0:a.state)==null?void 0:o.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let s=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(s,a),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,s=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-s-1,n.end.x,n.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,n){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return n<=a&&a<=s}_positionFromMouseEvent(e,t,n){let s=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,s,a){return{x1:e,y1:t,x2:n,y2:s,cols:this._bufferService.cols,fg:a}}};hd=dt([de(1,kd),de(2,On),de(3,si),de(4,fb)],hd);function j2(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var H2=class extends D2{constructor(e={}){super(e),this._linkifier=this._register(new Ys),this.browser=Mb,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ys),this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new he),this.onKey=this._onKey.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new he),this.onBell=this._onBell.event,this._onFocus=this._register(new he),this._onBlur=this._register(new he),this._onA11yCharEmitter=this._register(new he),this._onA11yTabEmitter=this._register(new he),this._onWillOpen=this._register(new he),this._setup(),this._decorationService=this._instantiationService.createInstance(N2),this._instantiationService.setService(va,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(TC),this._instantiationService.setService(fb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Bf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(lt(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,s="";switch(t.index){case 256:n="foreground",s="10";break;case 257:n="background",s="11";break;case 258:n="cursor",s="12";break;default:n="ansi",s="4;"+t.index}switch(t.type){case 0:let a=rt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${re.ESC}]${s};${w2(a)}${Db.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=wt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=wt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(re.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(re.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,a=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*a,c=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=c+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(we(this.element,"copy",t=>{this.hasSelection()&&Fx(t,this._selectionService)}));let e=t=>qx(t,this.textarea,this.coreService,this.optionsService);this._register(we(this.textarea,"paste",e)),this._register(we(this.element,"paste",e)),Bb?this._register(we(this.element,"mousedown",t=>{t.button===2&&ov(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(we(this.element,"contextmenu",t=>{ov(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Nd&&this._register(we(this.element,"auxclick",t=>{t.button===1&&nb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(we(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(we(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(we(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(we(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(we(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(we(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(we(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((a=this.element)==null?void 0:a.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(we(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Df.get()),zb||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(kC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(zn,this._coreBrowserService),this._register(we(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(we(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Jf,this._document,this._helperContainer),this._instantiationService.setService(yu,this._charSizeService),this._themeService=this._instantiationService.createInstance(nd),this._instantiationService.setService(Ks,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cu),this._instantiationService.setService(hb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(td,this.rows,this.screenElement)),this._instantiationService.setService(On,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Gf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ed),this._instantiationService.setService(kd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(hd,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(Xf,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(id,this.element,this.screenElement,s)),this._instantiationService.setService(Zx,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance($f,this.screenElement)),this._register(we(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Qf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){var h,g,_,b,y;let c=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!c)return!1;let f,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(f=3,o.button!==void 0&&(f=o.button<3?o.button:3)):f=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,f=o.button<3?o.button:3;break;case"mousedown":p=1,f=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let x=o.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(o,(b=(_=(g=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:g.device)==null?void 0:_.cell)==null?void 0:b.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;p=x<0?0:1,f=4;break;default:return!1}return p===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:f,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(t.addEventListener("mousemove",a.mousemove),s.mousemove=a.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),s.wheel=a.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(we(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(we(t,"wheel",o=>{var c,f,p,h,g;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(h=(p=(f=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:f.device)==null?void 0:p.cell)==null?void 0:h.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(o,!0);let _=re.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){ib(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=M2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let s=this.rows-1;return this.scrollLines(n.type===2?-s:s),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===re.ETX||n.key===re.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(U2(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(xt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(re.ESC+"[I"):this.coreService.triggerDataEvent(re.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${re.ESC}[4;${n};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${re.ESC}[6;${a};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function U2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var P2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},I2=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Vi)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Jv=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new I2(t)}getNullCell(){return new Vi}},F2=class extends Re{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new he),this.onBufferChange=this._onBufferChange.event,this._normal=new Jv(this._core.buffers.normal,"normal"),this._alternate=new Jv(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)}},q2=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,s)=>t(n,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},W2=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Y2=["cols","rows"],sn=0,V2=class extends Re{constructor(e){super(),this._core=this._register(new H2(e)),this._addonManager=this._register(new P2),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],n=(s,a)=>{this._checkReadonlyOptions(s),this._core.options[s]=a};for(let s in this._core.options){let a={get:t.bind(this,s),set:n.bind(this,s)};Object.defineProperty(this._publicOptions,s,a)}}_checkReadonlyOptions(e){if(Y2.includes(e))throw new Error(`Option "${e}" 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 q2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new W2(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 F2(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
75
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Df.get()},set promptLabel(e){Df.set(e)},get tooMuchOutput(){return Rf.get()},set tooMuchOutput(e){Rf.set(e)}}}_verifyIntegers(...e){for(sn of e)if(sn===1/0||isNaN(sn)||sn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sn of e)if(sn&&(sn===1/0||isNaN(sn)||sn%1!==0||sn<0))throw new Error("This API only accepts positive integers")}};/**
76
76
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
77
77
  * @license MIT
78
78
  *
@@ -83,7 +83,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
83
83
  * Fabrice Bellard's javascript vt100 for jslinux:
84
84
  * http://bellard.org/jslinux/
85
85
  * Copyright (c) 2011 Fabrice Bellard
86
- */var Y2=2,V2=1,K2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var _;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 t=this._terminal.options.scrollback===0?0:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,p=c.right+c.left,h=s-f,g=a-p-t;return{cols:Math.max(Y2,Math.floor(g/e.css.cell.width)),rows:Math.max(V2,Math.floor(h/e.css.cell.height))}}};/**
86
+ */var K2=2,X2=1,$2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var _;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 t=this._terminal.options.scrollback===0?0:((_=this._terminal.options.overviewRuler)==null?void 0:_.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(n.getPropertyValue("height")),a=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),c={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},f=c.top+c.bottom,p=c.right+c.left,h=s-f,g=a-p-t;return{cols:Math.max(K2,Math.floor(g/e.css.cell.width)),rows:Math.max(X2,Math.floor(h/e.css.cell.height))}}};/**
87
87
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
88
88
  * @license MIT
89
89
  *
@@ -94,37 +94,37 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
94
94
  * Fabrice Bellard's javascript vt100 for jslinux:
95
95
  * http://bellard.org/jslinux/
96
96
  * Copyright (c) 2011 Fabrice Bellard
97
- */var Lt=0,zt=0,Ot=0,ct=0,$t;(e=>{function t(a,o,c,f){return f!==void 0?`#${Hr(a)}${Hr(o)}${Hr(c)}${Hr(f)}`:`#${Hr(a)}${Hr(o)}${Hr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})($t||($t={}));var X2;(e=>{function t(p,h){if(ct=(h.rgba&255)/255,ct===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,b=h.rgba>>8&255,y=p.rgba>>24&255,x=p.rgba>>16&255,E=p.rgba>>8&255;Lt=y+Math.round((g-y)*ct),zt=x+Math.round((_-x)*ct),Ot=E+Math.round((b-E)*ct);let L=$t.toCss(Lt,zt,Ot),R=$t.toRgba(Lt,zt,Ot);return{css:L,rgba:R}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=lu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return $t.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Lt,zt,Ot]=lu.toChannels(h),{css:$t.toCss(Lt,zt,Ot),rgba:h}}e.opaque=a;function o(p,h){return ct=Math.round(h*255),[Lt,zt,Ot]=lu.toChannels(p.rgba),{css:$t.toCss(Lt,zt,Ot,ct),rgba:$t.toRgba(Lt,zt,Ot,ct)}}e.opacity=o;function c(p,h){return ct=p.rgba&255,o(p,ct*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(X2||(X2={}));var Wt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Ot=parseInt(a.slice(3,4).repeat(2),16),$t.toColor(Lt,zt,Ot);case 5:return Lt=parseInt(a.slice(1,2).repeat(2),16),zt=parseInt(a.slice(2,3).repeat(2),16),Ot=parseInt(a.slice(3,4).repeat(2),16),ct=parseInt(a.slice(4,5).repeat(2),16),$t.toColor(Lt,zt,Ot,ct);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Lt=parseInt(o[1]),zt=parseInt(o[2]),Ot=parseInt(o[3]),ct=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),$t.toColor(Lt,zt,Ot,ct);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Lt,zt,Ot,ct]=t.getImageData(0,0,1,1).data,ct!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:$t.toRgba(Lt,zt,Ot,ct),css:a}}e.toColor=s})(Wt||(Wt={}));var ni;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ni||(ni={}));var lu;(e=>{function t(c,f){if(ct=(f&255)/255,ct===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,b=c>>16&255,y=c>>8&255;return Lt=_+Math.round((p-_)*ct),zt=b+Math.round((h-b)*ct),Ot=y+Math.round((g-y)*ct),$t.toRgba(Lt,zt,Ot)}e.blend=t;function n(c,f,p){let h=ni.relativeLuminance(c>>8),g=ni.relativeLuminance(f>>8);if(Bn(h,g)<p){if(g<h){let y=s(c,f,p),x=Bn(h,ni.relativeLuminance(y>>8));if(x<p){let E=a(c,f,p),L=Bn(h,ni.relativeLuminance(E>>8));return x>L?y:E}return y}let _=a(c,f,p),b=Bn(h,ni.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Bn(h,ni.relativeLuminance(y>>8));return b>x?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,E=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));for(;E<p&&(b>0||y>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),E=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,E=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));for(;E<p&&(b<255||y<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),E=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(lu||(lu={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var $2=Object.freeze((()=>{let e=[Wt.toColor("#2e3436"),Wt.toColor("#cc0000"),Wt.toColor("#4e9a06"),Wt.toColor("#c4a000"),Wt.toColor("#3465a4"),Wt.toColor("#75507b"),Wt.toColor("#06989a"),Wt.toColor("#d3d7cf"),Wt.toColor("#555753"),Wt.toColor("#ef2929"),Wt.toColor("#8ae234"),Wt.toColor("#fce94f"),Wt.toColor("#729fcf"),Wt.toColor("#ad7fa8"),Wt.toColor("#34e2e2"),Wt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:$t.toCss(s,a,o),rgba:$t.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:$t.toCss(s,s,s),rgba:$t.toRgba(s,s,s)})}return e})());function Qv(e,t,n){return Math.max(t,Math.min(e,n))}function G2(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var qb=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=n,o=e.start.y,c=e.end.y,f=e.start.x,p=e.end.x;this._beforeSerialize(c-o,o,c);for(let h=o;h<=c;h++){let g=this._buffer.getLine(h);if(g){let _=h===e.start.y?f:0,b=h===e.end.y?p:g.length;for(let y=_;y<b;y++){let x=g.getCell(y,a===n?s:n);if(!x){console.warn(`Can't get cell at row=${h}, col=${y}`);continue}this._nextCell(x,a,h,y),a=x}}this._rowEnd(h,h===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,s){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return""}};function Wb(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Nn(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Yb(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var Z2=class extends qb{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=new Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){var s;this._nullCellCount>0&&!Nn(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!t){e-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(e),o=this._buffer.getLine(e+1);if(!o.isWrapped)n=`\r
98
- `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),f=a.getCell(a.length-2,this._thisRowLastSecondChar),p=o.getCell(0,this._nextRowFirstChar),h=p.getWidth()>1,g=!1;(p.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Nn(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&Nn(c,p)&&Nn(f,p)&&(g=!0)),g||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(e,t){let n=[],s=!Wb(e,t),a=!Nn(e,t),o=!Yb(e,t);if(s||a||o)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(s){let c=e.getFgColor();e.isFgRGB()?n.push(38,2,c>>>16&255,c>>>8&255,c&255):e.isFgPalette()?c>=16?n.push(38,5,c):n.push(c&8?90+(c&7):30+(c&7)):n.push(39)}if(a){let c=e.getBgColor();e.isBgRGB()?n.push(48,2,c>>>16&255,c>>>8&255,c&255):e.isBgPalette()?c>=16?n.push(48,5,c):n.push(c&8?100+(c&7):40+(c&7)):n.push(49)}o&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,this._cursorStyle);if(a?!Nn(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(Nn(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${o.join(";")}m`;let c=this._buffer.getLine(n);c!==void 0&&(c.getCell(s,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=s)}a?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Nn(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let o=0;o<t;o++)n+=this._allRows[o],o+1<t&&(n+=this._allRowSeparators[o]);if(!e){let o=this._buffer.baseY+this._buffer.cursorY,c=this._buffer.cursorX,f=o!==this._lastCursorRow||c!==this._lastCursorCol,p=h=>{h>0?n+=`\x1B[${h}C`:h<0&&(n+=`\x1B[${-h}D`)};f&&((h=>{h>0?n+=`\x1B[${h}B`:h<0&&(n+=`\x1B[${-h}A`)})(o-this._lastCursorRow),p(c-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(n+=`\x1B[${a.join(";")}m`),n}},Q2=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let s=t.length,a=n===void 0?s:Qv(n+e.rows,0,s);return this._serializeBufferByRange(e,t,{start:s-a,end:s-1},!1)}_serializeBufferByRange(e,t,n,s){return new Z2(t,e).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:e.cols,y:typeof n.end=="number"?n.end:n.end.line}},s)}_serializeBufferAsHTML(e,t){var f;let n=e.buffer.active,s=new J2(n,e,t),a=t.onlySelection??!1,o=t.range;if(o)return s.serialize({start:{x:o.startCol,y:(o.startLine,o.startLine)},end:{x:e.cols,y:(o.endLine,o.endLine)}});if(!a){let p=n.length,h=t.scrollback,g=h===void 0?p:Qv(h+e.rows,0,p);return s.serialize({start:{x:0,y:p-g},end:{x:e.cols,y:p-1}})}let c=(f=this._terminal)==null?void 0:f.getSelectionPosition();return c!==void 0?s.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.end.y}}):""}_serializeModes(e){let t="",n=e.modes;if(n.applicationCursorKeysMode&&(t+="\x1B[?1h"),n.applicationKeypadMode&&(t+="\x1B[?66h"),n.bracketedPasteMode&&(t+="\x1B[?2004h"),n.insertMode&&(t+="\x1B[4h"),n.originMode&&(t+="\x1B[?6h"),n.reverseWraparoundMode&&(t+="\x1B[?45h"),n.sendFocusMode&&(t+="\x1B[?1004h"),n.wraparoundMode===!1&&(t+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":t+="\x1B[?9h";break;case"vt200":t+="\x1B[?1000h";break;case"drag":t+="\x1B[?1002h";break;case"any":t+="\x1B[?1003h";break}return t}serialize(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let t=e!=null&&e.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e==null?void 0:e.scrollback);if(!(e!=null&&e.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${n}`}return e!=null&&e.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},J2=class extends qb{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow="",this._htmlContent="",t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=$2}_padStart(e,t,n){return t=t>>0,n=n??" ",e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){var c,f;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",a=((f=this._terminal.options.theme)==null?void 0:f.background)??"#000000");let o=[];o.push("color: "+s+";"),o.push("background-color: "+a+";"),o.push("font-family: "+this._terminal.options.fontFamily+";"),o.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+o.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(e,t){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],s=!Wb(e,t),a=!Nn(e,t),o=!Yb(e,t);if(s||a||o){let c=this._getHexColor(e,!0);c&&n.push("color: "+c+";");let f=this._getHexColor(e,!1);return f&&n.push("background-color: "+f+";"),e.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&n.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?n.push("text-decoration: overline underline;"):e.isUnderline()?n.push("text-decoration: underline;"):e.isOverline()&&n.push("text-decoration: overline;"),e.isBlink()&&n.push("text-decoration: blink;"),e.isInvisible()&&n.push("visibility: hidden;"),e.isItalic()&&n.push("font-style: italic;"),e.isDim()&&n.push("opacity: 0.5;"),e.isStrikethrough()&&n.push("text-decoration: line-through;"),n}}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,t);o&&(this._currentRow+=o.length===0?"</span><span>":"</span><span style='"+o.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=G2(e.getChars())}_serializeString(){return this._htmlContent}};const ek={background:"#F0EBE1",foreground:"#2C1810",cursor:"#8B4513",cursorAccent:"#F0EBE1",selectionBackground:"#D4C5B0",selectionForeground:"#2C1810",black:"#2C1810",red:"#A63D40",green:"#4A7A4A",yellow:"#8B6914",blue:"#4A6FA5",magenta:"#7B4B8A",cyan:"#3D7A7A",white:"#E6DDD0",brightBlack:"#8B7355",brightRed:"#B85C5C",brightGreen:"#5A8A5A",brightYellow:"#A07D1C",brightBlue:"#5A82BA",brightMagenta:"#8E5D9F",brightCyan:"#5A8F8F",brightWhite:"#4A3728"},tk="plotlink-terminal",ik=1,gr="scrollback",Jv=10*1024*1024;function Bd(){return new Promise((e,t)=>{const n=indexedDB.open(tk,ik);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(gr)||s.createObjectStore(gr)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function Zl(e,t){const n=t.length>Jv?t.slice(-Jv):t,s=await Bd();return new Promise((a,o)=>{const c=s.transaction(gr,"readwrite");c.objectStore(gr).put(n,e),c.oncomplete=()=>{s.close(),a()},c.onerror=()=>{s.close(),o(c.error)}})}async function nk(e){const t=await Bd();return new Promise((n,s)=>{const o=t.transaction(gr,"readonly").objectStore(gr).get(e);o.onsuccess=()=>{t.close(),n(o.result??null)},o.onerror=()=>{t.close(),s(o.error)}})}async function ey(e){const t=await Bd();return new Promise((n,s)=>{const a=t.transaction(gr,"readwrite");a.objectStore(gr).delete(e),a.oncomplete=()=>{t.close(),n()},a.onerror=()=>{t.close(),s(a.error)}})}const Et=new Map;function rk({token:e,storyName:t,authFetch:n,onSelectStory:s,onDestroySession:a,onArchiveStory:o,confirmedStories:c,renameRef:f}){const p=ie.useRef(null),h=ie.useRef(n),[g,_]=ie.useState([]),[b,y]=ie.useState(new Set),[x,E]=ie.useState(null),[L,R]=ie.useState(null),$=ie.useRef(()=>{});ie.useEffect(()=>{h.current=n},[n]);const I=ie.useCallback(T=>{var N;const{width:B}=T.container.getBoundingClientRect();if(!(B<50))try{T.fit.fit(),((N=T.ws)==null?void 0:N.readyState)===WebSocket.OPEN&&T.ws.send(JSON.stringify({type:"resize",cols:T.term.cols,rows:T.term.rows}))}catch{}},[]),Z=ie.useCallback(T=>{for(const[B,N]of Et)N.container.style.display=B===T?"block":"none";if(T){const B=Et.get(T);B&&setTimeout(()=>I(B),50)}},[I]),Y=ie.useCallback((T,B,N)=>{const A=window.location.protocol==="https:"?"wss:":"ws:",j=new WebSocket(`${A}//${window.location.host}/ws/terminal?story=${encodeURIComponent(T)}&token=${e}&resume=${N}`);j.onopen=()=>{B.connected=!0,B._retried=!1,y(P=>{const se=new Set(P);return se.delete(T),se}),j.send(JSON.stringify({type:"resize",cols:B.term.cols,rows:B.term.rows}))},j.onmessage=P=>{B.term.write(P.data)},j.onclose=P=>{if(B.connected=!1,B.ws===j){B.ws=null;try{const se=B.serialize.serialize();Zl(T,se).catch(()=>{})}catch{}if(P.code===4e3&&!B._retried){B._retried=!0,B.term.write(`\r
97
+ */var Ot=0,jt=0,Ht=0,ft=0,Gt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Hr(a)}${Hr(o)}${Hr(c)}${Hr(f)}`:`#${Hr(a)}${Hr(o)}${Hr(c)}`}e.toCss=t;function n(a,o,c,f=255){return(a<<24|o<<16|c<<8|f)>>>0}e.toRgba=n;function s(a,o,c,f){return{css:e.toCss(a,o,c,f),rgba:e.toRgba(a,o,c,f)}}e.toColor=s})(Gt||(Gt={}));var G2;(e=>{function t(p,h){if(ft=(h.rgba&255)/255,ft===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,_=h.rgba>>16&255,b=h.rgba>>8&255,y=p.rgba>>24&255,x=p.rgba>>16&255,k=p.rgba>>8&255;Ot=y+Math.round((g-y)*ft),jt=x+Math.round((_-x)*ft),Ht=k+Math.round((b-k)*ft);let L=Gt.toCss(Ot,jt,Ht),R=Gt.toRgba(Ot,jt,Ht);return{css:L,rgba:R}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=lu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return Gt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Ot,jt,Ht]=lu.toChannels(h),{css:Gt.toCss(Ot,jt,Ht),rgba:h}}e.opaque=a;function o(p,h){return ft=Math.round(h*255),[Ot,jt,Ht]=lu.toChannels(p.rgba),{css:Gt.toCss(Ot,jt,Ht,ft),rgba:Gt.toRgba(Ot,jt,Ht,ft)}}e.opacity=o;function c(p,h){return ft=p.rgba&255,o(p,ft*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(G2||(G2={}));var Yt;(e=>{let t,n;try{let a=document.createElement("canvas");a.width=1,a.height=1;let o=a.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Ot=parseInt(a.slice(1,2).repeat(2),16),jt=parseInt(a.slice(2,3).repeat(2),16),Ht=parseInt(a.slice(3,4).repeat(2),16),Gt.toColor(Ot,jt,Ht);case 5:return Ot=parseInt(a.slice(1,2).repeat(2),16),jt=parseInt(a.slice(2,3).repeat(2),16),Ht=parseInt(a.slice(3,4).repeat(2),16),ft=parseInt(a.slice(4,5).repeat(2),16),Gt.toColor(Ot,jt,Ht,ft);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let o=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return Ot=parseInt(o[1]),jt=parseInt(o[2]),Ht=parseInt(o[3]),ft=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Gt.toColor(Ot,jt,Ht,ft);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Ot,jt,Ht,ft]=t.getImageData(0,0,1,1).data,ft!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gt.toRgba(Ot,jt,Ht,ft),css:a}}e.toColor=s})(Yt||(Yt={}));var ni;(e=>{function t(s){return n(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function n(s,a,o){let c=s/255,f=a/255,p=o/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return h*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ni||(ni={}));var lu;(e=>{function t(c,f){if(ft=(f&255)/255,ft===1)return f;let p=f>>24&255,h=f>>16&255,g=f>>8&255,_=c>>24&255,b=c>>16&255,y=c>>8&255;return Ot=_+Math.round((p-_)*ft),jt=b+Math.round((h-b)*ft),Ht=y+Math.round((g-y)*ft),Gt.toRgba(Ot,jt,Ht)}e.blend=t;function n(c,f,p){let h=ni.relativeLuminance(c>>8),g=ni.relativeLuminance(f>>8);if(Bn(h,g)<p){if(g<h){let y=s(c,f,p),x=Bn(h,ni.relativeLuminance(y>>8));if(x<p){let k=a(c,f,p),L=Bn(h,ni.relativeLuminance(k>>8));return x>L?y:k}return y}let _=a(c,f,p),b=Bn(h,ni.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Bn(h,ni.relativeLuminance(y>>8));return b>x?_:y}return _}}e.ensureContrastRatio=n;function s(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,k=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));for(;k<p&&(b>0||y>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),k=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=s;function a(c,f,p){let h=c>>24&255,g=c>>16&255,_=c>>8&255,b=f>>24&255,y=f>>16&255,x=f>>8&255,k=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));for(;k<p&&(b<255||y<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),k=Bn(ni.relativeLuminance2(b,y,x),ni.relativeLuminance2(h,g,_));return(b<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function o(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=o})(lu||(lu={}));function Hr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Z2=Object.freeze((()=>{let e=[Yt.toColor("#2e3436"),Yt.toColor("#cc0000"),Yt.toColor("#4e9a06"),Yt.toColor("#c4a000"),Yt.toColor("#3465a4"),Yt.toColor("#75507b"),Yt.toColor("#06989a"),Yt.toColor("#d3d7cf"),Yt.toColor("#555753"),Yt.toColor("#ef2929"),Yt.toColor("#8ae234"),Yt.toColor("#fce94f"),Yt.toColor("#729fcf"),Yt.toColor("#ad7fa8"),Yt.toColor("#34e2e2"),Yt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let s=t[n/36%6|0],a=t[n/6%6|0],o=t[n%6];e.push({css:Gt.toCss(s,a,o),rgba:Gt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Gt.toCss(s,s,s),rgba:Gt.toRgba(s,s,s)})}return e})());function ey(e,t,n){return Math.max(t,Math.min(e,n))}function Q2(e){switch(e){case"&":return"&amp;";case"<":return"&lt;"}return e}var Yb=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),s=this._buffer.getNullCell(),a=n,o=e.start.y,c=e.end.y,f=e.start.x,p=e.end.x;this._beforeSerialize(c-o,o,c);for(let h=o;h<=c;h++){let g=this._buffer.getLine(h);if(g){let _=h===e.start.y?f:0,b=h===e.end.y?p:g.length;for(let y=_;y<b;y++){let x=g.getCell(y,a===n?s:n);if(!x){console.warn(`Can't get cell at row=${h}, col=${y}`);continue}this._nextCell(x,a,h,y),a=x}}this._rowEnd(h,h===c)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,s){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return""}};function Vb(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Nn(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Kb(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var J2=class extends Yb{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=new Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){var s;this._nullCellCount>0&&!Nn(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n="";if(!t){e-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let a=this._buffer.getLine(e),o=this._buffer.getLine(e+1);if(!o.isWrapped)n=`\r
98
+ `,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n="";let c=a.getCell(a.length-1,this._thisRowLastChar),f=a.getCell(a.length-2,this._thisRowLastSecondChar),p=o.getCell(0,this._nextRowFirstChar),h=p.getWidth()>1,g=!1;(p.getChars()&&h?this._nullCellCount<=1:this._nullCellCount<=0)&&((c.getChars()||c.getWidth()===0)&&Nn(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&Nn(c,p)&&Nn(f,p)&&(g=!0)),g||(n="-".repeat(this._nullCellCount+1),n+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(n+="\x1B[A",n+=`\x1B[${a.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${a.length-this._nullCellCount}D`,n+="\x1B[B"),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow="",this._nullCellCount=0}_diffStyle(e,t){let n=[],s=!Vb(e,t),a=!Nn(e,t),o=!Kb(e,t);if(s||a||o)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(s){let c=e.getFgColor();e.isFgRGB()?n.push(38,2,c>>>16&255,c>>>8&255,c&255):e.isFgPalette()?c>=16?n.push(38,5,c):n.push(c&8?90+(c&7):30+(c&7)):n.push(39)}if(a){let c=e.getBgColor();e.isBgRGB()?n.push(48,2,c>>>16&255,c>>>8&255,c&255):e.isBgPalette()?c>=16?n.push(48,5,c):n.push(c&8?100+(c&7):40+(c&7)):n.push(49)}o&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,this._cursorStyle);if(a?!Nn(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(Nn(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${o.join(";")}m`;let c=this._buffer.getLine(n);c!==void 0&&(c.getCell(s,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=s)}a?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(Nn(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=s+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n="";for(let o=0;o<t;o++)n+=this._allRows[o],o+1<t&&(n+=this._allRowSeparators[o]);if(!e){let o=this._buffer.baseY+this._buffer.cursorY,c=this._buffer.cursorX,f=o!==this._lastCursorRow||c!==this._lastCursorCol,p=h=>{h>0?n+=`\x1B[${h}C`:h<0&&(n+=`\x1B[${-h}D`)};f&&((h=>{h>0?n+=`\x1B[${h}B`:h<0&&(n+=`\x1B[${-h}A`)})(o-this._lastCursorRow),p(c-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,a=this._diffStyle(s,this._cursorStyle);return a.length>0&&(n+=`\x1B[${a.join(";")}m`),n}},ek=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let s=t.length,a=n===void 0?s:ey(n+e.rows,0,s);return this._serializeBufferByRange(e,t,{start:s-a,end:s-1},!1)}_serializeBufferByRange(e,t,n,s){return new J2(t,e).serialize({start:{x:0,y:typeof n.start=="number"?n.start:n.start.line},end:{x:e.cols,y:typeof n.end=="number"?n.end:n.end.line}},s)}_serializeBufferAsHTML(e,t){var f;let n=e.buffer.active,s=new tk(n,e,t),a=t.onlySelection??!1,o=t.range;if(o)return s.serialize({start:{x:o.startCol,y:(o.startLine,o.startLine)},end:{x:e.cols,y:(o.endLine,o.endLine)}});if(!a){let p=n.length,h=t.scrollback,g=h===void 0?p:ey(h+e.rows,0,p);return s.serialize({start:{x:0,y:p-g},end:{x:e.cols,y:p-1}})}let c=(f=this._terminal)==null?void 0:f.getSelectionPosition();return c!==void 0?s.serialize({start:{x:c.start.x,y:c.start.y},end:{x:c.end.x,y:c.end.y}}):""}_serializeModes(e){let t="",n=e.modes;if(n.applicationCursorKeysMode&&(t+="\x1B[?1h"),n.applicationKeypadMode&&(t+="\x1B[?66h"),n.bracketedPasteMode&&(t+="\x1B[?2004h"),n.insertMode&&(t+="\x1B[4h"),n.originMode&&(t+="\x1B[?6h"),n.reverseWraparoundMode&&(t+="\x1B[?45h"),n.sendFocusMode&&(t+="\x1B[?1004h"),n.wraparoundMode===!1&&(t+="\x1B[?7l"),n.mouseTrackingMode!=="none")switch(n.mouseTrackingMode){case"x10":t+="\x1B[?9h";break;case"vt200":t+="\x1B[?1000h";break;case"drag":t+="\x1B[?1002h";break;case"any":t+="\x1B[?1003h";break}return t}serialize(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let t=e!=null&&e.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e==null?void 0:e.scrollback);if(!(e!=null&&e.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let n=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${n}`}return e!=null&&e.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},tk=class extends Yb{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow="",this._htmlContent="",t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=Z2}_padStart(e,t,n){return t=t>>0,n=n??" ",e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){var c,f;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",a="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((c=this._terminal.options.theme)==null?void 0:c.foreground)??"#ffffff",a=((f=this._terminal.options.theme)==null?void 0:f.background)??"#000000");let o=[];o.push("color: "+s+";"),o.push("background-color: "+a+";"),o.push("font-family: "+this._terminal.options.fontFamily+";"),o.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+o.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(e,t){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return"#"+[n>>16&255,n>>8&255,n&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],s=!Vb(e,t),a=!Nn(e,t),o=!Kb(e,t);if(s||a||o){let c=this._getHexColor(e,!0);c&&n.push("color: "+c+";");let f=this._getHexColor(e,!1);return f&&n.push("background-color: "+f+";"),e.isInverse()&&n.push("color: #000000; background-color: #BFBFBF;"),e.isBold()&&n.push("font-weight: bold;"),e.isUnderline()&&e.isOverline()?n.push("text-decoration: overline underline;"):e.isUnderline()?n.push("text-decoration: underline;"):e.isOverline()&&n.push("text-decoration: overline;"),e.isBlink()&&n.push("text-decoration: blink;"),e.isInvisible()&&n.push("visibility: hidden;"),e.isItalic()&&n.push("font-style: italic;"),e.isDim()&&n.push("opacity: 0.5;"),e.isStrikethrough()&&n.push("text-decoration: line-through;"),n}}_nextCell(e,t,n,s){if(e.getWidth()===0)return;let a=e.getChars()==="",o=this._diffStyle(e,t);o&&(this._currentRow+=o.length===0?"</span><span>":"</span><span style='"+o.join(" ")+"'>"),a?this._currentRow+=" ":this._currentRow+=Q2(e.getChars())}_serializeString(){return this._htmlContent}};const ik={background:"#F0EBE1",foreground:"#2C1810",cursor:"#8B4513",cursorAccent:"#F0EBE1",selectionBackground:"#D4C5B0",selectionForeground:"#2C1810",black:"#2C1810",red:"#A63D40",green:"#4A7A4A",yellow:"#8B6914",blue:"#4A6FA5",magenta:"#7B4B8A",cyan:"#3D7A7A",white:"#E6DDD0",brightBlack:"#8B7355",brightRed:"#B85C5C",brightGreen:"#5A8A5A",brightYellow:"#A07D1C",brightBlue:"#5A82BA",brightMagenta:"#8E5D9F",brightCyan:"#5A8F8F",brightWhite:"#4A3728"},nk="plotlink-terminal",rk=1,gr="scrollback",ty=10*1024*1024;function Ld(){return new Promise((e,t)=>{const n=indexedDB.open(nk,rk);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(gr)||s.createObjectStore(gr)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function Zl(e,t){const n=t.length>ty?t.slice(-ty):t,s=await Ld();return new Promise((a,o)=>{const c=s.transaction(gr,"readwrite");c.objectStore(gr).put(n,e),c.oncomplete=()=>{s.close(),a()},c.onerror=()=>{s.close(),o(c.error)}})}async function sk(e){const t=await Ld();return new Promise((n,s)=>{const o=t.transaction(gr,"readonly").objectStore(gr).get(e);o.onsuccess=()=>{t.close(),n(o.result??null)},o.onerror=()=>{t.close(),s(o.error)}})}async function iy(e){const t=await Ld();return new Promise((n,s)=>{const a=t.transaction(gr,"readwrite");a.objectStore(gr).delete(e),a.oncomplete=()=>{t.close(),n()},a.onerror=()=>{t.close(),s(a.error)}})}const At=new Map;function lk({token:e,storyName:t,authFetch:n,onSelectStory:s,onDestroySession:a,onArchiveStory:o,confirmedStories:c,renameRef:f}){const p=Q.useRef(null),h=Q.useRef(n),[g,_]=Q.useState([]),[b,y]=Q.useState(new Set),[x,k]=Q.useState(null),[L,R]=Q.useState(null),$=Q.useRef(()=>{});Q.useEffect(()=>{h.current=n},[n]);const I=Q.useCallback(E=>{var N;const{width:B}=E.container.getBoundingClientRect();if(!(B<50))try{E.fit.fit(),((N=E.ws)==null?void 0:N.readyState)===WebSocket.OPEN&&E.ws.send(JSON.stringify({type:"resize",cols:E.term.cols,rows:E.term.rows}))}catch{}},[]),Z=Q.useCallback(E=>{for(const[B,N]of At)N.container.style.display=B===E?"block":"none";if(E){const B=At.get(E);B&&setTimeout(()=>I(B),50)}},[I]),Y=Q.useCallback((E,B,N)=>{const A=window.location.protocol==="https:"?"wss:":"ws:",j=new WebSocket(`${A}//${window.location.host}/ws/terminal?story=${encodeURIComponent(E)}&token=${e}&resume=${N}`);j.onopen=()=>{B.connected=!0,B._retried=!1,y(P=>{const oe=new Set(P);return oe.delete(E),oe}),j.send(JSON.stringify({type:"resize",cols:B.term.cols,rows:B.term.rows}))},j.onmessage=P=>{B.term.write(P.data)},j.onclose=P=>{if(B.connected=!1,B.ws===j){B.ws=null;try{const oe=B.serialize.serialize();Zl(E,oe).catch(()=>{})}catch{}if(P.code===4e3&&!B._retried){B._retried=!0,B.term.write(`\r
99
99
  \x1B[33m[Resume failed — starting fresh session...]\x1B[0m\r
100
- `),$.current(T,B,!1);return}y(se=>new Set(se).add(T))}},B.term.onData(P=>{j.readyState===WebSocket.OPEN&&j.send(P)}),B.ws=j},[e]);ie.useEffect(()=>{$.current=Y},[Y]);const O=ie.useCallback(async(T,B)=>{if(!p.current||Et.has(T))return;const{resume:N=!1,autoConnect:A=!0}=B??{},j=document.createElement("div");j.style.width="100%",j.style.height="100%",j.style.display="none",j.style.paddingLeft="10px",j.style.boxSizing="border-box",p.current.appendChild(j);const P=new W2({cols:80,scrollback:5e3,fontSize:13,fontFamily:'"Geist Mono", ui-monospace, monospace',lineHeight:1.05,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",theme:ek,allowTransparency:!1,drawBoldTextInBrightColors:!1,minimumContrastRatio:7}),se=new K2,k=new Q2;P.loadAddon(se),P.loadAddon(k),P.open(j);const D={term:P,fit:se,serialize:k,ws:null,container:j,observer:null,connected:!1},V=new ResizeObserver(()=>{var ee;const{width:C}=j.getBoundingClientRect();if(!(C<50))try{se.fit(),((ee=D.ws)==null?void 0:ee.readyState)===WebSocket.OPEN&&D.ws.send(JSON.stringify({type:"resize",cols:P.cols,rows:P.rows}))}catch{}});V.observe(j),D.observer=V,Et.set(T,D),_(C=>[...C,T]);try{const C=await nk(T);C&&P.write(C)}catch{}A?Y(T,D,N):y(C=>new Set(C).add(T)),setTimeout(()=>I(D),50)},[Y,I]),J=ie.useCallback(async(T,B)=>{const N=Et.get(T);N&&(N.ws&&(N.ws.close(),N.ws=null),B||(await h.current(`/api/terminal/${encodeURIComponent(T)}`,{method:"DELETE"}).catch(()=>{}),N.term.clear()),Y(T,N,B))},[Y]),ae=ie.useCallback(T=>{const B=Et.get(T);if(B){try{const N=B.serialize.serialize();Zl(T,N).catch(()=>{})}catch{}B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),Et.delete(T),_(N=>N.filter(A=>A!==T)),y(N=>{const A=new Set(N);return A.delete(T),A}),n(`/api/terminal/${encodeURIComponent(T)}`,{method:"DELETE"}).catch(()=>{}),a==null||a(T)}},[n,a]),de=ie.useCallback(T=>{var N;const B=Et.get(T);B&&(((N=B.ws)==null?void 0:N.readyState)===WebSocket.OPEN&&B.ws.send(`exit
101
- `),ey(T).catch(()=>{}),B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),Et.delete(T),_(A=>A.filter(j=>j!==T)),y(A=>{const j=new Set(A);return j.delete(T),j}),n(`/api/terminal/${encodeURIComponent(T)}/discard`,{method:"DELETE"}).catch(()=>{}),a==null||a(T))},[n,a]),F=ie.useCallback(async(T,B)=>{const N=Et.get(T);if(!N||Et.has(B)||!(await h.current("/api/terminal/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:T,newName:B})})).ok)return!1;Et.delete(T),Et.set(B,N);try{const j=N.serialize.serialize();await ey(T),await Zl(B,j)}catch{}return _(j=>j.map(P=>P===T?B:P)),y(j=>{if(!j.has(T))return j;const P=new Set(j);return P.delete(T),P.add(B),P}),!0},[]);ie.useEffect(()=>(f&&(f.current=F),()=>{f&&(f.current=null)}),[f,F]),ie.useEffect(()=>{t&&(Et.has(t)?Z(t):h.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(T=>T.ok?T.json():null).then(T=>{if(!Et.has(t)){const B=(T==null?void 0:T.sessionId)&&!(T!=null&&T.running);O(t,{autoConnect:!B}),Z(t)}}).catch(()=>{Et.has(t)||(O(t),Z(t))}))},[t,O,Z]),ie.useEffect(()=>{const T=setInterval(()=>{for(const[B,N]of Et)if(N.connected)try{const A=N.serialize.serialize();Zl(B,A).catch(()=>{})}catch{}},3e4);return()=>clearInterval(T)},[]),ie.useEffect(()=>()=>{for(const[T,B]of Et){try{const N=B.serialize.serialize();Zl(T,N).catch(()=>{})}catch{}B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),h.current(`/api/terminal/${encodeURIComponent(T)}`,{method:"DELETE"}).catch(()=>{})}Et.clear()},[]);const le=t?b.has(t):!1,H=g.length===0;return S.jsxs("div",{className:"h-full flex flex-col",children:[!H&&S.jsxs("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:[g.map(T=>S.jsxs("div",{onClick:()=>s==null?void 0:s(T),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${T===t?"bg-accent/10 text-accent":"text-muted hover:text-foreground"}`,children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${b.has(T)?"bg-amber-500":T===t?"bg-green-600":"bg-muted/50"}`}),S.jsx("span",{className:`truncate max-w-[120px] ${T.startsWith("_new_")?"italic":""}`,children:T.startsWith("_new_")?"Untitled":T}),S.jsx("button",{onClick:B=>{B.stopPropagation(),T.startsWith("_new_")?E(T):ae(T)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},T)),t!=null&&t.startsWith("_new_")?S.jsx("button",{onClick:()=>E(t),className:"ml-auto px-2 py-0.5 text-xs text-error hover:bg-surface rounded flex items-center gap-1 flex-shrink-0",children:"Cancel ×"}):t&&o&&(c!=null&&c.has(t))?S.jsx("button",{onClick:()=>R(t),className:"ml-auto px-2 py-0.5 text-xs text-muted hover:text-foreground hover:bg-surface rounded flex items-center gap-1 flex-shrink-0",children:"Archive"}):null]}),S.jsxs("div",{className:"relative flex-1 min-h-0",children:[S.jsx("div",{ref:p,className:"h-full"}),H&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted",children:S.jsxs("div",{className:"text-center",children:[S.jsx("p",{className:"text-lg font-serif",children:"Select a story on the left menu"}),S.jsx("p",{className:"text-sm mt-1",children:"to start an AI Writer session"})]})}),x&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3 p-6 bg-surface border border-border rounded-lg shadow-lg max-w-sm",children:[S.jsx("p",{className:"text-sm font-serif text-foreground font-medium",children:"Discard this session?"}),S.jsx("p",{className:"text-xs text-muted",children:"This session will be lost — your AI hasn't created a story structure yet."}),S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx("button",{onClick:()=>E(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:()=>{const T=x;E(null),de(T)},className:"px-4 py-1.5 bg-error text-white text-sm rounded hover:opacity-80",children:"Discard"})]})]})}),L&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3 p-6 bg-surface border border-border rounded-lg shadow-lg max-w-sm",children:[S.jsx("p",{className:"text-sm font-serif text-foreground font-medium",children:"Archive this story?"}),S.jsx("p",{className:"text-xs text-muted",children:"You can restore it later from the Archives view."}),S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx("button",{onClick:()=>R(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:async()=>{const T=L;R(null);try{(await h.current("/api/stories/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T})})).ok&&(ae(T),o==null||o(T))}catch{}},className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Archive"})]})]})}),le&&t&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3",children:[S.jsx("p",{className:"text-sm font-serif text-foreground",children:"Terminal disconnected"}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>J(t,!0),className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Resume Session"}),S.jsx("button",{onClick:()=>J(t,!1),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Start Fresh"})]}),S.jsx("p",{className:"text-xs text-muted",children:"Resume continues your previous Claude conversation"})]})})]})]})}function sk(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const lk=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ak=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ok={};function ty(e,t){return(ok.jsx?ak:lk).test(e)}const uk=/[ \t\n\f\r]/g;function ck(e){return typeof e=="object"?e.type==="text"?iy(e.value):!1:iy(e)}function iy(e){return e.replace(uk,"")===""}class Sa{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Sa.prototype.normal={};Sa.prototype.property={};Sa.prototype.space=void 0;function Vb(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Sa(n,s,t)}function cd(e){return e.toLowerCase()}class vi{constructor(t,n){this.attribute=n,this.property=t}}vi.prototype.attribute="";vi.prototype.booleanish=!1;vi.prototype.boolean=!1;vi.prototype.commaOrSpaceSeparated=!1;vi.prototype.commaSeparated=!1;vi.prototype.defined=!1;vi.prototype.mustUseProperty=!1;vi.prototype.number=!1;vi.prototype.overloadedBoolean=!1;vi.prototype.property="";vi.prototype.spaceSeparated=!1;vi.prototype.space=void 0;let hk=0;const Te=$r(),yt=$r(),hd=$r(),oe=$r(),Je=$r(),Ws=$r(),Ri=$r();function $r(){return 2**++hk}const fd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:yt,commaOrSpaceSeparated:Ri,commaSeparated:Ws,number:oe,overloadedBoolean:hd,spaceSeparated:Je},Symbol.toStringTag,{value:"Module"})),of=Object.keys(fd);class Nd extends vi{constructor(t,n,s,a){let o=-1;if(super(t,n),ny(this,"space",a),typeof s=="number")for(;++o<of.length;){const c=of[o];ny(this,of[o],(s&fd[c])===fd[c])}}}Nd.prototype.defined=!0;function ny(e,t,n){n&&(e[t]=n)}function $s(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Nd(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[cd(s)]=s,n[cd(o.attribute)]=s}return new Sa(t,n,e.space)}const Kb=$s({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:Je,ariaCurrent:null,ariaDescribedBy:Je,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:Je,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:Je,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Je,ariaLevel:oe,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:Je,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:Je,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:yt,ariaSetSize:oe,ariaSort:null,ariaValueMax:oe,ariaValueMin:oe,ariaValueNow:oe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Xb(e,t){return t in e?e[t]:t}function $b(e,t){return Xb(e,t.toLowerCase())}const fk=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ws,acceptCharset:Je,accessKey:Je,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:Je,autoFocus:Te,autoPlay:Te,blocking:Je,capture:null,charSet:null,checked:Te,cite:null,className:Je,cols:oe,colSpan:null,content:null,contentEditable:yt,controls:Te,controlsList:Je,coords:oe|Ws,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:hd,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:Je,height:oe,hidden:hd,high:oe,href:null,hrefLang:null,htmlFor:Je,httpEquiv:Je,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:Je,itemRef:Je,itemScope:Te,itemType:Je,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,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:Te,optimum:oe,pattern:null,ping:Je,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:Je,required:Te,reversed:Te,rows:oe,rowSpan:oe,sandbox:Je,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oe,step:null,style:null,tabIndex:oe,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:yt,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Je,axis:null,background:null,bgColor:null,border:oe,borderColor:null,bottomMargin:oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:$b}),dk=$s({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:Ri,accentHeight:oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oe,amplitude:oe,arabicForm:null,ascent:oe,attributeName:null,attributeType:null,azimuth:oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oe,by:null,calcMode:null,capHeight:oe,className:Je,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:oe,diffuseConstant:oe,direction:null,display:null,dur:null,divisor:oe,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:oe,enableBackground:null,end:null,event:null,exponent:oe,externalResourcesRequired:null,fill:null,fillOpacity:oe,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:Ws,g2:Ws,glyphName:Ws,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oe,horizOriginX:oe,horizOriginY:oe,id:null,ideographic:oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oe,k:oe,k1:oe,k2:oe,k3:oe,k4:oe,kernelMatrix:Ri,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oe,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:oe,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:oe,overlineThickness:oe,paintOrder:null,panose1:null,path:null,pathLength:oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Je,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ri,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ri,rev:Ri,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ri,requiredFeatures:Ri,requiredFonts:Ri,requiredFormats:Ri,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:oe,specularExponent:oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oe,strikethroughThickness:oe,string:null,stroke:null,strokeDashArray:Ri,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oe,strokeOpacity:oe,strokeWidth:null,style:null,surfaceScale:oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ri,tabIndex:oe,tableValues:null,target:null,targetX:oe,targetY:oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ri,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oe,underlineThickness:oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oe,values:null,vAlphabetic:oe,vMathematical:oe,vectorEffect:null,vHanging:oe,vIdeographic:oe,version:null,vertAdvY:oe,vertOriginX:oe,vertOriginY:oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xb}),Gb=$s({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Zb=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$b}),Qb=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),pk={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"},mk=/[A-Z]/g,ry=/-[a-z]/g,_k=/^data[-\w.:]+$/i;function gk(e,t){const n=cd(t);let s=t,a=vi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_k.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ry,yk);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ry.test(o)){let c=o.replace(mk,vk);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Nd}return new a(s,t)}function vk(e){return"-"+e.toLowerCase()}function yk(e){return e.charAt(1).toUpperCase()}const bk=Vb([Kb,fk,Gb,Zb,Qb],"html"),Ld=Vb([Kb,dk,Gb,Zb,Qb],"svg");function Sk(e){return e.join(" ").trim()}var Ps={},uf,sy;function xk(){if(sy)return uf;sy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
102
- `,h="/",g="*",_="",b="comment",y="declaration";function x(L,R){if(typeof L!="string")throw new TypeError("First argument must be a string");if(!L)return[];R=R||{};var $=1,I=1;function Z(B){var N=B.match(t);N&&($+=N.length);var A=B.lastIndexOf(p);I=~A?B.length-A:I+B.length}function Y(){var B={line:$,column:I};return function(N){return N.position=new O(B),de(),N}}function O(B){this.start=B,this.end={line:$,column:I},this.source=R.source}O.prototype.content=L;function J(B){var N=new Error(R.source+":"+$+":"+I+": "+B);if(N.reason=B,N.filename=R.source,N.line=$,N.column=I,N.source=L,!R.silent)throw N}function ae(B){var N=B.exec(L);if(N){var A=N[0];return Z(A),L=L.slice(A.length),N}}function de(){ae(n)}function F(B){var N;for(B=B||[];N=le();)N!==!1&&B.push(N);return B}function le(){var B=Y();if(!(h!=L.charAt(0)||g!=L.charAt(1))){for(var N=2;_!=L.charAt(N)&&(g!=L.charAt(N)||h!=L.charAt(N+1));)++N;if(N+=2,_===L.charAt(N-1))return J("End of comment missing");var A=L.slice(2,N-2);return I+=2,Z(A),L=L.slice(N),I+=2,B({type:b,comment:A})}}function H(){var B=Y(),N=ae(s);if(N){if(le(),!ae(a))return J("property missing ':'");var A=ae(o),j=B({type:y,property:E(N[0].replace(e,_)),value:A?E(A[0].replace(e,_)):_});return ae(c),j}}function T(){var B=[];F(B);for(var N;N=H();)N!==!1&&(B.push(N),F(B));return B}return de(),T()}function E(L){return L?L.replace(f,_):_}return uf=x,uf}var ly;function wk(){if(ly)return Ps;ly=1;var e=Ps&&Ps.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.default=n;const t=e(xk());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;f?a(h,g,p):g&&(o=o||{},o[h]=g)}),o}return Ps}var Ql={},ay;function Ck(){if(ay)return Ql;ay=1,Object.defineProperty(Ql,"__esModule",{value:!0}),Ql.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(a,f):h=h.replace(s,f),h.replace(t,c))};return Ql.camelCase=p,Ql}var Jl,oy;function kk(){if(oy)return Jl;oy=1;var e=Jl&&Jl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(wk()),n=Ck();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,p){f&&p&&(c[(0,n.camelCase)(f,o)]=p)}),c}return s.default=s,Jl=s,Jl}var Ek=kk();const Tk=gu(Ek),Jb=eS("end"),zd=eS("start");function eS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function tS(e){const t=zd(e),n=Jb(e);if(t&&n)return{start:t,end:n}}function oa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uy(e.position):"start"in e||"end"in e?uy(e):"line"in e||"column"in e?dd(e):""}function dd(e){return cy(e&&e.line)+":"+cy(e&&e.column)}function uy(e){return dd(e&&e.start)+"-"+dd(e&&e.end)}function cy(e){return e&&typeof e=="number"?e:1}class Zt extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?o.ruleId=s:(o.source=s.slice(0,p),o.ruleId=s.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=oa(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Zt.prototype.file="";Zt.prototype.name="";Zt.prototype.reason="";Zt.prototype.message="";Zt.prototype.stack="";Zt.prototype.column=void 0;Zt.prototype.line=void 0;Zt.prototype.ancestors=void 0;Zt.prototype.cause=void 0;Zt.prototype.fatal=void 0;Zt.prototype.place=void 0;Zt.prototype.ruleId=void 0;Zt.prototype.source=void 0;const Od={}.hasOwnProperty,Ak=new Map,Dk=/[A-Z]/g,Rk=new Set(["table","tbody","thead","tfoot","tr"]),Mk=new Set(["td","th"]),iS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Bk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Pk(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=Uk(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ld:bk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=nS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function nS(e,t,n){if(t.type==="element")return Nk(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Lk(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ok(e,t,n);if(t.type==="mdxjsEsm")return zk(e,t);if(t.type==="root")return jk(e,t,n);if(t.type==="text")return Hk(e,t)}function Nk(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=sS(e,t.tagName,!1),c=Ik(e,t);let f=Hd(e,t);return Rk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!ck(p):!0})),rS(e,c,o,t),jd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Lk(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}pa(e,t.position)}function zk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pa(e,t.position)}function Ok(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Ld,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:sS(e,t.name,!0),c=Fk(e,t),f=Hd(e,t);return rS(e,c,o,t),jd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function jk(e,t,n){const s={};return jd(s,Hd(e,t)),e.create(t,e.Fragment,s,n)}function Hk(e,t){return t.value}function rS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function jd(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Uk(e,t,n){return s;function s(a,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function Pk(e,t){return n;function n(s,a,o,c){const f=Array.isArray(o.children),p=zd(s);return t(a,o,c,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function Ik(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Od.call(t.properties,a)){const o=qk(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Mk.has(t.tagName)?s=f:n[c]=f}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Fk(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else pa(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else pa(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Hd(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:Ak;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const h=a.get(p)||0;c=p+"-"+h,a.set(p,h+1)}}const f=nS(e,o,c);f!==void 0&&n.push(f)}return n}function qk(e,t,n){const s=gk(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?sk(n):Sk(n)),s.property==="style"){let a=typeof n=="object"?n:Wk(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Yk(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?pk[s.property]||s.property:s.attribute,n]}}function Wk(e,t){try{return Tk(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Zt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=iS+"#cannot-parse-style-attribute",a}}function sS(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=ty(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=ty(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Od.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);pa(e)}function pa(e,t){const n=new Zt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=iS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Yk(e){const t={};let n;for(n in e)Od.call(e,n)&&(t[Vk(n)]=e[n]);return t}function Vk(e){let t=e.replace(Dk,Kk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Kk(e){return"-"+e.toLowerCase()}const cf={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"]},Xk={};function Ud(e,t){const n=Xk,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lS(e,s,a)}function lS(e,t,n){if($k(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return hy(e.children,t,n)}return Array.isArray(e)?hy(e,t,n):""}function hy(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=lS(e[a],t,n);return s.join("")}function $k(e){return!!(e&&typeof e=="object")}const fy=document.createElement("i");function Pd(e){const t="&"+e+";";fy.innerHTML=t;const n=fy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mi(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Yi(e,t){return e.length>0?(Mi(e,e.length,0,t),e):t}const dy={}.hasOwnProperty;function aS(e){const t={};let n=-1;for(;++n<e.length;)Gk(t,e[n]);return t}function Gk(e,t){let n;for(n in t){const a=(dy.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){dy.call(a,c)||(a[c]=[]);const f=o[c];Zk(a[c],Array.isArray(f)?f:f?[f]:[])}}}function Zk(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Mi(e,0,0,s)}function oS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ri=vr(/[A-Za-z]/),Gt=vr(/[\dA-Za-z]/),Qk=vr(/[#-'*+\--9=?A-Z^-~]/);function pu(e){return e!==null&&(e<32||e===127)}const pd=vr(/\d/),Jk=vr(/[\dA-Fa-f]/),eE=vr(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function Qe(e){return e!==null&&(e<0||e===32)}function Ne(e){return e===-2||e===-1||e===32}const xu=vr(new RegExp("\\p{P}|\\p{S}","u")),Kr=vr(/\s/);function vr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gs(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Gt(e.charCodeAt(n+1))&&Gt(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function He(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return Ne(p)?(e.enter(n),f(p)):t(p)}function f(p){return Ne(p)&&o++<a?(e.consume(p),f):(e.exit(n),t(p))}}const tE={tokenize:iE};function iE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),He(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return ve(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const nE={tokenize:rE},py={tokenize:sE};function rE(e){const t=this,n=[];let s=0,a,o,c;return f;function f(I){if(s<n.length){const Z=n[s];return t.containerState=Z[1],e.attempt(Z[0].continuation,p,h)(I)}return h(I)}function p(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&$();const Z=t.events.length;let Y=Z,O;for(;Y--;)if(t.events[Y][0]==="exit"&&t.events[Y][1].type==="chunkFlow"){O=t.events[Y][1].end;break}R(s);let J=Z;for(;J<t.events.length;)t.events[J][1].end={...O},J++;return Mi(t.events,Y+1,0,t.events.slice(Z)),t.events.length=J,h(I)}return f(I)}function h(I){if(s===n.length){if(!a)return b(I);if(a.currentConstruct&&a.currentConstruct.concrete)return x(I);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(py,g,_)(I)}function g(I){return a&&$(),R(s),b(I)}function _(I){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,x(I)}function b(I){return t.containerState={},e.attempt(py,y,x)(I)}function y(I){return s++,n.push([t.currentConstruct,t.containerState]),b(I)}function x(I){if(I===null){a&&$(),R(0),e.consume(I);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),E(I)}function E(I){if(I===null){L(e.exit("chunkFlow"),!0),R(0),e.consume(I);return}return ve(I)?(e.consume(I),L(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),E)}function L(I,Z){const Y=t.sliceStream(I);if(Z&&Y.push(null),I.previous=o,o&&(o.next=I),o=I,a.defineSkip(I.start),a.write(Y),t.parser.lazy[I.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<c&&(!a.events[O][1].end||a.events[O][1].end.offset>c))return;const J=t.events.length;let ae=J,de,F;for(;ae--;)if(t.events[ae][0]==="exit"&&t.events[ae][1].type==="chunkFlow"){if(de){F=t.events[ae][1].end;break}de=!0}for(R(s),O=J;O<t.events.length;)t.events[O][1].end={...F},O++;Mi(t.events,ae+1,0,t.events.slice(J)),t.events.length=O}}function R(I){let Z=n.length;for(;Z-- >I;){const Y=n[Z];t.containerState=Y[1],Y[0].exit.call(t,e)}n.length=I}function $(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function sE(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(e){if(e===null||Qe(e)||Kr(e))return 1;if(xu(e))return 2}function wu(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const md={name:"attention",resolveAll:lE,tokenize:aE};function lE(e,t){let n=-1,s,a,o,c,f,p,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const _={...e[s][1].end},b={...e[n][1].start};my(_,-p),my(b,p),c={type:p>1?"strongSequence":"emphasisSequence",start:_,end:{...e[s][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[n][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Yi(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=Yi(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Yi(h,wu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=Yi(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Yi(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Mi(e,s-1,n-s+3,h),n=s+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function aE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Vs(s);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===o)return e.consume(p),f;const h=e.exit("attentionSequence"),g=Vs(p),_=!g||g===2&&a||n.includes(p),b=!a||a===2&&g||n.includes(s);return h._open=!!(o===42?_:_&&(a||!b)),h._close=!!(o===42?b:b&&(g||!_)),t(p)}}function my(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const oE={name:"autolink",tokenize:uE};function uE(e,t,n){let s=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return ri(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||Gt(y)?(s=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),s=0,p):(y===43||y===45||y===46||Gt(y))&&s++<32?(e.consume(y),f):(s=0,h(y))}function p(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||pu(y)?n(y):(e.consume(y),p)}function h(y){return y===64?(e.consume(y),g):Qk(y)?(e.consume(y),h):n(y)}function g(y){return Gt(y)?_(y):n(y)}function _(y){return y===46?(e.consume(y),s=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Gt(y))&&s++<63){const x=y===45?b:_;return e.consume(y),x}return n(y)}}const xa={partial:!0,tokenize:cE};function cE(e,t,n){return s;function s(o){return Ne(o)?He(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||ve(o)?t(o):n(o)}}const uS={continuation:{tokenize:fE},exit:dE,name:"blockQuote",tokenize:hE};function hE(e,t,n){const s=this;return a;function a(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Ne(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function fE(e,t,n){const s=this;return a;function a(c){return Ne(c)?He(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(uS,t,n)(c)}}function dE(e){e.exit("blockQuote")}const cS={name:"characterEscape",tokenize:pE};function pE(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return eE(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const hS={name:"characterReference",tokenize:mE};function mE(e,t,n){const s=this;let a=0,o,c;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),p}function p(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Gt,g(_))}function h(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=Jk,g):(e.enter("characterReferenceValue"),o=7,c=pd,g(_))}function g(_){if(_===59&&a){const b=e.exit("characterReferenceValue");return c===Gt&&!Pd(s.sliceSerialize(b))?n(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(_)&&a++<o?(e.consume(_),g):n(_)}}const _y={partial:!0,tokenize:gE},gy={concrete:!0,name:"codeFenced",tokenize:_E};function _E(e,t,n){const s=this,a={partial:!0,tokenize:Y};let o=0,c=0,f;return p;function p(O){return h(O)}function h(O){const J=s.events[s.events.length-1];return o=J&&J[1].type==="linePrefix"?J[2].sliceSerialize(J[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===f?(c++,e.consume(O),g):c<3?n(O):(e.exit("codeFencedFenceSequence"),Ne(O)?He(e,_,"whitespace")(O):_(O))}function _(O){return O===null||ve(O)?(e.exit("codeFencedFence"),s.interrupt?t(O):e.check(_y,E,Z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||ve(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(O)):Ne(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,y,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),b)}function y(O){return O===null||ve(O)?_(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||ve(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(O)):O===96&&O===f?n(O):(e.consume(O),x)}function E(O){return e.attempt(a,Z,L)(O)}function L(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),R}function R(O){return o>0&&Ne(O)?He(e,$,"linePrefix",o+1)(O):$(O)}function $(O){return O===null||ve(O)?e.check(_y,E,Z)(O):(e.enter("codeFlowValue"),I(O))}function I(O){return O===null||ve(O)?(e.exit("codeFlowValue"),$(O)):(e.consume(O),I)}function Z(O){return e.exit("codeFenced"),t(O)}function Y(O,J,ae){let de=0;return F;function F(N){return O.enter("lineEnding"),O.consume(N),O.exit("lineEnding"),le}function le(N){return O.enter("codeFencedFence"),Ne(N)?He(O,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):H(N)}function H(N){return N===f?(O.enter("codeFencedFenceSequence"),T(N)):ae(N)}function T(N){return N===f?(de++,O.consume(N),T):de>=c?(O.exit("codeFencedFenceSequence"),Ne(N)?He(O,B,"whitespace")(N):B(N)):ae(N)}function B(N){return N===null||ve(N)?(O.exit("codeFencedFence"),J(N)):ae(N)}}}function gE(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const hf={name:"codeIndented",tokenize:yE},vE={partial:!0,tokenize:bE};function yE(e,t,n){const s=this;return a;function a(h){return e.enter("codeIndented"),He(e,o,"linePrefix",5)(h)}function o(h){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?p(h):ve(h)?e.attempt(vE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ve(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function p(h){return e.exit("codeIndented"),t(h)}}function bE(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):He(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):ve(c)?a(c):n(c)}}const SE={name:"codeText",previous:wE,resolve:xE,tokenize:CE};function xE(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function wE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CE(e,t,n){let s=0,a,o;return c;function c(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),s++,f):(e.exit("codeTextSequence"),p(_))}function p(_){return _===null?n(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),p):_===96?(o=e.enter("codeTextSequence"),a=0,g(_)):ve(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(_))}function h(_){return _===null||_===32||_===96||ve(_)?(e.exit("codeTextData"),p(_)):(e.consume(_),h)}function g(_){return _===96?(e.consume(_),a++,g):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(o.type="codeTextData",h(_))}}class kE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&ea(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ea(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ea(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ea(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ea(this.left,n.reverse())}}}function ea(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function fS(e){const t={};let n=-1,s,a,o,c,f,p,h;const g=new kE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,EE(g,n)),n=t[n],h=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(s),g.splice(a,n-a+1,f))}}return Mi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function EE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,p=[],h={};let g,_,b=-1,y=n,x=0,E=0;const L=[E];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=s.sliceStream(y),y.next||g.push(null),_&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),_=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(E=b+1,L.push(E),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):L.pop(),b=L.length;b--;){const R=f.slice(L[b],L[b+1]),$=o.pop();p.push([$,$+R.length-1]),e.splice($,2,R)}for(p.reverse(),b=-1;++b<p.length;)h[x+p[b][0]]=x+p[b][1],x+=p[b][1]-p[b][0]-1;return h}const TE={resolve:DE,tokenize:RE},AE={partial:!0,tokenize:ME};function DE(e){return fS(e),e}function RE(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):ve(f)?e.check(AE,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function ME(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),He(e,o,"linePrefix")}function o(c){if(c===null||ve(c))return n(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function dS(e,t,n,s,a,o,c,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return _;function _(R){return R===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(R),e.exit(o),b):R===null||R===32||R===41||pu(R)?n(R):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),E(R))}function b(R){return R===62?(e.enter(o),e.consume(R),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===62?(e.exit("chunkString"),e.exit(f),b(R)):R===null||R===60||ve(R)?n(R):(e.consume(R),R===92?x:y)}function x(R){return R===60||R===62||R===92?(e.consume(R),y):y(R)}function E(R){return!g&&(R===null||R===41||Qe(R))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(R)):g<h&&R===40?(e.consume(R),g++,E):R===41?(e.consume(R),g--,E):R===null||R===32||R===40||pu(R)?n(R):(e.consume(R),R===92?L:E)}function L(R){return R===40||R===41||R===92?(e.consume(R),E):E(R)}}function pS(e,t,n,s,a,o){const c=this;let f=0,p;return h;function h(y){return e.enter(s),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return f>999||y===null||y===91||y===93&&!p||y===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):ve(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||y===91||y===93||ve(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!Ne(y)),y===92?b:_)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function mS(e,t,n,s,a,o){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(s),e.enter(a),e.consume(b),e.exit(a),c=b===40?41:b,p):n(b)}function p(b){return b===c?(e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),p(c)):b===null?n(b):ve(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),He(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||ve(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?_:g)}function _(b){return b===c||b===92?(e.consume(b),g):g(b)}}function ua(e,t){let n;return s;function s(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Ne(a)?He(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const BE={name:"definition",tokenize:LE},NE={partial:!0,tokenize:zE};function LE(e,t,n){const s=this;let a;return o;function o(y){return e.enter("definition"),c(y)}function c(y){return pS.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),p):n(y)}function p(y){return Qe(y)?ua(e,h)(y):h(y)}function h(y){return dS(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(NE,_,_)(y)}function _(y){return Ne(y)?He(e,b,"whitespace")(y):b(y)}function b(y){return y===null||ve(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function zE(e,t,n){return s;function s(f){return Qe(f)?ua(e,a)(f):n(f)}function a(f){return mS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Ne(f)?He(e,c,"whitespace")(f):c(f)}function c(f){return f===null||ve(f)?t(f):n(f)}}const OE={name:"hardBreakEscape",tokenize:jE};function jE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return ve(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const HE={name:"headingAtx",resolve:UE,tokenize:PE};function UE(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Mi(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function PE(e,t,n){let s=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&s++<6?(e.consume(g),c):g===null||Qe(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||ve(g)?(e.exit("atxHeading"),t(g)):Ne(g)?He(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||Qe(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const IE=["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"],vy=["pre","script","style","textarea"],FE={concrete:!0,name:"htmlFlow",resolveTo:YE,tokenize:VE},qE={partial:!0,tokenize:XE},WE={partial:!0,tokenize:KE};function YE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function VE(e,t,n){const s=this;let a,o,c,f,p;return h;function h(C){return g(C)}function g(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),_}function _(C){return C===33?(e.consume(C),b):C===47?(e.consume(C),o=!0,E):C===63?(e.consume(C),a=3,s.interrupt?t:k):ri(C)?(e.consume(C),c=String.fromCharCode(C),L):n(C)}function b(C){return C===45?(e.consume(C),a=2,y):C===91?(e.consume(C),a=5,f=0,x):ri(C)?(e.consume(C),a=4,s.interrupt?t:k):n(C)}function y(C){return C===45?(e.consume(C),s.interrupt?t:k):n(C)}function x(C){const ee="CDATA[";return C===ee.charCodeAt(f++)?(e.consume(C),f===ee.length?s.interrupt?t:H:x):n(C)}function E(C){return ri(C)?(e.consume(C),c=String.fromCharCode(C),L):n(C)}function L(C){if(C===null||C===47||C===62||Qe(C)){const ee=C===47,pe=c.toLowerCase();return!ee&&!o&&vy.includes(pe)?(a=1,s.interrupt?t(C):H(C)):IE.includes(c.toLowerCase())?(a=6,ee?(e.consume(C),R):s.interrupt?t(C):H(C)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):o?$(C):I(C))}return C===45||Gt(C)?(e.consume(C),c+=String.fromCharCode(C),L):n(C)}function R(C){return C===62?(e.consume(C),s.interrupt?t:H):n(C)}function $(C){return Ne(C)?(e.consume(C),$):F(C)}function I(C){return C===47?(e.consume(C),F):C===58||C===95||ri(C)?(e.consume(C),Z):Ne(C)?(e.consume(C),I):F(C)}function Z(C){return C===45||C===46||C===58||C===95||Gt(C)?(e.consume(C),Z):Y(C)}function Y(C){return C===61?(e.consume(C),O):Ne(C)?(e.consume(C),Y):I(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),p=C,J):Ne(C)?(e.consume(C),O):ae(C)}function J(C){return C===p?(e.consume(C),p=null,de):C===null||ve(C)?n(C):(e.consume(C),J)}function ae(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Qe(C)?Y(C):(e.consume(C),ae)}function de(C){return C===47||C===62||Ne(C)?I(C):n(C)}function F(C){return C===62?(e.consume(C),le):n(C)}function le(C){return C===null||ve(C)?H(C):Ne(C)?(e.consume(C),le):n(C)}function H(C){return C===45&&a===2?(e.consume(C),A):C===60&&a===1?(e.consume(C),j):C===62&&a===4?(e.consume(C),D):C===63&&a===3?(e.consume(C),k):C===93&&a===5?(e.consume(C),se):ve(C)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(qE,V,T)(C)):C===null||ve(C)?(e.exit("htmlFlowData"),T(C)):(e.consume(C),H)}function T(C){return e.check(WE,B,V)(C)}function B(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),N}function N(C){return C===null||ve(C)?T(C):(e.enter("htmlFlowData"),H(C))}function A(C){return C===45?(e.consume(C),k):H(C)}function j(C){return C===47?(e.consume(C),c="",P):H(C)}function P(C){if(C===62){const ee=c.toLowerCase();return vy.includes(ee)?(e.consume(C),D):H(C)}return ri(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),P):H(C)}function se(C){return C===93?(e.consume(C),k):H(C)}function k(C){return C===62?(e.consume(C),D):C===45&&a===2?(e.consume(C),k):H(C)}function D(C){return C===null||ve(C)?(e.exit("htmlFlowData"),V(C)):(e.consume(C),D)}function V(C){return e.exit("htmlFlow"),t(C)}}function KE(e,t,n){const s=this;return a;function a(c){return ve(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function XE(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xa,t,n)}}const $E={name:"htmlText",tokenize:GE};function GE(e,t,n){const s=this;let a,o,c;return f;function f(k){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(k),p}function p(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),Y):k===63?(e.consume(k),I):ri(k)?(e.consume(k),ae):n(k)}function h(k){return k===45?(e.consume(k),g):k===91?(e.consume(k),o=0,x):ri(k)?(e.consume(k),$):n(k)}function g(k){return k===45?(e.consume(k),y):n(k)}function _(k){return k===null?n(k):k===45?(e.consume(k),b):ve(k)?(c=_,j(k)):(e.consume(k),_)}function b(k){return k===45?(e.consume(k),y):_(k)}function y(k){return k===62?A(k):k===45?b(k):_(k)}function x(k){const D="CDATA[";return k===D.charCodeAt(o++)?(e.consume(k),o===D.length?E:x):n(k)}function E(k){return k===null?n(k):k===93?(e.consume(k),L):ve(k)?(c=E,j(k)):(e.consume(k),E)}function L(k){return k===93?(e.consume(k),R):E(k)}function R(k){return k===62?A(k):k===93?(e.consume(k),R):E(k)}function $(k){return k===null||k===62?A(k):ve(k)?(c=$,j(k)):(e.consume(k),$)}function I(k){return k===null?n(k):k===63?(e.consume(k),Z):ve(k)?(c=I,j(k)):(e.consume(k),I)}function Z(k){return k===62?A(k):I(k)}function Y(k){return ri(k)?(e.consume(k),O):n(k)}function O(k){return k===45||Gt(k)?(e.consume(k),O):J(k)}function J(k){return ve(k)?(c=J,j(k)):Ne(k)?(e.consume(k),J):A(k)}function ae(k){return k===45||Gt(k)?(e.consume(k),ae):k===47||k===62||Qe(k)?de(k):n(k)}function de(k){return k===47?(e.consume(k),A):k===58||k===95||ri(k)?(e.consume(k),F):ve(k)?(c=de,j(k)):Ne(k)?(e.consume(k),de):A(k)}function F(k){return k===45||k===46||k===58||k===95||Gt(k)?(e.consume(k),F):le(k)}function le(k){return k===61?(e.consume(k),H):ve(k)?(c=le,j(k)):Ne(k)?(e.consume(k),le):de(k)}function H(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),a=k,T):ve(k)?(c=H,j(k)):Ne(k)?(e.consume(k),H):(e.consume(k),B)}function T(k){return k===a?(e.consume(k),a=void 0,N):k===null?n(k):ve(k)?(c=T,j(k)):(e.consume(k),T)}function B(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||Qe(k)?de(k):(e.consume(k),B)}function N(k){return k===47||k===62||Qe(k)?de(k):n(k)}function A(k){return k===62?(e.consume(k),e.exit("htmlTextData"),e.exit("htmlText"),t):n(k)}function j(k){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),P}function P(k){return Ne(k)?He(e,se,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):se(k)}function se(k){return e.enter("htmlTextData"),c(k)}}const Id={name:"labelEnd",resolveAll:e5,resolveTo:t5,tokenize:i5},ZE={tokenize:n5},QE={tokenize:r5},JE={tokenize:s5};function e5(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Mi(e,0,e.length,n),e}function t5(e,t){let n=e.length,s=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",p,t],["enter",h,t]],f=Yi(f,e.slice(o+1,o+s+3)),f=Yi(f,[["enter",g,t]]),f=Yi(f,wu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Yi(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=Yi(f,e.slice(c+1)),f=Yi(f,[["exit",p,t]]),Mi(e,o,e.length,f),e}function i5(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return f;function f(b){return o?o._inactive?_(b):(c=s.parser.defined.includes(Qi(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),p):n(b)}function p(b){return b===40?e.attempt(ZE,g,c?g:_)(b):b===91?e.attempt(QE,g,c?h:_)(b):c?g(b):_(b)}function h(b){return e.attempt(JE,g,_)(b)}function g(b){return t(b)}function _(b){return o._balanced=!0,n(b)}}function n5(e,t,n){return s;function s(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return Qe(_)?ua(e,o)(_):o(_)}function o(_){return _===41?g(_):dS(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return Qe(_)?ua(e,p)(_):g(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?mS(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):g(_)}function h(_){return Qe(_)?ua(e,g)(_):g(_)}function g(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):n(_)}}function r5(e,t,n){const s=this;return a;function a(f){return pS.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function s5(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const l5={name:"labelStartImage",resolveAll:Id.resolveAll,tokenize:a5};function a5(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const o5={name:"labelStartLink",resolveAll:Id.resolveAll,tokenize:u5};function u5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const ff={name:"lineEnding",tokenize:c5};function c5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,t,"linePrefix")}}const au={name:"thematicBreak",tokenize:h5};function h5(e,t,n){let s=0,a;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return a=h,f(h)}function f(h){return h===a?(e.enter("thematicBreakSequence"),p(h)):s>=3&&(h===null||ve(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),Ne(h)?He(e,f,"whitespace")(h):f(h))}}const gi={continuation:{tokenize:m5},exit:g5,name:"list",tokenize:p5},f5={partial:!0,tokenize:v5},d5={partial:!0,tokenize:_5};function p5(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(y){const x=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:pd(y)){if(s.containerState.type||(s.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(au,n,h)(y):h(y);if(!s.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(y)}return n(y)}function p(y){return pd(y)&&++c<10?(e.consume(y),p):(!s.interrupt||c<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):n(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,e.check(xa,s.interrupt?n:g,e.attempt(f5,b,_))}function g(y){return s.containerState.initialBlankLine=!0,o++,b(y)}function _(y){return Ne(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function m5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(xa,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,He(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!Ne(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(d5,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,He(e,e.attempt(gi,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _5(e,t,n){const s=this;return He(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function g5(e){e.exit(this.containerState.type)}function v5(e,t,n){const s=this;return He(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!Ne(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const yy={name:"setextUnderline",resolveTo:y5,tokenize:b5};function y5(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function b5(e,t,n){const s=this;let a;return o;function o(h){let g=s.events.length,_;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){_=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||_)?(e.enter("setextHeadingLine"),a=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Ne(h)?He(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||ve(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const S5={tokenize:x5};function x5(e){const t=this,n=e.attempt(xa,s,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(TE,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const w5={resolveAll:gS()},C5=_S("string"),k5=_S("text");function _S(e){return{resolveAll:gS(e==="text"?E5:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(g){return h(g)?o(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),p}function p(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),p)}function h(g){if(g===null)return!0;const _=a[g];let b=-1;if(_)for(;++b<_.length;){const y=_[b];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function gS(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function E5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,f=0,p;for(;o--;){const h=a[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)p=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const T5={42:gi,43:gi,45:gi,48:gi,49:gi,50:gi,51:gi,52:gi,53:gi,54:gi,55:gi,56:gi,57:gi,62:uS},A5={91:BE},D5={[-2]:hf,[-1]:hf,32:hf},R5={35:HE,42:au,45:[yy,au],60:FE,61:yy,95:au,96:gy,126:gy},M5={38:hS,92:cS},B5={[-5]:ff,[-4]:ff,[-3]:ff,33:l5,38:hS,42:md,60:[oE,$E],91:o5,92:[OE,cS],93:Id,95:md,96:SE},N5={null:[md,w5]},L5={null:[42,95]},z5={null:[]},O5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:L5,contentInitial:A5,disable:z5,document:T5,flow:R5,flowInitial:D5,insideSpan:N5,string:M5,text:B5},Symbol.toStringTag,{value:"Module"}));function j5(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const p={attempt:J(Y),check:J(O),consume:$,enter:I,exit:Z,interrupt:J(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:E,events:[],now:x,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:_};let g=t.tokenize.call(h,p);return t.resolveAll&&o.push(t),h;function _(le){return c=Yi(c,le),L(),c[c.length-1]!==null?[]:(ae(t,0),h.events=wu(o,h.events,h),h.events)}function b(le,H){return U5(y(le),H)}function y(le){return H5(c,le)}function x(){const{_bufferIndex:le,_index:H,line:T,column:B,offset:N}=s;return{_bufferIndex:le,_index:H,line:T,column:B,offset:N}}function E(le){a[le.line]=le.column,F()}function L(){let le;for(;s._index<c.length;){const H=c[s._index];if(typeof H=="string")for(le=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===le&&s._bufferIndex<H.length;)R(H.charCodeAt(s._bufferIndex));else R(H)}}function R(le){g=g(le)}function $(le){ve(le)?(s.line++,s.column=1,s.offset+=le===-3?2:1,F()):le!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=le}function I(le,H){const T=H||{};return T.type=le,T.start=x(),h.events.push(["enter",T,h]),f.push(T),T}function Z(le){const H=f.pop();return H.end=x(),h.events.push(["exit",H,h]),H}function Y(le,H){ae(le,H.from)}function O(le,H){H.restore()}function J(le,H){return T;function T(B,N,A){let j,P,se,k;return Array.isArray(B)?V(B):"tokenize"in B?V([B]):D(B);function D(he){return be;function be(Ue){const Se=Ue!==null&&he[Ue],Ht=Ue!==null&&he.null,Qt=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(Ht)?Ht:Ht?[Ht]:[]];return V(Qt)(Ue)}}function V(he){return j=he,P=0,he.length===0?A:C(he[P])}function C(he){return be;function be(Ue){return k=de(),se=he,he.partial||(h.currentConstruct=he),he.name&&h.parser.constructs.disable.null.includes(he.name)?pe():he.tokenize.call(H?Object.assign(Object.create(h),H):h,p,ee,pe)(Ue)}}function ee(he){return le(se,k),N}function pe(he){return k.restore(),++P<j.length?C(j[P]):A}}}function ae(le,H){le.resolveAll&&!o.includes(le)&&o.push(le),le.resolve&&Mi(h.events,H,h.events.length-H,le.resolve(h.events.slice(H),h)),le.resolveTo&&(h.events=le.resolveTo(h.events,h))}function de(){const le=x(),H=h.previous,T=h.currentConstruct,B=h.events.length,N=Array.from(f);return{from:B,restore:A};function A(){s=le,h.previous=H,h.currentConstruct=T,h.events.length=B,f=N,F()}}function F(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function H5(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function U5(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
100
+ `),$.current(E,B,!1);return}y(oe=>new Set(oe).add(E))}},B.term.onData(P=>{j.readyState===WebSocket.OPEN&&j.send(P)}),B.ws=j},[e]);Q.useEffect(()=>{$.current=Y},[Y]);const O=Q.useCallback(async(E,B)=>{if(!p.current||At.has(E))return;const{resume:N=!1,autoConnect:A=!0}=B??{},j=document.createElement("div");j.style.width="100%",j.style.height="100%",j.style.display="none",j.style.paddingLeft="10px",j.style.boxSizing="border-box",p.current.appendChild(j);const P=new V2({cols:80,scrollback:5e3,fontSize:13,fontFamily:'"Geist Mono", ui-monospace, monospace',lineHeight:1.05,letterSpacing:0,cursorBlink:!0,cursorStyle:"block",theme:ik,allowTransparency:!1,drawBoldTextInBrightColors:!1,minimumContrastRatio:7}),oe=new $2,T=new ek;P.loadAddon(oe),P.loadAddon(T),P.open(j);const D={term:P,fit:oe,serialize:T,ws:null,container:j,observer:null,connected:!1},V=new ResizeObserver(()=>{var ie;const{width:w}=j.getBoundingClientRect();if(!(w<50))try{oe.fit(),((ie=D.ws)==null?void 0:ie.readyState)===WebSocket.OPEN&&D.ws.send(JSON.stringify({type:"resize",cols:P.cols,rows:P.rows}))}catch{}});V.observe(j),D.observer=V,At.set(E,D),_(w=>[...w,E]);try{const w=await sk(E);w&&P.write(w)}catch{}A?Y(E,D,N):y(w=>new Set(w).add(E)),setTimeout(()=>I(D),50)},[Y,I]),J=Q.useCallback(async(E,B)=>{const N=At.get(E);N&&(N.ws&&(N.ws.close(),N.ws=null),B||(await h.current(`/api/terminal/${encodeURIComponent(E)}`,{method:"DELETE"}).catch(()=>{}),N.term.clear()),Y(E,N,B))},[Y]),ce=Q.useCallback(E=>{const B=At.get(E);if(B){try{const N=B.serialize.serialize();Zl(E,N).catch(()=>{})}catch{}B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),At.delete(E),_(N=>N.filter(A=>A!==E)),y(N=>{const A=new Set(N);return A.delete(E),A}),n(`/api/terminal/${encodeURIComponent(E)}`,{method:"DELETE"}).catch(()=>{}),a==null||a(E)}},[n,a]),pe=Q.useCallback(E=>{var N;const B=At.get(E);B&&(((N=B.ws)==null?void 0:N.readyState)===WebSocket.OPEN&&B.ws.send(`exit
101
+ `),iy(E).catch(()=>{}),B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),At.delete(E),_(A=>A.filter(j=>j!==E)),y(A=>{const j=new Set(A);return j.delete(E),j}),n(`/api/terminal/${encodeURIComponent(E)}/discard`,{method:"DELETE"}).catch(()=>{}),a==null||a(E))},[n,a]),F=Q.useCallback(async(E,B)=>{const N=At.get(E);if(!N||At.has(B)||!(await h.current("/api/terminal/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:E,newName:B})})).ok)return!1;At.delete(E),At.set(B,N);try{const j=N.serialize.serialize();await iy(E),await Zl(B,j)}catch{}return _(j=>j.map(P=>P===E?B:P)),y(j=>{if(!j.has(E))return j;const P=new Set(j);return P.delete(E),P.add(B),P}),!0},[]);Q.useEffect(()=>(f&&(f.current=F),()=>{f&&(f.current=null)}),[f,F]),Q.useEffect(()=>{t&&(At.has(t)?Z(t):h.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(E=>E.ok?E.json():null).then(E=>{if(!At.has(t)){const B=(E==null?void 0:E.sessionId)&&!(E!=null&&E.running);O(t,{autoConnect:!B}),Z(t)}}).catch(()=>{At.has(t)||(O(t),Z(t))}))},[t,O,Z]),Q.useEffect(()=>{const E=setInterval(()=>{for(const[B,N]of At)if(N.connected)try{const A=N.serialize.serialize();Zl(B,A).catch(()=>{})}catch{}},3e4);return()=>clearInterval(E)},[]),Q.useEffect(()=>()=>{for(const[E,B]of At){try{const N=B.serialize.serialize();Zl(E,N).catch(()=>{})}catch{}B.observer.disconnect(),B.ws&&B.ws.close(),B.term.dispose(),B.container.remove(),h.current(`/api/terminal/${encodeURIComponent(E)}`,{method:"DELETE"}).catch(()=>{})}At.clear()},[]);const se=t?b.has(t):!1,H=g.length===0;return S.jsxs("div",{className:"h-full flex flex-col",children:[!H&&S.jsxs("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:[g.map(E=>S.jsxs("div",{onClick:()=>s==null?void 0:s(E),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${E===t?"bg-accent/10 text-accent":"text-muted hover:text-foreground"}`,children:[S.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${b.has(E)?"bg-amber-500":E===t?"bg-green-600":"bg-muted/50"}`}),S.jsx("span",{className:`truncate max-w-[120px] ${E.startsWith("_new_")?"italic":""}`,children:E.startsWith("_new_")?"Untitled":E}),S.jsx("button",{onClick:B=>{B.stopPropagation(),E.startsWith("_new_")?k(E):ce(E)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},E)),t!=null&&t.startsWith("_new_")?S.jsx("button",{onClick:()=>k(t),className:"ml-auto px-2 py-0.5 text-xs text-error hover:bg-surface rounded flex items-center gap-1 flex-shrink-0",children:"Cancel ×"}):t&&o&&(c!=null&&c.has(t))?S.jsx("button",{onClick:()=>R(t),className:"ml-auto px-2 py-0.5 text-xs text-muted hover:text-foreground hover:bg-surface rounded flex items-center gap-1 flex-shrink-0",children:"Archive"}):null]}),S.jsxs("div",{className:"relative flex-1 min-h-0",children:[S.jsx("div",{ref:p,className:"h-full"}),H&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted",children:S.jsxs("div",{className:"text-center",children:[S.jsx("p",{className:"text-lg font-serif",children:"Select a story on the left menu"}),S.jsx("p",{className:"text-sm mt-1",children:"to start an AI Writer session"})]})}),x&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3 p-6 bg-surface border border-border rounded-lg shadow-lg max-w-sm",children:[S.jsx("p",{className:"text-sm font-serif text-foreground font-medium",children:"Discard this session?"}),S.jsx("p",{className:"text-xs text-muted",children:"This session will be lost — your AI hasn't created a story structure yet."}),S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx("button",{onClick:()=>k(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:()=>{const E=x;k(null),pe(E)},className:"px-4 py-1.5 bg-error text-white text-sm rounded hover:opacity-80",children:"Discard"})]})]})}),L&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3 p-6 bg-surface border border-border rounded-lg shadow-lg max-w-sm",children:[S.jsx("p",{className:"text-sm font-serif text-foreground font-medium",children:"Archive this story?"}),S.jsx("p",{className:"text-xs text-muted",children:"You can restore it later from the Archives view."}),S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx("button",{onClick:()=>R(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:async()=>{const E=L;R(null);try{(await h.current("/api/stories/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:E})})).ok&&(ce(E),o==null||o(E))}catch{}},className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Archive"})]})]})}),se&&t&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"rgba(240, 235, 225, 0.9)"},children:S.jsxs("div",{className:"text-center space-y-3",children:[S.jsx("p",{className:"text-sm font-serif text-foreground",children:"Terminal disconnected"}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>J(t,!0),className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim",children:"Resume Session"}),S.jsx("button",{onClick:()=>J(t,!1),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Start Fresh"})]}),S.jsx("p",{className:"text-xs text-muted",children:"Resume continues your previous Claude conversation"})]})})]})]})}function ak(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ok=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uk=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ck={};function ny(e,t){return(ck.jsx?uk:ok).test(e)}const hk=/[ \t\n\f\r]/g;function fk(e){return typeof e=="object"?e.type==="text"?ry(e.value):!1:ry(e)}function ry(e){return e.replace(hk,"")===""}class Sa{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Sa.prototype.normal={};Sa.prototype.property={};Sa.prototype.space=void 0;function Xb(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Sa(n,s,t)}function fd(e){return e.toLowerCase()}class vi{constructor(t,n){this.attribute=n,this.property=t}}vi.prototype.attribute="";vi.prototype.booleanish=!1;vi.prototype.boolean=!1;vi.prototype.commaOrSpaceSeparated=!1;vi.prototype.commaSeparated=!1;vi.prototype.defined=!1;vi.prototype.mustUseProperty=!1;vi.prototype.number=!1;vi.prototype.overloadedBoolean=!1;vi.prototype.property="";vi.prototype.spaceSeparated=!1;vi.prototype.space=void 0;let dk=0;const Ae=$r(),St=$r(),dd=$r(),ue=$r(),tt=$r(),Ws=$r(),Ri=$r();function $r(){return 2**++dk}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ae,booleanish:St,commaOrSpaceSeparated:Ri,commaSeparated:Ws,number:ue,overloadedBoolean:dd,spaceSeparated:tt},Symbol.toStringTag,{value:"Module"})),of=Object.keys(pd);class zd extends vi{constructor(t,n,s,a){let o=-1;if(super(t,n),sy(this,"space",a),typeof s=="number")for(;++o<of.length;){const c=of[o];sy(this,of[o],(s&pd[c])===pd[c])}}}zd.prototype.defined=!0;function sy(e,t,n){n&&(e[t]=n)}function $s(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new zd(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[fd(s)]=s,n[fd(o.attribute)]=s}return new Sa(t,n,e.space)}const $b=$s({properties:{ariaActiveDescendant:null,ariaAtomic:St,ariaAutoComplete:null,ariaBusy:St,ariaChecked:St,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:tt,ariaCurrent:null,ariaDescribedBy:tt,ariaDetails:null,ariaDisabled:St,ariaDropEffect:tt,ariaErrorMessage:null,ariaExpanded:St,ariaFlowTo:tt,ariaGrabbed:St,ariaHasPopup:null,ariaHidden:St,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tt,ariaLevel:ue,ariaLive:null,ariaModal:St,ariaMultiLine:St,ariaMultiSelectable:St,ariaOrientation:null,ariaOwns:tt,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:St,ariaReadOnly:St,ariaRelevant:null,ariaRequired:St,ariaRoleDescription:tt,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:St,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Gb(e,t){return t in e?e[t]:t}function Zb(e,t){return Gb(e,t.toLowerCase())}const pk=$s({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ws,acceptCharset:tt,accessKey:tt,action:null,allow:null,allowFullScreen:Ae,allowPaymentRequest:Ae,allowUserMedia:Ae,alt:null,as:null,async:Ae,autoCapitalize:null,autoComplete:tt,autoFocus:Ae,autoPlay:Ae,blocking:tt,capture:null,charSet:null,checked:Ae,cite:null,className:tt,cols:ue,colSpan:null,content:null,contentEditable:St,controls:Ae,controlsList:tt,coords:ue|Ws,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ae,defer:Ae,dir:null,dirName:null,disabled:Ae,download:dd,draggable:St,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ae,formTarget:null,headers:tt,height:ue,hidden:dd,high:ue,href:null,hrefLang:null,htmlFor:tt,httpEquiv:tt,id:null,imageSizes:null,imageSrcSet:null,inert:Ae,inputMode:null,integrity:null,is:null,isMap:Ae,itemId:null,itemProp:tt,itemRef:tt,itemScope:Ae,itemType:tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ae,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:Ae,muted:Ae,name:null,nonce:null,noModule:Ae,noValidate:Ae,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:Ae,optimum:ue,pattern:null,ping:tt,placeholder:null,playsInline:Ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ae,referrerPolicy:null,rel:tt,required:Ae,reversed:Ae,rows:ue,rowSpan:ue,sandbox:tt,scope:null,scoped:Ae,seamless:Ae,selected:Ae,shadowRootClonable:Ae,shadowRootDelegatesFocus:Ae,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:St,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:Ae,useMap:null,value:St,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tt,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ae,declare:Ae,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:Ae,noHref:Ae,noShade:Ae,noWrap:Ae,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:St,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ae,disableRemotePlayback:Ae,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:Zb}),mk=$s({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:Ri,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:Ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,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:Ws,g2:Ws,glyphName:Ws,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:Ri,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,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:ue,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:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ri,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ri,rev:Ri,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ri,requiredFeatures:Ri,requiredFonts:Ri,requiredFormats:Ri,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:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:Ri,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ri,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ri,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gb}),Qb=$s({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Jb=$s({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zb}),eS=$s({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),_k={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"},gk=/[A-Z]/g,ly=/-[a-z]/g,vk=/^data[-\w.:]+$/i;function yk(e,t){const n=fd(t);let s=t,a=vi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&vk.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(ly,Sk);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!ly.test(o)){let c=o.replace(gk,bk);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=zd}return new a(s,t)}function bk(e){return"-"+e.toLowerCase()}function Sk(e){return e.charAt(1).toUpperCase()}const xk=Xb([$b,pk,Qb,Jb,eS],"html"),Od=Xb([$b,mk,Qb,Jb,eS],"svg");function wk(e){return e.join(" ").trim()}var Ps={},uf,ay;function Ck(){if(ay)return uf;ay=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
102
+ `,h="/",g="*",_="",b="comment",y="declaration";function x(L,R){if(typeof L!="string")throw new TypeError("First argument must be a string");if(!L)return[];R=R||{};var $=1,I=1;function Z(B){var N=B.match(t);N&&($+=N.length);var A=B.lastIndexOf(p);I=~A?B.length-A:I+B.length}function Y(){var B={line:$,column:I};return function(N){return N.position=new O(B),pe(),N}}function O(B){this.start=B,this.end={line:$,column:I},this.source=R.source}O.prototype.content=L;function J(B){var N=new Error(R.source+":"+$+":"+I+": "+B);if(N.reason=B,N.filename=R.source,N.line=$,N.column=I,N.source=L,!R.silent)throw N}function ce(B){var N=B.exec(L);if(N){var A=N[0];return Z(A),L=L.slice(A.length),N}}function pe(){ce(n)}function F(B){var N;for(B=B||[];N=se();)N!==!1&&B.push(N);return B}function se(){var B=Y();if(!(h!=L.charAt(0)||g!=L.charAt(1))){for(var N=2;_!=L.charAt(N)&&(g!=L.charAt(N)||h!=L.charAt(N+1));)++N;if(N+=2,_===L.charAt(N-1))return J("End of comment missing");var A=L.slice(2,N-2);return I+=2,Z(A),L=L.slice(N),I+=2,B({type:b,comment:A})}}function H(){var B=Y(),N=ce(s);if(N){if(se(),!ce(a))return J("property missing ':'");var A=ce(o),j=B({type:y,property:k(N[0].replace(e,_)),value:A?k(A[0].replace(e,_)):_});return ce(c),j}}function E(){var B=[];F(B);for(var N;N=H();)N!==!1&&(B.push(N),F(B));return B}return pe(),E()}function k(L){return L?L.replace(f,_):_}return uf=x,uf}var oy;function kk(){if(oy)return Ps;oy=1;var e=Ps&&Ps.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.default=n;const t=e(Ck());function n(s,a){let o=null;if(!s||typeof s!="string")return o;const c=(0,t.default)(s),f=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;f?a(h,g,p):g&&(o=o||{},o[h]=g)}),o}return Ps}var Ql={},uy;function Ek(){if(uy)return Ql;uy=1,Object.defineProperty(Ql,"__esModule",{value:!0}),Ql.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(a,f):h=h.replace(s,f),h.replace(t,c))};return Ql.camelCase=p,Ql}var Jl,cy;function Tk(){if(cy)return Jl;cy=1;var e=Jl&&Jl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(kk()),n=Ek();function s(a,o){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(f,p){f&&p&&(c[(0,n.camelCase)(f,o)]=p)}),c}return s.default=s,Jl=s,Jl}var Ak=Tk();const Dk=gu(Ak),tS=iS("end"),jd=iS("start");function iS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function nS(e){const t=jd(e),n=tS(e);if(t&&n)return{start:t,end:n}}function oa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hy(e.position):"start"in e||"end"in e?hy(e):"line"in e||"column"in e?md(e):""}function md(e){return fy(e&&e.line)+":"+fy(e&&e.column)}function hy(e){return md(e&&e.start)+"-"+md(e&&e.end)}function fy(e){return e&&typeof e=="number"?e:1}class Qt extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(c=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?o.ruleId=s:(o.source=s.slice(0,p),o.ruleId=s.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=oa(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qt.prototype.file="";Qt.prototype.name="";Qt.prototype.reason="";Qt.prototype.message="";Qt.prototype.stack="";Qt.prototype.column=void 0;Qt.prototype.line=void 0;Qt.prototype.ancestors=void 0;Qt.prototype.cause=void 0;Qt.prototype.fatal=void 0;Qt.prototype.place=void 0;Qt.prototype.ruleId=void 0;Qt.prototype.source=void 0;const Hd={}.hasOwnProperty,Rk=new Map,Mk=/[A-Z]/g,Bk=new Set(["table","tbody","thead","tfoot","tr"]),Nk=new Set(["td","th"]),rS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lk(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Fk(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=Ik(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Od:xk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=sS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function sS(e,t,n){if(t.type==="element")return zk(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ok(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Hk(e,t,n);if(t.type==="mdxjsEsm")return jk(e,t);if(t.type==="root")return Uk(e,t,n);if(t.type==="text")return Pk(e,t)}function zk(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Od,e.schema=a),e.ancestors.push(t);const o=aS(e,t.tagName,!1),c=qk(e,t);let f=Pd(e,t);return Bk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!fk(p):!0})),lS(e,c,o,t),Ud(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Ok(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}pa(e,t.position)}function jk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);pa(e,t.position)}function Hk(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Od,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:aS(e,t.name,!0),c=Wk(e,t),f=Pd(e,t);return lS(e,c,o,t),Ud(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Uk(e,t,n){const s={};return Ud(s,Pd(e,t)),e.create(t,e.Fragment,s,n)}function Pk(e,t){return t.value}function lS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Ud(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Ik(e,t,n){return s;function s(a,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function Fk(e,t){return n;function n(s,a,o,c){const f=Array.isArray(o.children),p=jd(s);return t(a,o,c,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function qk(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Hd.call(t.properties,a)){const o=Yk(e,a,t.properties[a]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&Nk.has(t.tagName)?s=f:n[c]=f}}if(s){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Wk(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const o=s.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else pa(e,t.position);else{const a=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else pa(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Pd(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:Rk;for(;++s<t.children.length;){const o=t.children[s];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const h=a.get(p)||0;c=p+"-"+h,a.set(p,h+1)}}const f=sS(e,o,c);f!==void 0&&n.push(f)}return n}function Yk(e,t,n){const s=yk(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?ak(n):wk(n)),s.property==="style"){let a=typeof n=="object"?n:Vk(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Kk(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?_k[s.property]||s.property:s.attribute,n]}}function Vk(e,t){try{return Dk(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Qt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=rS+"#cannot-parse-style-attribute",a}}function aS(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,c;for(;++o<a.length;){const f=ny(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}s=c}else s=ny(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Hd.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);pa(e)}function pa(e,t){const n=new Qt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Kk(e){const t={};let n;for(n in e)Hd.call(e,n)&&(t[Xk(n)]=e[n]);return t}function Xk(e){let t=e.replace(Mk,$k);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $k(e){return"-"+e.toLowerCase()}const cf={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"]},Gk={};function Id(e,t){const n=Gk,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return oS(e,s,a)}function oS(e,t,n){if(Zk(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return dy(e.children,t,n)}return Array.isArray(e)?dy(e,t,n):""}function dy(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=oS(e[a],t,n);return s.join("")}function Zk(e){return!!(e&&typeof e=="object")}const py=document.createElement("i");function Fd(e){const t="&"+e+";";py.innerHTML=t;const n=py.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mi(e,t,n,s){const a=e.length;let o=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<s.length;)c=s.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Yi(e,t){return e.length>0?(Mi(e,e.length,0,t),e):t}const my={}.hasOwnProperty;function uS(e){const t={};let n=-1;for(;++n<e.length;)Qk(t,e[n]);return t}function Qk(e,t){let n;for(n in t){const a=(my.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){my.call(a,c)||(a[c]=[]);const f=o[c];Jk(a[c],Array.isArray(f)?f:f?[f]:[])}}}function Jk(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Mi(e,0,0,s)}function cS(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ri=vr(/[A-Za-z]/),Zt=vr(/[\dA-Za-z]/),eE=vr(/[#-'*+\--9=?A-Z^-~]/);function pu(e){return e!==null&&(e<32||e===127)}const _d=vr(/\d/),tE=vr(/[\dA-Fa-f]/),iE=vr(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function et(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const xu=vr(new RegExp("\\p{P}|\\p{S}","u")),Kr=vr(/\s/);function vr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gs(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Zt(e.charCodeAt(n+1))&&Zt(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),a=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function Ue(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return Le(p)?(e.enter(n),f(p)):t(p)}function f(p){return Le(p)&&o++<a?(e.consume(p),f):(e.exit(n),t(p))}}const nE={tokenize:rE};function rE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ue(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(f){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return ye(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const sE={tokenize:lE},_y={tokenize:aE};function lE(e){const t=this,n=[];let s=0,a,o,c;return f;function f(I){if(s<n.length){const Z=n[s];return t.containerState=Z[1],e.attempt(Z[0].continuation,p,h)(I)}return h(I)}function p(I){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&$();const Z=t.events.length;let Y=Z,O;for(;Y--;)if(t.events[Y][0]==="exit"&&t.events[Y][1].type==="chunkFlow"){O=t.events[Y][1].end;break}R(s);let J=Z;for(;J<t.events.length;)t.events[J][1].end={...O},J++;return Mi(t.events,Y+1,0,t.events.slice(Z)),t.events.length=J,h(I)}return f(I)}function h(I){if(s===n.length){if(!a)return b(I);if(a.currentConstruct&&a.currentConstruct.concrete)return x(I);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_y,g,_)(I)}function g(I){return a&&$(),R(s),b(I)}function _(I){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,x(I)}function b(I){return t.containerState={},e.attempt(_y,y,x)(I)}function y(I){return s++,n.push([t.currentConstruct,t.containerState]),b(I)}function x(I){if(I===null){a&&$(),R(0),e.consume(I);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),k(I)}function k(I){if(I===null){L(e.exit("chunkFlow"),!0),R(0),e.consume(I);return}return ye(I)?(e.consume(I),L(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),k)}function L(I,Z){const Y=t.sliceStream(I);if(Z&&Y.push(null),I.previous=o,o&&(o.next=I),o=I,a.defineSkip(I.start),a.write(Y),t.parser.lazy[I.start.line]){let O=a.events.length;for(;O--;)if(a.events[O][1].start.offset<c&&(!a.events[O][1].end||a.events[O][1].end.offset>c))return;const J=t.events.length;let ce=J,pe,F;for(;ce--;)if(t.events[ce][0]==="exit"&&t.events[ce][1].type==="chunkFlow"){if(pe){F=t.events[ce][1].end;break}pe=!0}for(R(s),O=J;O<t.events.length;)t.events[O][1].end={...F},O++;Mi(t.events,ce+1,0,t.events.slice(J)),t.events.length=O}}function R(I){let Z=n.length;for(;Z-- >I;){const Y=n[Z];t.containerState=Y[1],Y[0].exit.call(t,e)}n.length=I}function $(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function aE(e,t,n){return Ue(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vs(e){if(e===null||et(e)||Kr(e))return 1;if(xu(e))return 2}function wu(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!s.includes(o)&&(t=o(t,n),s.push(o))}return t}const gd={name:"attention",resolveAll:oE,tokenize:uE};function oE(e,t){let n=-1,s,a,o,c,f,p,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const _={...e[s][1].end},b={...e[n][1].start};gy(_,-p),gy(b,p),c={type:p>1?"strongSequence":"emphasisSequence",start:_,end:{...e[s][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[s][1].end={...c.start},e[n][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=Yi(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=Yi(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Yi(h,wu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=Yi(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Yi(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Mi(e,s-1,n-s+3,h),n=s+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Vs(s);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===o)return e.consume(p),f;const h=e.exit("attentionSequence"),g=Vs(p),_=!g||g===2&&a||n.includes(p),b=!a||a===2&&g||n.includes(s);return h._open=!!(o===42?_:_&&(a||!b)),h._close=!!(o===42?b:b&&(g||!_)),t(p)}}function gy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cE={name:"autolink",tokenize:hE};function hE(e,t,n){let s=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return ri(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||Zt(y)?(s=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),s=0,p):(y===43||y===45||y===46||Zt(y))&&s++<32?(e.consume(y),f):(s=0,h(y))}function p(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||pu(y)?n(y):(e.consume(y),p)}function h(y){return y===64?(e.consume(y),g):eE(y)?(e.consume(y),h):n(y)}function g(y){return Zt(y)?_(y):n(y)}function _(y){return y===46?(e.consume(y),s=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Zt(y))&&s++<63){const x=y===45?b:_;return e.consume(y),x}return n(y)}}const xa={partial:!0,tokenize:fE};function fE(e,t,n){return s;function s(o){return Le(o)?Ue(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||ye(o)?t(o):n(o)}}const hS={continuation:{tokenize:pE},exit:mE,name:"blockQuote",tokenize:dE};function dE(e,t,n){const s=this;return a;function a(c){if(c===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return Le(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function pE(e,t,n){const s=this;return a;function a(c){return Le(c)?Ue(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(hS,t,n)(c)}}function mE(e){e.exit("blockQuote")}const fS={name:"characterEscape",tokenize:_E};function _E(e,t,n){return s;function s(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return iE(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const dS={name:"characterReference",tokenize:gE};function gE(e,t,n){const s=this;let a=0,o,c;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),p}function p(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Zt,g(_))}function h(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=tE,g):(e.enter("characterReferenceValue"),o=7,c=_d,g(_))}function g(_){if(_===59&&a){const b=e.exit("characterReferenceValue");return c===Zt&&!Fd(s.sliceSerialize(b))?n(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(_)&&a++<o?(e.consume(_),g):n(_)}}const vy={partial:!0,tokenize:yE},yy={concrete:!0,name:"codeFenced",tokenize:vE};function vE(e,t,n){const s=this,a={partial:!0,tokenize:Y};let o=0,c=0,f;return p;function p(O){return h(O)}function h(O){const J=s.events[s.events.length-1];return o=J&&J[1].type==="linePrefix"?J[2].sliceSerialize(J[1],!0).length:0,f=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(O)}function g(O){return O===f?(c++,e.consume(O),g):c<3?n(O):(e.exit("codeFencedFenceSequence"),Le(O)?Ue(e,_,"whitespace")(O):_(O))}function _(O){return O===null||ye(O)?(e.exit("codeFencedFence"),s.interrupt?t(O):e.check(vy,k,Z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||ye(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(O)):Le(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ue(e,y,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),b)}function y(O){return O===null||ye(O)?_(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||ye(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(O)):O===96&&O===f?n(O):(e.consume(O),x)}function k(O){return e.attempt(a,Z,L)(O)}function L(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),R}function R(O){return o>0&&Le(O)?Ue(e,$,"linePrefix",o+1)(O):$(O)}function $(O){return O===null||ye(O)?e.check(vy,k,Z)(O):(e.enter("codeFlowValue"),I(O))}function I(O){return O===null||ye(O)?(e.exit("codeFlowValue"),$(O)):(e.consume(O),I)}function Z(O){return e.exit("codeFenced"),t(O)}function Y(O,J,ce){let pe=0;return F;function F(N){return O.enter("lineEnding"),O.consume(N),O.exit("lineEnding"),se}function se(N){return O.enter("codeFencedFence"),Le(N)?Ue(O,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):H(N)}function H(N){return N===f?(O.enter("codeFencedFenceSequence"),E(N)):ce(N)}function E(N){return N===f?(pe++,O.consume(N),E):pe>=c?(O.exit("codeFencedFenceSequence"),Le(N)?Ue(O,B,"whitespace")(N):B(N)):ce(N)}function B(N){return N===null||ye(N)?(O.exit("codeFencedFence"),J(N)):ce(N)}}}function yE(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const hf={name:"codeIndented",tokenize:SE},bE={partial:!0,tokenize:xE};function SE(e,t,n){const s=this;return a;function a(h){return e.enter("codeIndented"),Ue(e,o,"linePrefix",5)(h)}function o(h){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?p(h):ye(h)?e.attempt(bE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||ye(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function p(h){return e.exit("codeIndented"),t(h)}}function xE(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Ue(e,o,"linePrefix",5)(c)}function o(c){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):ye(c)?a(c):n(c)}}const wE={name:"codeText",previous:kE,resolve:CE,tokenize:EE};function CE(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function kE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function EE(e,t,n){let s=0,a,o;return c;function c(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),s++,f):(e.exit("codeTextSequence"),p(_))}function p(_){return _===null?n(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),p):_===96?(o=e.enter("codeTextSequence"),a=0,g(_)):ye(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(_))}function h(_){return _===null||_===32||_===96||ye(_)?(e.exit("codeTextData"),p(_)):(e.consume(_),h)}function g(_){return _===96?(e.consume(_),a++,g):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(o.type="codeTextData",h(_))}}class TE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&ea(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ea(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ea(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ea(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ea(this.left,n.reverse())}}}function ea(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function pS(e){const t={};let n=-1,s,a,o,c,f,p,h;const g=new TE(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,AE(g,n)),n=t[n],h=!0);else if(s[1]._container){for(o=n,a=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(s),g.splice(a,n-a+1,f))}}return Mi(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function AE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const o=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,p=[],h={};let g,_,b=-1,y=n,x=0,k=0;const L=[k];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=s.sliceStream(y),y.next||g.push(null),_&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),_=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(k=b+1,L.push(k),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):L.pop(),b=L.length;b--;){const R=f.slice(L[b],L[b+1]),$=o.pop();p.push([$,$+R.length-1]),e.splice($,2,R)}for(p.reverse(),b=-1;++b<p.length;)h[x+p[b][0]]=x+p[b][1],x+=p[b][1]-p[b][0]-1;return h}const DE={resolve:ME,tokenize:BE},RE={partial:!0,tokenize:NE};function ME(e){return pS(e),e}function BE(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):ye(f)?e.check(RE,c,o)(f):(e.consume(f),a)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function NE(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ue(e,o,"linePrefix")}function o(c){if(c===null||ye(c))return n(c);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function mS(e,t,n,s,a,o,c,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return _;function _(R){return R===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(R),e.exit(o),b):R===null||R===32||R===41||pu(R)?n(R):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(R))}function b(R){return R===62?(e.enter(o),e.consume(R),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===62?(e.exit("chunkString"),e.exit(f),b(R)):R===null||R===60||ye(R)?n(R):(e.consume(R),R===92?x:y)}function x(R){return R===60||R===62||R===92?(e.consume(R),y):y(R)}function k(R){return!g&&(R===null||R===41||et(R))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(R)):g<h&&R===40?(e.consume(R),g++,k):R===41?(e.consume(R),g--,k):R===null||R===32||R===40||pu(R)?n(R):(e.consume(R),R===92?L:k)}function L(R){return R===40||R===41||R===92?(e.consume(R),k):k(R)}}function _S(e,t,n,s,a,o){const c=this;let f=0,p;return h;function h(y){return e.enter(s),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return f>999||y===null||y===91||y===93&&!p||y===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):ye(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||y===91||y===93||ye(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!Le(y)),y===92?b:_)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function gS(e,t,n,s,a,o){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(s),e.enter(a),e.consume(b),e.exit(a),c=b===40?41:b,p):n(b)}function p(b){return b===c?(e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),p(c)):b===null?n(b):ye(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Ue(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||ye(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?_:g)}function _(b){return b===c||b===92?(e.consume(b),g):g(b)}}function ua(e,t){let n;return s;function s(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Le(a)?Ue(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const LE={name:"definition",tokenize:OE},zE={partial:!0,tokenize:jE};function OE(e,t,n){const s=this;let a;return o;function o(y){return e.enter("definition"),c(y)}function c(y){return _S.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),p):n(y)}function p(y){return et(y)?ua(e,h)(y):h(y)}function h(y){return mS(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(zE,_,_)(y)}function _(y){return Le(y)?Ue(e,b,"whitespace")(y):b(y)}function b(y){return y===null||ye(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function jE(e,t,n){return s;function s(f){return et(f)?ua(e,a)(f):n(f)}function a(f){return gS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return Le(f)?Ue(e,c,"whitespace")(f):c(f)}function c(f){return f===null||ye(f)?t(f):n(f)}}const HE={name:"hardBreakEscape",tokenize:UE};function UE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return ye(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const PE={name:"headingAtx",resolve:IE,tokenize:FE};function IE(e,t){let n=e.length-2,s=3,a,o;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},o={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Mi(e,s,n-s+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function FE(e,t,n){let s=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&s++<6?(e.consume(g),c):g===null||et(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||ye(g)?(e.exit("atxHeading"),t(g)):Le(g)?Ue(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||et(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const qE=["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"],by=["pre","script","style","textarea"],WE={concrete:!0,name:"htmlFlow",resolveTo:KE,tokenize:XE},YE={partial:!0,tokenize:GE},VE={partial:!0,tokenize:$E};function KE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function XE(e,t,n){const s=this;let a,o,c,f,p;return h;function h(w){return g(w)}function g(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),_}function _(w){return w===33?(e.consume(w),b):w===47?(e.consume(w),o=!0,k):w===63?(e.consume(w),a=3,s.interrupt?t:T):ri(w)?(e.consume(w),c=String.fromCharCode(w),L):n(w)}function b(w){return w===45?(e.consume(w),a=2,y):w===91?(e.consume(w),a=5,f=0,x):ri(w)?(e.consume(w),a=4,s.interrupt?t:T):n(w)}function y(w){return w===45?(e.consume(w),s.interrupt?t:T):n(w)}function x(w){const ie="CDATA[";return w===ie.charCodeAt(f++)?(e.consume(w),f===ie.length?s.interrupt?t:H:x):n(w)}function k(w){return ri(w)?(e.consume(w),c=String.fromCharCode(w),L):n(w)}function L(w){if(w===null||w===47||w===62||et(w)){const ie=w===47,ae=c.toLowerCase();return!ie&&!o&&by.includes(ae)?(a=1,s.interrupt?t(w):H(w)):qE.includes(c.toLowerCase())?(a=6,ie?(e.consume(w),R):s.interrupt?t(w):H(w)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(w):o?$(w):I(w))}return w===45||Zt(w)?(e.consume(w),c+=String.fromCharCode(w),L):n(w)}function R(w){return w===62?(e.consume(w),s.interrupt?t:H):n(w)}function $(w){return Le(w)?(e.consume(w),$):F(w)}function I(w){return w===47?(e.consume(w),F):w===58||w===95||ri(w)?(e.consume(w),Z):Le(w)?(e.consume(w),I):F(w)}function Z(w){return w===45||w===46||w===58||w===95||Zt(w)?(e.consume(w),Z):Y(w)}function Y(w){return w===61?(e.consume(w),O):Le(w)?(e.consume(w),Y):I(w)}function O(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),p=w,J):Le(w)?(e.consume(w),O):ce(w)}function J(w){return w===p?(e.consume(w),p=null,pe):w===null||ye(w)?n(w):(e.consume(w),J)}function ce(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||et(w)?Y(w):(e.consume(w),ce)}function pe(w){return w===47||w===62||Le(w)?I(w):n(w)}function F(w){return w===62?(e.consume(w),se):n(w)}function se(w){return w===null||ye(w)?H(w):Le(w)?(e.consume(w),se):n(w)}function H(w){return w===45&&a===2?(e.consume(w),A):w===60&&a===1?(e.consume(w),j):w===62&&a===4?(e.consume(w),D):w===63&&a===3?(e.consume(w),T):w===93&&a===5?(e.consume(w),oe):ye(w)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(YE,V,E)(w)):w===null||ye(w)?(e.exit("htmlFlowData"),E(w)):(e.consume(w),H)}function E(w){return e.check(VE,B,V)(w)}function B(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),N}function N(w){return w===null||ye(w)?E(w):(e.enter("htmlFlowData"),H(w))}function A(w){return w===45?(e.consume(w),T):H(w)}function j(w){return w===47?(e.consume(w),c="",P):H(w)}function P(w){if(w===62){const ie=c.toLowerCase();return by.includes(ie)?(e.consume(w),D):H(w)}return ri(w)&&c.length<8?(e.consume(w),c+=String.fromCharCode(w),P):H(w)}function oe(w){return w===93?(e.consume(w),T):H(w)}function T(w){return w===62?(e.consume(w),D):w===45&&a===2?(e.consume(w),T):H(w)}function D(w){return w===null||ye(w)?(e.exit("htmlFlowData"),V(w)):(e.consume(w),D)}function V(w){return e.exit("htmlFlow"),t(w)}}function $E(e,t,n){const s=this;return a;function a(c){return ye(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function GE(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xa,t,n)}}const ZE={name:"htmlText",tokenize:QE};function QE(e,t,n){const s=this;let a,o,c;return f;function f(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),p}function p(T){return T===33?(e.consume(T),h):T===47?(e.consume(T),Y):T===63?(e.consume(T),I):ri(T)?(e.consume(T),ce):n(T)}function h(T){return T===45?(e.consume(T),g):T===91?(e.consume(T),o=0,x):ri(T)?(e.consume(T),$):n(T)}function g(T){return T===45?(e.consume(T),y):n(T)}function _(T){return T===null?n(T):T===45?(e.consume(T),b):ye(T)?(c=_,j(T)):(e.consume(T),_)}function b(T){return T===45?(e.consume(T),y):_(T)}function y(T){return T===62?A(T):T===45?b(T):_(T)}function x(T){const D="CDATA[";return T===D.charCodeAt(o++)?(e.consume(T),o===D.length?k:x):n(T)}function k(T){return T===null?n(T):T===93?(e.consume(T),L):ye(T)?(c=k,j(T)):(e.consume(T),k)}function L(T){return T===93?(e.consume(T),R):k(T)}function R(T){return T===62?A(T):T===93?(e.consume(T),R):k(T)}function $(T){return T===null||T===62?A(T):ye(T)?(c=$,j(T)):(e.consume(T),$)}function I(T){return T===null?n(T):T===63?(e.consume(T),Z):ye(T)?(c=I,j(T)):(e.consume(T),I)}function Z(T){return T===62?A(T):I(T)}function Y(T){return ri(T)?(e.consume(T),O):n(T)}function O(T){return T===45||Zt(T)?(e.consume(T),O):J(T)}function J(T){return ye(T)?(c=J,j(T)):Le(T)?(e.consume(T),J):A(T)}function ce(T){return T===45||Zt(T)?(e.consume(T),ce):T===47||T===62||et(T)?pe(T):n(T)}function pe(T){return T===47?(e.consume(T),A):T===58||T===95||ri(T)?(e.consume(T),F):ye(T)?(c=pe,j(T)):Le(T)?(e.consume(T),pe):A(T)}function F(T){return T===45||T===46||T===58||T===95||Zt(T)?(e.consume(T),F):se(T)}function se(T){return T===61?(e.consume(T),H):ye(T)?(c=se,j(T)):Le(T)?(e.consume(T),se):pe(T)}function H(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),a=T,E):ye(T)?(c=H,j(T)):Le(T)?(e.consume(T),H):(e.consume(T),B)}function E(T){return T===a?(e.consume(T),a=void 0,N):T===null?n(T):ye(T)?(c=E,j(T)):(e.consume(T),E)}function B(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||et(T)?pe(T):(e.consume(T),B)}function N(T){return T===47||T===62||et(T)?pe(T):n(T)}function A(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function j(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),P}function P(T){return Le(T)?Ue(e,oe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):oe(T)}function oe(T){return e.enter("htmlTextData"),c(T)}}const qd={name:"labelEnd",resolveAll:i5,resolveTo:n5,tokenize:r5},JE={tokenize:s5},e5={tokenize:l5},t5={tokenize:a5};function i5(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&Mi(e,0,e.length,n),e}function n5(e,t){let n=e.length,s=0,a,o,c,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[o+s+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",p,t],["enter",h,t]],f=Yi(f,e.slice(o+1,o+s+3)),f=Yi(f,[["enter",g,t]]),f=Yi(f,wu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Yi(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=Yi(f,e.slice(c+1)),f=Yi(f,[["exit",p,t]]),Mi(e,o,e.length,f),e}function r5(e,t,n){const s=this;let a=s.events.length,o,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){o=s.events[a][1];break}return f;function f(b){return o?o._inactive?_(b):(c=s.parser.defined.includes(Qi(s.sliceSerialize({start:o.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),p):n(b)}function p(b){return b===40?e.attempt(JE,g,c?g:_)(b):b===91?e.attempt(e5,g,c?h:_)(b):c?g(b):_(b)}function h(b){return e.attempt(t5,g,_)(b)}function g(b){return t(b)}function _(b){return o._balanced=!0,n(b)}}function s5(e,t,n){return s;function s(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return et(_)?ua(e,o)(_):o(_)}function o(_){return _===41?g(_):mS(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return et(_)?ua(e,p)(_):g(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?gS(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):g(_)}function h(_){return et(_)?ua(e,g)(_):g(_)}function g(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):n(_)}}function l5(e,t,n){const s=this;return a;function a(f){return _S.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(Qi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function a5(e,t,n){return s;function s(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const o5={name:"labelStartImage",resolveAll:qd.resolveAll,tokenize:u5};function u5(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const c5={name:"labelStartLink",resolveAll:qd.resolveAll,tokenize:h5};function h5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const ff={name:"lineEnding",tokenize:f5};function f5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ue(e,t,"linePrefix")}}const au={name:"thematicBreak",tokenize:d5};function d5(e,t,n){let s=0,a;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return a=h,f(h)}function f(h){return h===a?(e.enter("thematicBreakSequence"),p(h)):s>=3&&(h===null||ye(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),Le(h)?Ue(e,f,"whitespace")(h):f(h))}}const gi={continuation:{tokenize:g5},exit:y5,name:"list",tokenize:_5},p5={partial:!0,tokenize:b5},m5={partial:!0,tokenize:v5};function _5(e,t,n){const s=this,a=s.events[s.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return f;function f(y){const x=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:_d(y)){if(s.containerState.type||(s.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(au,n,h)(y):h(y);if(!s.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(y)}return n(y)}function p(y){return _d(y)&&++c<10?(e.consume(y),p):(!s.interrupt||c<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):n(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,e.check(xa,s.interrupt?n:g,e.attempt(p5,b,_))}function g(y){return s.containerState.initialBlankLine=!0,o++,b(y)}function _(y){return Le(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return s.containerState.size=o+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function g5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(xa,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ue(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!Le(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(m5,t,c)(f))}function c(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ue(e,e.attempt(gi,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function v5(e,t,n){const s=this;return Ue(e,a,"listItemIndent",s.containerState.size+1);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(o):n(o)}}function y5(e){e.exit(this.containerState.type)}function b5(e,t,n){const s=this;return Ue(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const c=s.events[s.events.length-1];return!Le(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Sy={name:"setextUnderline",resolveTo:S5,tokenize:x5};function S5(e,t){let n=e.length,s,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",c,t]),e.splice(o+1,0,["exit",e[s][1],t]),e[s][1].end={...e[o][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function x5(e,t,n){const s=this;let a;return o;function o(h){let g=s.events.length,_;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){_=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||_)?(e.enter("setextHeadingLine"),a=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===a?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Le(h)?Ue(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||ye(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const w5={tokenize:C5};function C5(e){const t=this,n=e.attempt(xa,s,e.attempt(this.parser.constructs.flowInitial,a,Ue(e,e.attempt(this.parser.constructs.flow,a,e.attempt(DE,a)),"linePrefix")));return n;function s(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const k5={resolveAll:yS()},E5=vS("string"),T5=vS("text");function vS(e){return{resolveAll:yS(e==="text"?A5:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],o=n.attempt(a,c,f);return c;function c(g){return h(g)?o(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),p}function p(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),p)}function h(g){if(g===null)return!0;const _=a[g];let b=-1;if(_)for(;++b<_.length;){const y=_[b];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function yS(e){return t;function t(n,s){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,s):n}}function A5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let o=a.length,c=-1,f=0,p;for(;o--;){const h=a[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)p=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:s.start._bufferIndex+c,_index:s.start._index+o,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const D5={42:gi,43:gi,45:gi,48:gi,49:gi,50:gi,51:gi,52:gi,53:gi,54:gi,55:gi,56:gi,57:gi,62:hS},R5={91:LE},M5={[-2]:hf,[-1]:hf,32:hf},B5={35:PE,42:au,45:[Sy,au],60:WE,61:Sy,95:au,96:yy,126:yy},N5={38:dS,92:fS},L5={[-5]:ff,[-4]:ff,[-3]:ff,33:o5,38:dS,42:gd,60:[cE,ZE],91:c5,92:[HE,fS],93:qd,95:gd,96:wE},z5={null:[gd,k5]},O5={null:[42,95]},j5={null:[]},H5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:O5,contentInitial:R5,disable:j5,document:D5,flow:B5,flowInitial:M5,insideSpan:z5,string:N5,text:L5},Symbol.toStringTag,{value:"Module"}));function U5(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},o=[];let c=[],f=[];const p={attempt:J(Y),check:J(O),consume:$,enter:I,exit:Z,interrupt:J(O,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:x,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:_};let g=t.tokenize.call(h,p);return t.resolveAll&&o.push(t),h;function _(se){return c=Yi(c,se),L(),c[c.length-1]!==null?[]:(ce(t,0),h.events=wu(o,h.events,h),h.events)}function b(se,H){return I5(y(se),H)}function y(se){return P5(c,se)}function x(){const{_bufferIndex:se,_index:H,line:E,column:B,offset:N}=s;return{_bufferIndex:se,_index:H,line:E,column:B,offset:N}}function k(se){a[se.line]=se.column,F()}function L(){let se;for(;s._index<c.length;){const H=c[s._index];if(typeof H=="string")for(se=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===se&&s._bufferIndex<H.length;)R(H.charCodeAt(s._bufferIndex));else R(H)}}function R(se){g=g(se)}function $(se){ye(se)?(s.line++,s.column=1,s.offset+=se===-3?2:1,F()):se!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=se}function I(se,H){const E=H||{};return E.type=se,E.start=x(),h.events.push(["enter",E,h]),f.push(E),E}function Z(se){const H=f.pop();return H.end=x(),h.events.push(["exit",H,h]),H}function Y(se,H){ce(se,H.from)}function O(se,H){H.restore()}function J(se,H){return E;function E(B,N,A){let j,P,oe,T;return Array.isArray(B)?V(B):"tokenize"in B?V([B]):D(B);function D(le){return ge;function ge(Ee){const Se=Ee!==null&&le[Ee],Ze=Ee!==null&&le.null,Fe=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(Ze)?Ze:Ze?[Ze]:[]];return V(Fe)(Ee)}}function V(le){return j=le,P=0,le.length===0?A:w(le[P])}function w(le){return ge;function ge(Ee){return T=pe(),oe=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ae():le.tokenize.call(H?Object.assign(Object.create(h),H):h,p,ie,ae)(Ee)}}function ie(le){return se(oe,T),N}function ae(le){return T.restore(),++P<j.length?w(j[P]):A}}}function ce(se,H){se.resolveAll&&!o.includes(se)&&o.push(se),se.resolve&&Mi(h.events,H,h.events.length-H,se.resolve(h.events.slice(H),h)),se.resolveTo&&(h.events=se.resolveTo(h.events,h))}function pe(){const se=x(),H=h.previous,E=h.currentConstruct,B=h.events.length,N=Array.from(f);return{from:B,restore:A};function A(){s=se,h.previous=H,h.currentConstruct=E,h.events.length=B,f=N,F()}}function F(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function P5(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,o)];else{if(c=e.slice(n,a),s>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(s):c.shift()}o>0&&c.push(e[a].slice(0,o))}return c}function I5(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
103
103
  `;break}case-3:{c=`\r
104
- `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function P5(e){const s={constructs:aS([O5,...(e||{}).extensions||[]]),content:a(tE),defined:[],document:a(nE),flow:a(S5),lazy:{},string:a(C5),text:a(k5)};return s;function a(o){return c;function c(f){return j5(s,o,f)}}}function I5(e){for(;!fS(e););return e}const by=/[\0\t\n\r]/g;function F5(){let e=1,t="",n=!0,s;return a;function a(o,c,f){const p=[];let h,g,_,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),_=0,t="",n&&(o.charCodeAt(0)===65279&&_++,n=void 0);_<o.length;){if(by.lastIndex=_,h=by.exec(o),b=h&&h.index!==void 0?h.index:o.length,y=o.charCodeAt(b),!h){t=o.slice(_);break}if(y===10&&_===b&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),_<b&&(p.push(o.slice(_,b)),e+=b-_),y){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}_=b+1}return f&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const q5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function W5(e){return e.replace(q5,Y5)}function Y5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return oS(n.slice(o?2:1),o?16:10)}return Pd(n)||e}const vS={}.hasOwnProperty;function V5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),K5(n)(I5(P5(n).document().write(F5()(e,t,!0))))}function K5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Qr),autolinkProtocol:de,autolinkEmail:de,atxHeading:o(Gr),blockQuote:o(Ht),characterEscape:de,characterReference:de,codeFenced:o(Qt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Qt,c),codeText:o(ai,c),codeTextData:de,data:de,codeFlowValue:de,definition:o(je),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(yi),hardBreakEscape:o(Zr),hardBreakTrailing:o(Zr),htmlFlow:o(ka,c),htmlFlowData:de,htmlText:o(ka,c),htmlTextData:de,image:o(Ea),label:c,link:o(Qr),listItem:o(Zs),listItemValue:b,listOrdered:o(Jr,_),listUnordered:o(Jr),paragraph:o(Tu),reference:C,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Gr),strong:o(Au),thematicBreak:o(Du)},exit:{atxHeading:p(),atxHeadingSequence:Y,autolink:p(),autolinkEmail:Se,autolinkProtocol:Ue,blockQuote:p(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:he,characterReference:be,codeFenced:p(L),codeFencedFence:E,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:F,codeIndented:p(R),codeText:p(N),codeTextData:F,data:F,definition:p(),definitionDestinationString:Z,definitionLabelString:$,definitionTitleString:I,emphasis:p(),hardBreakEscape:p(H),hardBreakTrailing:p(H),htmlFlow:p(T),htmlFlowData:F,htmlText:p(B),htmlTextData:F,image:p(j),label:se,labelText:P,lineEnding:le,link:p(A),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ee,resourceDestinationString:k,resourceTitleString:D,resource:V,setextHeading:p(ae),setextHeadingLineSequence:J,setextHeadingText:O,strong:p(),thematicBreak:p()}};yS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(Q){let ce={type:"root",children:[]};const xe={stack:[ce],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Re=[];let qe=-1;for(;++qe<Q.length;)if(Q[qe][1].type==="listOrdered"||Q[qe][1].type==="listUnordered")if(Q[qe][0]==="enter")Re.push(qe);else{const bi=Re.pop();qe=a(Q,bi,qe)}for(qe=-1;++qe<Q.length;){const bi=t[Q[qe][0]];vS.call(bi,Q[qe][1].type)&&bi[Q[qe][1].type].call(Object.assign({sliceSerialize:Q[qe][2].sliceSerialize},xe),Q[qe][1])}if(xe.tokenStack.length>0){const bi=xe.tokenStack[xe.tokenStack.length-1];(bi[1]||Sy).call(xe,void 0,bi[0])}for(ce.position={start:fr(Q.length>0?Q[0][1].start:{line:1,column:1,offset:0}),end:fr(Q.length>0?Q[Q.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)ce=t.transforms[qe](ce)||ce;return ce}function a(Q,ce,xe){let Re=ce-1,qe=-1,bi=!1,fn,ei,xt,oi;for(;++Re<=xe;){const Ge=Q[Re];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?qe++:qe--,oi=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(fn&&!oi&&!qe&&!xt&&(xt=Re),oi=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:oi=void 0}if(!qe&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||qe===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(fn){let Hn=Re;for(ei=void 0;Hn--;){const Ki=Q[Hn];if(Ki[1].type==="lineEnding"||Ki[1].type==="lineEndingBlank"){if(Ki[0]==="exit")continue;ei&&(Q[ei][1].type="lineEndingBlank",bi=!0),Ki[1].type="lineEnding",ei=Hn}else if(!(Ki[1].type==="linePrefix"||Ki[1].type==="blockQuotePrefix"||Ki[1].type==="blockQuotePrefixWhitespace"||Ki[1].type==="blockQuoteMarker"||Ki[1].type==="listItemIndent"))break}xt&&(!ei||xt<ei)&&(fn._spread=!0),fn.end=Object.assign({},ei?Q[ei][1].start:Ge[1].end),Q.splice(ei||Re,0,["exit",fn,Ge[2]]),Re++,xe++}if(Ge[1].type==="listItemPrefix"){const Hn={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};fn=Hn,Q.splice(Re,0,["enter",Hn,Ge[2]]),Re++,xe++,xt=void 0,oi=!0}}}return Q[ce][1]._spread=bi,xe}function o(Q,ce){return xe;function xe(Re){f.call(this,Q(Re),Re),ce&&ce.call(this,Re)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(Q,ce,xe){this.stack[this.stack.length-1].children.push(Q),this.stack.push(Q),this.tokenStack.push([ce,xe||void 0]),Q.position={start:fr(ce.start),end:void 0}}function p(Q){return ce;function ce(xe){Q&&Q.call(this,xe),h.call(this,xe)}}function h(Q,ce){const xe=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==Q.type&&(ce?ce.call(this,Q,Re[0]):(Re[1]||Sy).call(this,Q,Re[0]));else throw new Error("Cannot close `"+Q.type+"` ("+oa({start:Q.start,end:Q.end})+"): it’s not open");xe.position.end=fr(Q.end)}function g(){return Ud(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function b(Q){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(Q),10),this.data.expectingFirstListItemValue=void 0}}function y(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=Q}function x(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=Q}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function L(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.value=Q.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.value=Q.replace(/(\r?\n|\r)$/g,"")}function $(Q){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ce,xe.identifier=Qi(this.sliceSerialize(Q)).toLowerCase()}function I(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.title=Q}function Z(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.url=Q}function Y(Q){const ce=this.stack[this.stack.length-1];if(!ce.depth){const xe=this.sliceSerialize(Q).length;ce.depth=xe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function J(Q){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(Q).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function de(Q){const xe=this.stack[this.stack.length-1].children;let Re=xe[xe.length-1];(!Re||Re.type!=="text")&&(Re=Jt(),Re.position={start:fr(Q.start),end:void 0},xe.push(Re)),this.stack.push(Re)}function F(Q){const ce=this.stack.pop();ce.value+=this.sliceSerialize(Q),ce.position.end=fr(Q.end)}function le(Q){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=ce.children[ce.children.length-1];xe.position.end=fr(Q.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(de.call(this,Q),F.call(this,Q))}function H(){this.data.atHardBreak=!0}function T(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.value=Q}function B(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.value=Q}function N(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.value=Q}function A(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=ce,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function j(){const Q=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";Q.type+="Reference",Q.referenceType=ce,delete Q.url,delete Q.title}else delete Q.identifier,delete Q.label;this.data.referenceType=void 0}function P(Q){const ce=this.sliceSerialize(Q),xe=this.stack[this.stack.length-2];xe.label=W5(ce),xe.identifier=Qi(ce).toLowerCase()}function se(){const Q=this.stack[this.stack.length-1],ce=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const Re=Q.children;xe.children=Re}else xe.alt=ce}function k(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.url=Q}function D(){const Q=this.resume(),ce=this.stack[this.stack.length-1];ce.title=Q}function V(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function ee(Q){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ce,xe.identifier=Qi(this.sliceSerialize(Q)).toLowerCase(),this.data.referenceType="full"}function pe(Q){this.data.characterReferenceType=Q.type}function he(Q){const ce=this.sliceSerialize(Q),xe=this.data.characterReferenceType;let Re;xe?(Re=oS(ce,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Pd(ce);const qe=this.stack[this.stack.length-1];qe.value+=Re}function be(Q){const ce=this.stack.pop();ce.position.end=fr(Q.end)}function Ue(Q){F.call(this,Q);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(Q)}function Se(Q){F.call(this,Q);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(Q)}function Ht(){return{type:"blockquote",children:[]}}function Qt(){return{type:"code",lang:null,meta:null,value:""}}function ai(){return{type:"inlineCode",value:""}}function je(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function yi(){return{type:"emphasis",children:[]}}function Gr(){return{type:"heading",depth:0,children:[]}}function Zr(){return{type:"break"}}function ka(){return{type:"html",value:""}}function Ea(){return{type:"image",title:null,url:"",alt:null}}function Qr(){return{type:"link",title:null,url:"",children:[]}}function Jr(Q){return{type:"list",ordered:Q.type==="listOrdered",start:null,spread:Q._spread,children:[]}}function Zs(Q){return{type:"listItem",spread:Q._spread,checked:null,children:[]}}function Tu(){return{type:"paragraph",children:[]}}function Au(){return{type:"strong",children:[]}}function Jt(){return{type:"text",value:""}}function Du(){return{type:"thematicBreak"}}}function fr(e){return{line:e.line,column:e.column,offset:e.offset}}function yS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?yS(e,s):X5(e,s)}}function X5(e,t){let n;for(n in t)if(vS.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Sy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+oa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is still open")}function $5(e){const t=this;t.parser=n;function n(s){return V5(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G5(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Z5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
105
- `}]}function Q5(e,t){const n=t.value?t.value+`
106
- `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function J5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Gs(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,h),e.applyData(t,h)}function iT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function bS(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function rT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return bS(e,t);const a={src:Gs(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function sT(e,t){const n={src:Gs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function lT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function aT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return bS(e,t);const a={href:Gs(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function oT(e,t){const n={href:Gs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function uT(e,t,n){const s=e.all(t),a=n?cT(n):SS(t),o={},c=[];if(typeof t.checked=="boolean"){const g=s[0];let _;g&&g.type==="element"&&g.tagName==="p"?_=g:(_={type:"element",tagName:"p",properties:{},children:[]},s.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
104
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(o)}a=o===-2,s.push(c)}return s.join("")}function F5(e){const s={constructs:uS([H5,...(e||{}).extensions||[]]),content:a(nE),defined:[],document:a(sE),flow:a(w5),lazy:{},string:a(E5),text:a(T5)};return s;function a(o){return c;function c(f){return U5(s,o,f)}}}function q5(e){for(;!pS(e););return e}const xy=/[\0\t\n\r]/g;function W5(){let e=1,t="",n=!0,s;return a;function a(o,c,f){const p=[];let h,g,_,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),_=0,t="",n&&(o.charCodeAt(0)===65279&&_++,n=void 0);_<o.length;){if(xy.lastIndex=_,h=xy.exec(o),b=h&&h.index!==void 0?h.index:o.length,y=o.charCodeAt(b),!h){t=o.slice(_);break}if(y===10&&_===b&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),_<b&&(p.push(o.slice(_,b)),e+=b-_),y){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}_=b+1}return f&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const Y5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function V5(e){return e.replace(Y5,K5)}function K5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return cS(n.slice(o?2:1),o?16:10)}return Fd(n)||e}const bS={}.hasOwnProperty;function X5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),$5(n)(q5(F5(n).document().write(W5()(e,t,!0))))}function $5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Qr),autolinkProtocol:pe,autolinkEmail:pe,atxHeading:o(Gr),blockQuote:o(Ze),characterEscape:pe,characterReference:pe,codeFenced:o(Fe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Fe,c),codeText:o(ai,c),codeTextData:pe,data:pe,codeFlowValue:pe,definition:o(He),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(yi),hardBreakEscape:o(Zr),hardBreakTrailing:o(Zr),htmlFlow:o(ka,c),htmlFlowData:pe,htmlText:o(ka,c),htmlTextData:pe,image:o(Ea),label:c,link:o(Qr),listItem:o(Zs),listItemValue:b,listOrdered:o(Jr,_),listUnordered:o(Jr),paragraph:o(Tu),reference:w,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Gr),strong:o(Au),thematicBreak:o(Du)},exit:{atxHeading:p(),atxHeadingSequence:Y,autolink:p(),autolinkEmail:Se,autolinkProtocol:Ee,blockQuote:p(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:le,characterReference:ge,codeFenced:p(L),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:F,codeIndented:p(R),codeText:p(N),codeTextData:F,data:F,definition:p(),definitionDestinationString:Z,definitionLabelString:$,definitionTitleString:I,emphasis:p(),hardBreakEscape:p(H),hardBreakTrailing:p(H),htmlFlow:p(E),htmlFlowData:F,htmlText:p(B),htmlTextData:F,image:p(j),label:oe,labelText:P,lineEnding:se,link:p(A),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ie,resourceDestinationString:T,resourceTitleString:D,resource:V,setextHeading:p(ce),setextHeadingLineSequence:J,setextHeadingText:O,strong:p(),thematicBreak:p()}};SS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ee){let fe={type:"root",children:[]};const xe={stack:[fe],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Me=[];let We=-1;for(;++We<ee.length;)if(ee[We][1].type==="listOrdered"||ee[We][1].type==="listUnordered")if(ee[We][0]==="enter")Me.push(We);else{const bi=Me.pop();We=a(ee,bi,We)}for(We=-1;++We<ee.length;){const bi=t[ee[We][0]];bS.call(bi,ee[We][1].type)&&bi[ee[We][1].type].call(Object.assign({sliceSerialize:ee[We][2].sliceSerialize},xe),ee[We][1])}if(xe.tokenStack.length>0){const bi=xe.tokenStack[xe.tokenStack.length-1];(bi[1]||wy).call(xe,void 0,bi[0])}for(fe.position={start:fr(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:fr(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)fe=t.transforms[We](fe)||fe;return fe}function a(ee,fe,xe){let Me=fe-1,We=-1,bi=!1,fn,ei,Ct,oi;for(;++Me<=xe;){const Qe=ee[Me];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?We++:We--,oi=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(fn&&!oi&&!We&&!Ct&&(Ct=Me),oi=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:oi=void 0}if(!We&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||We===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(fn){let Hn=Me;for(ei=void 0;Hn--;){const Ki=ee[Hn];if(Ki[1].type==="lineEnding"||Ki[1].type==="lineEndingBlank"){if(Ki[0]==="exit")continue;ei&&(ee[ei][1].type="lineEndingBlank",bi=!0),Ki[1].type="lineEnding",ei=Hn}else if(!(Ki[1].type==="linePrefix"||Ki[1].type==="blockQuotePrefix"||Ki[1].type==="blockQuotePrefixWhitespace"||Ki[1].type==="blockQuoteMarker"||Ki[1].type==="listItemIndent"))break}Ct&&(!ei||Ct<ei)&&(fn._spread=!0),fn.end=Object.assign({},ei?ee[ei][1].start:Qe[1].end),ee.splice(ei||Me,0,["exit",fn,Qe[2]]),Me++,xe++}if(Qe[1].type==="listItemPrefix"){const Hn={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};fn=Hn,ee.splice(Me,0,["enter",Hn,Qe[2]]),Me++,xe++,Ct=void 0,oi=!0}}}return ee[fe][1]._spread=bi,xe}function o(ee,fe){return xe;function xe(Me){f.call(this,ee(Me),Me),fe&&fe.call(this,Me)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ee,fe,xe){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([fe,xe||void 0]),ee.position={start:fr(fe.start),end:void 0}}function p(ee){return fe;function fe(xe){ee&&ee.call(this,xe),h.call(this,xe)}}function h(ee,fe){const xe=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==ee.type&&(fe?fe.call(this,ee,Me[0]):(Me[1]||wy).call(this,ee,Me[0]));else throw new Error("Cannot close `"+ee.type+"` ("+oa({start:ee.start,end:ee.end})+"): it’s not open");xe.position.end=fr(ee.end)}function g(){return Id(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function b(ee){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=ee}function x(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=ee}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function L(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ee.replace(/(\r?\n|\r)$/g,"")}function $(ee){const fe=this.resume(),xe=this.stack[this.stack.length-1];xe.label=fe,xe.identifier=Qi(this.sliceSerialize(ee)).toLowerCase()}function I(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ee}function Z(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ee}function Y(ee){const fe=this.stack[this.stack.length-1];if(!fe.depth){const xe=this.sliceSerialize(ee).length;fe.depth=xe}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function J(ee){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function ce(){this.data.setextHeadingSlurpLineEnding=void 0}function pe(ee){const xe=this.stack[this.stack.length-1].children;let Me=xe[xe.length-1];(!Me||Me.type!=="text")&&(Me=Jt(),Me.position={start:fr(ee.start),end:void 0},xe.push(Me)),this.stack.push(Me)}function F(ee){const fe=this.stack.pop();fe.value+=this.sliceSerialize(ee),fe.position.end=fr(ee.end)}function se(ee){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=fe.children[fe.children.length-1];xe.position.end=fr(ee.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(fe.type)&&(pe.call(this,ee),F.call(this,ee))}function H(){this.data.atHardBreak=!0}function E(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ee}function B(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ee}function N(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ee}function A(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=fe,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function j(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=fe,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function P(ee){const fe=this.sliceSerialize(ee),xe=this.stack[this.stack.length-2];xe.label=V5(fe),xe.identifier=Qi(fe).toLowerCase()}function oe(){const ee=this.stack[this.stack.length-1],fe=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const Me=ee.children;xe.children=Me}else xe.alt=fe}function T(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ee}function D(){const ee=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ee}function V(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function ie(ee){const fe=this.resume(),xe=this.stack[this.stack.length-1];xe.label=fe,xe.identifier=Qi(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function ae(ee){this.data.characterReferenceType=ee.type}function le(ee){const fe=this.sliceSerialize(ee),xe=this.data.characterReferenceType;let Me;xe?(Me=cS(fe,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=Fd(fe);const We=this.stack[this.stack.length-1];We.value+=Me}function ge(ee){const fe=this.stack.pop();fe.position.end=fr(ee.end)}function Ee(ee){F.call(this,ee);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(ee)}function Se(ee){F.call(this,ee);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(ee)}function Ze(){return{type:"blockquote",children:[]}}function Fe(){return{type:"code",lang:null,meta:null,value:""}}function ai(){return{type:"inlineCode",value:""}}function He(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function yi(){return{type:"emphasis",children:[]}}function Gr(){return{type:"heading",depth:0,children:[]}}function Zr(){return{type:"break"}}function ka(){return{type:"html",value:""}}function Ea(){return{type:"image",title:null,url:"",alt:null}}function Qr(){return{type:"link",title:null,url:"",children:[]}}function Jr(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function Zs(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function Tu(){return{type:"paragraph",children:[]}}function Au(){return{type:"strong",children:[]}}function Jt(){return{type:"text",value:""}}function Du(){return{type:"thematicBreak"}}}function fr(e){return{line:e.line,column:e.column,offset:e.offset}}function SS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?SS(e,s):G5(e,s)}}function G5(e,t){let n;for(n in t)if(bS.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function wy(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+oa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is still open")}function Z5(e){const t=this;t.parser=n;function n(s){return X5(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Q5(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function J5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
105
+ `}]}function eT(e,t){const n=t.value?t.value+`
106
+ `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function tT(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Gs(s.toLowerCase()),o=e.footnoteOrder.indexOf(s);let c,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(s,f);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,h),e.applyData(t,h)}function rT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function xS(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),o=a[0];o&&o.type==="text"?o.value="["+o.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function lT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return xS(e,t);const a={src:Gs(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,o),e.applyData(t,o)}function aT(e,t){const n={src:Gs(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function oT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function uT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return xS(e,t);const a={href:Gs(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const o={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function cT(e,t){const n={href:Gs(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function hT(e,t,n){const s=e.all(t),a=n?fT(n):wS(t),o={},c=[];if(typeof t.checked=="boolean"){const g=s[0];let _;g&&g.type==="element"&&g.tagName==="p"?_=g:(_={type:"element",tagName:"p",properties:{},children:[]},s.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
107
107
  `}),g.type==="element"&&g.tagName==="p"&&!a?c.push(...g.children):c.push(g)}const p=s[s.length-1];p&&(a||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
108
- `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function cT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=SS(n[s])}return t}function SS(e){const t=e.spread;return t??e.children.length>1}function hT(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function fT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mT(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=zd(t.children[1]),p=Jb(t.children[t.children.length-1]);f&&p&&(c.position={start:f,end:p}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function _T(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let p=-1;const h=[];for(;++p<f;){const _=t.children[p],b={},y=c?c[p]:void 0;y&&(b.align=y);let x={type:"element",tagName:o,properties:b,children:[]};_&&(x.children=e.all(_),e.patch(_,x),x=e.applyData(_,x)),h.push(x)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function gT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const xy=9,wy=32;function vT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(Cy(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(Cy(t.slice(a),a>0,!1)),o.join("")}function Cy(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===xy||o===wy;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===xy||o===wy;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function yT(e,t){const n={type:"text",value:vT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const ST={blockquote:G5,break:Z5,code:Q5,delete:J5,emphasis:eT,footnoteReference:tT,heading:iT,html:nT,imageReference:rT,image:sT,inlineCode:lT,linkReference:aT,link:oT,listItem:uT,list:hT,paragraph:fT,root:dT,strong:pT,table:mT,tableCell:gT,tableRow:_T,text:yT,thematicBreak:bT,toml:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const xS=-1,Cu=0,ca=1,mu=2,Fd=3,qd=4,Wd=5,Yd=6,wS=7,CS=8,ky=typeof self=="object"?self:globalThis,xT=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Cu:case xS:return n(c,a);case ca:{const f=n([],a);for(const p of c)f.push(s(p));return f}case mu:{const f=n({},a);for(const[p,h]of c)f[s(p)]=s(h);return f}case Fd:return n(new Date(c),a);case qd:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case Wd:{const f=n(new Map,a);for(const[p,h]of c)f.set(s(p),s(h));return f}case Yd:{const f=n(new Set,a);for(const p of c)f.add(s(p));return f}case wS:{const{name:f,message:p}=c;return n(new ky[f](p),a)}case CS:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new ky[o](c),a)};return s},Ey=e=>xT(new Map,e)(0),Is="",{toString:wT}={},{keys:CT}=Object,ta=e=>{const t=typeof e;if(t!=="object"||!e)return[Cu,t];const n=wT.call(e).slice(8,-1);switch(n){case"Array":return[ca,Is];case"Object":return[mu,Is];case"Date":return[Fd,Is];case"RegExp":return[qd,Is];case"Map":return[Wd,Is];case"Set":return[Yd,Is];case"DataView":return[ca,n]}return n.includes("Array")?[ca,n]:n.includes("Error")?[wS,n]:[mu,n]},Zo=([e,t])=>e===Cu&&(t==="function"||t==="symbol"),kT=(e,t,n,s)=>{const a=(c,f)=>{const p=s.push(c)-1;return n.set(f,p),p},o=c=>{if(n.has(c))return n.get(c);let[f,p]=ta(c);switch(f){case Cu:{let g=c;switch(p){case"bigint":f=CS,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return a([xS],c)}return a([f,g],c)}case ca:{if(p){let b=c;return p==="DataView"?b=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(c)),a([p,[...b]],c)}const g=[],_=a([f,g],c);for(const b of c)g.push(o(b));return _}case mu:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const g=[],_=a([f,g],c);for(const b of CT(c))(e||!Zo(ta(c[b])))&&g.push([o(b),o(c[b])]);return _}case Fd:return a([f,c.toISOString()],c);case qd:{const{source:g,flags:_}=c;return a([f,{source:g,flags:_}],c)}case Wd:{const g=[],_=a([f,g],c);for(const[b,y]of c)(e||!(Zo(ta(b))||Zo(ta(y))))&&g.push([o(b),o(y)]);return _}case Yd:{const g=[],_=a([f,g],c);for(const b of c)(e||!Zo(ta(b)))&&g.push(o(b));return _}}const{message:h}=c;return a([f,{name:p,message:h}],c)};return o},Ty=(e,{json:t,lossy:n}={})=>{const s=[];return kT(!(t||n),!!t,new Map,s)(e),s},ma=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ey(Ty(e,t)):structuredClone(e):(e,t)=>Ey(Ty(e,t));function ET(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function TT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ET,s=e.options.footnoteBackLabel||TT,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),_=String(h.identifier).toUpperCase(),b=Gs(_.toLowerCase());let y=0;const x=[],E=e.footnoteCounts.get(_);for(;E!==void 0&&++y<=E;){x.length>0&&x.push({type:"text",value:" "});let $=typeof n=="string"?n:n(p,y);typeof $=="string"&&($={type:"text",value:$}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,y),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const L=g[g.length-1];if(L&&L.type==="element"&&L.tagName==="p"){const $=L.children[L.children.length-1];$&&$.type==="text"?$.value+=" ":L.children.push({type:"text",value:" "}),L.children.push(...x)}else g.push(...x);const R={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,R),f.push(R)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ma(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
108
+ `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function fT(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=wS(n[s])}return t}function wS(e){const t=e.spread;return t??e.children.length>1}function dT(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function pT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _T(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gT(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=jd(t.children[1]),p=tS(t.children[t.children.length-1]);f&&p&&(c.position={start:f,end:p}),a.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function vT(e,t,n){const s=n?n.children:void 0,o=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let p=-1;const h=[];for(;++p<f;){const _=t.children[p],b={},y=c?c[p]:void 0;y&&(b.align=y);let x={type:"element",tagName:o,properties:b,children:[]};_&&(x.children=e.all(_),e.patch(_,x),x=e.applyData(_,x)),h.push(x)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function yT(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Cy=9,ky=32;function bT(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const o=[];for(;s;)o.push(Ey(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(Ey(t.slice(a),a>0,!1)),o.join("")}function Ey(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===Cy||o===ky;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===Cy||o===ky;)a--,o=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function ST(e,t){const n={type:"text",value:bT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function xT(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wT={blockquote:Q5,break:J5,code:eT,delete:tT,emphasis:iT,footnoteReference:nT,heading:rT,html:sT,imageReference:lT,image:aT,inlineCode:oT,linkReference:uT,link:cT,listItem:hT,list:dT,paragraph:pT,root:mT,strong:_T,table:gT,tableCell:yT,tableRow:vT,text:ST,thematicBreak:xT,toml:Go,yaml:Go,definition:Go,footnoteDefinition:Go};function Go(){}const CS=-1,Cu=0,ca=1,mu=2,Wd=3,Yd=4,Vd=5,Kd=6,kS=7,ES=8,Ty=typeof self=="object"?self:globalThis,CT=(e,t)=>{const n=(a,o)=>(e.set(o,a),a),s=a=>{if(e.has(a))return e.get(a);const[o,c]=t[a];switch(o){case Cu:case CS:return n(c,a);case ca:{const f=n([],a);for(const p of c)f.push(s(p));return f}case mu:{const f=n({},a);for(const[p,h]of c)f[s(p)]=s(h);return f}case Wd:return n(new Date(c),a);case Yd:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case Vd:{const f=n(new Map,a);for(const[p,h]of c)f.set(s(p),s(h));return f}case Kd:{const f=n(new Set,a);for(const p of c)f.add(s(p));return f}case kS:{const{name:f,message:p}=c;return n(new Ty[f](p),a)}case ES:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new Ty[o](c),a)};return s},Ay=e=>CT(new Map,e)(0),Is="",{toString:kT}={},{keys:ET}=Object,ta=e=>{const t=typeof e;if(t!=="object"||!e)return[Cu,t];const n=kT.call(e).slice(8,-1);switch(n){case"Array":return[ca,Is];case"Object":return[mu,Is];case"Date":return[Wd,Is];case"RegExp":return[Yd,Is];case"Map":return[Vd,Is];case"Set":return[Kd,Is];case"DataView":return[ca,n]}return n.includes("Array")?[ca,n]:n.includes("Error")?[kS,n]:[mu,n]},Zo=([e,t])=>e===Cu&&(t==="function"||t==="symbol"),TT=(e,t,n,s)=>{const a=(c,f)=>{const p=s.push(c)-1;return n.set(f,p),p},o=c=>{if(n.has(c))return n.get(c);let[f,p]=ta(c);switch(f){case Cu:{let g=c;switch(p){case"bigint":f=ES,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return a([CS],c)}return a([f,g],c)}case ca:{if(p){let b=c;return p==="DataView"?b=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(c)),a([p,[...b]],c)}const g=[],_=a([f,g],c);for(const b of c)g.push(o(b));return _}case mu:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const g=[],_=a([f,g],c);for(const b of ET(c))(e||!Zo(ta(c[b])))&&g.push([o(b),o(c[b])]);return _}case Wd:return a([f,c.toISOString()],c);case Yd:{const{source:g,flags:_}=c;return a([f,{source:g,flags:_}],c)}case Vd:{const g=[],_=a([f,g],c);for(const[b,y]of c)(e||!(Zo(ta(b))||Zo(ta(y))))&&g.push([o(b),o(y)]);return _}case Kd:{const g=[],_=a([f,g],c);for(const b of c)(e||!Zo(ta(b)))&&g.push(o(b));return _}}const{message:h}=c;return a([f,{name:p,message:h}],c)};return o},Dy=(e,{json:t,lossy:n}={})=>{const s=[];return TT(!(t||n),!!t,new Map,s)(e),s},ma=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ay(Dy(e,t)):structuredClone(e):(e,t)=>Ay(Dy(e,t));function AT(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function DT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function RT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||AT,s=e.options.footnoteBackLabel||DT,a=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),_=String(h.identifier).toUpperCase(),b=Gs(_.toLowerCase());let y=0;const x=[],k=e.footnoteCounts.get(_);for(;k!==void 0&&++y<=k;){x.length>0&&x.push({type:"text",value:" "});let $=typeof n=="string"?n:n(p,y);typeof $=="string"&&($={type:"text",value:$}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,y),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const L=g[g.length-1];if(L&&L.type==="element"&&L.tagName==="p"){const $=L.children[L.children.length-1];$&&$.type==="text"?$.value+=" ":L.children.push({type:"text",value:" "}),L.children.push(...x)}else g.push(...x);const R={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,R),f.push(R)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ma(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
109
109
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
110
- `}]}}const ku=(function(e){if(e==null)return BT;if(typeof e=="function")return Eu(e);if(typeof e=="object")return Array.isArray(e)?DT(e):RT(e);if(typeof e=="string")return MT(e);throw new Error("Expected function, string, or object as test")});function DT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ku(e[n]);return Eu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function RT(e){const t=e;return Eu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function MT(e){return Eu(t);function t(n){return n&&n.type===e}}function Eu(e){return t;function t(n,s,a){return!!(NT(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function BT(){return!0}function NT(e){return e!==null&&typeof e=="object"&&"type"in e}const kS=[],LT=!0,_d=!1,zT="skip";function ES(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=ku(a),c=s?-1:1;f(e,void 0,[])();function f(p,h,g){const _=p&&typeof p=="object"?p:{};if(typeof _.type=="string"){const y=typeof _.tagName=="string"?_.tagName:typeof _.name=="string"?_.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=kS,x,E,L;if((!t||o(p,h,g[g.length-1]||void 0))&&(y=OT(n(p,g)),y[0]===_d))return y;if("children"in p&&p.children){const R=p;if(R.children&&y[0]!==zT)for(E=(s?R.children.length:-1)+c,L=g.concat(R);E>-1&&E<R.children.length;){const $=R.children[E];if(x=f($,E,L)(),x[0]===_d)return x;E=typeof x[1]=="number"?x[1]:E+c}}return y}}}function OT(e){return Array.isArray(e)?e:typeof e=="number"?[LT,e]:e==null?kS:[e]}function Vd(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),ES(e,o,f,a);function f(p,h){const g=h[h.length-1],_=g?g.children.indexOf(p):void 0;return c(p,_,g)}}const gd={}.hasOwnProperty,jT={};function HT(e,t){const n=t||jT,s=new Map,a=new Map,o=new Map,c={...ST,...n.handlers},f={all:h,applyData:PT,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:UT,wrap:FT};return Vd(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const _=g.type==="definition"?s:a,b=String(g.identifier).toUpperCase();_.has(b)||_.set(b,g)}}),f;function p(g,_){const b=g.type,y=f.handlers[b];if(gd.call(f.handlers,b)&&y)return y(f,g,_);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:E,...L}=g,R=ma(L);return R.children=f.all(g),R}return ma(g)}return(f.options.unknownHandler||IT)(f,g,_)}function h(g){const _=[];if("children"in g){const b=g.children;let y=-1;for(;++y<b.length;){const x=f.one(b[y],g);if(x){if(y&&b[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=Ay(x.value)),!Array.isArray(x)&&x.type==="element")){const E=x.children[0];E&&E.type==="text"&&(E.value=Ay(E.value))}Array.isArray(x)?_.push(...x):_.push(x)}}}return _}}function UT(e,t){e.position&&(t.position=tS(e))}function PT(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,ma(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function IT(e,t){const n=t.data||{},s="value"in t&&!(gd.call(n,"hProperties")||gd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function FT(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
110
+ `}]}}const ku=(function(e){if(e==null)return LT;if(typeof e=="function")return Eu(e);if(typeof e=="object")return Array.isArray(e)?MT(e):BT(e);if(typeof e=="string")return NT(e);throw new Error("Expected function, string, or object as test")});function MT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ku(e[n]);return Eu(s);function s(...a){let o=-1;for(;++o<t.length;)if(t[o].apply(this,a))return!0;return!1}}function BT(e){const t=e;return Eu(n);function n(s){const a=s;let o;for(o in e)if(a[o]!==t[o])return!1;return!0}}function NT(e){return Eu(t);function t(n){return n&&n.type===e}}function Eu(e){return t;function t(n,s,a){return!!(zT(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function LT(){return!0}function zT(e){return e!==null&&typeof e=="object"&&"type"in e}const TS=[],OT=!0,vd=!1,jT="skip";function AS(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=ku(a),c=s?-1:1;f(e,void 0,[])();function f(p,h,g){const _=p&&typeof p=="object"?p:{};if(typeof _.type=="string"){const y=typeof _.tagName=="string"?_.tagName:typeof _.name=="string"?_.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(y?"<"+y+">":""))+")"})}return b;function b(){let y=TS,x,k,L;if((!t||o(p,h,g[g.length-1]||void 0))&&(y=HT(n(p,g)),y[0]===vd))return y;if("children"in p&&p.children){const R=p;if(R.children&&y[0]!==jT)for(k=(s?R.children.length:-1)+c,L=g.concat(R);k>-1&&k<R.children.length;){const $=R.children[k];if(x=f($,k,L)(),x[0]===vd)return x;k=typeof x[1]=="number"?x[1]:k+c}}return y}}}function HT(e){return Array.isArray(e)?e:typeof e=="number"?[OT,e]:e==null?TS:[e]}function Xd(e,t,n,s){let a,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,a=n):(o=t,c=n,a=s),AS(e,o,f,a);function f(p,h){const g=h[h.length-1],_=g?g.children.indexOf(p):void 0;return c(p,_,g)}}const yd={}.hasOwnProperty,UT={};function PT(e,t){const n=t||UT,s=new Map,a=new Map,o=new Map,c={...wT,...n.handlers},f={all:h,applyData:FT,definitionById:s,footnoteById:a,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:IT,wrap:WT};return Xd(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const _=g.type==="definition"?s:a,b=String(g.identifier).toUpperCase();_.has(b)||_.set(b,g)}}),f;function p(g,_){const b=g.type,y=f.handlers[b];if(yd.call(f.handlers,b)&&y)return y(f,g,_);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in g){const{children:k,...L}=g,R=ma(L);return R.children=f.all(g),R}return ma(g)}return(f.options.unknownHandler||qT)(f,g,_)}function h(g){const _=[];if("children"in g){const b=g.children;let y=-1;for(;++y<b.length;){const x=f.one(b[y],g);if(x){if(y&&b[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=Ry(x.value)),!Array.isArray(x)&&x.type==="element")){const k=x.children[0];k&&k.type==="text"&&(k.value=Ry(k.value))}Array.isArray(x)?_.push(...x):_.push(x)}}}return _}}function IT(e,t){e.position&&(t.position=nS(e))}function FT(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,o=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,ma(o)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function qT(e,t){const n=t.data||{},s="value"in t&&!(yd.call(n,"hProperties")||yd.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function WT(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
111
111
  `});++s<e.length;)s&&n.push({type:"text",value:`
112
112
  `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
113
- `}),n}function Ay(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Dy(e,t){const n=HT(e,t),s=n.one(e,void 0),a=AT(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
114
- `},a),o}function qT(e,t){return e&&"run"in e?async function(n,s){const a=Dy(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Dy(n,{file:s,...e||t})}}function Ry(e){if(e)throw e}var df,My;function WT(){if(My)return df;My=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),_=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!_)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(s)return s(h,g).value}else return;return h[g]};return df=function p(){var h,g,_,b,y,x,E=arguments[0],L=1,R=arguments.length,$=!1;for(typeof E=="boolean"&&($=E,E=arguments[1]||{},L=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});L<R;++L)if(h=arguments[L],h!=null)for(g in h)_=f(E,g),b=f(h,g),E!==b&&($&&b&&(o(b)||(y=a(b)))?(y?(y=!1,x=_&&a(_)?_:[]):x=_&&o(_)?_:{},c(E,{name:g,newValue:p($,x,b)})):typeof b<"u"&&c(E,{name:g,newValue:b}));return E},df}var YT=WT();const pf=gu(YT);function vd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function VT(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(p,...h){const g=e[++o];let _=-1;if(p){c(p);return}for(;++_<a.length;)(h[_]===null||h[_]===void 0)&&(h[_]=a[_]);a=h,g?KT(g,f)(...h):c(null,...h)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function KT(e,t){let n;return s;function s(...c){const f=e.length>c.length;let p;f&&c.push(a);try{p=e.apply(this,c)}catch(h){const g=h;if(f&&n)throw g;return a(g)}f||(p&&p.then&&typeof p.then=="function"?p.then(o,a):p instanceof Error?a(p):o(p))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const an={basename:XT,dirname:$T,extname:GT,join:ZT,sep:"/"};function XT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');wa(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(s=a):(f=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function $T(e){if(wa(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function GT(e){wa(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function ZT(...e){let t=-1,n;for(;++t<e.length;)wa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":QT(n)}function QT(e){wa(e);const t=e.codePointAt(0)===47;let n=JT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function JT(e,t){let n="",s=0,a=-1,o=0,c=-1,f,p;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function wa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const e3={cwd:t3};function t3(){return"/"}function yd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function i3(e){if(typeof e=="string")e=new URL(e);else if(!yd(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return n3(e)}function n3(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const mf=["history","path","basename","stem","extname","dirname"];class TS{constructor(t){let n;t?yd(t)?n={path:t}:typeof t=="string"||r3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":e3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<mf.length;){const o=mf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)mf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?an.basename(this.path):void 0}set basename(t){gf(t,"basename"),_f(t,"basename"),this.path=an.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?an.dirname(this.path):void 0}set dirname(t){By(this.basename,"dirname"),this.path=an.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?an.extname(this.path):void 0}set extname(t){if(_f(t,"extname"),By(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=an.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){yd(t)&&(t=i3(t)),gf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?an.basename(this.path,this.extname):void 0}set stem(t){gf(t,"stem"),_f(t,"stem"),this.path=an.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Zt(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _f(e,t){if(e&&e.includes(an.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+an.sep+"`")}function gf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function By(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function r3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s3=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),l3={}.hasOwnProperty;class Kd extends s3{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=VT()}copy(){const t=new Kd;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(pf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bf("data",this.frozen),this.namespace[t]=n,this):l3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qo(t),s=this.parser||this.Parser;return vf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),vf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Qo(t),p=s.parse(f);s.run(p,f,function(g,_,b){if(g||!_||!b)return h(g);const y=_,x=s.stringify(y,b);u3(x)?b.value=x:b.result=x,h(g,b)});function h(g,_){g||!_?c(g):o?o(_):n(void 0,_)}}}processSync(t){let n=!1,s;return this.freeze(),vf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(t,a),Ly("processSync","process",n),s;function a(o,c){n=!0,Ry(o),s=c}}run(t,n,s){Ny(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const p=Qo(n);a.run(t,p,h);function h(g,_,b){const y=_||t;g?f(g):c?c(y):s(void 0,y,b)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),Ly("runSync","run",s),a;function o(c,f){Ry(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=Qo(n),a=this.compiler||this.Compiler;return yf("stringify",a),Ny(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(bf("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,..._]=h;p(g,_)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))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");f(h.plugins),h.settings&&(a.settings=pf(!0,a.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const _=h[g];o(_)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let _=-1,b=-1;for(;++_<s.length;)if(s[_][0]===h){b=_;break}if(b===-1)s.push([h,...g]);else if(g.length>0){let[y,...x]=g;const E=s[b][1];vd(E)&&vd(y)&&(y=pf(!0,E,y)),s[b]=[h,y,...x]}}}}const a3=new Kd().freeze();function vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ny(e){if(!vd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ly(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qo(e){return o3(e)?e:new TS(e)}function o3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function u3(e){return typeof e=="string"||c3(e)}function c3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const h3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zy=[],Oy={allowDangerousHtml:!0},f3=/^(https?|ircs?|mailto|xmpp)$/i,d3=[{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 p3(e){const t=m3(e),n=_3(e);return g3(t.runSync(t.parse(n),n),e)}function m3(e){const t=e.rehypePlugins||zy,n=e.remarkPlugins||zy,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Oy}:Oy;return a3().use($5).use(n).use(qT,s).use(t)}function _3(e){const t=e.children||"",n=new TS;return typeof t=="string"&&(n.value=t),n}function g3(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,p=t.urlTransform||v3;for(const g of d3)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+h3+g.id,void 0);return Vd(e,h),Bk(e,{Fragment:S.Fragment,components:a,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function h(g,_,b){if(g.type==="raw"&&b&&typeof _=="number")return c?b.children.splice(_,1):b.children[_]={type:"text",value:g.value},_;if(g.type==="element"){let y;for(y in cf)if(Object.hasOwn(cf,y)&&Object.hasOwn(g.properties,y)){const x=g.properties[y],E=cf[y];(E===null||E.includes(g.tagName))&&(g.properties[y]=p(String(x||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&s&&typeof _=="number"&&(y=!s(g,_,b)),y&&b&&typeof _=="number")return f&&g.children?b.children.splice(_,1,...g.children):b.children.splice(_,1),_}}}function v3(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||f3.test(e.slice(0,t))?e:""}function y3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function AS(e,t,n){const a=ku((n||{}).ignore||[]),o=b3(t);let c=-1;for(;++c<o.length;)ES(e,"text",f);function f(h,g){let _=-1,b;for(;++_<g.length;){const y=g[_],x=b?b.children:void 0;if(a(y,x?x.indexOf(y):void 0,b))return;b=y}if(b)return p(h,g)}function p(h,g){const _=g[g.length-1],b=o[c][0],y=o[c][1];let x=0;const L=_.children.indexOf(h);let R=!1,$=[];b.lastIndex=0;let I=b.exec(h.value);for(;I;){const Z=I.index,Y={index:I.index,input:I.input,stack:[...g,h]};let O=y(...I,Y);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=Z+1:(x!==Z&&$.push({type:"text",value:h.value.slice(x,Z)}),Array.isArray(O)?$.push(...O):O&&$.push(O),x=Z+I[0].length,R=!0),!b.global)break;I=b.exec(h.value)}return R?(x<h.value.length&&$.push({type:"text",value:h.value.slice(x)}),_.children.splice(L,1,...$)):$=[h],L+$.length}}function b3(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([S3(a[0]),x3(a[1])])}return t}function S3(e){return typeof e=="string"?new RegExp(y3(e),"g"):e}function x3(e){return typeof e=="function"?e:function(){return e}}function w3(e){AS(e,[/\r?\n|\r/g,C3])}function C3(){return{type:"break"}}function k3(){return function(e){w3(e)}}function jy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}const Sf="phrasing",xf=["autolink","link","image","label"];function E3(){return{transforms:[N3],enter:{literalAutolink:A3,literalAutolinkEmail:wf,literalAutolinkHttp:wf,literalAutolinkWww:wf},exit:{literalAutolink:B3,literalAutolinkEmail:M3,literalAutolinkHttp:D3,literalAutolinkWww:R3}}}function T3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sf,notInConstruct:xf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sf,notInConstruct:xf},{character:":",before:"[ps]",after:"\\/",inConstruct:Sf,notInConstruct:xf}]}}function A3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wf(e){this.config.enter.autolinkProtocol.call(this,e)}function D3(e){this.config.exit.autolinkProtocol.call(this,e)}function R3(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function M3(e){this.config.exit.autolinkEmail.call(this,e)}function B3(e){this.exit(e)}function N3(e){AS(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,L3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),z3]],{ignore:["link","linkReference"]})}function L3(e,t,n,s,a){let o="";if(!DS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!O3(n)))return!1;const c=j3(n+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function z3(e,t,n,s){return!DS(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function O3(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function j3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=jy(e,"(");let o=jy(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function DS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Kr(n)||xu(n))&&(!t||n!==47)}RS.peek=V3;function H3(){this.buffer()}function U3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function P3(){this.buffer()}function I3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function F3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function q3(e){this.exit(e)}function W3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Y3(e){this.exit(e)}function V3(){return"["}function RS(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function K3(){return{enter:{gfmFootnoteCallString:H3,gfmFootnoteCall:U3,gfmFootnoteDefinitionLabelString:P3,gfmFootnoteDefinition:I3},exit:{gfmFootnoteCallString:F3,gfmFootnoteCall:q3,gfmFootnoteDefinitionLabelString:W3,gfmFootnoteDefinition:Y3}}}function X3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:RS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const f=o.createTracker(c);let p=f.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return p+=f.move(o.safe(o.associationId(s),{before:p,after:"]"})),g(),p+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),p+=f.move((t?`
115
- `:" ")+o.indentLines(o.containerFlow(s,f.current()),t?MS:$3))),h(),p}}function $3(e,t,n){return t===0?e:MS(e,t,n)}function MS(e,t,n){return(n?"":" ")+e}const G3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];BS.peek=tA;function Z3(){return{canContainEols:["delete"],enter:{strikethrough:J3},exit:{strikethrough:eA}}}function Q3(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G3}],handlers:{delete:BS}}}function J3(e){this.enter({type:"delete",children:[]},e)}function eA(e){this.exit(e)}function BS(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function tA(){return"~"}function iA(e){return e.length}function nA(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||iA,o=[],c=[],f=[],p=[];let h=0,g=-1;for(;++g<e.length;){const E=[],L=[];let R=-1;for(e[g].length>h&&(h=e[g].length);++R<e[g].length;){const $=rA(e[g][R]);if(n.alignDelimiters!==!1){const I=a($);L[R]=I,(p[R]===void 0||I>p[R])&&(p[R]=I)}E.push($)}c[g]=E,f[g]=L}let _=-1;if(typeof s=="object"&&"length"in s)for(;++_<h;)o[_]=Hy(s[_]);else{const E=Hy(s);for(;++_<h;)o[_]=E}_=-1;const b=[],y=[];for(;++_<h;){const E=o[_];let L="",R="";E===99?(L=":",R=":"):E===108?L=":":E===114&&(R=":");let $=n.alignDelimiters===!1?1:Math.max(1,p[_]-L.length-R.length);const I=L+"-".repeat($)+R;n.alignDelimiters!==!1&&($=L.length+$+R.length,$>p[_]&&(p[_]=$),y[_]=$),b[_]=I}c.splice(1,0,b),f.splice(1,0,y),g=-1;const x=[];for(;++g<c.length;){const E=c[g],L=f[g];_=-1;const R=[];for(;++_<h;){const $=E[_]||"";let I="",Z="";if(n.alignDelimiters!==!1){const Y=p[_]-(L[_]||0),O=o[_];O===114?I=" ".repeat(Y):O===99?Y%2?(I=" ".repeat(Y/2+.5),Z=" ".repeat(Y/2-.5)):(I=" ".repeat(Y/2),Z=I):Z=" ".repeat(Y)}n.delimiterStart!==!1&&!_&&R.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&$==="")&&(n.delimiterStart!==!1||_)&&R.push(" "),n.alignDelimiters!==!1&&R.push(I),R.push($),n.alignDelimiters!==!1&&R.push(Z),n.padding!==!1&&R.push(" "),(n.delimiterEnd!==!1||_!==h-1)&&R.push("|")}x.push(n.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return x.join(`
116
- `)}function rA(e){return e==null?"":String(e)}function Hy(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function sA(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),lA);return a(),c}function lA(e,t,n){return">"+(n?"":" ")+e}function aA(e,t){return Uy(e,t.inConstruct,!0)&&!Uy(e,t.notInConstruct,!1)}function Uy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Py(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
117
- `&&aA(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
118
- `}function oA(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function uA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function hA(e,t,n,s){const a=cA(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(uA(e,n)){const _=n.enter("codeIndented"),b=n.indentLines(o,fA);return _(),b}const f=n.createTracker(s),p=a.repeat(Math.max(oA(o,a)+1,3)),h=n.enter("codeFenced");let g=f.move(p);if(e.lang){const _=n.enter(`codeFencedLang${c}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),_()}if(e.lang&&e.meta){const _=n.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
113
+ `}),n}function Ry(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function My(e,t){const n=PT(e,t),s=n.one(e,void 0),a=RT(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&o.children.push({type:"text",value:`
114
+ `},a),o}function YT(e,t){return e&&"run"in e?async function(n,s){const a=My(n,{file:s,...t});await e.run(a,s)}:function(n,s){return My(n,{file:s,...e||t})}}function By(e){if(e)throw e}var df,Ny;function VT(){if(Ny)return df;Ny=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),_=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!_)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(s)return s(h,g).value}else return;return h[g]};return df=function p(){var h,g,_,b,y,x,k=arguments[0],L=1,R=arguments.length,$=!1;for(typeof k=="boolean"&&($=k,k=arguments[1]||{},L=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});L<R;++L)if(h=arguments[L],h!=null)for(g in h)_=f(k,g),b=f(h,g),k!==b&&($&&b&&(o(b)||(y=a(b)))?(y?(y=!1,x=_&&a(_)?_:[]):x=_&&o(_)?_:{},c(k,{name:g,newValue:p($,x,b)})):typeof b<"u"&&c(k,{name:g,newValue:b}));return k},df}var KT=VT();const pf=gu(KT);function bd(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function XT(){const e=[],t={run:n,use:s};return t;function n(...a){let o=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...a);function f(p,...h){const g=e[++o];let _=-1;if(p){c(p);return}for(;++_<a.length;)(h[_]===null||h[_]===void 0)&&(h[_]=a[_]);a=h,g?$T(g,f)(...h):c(null,...h)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function $T(e,t){let n;return s;function s(...c){const f=e.length>c.length;let p;f&&c.push(a);try{p=e.apply(this,c)}catch(h){const g=h;if(f&&n)throw g;return a(g)}f||(p&&p.then&&typeof p.then=="function"?p.then(o,a):p instanceof Error?a(p):o(p))}function a(c,...f){n||(n=!0,t(c,...f))}function o(c){a(null,c)}}const an={basename:GT,dirname:ZT,extname:QT,join:JT,sep:"/"};function GT(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');wa(e);let n=0,s=-1,a=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else s<0&&(o=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(o){n=a+1;break}}else c<0&&(o=!0,c=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(s=a):(f=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function ZT(e){if(wa(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function QT(e){wa(e);let t=e.length,n=-1,s=0,a=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?a<0?a=t:o!==1&&(o=1):a>-1&&(o=-1)}return a<0||n<0||o===0||o===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function JT(...e){let t=-1,n;for(;++t<e.length;)wa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":e3(n)}function e3(e){wa(e);const t=e.codePointAt(0)===47;let n=t3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function t3(e,t){let n="",s=0,a=-1,o=0,c=-1,f,p;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(a===c-1||o===1))if(a!==c-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,o=0;continue}}else if(n.length>0){n="",s=0,a=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function wa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const i3={cwd:n3};function n3(){return"/"}function Sd(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function r3(e){if(typeof e=="string")e=new URL(e);else if(!Sd(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return s3(e)}function s3(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const mf=["history","path","basename","stem","extname","dirname"];class DS{constructor(t){let n;t?Sd(t)?n={path:t}:typeof t=="string"||l3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":i3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<mf.length;){const o=mf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)mf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?an.basename(this.path):void 0}set basename(t){gf(t,"basename"),_f(t,"basename"),this.path=an.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?an.dirname(this.path):void 0}set dirname(t){Ly(this.basename,"dirname"),this.path=an.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?an.extname(this.path):void 0}set extname(t){if(_f(t,"extname"),Ly(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=an.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sd(t)&&(t=r3(t)),gf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?an.basename(this.path,this.extname):void 0}set stem(t){gf(t,"stem"),_f(t,"stem"),this.path=an.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Qt(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _f(e,t){if(e&&e.includes(an.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+an.sep+"`")}function gf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ly(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function l3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const a3=(function(e){const s=this.constructor.prototype,a=s[e],o=function(){return a.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),o3={}.hasOwnProperty;class $d extends a3{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=XT()}copy(){const t=new $d;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(pf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bf("data",this.frozen),this.namespace[t]=n,this):o3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qo(t),s=this.parser||this.Parser;return vf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),vf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=Qo(t),p=s.parse(f);s.run(p,f,function(g,_,b){if(g||!_||!b)return h(g);const y=_,x=s.stringify(y,b);h3(x)?b.value=x:b.result=x,h(g,b)});function h(g,_){g||!_?c(g):o?o(_):n(void 0,_)}}}processSync(t){let n=!1,s;return this.freeze(),vf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(t,a),Oy("processSync","process",n),s;function a(o,c){n=!0,By(o),s=c}}run(t,n,s){zy(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(c,f){const p=Qo(n);a.run(t,p,h);function h(g,_,b){const y=_||t;g?f(g):c?c(y):s(void 0,y,b)}}}runSync(t,n){let s=!1,a;return this.run(t,n,o),Oy("runSync","run",s),a;function o(c,f){By(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=Qo(n),a=this.compiler||this.Compiler;return yf("stringify",a),zy(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(bf("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,..._]=h;p(g,_)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))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");f(h.plugins),h.settings&&(a.settings=pf(!0,a.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const _=h[g];o(_)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let _=-1,b=-1;for(;++_<s.length;)if(s[_][0]===h){b=_;break}if(b===-1)s.push([h,...g]);else if(g.length>0){let[y,...x]=g;const k=s[b][1];bd(k)&&bd(y)&&(y=pf(!0,k,y)),s[b]=[h,y,...x]}}}}const u3=new $d().freeze();function vf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zy(e){if(!bd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Oy(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qo(e){return c3(e)?e:new DS(e)}function c3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function h3(e){return typeof e=="string"||f3(e)}function f3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const d3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jy=[],Hy={allowDangerousHtml:!0},p3=/^(https?|ircs?|mailto|xmpp)$/i,m3=[{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 _3(e){const t=g3(e),n=v3(e);return y3(t.runSync(t.parse(n),n),e)}function g3(e){const t=e.rehypePlugins||jy,n=e.remarkPlugins||jy,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hy}:Hy;return u3().use(Z5).use(n).use(YT,s).use(t)}function v3(e){const t=e.children||"",n=new DS;return typeof t=="string"&&(n.value=t),n}function y3(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,p=t.urlTransform||b3;for(const g of m3)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+d3+g.id,void 0);return Xd(e,h),Lk(e,{Fragment:S.Fragment,components:a,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function h(g,_,b){if(g.type==="raw"&&b&&typeof _=="number")return c?b.children.splice(_,1):b.children[_]={type:"text",value:g.value},_;if(g.type==="element"){let y;for(y in cf)if(Object.hasOwn(cf,y)&&Object.hasOwn(g.properties,y)){const x=g.properties[y],k=cf[y];(k===null||k.includes(g.tagName))&&(g.properties[y]=p(String(x||""),y,g))}}if(g.type==="element"){let y=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!y&&s&&typeof _=="number"&&(y=!s(g,_,b)),y&&b&&typeof _=="number")return f&&g.children?b.children.splice(_,1,...g.children):b.children.splice(_,1),_}}}function b3(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||p3.test(e.slice(0,t))?e:""}function S3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RS(e,t,n){const a=ku((n||{}).ignore||[]),o=x3(t);let c=-1;for(;++c<o.length;)AS(e,"text",f);function f(h,g){let _=-1,b;for(;++_<g.length;){const y=g[_],x=b?b.children:void 0;if(a(y,x?x.indexOf(y):void 0,b))return;b=y}if(b)return p(h,g)}function p(h,g){const _=g[g.length-1],b=o[c][0],y=o[c][1];let x=0;const L=_.children.indexOf(h);let R=!1,$=[];b.lastIndex=0;let I=b.exec(h.value);for(;I;){const Z=I.index,Y={index:I.index,input:I.input,stack:[...g,h]};let O=y(...I,Y);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=Z+1:(x!==Z&&$.push({type:"text",value:h.value.slice(x,Z)}),Array.isArray(O)?$.push(...O):O&&$.push(O),x=Z+I[0].length,R=!0),!b.global)break;I=b.exec(h.value)}return R?(x<h.value.length&&$.push({type:"text",value:h.value.slice(x)}),_.children.splice(L,1,...$)):$=[h],L+$.length}}function x3(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const a=n[s];t.push([w3(a[0]),C3(a[1])])}return t}function w3(e){return typeof e=="string"?new RegExp(S3(e),"g"):e}function C3(e){return typeof e=="function"?e:function(){return e}}function k3(e){RS(e,[/\r?\n|\r/g,E3])}function E3(){return{type:"break"}}function T3(){return function(e){k3(e)}}function Uy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(t);for(;a!==-1;)s++,a=n.indexOf(t,a+t.length);return s}const Sf="phrasing",xf=["autolink","link","image","label"];function A3(){return{transforms:[z3],enter:{literalAutolink:R3,literalAutolinkEmail:wf,literalAutolinkHttp:wf,literalAutolinkWww:wf},exit:{literalAutolink:L3,literalAutolinkEmail:N3,literalAutolinkHttp:M3,literalAutolinkWww:B3}}}function D3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sf,notInConstruct:xf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sf,notInConstruct:xf},{character:":",before:"[ps]",after:"\\/",inConstruct:Sf,notInConstruct:xf}]}}function R3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function wf(e){this.config.enter.autolinkProtocol.call(this,e)}function M3(e){this.config.exit.autolinkProtocol.call(this,e)}function B3(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function N3(e){this.config.exit.autolinkEmail.call(this,e)}function L3(e){this.exit(e)}function z3(e){RS(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,O3],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),j3]],{ignore:["link","linkReference"]})}function O3(e,t,n,s,a){let o="";if(!MS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!H3(n)))return!1;const c=U3(n+s);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function j3(e,t,n,s){return!MS(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function H3(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function U3(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const a=Uy(e,"(");let o=Uy(e,")");for(;s!==-1&&a>o;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),o++;return[e,n]}function MS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Kr(n)||xu(n))&&(!t||n!==47)}BS.peek=X3;function P3(){this.buffer()}function I3(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function F3(){this.buffer()}function q3(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function W3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Y3(e){this.exit(e)}function V3(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Qi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function K3(e){this.exit(e)}function X3(){return"["}function BS(e,t,n,s){const a=n.createTracker(s);let o=a.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=a.move("]"),o}function $3(){return{enter:{gfmFootnoteCallString:P3,gfmFootnoteCall:I3,gfmFootnoteDefinitionLabelString:F3,gfmFootnoteDefinition:q3},exit:{gfmFootnoteCallString:W3,gfmFootnoteCall:Y3,gfmFootnoteDefinitionLabelString:V3,gfmFootnoteDefinition:K3}}}function G3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:BS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,o,c){const f=o.createTracker(c);let p=f.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return p+=f.move(o.safe(o.associationId(s),{before:p,after:"]"})),g(),p+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),p+=f.move((t?`
115
+ `:" ")+o.indentLines(o.containerFlow(s,f.current()),t?NS:Z3))),h(),p}}function Z3(e,t,n){return t===0?e:NS(e,t,n)}function NS(e,t,n){return(n?"":" ")+e}const Q3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LS.peek=nA;function J3(){return{canContainEols:["delete"],enter:{strikethrough:tA},exit:{strikethrough:iA}}}function eA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q3}],handlers:{delete:LS}}}function tA(e){this.enter({type:"delete",children:[]},e)}function iA(e){this.exit(e)}function LS(e,t,n,s){const a=n.createTracker(s),o=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),o(),c}function nA(){return"~"}function rA(e){return e.length}function sA(e,t){const n=t||{},s=(n.align||[]).concat(),a=n.stringLength||rA,o=[],c=[],f=[],p=[];let h=0,g=-1;for(;++g<e.length;){const k=[],L=[];let R=-1;for(e[g].length>h&&(h=e[g].length);++R<e[g].length;){const $=lA(e[g][R]);if(n.alignDelimiters!==!1){const I=a($);L[R]=I,(p[R]===void 0||I>p[R])&&(p[R]=I)}k.push($)}c[g]=k,f[g]=L}let _=-1;if(typeof s=="object"&&"length"in s)for(;++_<h;)o[_]=Py(s[_]);else{const k=Py(s);for(;++_<h;)o[_]=k}_=-1;const b=[],y=[];for(;++_<h;){const k=o[_];let L="",R="";k===99?(L=":",R=":"):k===108?L=":":k===114&&(R=":");let $=n.alignDelimiters===!1?1:Math.max(1,p[_]-L.length-R.length);const I=L+"-".repeat($)+R;n.alignDelimiters!==!1&&($=L.length+$+R.length,$>p[_]&&(p[_]=$),y[_]=$),b[_]=I}c.splice(1,0,b),f.splice(1,0,y),g=-1;const x=[];for(;++g<c.length;){const k=c[g],L=f[g];_=-1;const R=[];for(;++_<h;){const $=k[_]||"";let I="",Z="";if(n.alignDelimiters!==!1){const Y=p[_]-(L[_]||0),O=o[_];O===114?I=" ".repeat(Y):O===99?Y%2?(I=" ".repeat(Y/2+.5),Z=" ".repeat(Y/2-.5)):(I=" ".repeat(Y/2),Z=I):Z=" ".repeat(Y)}n.delimiterStart!==!1&&!_&&R.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&$==="")&&(n.delimiterStart!==!1||_)&&R.push(" "),n.alignDelimiters!==!1&&R.push(I),R.push($),n.alignDelimiters!==!1&&R.push(Z),n.padding!==!1&&R.push(" "),(n.delimiterEnd!==!1||_!==h-1)&&R.push("|")}x.push(n.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return x.join(`
116
+ `)}function lA(e){return e==null?"":String(e)}function Py(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function aA(e,t,n,s){const a=n.enter("blockquote"),o=n.createTracker(s);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),oA);return a(),c}function oA(e,t,n){return">"+(n?"":" ")+e}function uA(e,t){return Iy(e,t.inConstruct,!0)&&!Iy(e,t.notInConstruct,!1)}function Iy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Fy(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
117
+ `&&uA(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
118
+ `}function cA(e,t){const n=String(e);let s=n.indexOf(t),a=s,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++o>c&&(c=o):o=1,a=s+t.length,s=n.indexOf(t,a);return c}function hA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function fA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dA(e,t,n,s){const a=fA(n),o=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(hA(e,n)){const _=n.enter("codeIndented"),b=n.indentLines(o,pA);return _(),b}const f=n.createTracker(s),p=a.repeat(Math.max(cA(o,a)+1,3)),h=n.enter("codeFenced");let g=f.move(p);if(e.lang){const _=n.enter(`codeFencedLang${c}`);g+=f.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),_()}if(e.lang&&e.meta){const _=n.enter(`codeFencedMeta${c}`);g+=f.move(" "),g+=f.move(n.safe(e.meta,{before:g,after:`
119
119
  `,encode:["`"],...f.current()})),_()}return g+=f.move(`
120
120
  `),o&&(g+=f.move(o+`
121
- `)),g+=f.move(p),h(),g}function fA(e,t,n){return(n?"":" ")+e}function Xd(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function dA(e,t,n,s){const a=Xd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("[");return h+=p.move(n.safe(n.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":`
122
- `,...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),c(),h}function pA(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _a(e){return"&#x"+e.toString(16).toUpperCase()+";"}function _u(e,t,n){const s=Vs(e),a=Vs(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}NS.peek=mA;function NS(e,t,n,s){const a=pA(n),o=n.enter("emphasis"),c=n.createTracker(s),f=c.move(a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=_u(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+_a(_));const y=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+p+y}function mA(e,t,n){return n.options.emphasis||"*"}function _A(e,t){let n=!1;return Vd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,_d}),!!((!e.depth||e.depth<3)&&Ud(e)&&(t.options.setext||n))}function gA(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(_A(e,n)){const g=n.enter("headingSetext"),_=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
121
+ `)),g+=f.move(p),h(),g}function pA(e,t,n){return(n?"":" ")+e}function Gd(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function mA(e,t,n,s){const a=Gd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("[");return h+=p.move(n.safe(n.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":`
122
+ `,...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),c(),h}function _A(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _a(e){return"&#x"+e.toString(16).toUpperCase()+";"}function _u(e,t,n){const s=Vs(e),a=Vs(t);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}zS.peek=gA;function zS(e,t,n,s){const a=_A(n),o=n.enter("emphasis"),c=n.createTracker(s),f=c.move(a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=_u(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+_a(_));const y=c.move(a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+p+y}function gA(e,t,n){return n.options.emphasis||"*"}function vA(e,t){let n=!1;return Xd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,vd}),!!((!e.depth||e.depth<3)&&Id(e)&&(t.options.setext||n))}function yA(e,t,n,s){const a=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(s);if(vA(e,n)){const g=n.enter("headingSetext"),_=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
123
123
  `,after:`
124
124
  `});return _(),g(),b+`
125
125
  `+(a===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
126
126
  `))+1))}const c="#".repeat(a),f=n.enter("headingAtx"),p=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
127
- `,...o.current()});return/^[\t ]/.test(h)&&(h=_a(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),f(),h}LS.peek=vA;function LS(e){return e.value||""}function vA(){return"<"}zS.peek=yA;function zS(e,t,n,s){const a=Xd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("![");return h+=p.move(n.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),h+=p.move(")"),c(),h}function yA(){return"!"}OS.peek=bA;function OS(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("![");const h=n.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function bA(){return"!"}jS.peek=SA;function jS(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let p;if(c.atBreak)for(;p=f.exec(s);){let h=p.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(p.index+1)}}return a+s+a}function SA(){return"`"}function HS(e,t){const n=Ud(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}US.peek=xA;function US(e,t,n,s){const a=Xd(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,p;if(HS(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let _=c.move("<");return _+=c.move(n.containerPhrasing(e,{before:_,after:">",...c.current()})),_+=c.move(">"),f(),n.stack=g,_}f=n.enter("link"),p=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(p=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),h+=c.move(" "+a),h+=c.move(n.safe(e.title,{before:h,after:a,...c.current()})),h+=c.move(a),p()),h+=c.move(")"),f(),h}function xA(e,t,n){return HS(e,n)?"<":"["}PS.peek=wA;function PS(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("[");const h=n.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function wA(){return"["}function $d(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function CA(e){const t=$d(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function kA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function IS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function EA(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?kA(n):$d(n);const f=e.ordered?c==="."?")":".":CA(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),IS(n)===c&&g){let _=-1;for(;++_<e.children.length;){const b=e.children[_];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),h}function TA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function AA(e,t,n,s){const a=TA(n);let o=n.bulletCurrent||$d(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const p=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),g);return p(),h;function g(_,b,y){return b?(y?"":" ".repeat(c))+_:(y?o:o+" ".repeat(c-o.length))+_}}function DA(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const RA=ku(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function MA(e,t,n,s){return(e.children.some(function(c){return RA(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function BA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}FS.peek=NA;function FS(e,t,n,s){const a=BA(n),o=n.enter("strong"),c=n.createTracker(s),f=c.move(a+a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=_u(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+_a(_));const y=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+p+y}function NA(e,t,n){return n.options.strong||"*"}function LA(e,t,n,s){return n.safe(e.value,s)}function zA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function OA(e,t,n){const s=(IS(n)+(n.options.ruleSpaces?" ":"")).repeat(zA(n));return n.options.ruleSpaces?s.slice(0,-1):s}const qS={blockquote:sA,break:Py,code:hA,definition:dA,emphasis:NS,hardBreak:Py,heading:gA,html:LS,image:zS,imageReference:OS,inlineCode:jS,link:US,linkReference:PS,list:EA,listItem:AA,paragraph:DA,root:MA,strong:FS,text:LA,thematicBreak:OA};function jA(){return{enter:{table:HA,tableData:Iy,tableHeader:Iy,tableRow:PA},exit:{codeText:IA,table:UA,tableData:Cf,tableHeader:Cf,tableRow:Cf}}}function HA(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function UA(e){this.exit(e),this.data.inTable=void 0}function PA(e){this.enter({type:"tableRow",children:[]},e)}function Cf(e){this.exit(e)}function Iy(e){this.enter({type:"tableCell",children:[]},e)}function IA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,FA));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function FA(e,t){return t==="|"?t:e}function qA(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
128
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:p,tableRow:f}};function c(y,x,E,L){return h(g(y,E,L),y.align)}function f(y,x,E,L){const R=_(y,E,L),$=h([R]);return $.slice(0,$.indexOf(`
129
- `))}function p(y,x,E,L){const R=E.enter("tableCell"),$=E.enter("phrasing"),I=E.containerPhrasing(y,{...L,before:o,after:o});return $(),R(),I}function h(y,x){return nA(y,{align:x,alignDelimiters:s,padding:n,stringLength:a})}function g(y,x,E){const L=y.children;let R=-1;const $=[],I=x.enter("table");for(;++R<L.length;)$[R]=_(L[R],x,E);return I(),$}function _(y,x,E){const L=y.children;let R=-1;const $=[],I=x.enter("tableRow");for(;++R<L.length;)$[R]=p(L[R],y,x,E);return I(),$}function b(y,x,E){let L=qS.inlineCode(y,x,E);return E.stack.includes("tableCell")&&(L=L.replace(/\|/g,"\\$&")),L}}function WA(){return{exit:{taskListCheckValueChecked:Fy,taskListCheckValueUnchecked:Fy,paragraph:VA}}}function YA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KA}}}function Fy(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function VA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function KA(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);o&&f.move(c);let p=qS.listItem(e,t,n,{...s,...f.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+c}}function XA(){return[E3(),K3(),Z3(),jA(),WA()]}function $A(e){return{extensions:[T3(),X3(e),Q3(),qA(e),YA()]}}const GA={tokenize:iD,partial:!0},WS={tokenize:nD,partial:!0},YS={tokenize:rD,partial:!0},VS={tokenize:sD,partial:!0},ZA={tokenize:lD,partial:!0},KS={name:"wwwAutolink",tokenize:eD,previous:$S},XS={name:"protocolAutolink",tokenize:tD,previous:GS},jn={name:"emailAutolink",tokenize:JA,previous:ZS},hn={};function QA(){return{text:hn}}let Ur=48;for(;Ur<123;)hn[Ur]=jn,Ur++,Ur===58?Ur=65:Ur===91&&(Ur=97);hn[43]=jn;hn[45]=jn;hn[46]=jn;hn[95]=jn;hn[72]=[jn,XS];hn[104]=[jn,XS];hn[87]=[jn,KS];hn[119]=[jn,KS];function JA(e,t,n){const s=this;let a,o;return c;function c(_){return!bd(_)||!ZS.call(s,s.previous)||Gd(s.events)?n(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return bd(_)?(e.consume(_),f):_===64?(e.consume(_),p):n(_)}function p(_){return _===46?e.check(ZA,g,h)(_):_===45||_===95||Gt(_)?(o=!0,e.consume(_),p):g(_)}function h(_){return e.consume(_),a=!0,p}function g(_){return o&&a&&ri(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):n(_)}}function eD(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!$S.call(s,s.previous)||Gd(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(GA,e.attempt(WS,e.attempt(YS,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function tD(e,t,n){const s=this;let a="",o=!1;return c;function c(_){return(_===72||_===104)&&GS.call(s,s.previous)&&!Gd(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):n(_)}function f(_){if(ri(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(_),p}return n(_)}function p(_){return _===47?(e.consume(_),o?h:(o=!0,p)):n(_)}function h(_){return _===null||pu(_)||Qe(_)||Kr(_)||xu(_)?n(_):e.attempt(WS,e.attempt(YS,g),n)(_)}function g(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function iD(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function nD(e,t,n){let s,a,o;return c;function c(h){return h===46||h===95?e.check(VS,p,f)(h):h===null||Qe(h)||Kr(h)||h!==45&&xu(h)?p(h):(o=!0,e.consume(h),c)}function f(h){return h===95?s=!0:(a=s,s=void 0),e.consume(h),c}function p(h){return a||s||!o?n(h):t(h)}}function rD(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(VS,t,o)(c):c===null||Qe(c)||Kr(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function sD(e,t,n){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||Qe(f)||Kr(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||Qe(f)||Kr(f)?t(f):s(f)}function o(f){return ri(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):ri(f)?(e.consume(f),c):n(f)}}function lD(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return Gt(o)?n(o):t(o)}}function $S(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qe(e)}function GS(e){return!ri(e)}function ZS(e){return!(e===47||bd(e))}function bd(e){return e===43||e===45||e===46||e===95||Gt(e)}function Gd(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const aD={tokenize:mD,partial:!0};function oD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fD,continuation:{tokenize:dD},exit:pD}},text:{91:{name:"gfmFootnoteCall",tokenize:hD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uD,resolveTo:cD}}}}function uD(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const p=s.events[a][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!c||!c._balanced)return n(p);const h=Qi(s.sliceSerialize({start:c.end,end:s.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function cD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function hD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),p}function p(_){return _!==94?n(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(_){if(o>999||_===93&&!c||_===null||_===91||Qe(_))return n(_);if(_===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(Qi(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return Qe(_)||(c=!0),o++,e.consume(_),_===92?g:h}function g(_){return _===91||_===92||_===93?(e.consume(_),o++,h):h(_)}}function fD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return p;function p(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(x)}function g(x){if(c>999||x===93&&!f||x===null||x===91||Qe(x))return n(x);if(x===93){e.exit("chunkString");const E=e.exit("gfmFootnoteDefinitionLabelString");return o=Qi(s.sliceSerialize(E)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Qe(x)||(f=!0),c++,e.consume(x),x===92?_:g}function _(x){return x===91||x===92||x===93?(e.consume(x),c++,g):g(x)}function b(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(o)||a.push(o),He(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function dD(e,t,n){return e.check(xa,t,e.attempt(aD,t,n))}function pD(e){e.exit("gfmFootnoteDefinition")}function mD(e,t,n){const s=this;return He(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function _D(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,f){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let h=p;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[p][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[p][1].end)},_={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[p][1].start)},b=[["enter",g,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",_,f]],y=f.parser.constructs.insideSpan.null;y&&Mi(b,b.length,0,wu(y,c.slice(h+1,p),f)),Mi(b,b.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Mi(c,h-1,p-h+3,b),p=h+b.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,f,p){const h=this.previous,g=this.events;let _=0;return b;function b(x){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(x):(c.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const E=Vs(h);if(x===126)return _>1?p(x):(c.consume(x),_++,y);if(_<2&&!n)return p(x);const L=c.exit("strikethroughSequenceTemporary"),R=Vs(x);return L._open=!R||R===2&&!!E,L._close=!E||E===2&&!!R,f(x)}}}class gD{constructor(){this.map=[]}add(t,n,s){vD(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function vD(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function yD(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function bD(){return{flow:{null:{name:"table",tokenize:SD,resolveAll:xD}}}}function SD(e,t,n){const s=this;let a=0,o=0,c;return f;function f(F){let le=s.events.length-1;for(;le>-1;){const B=s.events[le][1].type;if(B==="lineEnding"||B==="linePrefix")le--;else break}const H=le>-1?s.events[le][1].type:null,T=H==="tableHead"||H==="tableRow"?O:p;return T===O&&s.parser.lazy[s.now().line]?n(F):T(F)}function p(F){return e.enter("tableHead"),e.enter("tableRow"),h(F)}function h(F){return F===124||(c=!0,o+=1),g(F)}function g(F){return F===null?n(F):ve(F)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),y):n(F):Ne(F)?He(e,g,"whitespace")(F):(o+=1,c&&(c=!1,a+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),_(F)))}function _(F){return F===null||F===124||Qe(F)?(e.exit("data"),g(F)):(e.consume(F),F===92?b:_)}function b(F){return F===92||F===124?(e.consume(F),_):_(F)}function y(F){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(F):(e.enter("tableDelimiterRow"),c=!1,Ne(F)?He(e,x,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):x(F))}function x(F){return F===45||F===58?L(F):F===124?(c=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),E):Y(F)}function E(F){return Ne(F)?He(e,L,"whitespace")(F):L(F)}function L(F){return F===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),R):F===45?(o+=1,R(F)):F===null||ve(F)?Z(F):Y(F)}function R(F){return F===45?(e.enter("tableDelimiterFiller"),$(F)):Y(F)}function $(F){return F===45?(e.consume(F),$):F===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(F))}function I(F){return Ne(F)?He(e,Z,"whitespace")(F):Z(F)}function Z(F){return F===124?x(F):F===null||ve(F)?!c||a!==o?Y(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):Y(F)}function Y(F){return n(F)}function O(F){return e.enter("tableRow"),J(F)}function J(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),J):F===null||ve(F)?(e.exit("tableRow"),t(F)):Ne(F)?He(e,J,"whitespace")(F):(e.enter("data"),ae(F))}function ae(F){return F===null||F===124||Qe(F)?(e.exit("data"),J(F)):(e.consume(F),F===92?de:ae)}function de(F){return F===92||F===124?(e.consume(F),ae):ae(F)}}function xD(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,p=0,h,g,_;const b=new gD;for(;++n<e.length;){const y=e[n],x=y[1];y[0]==="enter"?x.type==="tableHead"?(f=!1,p!==0&&(qy(b,t,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},b.add(n,0,[["enter",h,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(s=!0,_=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},b.add(n,0,[["enter",g,t]])),a=x.type==="tableDelimiterRow"?2:g?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],_=Jo(b,t,o,a,void 0,_),o=[0,0,0,0]),c[2]=n)):x.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],_=Jo(b,t,o,a,void 0,_)),o=c,c=[o[1],n,0,0])):x.type==="tableHead"?(f=!0,p=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],_=Jo(b,t,o,a,n,_)):c[1]!==0&&(_=Jo(b,t,c,a,n,_)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&qy(b,t,p,h,g),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=yD(t.events,n))}return e}function Jo(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Fs(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=Fs(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Fs(t.events,n[2]),g=Fs(t.events,n[3]),_={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",_,t]]),s!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,E=n[3]-n[2]-1;e.add(x,E,[])}}e.add(n[3]+1,0,[["exit",_,t]])}return a!==void 0&&(o.end=Object.assign({},Fs(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function qy(e,t,n,s,a){const o=[],c=Fs(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Fs(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const wD={name:"tasklistCheck",tokenize:kD};function CD(){return{text:{91:wD}}}function kD(e,t,n){const s=this;return a;function a(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return Qe(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(p)}function f(p){return ve(p)?t(p):Ne(p)?e.check({tokenize:ED},t,n)(p):n(p)}}function ED(e,t,n){return He(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function TD(e){return aS([QA(),oD(),_D(e),bD(),CD()])}const AD={};function DD(e){const t=this,n=e||AD,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(TD(n)),o.push(XA()),c.push($A(n))}const Pr=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Wy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Pr,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Pr],h2:[["className","sr-only"]],img:[...Pr,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Pr,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Pr],table:[...Pr],ul:[...Pr,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},pr={}.hasOwnProperty;function RD(e,t){let n={type:"root",children:[]};const s={schema:t?{...Wy,...t}:Wy,stack:[]},a=QS(s,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function QS(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return MD(e,n);case"doctype":return BD(e,n);case"element":return ND(e,n);case"root":return LD(e,n);case"text":return zD(e,n)}}}function MD(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",s=n.indexOf("-->"),o={type:"comment",value:s<0?n:n.slice(0,s)};return Ca(o,t),o}}function BD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Ca(n,t),n}}function ND(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const s=JS(e,t.children),a=OD(e,t.properties);e.stack.pop();let o=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&pr.call(e.schema.ancestors,n))){const f=e.schema.ancestors[n];let p=-1;for(o=!1;++p<f.length;)e.stack.includes(f[p])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?s:void 0;const c={type:"element",tagName:n,properties:a,children:s};return Ca(c,t),c}function LD(e,t){const s={type:"root",children:JS(e,t.children)};return Ca(s,t),s}function zD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return Ca(s,t),s}function JS(e,t){const n=[];if(Array.isArray(t)){const s=t;let a=-1;for(;++a<s.length;){const o=QS(e,s[a]);o&&(Array.isArray(o)?n.push(...o):n.push(o))}}return n}function OD(e,t){const n=e.stack[e.stack.length-1],s=e.schema.attributes,a=e.schema.required,o=s&&pr.call(s,n)?s[n]:void 0,c=s&&pr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(pr.call(f,h)){const g=f[h];let _=Yy(e,Vy(o,h),h,g);_==null&&(_=Yy(e,Vy(c,h),h,g)),_!=null&&(p[h]=_)}if(a&&pr.call(a,n)){const g=a[n];for(h in g)pr.call(g,h)&&!pr.call(p,h)&&(p[h]=g[h])}return p}function Yy(e,t,n,s){return t?Array.isArray(s)?jD(e,t,n,s):e0(e,t,n,s):void 0}function jD(e,t,n,s){let a=-1;const o=[];for(;++a<s.length;){const c=e0(e,t,n,s[a]);(typeof c=="number"||typeof c=="string")&&o.push(c)}return o}function e0(e,t,n,s){if(!(typeof s!="boolean"&&typeof s!="number"&&typeof s!="string")&&HD(e,n,s)){if(typeof t=="object"&&t.length>1){let a=!1,o=0;for(;++o<t.length;){const c=t[o];if(c&&typeof c=="object"&&"flags"in c){if(c.test(String(s))){a=!0;break}}else if(c===s){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+s:s}}function HD(e,t,n){const s=e.schema.protocols&&pr.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!s||s.length===0)return!0;const a=String(n),o=a.indexOf(":"),c=a.indexOf("?"),f=a.indexOf("#"),p=a.indexOf("/");if(o<0||p>-1&&o>p||c>-1&&o>c||f>-1&&o>f)return!0;let h=-1;for(;++h<s.length;){const g=s[h];if(o===g.length&&a.slice(0,g.length)===g)return!0}return!1}function Ca(e,t){const n=tS(t);t.data&&(e.data=ma(t.data)),n&&(e.position=n)}function Vy(e,t){let n,s=-1;if(e)for(;++s<e.length;){const a=e[s],o=typeof a=="string"?a:a[0];if(o===t)return a;o==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function UD(e){return function(t){return RD(t,e)}}function PD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a}){const[o,c]=ie.useState(null),[f,p]=ie.useState(!1),[h,g]=ie.useState("preview"),[_,b]=ie.useState(""),[y,x]=ie.useState(!1),[E,L]=ie.useState(!1),[R,$]=ie.useState(!1),[I,Z]=ie.useState(null),Y=ie.useRef(null),O=ie.useRef(!1),J=ie.useRef(null),ae=ie.useCallback(async()=>{if(!e||!t){c(null);return}const se=`${e}/${t}`,k=J.current!==se;k&&(J.current=se);try{const D=await n(`/api/stories/${e}/${t}`);if(D.ok){const V=await D.json();c(V),(k||!O.current)&&(b(V.content??""),k&&(L(!1),O.current=!1))}}catch{}},[e,t,n]);ie.useEffect(()=>{p(!0),ae().finally(()=>p(!1))},[ae]),ie.useEffect(()=>{if(!e||!t||h==="edit"&&E)return;const se=setInterval(ae,3e3);return()=>clearInterval(se)},[e,t,ae,h,E]);const de=ie.useCallback(async()=>{if(!(!e||!t)){x(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:_})})).ok&&(L(!1),O.current=!1,c(k=>k&&{...k,content:_}))}catch{}x(!1)}},[e,t,n,_]);ie.useEffect(()=>{if(h!=="edit")return;const se=k=>{(k.metaKey||k.ctrlKey)&&k.key==="s"&&(k.preventDefault(),de())};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[h,de]),ie.useEffect(()=>{if((o==null?void 0:o.status)!=="published-not-indexed"||!o.publishedAt)return;const se=new Date(o.publishedAt).getTime(),k=300*1e3,D=()=>{const C=Math.max(0,k-(Date.now()-se));Z(C)};D();const V=setInterval(D,1e3);return()=>clearInterval(V)},[o==null?void 0:o.status,o==null?void 0:o.publishedAt]);const F=I!==null&&I<=0,le=I!==null&&I>0?`${Math.floor(I/6e4)}:${String(Math.floor(I%6e4/1e3)).padStart(2,"0")}`:null;if(!e||!t)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:S.jsxs("div",{className:"text-center",children:[S.jsx("p",{className:"text-lg font-serif",children:"Select a file to preview"}),S.jsx("p",{className:"text-sm mt-1",children:"Click a story file in the sidebar"})]})});if(f&&!o)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const T=(h==="edit"?_:(o==null?void 0:o.content)??"").length,B=t==="genesis.md",N=t?/^plot-\d+\.md$/.test(t):!1,A=(o==null?void 0:o.status)==="published"||(o==null?void 0:o.status)==="published-not-indexed",j=B||N?1e4:null,P=!A&&j!==null&&T>j;return S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"border-b border-border",children:[S.jsxs("div",{className:"px-3 py-1.5 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-muted",children:[S.jsxs("span",{children:[e,"/",t]}),(o==null?void 0:o.status)==="published"&&S.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(o==null?void 0:o.status)==="published-not-indexed"&&S.jsx("span",{className:"text-amber-700 font-medium",title:o.indexError,children:"Published (not indexed)"}),(o==null?void 0:o.status)==="pending"&&S.jsx("span",{className:"text-amber-700 font-medium",children:"Pending"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("span",{className:`text-xs font-mono ${P?"text-error font-medium":"text-muted"}`,children:[T.toLocaleString(),j!==null?`/${j.toLocaleString()}`:" chars"]}),P&&S.jsxs("span",{className:"text-error text-xs font-medium",children:[(T-j).toLocaleString()," over limit"]})]})]}),S.jsxs("div",{className:"flex px-3 gap-1",children:[S.jsx("button",{onClick:()=>g("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),S.jsxs("button",{onClick:()=>g("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",E&&S.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),h==="preview"?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:o!=null&&o.content?S.jsx("div",{className:"prose max-w-none",children:S.jsx(p3,{remarkPlugins:[k3,DD],rehypePlugins:[UD],children:o.content})}):S.jsx("p",{className:"text-muted italic",children:"No content"})}):S.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",style:{background:"var(--paper-bg)"},children:[S.jsx("textarea",{ref:Y,value:_,onChange:se=>{b(se.target.value),L(!0),O.current=!0},className:"flex-1 min-h-0 w-full resize-none px-4 py-3 text-sm leading-relaxed focus:outline-none",style:{fontFamily:'"Geist Mono", ui-monospace, monospace',background:"var(--paper-bg)",color:"var(--text)"},spellCheck:!1}),S.jsxs("div",{className:"px-3 py-1.5 border-t border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs text-muted",children:E?"Unsaved changes":"No changes"}),S.jsx("button",{onClick:de,disabled:!E||y,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:y?"Saving...":"Save"})]})]}),S.jsx("div",{className:"px-3 py-2 border-t border-border flex items-center justify-between",children:t==="structure.md"?S.jsx("p",{className:"text-muted text-xs italic",children:"This is your story outline — not publishable. Ask AI to write the genesis next."}):(o==null?void 0:o.status)==="published-not-indexed"?S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-amber-700",children:"Published on-chain but not indexed on PlotLink"}),!F&&S.jsx("button",{onClick:async()=>{if(!(!e||!t||!o.txHash)){$(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:o.txHash,content:o.content,storylineId:o.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:o.txHash,storylineId:o.storylineId,contentCid:"",gasCost:""})}),ae())}catch{}$(!1)}},disabled:R,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:R?"Retrying...":`Retry Index${le?` (${le})`:""}`}),N&&S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a,className:"px-3 py-1 border border-border text-xs rounded hover:bg-surface disabled:opacity-50",children:a===t?"Publishing...":"Retry Publish"}),o.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),S.jsx("p",{className:"text-muted text-xs",children:F?N?"Index window expired. Use Retry Publish to create a new on-chain tx.":"Index window expired. Contact support or re-publish manually.":N?"Try Retry Index first (available for 5 min after publish). If that fails, Retry Publish creates a new on-chain tx.":"Retry Index is available for 5 min after publish."}),o.indexError&&S.jsx("p",{className:"text-error text-xs",children:o.indexError})]}):(o==null?void 0:o.status)==="published"?S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-green-700",children:"Published"}),o.storylineId&&S.jsx("a",{href:(()=>{var D;const se=`https://plotlink.xyz/story/${o.storylineId}`;if(!N)return se;const k=o.plotIndex!=null&&o.plotIndex>0?o.plotIndex:parseInt(((D=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:D[1])??"1");return`${se}/${k}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),o.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}):S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t)),disabled:!!a||P,className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:a===t?"Publishing...":"Publish to PlotLink"}),P&&S.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]})})]})}const t0="plotlink-panel-ratio",ID=.6,Ky=300,kf=224,Ef=6;function FD(){try{const e=localStorage.getItem(t0);if(e){const t=parseFloat(e);if(t>0&&t<1)return t}}catch{}return ID}function Xy(e,t){if(t<=0)return e;const n=Ky/t,s=1-Ky/t;return n>=s?.5:Math.min(s,Math.max(n,e))}function qD({token:e,authFetch:t}){const[n,s]=ie.useState(null),[a,o]=ie.useState(null),[c,f]=ie.useState(null),[p,h]=ie.useState(""),[g,_]=ie.useState(FD),[b,y]=ie.useState([]),x=ie.useRef(new Set),E=ie.useRef(null),L=ie.useRef(null),R=ie.useRef(!1);ie.useEffect(()=>{try{localStorage.setItem(t0,String(g))}catch{}},[g]),ie.useEffect(()=>{const H=()=>{if(!L.current)return;const T=L.current.getBoundingClientRect().width-kf-Ef;_(B=>Xy(B,T))};return window.addEventListener("resize",H),H(),()=>window.removeEventListener("resize",H)},[]);const $=ie.useCallback(()=>{const H=`_new_${Date.now()}`;y(T=>[...T,H]),s(H),o(null)},[]);ie.useEffect(()=>{if(b.length===0)return;const H=setInterval(async()=>{try{const T=await t("/api/stories");if(!T.ok)return;const B=await T.json(),N=new Set(B.stories.filter(A=>A.name!=="_example").map(A=>A.name));for(const A of N)if(!x.current.has(A)&&b.length>0){const j=b[0];let P=!1;E.current&&(P=await E.current(j,A).catch(()=>!1)),P&&y(se=>se.slice(1)),s(A),o(null)}x.current=N}catch{}},3e3);return()=>clearInterval(H)},[t,b]),ie.useEffect(()=>{t("/api/stories").then(H=>{if(H.ok)return H.json()}).then(H=>{H!=null&&H.stories&&(x.current=new Set(H.stories.filter(T=>T.name!=="_example").map(T=>T.name)))}).catch(()=>{})},[t]);const I=ie.useCallback((H,T)=>{s(H),o(T)},[]),Z=ie.useRef(null),Y=ie.useCallback(async H=>{var T,B,N,A;Z.current=H,s(H),o(null);try{const j=await t(`/api/stories/${H}`);if(j.ok&&Z.current===H){const se=(await j.json()).files||[],D=((T=se.map(V=>{var C;return{file:V.file,num:(C=V.file.match(/^plot-(\d+)\.md$/))==null?void 0:C[1]}}).filter(V=>V.num!=null).sort((V,C)=>parseInt(C.num)-parseInt(V.num))[0])==null?void 0:T.file)??((B=se.find(V=>V.file==="genesis.md"))==null?void 0:B.file)??((N=se.find(V=>V.file==="structure.md"))==null?void 0:N.file)??((A=se[0])==null?void 0:A.file);D&&Z.current===H&&o(D)}}catch{}},[t]),O=ie.useCallback(H=>{H.preventDefault(),R.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const T=N=>{if(!R.current||!L.current)return;const A=L.current.getBoundingClientRect(),j=A.width-kf-Ef,P=N.clientX-A.left-kf;_(Xy(P/j,j))},B=()=>{R.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",T),window.removeEventListener("mouseup",B)};window.addEventListener("mousemove",T),window.addEventListener("mouseup",B)},[]),J=ie.useCallback(async(H,T)=>{var B;f(T),h("Reading file...");try{const N=await t(`/api/stories/${H}/${T}`);if(!N.ok)throw new Error("Failed to read file");const A=await N.json(),j=A.content.match(/^#\s+(.+)$/m),P=j?j[1].slice(0,60):T.replace(".md","");let se="Fiction";try{const ee=await t(`/api/stories/${H}/structure.md`);if(ee.ok){const he=(await ee.json()).content.match(/genre[:\s]+(.+)/i);he&&(se=he[1].trim().slice(0,30))}}catch{}let k;if(T.match(/^plot-\d+\.md$/)){try{const ee=await t(`/api/stories/${H}`);if(ee.ok){const he=(await ee.json()).files.find(be=>be.file==="genesis.md"&&be.storylineId);k=he==null?void 0:he.storylineId}}catch{}if(!k){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const D=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:H,fileName:T,title:P,content:A.content,genre:se,storylineId:k})});if(!D.ok){const ee=await D.json();throw new Error(ee.error||"Publish failed")}const V=(B=D.body)==null?void 0:B.getReader(),C=new TextDecoder;if(V)for(;;){const{done:ee,value:pe}=await V.read();if(ee)break;const be=C.decode(pe).split(`
130
- `).filter(Ue=>Ue.startsWith("data: "));for(const Ue of be)try{const Se=JSON.parse(Ue.slice(6));Se.step&&h(Se.message||Se.step),Se.step==="done"&&Se.txHash&&await t(`/api/stories/${H}/${T}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:Se.txHash,storylineId:Se.storylineId,plotIndex:Se.plotIndex,contentCid:Se.contentCid,gasCost:Se.gasCost,indexError:Se.indexError})})}catch{}}h("Published!")}catch(N){const A=N instanceof Error?N.message:"Publish failed";h(`Error: ${A}`)}finally{setTimeout(()=>{f(null),h("")},3e3)}},[t]),ae=ie.useCallback(H=>{H.startsWith("_new_")&&y(T=>T.filter(B=>B!==H))},[]),[de,F]=ie.useState(new Set);ie.useEffect(()=>{t("/api/stories").then(T=>T.ok?T.json():null).then(T=>{T!=null&&T.stories&&F(new Set(T.stories.filter(B=>B.hasStructure).map(B=>B.name)))}).catch(()=>{});const H=setInterval(async()=>{try{const T=await t("/api/stories");if(T.ok){const B=await T.json();F(new Set(B.stories.filter(N=>N.hasStructure).map(N=>N.name)))}}catch{}},5e3);return()=>clearInterval(H)},[t]);const le=ie.useCallback(H=>{n===H&&(s(null),o(null))},[n]);return S.jsxs("div",{ref:L,className:"h-[calc(100vh-3.5rem)] flex",children:[S.jsx("div",{className:"w-56 border-r border-border flex-shrink-0",children:S.jsx(zx,{authFetch:t,selectedStory:n,selectedFile:a,onSelectFile:I,onNewStory:$,untitledSessions:b})}),S.jsx("div",{className:"min-w-0 border-r border-border",style:{flex:`${g} 0 0`},children:S.jsx(rk,{token:e,storyName:n,authFetch:t,onSelectStory:Y,onDestroySession:ae,onArchiveStory:le,confirmedStories:de,renameRef:E})}),S.jsx("div",{onMouseDown:O,className:"flex-shrink-0 flex items-center justify-center hover:bg-border/50 transition-colors",style:{width:Ef,cursor:"col-resize",background:"var(--border)"},children:S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}})]})}),S.jsxs("div",{className:"min-w-0 flex flex-col",style:{flex:`${1-g} 0 0`},children:[S.jsx(PD,{storyName:n,fileName:a,authFetch:t,onPublish:J,publishingFile:c}),p&&S.jsx("div",{className:"px-3 py-1.5 bg-surface border-t border-border text-xs text-muted",children:p})]})]})}function WD({token:e,onComplete:t}){const[n,s]=ie.useState(!1),[a,o]=ie.useState(null),[c,f]=ie.useState(!1),p=async()=>{s(!0),o(null);try{const h=await fetch("/api/wallet/create",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=await h.json();if(!h.ok)throw new Error(g.error||"Wallet creation failed");f(!0)}catch(h){o(h instanceof Error?h.message:"Wallet creation failed")}s(!1)};return ie.useEffect(()=>{p()},[]),S.jsxs("div",{className:"mx-auto max-w-sm p-6 text-center",children:[S.jsx("h2",{className:"text-accent mb-1 text-lg font-bold",children:"Wallet Setup"}),S.jsx("p",{className:"text-muted mb-6 text-xs",children:"creating your OWS wallet for on-chain publishing"}),n&&S.jsx("p",{className:"text-accent text-sm",children:"creating wallet..."}),a&&S.jsxs("div",{className:"space-y-4",children:[S.jsx("div",{className:"rounded border border-red-700/30 p-3 text-xs text-red-700",children:a}),S.jsx("button",{onClick:p,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"retry"})]}),c&&S.jsxs("div",{className:"space-y-4",children:[S.jsx("div",{className:"text-accent text-2xl",children:"✓"}),S.jsx("p",{className:"text-foreground text-sm font-medium",children:"wallet created"}),S.jsx("button",{onClick:t,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"continue"})]})]})}function YD({token:e,onLogout:t}){const[n,s]=ie.useState("home"),[a,o]=ie.useState(0),c=ie.useCallback(async(f,p)=>fetch(f,{...p,headers:{...(p==null?void 0:p.headers)||{},Authorization:`Bearer ${e}`}}),[e]);return ie.useEffect(()=>{async function f(){try{if(!(await(await c("/api/wallet")).json()).exists){s("wallet-setup");return}const g=await c("/api/stories");if(g.ok){const _=await g.json();o(_.stories.filter(b=>b.name!=="_example").length)}}catch{}}f()},[e]),S.jsxs("div",{className:"flex h-screen flex-col",children:[S.jsxs("header",{className:"border-border flex h-14 items-center justify-between border-b px-4 flex-shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("button",{onClick:()=>{n!=="wallet-setup"&&s("home")},className:"flex items-center gap-2 hover:opacity-80",children:S.jsx("span",{className:"text-accent text-sm font-bold tracking-tight",children:"PlotLink OWS"})}),S.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"writer"})]}),n!=="wallet-setup"&&S.jsxs("nav",{className:"flex items-center gap-4",children:[S.jsx("button",{onClick:()=>s("stories"),className:`text-xs transition-colors ${n==="stories"?"text-accent":"text-muted hover:text-foreground"}`,children:"stories"}),S.jsx("button",{onClick:()=>s("dashboard"),className:`text-xs transition-colors ${n==="dashboard"?"text-accent":"text-muted hover:text-foreground"}`,children:"dashboard"}),S.jsx("button",{onClick:()=>s("settings"),className:`text-xs transition-colors ${n==="settings"?"text-accent":"text-muted hover:text-foreground"}`,children:"settings"}),S.jsx("button",{onClick:t,className:"text-muted hover:text-foreground text-xs transition-colors",children:"logout"})]})]}),S.jsxs("main",{className:"flex-1 min-h-0",children:[n==="home"&&S.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-8",children:[S.jsxs("div",{className:"text-center space-y-2",children:[S.jsx("h1",{className:"text-2xl font-serif text-foreground",children:"Write. Publish. Earn."}),S.jsx("p",{className:"text-muted text-sm",children:"Claude CLI writes stories. You publish them on-chain."})]}),S.jsxs("div",{className:"text-center space-y-3",children:[S.jsx("button",{onClick:()=>s("stories"),className:"bg-accent text-white hover:bg-accent-dim px-6 py-2.5 rounded text-sm font-medium transition-colors",children:"Start Writing"}),a>0&&S.jsxs("p",{className:"text-muted text-xs",children:[a," ",a===1?"story":"stories"," in progress"]})]}),S.jsxs("div",{className:"rounded border border-border p-4 space-y-2 text-xs text-muted",children:[S.jsx("p",{className:"font-medium text-foreground text-sm",children:"How it works"}),S.jsxs("ol",{className:"space-y-1.5 list-decimal list-inside",children:[S.jsxs("li",{children:["Open the ",S.jsx("strong",{children:"Stories"})," tab — Claude CLI launches in the terminal"]}),S.jsx("li",{children:"Tell Claude your story idea — it brainstorms, outlines, and writes"}),S.jsx("li",{children:"Review the live preview as Claude creates files"}),S.jsxs("li",{children:["Click ",S.jsx("strong",{children:"Publish"})," to put your story on-chain"]}),S.jsxs("li",{children:["Earn 5% royalties on every trade at ",S.jsx("a",{href:"https://plotlink.xyz",target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"plotlink.xyz"})]})]})]}),S.jsx(Qy,{token:e})]}),n==="stories"&&S.jsx(qD,{token:e,authFetch:c}),n==="dashboard"&&S.jsx(Bx,{token:e}),n==="wallet-setup"&&S.jsx(WD,{token:e,onComplete:()=>s("home")}),n==="settings"&&S.jsx(Rx,{token:e,onLogout:t})]})]})}function VD(){const[e,t]=ie.useState(()=>localStorage.getItem("ows-token")),[n,s]=ie.useState(null),[a,o]=ie.useState(!0);ie.useEffect(()=>{fetch("/api/auth/status").then(h=>h.json()).then(h=>s(h.configured)).catch(()=>s(null))},[]),ie.useEffect(()=>{if(!e){o(!1);return}fetch("/api/auth/verify",{headers:{Authorization:`Bearer ${e}`}}).then(h=>{h.ok||(localStorage.removeItem("ows-token"),t(null))}).catch(()=>{localStorage.removeItem("ows-token"),t(null)}).finally(()=>o(!1))},[e]);const c=async h=>{try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),null):_.error||"Login failed"}catch{return"Cannot connect to server"}},f=async h=>{try{const g=await fetch("/api/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),s(!0),null):_.error||"Setup failed"}catch{return"Cannot connect to server"}},p=()=>{localStorage.removeItem("ows-token"),t(null)};return a||n===null?S.jsx("div",{className:"flex h-screen items-center justify-center",children:S.jsx("span",{className:"text-muted text-sm",children:"connecting..."})}):n?e?S.jsx(YD,{token:e,onLogout:p}):S.jsx(Ax,{onLogin:c}):S.jsx(Dx,{onSetup:f})}Tx.createRoot(document.getElementById("root")).render(S.jsx(yx.StrictMode,{children:S.jsx(VD,{})}));
127
+ `,...o.current()});return/^[\t ]/.test(h)&&(h=_a(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),f(),h}OS.peek=bA;function OS(e){return e.value||""}function bA(){return"<"}jS.peek=SA;function jS(e,t,n,s){const a=Gd(n),o=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const p=n.createTracker(s);let h=p.move("![");return h+=p.move(n.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=p.move(" "+a),h+=p.move(n.safe(e.title,{before:h,after:a,...p.current()})),h+=p.move(a),f()),h+=p.move(")"),c(),h}function SA(){return"!"}HS.peek=xA;function HS(e,t,n,s){const a=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("![");const h=n.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function xA(){return"!"}US.peek=wA;function US(e,t,n){let s=e.value||"",a="`",o=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let p;if(c.atBreak)for(;p=f.exec(s);){let h=p.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(p.index+1)}}return a+s+a}function wA(){return"`"}function PS(e,t){const n=Id(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}IS.peek=CA;function IS(e,t,n,s){const a=Gd(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,p;if(PS(e,n)){const g=n.stack;n.stack=[],f=n.enter("autolink");let _=c.move("<");return _+=c.move(n.containerPhrasing(e,{before:_,after:">",...c.current()})),_+=c.move(">"),f(),n.stack=g,_}f=n.enter("link"),p=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(p=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),h+=c.move(" "+a),h+=c.move(n.safe(e.title,{before:h,after:a,...c.current()})),h+=c.move(a),p()),h+=c.move(")"),f(),h}function CA(e,t,n){return PS(e,n)?"<":"["}FS.peek=kA;function FS(e,t,n,s){const a=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(s);let p=f.move("[");const h=n.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const _=n.safe(n.associationId(e),{before:p,after:"]",...f.current()});return c(),n.stack=g,o(),a==="full"||!h||h!==_?p+=f.move(_+"]"):a==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function kA(){return"["}function Zd(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function EA(e){const t=Zd(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function TA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function qS(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function AA(e,t,n,s){const a=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?TA(n):Zd(n);const f=e.ordered?c==="."?")":".":EA(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),qS(n)===c&&g){let _=-1;for(;++_<e.children.length;){const b=e.children[_];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,s);return n.bulletLastUsed=c,n.bulletCurrent=o,a(),h}function DA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function RA(e,t,n,s){const a=DA(n);let o=n.bulletCurrent||Zd(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(s);f.move(o+" ".repeat(c-o.length)),f.shift(c);const p=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),g);return p(),h;function g(_,b,y){return b?(y?"":" ".repeat(c))+_:(y?o:o+" ".repeat(c-o.length))+_}}function MA(e,t,n,s){const a=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,s);return o(),a(),c}const BA=ku(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function NA(e,t,n,s){return(e.children.some(function(c){return BA(c)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function LA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}WS.peek=zA;function WS(e,t,n,s){const a=LA(n),o=n.enter("strong"),c=n.createTracker(s),f=c.move(a+a);let p=c.move(n.containerPhrasing(e,{after:a,before:f,...c.current()}));const h=p.charCodeAt(0),g=_u(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=_a(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=_u(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+_a(_));const y=c.move(a+a);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:g.outside},f+p+y}function zA(e,t,n){return n.options.strong||"*"}function OA(e,t,n,s){return n.safe(e.value,s)}function jA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function HA(e,t,n){const s=(qS(n)+(n.options.ruleSpaces?" ":"")).repeat(jA(n));return n.options.ruleSpaces?s.slice(0,-1):s}const YS={blockquote:aA,break:Fy,code:dA,definition:mA,emphasis:zS,hardBreak:Fy,heading:yA,html:OS,image:jS,imageReference:HS,inlineCode:US,link:IS,linkReference:FS,list:AA,listItem:RA,paragraph:MA,root:NA,strong:WS,text:OA,thematicBreak:HA};function UA(){return{enter:{table:PA,tableData:qy,tableHeader:qy,tableRow:FA},exit:{codeText:qA,table:IA,tableData:Cf,tableHeader:Cf,tableRow:Cf}}}function PA(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function IA(e){this.exit(e),this.data.inTable=void 0}function FA(e){this.enter({type:"tableRow",children:[]},e)}function Cf(e){this.exit(e)}function qy(e){this.enter({type:"tableCell",children:[]},e)}function qA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,WA));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function WA(e,t){return t==="|"?t:e}function YA(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,a=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
128
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:p,tableRow:f}};function c(y,x,k,L){return h(g(y,k,L),y.align)}function f(y,x,k,L){const R=_(y,k,L),$=h([R]);return $.slice(0,$.indexOf(`
129
+ `))}function p(y,x,k,L){const R=k.enter("tableCell"),$=k.enter("phrasing"),I=k.containerPhrasing(y,{...L,before:o,after:o});return $(),R(),I}function h(y,x){return sA(y,{align:x,alignDelimiters:s,padding:n,stringLength:a})}function g(y,x,k){const L=y.children;let R=-1;const $=[],I=x.enter("table");for(;++R<L.length;)$[R]=_(L[R],x,k);return I(),$}function _(y,x,k){const L=y.children;let R=-1;const $=[],I=x.enter("tableRow");for(;++R<L.length;)$[R]=p(L[R],y,x,k);return I(),$}function b(y,x,k){let L=YS.inlineCode(y,x,k);return k.stack.includes("tableCell")&&(L=L.replace(/\|/g,"\\$&")),L}}function VA(){return{exit:{taskListCheckValueChecked:Wy,taskListCheckValueUnchecked:Wy,paragraph:XA}}}function KA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:$A}}}function Wy(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function XA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=t.children;let o=-1,c;for(;++o<a.length;){const f=a[o];if(f.type==="paragraph"){c=f;break}}c===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function $A(e,t,n,s){const a=e.children[0],o=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(s);o&&f.move(c);let p=YS.listItem(e,t,n,{...s,...f.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+c}}function GA(){return[A3(),$3(),J3(),UA(),VA()]}function ZA(e){return{extensions:[D3(),G3(e),eA(),YA(e),KA()]}}const QA={tokenize:rD,partial:!0},VS={tokenize:sD,partial:!0},KS={tokenize:lD,partial:!0},XS={tokenize:aD,partial:!0},JA={tokenize:oD,partial:!0},$S={name:"wwwAutolink",tokenize:iD,previous:ZS},GS={name:"protocolAutolink",tokenize:nD,previous:QS},jn={name:"emailAutolink",tokenize:tD,previous:JS},hn={};function eD(){return{text:hn}}let Ur=48;for(;Ur<123;)hn[Ur]=jn,Ur++,Ur===58?Ur=65:Ur===91&&(Ur=97);hn[43]=jn;hn[45]=jn;hn[46]=jn;hn[95]=jn;hn[72]=[jn,GS];hn[104]=[jn,GS];hn[87]=[jn,$S];hn[119]=[jn,$S];function tD(e,t,n){const s=this;let a,o;return c;function c(_){return!xd(_)||!JS.call(s,s.previous)||Qd(s.events)?n(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return xd(_)?(e.consume(_),f):_===64?(e.consume(_),p):n(_)}function p(_){return _===46?e.check(JA,g,h)(_):_===45||_===95||Zt(_)?(o=!0,e.consume(_),p):g(_)}function h(_){return e.consume(_),a=!0,p}function g(_){return o&&a&&ri(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):n(_)}}function iD(e,t,n){const s=this;return a;function a(c){return c!==87&&c!==119||!ZS.call(s,s.previous)||Qd(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(QA,e.attempt(VS,e.attempt(KS,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function nD(e,t,n){const s=this;let a="",o=!1;return c;function c(_){return(_===72||_===104)&&QS.call(s,s.previous)&&!Qd(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):n(_)}function f(_){if(ri(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const b=a.toLowerCase();if(b==="http"||b==="https")return e.consume(_),p}return n(_)}function p(_){return _===47?(e.consume(_),o?h:(o=!0,p)):n(_)}function h(_){return _===null||pu(_)||et(_)||Kr(_)||xu(_)?n(_):e.attempt(VS,e.attempt(KS,g),n)(_)}function g(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function rD(e,t,n){let s=0;return a;function a(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),a):c===46&&s===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function sD(e,t,n){let s,a,o;return c;function c(h){return h===46||h===95?e.check(XS,p,f)(h):h===null||et(h)||Kr(h)||h!==45&&xu(h)?p(h):(o=!0,e.consume(h),c)}function f(h){return h===95?s=!0:(a=s,s=void 0),e.consume(h),c}function p(h){return a||s||!o?n(h):t(h)}}function lD(e,t){let n=0,s=0;return a;function a(c){return c===40?(n++,e.consume(c),a):c===41&&s<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(XS,t,o)(c):c===null||et(c)||Kr(c)?t(c):(e.consume(c),a)}function o(c){return c===41&&s++,e.consume(c),a}}function aD(e,t,n){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),o):f===93?(e.consume(f),a):f===60||f===null||et(f)||Kr(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||et(f)||Kr(f)?t(f):s(f)}function o(f){return ri(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):ri(f)?(e.consume(f),c):n(f)}}function oD(e,t,n){return s;function s(o){return e.consume(o),a}function a(o){return Zt(o)?n(o):t(o)}}function ZS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||et(e)}function QS(e){return!ri(e)}function JS(e){return!(e===47||xd(e))}function xd(e){return e===43||e===45||e===46||e===95||Zt(e)}function Qd(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const uD={tokenize:gD,partial:!0};function cD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:pD,continuation:{tokenize:mD},exit:_D}},text:{91:{name:"gfmFootnoteCall",tokenize:dD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hD,resolveTo:fD}}}}function hD(e,t,n){const s=this;let a=s.events.length;const o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;a--;){const p=s.events[a][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!c||!c._balanced)return n(p);const h=Qi(s.sliceSerialize({start:c.end,end:s.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function fD(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...f),e}function dD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o=0,c;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),p}function p(_){return _!==94?n(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(_){if(o>999||_===93&&!c||_===null||_===91||et(_))return n(_);if(_===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(Qi(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return et(_)||(c=!0),o++,e.consume(_),_===92?g:h}function g(_){return _===91||_===92||_===93?(e.consume(_),o++,h):h(_)}}function pD(e,t,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o,c=0,f;return p;function p(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(x)}function g(x){if(c>999||x===93&&!f||x===null||x===91||et(x))return n(x);if(x===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=Qi(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return et(x)||(f=!0),c++,e.consume(x),x===92?_:g}function _(x){return x===91||x===92||x===93?(e.consume(x),c++,g):g(x)}function b(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(o)||a.push(o),Ue(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function mD(e,t,n){return e.check(xa,t,e.attempt(uD,t,n))}function _D(e){e.exit("gfmFootnoteDefinition")}function gD(e,t,n){const s=this;return Ue(e,a,"gfmFootnoteDefinitionIndent",5);function a(o){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function vD(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:o,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(c,f){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let h=p;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[p][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[p][1].end)},_={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[p][1].start)},b=[["enter",g,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",_,f]],y=f.parser.constructs.insideSpan.null;y&&Mi(b,b.length,0,wu(y,c.slice(h+1,p),f)),Mi(b,b.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Mi(c,h-1,p-h+3,b),p=h+b.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,f,p){const h=this.previous,g=this.events;let _=0;return b;function b(x){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(x):(c.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const k=Vs(h);if(x===126)return _>1?p(x):(c.consume(x),_++,y);if(_<2&&!n)return p(x);const L=c.exit("strikethroughSequenceTemporary"),R=Vs(x);return L._open=!R||R===2&&!!k,L._close=!k||k===2&&!!R,f(x)}}}class yD{constructor(){this.map=[]}add(t,n,s){bD(this,t,n,s)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let a=s.pop();for(;a;){for(const o of a)t.push(o);a=s.pop()}this.map.length=0}}function bD(e,t,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...s);return}a+=1}e.map.push([t,n,s])}}function SD(e,t){let n=!1;const s=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=s.length-1;s[o]=s[o]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function xD(){return{flow:{null:{name:"table",tokenize:wD,resolveAll:CD}}}}function wD(e,t,n){const s=this;let a=0,o=0,c;return f;function f(F){let se=s.events.length-1;for(;se>-1;){const B=s.events[se][1].type;if(B==="lineEnding"||B==="linePrefix")se--;else break}const H=se>-1?s.events[se][1].type:null,E=H==="tableHead"||H==="tableRow"?O:p;return E===O&&s.parser.lazy[s.now().line]?n(F):E(F)}function p(F){return e.enter("tableHead"),e.enter("tableRow"),h(F)}function h(F){return F===124||(c=!0,o+=1),g(F)}function g(F){return F===null?n(F):ye(F)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),y):n(F):Le(F)?Ue(e,g,"whitespace")(F):(o+=1,c&&(c=!1,a+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),_(F)))}function _(F){return F===null||F===124||et(F)?(e.exit("data"),g(F)):(e.consume(F),F===92?b:_)}function b(F){return F===92||F===124?(e.consume(F),_):_(F)}function y(F){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(F):(e.enter("tableDelimiterRow"),c=!1,Le(F)?Ue(e,x,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):x(F))}function x(F){return F===45||F===58?L(F):F===124?(c=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),k):Y(F)}function k(F){return Le(F)?Ue(e,L,"whitespace")(F):L(F)}function L(F){return F===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),R):F===45?(o+=1,R(F)):F===null||ye(F)?Z(F):Y(F)}function R(F){return F===45?(e.enter("tableDelimiterFiller"),$(F)):Y(F)}function $(F){return F===45?(e.consume(F),$):F===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(F))}function I(F){return Le(F)?Ue(e,Z,"whitespace")(F):Z(F)}function Z(F){return F===124?x(F):F===null||ye(F)?!c||a!==o?Y(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):Y(F)}function Y(F){return n(F)}function O(F){return e.enter("tableRow"),J(F)}function J(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),J):F===null||ye(F)?(e.exit("tableRow"),t(F)):Le(F)?Ue(e,J,"whitespace")(F):(e.enter("data"),ce(F))}function ce(F){return F===null||F===124||et(F)?(e.exit("data"),J(F)):(e.consume(F),F===92?pe:ce)}function pe(F){return F===92||F===124?(e.consume(F),ce):ce(F)}}function CD(e,t){let n=-1,s=!0,a=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,p=0,h,g,_;const b=new yD;for(;++n<e.length;){const y=e[n],x=y[1];y[0]==="enter"?x.type==="tableHead"?(f=!1,p!==0&&(Yy(b,t,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},b.add(n,0,[["enter",h,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(s=!0,_=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},b.add(n,0,[["enter",g,t]])),a=x.type==="tableDelimiterRow"?2:g?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],_=Jo(b,t,o,a,void 0,_),o=[0,0,0,0]),c[2]=n)):x.type==="tableCellDivider"&&(s?s=!1:(o[1]!==0&&(c[0]=c[1],_=Jo(b,t,o,a,void 0,_)),o=c,c=[o[1],n,0,0])):x.type==="tableHead"?(f=!0,p=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],_=Jo(b,t,o,a,n,_)):c[1]!==0&&(_=Jo(b,t,c,a,n,_)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&Yy(b,t,p,h,g),b.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=SD(t.events,n))}return e}function Jo(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Fs(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=Fs(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Fs(t.events,n[2]),g=Fs(t.events,n[3]),_={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",_,t]]),s!==2){const b=t.events[n[2]],y=t.events[n[3]];if(b[1].end=Object.assign({},y[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,k=n[3]-n[2]-1;e.add(x,k,[])}}e.add(n[3]+1,0,[["exit",_,t]])}return a!==void 0&&(o.end=Object.assign({},Fs(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Yy(e,t,n,s,a){const o=[],c=Fs(t.events,n);a&&(a.end=Object.assign({},c),o.push(["exit",a,t])),s.end=Object.assign({},c),o.push(["exit",s,t]),e.add(n+1,0,o)}function Fs(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const kD={name:"tasklistCheck",tokenize:TD};function ED(){return{text:{91:kD}}}function TD(e,t,n){const s=this;return a;function a(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return et(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(p)}function f(p){return ye(p)?t(p):Le(p)?e.check({tokenize:AD},t,n)(p):n(p)}}function AD(e,t,n){return Ue(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function DD(e){return uS([eD(),cD(),vD(e),xD(),ED()])}const RD={};function MD(e){const t=this,n=e||RD,s=t.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),o=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(DD(n)),o.push(GA()),c.push(ZA(n))}const Pr=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Vy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Pr,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Pr],h2:[["className","sr-only"]],img:[...Pr,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Pr,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Pr],table:[...Pr],ul:[...Pr,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]},pr={}.hasOwnProperty;function BD(e,t){let n={type:"root",children:[]};const s={schema:t?{...Vy,...t}:Vy,stack:[]},a=e0(s,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function e0(e,t){if(t&&typeof t=="object"){const n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return ND(e,n);case"doctype":return LD(e,n);case"element":return zD(e,n);case"root":return OD(e,n);case"text":return jD(e,n)}}}function ND(e,t){if(e.schema.allowComments){const n=typeof t.value=="string"?t.value:"",s=n.indexOf("-->"),o={type:"comment",value:s<0?n:n.slice(0,s)};return Ca(o,t),o}}function LD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Ca(n,t),n}}function zD(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const s=t0(e,t.children),a=HD(e,t.properties);e.stack.pop();let o=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(o=!0,e.schema.ancestors&&pr.call(e.schema.ancestors,n))){const f=e.schema.ancestors[n];let p=-1;for(o=!1;++p<f.length;)e.stack.includes(f[p])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(n)?s:void 0;const c={type:"element",tagName:n,properties:a,children:s};return Ca(c,t),c}function OD(e,t){const s={type:"root",children:t0(e,t.children)};return Ca(s,t),s}function jD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return Ca(s,t),s}function t0(e,t){const n=[];if(Array.isArray(t)){const s=t;let a=-1;for(;++a<s.length;){const o=e0(e,s[a]);o&&(Array.isArray(o)?n.push(...o):n.push(o))}}return n}function HD(e,t){const n=e.stack[e.stack.length-1],s=e.schema.attributes,a=e.schema.required,o=s&&pr.call(s,n)?s[n]:void 0,c=s&&pr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(pr.call(f,h)){const g=f[h];let _=Ky(e,Xy(o,h),h,g);_==null&&(_=Ky(e,Xy(c,h),h,g)),_!=null&&(p[h]=_)}if(a&&pr.call(a,n)){const g=a[n];for(h in g)pr.call(g,h)&&!pr.call(p,h)&&(p[h]=g[h])}return p}function Ky(e,t,n,s){return t?Array.isArray(s)?UD(e,t,n,s):i0(e,t,n,s):void 0}function UD(e,t,n,s){let a=-1;const o=[];for(;++a<s.length;){const c=i0(e,t,n,s[a]);(typeof c=="number"||typeof c=="string")&&o.push(c)}return o}function i0(e,t,n,s){if(!(typeof s!="boolean"&&typeof s!="number"&&typeof s!="string")&&PD(e,n,s)){if(typeof t=="object"&&t.length>1){let a=!1,o=0;for(;++o<t.length;){const c=t[o];if(c&&typeof c=="object"&&"flags"in c){if(c.test(String(s))){a=!0;break}}else if(c===s){a=!0;break}}if(!a)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+s:s}}function PD(e,t,n){const s=e.schema.protocols&&pr.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!s||s.length===0)return!0;const a=String(n),o=a.indexOf(":"),c=a.indexOf("?"),f=a.indexOf("#"),p=a.indexOf("/");if(o<0||p>-1&&o>p||c>-1&&o>c||f>-1&&o>f)return!0;let h=-1;for(;++h<s.length;){const g=s[h];if(o===g.length&&a.slice(0,g.length)===g)return!0}return!1}function Ca(e,t){const n=nS(t);t.data&&(e.data=ma(t.data)),n&&(e.position=n)}function Xy(e,t){let n,s=-1;if(e)for(;++s<e.length;){const a=e[s],o=typeof a=="string"?a:a[0];if(o===t)return a;o==="data*"&&(n=a)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return n}function ID(e){return function(t){return BD(t,e)}}const kf=["Romance","Fantasy","Science Fiction","Mystery","Thriller","Horror","Adventure","Historical Fiction","Contemporary Lit","Humor","Poetry","Non-Fiction","Fanfiction","Short Story","Paranormal","Werewolf","LGBTQ+","New Adult","Teen Fiction","Diverse Lit","Others"],Ef=["English","Chinese","Korean","Japanese","Spanish","French","Hindi","Arabic","Portuguese","Russian","Others"];function FD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a}){const[o,c]=Q.useState(null),[f,p]=Q.useState(!1),[h,g]=Q.useState("preview"),[_,b]=Q.useState(""),[y,x]=Q.useState(!1),[k,L]=Q.useState(!1),[R,$]=Q.useState(!1),[I,Z]=Q.useState(null),[Y,O]=Q.useState(kf[0]),[J,ce]=Q.useState(Ef[0]),[pe,F]=Q.useState(!1),se=Q.useRef(null),H=Q.useRef(!1),E=Q.useRef(null),B=Q.useCallback(async()=>{if(!e||!t){c(null);return}const ae=`${e}/${t}`,le=E.current!==ae;le&&(E.current=ae);try{const ge=await n(`/api/stories/${e}/${t}`);if(ge.ok){const Ee=await ge.json();c(Ee),(le||!H.current)&&(b(Ee.content??""),le&&(L(!1),H.current=!1))}}catch{}},[e,t,n]);Q.useEffect(()=>{p(!0),B().finally(()=>p(!1))},[B]),Q.useEffect(()=>{if(!e||!t||h==="edit"&&k)return;const ae=setInterval(B,3e3);return()=>clearInterval(ae)},[e,t,B,h,k]),Q.useEffect(()=>{if(!e)return;let ae=!1;return n(`/api/stories/${e}/structure.md`).then(le=>le.ok?le.json():null).then(le=>{if(ae||!(le!=null&&le.content))return;const ge=le.content.match(/\*{0,2}genre\*{0,2}[:\s]+(.+)/i);if(ge){const Se=ge[1].replace(/\*+/g,"").trim(),Ze=kf.find(Fe=>Fe.toLowerCase()===Se.toLowerCase());Ze&&O(Ze)}const Ee=le.content.match(/\*{0,2}language\*{0,2}[:\s]+(.+)/i);if(Ee){const Se=Ee[1].replace(/\*+/g,"").trim(),Ze=Ef.find(Fe=>Fe.toLowerCase()===Se.toLowerCase());Ze&&ce(Ze)}}).catch(()=>{}),()=>{ae=!0}},[e,n]);const N=Q.useCallback(async()=>{if(!(!e||!t)){x(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:_})})).ok&&(L(!1),H.current=!1,c(le=>le&&{...le,content:_}))}catch{}x(!1)}},[e,t,n,_]);Q.useEffect(()=>{if(h!=="edit")return;const ae=le=>{(le.metaKey||le.ctrlKey)&&le.key==="s"&&(le.preventDefault(),N())};return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[h,N]),Q.useEffect(()=>{if((o==null?void 0:o.status)!=="published-not-indexed"||!o.publishedAt)return;const ae=new Date(o.publishedAt).getTime(),le=300*1e3,ge=()=>{const Se=Math.max(0,le-(Date.now()-ae));Z(Se)};ge();const Ee=setInterval(ge,1e3);return()=>clearInterval(Ee)},[o==null?void 0:o.status,o==null?void 0:o.publishedAt]);const A=I!==null&&I<=0,j=I!==null&&I>0?`${Math.floor(I/6e4)}:${String(Math.floor(I%6e4/1e3)).padStart(2,"0")}`:null;if(!e||!t)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:S.jsxs("div",{className:"text-center",children:[S.jsx("p",{className:"text-lg font-serif",children:"Select a file to preview"}),S.jsx("p",{className:"text-sm mt-1",children:"Click a story file in the sidebar"})]})});if(f&&!o)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const oe=(h==="edit"?_:(o==null?void 0:o.content)??"").length,T=t==="genesis.md",D=t?/^plot-\d+\.md$/.test(t):!1,V=(o==null?void 0:o.status)==="published"||(o==null?void 0:o.status)==="published-not-indexed",w=T||D?1e4:null,ie=!V&&w!==null&&oe>w;return S.jsxs("div",{className:"h-full flex flex-col",children:[S.jsxs("div",{className:"border-b border-border",children:[S.jsxs("div",{className:"px-3 py-1.5 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-muted",children:[S.jsxs("span",{children:[e,"/",t]}),(o==null?void 0:o.status)==="published"&&S.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(o==null?void 0:o.status)==="published-not-indexed"&&S.jsx("span",{className:"text-amber-700 font-medium",title:o.indexError,children:"Published (not indexed)"}),(o==null?void 0:o.status)==="pending"&&S.jsx("span",{className:"text-amber-700 font-medium",children:"Pending"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("span",{className:`text-xs font-mono ${ie?"text-error font-medium":"text-muted"}`,children:[oe.toLocaleString(),w!==null?`/${w.toLocaleString()}`:" chars"]}),ie&&S.jsxs("span",{className:"text-error text-xs font-medium",children:[(oe-w).toLocaleString()," over limit"]})]})]}),S.jsxs("div",{className:"flex px-3 gap-1",children:[S.jsx("button",{onClick:()=>g("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),S.jsxs("button",{onClick:()=>g("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${h==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",k&&S.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),h==="preview"?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:o!=null&&o.content?S.jsx("div",{className:"prose max-w-none",children:S.jsx(_3,{remarkPlugins:[T3,MD],rehypePlugins:[ID],children:o.content})}):S.jsx("p",{className:"text-muted italic",children:"No content"})}):S.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",style:{background:"var(--paper-bg)"},children:[S.jsx("textarea",{ref:se,value:_,onChange:ae=>{b(ae.target.value),L(!0),H.current=!0},className:"flex-1 min-h-0 w-full resize-none px-4 py-3 text-sm leading-relaxed focus:outline-none",style:{fontFamily:'"Geist Mono", ui-monospace, monospace',background:"var(--paper-bg)",color:"var(--text)"},spellCheck:!1}),S.jsxs("div",{className:"px-3 py-1.5 border-t border-border flex items-center justify-between",children:[S.jsx("span",{className:"text-xs text-muted",children:k?"Unsaved changes":"No changes"}),S.jsx("button",{onClick:N,disabled:!k||y,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:y?"Saving...":"Save"})]})]}),S.jsx("div",{className:"px-3 py-2 border-t border-border flex items-center justify-between",children:t==="structure.md"?S.jsx("p",{className:"text-muted text-xs italic",children:"This is your story outline — not publishable. Ask AI to write the genesis next."}):(o==null?void 0:o.status)==="published-not-indexed"?S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-amber-700",children:"Published on-chain but not indexed on PlotLink"}),!A&&S.jsx("button",{onClick:async()=>{if(!(!e||!t||!o.txHash)){$(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:o.txHash,content:o.content,storylineId:o.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:o.txHash,storylineId:o.storylineId,contentCid:"",gasCost:""})}),B())}catch{}$(!1)}},disabled:R,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:R?"Retrying...":`Retry Index${j?` (${j})`:""}`}),D&&S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,Y,J,pe)),disabled:!!a,className:"px-3 py-1 border border-border text-xs rounded hover:bg-surface disabled:opacity-50",children:a===t?"Publishing...":"Retry Publish"}),o.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),S.jsx("p",{className:"text-muted text-xs",children:A?D?"Index window expired. Use Retry Publish to create a new on-chain tx.":"Index window expired. Contact support or re-publish manually.":D?"Try Retry Index first (available for 5 min after publish). If that fails, Retry Publish creates a new on-chain tx.":"Retry Index is available for 5 min after publish."}),o.indexError&&S.jsx("p",{className:"text-error text-xs",children:o.indexError})]}):(o==null?void 0:o.status)==="published"?S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-green-700",children:"Published"}),o.storylineId&&S.jsx("a",{href:(()=>{var ge;const ae=`https://plotlink.xyz/story/${o.storylineId}`;if(!D)return ae;const le=o.plotIndex!=null&&o.plotIndex>0?o.plotIndex:parseInt(((ge=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:ge[1])??"1");return`${ae}/${le}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),o.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}):S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[T&&S.jsxs(S.Fragment,{children:[S.jsx("select",{value:Y,onChange:ae=>O(ae.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:kf.map(ae=>S.jsx("option",{value:ae,children:ae},ae))}),S.jsx("select",{value:J,onChange:ae=>ce(ae.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:Ef.map(ae=>S.jsx("option",{value:ae,children:ae},ae))})]}),S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,Y,J,pe)),disabled:!!a||ie,className:"px-4 py-1.5 bg-accent text-white text-sm rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:a===t?"Publishing...":"Publish to PlotLink"}),ie&&S.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]}),T&&S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:pe,onChange:ae=>F(ae.target.checked),className:"rounded border-border"}),"This story contains adult content (18+)"]}),pe&&S.jsx("span",{className:"text-xs text-amber-600",children:"Adult content will be hidden from the default browse view."})]})]})})]})}const n0="plotlink-panel-ratio",qD=.6,$y=300,Tf=224,Af=6;function WD(){try{const e=localStorage.getItem(n0);if(e){const t=parseFloat(e);if(t>0&&t<1)return t}}catch{}return qD}function Gy(e,t){if(t<=0)return e;const n=$y/t,s=1-$y/t;return n>=s?.5:Math.min(s,Math.max(n,e))}function YD({token:e,authFetch:t}){const[n,s]=Q.useState(null),[a,o]=Q.useState(null),[c,f]=Q.useState(null),[p,h]=Q.useState(""),[g,_]=Q.useState(WD),[b,y]=Q.useState([]),x=Q.useRef(new Set),k=Q.useRef(null),L=Q.useRef(null),R=Q.useRef(!1);Q.useEffect(()=>{try{localStorage.setItem(n0,String(g))}catch{}},[g]),Q.useEffect(()=>{const H=()=>{if(!L.current)return;const E=L.current.getBoundingClientRect().width-Tf-Af;_(B=>Gy(B,E))};return window.addEventListener("resize",H),H(),()=>window.removeEventListener("resize",H)},[]);const $=Q.useCallback(()=>{const H=`_new_${Date.now()}`;y(E=>[...E,H]),s(H),o(null)},[]);Q.useEffect(()=>{if(b.length===0)return;const H=setInterval(async()=>{try{const E=await t("/api/stories");if(!E.ok)return;const B=await E.json(),N=new Set(B.stories.filter(A=>A.name!=="_example").map(A=>A.name));for(const A of N)if(!x.current.has(A)&&b.length>0){const j=b[0];let P=!1;k.current&&(P=await k.current(j,A).catch(()=>!1)),P&&y(oe=>oe.slice(1)),s(A),o(null)}x.current=N}catch{}},3e3);return()=>clearInterval(H)},[t,b]),Q.useEffect(()=>{t("/api/stories").then(H=>{if(H.ok)return H.json()}).then(H=>{H!=null&&H.stories&&(x.current=new Set(H.stories.filter(E=>E.name!=="_example").map(E=>E.name)))}).catch(()=>{})},[t]);const I=Q.useCallback((H,E)=>{s(H),o(E)},[]),Z=Q.useRef(null),Y=Q.useCallback(async H=>{var E,B,N,A;Z.current=H,s(H),o(null);try{const j=await t(`/api/stories/${H}`);if(j.ok&&Z.current===H){const oe=(await j.json()).files||[],D=((E=oe.map(V=>{var w;return{file:V.file,num:(w=V.file.match(/^plot-(\d+)\.md$/))==null?void 0:w[1]}}).filter(V=>V.num!=null).sort((V,w)=>parseInt(w.num)-parseInt(V.num))[0])==null?void 0:E.file)??((B=oe.find(V=>V.file==="genesis.md"))==null?void 0:B.file)??((N=oe.find(V=>V.file==="structure.md"))==null?void 0:N.file)??((A=oe[0])==null?void 0:A.file);D&&Z.current===H&&o(D)}}catch{}},[t]),O=Q.useCallback(H=>{H.preventDefault(),R.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const E=N=>{if(!R.current||!L.current)return;const A=L.current.getBoundingClientRect(),j=A.width-Tf-Af,P=N.clientX-A.left-Tf;_(Gy(P/j,j))},B=()=>{R.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",B)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",B)},[]),J=Q.useCallback(async(H,E,B,N,A)=>{var j;f(E),h("Reading file...");try{const P=await t(`/api/stories/${H}/${E}`);if(!P.ok)throw new Error("Failed to read file");const oe=await P.json(),T=oe.content.match(/^#\s+(.+)$/m),D=T?T[1].slice(0,60):E.replace(".md","");let V;if(E.match(/^plot-\d+\.md$/)){try{const le=await t(`/api/stories/${H}`);if(le.ok){const Ee=(await le.json()).files.find(Se=>Se.file==="genesis.md"&&Se.storylineId);V=Ee==null?void 0:Ee.storylineId}}catch{}if(!V){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const w=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:H,fileName:E,title:D,content:oe.content,genre:B,language:N,isNsfw:A,storylineId:V})});if(!w.ok){const le=await w.json();throw new Error(le.error||"Publish failed")}const ie=(j=w.body)==null?void 0:j.getReader(),ae=new TextDecoder;if(ie)for(;;){const{done:le,value:ge}=await ie.read();if(le)break;const Se=ae.decode(ge).split(`
130
+ `).filter(Ze=>Ze.startsWith("data: "));for(const Ze of Se)try{const Fe=JSON.parse(Ze.slice(6));Fe.step&&h(Fe.message||Fe.step),Fe.step==="done"&&Fe.txHash&&await t(`/api/stories/${H}/${E}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:Fe.txHash,storylineId:Fe.storylineId,plotIndex:Fe.plotIndex,contentCid:Fe.contentCid,gasCost:Fe.gasCost,indexError:Fe.indexError})})}catch{}}h("Published!")}catch(P){const oe=P instanceof Error?P.message:"Publish failed";h(`Error: ${oe}`)}finally{setTimeout(()=>{f(null),h("")},3e3)}},[t]),ce=Q.useCallback(H=>{H.startsWith("_new_")&&y(E=>E.filter(B=>B!==H))},[]),[pe,F]=Q.useState(new Set);Q.useEffect(()=>{t("/api/stories").then(E=>E.ok?E.json():null).then(E=>{E!=null&&E.stories&&F(new Set(E.stories.filter(B=>B.hasStructure).map(B=>B.name)))}).catch(()=>{});const H=setInterval(async()=>{try{const E=await t("/api/stories");if(E.ok){const B=await E.json();F(new Set(B.stories.filter(N=>N.hasStructure).map(N=>N.name)))}}catch{}},5e3);return()=>clearInterval(H)},[t]);const se=Q.useCallback(H=>{n===H&&(s(null),o(null))},[n]);return S.jsxs("div",{ref:L,className:"h-[calc(100vh-3.5rem)] flex",children:[S.jsx("div",{className:"w-56 border-r border-border flex-shrink-0",children:S.jsx(jx,{authFetch:t,selectedStory:n,selectedFile:a,onSelectFile:I,onNewStory:$,untitledSessions:b})}),S.jsx("div",{className:"min-w-0 border-r border-border",style:{flex:`${g} 0 0`},children:S.jsx(lk,{token:e,storyName:n,authFetch:t,onSelectStory:Y,onDestroySession:ce,onArchiveStory:se,confirmedStories:pe,renameRef:k})}),S.jsx("div",{onMouseDown:O,className:"flex-shrink-0 flex items-center justify-center hover:bg-border/50 transition-colors",style:{width:Af,cursor:"col-resize",background:"var(--border)"},children:S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}}),S.jsx("div",{className:"w-0.5 h-0.5 rounded-full",style:{background:"var(--text-muted)"}})]})}),S.jsxs("div",{className:"min-w-0 flex flex-col",style:{flex:`${1-g} 0 0`},children:[S.jsx(FD,{storyName:n,fileName:a,authFetch:t,onPublish:J,publishingFile:c}),p&&S.jsx("div",{className:"px-3 py-1.5 bg-surface border-t border-border text-xs text-muted",children:p})]})]})}function VD({token:e,onComplete:t}){const[n,s]=Q.useState(!1),[a,o]=Q.useState(null),[c,f]=Q.useState(!1),p=async()=>{s(!0),o(null);try{const h=await fetch("/api/wallet/create",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=await h.json();if(!h.ok)throw new Error(g.error||"Wallet creation failed");f(!0)}catch(h){o(h instanceof Error?h.message:"Wallet creation failed")}s(!1)};return Q.useEffect(()=>{p()},[]),S.jsxs("div",{className:"mx-auto max-w-sm p-6 text-center",children:[S.jsx("h2",{className:"text-accent mb-1 text-lg font-bold",children:"Wallet Setup"}),S.jsx("p",{className:"text-muted mb-6 text-xs",children:"creating your OWS wallet for on-chain publishing"}),n&&S.jsx("p",{className:"text-accent text-sm",children:"creating wallet..."}),a&&S.jsxs("div",{className:"space-y-4",children:[S.jsx("div",{className:"rounded border border-red-700/30 p-3 text-xs text-red-700",children:a}),S.jsx("button",{onClick:p,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"retry"})]}),c&&S.jsxs("div",{className:"space-y-4",children:[S.jsx("div",{className:"text-accent text-2xl",children:"✓"}),S.jsx("p",{className:"text-foreground text-sm font-medium",children:"wallet created"}),S.jsx("button",{onClick:t,className:"border-accent text-accent hover:bg-accent/10 w-full rounded border px-4 py-2 text-sm font-medium transition-colors",children:"continue"})]})]})}function KD({token:e,onLogout:t}){const[n,s]=Q.useState("home"),[a,o]=Q.useState(0),c=Q.useCallback(async(f,p)=>fetch(f,{...p,headers:{...(p==null?void 0:p.headers)||{},Authorization:`Bearer ${e}`}}),[e]);return Q.useEffect(()=>{async function f(){try{if(!(await(await c("/api/wallet")).json()).exists){s("wallet-setup");return}const g=await c("/api/stories");if(g.ok){const _=await g.json();o(_.stories.filter(b=>b.name!=="_example").length)}}catch{}}f()},[e]),S.jsxs("div",{className:"flex h-screen flex-col",children:[S.jsxs("header",{className:"border-border flex h-14 items-center justify-between border-b px-4 flex-shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("button",{onClick:()=>{n!=="wallet-setup"&&s("home")},className:"flex items-center gap-2 hover:opacity-80",children:S.jsx("span",{className:"text-accent text-sm font-bold tracking-tight",children:"PlotLink OWS"})}),S.jsx("span",{className:"text-muted text-[10px] uppercase tracking-wider",children:"writer"})]}),n!=="wallet-setup"&&S.jsxs("nav",{className:"flex items-center gap-4",children:[S.jsx("button",{onClick:()=>s("stories"),className:`text-xs transition-colors ${n==="stories"?"text-accent":"text-muted hover:text-foreground"}`,children:"stories"}),S.jsx("button",{onClick:()=>s("dashboard"),className:`text-xs transition-colors ${n==="dashboard"?"text-accent":"text-muted hover:text-foreground"}`,children:"dashboard"}),S.jsx("button",{onClick:()=>s("settings"),className:`text-xs transition-colors ${n==="settings"?"text-accent":"text-muted hover:text-foreground"}`,children:"settings"}),S.jsx("button",{onClick:t,className:"text-muted hover:text-foreground text-xs transition-colors",children:"logout"})]})]}),S.jsxs("main",{className:"flex-1 min-h-0",children:[n==="home"&&S.jsxs("div",{className:"mx-auto max-w-lg space-y-6 p-8",children:[S.jsxs("div",{className:"text-center space-y-2",children:[S.jsx("h1",{className:"text-2xl font-serif text-foreground",children:"Write. Publish. Earn."}),S.jsx("p",{className:"text-muted text-sm",children:"Claude CLI writes stories. You publish them on-chain."})]}),S.jsxs("div",{className:"text-center space-y-3",children:[S.jsx("button",{onClick:()=>s("stories"),className:"bg-accent text-white hover:bg-accent-dim px-6 py-2.5 rounded text-sm font-medium transition-colors",children:"Start Writing"}),a>0&&S.jsxs("p",{className:"text-muted text-xs",children:[a," ",a===1?"story":"stories"," in progress"]})]}),S.jsxs("div",{className:"rounded border border-border p-4 space-y-2 text-xs text-muted",children:[S.jsx("p",{className:"font-medium text-foreground text-sm",children:"How it works"}),S.jsxs("ol",{className:"space-y-1.5 list-decimal list-inside",children:[S.jsxs("li",{children:["Open the ",S.jsx("strong",{children:"Stories"})," tab — Claude CLI launches in the terminal"]}),S.jsx("li",{children:"Tell Claude your story idea — it brainstorms, outlines, and writes"}),S.jsx("li",{children:"Review the live preview as Claude creates files"}),S.jsxs("li",{children:["Click ",S.jsx("strong",{children:"Publish"})," to put your story on-chain"]}),S.jsxs("li",{children:["Earn 5% royalties on every trade at ",S.jsx("a",{href:"https://plotlink.xyz",target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"plotlink.xyz"})]})]})]}),S.jsx("div",{className:"text-center",children:S.jsx("a",{href:"https://github.com/realproject7/plotlink-ows#-wallet-setup",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted hover:text-accent underline transition-colors",children:"Wallet Setup Guide"})}),S.jsx(eb,{token:e})]}),n==="stories"&&S.jsx(YD,{token:e,authFetch:c}),n==="dashboard"&&S.jsx(Lx,{token:e}),n==="wallet-setup"&&S.jsx(VD,{token:e,onComplete:()=>s("home")}),n==="settings"&&S.jsx(Bx,{token:e,onLogout:t})]})]})}function XD(){const[e,t]=Q.useState(()=>localStorage.getItem("ows-token")),[n,s]=Q.useState(null),[a,o]=Q.useState(!0);Q.useEffect(()=>{fetch("/api/auth/status").then(h=>h.json()).then(h=>s(h.configured)).catch(()=>s(null))},[]),Q.useEffect(()=>{if(!e){o(!1);return}fetch("/api/auth/verify",{headers:{Authorization:`Bearer ${e}`}}).then(h=>{h.ok||(localStorage.removeItem("ows-token"),t(null))}).catch(()=>{localStorage.removeItem("ows-token"),t(null)}).finally(()=>o(!1))},[e]);const c=async h=>{try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),null):_.error||"Login failed"}catch{return"Cannot connect to server"}},f=async h=>{try{const g=await fetch("/api/auth/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({passphrase:h})}),_=await g.json();return g.ok?(localStorage.setItem("ows-token",_.token),t(_.token),s(!0),null):_.error||"Setup failed"}catch{return"Cannot connect to server"}},p=()=>{localStorage.removeItem("ows-token"),t(null)};return a||n===null?S.jsx("div",{className:"flex h-screen items-center justify-center",children:S.jsx("span",{className:"text-muted text-sm",children:"connecting..."})}):n?e?S.jsx(KD,{token:e,onLogout:p}):S.jsx(Rx,{onLogin:c}):S.jsx(Mx,{onSetup:f})}Dx.createRoot(document.getElementById("root")).render(S.jsx(Sx.StrictMode,{children:S.jsx(XD,{})}));