plotlink-ows 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/lib/generate-claude-md.ts +139 -0
- package/app/lib/publish.ts +35 -0
- package/app/routes/publish.ts +36 -1
- package/app/server.ts +4 -0
- package/app/web/components/PreviewPanel.tsx +114 -0
- package/app/web/dist/assets/{index-9T4gFznD.js → index-ClPr6pbO.js} +40 -40
- package/app/web/dist/assets/{index-CXg4YULp.css → index-QJp_wjOl.css} +1 -1
- package/app/web/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function ku(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kh={exports:{}},na={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -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
|
|
9
|
+
*/var Zg;function vx(){if(Zg)return na;Zg=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 na.Fragment=t,na.jsx=n,na.jsxs=n,na}var Qg;function yx(){return Qg||(Qg=1,Kh.exports=vx()),Kh.exports}var S=yx(),Xh={exports:{}},Ae={};/**
|
|
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
|
|
17
|
+
*/var Jg;function bx(){if(Jg)return Ae;Jg=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 M(D,X,C){this.props=D,this.context=X,this.refs=L,this.updater=C||x}M.prototype.isReactComponent={},M.prototype.setState=function(D,X){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,X,"setState")},M.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function $(){}$.prototype=M.prototype;function I(D,X,C){this.props=D,this.context=X,this.refs=L,this.updater=C||x}var Z=I.prototype=new $;Z.constructor=I,k(Z,M.prototype),Z.isPureReactComponent=!0;var W=Array.isArray;function O(){}var te={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function me(D,X,C){var Q=C.ref;return{$$typeof:e,type:D,key:X,ref:Q!==void 0?Q:null,props:C}}function U(D,X){return me(D.type,X,D.props)}function se(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function K(D){var X={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(C){return X[C]})}var B=/\/+/g;function A(D,X){return typeof D=="object"&&D!==null&&D.key!=null?K(""+D.key):X.toString(36)}function R(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(X){D.status==="pending"&&(D.status="fulfilled",D.value=X)},function(X){D.status==="pending"&&(D.status="rejected",D.reason=X)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function T(D,X,C,Q,fe){var de=typeof D;(de==="undefined"||de==="boolean")&&(D=null);var Ce=!1;if(D===null)Ce=!0;else switch(de){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(D.$$typeof){case e:case t:Ce=!0;break;case g:return Ce=D._init,T(Ce(D._payload),X,C,Q,fe)}}if(Ce)return fe=fe(D),Ce=Q===""?"."+A(D,0):Q,W(fe)?(C="",Ce!=null&&(C=Ce.replace(B,"$&/")+"/"),T(fe,X,C,"",function(st){return st})):fe!=null&&(se(fe)&&(fe=U(fe,C+(fe.key==null||D&&D.key===fe.key?"":(""+fe.key).replace(B,"$&/")+"/")+Ce)),X.push(fe)),1;Ce=0;var ze=Q===""?".":Q+":";if(W(D))for(var Te=0;Te<D.length;Te++)Q=D[Te],de=ze+A(Q,Te),Ce+=T(Q,X,C,de,fe);else if(Te=y(D),typeof Te=="function")for(D=Te.call(D),Te=0;!(Q=D.next()).done;)Q=Q.value,de=ze+A(Q,Te++),Ce+=T(Q,X,C,de,fe);else if(de==="object"){if(typeof D.then=="function")return T(R(D),X,C,Q,fe);throw X=String(D),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function j(D,X,C){if(D==null)return D;var Q=[],fe=0;return T(D,Q,"","",function(de){return X.call(C,de,fe++)}),Q}function H(D){if(D._status===-1){var X=D._result;X=X(),X.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=X)}if(D._status===1)return D._result.default;throw D._result}var le=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=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(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},E={map:j,forEach:function(D,X,C){j(D,function(){X.apply(this,arguments)},C)},count:function(D){var X=0;return j(D,function(){X++}),X},toArray:function(D){return j(D,function(X){return X})||[]},only:function(D){if(!se(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ae.Activity=_,Ae.Children=E,Ae.Component=M,Ae.Fragment=n,Ae.Profiler=a,Ae.PureComponent=I,Ae.StrictMode=s,Ae.Suspense=p,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=te,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(D){return te.H.useMemoCache(D)}},Ae.cache=function(D){return function(){return D.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(D,X,C){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Q=k({},D.props),fe=D.key;if(X!=null)for(de in X.key!==void 0&&(fe=""+X.key),X)!oe.call(X,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&X.ref===void 0||(Q[de]=X[de]);var de=arguments.length-2;if(de===1)Q.children=C;else if(1<de){for(var Ce=Array(de),ze=0;ze<de;ze++)Ce[ze]=arguments[ze+2];Q.children=Ce}return me(D.type,fe,Q)},Ae.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},Ae.createElement=function(D,X,C){var Q,fe={},de=null;if(X!=null)for(Q in X.key!==void 0&&(de=""+X.key),X)oe.call(X,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(fe[Q]=X[Q]);var Ce=arguments.length-2;if(Ce===1)fe.children=C;else if(1<Ce){for(var ze=Array(Ce),Te=0;Te<Ce;Te++)ze[Te]=arguments[Te+2];fe.children=ze}if(D&&D.defaultProps)for(Q in Ce=D.defaultProps,Ce)fe[Q]===void 0&&(fe[Q]=Ce[Q]);return me(D,de,fe)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(D){return{$$typeof:f,render:D}},Ae.isValidElement=se,Ae.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:H}},Ae.memo=function(D,X){return{$$typeof:h,type:D,compare:X===void 0?null:X}},Ae.startTransition=function(D){var X=te.T,C={};te.T=C;try{var Q=D(),fe=te.S;fe!==null&&fe(C,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(O,le)}catch(de){le(de)}finally{X!==null&&C.types!==null&&(X.types=C.types),te.T=X}},Ae.unstable_useCacheRefresh=function(){return te.H.useCacheRefresh()},Ae.use=function(D){return te.H.use(D)},Ae.useActionState=function(D,X,C){return te.H.useActionState(D,X,C)},Ae.useCallback=function(D,X){return te.H.useCallback(D,X)},Ae.useContext=function(D){return te.H.useContext(D)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(D,X){return te.H.useDeferredValue(D,X)},Ae.useEffect=function(D,X){return te.H.useEffect(D,X)},Ae.useEffectEvent=function(D){return te.H.useEffectEvent(D)},Ae.useId=function(){return te.H.useId()},Ae.useImperativeHandle=function(D,X,C){return te.H.useImperativeHandle(D,X,C)},Ae.useInsertionEffect=function(D,X){return te.H.useInsertionEffect(D,X)},Ae.useLayoutEffect=function(D,X){return te.H.useLayoutEffect(D,X)},Ae.useMemo=function(D,X){return te.H.useMemo(D,X)},Ae.useOptimistic=function(D,X){return te.H.useOptimistic(D,X)},Ae.useReducer=function(D,X,C){return te.H.useReducer(D,X,C)},Ae.useRef=function(D){return te.H.useRef(D)},Ae.useState=function(D){return te.H.useState(D)},Ae.useSyncExternalStore=function(D,X,C){return te.H.useSyncExternalStore(D,X,C)},Ae.useTransition=function(){return te.H.useTransition()},Ae.version="19.2.3",Ae}var ev;function Ed(){return ev||(ev=1,Xh.exports=bx()),Xh.exports}var V=Ed();const Sx=ku(V);var Gh={exports:{}},ra={},$h={exports:{}},Zh={};/**
|
|
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
|
|
25
|
+
*/var tv;function xx(){return tv||(tv=1,(function(e){function t(T,j){var H=T.length;T.push(j);e:for(;0<H;){var le=H-1>>>1,E=T[le];if(0<a(E,j))T[le]=j,T[H]=E,H=le;else break e}}function n(T){return T.length===0?null:T[0]}function s(T){if(T.length===0)return null;var j=T[0],H=T.pop();if(H!==j){T[0]=H;e:for(var le=0,E=T.length,D=E>>>1;le<D;){var X=2*(le+1)-1,C=T[X],Q=X+1,fe=T[Q];if(0>a(C,H))Q<E&&0>a(fe,C)?(T[le]=fe,T[Q]=H,le=Q):(T[le]=C,T[X]=H,le=X);else if(Q<E&&0>a(fe,H))T[le]=fe,T[Q]=H,le=Q;else break e}}return j}function a(T,j){var H=T.sortIndex-j.sortIndex;return H!==0?H:T.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,M=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function Z(T){for(var j=n(h);j!==null;){if(j.callback===null)s(h);else if(j.startTime<=T)s(h),j.sortIndex=j.expirationTime,t(p,j);else break;j=n(h)}}function W(T){if(k=!1,Z(T),!x)if(n(p)!==null)x=!0,O||(O=!0,K());else{var j=n(h);j!==null&&R(W,j.startTime-T)}}var O=!1,te=-1,oe=5,me=-1;function U(){return L?!0:!(e.unstable_now()-me<oe)}function se(){if(L=!1,O){var T=e.unstable_now();me=T;var j=!0;try{e:{x=!1,k&&(k=!1,$(te),te=-1),y=!0;var H=b;try{t:{for(Z(T),_=n(p);_!==null&&!(_.expirationTime>T&&U());){var le=_.callback;if(typeof le=="function"){_.callback=null,b=_.priorityLevel;var E=le(_.expirationTime<=T);if(T=e.unstable_now(),typeof E=="function"){_.callback=E,Z(T),j=!0;break t}_===n(p)&&s(p),Z(T)}else s(p);_=n(p)}if(_!==null)j=!0;else{var D=n(h);D!==null&&R(W,D.startTime-T),j=!1}}break e}finally{_=null,b=H,y=!1}j=void 0}}finally{j?K():O=!1}}}var K;if(typeof I=="function")K=function(){I(se)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,A=B.port2;B.port1.onmessage=se,K=function(){A.postMessage(null)}}else K=function(){M(se,0)};function R(T,j){te=M(function(){T(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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(T){switch(b){case 1:case 2:case 3:var j=3;break;default:j=b}var H=b;b=j;try{return T()}finally{b=H}},e.unstable_requestPaint=function(){L=!0},e.unstable_runWithPriority=function(T,j){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var H=b;b=T;try{return j()}finally{b=H}},e.unstable_scheduleCallback=function(T,j,H){var le=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?le+H:le):H=le,T){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=H+E,T={id:g++,callback:j,priorityLevel:T,startTime:H,expirationTime:E,sortIndex:-1},H>le?(T.sortIndex=H,t(h,T),n(p)===null&&T===n(h)&&(k?($(te),te=-1):k=!0,R(W,H-le))):(T.sortIndex=E,t(p,T),x||y||(x=!0,O||(O=!0,K()))),T},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(T){var j=b;return function(){var H=b;b=j;try{return T.apply(this,arguments)}finally{b=H}}}})(Zh)),Zh}var iv;function wx(){return iv||(iv=1,$h.exports=xx()),$h.exports}var Qh={exports:{}},ni={};/**
|
|
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
|
|
33
|
+
*/var nv;function Cx(){if(nv)return ni;nv=1;var e=Ed();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 ni.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,ni.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)},ni.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()}},ni.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))},ni.prefetchDNS=function(p){typeof p=="string"&&s.d.D(p)},ni.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})}},ni.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)},ni.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})}},ni.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)},ni.requestFormReset=function(p){s.d.r(p)},ni.unstable_batchedUpdates=function(p,h){return p(h)},ni.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},ni.useFormStatus=function(){return c.H.useHostTransitionStatus()},ni.version="19.2.3",ni}var rv;function kx(){if(rv)return Qh.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(),Qh.exports=Cx(),Qh.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
|
|
41
|
+
*/var sv;function Ex(){if(sv)return ra;sv=1;var e=wx(),t=Ed(),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,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"),k=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),I=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),me=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),se=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=se&&i[se]||i["@@iterator"],typeof i=="function"?i:null)}var B=Symbol.for("react.client.reference");function A(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===B?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case M:return"Profiler";case L:return"StrictMode";case W:return"Suspense";case O:return"SuspenseList";case me: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 te:return r=i.displayName||null,r!==null?r:A(i.type)||"Memo";case oe:r=i._payload,i=i._init;try{return A(i(r))}catch{}}return null}var R=Array.isArray,T=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,H={pending:!1,data:null,method:null,action:null},le=[],E=-1;function D(i){return{current:i}}function X(i){0>E||(i.current=le[E],le[E]=null,E--)}function C(i,r){E++,le[E]=i.current,i.current=r}var Q=D(null),fe=D(null),de=D(null),Ce=D(null);function ze(i,r){switch(C(de,r),C(fe,i),C(Q,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?bg(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=bg(r),i=Sg(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}X(Q),C(Q,i)}function Te(){X(Q),X(fe),X(de)}function st(i){i.memoizedState!==null&&C(Ce,i);var r=Q.current,l=Sg(r,i.type);r!==l&&(C(fe,i),C(Q,l))}function Xe(i){fe.current===i&&(X(Q),X(fe)),Ce.current===i&&(X(Ce),Jl._currentValue=H)}var xt,xe;function Xt(i){if(xt===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);xt=r&&r[1]||"",xe=-1<l.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+xt+i+xe}var
|
|
43
|
+
`+xt+i+xe}var xn=!1;function wn(i,r){if(!i||xn)return"";xn=!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(G){var Y=G}Reflect.construct(i,[],ne)}else{try{ne.call()}catch(G){Y=G}i.call(ne.prototype)}}else{try{throw Error()}catch(G){Y=G}(ne=i())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(G){if(G&&Y&&typeof G.stack=="string")return[G.stack,Y.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 N=v.split(`
|
|
44
44
|
`),q=w.split(`
|
|
45
45
|
`);for(d=u=0;u<N.length&&!N[u].includes("DetermineComponentFrameRoot");)u++;for(;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;if(u===N.length||d===q.length)for(u=N.length-1,d=q.length-1;1<=u&&0<=d&&N[u]!==q[d];)d--;for(;1<=u&&0<=d;u--,d--)if(N[u]!==q[d]){if(u!==1||d!==1)do if(u--,d--,0>d||N[u]!==q[d]){var J=`
|
|
46
|
-
`+N[u].replace(" at new "," at ");return i.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",i.displayName)),J}while(1<=u&&0<=d);break}}}finally{
|
|
46
|
+
`+N[u].replace(" at new "," at ");return i.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",i.displayName)),J}while(1<=u&&0<=d);break}}}finally{xn=!1,Error.prepareStackTrace=l}return(l=i?i.displayName||i.name:"")?Xt(l):""}function hs(i,r){switch(i.tag){case 26:case 27:case 5:return Xt(i.type);case 16:return Xt("Lazy");case 13:return i.child!==r&&r!==null?Xt("Suspense Fallback"):Xt("Suspense");case 19:return Xt("SuspenseList");case 0:case 15:return wn(i.type,!1);case 11:return wn(i.type.render,!1);case 1:return wn(i.type,!0);case 31:return Xt("Activity");default:return""}}function Br(i){try{var r="",l=null;do r+=hs(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 qn=Object.prototype.hasOwnProperty,mn=e.unstable_scheduleCallback,Wn=e.unstable_cancelCallback,Ma=e.unstable_shouldYield,Er=e.unstable_requestPaint,vt=e.unstable_now,_n=e.unstable_getCurrentPriorityLevel,ee=e.unstable_ImmediatePriority,ce=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,le=e.unstable_LowPriority,me=e.unstable_IdlePriority,Te=e.log,Qe=e.unstable_setDisableYieldValue,nt=null,Je=null;function zt(i){if(typeof Te=="function"&&Qe(i),Je&&typeof Je.setStrictMode=="function")try{Je.setStrictMode(nt,i)}catch{}}var et=Math.clz32?Math.clz32:r0,Yn=Math.log,$i=Math.LN2;function r0(i){return i>>>=0,i===0?32:31-(Yn(i)/$i|0)|0}var Ba=256,Na=262144,La=4194304;function Tr(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 za(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=Tr(u):(v&=w,v!==0?d=Tr(v):l||(l=w&~i,l!==0&&(d=Tr(l))))):(w=u&~m,w!==0?d=Tr(w):v!==0?d=Tr(v):l||(l=u&~i,l!==0&&(d=Tr(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 rl(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=La;return La<<=1,(La&62914560)===0&&(La=4194304),i}function Bu(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function sl(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 w=i.entanglements,N=i.expirationTimes,q=i.hiddenUpdates;for(l=v&~l;0<l;){var J=31-et(l),ne=1<<J;w[J]=0,N[J]=-1;var Y=q[J];if(Y!==null)for(q[J]=null,J=0;J<Y.length;J++){var X=Y[J];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-et(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-et(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:Nu(l),(l&(i.suspendedLanes|r))!==0?0:l}function Nu(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 Lu(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 Vn=Math.random().toString(36).slice(2),Kt="__reactFiber$"+Vn,fi="__reactProps$"+Vn,ss="__reactContainer$"+Vn,zu="__reactEvents$"+Vn,a0="__reactListeners$"+Vn,o0="__reactHandles$"+Vn,sp="__reactResources$"+Vn,ll="__reactMarker$"+Vn;function Ou(i){delete i[Kt],delete i[fi],delete i[zu],delete i[a0],delete i[o0]}function ls(i){var r=i[Kt];if(r)return r;for(var l=i.parentNode;l;){if(r=l[ss]||l[Kt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=Eg(i);i!==null;){if(l=i[Kt])return l;i=Eg(i)}return r}i=l,l=i.parentNode}return null}function as(i){if(i=i[Kt]||i[ss]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function al(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function os(i){var r=i[sp];return r||(r=i[sp]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Ot(i){i[ll]=!0}var lp=new Set,ap={};function Ar(i,r){us(i,r),us(i+"Capture",r)}function us(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 qn.call(up,i)?!0:qn.call(op,i)?!1:u0.test(i)?up[i]=!0:(op[i]=!0,!1)}function Oa(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 ja(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 gn(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 Li(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 ju(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 Ha(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 zi(i){return i.replace(f0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Hu(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=""+Li(r)):i.value!==""+Li(r)&&(i.value=""+Li(r)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),r!=null?Pu(i,v,Li(r)):l!=null?Pu(i,v,Li(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=""+Li(w):i.removeAttribute("name")}function fp(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)){ju(i);return}l=l!=null?""+Li(l):"",r=r!=null?""+Li(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),ju(i)}function Pu(i,r,l){r==="number"&&Ha(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function cs(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=""+Li(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=""+Li(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Li(l):""}function pp(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(R(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Li(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),ju(i)}function hs(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 Uu(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 Pa(i){return m0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function vn(){}var Iu=null;function Fu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var fs=null,ds=null;function gp(i){var r=as(i);if(r&&(i=r.stateNode)){var l=i[fi]||null;e:switch(i=r.stateNode,r.type){case"input":if(Hu(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="'+zi(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[fi]||null;if(!d)throw Error(s(90));Hu(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&&cs(i,!!l.multiple,r,!1)}}}var qu=!1;function vp(i,r,l){if(qu)return i(r,l);qu=!0;try{var u=i(r);return u}finally{if(qu=!1,(fs!==null||ds!==null)&&(To(),fs&&(r=fs,i=ds,ds=fs=null,gp(r),i)))for(r=0;r<i.length;r++)gp(i[r])}}function ol(i,r){var l=i.stateNode;if(l===null)return null;var u=l[fi]||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 yn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wu=!1;if(yn)try{var ul={};Object.defineProperty(ul,"passive",{get:function(){Wu=!0}}),window.addEventListener("test",ul,ul),window.removeEventListener("test",ul,ul)}catch{Wu=!1}var Kn=null,Yu=null,Ua=null;function yp(){if(Ua)return Ua;var i,r=Yu,l=r.length,u,d="value"in Kn?Kn.value:Kn.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 Ua=d.slice(i,1<u?1-u:void 0)}function Ia(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 Fa(){return!0}function bp(){return!1}function di(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)?Fa: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=Fa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Fa)},persist:function(){},isPersistent:Fa}),r}var Dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qa=di(Dr),cl=_({},Dr,{view:0,detail:0}),_0=di(cl),Vu,Ku,hl,Wa=_({},cl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$u,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!==hl&&(hl&&i.type==="mousemove"?(Vu=i.screenX-hl.screenX,Ku=i.screenY-hl.screenY):Ku=Vu=0,hl=i),Vu)},movementY:function(i){return"movementY"in i?i.movementY:Ku}}),Sp=di(Wa),g0=_({},Wa,{dataTransfer:0}),v0=di(g0),y0=_({},cl,{relatedTarget:0}),Xu=di(y0),b0=_({},Dr,{animationName:0,elapsedTime:0,pseudoElement:0}),S0=di(b0),x0=_({},Dr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),w0=di(x0),C0=_({},Dr,{data:0}),xp=di(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 $u(){return A0}var D0=_({},cl,{key:function(i){if(i.key){var r=k0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Ia(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:$u,charCode:function(i){return i.type==="keypress"?Ia(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ia(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),R0=di(D0),M0=_({},Wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wp=di(M0),B0=_({},cl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$u}),N0=di(B0),L0=_({},Dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=di(L0),O0=_({},Wa,{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=di(O0),H0=_({},Dr,{newState:0,oldState:0}),P0=di(H0),U0=[9,13,27,32],Gu=yn&&"CompositionEvent"in window,fl=null;yn&&"documentMode"in document&&(fl=document.documentMode);var I0=yn&&"TextEvent"in window&&!fl,Cp=yn&&(!Gu||fl&&8<fl&&11>=fl),kp=" ",Ep=!1;function Tp(i,r){switch(i){case"keyup":return U0.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 ps=!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(ps)return i==="compositionend"||!Gu&&Tp(i,r)?(i=yp(),Ua=Yu=Kn=null,ps=!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){fs?ds?ds.push(u):ds=[u]:fs=u,r=Lo(r,"onChange"),0<r.length&&(l=new qa("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var dl=null,pl=null;function Y0(i){fg(i,0)}function Ya(i){var r=al(i);if(hp(r))return i}function Mp(i,r){if(i==="change")return r}var Bp=!1;if(yn){var Zu;if(yn){var Qu="oninput"in document;if(!Qu){var Np=document.createElement("div");Np.setAttribute("oninput","return;"),Qu=typeof Np.oninput=="function"}Zu=Qu}else Zu=!1;Bp=Zu&&(!document.documentMode||9<document.documentMode)}function Lp(){dl&&(dl.detachEvent("onpropertychange",zp),pl=dl=null)}function zp(i){if(i.propertyName==="value"&&Ya(pl)){var r=[];Rp(r,pl,i,Fu(i)),vp(Y0,r)}}function V0(i,r,l){i==="focusin"?(Lp(),dl=r,pl=l,dl.attachEvent("onpropertychange",zp)):i==="focusout"&&Lp()}function K0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ya(pl)}function X0(i,r){if(i==="click")return Ya(r)}function $0(i,r){if(i==="input"||i==="change")return Ya(r)}function G0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var xi=typeof Object.is=="function"?Object.is:G0;function ml(i,r){if(xi(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(!qn.call(r,d)||!xi(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 Pp(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Ha(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=Ha(i.document)}return r}function Ju(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=yn&&"documentMode"in document&&11>=document.documentMode,ms=null,ec=null,_l=null,tc=!1;function Up(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;tc||ms==null||ms!==Ha(u)||(u=ms,"selectionStart"in u&&Ju(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}),_l&&ml(_l,u)||(_l=u,u=Lo(ec,"onSelect"),0<u.length&&(r=new qa("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=ms)))}function Rr(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var _s={animationend:Rr("Animation","AnimationEnd"),animationiteration:Rr("Animation","AnimationIteration"),animationstart:Rr("Animation","AnimationStart"),transitionrun:Rr("Transition","TransitionRun"),transitionstart:Rr("Transition","TransitionStart"),transitioncancel:Rr("Transition","TransitionCancel"),transitionend:Rr("Transition","TransitionEnd")},ic={},Ip={};yn&&(Ip=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Mr(i){if(ic[i])return ic[i];if(!_s[i])return i;var r=_s[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in Ip)return ic[i]=r[l];return i}var Fp=Mr("animationend"),qp=Mr("animationiteration"),Wp=Mr("animationstart"),Q0=Mr("transitionrun"),J0=Mr("transitionstart"),e1=Mr("transitioncancel"),Yp=Mr("transitionend"),Vp=new Map,nc="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(" ");nc.push("scrollEnd");function Gi(i,r){Vp.set(i,r),Ar(r,[i])}var Va=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)},Oi=[],gs=0,rc=0;function Ka(){for(var i=gs,r=rc=gs=0;r<i;){var l=Oi[r];Oi[r++]=null;var u=Oi[r];Oi[r++]=null;var d=Oi[r];Oi[r++]=null;var m=Oi[r];if(Oi[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 Xa(i,r,l,u){Oi[gs++]=i,Oi[gs++]=r,Oi[gs++]=l,Oi[gs++]=u,rc|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function sc(i,r,l,u){return Xa(i,r,l,u),$a(i)}function Br(i,r){return Xa(i,null,null,r),$a(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-et(l),i=m.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),m):null}function $a(i){if(50<Hl)throw Hl=0,ph=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var vs={};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 wi(i,r,l,u){return new t1(i,r,l,u)}function lc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function bn(i,r){var l=i.alternate;return l===null?(l=wi(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 Ga(i,r,l,u,d,m){var v=0;if(u=i,typeof i=="function")lc(i)&&(v=1);else if(typeof i=="string")v=lx(i,l,Q.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case _e:return i=wi(31,l,r,d),i.elementType=_e,i.lanes=m,i;case k:return Nr(l.children,d,m,r);case L:v=8,d|=24;break;case M:return i=wi(12,l,r,d|2),i.elementType=M,i.lanes=m,i;case W:return i=wi(13,l,r,d),i.elementType=W,i.lanes=m,i;case O:return i=wi(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 G:v=9;break e;case Z:v=11;break e;case te:v=14;break e;case ue:v=16,u=null;break e}v=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=wi(v,l,r,d),r.elementType=i,r.type=u,r.lanes=m,r}function Nr(i,r,l,u){return i=wi(7,i,u,r),i.lanes=l,i}function ac(i,r,l){return i=wi(6,i,null,r),i.lanes=l,i}function $p(i){var r=wi(18,null,null,0);return r.stateNode=i,r}function oc(i,r,l){return r=wi(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 ji(i,r){if(typeof i=="object"&&i!==null){var l=Gp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:rs(r)},Gp.set(i,r),r)}return{value:i,source:r,stack:rs(r)}}var ys=[],bs=0,Za=null,gl=0,Hi=[],Pi=0,Xn=null,tn=1,nn="";function Sn(i,r){ys[bs++]=gl,ys[bs++]=Za,Za=i,gl=r}function Zp(i,r,l){Hi[Pi++]=tn,Hi[Pi++]=nn,Hi[Pi++]=Xn,Xn=i;var u=tn;i=nn;var d=32-et(u)-1;u&=~(1<<d),l+=1;var m=32-et(r)+d;if(30<m){var v=d-d%5;m=(u&(1<<v)-1).toString(32),u>>=v,d-=v,tn=1<<32-et(r)+d|l<<d|u,nn=m+i}else tn=1<<m|l<<d|u,nn=i}function uc(i){i.return!==null&&(Sn(i,1),Zp(i,1,0))}function cc(i){for(;i===Za;)Za=ys[--bs],ys[bs]=null,gl=ys[--bs],ys[bs]=null;for(;i===Xn;)Xn=Hi[--Pi],Hi[Pi]=null,nn=Hi[--Pi],Hi[Pi]=null,tn=Hi[--Pi],Hi[Pi]=null}function Qp(i,r){Hi[Pi++]=tn,Hi[Pi++]=nn,Hi[Pi++]=Xn,tn=r.id,nn=r.overflow,Xn=i}var Xt=null,lt=null,Ue=!1,$n=null,Ui=!1,hc=Error(s(519));function Gn(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vl(ji(r,i)),hc}function Jp(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[Kt]=i,r[fi]=u,l){case"dialog":Oe("cancel",r),Oe("close",r);break;case"iframe":case"object":case"embed":Oe("load",r);break;case"video":case"audio":for(l=0;l<Ul.length;l++)Oe(Ul[l],r);break;case"source":Oe("error",r);break;case"img":case"image":case"link":Oe("error",r),Oe("load",r);break;case"details":Oe("toggle",r);break;case"input":Oe("invalid",r),fp(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Oe("invalid",r);break;case"textarea":Oe("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&&(Oe("beforetoggle",r),Oe("toggle",r)),u.onScroll!=null&&Oe("scroll",r),u.onScrollEnd!=null&&Oe("scrollend",r),u.onClick!=null&&(r.onclick=vn),r=!0):r=!1,r||Gn(i,!0)}function em(i){for(Xt=i.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:Ui=!1;return;case 27:case 3:Ui=!0;return;default:Xt=Xt.return}}function Ss(i){if(i!==Xt)return!1;if(!Ue)return em(i),Ue=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Dh(i.type,i.memoizedProps)),l=!l),l&<&&Gn(i),em(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));lt=kg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));lt=kg(i)}else r===27?(r=lt,cr(i.type)?(i=Lh,Lh=null,lt=i):lt=r):lt=Xt?Fi(i.stateNode.nextSibling):null;return!0}function Lr(){lt=Xt=null,Ue=!1}function fc(){var i=$n;return i!==null&&(gi===null?gi=i:gi.push.apply(gi,i),$n=null),i}function vl(i){$n===null?$n=[i]:$n.push(i)}var dc=D(null),zr=null,xn=null;function Zn(i,r,l){C(dc,r._currentValue),r._currentValue=l}function wn(i){i._currentValue=dc.current,K(dc)}function pc(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 mc(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 N=0;N<r.length;N++)if(w.context===r[N]){m.lanes|=l,w=m.alternate,w!==null&&(w.lanes|=l),pc(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),pc(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 xs(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;xi(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===Ce.current){if(v=d.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Yl):i=[Yl])}d=d.return}i!==null&&mc(r,i,l,u),r.flags|=262144}function Qa(i){for(i=i.firstContext;i!==null;){if(!xi(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Or(i){zr=i,xn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function $t(i){return tm(zr,i)}function Ja(i,r){return zr===null&&Or(i),tm(i,r)}function tm(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},xn===null){if(i===null)throw Error(s(308));xn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else xn=xn.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,wt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _c(){return{controller:new i1,data:new Map,refCount:0}}function yl(i){i.refCount--,i.refCount===0&&n1(r1,function(){i.controller.abort()})}var bl=null,gc=0,ws=0,Cs=null;function s1(i,r){if(bl===null){var l=bl=[];gc=0,ws=bh(),Cs={status:"pending",value:void 0,then:function(u){l.push(u)}}}return gc++,r.then(im,im),r}function im(){if(--gc===0&&bl!==null){Cs!==null&&(Cs.status="fulfilled");var i=bl;bl=null,ws=0,Cs=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=T.S;T.S=function(i,r){U_=vt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&s1(i,r),nm!==null&&nm(i,r)};var jr=D(null);function vc(){var i=jr.current;return i!==null?i:tt.pooledCache}function eo(i,r){r===null?C(jr,jr.current):C(jr,r.pool)}function rm(){var i=vc();return i===null?null:{parent:wt._currentValue,pool:i}}var ks=Error(s(460)),yc=Error(s(474)),to=Error(s(542)),io={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(vn,vn),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(vn,vn);else{if(i=tt,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 Pr=r,ks}}function Hr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Pr=l,ks):l}}var Pr=null;function am(){if(Pr===null)throw Error(s(459));var i=Pr;return Pr=null,i}function om(i){if(i===ks||i===to)throw Error(s(483))}var Es=null,Sl=0;function no(i){var r=Sl;return Sl+=1,Es===null&&(Es=[]),lm(Es,i,r)}function xl(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function ro(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(P,z){if(i){var F=P.deletions;F===null?(P.deletions=[z],P.flags|=16):F.push(z)}}function l(P,z){if(!i)return null;for(;z!==null;)r(P,z),z=z.sibling;return null}function u(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function d(P,z){return P=bn(P,z),P.index=0,P.sibling=null,P}function m(P,z,F){return P.index=F,i?(F=P.alternate,F!==null?(F=F.index,F<z?(P.flags|=67108866,z):F):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function v(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function w(P,z,F,ie){return z===null||z.tag!==6?(z=ac(F,P.mode,ie),z.return=P,z):(z=d(z,F),z.return=P,z)}function N(P,z,F,ie){var ye=F.type;return ye===k?J(P,z,F.props.children,ie,F.key):z!==null&&(z.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===ue&&Hr(ye)===z.type)?(z=d(z,F.props),xl(z,F),z.return=P,z):(z=Ga(F.type,F.key,F.props,null,P.mode,ie),xl(z,F),z.return=P,z)}function q(P,z,F,ie){return z===null||z.tag!==4||z.stateNode.containerInfo!==F.containerInfo||z.stateNode.implementation!==F.implementation?(z=oc(F,P.mode,ie),z.return=P,z):(z=d(z,F.children||[]),z.return=P,z)}function J(P,z,F,ie,ye){return z===null||z.tag!==7?(z=Nr(F,P.mode,ie,ye),z.return=P,z):(z=d(z,F),z.return=P,z)}function ne(P,z,F){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=ac(""+z,P.mode,F),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case y:return F=Ga(z.type,z.key,z.props,null,P.mode,F),xl(F,z),F.return=P,F;case x:return z=oc(z,P.mode,F),z.return=P,z;case ue:return z=Hr(z),ne(P,z,F)}if(R(z)||V(z))return z=Nr(z,P.mode,F,null),z.return=P,z;if(typeof z.then=="function")return ne(P,no(z),F);if(z.$$typeof===I)return ne(P,Ja(P,z),F);ro(P,z)}return null}function Y(P,z,F,ie){var ye=z!==null?z.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return ye!==null?null:w(P,z,""+F,ie);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case y:return F.key===ye?N(P,z,F,ie):null;case x:return F.key===ye?q(P,z,F,ie):null;case ue:return F=Hr(F),Y(P,z,F,ie)}if(R(F)||V(F))return ye!==null?null:J(P,z,F,ie,null);if(typeof F.then=="function")return Y(P,z,no(F),ie);if(F.$$typeof===I)return Y(P,z,Ja(P,F),ie);ro(P,F)}return null}function X(P,z,F,ie,ye){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return P=P.get(F)||null,w(z,P,""+ie,ye);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return P=P.get(ie.key===null?F:ie.key)||null,N(z,P,ie,ye);case x:return P=P.get(ie.key===null?F:ie.key)||null,q(z,P,ie,ye);case ue:return ie=Hr(ie),X(P,z,F,ie,ye)}if(R(ie)||V(ie))return P=P.get(F)||null,J(z,P,ie,ye,null);if(typeof ie.then=="function")return X(P,z,F,no(ie),ye);if(ie.$$typeof===I)return X(P,z,F,Ja(z,ie),ye);ro(z,ie)}return null}function ge(P,z,F,ie){for(var ye=null,Fe=null,ve=z,Re=z=0,Pe=null;ve!==null&&Re<F.length;Re++){ve.index>Re?(Pe=ve,ve=null):Pe=ve.sibling;var qe=Y(P,ve,F[Re],ie);if(qe===null){ve===null&&(ve=Pe);break}i&&ve&&qe.alternate===null&&r(P,ve),z=m(qe,z,Re),Fe===null?ye=qe:Fe.sibling=qe,Fe=qe,ve=Pe}if(Re===F.length)return l(P,ve),Ue&&Sn(P,Re),ye;if(ve===null){for(;Re<F.length;Re++)ve=ne(P,F[Re],ie),ve!==null&&(z=m(ve,z,Re),Fe===null?ye=ve:Fe.sibling=ve,Fe=ve);return Ue&&Sn(P,Re),ye}for(ve=u(ve);Re<F.length;Re++)Pe=X(ve,P,Re,F[Re],ie),Pe!==null&&(i&&Pe.alternate!==null&&ve.delete(Pe.key===null?Re:Pe.key),z=m(Pe,z,Re),Fe===null?ye=Pe:Fe.sibling=Pe,Fe=Pe);return i&&ve.forEach(function(mr){return r(P,mr)}),Ue&&Sn(P,Re),ye}function we(P,z,F,ie){if(F==null)throw Error(s(151));for(var ye=null,Fe=null,ve=z,Re=z=0,Pe=null,qe=F.next();ve!==null&&!qe.done;Re++,qe=F.next()){ve.index>Re?(Pe=ve,ve=null):Pe=ve.sibling;var mr=Y(P,ve,qe.value,ie);if(mr===null){ve===null&&(ve=Pe);break}i&&ve&&mr.alternate===null&&r(P,ve),z=m(mr,z,Re),Fe===null?ye=mr:Fe.sibling=mr,Fe=mr,ve=Pe}if(qe.done)return l(P,ve),Ue&&Sn(P,Re),ye;if(ve===null){for(;!qe.done;Re++,qe=F.next())qe=ne(P,qe.value,ie),qe!==null&&(z=m(qe,z,Re),Fe===null?ye=qe:Fe.sibling=qe,Fe=qe);return Ue&&Sn(P,Re),ye}for(ve=u(ve);!qe.done;Re++,qe=F.next())qe=X(ve,P,Re,qe.value,ie),qe!==null&&(i&&qe.alternate!==null&&ve.delete(qe.key===null?Re:qe.key),z=m(qe,z,Re),Fe===null?ye=qe:Fe.sibling=qe,Fe=qe);return i&&ve.forEach(function(gx){return r(P,gx)}),Ue&&Sn(P,Re),ye}function Ge(P,z,F,ie){if(typeof F=="object"&&F!==null&&F.type===k&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case y:e:{for(var ye=F.key;z!==null;){if(z.key===ye){if(ye=F.type,ye===k){if(z.tag===7){l(P,z.sibling),ie=d(z,F.props.children),ie.return=P,P=ie;break e}}else if(z.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===ue&&Hr(ye)===z.type){l(P,z.sibling),ie=d(z,F.props),xl(ie,F),ie.return=P,P=ie;break e}l(P,z);break}else r(P,z);z=z.sibling}F.type===k?(ie=Nr(F.props.children,P.mode,ie,F.key),ie.return=P,P=ie):(ie=Ga(F.type,F.key,F.props,null,P.mode,ie),xl(ie,F),ie.return=P,P=ie)}return v(P);case x:e:{for(ye=F.key;z!==null;){if(z.key===ye)if(z.tag===4&&z.stateNode.containerInfo===F.containerInfo&&z.stateNode.implementation===F.implementation){l(P,z.sibling),ie=d(z,F.children||[]),ie.return=P,P=ie;break e}else{l(P,z);break}else r(P,z);z=z.sibling}ie=oc(F,P.mode,ie),ie.return=P,P=ie}return v(P);case ue:return F=Hr(F),Ge(P,z,F,ie)}if(R(F))return ge(P,z,F,ie);if(V(F)){if(ye=V(F),typeof ye!="function")throw Error(s(150));return F=ye.call(F),we(P,z,F,ie)}if(typeof F.then=="function")return Ge(P,z,no(F),ie);if(F.$$typeof===I)return Ge(P,z,Ja(P,F),ie);ro(P,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,z!==null&&z.tag===6?(l(P,z.sibling),ie=d(z,F),ie.return=P,P=ie):(l(P,z),ie=ac(F,P.mode,ie),ie.return=P,P=ie),v(P)):l(P,z)}return function(P,z,F,ie){try{Sl=0;var ye=Ge(P,z,F,ie);return Es=null,ye}catch(ve){if(ve===ks||ve===to)throw ve;var Fe=wi(29,ve,null,P.mode);return Fe.lanes=ie,Fe.return=P,Fe}finally{}}}var Ur=um(!0),cm=um(!1),Qn=!1;function bc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sc(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 Jn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function er(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(We&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=$a(i),Kp(i,null,l),r}return Xa(i,u,r,l),$a(i)}function wl(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 xc(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 wc=!1;function Cl(){if(wc){var i=Cs;if(i!==null)throw i}}function kl(i,r,l,u){wc=!1;var d=i.updateQueue;Qn=!1;var m=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var N=w,q=N.next;N.next=null,v===null?m=q:v.next=q,v=N;var J=i.alternate;J!==null&&(J=J.updateQueue,w=J.lastBaseUpdate,w!==v&&(w===null?J.firstBaseUpdate=q:w.next=q,J.lastBaseUpdate=N))}if(m!==null){var ne=d.baseState;v=0,J=q=N=null,w=m;do{var Y=w.lane&-536870913,X=Y!==w.lane;if(X?(He&Y)===Y:(u&Y)===Y){Y!==0&&Y===ws&&(wc=!0),J!==null&&(J=J.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ge=i,we=w;Y=r;var Ge=l;switch(we.tag){case 1:if(ge=we.payload,typeof ge=="function"){ne=ge.call(Ge,ne,Y);break e}ne=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=we.payload,Y=typeof ge=="function"?ge.call(Ge,ne,Y):ge,Y==null)break e;ne=_({},ne,Y);break e;case 2:Qn=!0}}Y=w.callback,Y!==null&&(i.flags|=64,X&&(i.flags|=8192),X=d.callbacks,X===null?d.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},J===null?(q=J=X,N=ne):J=J.next=X,v|=Y;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);J===null&&(N=ne),d.baseState=N,d.firstBaseUpdate=q,d.lastBaseUpdate=J,m===null&&(d.shared.lanes=0),sr|=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 Ts=D(null),so=D(0);function dm(i,r){i=Bn,C(so,i),C(Ts,r),Bn=i|r.baseLanes}function Cc(){C(so,Bn),C(Ts,Ts.current)}function kc(){Bn=so.current,K(Ts),K(so)}var Ci=D(null),Ii=null;function tr(i){var r=i.alternate;C(yt,yt.current&1),C(Ci,i),Ii===null&&(r===null||Ts.current!==null||r.memoizedState!==null)&&(Ii=i)}function Ec(i){C(yt,yt.current),C(Ci,i),Ii===null&&(Ii=i)}function pm(i){i.tag===22?(C(yt,yt.current),C(Ci,i),Ii===null&&(Ii=i)):ir()}function ir(){C(yt,yt.current),C(Ci,Ci.current)}function ki(i){K(Ci),Ii===i&&(Ii=null),K(yt)}var yt=D(0);function lo(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Bh(l)||Nh(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 Cn=0,De=null,Xe=null,Ct=null,ao=!1,As=!1,Ir=!1,oo=0,El=0,Ds=null,a1=0;function dt(){throw Error(s(321))}function Tc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!xi(i[l],r[l]))return!1;return!0}function Ac(i,r,l,u,d,m){return Cn=m,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,T.H=i===null||i.memoizedState===null?Zm:qc,Ir=!1,m=l(u,d),Ir=!1,As&&(m=_m(r,l,u,d)),mm(i),m}function mm(i){T.H=Dl;var r=Xe!==null&&Xe.next!==null;if(Cn=0,Ct=Xe=De=null,ao=!1,El=0,Ds=null,r)throw Error(s(300));i===null||kt||(i=i.dependencies,i!==null&&Qa(i)&&(kt=!0))}function _m(i,r,l,u){De=i;var d=0;do{if(As&&(Ds=null),El=0,As=!1,25<=d)throw Error(s(301));if(d+=1,Ct=Xe=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}T.H=Qm,m=r(l,u)}while(As);return m}function o1(){var i=T.H,r=i.useState()[0];return r=typeof r.then=="function"?Tl(r):r,i=i.useState()[0],(Xe!==null?Xe.memoizedState:null)!==i&&(De.flags|=1024),r}function Dc(){var i=oo!==0;return oo=0,i}function Rc(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Mc(i){if(ao){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}ao=!1}Cn=0,Ct=Xe=De=null,As=!1,El=oo=0,Ds=null}function li(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?De.memoizedState=Ct=i:Ct=Ct.next=i,Ct}function bt(){if(Xe===null){var i=De.alternate;i=i!==null?i.memoizedState:null}else i=Xe.next;var r=Ct===null?De.memoizedState:Ct.next;if(r!==null)Ct=r,Xe=i;else{if(i===null)throw De.alternate===null?Error(s(467)):Error(s(310));Xe=i,i={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},Ct===null?De.memoizedState=Ct=i:Ct=Ct.next=i}return Ct}function uo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tl(i){var r=El;return El+=1,Ds===null&&(Ds=[]),i=lm(Ds,i,r),r=De,(Ct===null?r.memoizedState:Ct.next)===null&&(r=r.alternate,T.H=r===null||r.memoizedState===null?Zm:qc),i}function co(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Tl(i);if(i.$$typeof===I)return $t(i)}throw Error(s(438,String(i)))}function Bc(i){var r=null,l=De.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=De.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=uo(),De.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]=U;return r.index++,l}function kn(i,r){return typeof r=="function"?r(i):r}function ho(i){var r=bt();return Nc(r,Xe,i)}function Nc(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,N=null,q=r,J=!1;do{var ne=q.lane&-536870913;if(ne!==q.lane?(He&ne)===ne:(Cn&ne)===ne){var Y=q.revertLane;if(Y===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ne===ws&&(J=!0);else if((Cn&Y)===Y){q=q.next,Y===ws&&(J=!0);continue}else ne={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},N===null?(w=N=ne,v=m):N=N.next=ne,De.lanes|=Y,sr|=Y;ne=q.action,Ir&&l(m,ne),m=q.hasEagerState?q.eagerState:l(m,ne)}else Y={lane:ne,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},N===null?(w=N=Y,v=m):N=N.next=Y,De.lanes|=ne,sr|=ne;q=q.next}while(q!==null&&q!==r);if(N===null?v=m:N.next=w,!xi(m,i.memoizedState)&&(kt=!0,J&&(l=Cs,l!==null)))throw l;i.memoizedState=m,i.baseState=v,i.baseQueue=N,u.lastRenderedState=m}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function Lc(i){var r=bt(),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);xi(m,r.memoizedState)||(kt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function gm(i,r,l){var u=De,d=bt(),m=Ue;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var v=!xi((Xe||d).memoizedState,l);if(v&&(d.memoizedState=l,kt=!0),d=d.queue,jc(bm.bind(null,u,d,i),[i]),d.getSnapshot!==r||v||Ct!==null&&Ct.memoizedState.tag&1){if(u.flags|=2048,Rs(9,{destroy:void 0},ym.bind(null,u,d,l,r),null),tt===null)throw Error(s(349));m||(Cn&127)!==0||vm(u,r,l)}return l}function vm(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=De.updateQueue,r===null?(r=uo(),De.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!xi(i,l)}catch{return!0}}function xm(i){var r=Br(i,2);r!==null&&vi(r,i,2)}function zc(i){var r=li();if(typeof i=="function"){var l=i;if(i=l(),Ir){zt(!0);try{l()}finally{zt(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:i},r}function wm(i,r,l,u){return i.baseState=l,Nc(i,Xe,typeof u=="function"?u:kn)}function u1(i,r,l,u,d){if(mo(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)}};T.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=T.T,v={};T.T=v;try{var w=l(d,u),N=T.S;N!==null&&N(v,w),km(i,r,w)}catch(q){Oc(i,r,q)}finally{m!==null&&v.types!==null&&(m.types=v.types),T.T=m}}else try{m=l(d,u),km(i,r,m)}catch(q){Oc(i,r,q)}}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 Oc(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 Oc(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(Ue){var l=tt.formState;if(l!==null){e:{var u=De;if(Ue){if(lt){t:{for(var d=lt,m=Ui;d.nodeType!==8;){if(!m){d=null;break t}if(d=Fi(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){lt=Fi(d.nextSibling),u=d.data==="F!";break e}}Gn(u)}u=!1}u&&(r=l[0])}}return l=li(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Am,lastRenderedState:r},l.queue=u,l=Xm.bind(null,De,u),u.dispatch=l,u=zc(!1),m=Fc.bind(null,De,!1,u.queue),u=li(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=u1.bind(null,De,d,m,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function Rm(i){var r=bt();return Mm(r,Xe,i)}function Mm(i,r,l){if(r=Nc(i,r,Am)[0],i=ho(kn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Tl(r)}catch(v){throw v===ks?to:v}else u=r;r=bt();var d=r.queue,m=d.dispatch;return l!==r.memoizedState&&(De.flags|=2048,Rs(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=bt(),l=Xe;if(l!==null)return Mm(r,l,i);bt(),r=r.memoizedState,l=bt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function Rs(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=De.updateQueue,r===null&&(r=uo(),De.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 bt().memoizedState}function fo(i,r,l,u){var d=li();De.flags|=i,d.memoizedState=Rs(1|r,{destroy:void 0},l,u===void 0?null:u)}function po(i,r,l,u){var d=bt();u=u===void 0?null:u;var m=d.memoizedState.inst;Xe!==null&&u!==null&&Tc(u,Xe.memoizedState.deps)?d.memoizedState=Rs(r,m,l,u):(De.flags|=i,d.memoizedState=Rs(1|r,m,l,u))}function Lm(i,r){fo(8390656,8,i,r)}function jc(i,r){po(2048,8,i,r)}function h1(i){De.flags|=4;var r=De.updateQueue;if(r===null)r=uo(),De.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function zm(i){var r=bt().memoizedState;return h1({ref:r,nextImpl:i}),function(){if((We&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Om(i,r){return po(4,2,i,r)}function jm(i,r){return po(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 Pm(i,r,l){l=l!=null?l.concat([i]):null,po(4,4,Hm.bind(null,r,i),l)}function Hc(){}function Um(i,r){var l=bt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&Tc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function Im(i,r){var l=bt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&Tc(r,u[1]))return u[0];if(u=i(),Ir){zt(!0);try{i()}finally{zt(!1)}}return l.memoizedState=[u,r],u}function Pc(i,r,l){return l===void 0||(Cn&1073741824)!==0&&(He&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=F_(),De.lanes|=i,sr|=i,l)}function Fm(i,r,l,u){return xi(l,r)?l:Ts.current!==null?(i=Pc(i,l,u),xi(i,r)||(kt=!0),i):(Cn&42)===0||(Cn&1073741824)!==0&&(He&261930)===0?(kt=!0,i.memoizedState=l):(i=F_(),De.lanes|=i,sr|=i,r)}function qm(i,r,l,u,d){var m=j.p;j.p=m!==0&&8>m?m:8;var v=T.T,w={};T.T=w,Fc(i,!1,r,l);try{var N=d(),q=T.S;if(q!==null&&q(w,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var J=l1(N,u);Al(i,r,J,Ai(i))}else Al(i,r,u,Ai(i))}catch(ne){Al(i,r,{then:function(){},status:"rejected",reason:ne},Ai())}finally{j.p=m,v!==null&&w.types!==null&&(v.types=w.types),T.T=v}}function f1(){}function Uc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=Wm(i).queue;qm(i,d,r,H,l===null?f1:function(){return Ym(i),l(u)})}function Wm(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,lastRenderedState:H},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kn,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),Al(i,r.next.queue,{},Ai())}function Ic(){return $t(Yl)}function Vm(){return bt().memoizedState}function Km(){return bt().memoizedState}function d1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=Ai();i=Jn(l);var u=er(r,i,l);u!==null&&(vi(u,r,l),wl(u,r,l)),r={cache:_c()},i.payload=r;return}r=r.return}}function p1(i,r,l){var u=Ai();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},mo(i)?$m(r,l):(l=sc(i,r,l,u),l!==null&&(vi(l,i,u),Gm(l,r,u)))}function Xm(i,r,l){var u=Ai();Al(i,r,l,u)}function Al(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(mo(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,w=m(v,l);if(d.hasEagerState=!0,d.eagerState=w,xi(w,v))return Xa(i,r,d,0),tt===null&&Ka(),!1}catch{}finally{}if(l=sc(i,r,d,u),l!==null)return vi(l,i,u),Gm(l,r,u),!0}return!1}function Fc(i,r,l,u){if(u={lane:2,revertLane:bh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},mo(i)){if(r)throw Error(s(479))}else r=sc(i,l,u,2),r!==null&&vi(r,i,2)}function mo(i){var r=i.alternate;return i===De||r!==null&&r===De}function $m(i,r){As=ao=!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 Dl={readContext:$t,use:co,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};Dl.useEffectEvent=dt;var Zm={readContext:$t,use:co,useCallback:function(i,r){return li().memoizedState=[i,r===void 0?null:r],i},useContext:$t,useEffect:Lm,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,fo(4194308,4,Hm.bind(null,r,i),l)},useLayoutEffect:function(i,r){return fo(4194308,4,i,r)},useInsertionEffect:function(i,r){fo(4,2,i,r)},useMemo:function(i,r){var l=li();r=r===void 0?null:r;var u=i();if(Ir){zt(!0);try{i()}finally{zt(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=li();if(l!==void 0){var d=l(r);if(Ir){zt(!0);try{l(r)}finally{zt(!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,De,i),[u.memoizedState,i]},useRef:function(i){var r=li();return i={current:i},r.memoizedState=i},useState:function(i){i=zc(i);var r=i.queue,l=Xm.bind(null,De,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Hc,useDeferredValue:function(i,r){var l=li();return Pc(l,i,r)},useTransition:function(){var i=zc(!1);return i=qm.bind(null,De,i.queue,!0,!1),li().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=De,d=li();if(Ue){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),tt===null)throw Error(s(349));(He&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,Rs(9,{destroy:void 0},ym.bind(null,u,m,l,r),null),l},useId:function(){var i=li(),r=tt.identifierPrefix;if(Ue){var l=nn,u=tn;l=(u&~(1<<32-et(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=oo++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=a1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Ic,useFormState:Dm,useActionState:Dm,useOptimistic:function(i){var r=li();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Fc.bind(null,De,!0,l),l.dispatch=r,[i,r]},useMemoCache:Bc,useCacheRefresh:function(){return li().memoizedState=d1.bind(null,De)},useEffectEvent:function(i){var r=li(),l={impl:i};return r.memoizedState=l,function(){if((We&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},qc={readContext:$t,use:co,useCallback:Um,useContext:$t,useEffect:jc,useImperativeHandle:Pm,useInsertionEffect:Om,useLayoutEffect:jm,useMemo:Im,useReducer:ho,useRef:Nm,useState:function(){return ho(kn)},useDebugValue:Hc,useDeferredValue:function(i,r){var l=bt();return Fm(l,Xe.memoizedState,i,r)},useTransition:function(){var i=ho(kn)[0],r=bt().memoizedState;return[typeof i=="boolean"?i:Tl(i),r]},useSyncExternalStore:gm,useId:Vm,useHostTransitionStatus:Ic,useFormState:Rm,useActionState:Rm,useOptimistic:function(i,r){var l=bt();return wm(l,Xe,i,r)},useMemoCache:Bc,useCacheRefresh:Km};qc.useEffectEvent=zm;var Qm={readContext:$t,use:co,useCallback:Um,useContext:$t,useEffect:jc,useImperativeHandle:Pm,useInsertionEffect:Om,useLayoutEffect:jm,useMemo:Im,useReducer:Lc,useRef:Nm,useState:function(){return Lc(kn)},useDebugValue:Hc,useDeferredValue:function(i,r){var l=bt();return Xe===null?Pc(l,i,r):Fm(l,Xe.memoizedState,i,r)},useTransition:function(){var i=Lc(kn)[0],r=bt().memoizedState;return[typeof i=="boolean"?i:Tl(i),r]},useSyncExternalStore:gm,useId:Vm,useHostTransitionStatus:Ic,useFormState:Bm,useActionState:Bm,useOptimistic:function(i,r){var l=bt();return Xe!==null?wm(l,Xe,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:Bc,useCacheRefresh:Km};Qm.useEffectEvent=zm;function Wc(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 Yc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=Ai(),d=Jn(u);d.payload=r,l!=null&&(d.callback=l),r=er(i,d,u),r!==null&&(vi(r,i,u),wl(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=Ai(),d=Jn(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=er(i,d,u),r!==null&&(vi(r,i,u),wl(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=Ai(),u=Jn(l);u.tag=2,r!=null&&(u.callback=r),r=er(i,u,l),r!==null&&(vi(r,i,l),wl(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?!ml(l,u)||!ml(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&&Yc.enqueueReplaceState(r,r.state,null)}function Fr(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){Va(i)}function i_(i){console.error(i)}function n_(i){Va(i)}function _o(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 Vc(i,r,l){return l=Jn(l),l.tag=3,l.payload={element:null},l.callback=function(){_o(i,r)},l}function s_(i){return i=Jn(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"&&(lr===null?lr=new Set([this]):lr.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}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&&xs(r,l,d,!0),l=Ci.current,l!==null){switch(l.tag){case 31:case 13:return Ii===null?Ao():l.alternate===null&&pt===0&&(pt=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===io?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),gh(i,u,d)),!1;case 22:return l.flags|=65536,u===io?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)),gh(i,u,d)),!1}throw Error(s(435,l.tag))}return gh(i,u,d),Ao(),!1}if(Ue)return r=Ci.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==hc&&(i=Error(s(422),{cause:u}),vl(ji(i,l)))):(u!==hc&&(r=Error(s(423),{cause:u}),vl(ji(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=ji(u,l),d=Vc(i.stateNode,u,d),xc(i,d),pt!==4&&(pt=2)),!1;var m=Error(s(520),{cause:u});if(m=ji(m,l),jl===null?jl=[m]:jl.push(m),pt!==4&&(pt=2),r===null)return!0;u=ji(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Vc(l.stateNode,u,i),xc(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"&&(lr===null||!lr.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=s_(d),l_(d,i,l,u),xc(l,d),!1}l=l.return}while(l!==null);return!1}var Kc=Error(s(461)),kt=!1;function Gt(i,r,l,u){r.child=i===null?cm(r,null,l,u):Ur(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 w in u)w!=="ref"&&(v[w]=u[w])}else v=u;return Or(r),u=Ac(i,r,l,v,m,d),w=Dc(),i!==null&&!kt?(Rc(i,r,d),En(i,r,d)):(Ue&&w&&uc(r),r.flags|=1,Gt(i,r,u,d),r.child)}function o_(i,r,l,u,d){if(i===null){var m=l.type;return typeof m=="function"&&!lc(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,u_(i,r,m,u,d)):(i=Ga(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!th(i,d)){var v=m.memoizedProps;if(l=l.compare,l=l!==null?l:ml,l(v,u)&&i.ref===r.ref)return En(i,r,d)}return r.flags|=1,i=bn(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(ml(m,u)&&i.ref===r.ref)if(kt=!1,r.pendingProps=u=m,th(i,d))(i.flags&131072)!==0&&(kt=!0);else return r.lanes=i.lanes,En(i,r,d)}return Xc(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&&eo(r,m!==null?m.cachePool:null),m!==null?dm(r,m):Cc(),pm(r);else return u=r.lanes=536870912,h_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?(eo(r,m.cachePool),dm(r,m),ir(),r.memoizedState=null):(i!==null&&eo(r,null),Cc(),ir());return Gt(i,r,d,l),r.child}function Rl(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=vc();return m=m===null?null:{parent:wt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&eo(r,null),Cc(),pm(r),i!==null&&xs(i,r,u,!0),r.childLanes=d,null}function go(i,r){return r=yo({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 Ur(r,i.child,null,l),i=go(r,r.pendingProps),i.flags|=2,ki(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(Ue){if(u.mode==="hidden")return i=go(r,u),r.lanes=536870912,Rl(null,i);if(Ec(r),(i=lt)?(i=Cg(i,Ui),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Xn!==null?{id:tn,overflow:nn}:null,retryLane:536870912,hydrationErrors:null},l=$p(i),l.return=r,r.child=l,Xt=r,lt=null)):i=null,i===null)throw Gn(r);return r.lanes=536870912,null}return go(r,u)}var m=i.memoizedState;if(m!==null){var v=m.dehydrated;if(Ec(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(kt||xs(i,r,l,!1),d=(l&i.childLanes)!==0,kt||d){if(u=tt,u!==null&&(v=ip(u,l),v!==0&&v!==m.retryLane))throw m.retryLane=v,Br(i,v),vi(u,i,v),Kc;Ao(),r=f_(i,r,l)}else i=m.treeContext,lt=Fi(v.nextSibling),Xt=r,Ue=!0,$n=null,Ui=!1,i!==null&&Qp(r,i),r=go(r,u),r.flags|=4096;return r}return i=bn(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function vo(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 Xc(i,r,l,u,d){return Or(r),l=Ac(i,r,l,u,void 0,d),u=Dc(),i!==null&&!kt?(Rc(i,r,d),En(i,r,d)):(Ue&&u&&uc(r),r.flags|=1,Gt(i,r,l,d),r.child)}function d_(i,r,l,u,d,m){return Or(r),r.updateQueue=null,l=_m(r,u,l,d),mm(i),u=Dc(),i!==null&&!kt?(Rc(i,r,m),En(i,r,m)):(Ue&&u&&uc(r),r.flags|=1,Gt(i,r,l,m),r.child)}function p_(i,r,l,u,d){if(Or(r),r.stateNode===null){var m=vs,v=l.contextType;typeof v=="object"&&v!==null&&(m=$t(v)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Yc,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},bc(r),v=l.contextType,m.context=typeof v=="object"&&v!==null?$t(v):vs,m.state=r.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Wc(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&&Yc.enqueueReplaceState(m,m.state,null),kl(r,u,m,d),Cl(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var w=r.memoizedProps,N=Fr(l,w);m.props=N;var q=m.context,J=l.contextType;v=vs,typeof J=="object"&&J!==null&&(v=$t(J));var ne=l.getDerivedStateFromProps;J=typeof ne=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,J||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||q!==v)&&e_(r,m,u,v),Qn=!1;var Y=r.memoizedState;m.state=Y,kl(r,u,m,d),Cl(),q=r.memoizedState,w||Y!==q||Qn?(typeof ne=="function"&&(Wc(r,l,ne,u),q=r.memoizedState),(N=Qn||Jm(r,l,N,u,Y,q,v))?(J||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=q),m.props=u,m.state=q,m.context=v,u=N):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,Sc(i,r),v=r.memoizedProps,J=Fr(l,v),m.props=J,ne=r.pendingProps,Y=m.context,q=l.contextType,N=vs,typeof q=="object"&&q!==null&&(N=$t(q)),w=l.getDerivedStateFromProps,(q=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(v!==ne||Y!==N)&&e_(r,m,u,N),Qn=!1,Y=r.memoizedState,m.state=Y,kl(r,u,m,d),Cl();var X=r.memoizedState;v!==ne||Y!==X||Qn||i!==null&&i.dependencies!==null&&Qa(i.dependencies)?(typeof w=="function"&&(Wc(r,l,w,u),X=r.memoizedState),(J=Qn||Jm(r,l,J,u,Y,X,N)||i!==null&&i.dependencies!==null&&Qa(i.dependencies))?(q||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,X,N),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,X,N)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=X),m.props=u,m.state=X,m.context=N,u=J):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,vo(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=Ur(r,i.child,null,d),r.child=Ur(r,null,l,d)):Gt(i,r,l,d),r.memoizedState=m.state,i=r.child):i=En(i,r,d),i}function m_(i,r,l,u){return Lr(),r.flags|=256,Gt(i,r,l,u),r.child}var $c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(i){return{baseLanes:i,cachePool:rm()}}function Zc(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=Ti),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:(yt.current&2)!==0),v&&(d=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,i===null){if(Ue){if(d?tr(r):ir(),(i=lt)?(i=Cg(i,Ui),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Xn!==null?{id:tn,overflow:nn}:null,retryLane:536870912,hydrationErrors:null},l=$p(i),l.return=r,r.child=l,Xt=r,lt=null)):i=null,i===null)throw Gn(r);return Nh(i)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,d?(ir(),d=r.mode,w=yo({mode:"hidden",children:w},d),u=Nr(u,d,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Gc(l),u.childLanes=Zc(i,v,l),r.memoizedState=$c,Rl(null,u)):(tr(r),Qc(r,w))}var N=i.memoizedState;if(N!==null&&(w=N.dehydrated,w!==null)){if(m)r.flags&256?(tr(r),r.flags&=-257,r=Jc(i,r,l)):r.memoizedState!==null?(ir(),r.child=i.child,r.flags|=128,r=null):(ir(),w=u.fallback,d=r.mode,u=yo({mode:"visible",children:u.children},d),w=Nr(w,d,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Ur(r,i.child,null,l),u=r.child,u.memoizedState=Gc(l),u.childLanes=Zc(i,v,l),r.memoizedState=$c,r=Rl(null,u));else if(tr(r),Nh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var q=v.dgst;v=q,u=Error(s(419)),u.stack="",u.digest=v,vl({value:u,source:null,stack:null}),r=Jc(i,r,l)}else if(kt||xs(i,r,l,!1),v=(l&i.childLanes)!==0,kt||v){if(v=tt,v!==null&&(u=ip(v,l),u!==0&&u!==N.retryLane))throw N.retryLane=u,Br(i,u),vi(v,i,u),Kc;Bh(w)||Ao(),r=Jc(i,r,l)}else Bh(w)?(r.flags|=192,r.child=i.child,r=null):(i=N.treeContext,lt=Fi(w.nextSibling),Xt=r,Ue=!0,$n=null,Ui=!1,i!==null&&Qp(r,i),r=Qc(r,u.children),r.flags|=4096);return r}return d?(ir(),w=u.fallback,d=r.mode,N=i.child,q=N.sibling,u=bn(N,{mode:"hidden",children:u.children}),u.subtreeFlags=N.subtreeFlags&65011712,q!==null?w=bn(q,w):(w=Nr(w,d,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,Rl(null,u),u=r.child,w=i.child.memoizedState,w===null?w=Gc(l):(d=w.cachePool,d!==null?(N=wt._currentValue,d=d.parent!==N?{parent:N,pool:N}:d):d=rm(),w={baseLanes:w.baseLanes|l,cachePool:d}),u.memoizedState=w,u.childLanes=Zc(i,v,l),r.memoizedState=$c,Rl(i.child,u)):(tr(r),l=i.child,i=l.sibling,l=bn(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 Qc(i,r){return r=yo({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function yo(i,r){return i=wi(22,i,null,r),i.lanes=0,i}function Jc(i,r,l){return Ur(r,i.child,null,l),i=Qc(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),pc(i.return,r,l)}function eh(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=yt.current,w=(v&2)!==0;if(w?(v=v&1|2,r.flags|=128):v&=1,C(yt,v),Gt(i,r,u,l),u=Ue?gl:0,!w&&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&&lo(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),eh(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&&lo(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}eh(r,!0,l,null,m,u);break;case"together":eh(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function En(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),sr|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(xs(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=bn(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=bn(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function th(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Qa(i)))}function g1(i,r,l){switch(r.tag){case 3:Le(r,r.stateNode.containerInfo),Zn(r,wt,i.memoizedState.cache),Lr();break;case 27:case 5:st(r);break;case 4:Le(r,r.stateNode.containerInfo);break;case 10:Zn(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Ec(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(tr(r),r.flags|=128,null):(l&r.child.childLanes)!==0?__(i,r,l):(tr(r),i=En(i,r,l),i!==null?i.sibling:null);tr(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(xs(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),C(yt,yt.current),u)break;return null;case 22:return r.lanes=0,c_(i,r,l,r.pendingProps);case 24:Zn(r,wt,i.memoizedState.cache)}return En(i,r,l)}function y_(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)kt=!0;else{if(!th(i,l)&&(r.flags&128)===0)return kt=!1,g1(i,r,l);kt=(i.flags&131072)!==0}else kt=!1,Ue&&(r.flags&1048576)!==0&&Zp(r,gl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Hr(r.elementType),r.type=i,typeof i=="function")lc(i)?(u=Fr(i,u),r.tag=1,r=p_(null,r,i,u,l)):(r.tag=0,r=Xc(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===te){r.tag=14,r=o_(null,r,i,u,l);break e}}throw r=A(i)||i,Error(s(306,r,""))}}return r;case 0:return Xc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Fr(u,r.pendingProps),p_(i,r,u,d,l);case 3:e:{if(Le(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;d=m.element,Sc(i,r),kl(r,u,null,l);var v=r.memoizedState;if(u=v.cache,Zn(r,wt,u),u!==m.cache&&mc(r,[wt],l,!0),Cl(),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=ji(Error(s(424)),r),vl(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(lt=Fi(i.firstChild),Xt=r,Ue=!0,$n=null,Ui=!0,l=cm(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Lr(),u===d){r=En(i,r,l);break e}Gt(i,r,u,l)}r=r.child}return r;case 26:return vo(i,r),i===null?(l=Rg(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ue||(l=r.type,i=r.pendingProps,u=zo(de.current).createElement(l),u[Kt]=r,u[fi]=i,Zt(u,l,i),Ot(u),r.stateNode=u):r.memoizedState=Rg(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return st(r),i===null&&Ue&&(u=r.stateNode=Tg(r.type,r.pendingProps,de.current),Xt=r,Ui=!0,d=lt,cr(r.type)?(Lh=d,lt=Fi(u.firstChild)):lt=d),Gt(i,r,r.pendingProps.children,l),vo(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Ue&&((d=u=lt)&&(u=K1(u,r.type,r.pendingProps,Ui),u!==null?(r.stateNode=u,Xt=r,lt=Fi(u.firstChild),Ui=!1,d=!0):d=!1),d||Gn(r)),st(r),d=r.type,m=r.pendingProps,v=i!==null?i.memoizedProps:null,u=m.children,Dh(d,m)?u=null:v!==null&&Dh(d,v)&&(r.flags|=32),r.memoizedState!==null&&(d=Ac(i,r,o1,null,null,l),Yl._currentValue=d),vo(i,r),Gt(i,r,u,l),r.child;case 6:return i===null&&Ue&&((i=l=lt)&&(l=X1(l,r.pendingProps,Ui),l!==null?(r.stateNode=l,Xt=r,lt=null,i=!0):i=!1),i||Gn(r)),null;case 13:return __(i,r,l);case 4:return Le(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Ur(r,null,u,l):Gt(i,r,u,l),r.child;case 11:return a_(i,r,r.type,r.pendingProps,l);case 7:return Gt(i,r,r.pendingProps,l),r.child;case 8:return Gt(i,r,r.pendingProps.children,l),r.child;case 12:return Gt(i,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,Zn(r,r.type,u.value),Gt(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,Or(r),d=$t(d),u=u(d),r.flags|=1,Gt(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 Or(r),u=$t(wt),i===null?(d=vc(),d===null&&(d=tt,m=_c(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),r.memoizedState={parent:u,cache:d},bc(r),Zn(r,wt,d)):((i.lanes&l)!==0&&(Sc(i,r),kl(r,null,null,l),Cl()),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),Zn(r,wt,u)):(u=m.cache,Zn(r,wt,u),u!==d.cache&&mc(r,[wt],l,!0))),Gt(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Tn(i){i.flags|=4}function ih(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 Pr=io,yc}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 Pr=io,yc}function bo(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?Jd():536870912,i.lanes|=r,Ls|=r)}function Ml(i,r){if(!Ue)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 at(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(cc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(r),null;case 1:return at(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),wn(wt),Ee(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(Ss(r)?Tn(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,fc())),at(r),null;case 26:var d=r.type,m=r.memoizedState;return i===null?(Tn(r),m!==null?(at(r),b_(r,m)):(at(r),ih(r,d,null,u,l))):m?m!==i.memoizedState?(Tn(r),at(r),b_(r,m)):(at(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&Tn(r),at(r),ih(r,d,i,u,l)),null;case 27:if(Ye(r),l=de.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&Tn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return at(r),null}i=Q.current,Ss(r)?Jp(r):(i=Tg(d,u,l),r.stateNode=i,Tn(r))}return at(r),null;case 5:if(Ye(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&Tn(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return at(r),null}if(m=Q.current,Ss(r))Jp(r);else{var v=zo(de.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[Kt]=r,m[fi]=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(Zt(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&&Tn(r)}}return at(r),ih(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&Tn(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=de.current,Ss(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=Xt,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[Kt]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||_g(i.nodeValue,l)),i||Gn(r,!0)}else i=zo(i).createTextNode(u),i[Kt]=r,r.stateNode=i}return at(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=Ss(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[Kt]=r}else Lr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;at(r),i=!1}else l=fc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(ki(r),r):(ki(r),null);if((r.flags&128)!==0)throw Error(s(558))}return at(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=Ss(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[Kt]=r}else Lr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;at(r),d=!1}else d=fc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(ki(r),r):(ki(r),null)}return ki(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),bo(r,r.updateQueue),at(r),null);case 4:return Ee(),i===null&&Ch(r.stateNode.containerInfo),at(r),null;case 10:return wn(r.type),at(r),null;case 19:if(K(yt),u=r.memoizedState,u===null)return at(r),null;if(d=(r.flags&128)!==0,m=u.rendering,m===null)if(d)Ml(u,!1);else{if(pt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=lo(i),m!==null){for(r.flags|=128,Ml(u,!1),i=m.updateQueue,r.updateQueue=i,bo(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)Xp(l,i),l=l.sibling;return C(yt,yt.current&1|2),Ue&&Sn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&vt()>ko&&(r.flags|=128,d=!0,Ml(u,!1),r.lanes=4194304)}else{if(!d)if(i=lo(m),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,bo(r,i),Ml(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!Ue)return at(r),null}else 2*vt()-u.renderingStartTime>ko&&l!==536870912&&(r.flags|=128,d=!0,Ml(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=vt(),i.sibling=null,l=yt.current,C(yt,d?l&1|2:l&1),Ue&&Sn(r,u.treeForkCount),i):(at(r),null);case 22:case 23:return ki(r),kc(),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&&(at(r),r.subtreeFlags&6&&(r.flags|=8192)):at(r),l=r.updateQueue,l!==null&&bo(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&&K(jr),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),wn(wt),at(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function y1(i,r){switch(cc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return wn(wt),Ee(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Ye(r),null;case 31:if(r.memoizedState!==null){if(ki(r),r.alternate===null)throw Error(s(340));Lr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(ki(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Lr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return K(yt),null;case 4:return Ee(),null;case 10:return wn(r.type),null;case 22:case 23:return ki(r),kc(),i!==null&&K(jr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return wn(wt),null;case 25:return null;default:return null}}function S_(i,r){switch(cc(r),r.tag){case 3:wn(wt),Ee();break;case 26:case 27:case 5:Ye(r);break;case 4:Ee();break;case 31:r.memoizedState!==null&&ki(r);break;case 13:ki(r);break;case 19:K(yt);break;case 10:wn(r.type);break;case 22:case 23:ki(r),kc(),i!==null&&K(jr);break;case 24:wn(wt)}}function Bl(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){Ke(r,r.return,w)}}function nr(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 N=l,q=w;try{q()}catch(J){Ke(d,N,J)}}}u=u.next}while(u!==m)}}catch(J){Ke(r,r.return,J)}}function x_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{fm(r,l)}catch(u){Ke(i,i.return,u)}}}function w_(i,r,l){l.props=Fr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){Ke(i,r,u)}}function Nl(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){Ke(i,r,d)}}function rn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){Ke(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){Ke(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){Ke(i,i.return,d)}}function nh(i,r,l){try{var u=i.stateNode;I1(u,i.type,l,r),u[fi]=r}catch(d){Ke(i,i.return,d)}}function k_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&cr(i.type)||i.tag===4}function rh(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&&cr(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 sh(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=vn));else if(u!==4&&(u===27&&cr(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(sh(i,r,l),i=i.sibling;i!==null;)sh(i,r,l),i=i.sibling}function So(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&&cr(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(So(i,r,l),i=i.sibling;i!==null;)So(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]);Zt(r,u,l),r[Kt]=i,r[fi]=l}catch(m){Ke(i,i.return,m)}}var An=!1,Et=!1,lh=!1,T_=typeof WeakSet=="function"?WeakSet:Set,jt=null;function b1(i,r){if(i=i.containerInfo,Th=Fo,i=Pp(i),Ju(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,N=-1,q=0,J=0,ne=i,Y=null;t:for(;;){for(var X;ne!==l||d!==0&&ne.nodeType!==3||(w=v+d),ne!==m||u!==0&&ne.nodeType!==3||(N=v+u),ne.nodeType===3&&(v+=ne.nodeValue.length),(X=ne.firstChild)!==null;)Y=ne,ne=X;for(;;){if(ne===i)break t;if(Y===l&&++q===d&&(w=v),Y===m&&++J===u&&(N=v),(X=ne.nextSibling)!==null)break;ne=Y,Y=ne.parentNode}ne=X}l=w===-1||N===-1?null:{start:w,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ah={focusedElem:i,selectionRange:l},Fo=!1,jt=r;jt!==null;)if(r=jt,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,jt=i;else for(;jt!==null;){switch(r=jt,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 ge=Fr(l.type,d);i=u.getSnapshotBeforeUpdate(ge,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(we){Ke(l,l.return,we)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Mh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Mh(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,jt=i;break}jt=r.return}}function A_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:Rn(i,l),u&4&&Bl(5,l);break;case 1:if(Rn(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(v){Ke(l,l.return,v)}else{var d=Fr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ke(l,l.return,v)}}u&64&&x_(l),u&512&&Nl(l,l.return);break;case 3:if(Rn(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){Ke(l,l.return,v)}}break;case 27:r===null&&u&4&&E_(l);case 26:case 5:Rn(i,l),r===null&&u&4&&C_(l),u&512&&Nl(l,l.return);break;case 12:Rn(i,l);break;case 31:Rn(i,l),u&4&&M_(i,l);break;case 13:Rn(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||An,!u){r=r!==null&&r.memoizedState!==null||Et,d=An;var m=Et;An=u,(Et=r)&&!m?Mn(i,l,(l.subtreeFlags&8772)!==0):Rn(i,l),An=d,Et=m}break;case 30:break;default:Rn(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&&Ou(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 ut=null,pi=!1;function Dn(i,r,l){for(l=l.child;l!==null;)R_(i,r,l),l=l.sibling}function R_(i,r,l){if(Je&&typeof Je.onCommitFiberUnmount=="function")try{Je.onCommitFiberUnmount(nt,l)}catch{}switch(l.tag){case 26:Et||rn(l,r),Dn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Et||rn(l,r);var u=ut,d=pi;cr(l.type)&&(ut=l.stateNode,pi=!1),Dn(i,r,l),Fl(l.stateNode),ut=u,pi=d;break;case 5:Et||rn(l,r);case 6:if(u=ut,d=pi,ut=null,Dn(i,r,l),ut=u,pi=d,ut!==null)if(pi)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(l.stateNode)}catch(m){Ke(l,r,m)}else try{ut.removeChild(l.stateNode)}catch(m){Ke(l,r,m)}break;case 18:ut!==null&&(pi?(i=ut,xg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),Fs(i)):xg(ut,l.stateNode));break;case 4:u=ut,d=pi,ut=l.stateNode.containerInfo,pi=!0,Dn(i,r,l),ut=u,pi=d;break;case 0:case 11:case 14:case 15:nr(2,l,r),Et||nr(4,l,r),Dn(i,r,l);break;case 1:Et||(rn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&w_(l,r,u)),Dn(i,r,l);break;case 21:Dn(i,r,l);break;case 22:Et=(u=Et)||l.memoizedState!==null,Dn(i,r,l),Et=u;break;default:Dn(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{Fs(i)}catch(l){Ke(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{Fs(i)}catch(l){Ke(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 xo(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 mi(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(cr(w.type)){ut=w.stateNode,pi=!1;break e}break;case 5:ut=w.stateNode,pi=!1;break e;case 3:case 4:ut=w.stateNode.containerInfo,pi=!0;break e}w=w.return}if(ut===null)throw Error(s(160));R_(m,v,d),ut=null,pi=!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 Zi=null;function N_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:mi(r,i),_i(i),u&4&&(nr(3,i,i.return),Bl(3,i),nr(5,i,i.return));break;case 1:mi(r,i),_i(i),u&512&&(Et||l===null||rn(l,l.return)),u&64&&An&&(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=Zi;if(mi(r,i),_i(i),u&512&&(Et||l===null||rn(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[ll]||m[Kt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(u),d.head.insertBefore(m,d.querySelector("head > title"))),Zt(m,u,l),m[Kt]=i,Ot(m),u=m;break e;case"link":var v=Ng("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),Zt(m,u,l),d.head.appendChild(m);break;case"meta":if(v=Ng("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),Zt(m,u,l),d.head.appendChild(m);break;default:throw Error(s(468,u))}m[Kt]=i,Ot(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&&nh(i,i.memoizedProps,l.memoizedProps)}break;case 27:mi(r,i),_i(i),u&512&&(Et||l===null||rn(l,l.return)),l!==null&&u&4&&nh(i,i.memoizedProps,l.memoizedProps);break;case 5:if(mi(r,i),_i(i),u&512&&(Et||l===null||rn(l,l.return)),i.flags&32){d=i.stateNode;try{hs(d,"")}catch(ge){Ke(i,i.return,ge)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,nh(i,d,l!==null?l.memoizedProps:d)),u&1024&&(lh=!0);break;case 6:if(mi(r,i),_i(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(ge){Ke(i,i.return,ge)}}break;case 3:if(Ho=null,d=Zi,Zi=Oo(r.containerInfo),mi(r,i),Zi=d,_i(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Fs(r.containerInfo)}catch(ge){Ke(i,i.return,ge)}lh&&(lh=!1,L_(i));break;case 4:u=Zi,Zi=Oo(i.stateNode.containerInfo),mi(r,i),_i(i),Zi=u;break;case 12:mi(r,i),_i(i);break;case 31:mi(r,i),_i(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,xo(i,u)));break;case 13:mi(r,i),_i(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Co=vt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,xo(i,u)));break;case 22:d=i.memoizedState!==null;var N=l!==null&&l.memoizedState!==null,q=An,J=Et;if(An=q||d,Et=J||N,mi(r,i),Et=J,An=q,_i(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||N||An||Et||qr(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){N=l=r;try{if(m=N.stateNode,d)v=m.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=N.stateNode;var ne=N.memoizedProps.style,Y=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(ge){Ke(N,N.return,ge)}}}else if(r.tag===6){if(l===null){N=r;try{N.stateNode.nodeValue=d?"":N.memoizedProps}catch(ge){Ke(N,N.return,ge)}}}else if(r.tag===18){if(l===null){N=r;try{var X=N.stateNode;d?wg(X,!0):wg(N.stateNode,!1)}catch(ge){Ke(N,N.return,ge)}}}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,xo(i,l))));break;case 19:mi(r,i),_i(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,xo(i,u)));break;case 30:break;case 21:break;default:mi(r,i),_i(i)}}function _i(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=rh(i);So(i,m,d);break;case 5:var v=l.stateNode;l.flags&32&&(hs(v,""),l.flags&=-33);var w=rh(i);So(i,w,v);break;case 3:case 4:var N=l.stateNode.containerInfo,q=rh(i);sh(i,q,N);break;default:throw Error(s(161))}}catch(J){Ke(i,i.return,J)}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 Rn(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)A_(i,r.alternate,r),r=r.sibling}function qr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:nr(4,r,r.return),qr(r);break;case 1:rn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&w_(r,r.return,l),qr(r);break;case 27:Fl(r.stateNode);case 26:case 5:rn(r,r.return),qr(r);break;case 22:r.memoizedState===null&&qr(r);break;case 30:qr(r);break;default:qr(r)}i=i.sibling}}function Mn(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:Mn(d,m,l),Bl(4,m);break;case 1:if(Mn(d,m,l),u=m,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(q){Ke(u,u.return,q)}if(u=m,d=u.updateQueue,d!==null){var w=u.stateNode;try{var N=d.shared.hiddenCallbacks;if(N!==null)for(d.shared.hiddenCallbacks=null,d=0;d<N.length;d++)hm(N[d],w)}catch(q){Ke(u,u.return,q)}}l&&v&64&&x_(m),Nl(m,m.return);break;case 27:E_(m);case 26:case 5:Mn(d,m,l),l&&u===null&&v&4&&C_(m),Nl(m,m.return);break;case 12:Mn(d,m,l);break;case 31:Mn(d,m,l),l&&v&4&&M_(d,m);break;case 13:Mn(d,m,l),l&&v&4&&B_(d,m);break;case 22:m.memoizedState===null&&Mn(d,m,l),Nl(m,m.return);break;case 30:break;default:Mn(d,m,l)}r=r.sibling}}function ah(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&&yl(l))}function oh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&yl(i))}function Qi(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:Qi(i,r,l,u),d&2048&&Bl(9,r);break;case 1:Qi(i,r,l,u);break;case 3:Qi(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&&yl(i)));break;case 12:if(d&2048){Qi(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(N){Ke(r,r.return,N)}}else Qi(i,r,l,u);break;case 31:Qi(i,r,l,u);break;case 13:Qi(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,v=r.alternate,r.memoizedState!==null?m._visibility&2?Qi(i,r,l,u):Ll(i,r):m._visibility&2?Qi(i,r,l,u):(m._visibility|=2,Ms(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&ah(v,r);break;case 24:Qi(i,r,l,u),d&2048&&oh(r.alternate,r);break;default:Qi(i,r,l,u)}}function Ms(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,N=u,q=v.flags;switch(v.tag){case 0:case 11:case 15:Ms(m,v,w,N,d),Bl(8,v);break;case 23:break;case 22:var J=v.stateNode;v.memoizedState!==null?J._visibility&2?Ms(m,v,w,N,d):Ll(m,v):(J._visibility|=2,Ms(m,v,w,N,d)),d&&q&2048&&ah(v.alternate,v);break;case 24:Ms(m,v,w,N,d),d&&q&2048&&oh(v.alternate,v);break;default:Ms(m,v,w,N,d)}r=r.sibling}}function Ll(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:Ll(l,u),d&2048&&ah(u.alternate,u);break;case 24:Ll(l,u),d&2048&&oh(u.alternate,u);break;default:Ll(l,u)}r=r.sibling}}var zl=8192;function Bs(i,r,l){if(i.subtreeFlags&zl)for(i=i.child;i!==null;)O_(i,r,l),i=i.sibling}function O_(i,r,l){switch(i.tag){case 26:Bs(i,r,l),i.flags&zl&&i.memoizedState!==null&&ax(l,Zi,i.memoizedState,i.memoizedProps);break;case 5:Bs(i,r,l);break;case 3:case 4:var u=Zi;Zi=Oo(i.stateNode.containerInfo),Bs(i,r,l),Zi=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=zl,zl=16777216,Bs(i,r,l),zl=u):Bs(i,r,l));break;default:Bs(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 Ol(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];jt=u,P_(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:Ol(i),i.flags&2048&&nr(9,i,i.return);break;case 3:Ol(i);break;case 12:Ol(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,wo(i)):Ol(i);break;default:Ol(i)}}function wo(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];jt=u,P_(u,i)}j_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:nr(8,r,r.return),wo(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,wo(r));break;default:wo(r)}i=i.sibling}}function P_(i,r){for(;jt!==null;){var l=jt;switch(l.tag){case 0:case 11:case 15:nr(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:yl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,jt=u;else e:for(l=i;jt!==null;){u=jt;var d=u.sibling,m=u.return;if(D_(u),u===l){jt=null;break e}if(d!==null){d.return=m,jt=d;break e}jt=m}}}var x1={getCacheForType:function(i){var r=$t(wt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return $t(wt).controller.signal}},w1=typeof WeakMap=="function"?WeakMap:Map,We=0,tt=null,ze=null,He=0,Ve=0,Ei=null,rr=!1,Ns=!1,uh=!1,Bn=0,pt=0,sr=0,Wr=0,ch=0,Ti=0,Ls=0,jl=null,gi=null,hh=!1,Co=0,U_=0,ko=1/0,Eo=null,lr=null,Rt=0,ar=null,zs=null,Nn=0,fh=0,dh=null,I_=null,Hl=0,ph=null;function Ai(){return(We&2)!==0&&He!==0?He&-He:T.T!==null?bh():np()}function F_(){if(Ti===0)if((He&536870912)===0||Ue){var i=Na;Na<<=1,(Na&3932160)===0&&(Na=262144),Ti=i}else Ti=536870912;return i=Ci.current,i!==null&&(i.flags|=32),Ti}function vi(i,r,l){(i===tt&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)&&(Os(i,0),or(i,He,Ti,!1)),sl(i,l),((We&2)===0||i!==tt)&&(i===tt&&((We&2)===0&&(Wr|=l),pt===4&&or(i,He,Ti,!1)),sn(i))}function q_(i,r,l){if((We&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||rl(i,r),d=u?E1(i,r):_h(i,r,!0),m=u;do{if(d===0){Ns&&!u&&or(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!C1(l)){d=_h(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=jl;var N=w.current.memoizedState.isDehydrated;if(N&&(Os(w,v).flags|=256),v=_h(w,v,!1),v!==2){if(uh&&!N){w.errorRecoveryDisabledLanes|=m,Wr|=m,d=4;break e}m=gi,gi=d,m!==null&&(gi===null?gi=m:gi.push.apply(gi,m))}d=v}if(m=!1,d!==2)continue}}if(d===1){Os(i,0),or(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:or(u,r,Ti,!rr);break e;case 2:gi=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=Co+300-vt(),10<d)){if(or(u,r,Ti,!rr),za(u,0,!0)!==0)break e;Nn=r,u.timeoutHandle=bg(W_.bind(null,u,l,gi,Eo,hh,r,Ti,Wr,Ls,rr,m,"Throttled",-0,0),d);break e}W_(u,l,gi,Eo,hh,r,Ti,Wr,Ls,rr,m,null,-0,0)}}break}while(!0);sn(i)}function W_(i,r,l,u,d,m,v,w,N,q,J,ne,Y,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:vn},O_(r,m,ne);var ge=(m&62914560)===m?Co-vt():(m&4194048)===m?U_-vt():0;if(ge=ox(ne,ge),ge!==null){Nn=m,i.cancelPendingCommit=ge(Q_.bind(null,i,r,m,l,u,d,v,w,N,J,ne,null,Y,X)),or(i,m,v,!q);return}}Q_(i,r,m,l,u,d,v,w,N)}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(!xi(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 or(i,r,l,u){r&=~ch,r&=~Wr,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var m=31-et(d),v=1<<m;u[m]=-1,d&=~v}l!==0&&ep(i,l,r)}function To(){return(We&6)===0?(Pl(0),!1):!0}function mh(){if(ze!==null){if(Ve===0)var i=ze.return;else i=ze,xn=zr=null,Mc(i),Es=null,Sl=0,i=ze;for(;i!==null;)S_(i.alternate,i),i=i.return;ze=null}}function Os(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,W1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Nn=0,mh(),tt=i,ze=l=bn(i.current,null),He=r,Ve=0,Ei=null,rr=!1,Ns=rl(i,r),uh=!1,Ls=Ti=ch=Wr=sr=pt=0,gi=jl=null,hh=!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-et(u),m=1<<d;r|=i[d],u&=~m}return Bn=r,Ka(),l}function Y_(i,r){De=null,T.H=Dl,r===ks||r===to?(r=am(),Ve=3):r===yc?(r=am(),Ve=4):Ve=r===Kc?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ei=r,ze===null&&(pt=1,_o(i,ji(r,i.current)))}function V_(){var i=Ci.current;return i===null?!0:(He&4194048)===He?Ii===null:(He&62914560)===He||(He&536870912)!==0?i===Ii:!1}function K_(){var i=T.H;return T.H=Dl,i===null?Dl:i}function X_(){var i=T.A;return T.A=x1,i}function Ao(){pt=4,rr||(He&4194048)!==He&&Ci.current!==null||(Ns=!0),(sr&134217727)===0&&(Wr&134217727)===0||tt===null||or(tt,He,Ti,!1)}function _h(i,r,l){var u=We;We|=2;var d=K_(),m=X_();(tt!==i||He!==r)&&(Eo=null,Os(i,r)),r=!1;var v=pt;e:do try{if(Ve!==0&&ze!==null){var w=ze,N=Ei;switch(Ve){case 8:mh(),v=6;break e;case 3:case 2:case 9:case 6:Ci.current===null&&(r=!0);var q=Ve;if(Ve=0,Ei=null,js(i,w,N,q),l&&Ns){v=0;break e}break;default:q=Ve,Ve=0,Ei=null,js(i,w,N,q)}}k1(),v=pt;break}catch(J){Y_(i,J)}while(!0);return r&&i.shellSuspendCounter++,xn=zr=null,We=u,T.H=d,T.A=m,ze===null&&(tt=null,He=0,Ka()),v}function k1(){for(;ze!==null;)$_(ze)}function E1(i,r){var l=We;We|=2;var u=K_(),d=X_();tt!==i||He!==r?(Eo=null,ko=vt()+500,Os(i,r)):Ns=rl(i,r);e:do try{if(Ve!==0&&ze!==null){r=ze;var m=Ei;t:switch(Ve){case 1:Ve=0,Ei=null,js(i,r,m,1);break;case 2:case 9:if(sm(m)){Ve=0,Ei=null,G_(r);break}r=function(){Ve!==2&&Ve!==9||tt!==i||(Ve=7),sn(i)},m.then(r,r);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:sm(m)?(Ve=0,Ei=null,G_(r)):(Ve=0,Ei=null,js(i,r,m,7));break;case 5:var v=null;switch(ze.tag){case 26:v=ze.memoizedState;case 5:case 27:var w=ze;if(v?zg(v):w.stateNode.complete){Ve=0,Ei=null;var N=w.sibling;if(N!==null)ze=N;else{var q=w.return;q!==null?(ze=q,Do(q)):ze=null}break t}}Ve=0,Ei=null,js(i,r,m,5);break;case 6:Ve=0,Ei=null,js(i,r,m,6);break;case 8:mh(),pt=6;break e;default:throw Error(s(462))}}T1();break}catch(J){Y_(i,J)}while(!0);return xn=zr=null,T.H=u,T.A=d,We=l,ze!==null?0:(tt=null,He=0,Ka(),pt)}function T1(){for(;ze!==null&&!Ma();)$_(ze)}function $_(i){var r=y_(i.alternate,i,Bn);i.memoizedProps=i.pendingProps,r===null?Do(i):ze=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,He);break;case 11:r=d_(l,r,r.pendingProps,r.type.render,r.ref,He);break;case 5:Mc(r);default:S_(l,r),r=ze=Xp(r,Bn),r=y_(l,r,Bn)}i.memoizedProps=i.pendingProps,r===null?Do(i):ze=r}function js(i,r,l,u){xn=zr=null,Mc(r),Es=null,Sl=0;var d=r.return;try{if(m1(i,d,r,l,He)){pt=1,_o(i,ji(l,i.current)),ze=null;return}}catch(m){if(d!==null)throw ze=d,m;pt=1,_o(i,ji(l,i.current)),ze=null;return}r.flags&32768?(Ue||u===1?i=!0:Ns||(He&536870912)!==0?i=!1:(rr=i=!0,(u===2||u===9||u===3||u===6)&&(u=Ci.current,u!==null&&u.tag===13&&(u.flags|=16384))),Z_(r,i)):Do(r)}function Do(i){var r=i;do{if((r.flags&32768)!==0){Z_(r,rr);return}i=r.return;var l=v1(r.alternate,r,Bn);if(l!==null){ze=l;return}if(r=r.sibling,r!==null){ze=r;return}ze=r=i}while(r!==null);pt===0&&(pt=5)}function Z_(i,r){do{var l=y1(i.alternate,i);if(l!==null){l.flags&=32767,ze=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){ze=i;return}ze=i=l}while(i!==null);pt=6,ze=null}function Q_(i,r,l,u,d,m,v,w,N){i.cancelPendingCommit=null;do Ro();while(Rt!==0);if((We&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=rc,l0(i,l,m,v,w,N),i===tt&&(ze=tt=null,He=0),zs=r,ar=i,Nn=l,fh=m,dh=d,I_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,M1(be,function(){return ng(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=T.T,T.T=null,d=j.p,j.p=2,v=We,We|=4;try{b1(i,r,l)}finally{We=v,j.p=d,T.T=u}}Rt=1,J_(),eg(),tg()}}function J_(){if(Rt===1){Rt=0;var i=ar,r=zs,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var u=j.p;j.p=2;var d=We;We|=4;try{N_(r,i);var m=Ah,v=Pp(i.containerInfo),w=m.focusedElem,N=m.selectionRange;if(v!==w&&w&&w.ownerDocument&&Hp(w.ownerDocument.documentElement,w)){if(N!==null&&Ju(w)){var q=N.start,J=N.end;if(J===void 0&&(J=q),"selectionStart"in w)w.selectionStart=q,w.selectionEnd=Math.min(J,w.value.length);else{var ne=w.ownerDocument||document,Y=ne&&ne.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),ge=w.textContent.length,we=Math.min(N.start,ge),Ge=N.end===void 0?we:Math.min(N.end,ge);!X.extend&&we>Ge&&(v=Ge,Ge=we,we=v);var P=jp(w,we),z=jp(w,Ge);if(P&&z&&(X.rangeCount!==1||X.anchorNode!==P.node||X.anchorOffset!==P.offset||X.focusNode!==z.node||X.focusOffset!==z.offset)){var F=ne.createRange();F.setStart(P.node,P.offset),X.removeAllRanges(),we>Ge?(X.addRange(F),X.extend(z.node,z.offset)):(F.setEnd(z.node,z.offset),X.addRange(F))}}}}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 ie=ne[w];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Fo=!!Th,Ah=Th=null}finally{We=d,j.p=u,T.T=l}}i.current=r,Rt=2}}function eg(){if(Rt===2){Rt=0;var i=ar,r=zs,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var u=j.p;j.p=2;var d=We;We|=4;try{A_(i,r.alternate,r)}finally{We=d,j.p=u,T.T=l}}Rt=3}}function tg(){if(Rt===4||Rt===3){Rt=0,Er();var i=ar,r=zs,l=Nn,u=I_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Rt=5:(Rt=0,zs=ar=null,ig(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(lr=null),Lu(l),r=r.stateNode,Je&&typeof Je.onCommitFiberRoot=="function")try{Je.onCommitFiberRoot(nt,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=T.T,d=j.p,j.p=2,T.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{T.T=r,j.p=d}}(Nn&3)!==0&&Ro(),sn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===ph?Hl++:(Hl=0,ph=i):Hl=0,Pl(0)}}function ig(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,yl(r)))}function Ro(){return J_(),eg(),tg(),ng()}function ng(){if(Rt!==5)return!1;var i=ar,r=fh;fh=0;var l=Lu(Nn),u=T.T,d=j.p;try{j.p=32>l?32:l,T.T=null,l=dh,dh=null;var m=ar,v=Nn;if(Rt=0,zs=ar=null,Nn=0,(We&6)!==0)throw Error(s(331));var w=We;if(We|=4,H_(m.current),z_(m,m.current,v,l),We=w,Pl(0,!1),Je&&typeof Je.onPostCommitFiberRoot=="function")try{Je.onPostCommitFiberRoot(nt,m)}catch{}return!0}finally{j.p=d,T.T=u,ig(i,r)}}function rg(i,r,l){r=ji(l,r),r=Vc(i.stateNode,r,2),i=er(i,r,2),i!==null&&(sl(i,2),sn(i))}function Ke(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"&&(lr===null||!lr.has(u))){i=ji(l,i),l=s_(2),u=er(r,l,2),u!==null&&(l_(l,u,r,i),sl(u,2),sn(u));break}}r=r.return}}function gh(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)||(uh=!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,tt===i&&(He&l)===l&&(pt===4||pt===3&&(He&62914560)===He&&300>vt()-Co?(We&2)===0&&Os(i,0):ch|=l,Ls===He&&(Ls=0)),sn(i)}function sg(i,r){r===0&&(r=Jd()),i=Br(i,r),i!==null&&(sl(i,r),sn(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 mn(i,r)}var Mo=null,Hs=null,vh=!1,Bo=!1,yh=!1,ur=0;function sn(i){i!==Hs&&i.next===null&&(Hs===null?Mo=Hs=i:Hs=Hs.next=i),Bo=!0,vh||(vh=!0,N1())}function Pl(i,r){if(!yh&&Bo){yh=!0;do for(var l=!1,u=Mo;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-et(42|i)+1)-1,m&=d&~(v&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,ug(u,m))}else m=He,m=za(u,u===tt?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||rl(u,m)||(l=!0,ug(u,m));u=u.next}while(l);yh=!1}}function B1(){lg()}function lg(){Bo=vh=!1;var i=0;ur!==0&&q1()&&(i=ur);for(var r=vt(),l=null,u=Mo;u!==null;){var d=u.next,m=ag(u,r);m===0?(u.next=null,l===null?Mo=d:l.next=d,d===null&&(Hs=l)):(l=u,(i!==0||(m&3)!==0)&&(Bo=!0)),u=d}Rt!==0&&Rt!==5||Pl(i),ur!==0&&(ur=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-et(m),w=1<<v,N=d[v];N===-1?((w&l)===0||(w&u)!==0)&&(d[v]=s0(w,r)):N<=r&&(i.expiredLanes|=w),m&=~w}if(r=tt,l=He,l=za(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Wn(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||rl(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Wn(u),Lu(l)){case 2:case 8:l=ce;break;case 32:l=be;break;case 268435456:l=me;break;default:l=be}return u=og.bind(null,i),l=mn(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Wn(u),i.callbackPriority=2,i.callbackNode=null,2}function og(i,r){if(Rt!==0&&Rt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(Ro()&&i.callbackNode!==l)return null;var u=He;return u=za(i,i===tt?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(q_(i,u,r),ag(i,vt()),i.callbackNode!=null&&i.callbackNode===l?og.bind(null,i):null)}function ug(i,r){if(Ro())return null;q_(i,r,!0)}function N1(){Y1(function(){(We&6)!==0?mn(ee,B1):lg()})}function bh(){if(ur===0){var i=ws;i===0&&(i=Ba,Ba<<=1,(Ba&261888)===0&&(Ba=256)),ur=i}return ur}function cg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Pa(""+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[fi]||null).action),v=u.submitter;v&&(r=(r=v[fi]||null)?cg(r.formAction):v.getAttribute("formAction"),r!==null&&(m=r,v=null));var w=new qa("action","action",null,u,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ur!==0){var N=v?hg(d,v):new FormData(d);Uc(l,{pending:!0,data:N,method:d.method,action:m},null,N)}}else typeof m=="function"&&(w.preventDefault(),N=v?hg(d,v):new FormData(d),Uc(l,{pending:!0,data:N,method:d.method,action:m},m,N))},currentTarget:d}]})}}for(var Sh=0;Sh<nc.length;Sh++){var xh=nc[Sh],z1=xh.toLowerCase(),O1=xh[0].toUpperCase()+xh.slice(1);Gi(z1,"on"+O1)}Gi(Fp,"onAnimationEnd"),Gi(qp,"onAnimationIteration"),Gi(Wp,"onAnimationStart"),Gi("dblclick","onDoubleClick"),Gi("focusin","onFocus"),Gi("focusout","onBlur"),Gi(Q0,"onTransitionRun"),Gi(J0,"onTransitionStart"),Gi(e1,"onTransitionCancel"),Gi(Yp,"onTransitionEnd"),us("onMouseEnter",["mouseout","mouseover"]),us("onMouseLeave",["mouseout","mouseover"]),us("onPointerEnter",["pointerout","pointerover"]),us("onPointerLeave",["pointerout","pointerover"]),Ar("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ar("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ar("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ar("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ar("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ar("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ul="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(Ul));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 w=u[v],N=w.instance,q=w.currentTarget;if(w=w.listener,N!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=q;try{m(d)}catch(J){Va(J)}d.currentTarget=null,m=N}else for(v=0;v<u.length;v++){if(w=u[v],N=w.instance,q=w.currentTarget,w=w.listener,N!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=q;try{m(d)}catch(J){Va(J)}d.currentTarget=null,m=N}}}}function Oe(i,r){var l=r[zu];l===void 0&&(l=r[zu]=new Set);var u=i+"__bubble";l.has(u)||(dg(r,i,2,!1),l.add(u))}function wh(i,r,l){var u=0;r&&(u|=4),dg(l,i,u,r)}var No="_reactListening"+Math.random().toString(36).slice(2);function Ch(i){if(!i[No]){i[No]=!0,lp.forEach(function(l){l!=="selectionchange"&&(j1.has(l)||wh(l,!1,i),wh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[No]||(r[No]=!0,wh("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=Ph}l=d.bind(null,r,l,i),d=void 0,!Wu||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 kh(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 N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=ls(w),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){u=m=v;continue e}w=w.parentNode}}u=u.return}vp(function(){var q=m,J=Fu(l),ne=[];e:{var Y=Vp.get(i);if(Y!==void 0){var X=qa,ge=i;switch(i){case"keypress":if(Ia(l)===0)break e;case"keydown":case"keyup":X=R0;break;case"focusin":ge="focus",X=Xu;break;case"focusout":ge="blur",X=Xu;break;case"beforeblur":case"afterblur":X=Xu;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=P0}var we=(r&4)!==0,Ge=!we&&(i==="scroll"||i==="scrollend"),P=we?Y!==null?Y+"Capture":null:Y;we=[];for(var z=q,F;z!==null;){var ie=z;if(F=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||F===null||P===null||(ie=ol(z,P),ie!=null&&we.push(Il(z,ie,F))),Ge)break;z=z.return}0<we.length&&(Y=new X(Y,ge,null,l,J),ne.push({event:Y,listeners:we}))}}if((r&7)===0){e:{if(Y=i==="mouseover"||i==="pointerover",X=i==="mouseout"||i==="pointerout",Y&&l!==Iu&&(ge=l.relatedTarget||l.fromElement)&&(ls(ge)||ge[ss]))break e;if((X||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(ge=l.relatedTarget||l.toElement,X=q,ge=ge?ls(ge):null,ge!==null&&(Ge=o(ge),we=ge.tag,ge!==Ge||we!==5&&we!==27&&we!==6)&&(ge=null)):(X=null,ge=q),X!==ge)){if(we=Sp,ie="onMouseLeave",P="onMouseEnter",z="mouse",(i==="pointerout"||i==="pointerover")&&(we=wp,ie="onPointerLeave",P="onPointerEnter",z="pointer"),Ge=X==null?Y:al(X),F=ge==null?Y:al(ge),Y=new we(ie,z+"leave",X,l,J),Y.target=Ge,Y.relatedTarget=F,ie=null,ls(J)===q&&(we=new we(P,z+"enter",ge,l,J),we.target=F,we.relatedTarget=Ge,ie=we),Ge=ie,X&&ge)t:{for(we=H1,P=X,z=ge,F=0,ie=P;ie;ie=we(ie))F++;ie=0;for(var ye=z;ye;ye=we(ye))ie++;for(;0<F-ie;)P=we(P),F--;for(;0<ie-F;)z=we(z),ie--;for(;F--;){if(P===z||z!==null&&P===z.alternate){we=P;break t}P=we(P),z=we(z)}we=null}else we=null;X!==null&&pg(ne,Y,X,we,!1),ge!==null&&Ge!==null&&pg(ne,Ge,ge,we,!0)}}e:{if(Y=q?al(q):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var Fe=Mp;else if(Dp(Y))if(Bp)Fe=$0;else{Fe=K0;var ve=V0}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?q&&Uu(q.elementType)&&(Fe=Mp):Fe=X0;if(Fe&&(Fe=Fe(i,q))){Rp(ne,Fe,l,J);break e}ve&&ve(i,Y,q),i==="focusout"&&q&&Y.type==="number"&&q.memoizedProps.value!=null&&Pu(Y,"number",Y.value)}switch(ve=q?al(q):window,i){case"focusin":(Dp(ve)||ve.contentEditable==="true")&&(ms=ve,ec=q,_l=null);break;case"focusout":_l=ec=ms=null;break;case"mousedown":tc=!0;break;case"contextmenu":case"mouseup":case"dragend":tc=!1,Up(ne,l,J);break;case"selectionchange":if(Z0)break;case"keydown":case"keyup":Up(ne,l,J)}var Re;if(Gu)e:{switch(i){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else ps?Tp(i,l)&&(Pe="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(Cp&&l.locale!=="ko"&&(ps||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&ps&&(Re=yp()):(Kn=J,Yu="value"in Kn?Kn.value:Kn.textContent,ps=!0)),ve=Lo(q,Pe),0<ve.length&&(Pe=new xp(Pe,i,null,l,J),ne.push({event:Pe,listeners:ve}),Re?Pe.data=Re:(Re=Ap(l),Re!==null&&(Pe.data=Re)))),(Re=I0?F0(i,l):q0(i,l))&&(Pe=Lo(q,"onBeforeInput"),0<Pe.length&&(ve=new xp("onBeforeInput","beforeinput",null,l,J),ne.push({event:ve,listeners:Pe}),ve.data=Re)),L1(ne,i,q,l,J)}fg(ne,r)})}function Il(i,r,l){return{instance:i,listener:r,currentTarget:l}}function Lo(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=ol(i,l),d!=null&&u.unshift(Il(i,d,m)),d=ol(i,r),d!=null&&u.push(Il(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 w=l,N=w.alternate,q=w.stateNode;if(w=w.tag,N!==null&&N===u)break;w!==5&&w!==26&&w!==27||q===null||(N=q,d?(q=ol(l,m),q!=null&&v.unshift(Il(l,q,N))):d||(q=ol(l,m),q!=null&&v.push(Il(l,q,N)))),l=l.return}v.length!==0&&i.push({event:r,listeners:v})}var P1=/\r\n?/g,U1=/\u0000|\uFFFD/g;function mg(i){return(typeof i=="string"?i:""+i).replace(P1,`
|
|
49
|
-
`).replace(U1,"")}function _g(i,r){return r=mg(r),mg(i)===r}function $e(i,r,l,u,d,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||hs(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&hs(i,""+u);break;case"className":ja(i,"class",u);break;case"tabIndex":ja(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":ja(i,l,u);break;case"style":_p(i,u,m);break;case"data":if(r!=="object"){ja(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=Pa(""+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"&&$e(i,r,"name",d.name,d,null),$e(i,r,"formEncType",d.formEncType,d,null),$e(i,r,"formMethod",d.formMethod,d,null),$e(i,r,"formTarget",d.formTarget,d,null)):($e(i,r,"encType",d.encType,d,null),$e(i,r,"method",d.method,d,null),$e(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=Pa(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=vn);break;case"onScroll":u!=null&&Oe("scroll",i);break;case"onScrollEnd":u!=null&&Oe("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=Pa(""+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":Oe("beforetoggle",i),Oe("toggle",i),Oa(i,"popover",u);break;case"xlinkActuate":gn(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":gn(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":gn(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":gn(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":gn(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":gn(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":gn(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":gn(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":gn(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Oa(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,Oa(i,l,u))}}function Eh(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"?hs(i,u):(typeof u=="number"||typeof u=="bigint")&&hs(i,""+u);break;case"onScroll":u!=null&&Oe("scroll",i);break;case"onScrollEnd":u!=null&&Oe("scrollend",i);break;case"onClick":u!=null&&(i.onclick=vn);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[fi]||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,""):Oa(i,l,u)}}}function Zt(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",i),Oe("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:$e(i,r,m,v,l,null)}}d&&$e(i,r,"srcSet",l.srcSet,l,null),u&&$e(i,r,"src",l.src,l,null);return;case"input":Oe("invalid",i);var w=m=v=d=null,N=null,q=null;for(u in l)if(l.hasOwnProperty(u)){var J=l[u];if(J!=null)switch(u){case"name":d=J;break;case"type":v=J;break;case"checked":N=J;break;case"defaultChecked":q=J;break;case"value":m=J;break;case"defaultValue":w=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,r));break;default:$e(i,r,u,J,l,null)}}fp(i,m,w,N,q,v,d,!1);return;case"select":Oe("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:$e(i,r,d,w,l,null)}r=m,l=v,i.multiple=!!u,r!=null?cs(i,!!u,r,!1):l!=null&&cs(i,!!u,l,!0);return;case"textarea":Oe("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:$e(i,r,v,w,l,null)}pp(i,u,d,m);return;case"option":for(N in l)if(l.hasOwnProperty(N)&&(u=l[N],u!=null))switch(N){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:$e(i,r,N,u,l,null)}return;case"dialog":Oe("beforetoggle",i),Oe("toggle",i),Oe("cancel",i),Oe("close",i);break;case"iframe":case"object":Oe("load",i);break;case"video":case"audio":for(u=0;u<Ul.length;u++)Oe(Ul[u],i);break;case"image":Oe("error",i),Oe("load",i);break;case"details":Oe("toggle",i);break;case"embed":case"source":case"link":Oe("error",i),Oe("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(q in l)if(l.hasOwnProperty(q)&&(u=l[q],u!=null))switch(q){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:$e(i,r,q,u,l,null)}return;default:if(Uu(r)){for(J in l)l.hasOwnProperty(J)&&(u=l[J],u!==void 0&&Eh(i,r,J,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&$e(i,r,w,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,w=null,N=null,q=null,J=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":N=ne;default:u.hasOwnProperty(X)||$e(i,r,X,null,u,ne)}}for(var Y in u){var X=u[Y];if(ne=l[Y],u.hasOwnProperty(Y)&&(X!=null||ne!=null))switch(Y){case"type":m=X;break;case"name":d=X;break;case"checked":q=X;break;case"defaultChecked":J=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&&$e(i,r,Y,X,u,ne)}}Hu(i,v,w,N,q,J,m,d);return;case"select":X=v=w=Y=null;for(m in l)if(N=l[m],l.hasOwnProperty(m)&&N!=null)switch(m){case"value":break;case"multiple":X=N;default:u.hasOwnProperty(m)||$e(i,r,m,null,u,N)}for(d in u)if(m=u[d],N=l[d],u.hasOwnProperty(d)&&(m!=null||N!=null))switch(d){case"value":Y=m;break;case"defaultValue":w=m;break;case"multiple":v=m;default:m!==N&&$e(i,r,d,m,u,N)}r=w,l=v,u=X,Y!=null?cs(i,!!l,Y,!1):!!u!=!!l&&(r!=null?cs(i,!!l,r,!0):cs(i,!!l,l?[]:"",!1));return;case"textarea":X=Y=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:$e(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":Y=d;break;case"defaultValue":X=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&$e(i,r,v,d,u,m)}dp(i,Y,X);return;case"option":for(var ge in l)if(Y=l[ge],l.hasOwnProperty(ge)&&Y!=null&&!u.hasOwnProperty(ge))switch(ge){case"selected":i.selected=!1;break;default:$e(i,r,ge,null,u,Y)}for(N in u)if(Y=u[N],X=l[N],u.hasOwnProperty(N)&&Y!==X&&(Y!=null||X!=null))switch(N){case"selected":i.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:$e(i,r,N,Y,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 we in l)Y=l[we],l.hasOwnProperty(we)&&Y!=null&&!u.hasOwnProperty(we)&&$e(i,r,we,null,u,Y);for(q in u)if(Y=u[q],X=l[q],u.hasOwnProperty(q)&&Y!==X&&(Y!=null||X!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,r));break;default:$e(i,r,q,Y,u,X)}return;default:if(Uu(r)){for(var Ge in l)Y=l[Ge],l.hasOwnProperty(Ge)&&Y!==void 0&&!u.hasOwnProperty(Ge)&&Eh(i,r,Ge,void 0,u,Y);for(J in u)Y=u[J],X=l[J],!u.hasOwnProperty(J)||Y===X||Y===void 0&&X===void 0||Eh(i,r,J,Y,u,X);return}}for(var P in l)Y=l[P],l.hasOwnProperty(P)&&Y!=null&&!u.hasOwnProperty(P)&&$e(i,r,P,null,u,Y);for(ne in u)Y=u[ne],X=l[ne],!u.hasOwnProperty(ne)||Y===X||Y==null&&X==null||$e(i,r,ne,Y,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,w=d.duration;if(m&&w&&gg(v)){for(v=0,w=d.responseEnd,u+=1;u<l.length;u++){var N=l[u],q=N.startTime;if(q>w)break;var J=N.transferSize,ne=N.initiatorType;J&&gg(ne)&&(N=N.responseEnd,v+=J*(N<w?1:(w-q)/(N-q)))}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 Th=null,Ah=null;function zo(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 Dh(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 Rh=null;function q1(){var i=window.event;return i&&i.type==="popstate"?i===Rh?!1:(Rh=i,!0):(Rh=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 cr(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),Fs(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Fl(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,Fl(l);for(var m=l.firstChild;m;){var v=m.nextSibling,w=m.nodeName;m[ll]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=v}}else l==="body"&&Fl(i.ownerDocument.body);l=d}while(l);Fs(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 Mh(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":Mh(l),Ou(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[ll])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=Fi(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=Fi(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=Fi(i.nextSibling),i===null))return null;return i}function Bh(i){return i.data==="$?"||i.data==="$~"}function Nh(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 Fi(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 Lh=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 Fi(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=zo(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 Fl(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Ou(i)}var qi=new Map,Ag=new Set;function Oo(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ln=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=Ln.f(),r=To();return i||r}function Z1(i){var r=as(i);r!==null&&r.tag===5&&r.type==="form"?Ym(r):Ln.r(i)}var Ps=typeof document>"u"?null:document;function Dg(i,r,l){var u=Ps;if(u&&typeof r=="string"&&r){var d=zi(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"),Zt(r,"link",i),Ot(r),u.head.appendChild(r)))}}function Q1(i){Ln.D(i),Dg("dns-prefetch",i,null)}function J1(i,r){Ln.C(i,r),Dg("preconnect",i,r)}function ex(i,r,l){Ln.L(i,r,l);var u=Ps;if(u&&i&&r){var d='link[rel="preload"][as="'+zi(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+zi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+zi(l.imageSizes)+'"]')):d+='[href="'+zi(i)+'"]';var m=d;switch(r){case"style":m=Us(i);break;case"script":m=Is(i)}qi.has(m)||(i=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),qi.set(m,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(ql(m))||r==="script"&&u.querySelector(Wl(m))||(r=u.createElement("link"),Zt(r,"link",i),Ot(r),u.head.appendChild(r)))}}function tx(i,r){Ln.m(i,r);var l=Ps;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+zi(u)+'"][href="'+zi(i)+'"]',m=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Is(i)}if(!qi.has(m)&&(i=_({rel:"modulepreload",href:i},r),qi.set(m,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Wl(m)))return}u=l.createElement("link"),Zt(u,"link",i),Ot(u),l.head.appendChild(u)}}}function ix(i,r,l){Ln.S(i,r,l);var u=Ps;if(u&&i){var d=os(u).hoistableStyles,m=Us(i);r=r||"default";var v=d.get(m);if(!v){var w={loading:0,preload:null};if(v=u.querySelector(ql(m)))w.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":r},l),(l=qi.get(m))&&zh(i,l);var N=v=u.createElement("link");Ot(N),Zt(N,"link",i),N._p=new Promise(function(q,J){N.onload=q,N.onerror=J}),N.addEventListener("load",function(){w.loading|=1}),N.addEventListener("error",function(){w.loading|=2}),w.loading|=4,jo(v,r,u)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(m,v)}}}function nx(i,r){Ln.X(i,r);var l=Ps;if(l&&i){var u=os(l).hoistableScripts,d=Is(i),m=u.get(d);m||(m=l.querySelector(Wl(d)),m||(i=_({src:i,async:!0},r),(r=qi.get(d))&&Oh(i,r),m=l.createElement("script"),Ot(m),Zt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function rx(i,r){Ln.M(i,r);var l=Ps;if(l&&i){var u=os(l).hoistableScripts,d=Is(i),m=u.get(d);m||(m=l.querySelector(Wl(d)),m||(i=_({src:i,async:!0,type:"module"},r),(r=qi.get(d))&&Oh(i,r),m=l.createElement("script"),Ot(m),Zt(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=de.current)?Oo(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=Us(l.href),l=os(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=Us(l.href);var m=os(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(ql(i)))&&!m._p&&(v.instance=m,v.state.loading=5),qi.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},qi.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=Is(l),l=os(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 Us(i){return'href="'+zi(i)+'"'}function ql(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}),Zt(r,"link",l),Ot(r),i.head.appendChild(r))}function Is(i){return'[src="'+zi(i)+'"]'}function Wl(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~="'+zi(l.href)+'"]');if(u)return r.instance=u,Ot(u),u;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Ot(u),Zt(u,"style",d),jo(u,l.precedence,i),r.instance=u;case"stylesheet":d=Us(l.href);var m=i.querySelector(ql(d));if(m)return r.state.loading|=4,r.instance=m,Ot(m),m;u=Mg(l),(d=qi.get(d))&&zh(u,d),m=(i.ownerDocument||i).createElement("link"),Ot(m);var v=m;return v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Zt(m,"link",u),r.state.loading|=4,jo(m,l.precedence,i),r.instance=m;case"script":return m=Is(l.src),(d=i.querySelector(Wl(m)))?(r.instance=d,Ot(d),d):(u=l,(d=qi.get(m))&&(u=_({},l),Oh(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),Ot(d),Zt(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,jo(u,l.precedence,i));return r.instance}function jo(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 zh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Oh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Ho=null;function Ng(i,r,l){if(Ho===null){var u=new Map,d=Ho=new Map;d.set(l,u)}else d=Ho,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[ll]||m[Kt]||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 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=Us(u.href),m=r.querySelector(ql(d));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Po.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,Ot(m);return}m=r.ownerDocument||r,u=Mg(u),(d=qi.get(d))&&zh(u,d),m=m.createElement("link"),Ot(m);var v=m;v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Zt(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=Po.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var jh=0;function ox(i,r){return i.stylesheets&&i.count===0&&Io(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&Io(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&jh===0&&(jh=62500*F1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Io(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>jh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Po(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Io(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Uo=null;function Io(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Uo=new Map,r.forEach(ux,i),Uo=null,Po.call(i))}function ux(i,r){if(!(r.state.loading&4)){var l=Uo.get(i);if(l)var u=l.get(null);else{l=new Map,Uo.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=Po.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 Yl={$$typeof:I,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function cx(i,r,l,u,d,m,v,w,N){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=Bu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bu(0),this.hiddenUpdates=Bu(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Og(i,r,l,u,d,m,v,w,N,q,J,ne){return i=new cx(i,r,l,v,N,q,J,ne,w),r=1,m===!0&&(r|=24),m=wi(3,null,null,r),i.current=m,m.stateNode=i,r=_c(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},bc(m),i}function jg(i){return i?(i=vs,i):vs}function Hg(i,r,l,u,d,m){d=jg(d),u.context===null?u.context=d:u.pendingContext=d,u=Jn(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=er(i,u,r),l!==null&&(vi(l,i,r),wl(l,i,r))}function Pg(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Hh(i,r){Pg(i,r),(i=i.alternate)&&Pg(i,r)}function Ug(i){if(i.tag===13||i.tag===31){var r=Br(i,67108864);r!==null&&vi(r,i,67108864),Hh(i,67108864)}}function Ig(i){if(i.tag===13||i.tag===31){var r=Ai();r=Nu(r);var l=Br(i,r);l!==null&&vi(l,i,r),Hh(i,r)}}var Fo=!0;function hx(i,r,l,u){var d=T.T;T.T=null;var m=j.p;try{j.p=2,Ph(i,r,l,u)}finally{j.p=m,T.T=d}}function fx(i,r,l,u){var d=T.T;T.T=null;var m=j.p;try{j.p=8,Ph(i,r,l,u)}finally{j.p=m,T.T=d}}function Ph(i,r,l,u){if(Fo){var d=Uh(u);if(d===null)kh(i,r,u,qo,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=as(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var v=Tr(m.pendingLanes);if(v!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var N=1<<31-et(v);w.entanglements[1]|=N,v&=~N}sn(m),(We&6)===0&&(ko=vt()+500,Pl(0))}}break;case 31:case 13:w=Br(m,2),w!==null&&vi(w,m,2),To(),Hh(m,2)}if(m=Uh(u),m===null&&kh(i,r,u,qo,l),m===d)break;d=m}d!==null&&u.stopPropagation()}else kh(i,r,u,null,l)}}function Uh(i){return i=Fu(i),Ih(i)}var qo=null;function Ih(i){if(qo=null,i=ls(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 qo=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(_n()){case ee:return 2;case ce:return 8;case be:case le:return 32;case me:return 268435456;default:return 32}default:return 32}}var Fh=!1,hr=null,fr=null,dr=null,Vl=new Map,Kl=new Map,pr=[],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":hr=null;break;case"dragenter":case"dragleave":fr=null;break;case"mouseover":case"mouseout":dr=null;break;case"pointerover":case"pointerout":Vl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kl.delete(r.pointerId)}}function Xl(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=as(r),r!==null&&Ug(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 hr=Xl(hr,i,r,l,u,d),!0;case"dragenter":return fr=Xl(fr,i,r,l,u,d),!0;case"mouseover":return dr=Xl(dr,i,r,l,u,d),!0;case"pointerover":var m=d.pointerId;return Vl.set(m,Xl(Vl.get(m)||null,i,r,l,u,d)),!0;case"gotpointercapture":return m=d.pointerId,Kl.set(m,Xl(Kl.get(m)||null,i,r,l,u,d)),!0}return!1}function Wg(i){var r=ls(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 Wo(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=Uh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Iu=u,l.target.dispatchEvent(u),Iu=null}else return r=as(l),r!==null&&Ug(r),i.blockedOn=l,!1;r.shift()}return!0}function Yg(i,r,l){Wo(i)&&l.delete(r)}function mx(){Fh=!1,hr!==null&&Wo(hr)&&(hr=null),fr!==null&&Wo(fr)&&(fr=null),dr!==null&&Wo(dr)&&(dr=null),Vl.forEach(Yg),Kl.forEach(Yg)}function Yo(i,r){i.blockedOn===r&&(i.blockedOn=null,Fh||(Fh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,mx)))}var Vo=null;function Vg(i){Vo!==i&&(Vo=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Vo===i&&(Vo=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(Ih(u||l)===null)continue;break}var m=as(l);m!==null&&(i.splice(r,3),r-=3,Uc(m,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function Fs(i){function r(N){return Yo(N,i)}hr!==null&&Yo(hr,i),fr!==null&&Yo(fr,i),dr!==null&&Yo(dr,i),Vl.forEach(r),Kl.forEach(r);for(var l=0;l<pr.length;l++){var u=pr[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<pr.length&&(l=pr[0],l.blockedOn===null);)Wg(l),l.blockedOn===null&&pr.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[fi]||null;if(typeof m=="function")v||Vg(l);else if(v){var w=null;if(m&&m.hasAttribute("formAction")){if(d=m,v=m[fi]||null)w=v.formAction;else if(Ih(d)!==null)continue}else w=v.action;typeof w=="function"?l[u+1]=w:(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 qh(i){this._internalRoot=i}Ko.prototype.render=qh.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=Ai();Hg(l,u,i,r,null,null)},Ko.prototype.unmount=qh.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),To(),r[ss]=null}};function Ko(i){this._internalRoot=i}Ko.prototype.unstable_scheduleHydration=function(i){if(i){var r=np();i={blockedOn:null,target:i,priority:r};for(var l=0;l<pr.length&&r!==0&&r<pr[l].priority;l++);pr.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:T,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xo.isDisabled&&Xo.supportsFiber)try{nt=Xo.inject(_x),Je=Xo}catch{}}return Gl.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[ss]=r.current,Ch(i),new qh(r)},Gl.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",m=t_,v=i_,w=n_,N=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&&(N=l.formState)),r=Og(i,1,!0,r,l??null,u,d,N,m,v,w,Kg),r.context=jg(null),l=r.current,u=Ai(),u=Nu(u),d=Jn(u),d.callback=null,er(l,d,u),l=u,r.current.lanes=l,sl(r,l),sn(r),i[ss]=r.current,Ch(i),new Ko(r)},Gl.version="19.2.3",Gl}var rv;function Tx(){if(rv)return Vh.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(),Vh.exports=Ex(),Vh.exports}var Ax=Tx();const Dx=xu(Ax);function Rx({onLogin:e}){const[t,n]=$.useState(""),[s,a]=$.useState(null),[o,c]=$.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]=$.useState(""),[s,a]=$.useState(""),[o,c]=$.useState(null),[f,p]=$.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]=$.useState(null),[s,a]=$.useState(!1),[o,c]=$.useState(!1),[f,p]=$.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"}))};$.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]=$.useState(""),[a,o]=$.useState(""),[c,f]=$.useState(null),[p,h]=$.useState(!1),[g,_]=$.useState(!1),[b,y]=$.useState(null),[x,k]=$.useState("AI Writer"),[L,M]=$.useState(""),[G,I]=$.useState(""),[Z,W]=$.useState(!1),[O,te]=$.useState(null),[ue,_e]=$.useState(""),[U,se]=$.useState(null),[V,B]=$.useState(!1),[A,R]=$.useState(null),[T,j]=$.useState(null),H=$.useCallback((C,Q)=>fetch(C,{...Q,headers:{...Q==null?void 0:Q.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);$.useEffect(()=>{H("/api/settings/link-status").then(C=>C.json()).then(C=>y(C)).catch(()=>y({linked:!1}))},[]);const ae=async()=>{if(!x.trim()){te("Agent name is required");return}if(!L.trim()){te("Description is required");return}W(!0),te(null);try{const C=await H("/api/settings/register-agent",{method:"POST",body:JSON.stringify({name:x,description:L,...G.trim()&&{genre:G}})}),Q=await C.json();if(!C.ok)throw new Error(Q.error||"Registration failed");y({linked:!0,agentId:Q.agentId,owsWallet:Q.owsWallet,txHash:Q.txHash})}catch(C){te(C instanceof Error?C.message:"Registration failed")}W(!1)},E=async()=>{if(!ue.trim()||!/^0x[a-fA-F0-9]{40}$/.test(ue)){R("Enter a valid wallet address (0x...)");return}B(!0),R(null),se(null);try{const C=await H("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:ue})}),Q=await C.json();if(!C.ok)throw new Error(Q.error||"Failed to generate binding code");se(Q)}catch(C){R(C instanceof Error?C.message:"Failed to generate binding code")}B(!1)},D=async(C,Q)=>{await navigator.clipboard.writeText(C),j(Q),setTimeout(()=>j(null),2e3)},K=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 H("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!C.ok){const Q=await C.json();throw new Error(Q.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=>k(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=>M(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:G,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:ae,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:ue,onChange:C=>_e(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"}),A&&S.jsx("p",{className:"text-error text-xs",children:A}),S.jsx("button",{onClick:E,disabled:V||!ue.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:V?"Generating...":"Generate Binding Code"}),U&&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:U.signature}),S.jsx("button",{onClick:()=>D(U.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:T==="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:U.owsWallet}),S.jsx("button",{onClick:()=>D(U.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:T==="wallet"?"Copied!":"Copy"})]})]}),U.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:U.agentId}),S.jsx("button",{onClick:()=>D(String(U.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:T==="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: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:K,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]=$.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)};$.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]=$.useState([]),[p,h]=$.useState([]),[g,_]=$.useState(new Set),[b,y]=$.useState(!1),x=$.useCallback(async()=>{try{const W=await e("/api/stories");if(W.ok){const O=await W.json();f(O.stories)}}catch{}},[e]),k=$.useCallback(async()=>{try{const W=await e("/api/stories/archived");if(W.ok){const O=await W.json();h(O.stories)}}catch{}},[e]),L=$.useCallback(async W=>{try{(await e("/api/stories/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W})})).ok&&(k(),x())}catch{}},[e,k,x]);$.useEffect(()=>{x();const W=setInterval(x,5e3);return()=>clearInterval(W)},[x]),$.useEffect(()=>{b&&k()},[b,k]),$.useEffect(()=>{t&&_(W=>new Set(W).add(t))},[t]);const M=W=>{var te;const O=W.map(ue=>{var _e;return{file:ue.file,num:(_e=ue.file.match(/^plot-(\d+)\.md$/))==null?void 0:_e[1]}}).filter(ue=>ue.num!=null).sort((ue,_e)=>parseInt(_e.num)-parseInt(ue.num));return O.length>0?O[0].file:W.some(ue=>ue.file==="genesis.md")?"genesis.md":W.some(ue=>ue.file==="structure.md")?"structure.md":((te=W[0])==null?void 0:te.file)??null},G=W=>{_(O=>{const te=new Set(O);return te.has(W)?te.delete(W):te.add(W),te})},I=W=>{if(G(W.name),!g.has(W.name)){const O=M(W.files);O&&s(W.name,O)}},Z=W=>{const O=te=>{if(te==="structure.md")return 0;if(te==="genesis.md")return 1;const ue=te.match(/^plot-(\d+)\.md$/);return ue?2+parseInt(ue[1]):100};return[...W].sort((te,ue)=>O(te.file)-O(ue.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(W=>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:W.name,children:W.title||W.name}),S.jsx("button",{onClick:()=>L(W.name),className:"text-xs text-accent hover:text-accent-dim flex-shrink-0 ml-2",children:"Restore"})]},W.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(W=>S.jsx("div",{children:S.jsxs("button",{onClick:()=>s(W,""),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm ${t===W?"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"})]})},W)),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(W=>W.name!=="_example").map(W=>S.jsxs("div",{children:[S.jsxs("button",{onClick:()=>I(W),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(W.name)?"▼":"▶"}),S.jsx("span",{className:"font-medium truncate",title:W.name,children:W.title||W.name}),S.jsxs("span",{className:"ml-auto text-xs text-muted",children:[W.publishedCount,"/",W.files.length]})]}),g.has(W.name)&&S.jsx("div",{className:"pl-4",children:Z(W.files).map(O=>{const te=t===W.name&&n===O.file;return S.jsxs("button",{onClick:()=>s(W.name,O.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${te?"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)})})]},W.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 Cn=Object.prototype.hasOwnProperty,Ui=e.unstable_scheduleCallback,Nr=e.unstable_cancelCallback,fs=e.unstable_shouldYield,fl=e.unstable_requestPaint,zt=e.unstable_now,Zn=e.unstable_getCurrentPriorityLevel,ee=e.unstable_ImmediatePriority,ue=e.unstable_UserBlockingPriority,be=e.unstable_NormalPriority,Be=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,oi=e.log,nn=e.unstable_setDisableYieldValue,Ot=null,dt=null;function ui(i){if(typeof oi=="function"&&nn(i),dt&&typeof dt.setStrictMode=="function")try{dt.setStrictMode(Ot,i)}catch{}}var Ve=Math.clz32?Math.clz32:zu,gi=Math.log,jt=Math.LN2;function zu(i){return i>>>=0,i===0?32:31-(gi(i)/jt|0)|0}var un=256,kn=262144,ce=4194304;function ve(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 ke(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=ve(u):(v&=w,v!==0?d=ve(v):l||(l=w&~i,l!==0&&(d=ve(l))))):(w=u&~m,w!==0?d=ve(w):v!==0?d=ve(v):l||(l=u&~i,l!==0&&(d=ve(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 tt(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function ci(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 vi(){var i=ce;return ce<<=1,(ce&62914560)===0&&(ce=4194304),i}function Lr(i){for(var r=[],l=0;31>l;l++)r.push(i);return r}function dl(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 w=i.entanglements,N=i.expirationTimes,q=i.hiddenUpdates;for(l=v&~l;0<l;){var J=31-Ve(l),ne=1<<J;w[J]=0,N[J]=-1;var Y=q[J];if(Y!==null)for(q[J]=null,J=0;J<Y.length;J++){var G=Y[J];G!==null&&(G.lane&=-536870913)}l&=~ne}u!==0&&ip(i,u,0),m!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=m&~(v&~r))}function ip(i,r,l){i.pendingLanes|=r,i.suspendedLanes&=~r;var u=31-Ve(r);i.entangledLanes|=r,i.entanglements[u]=i.entanglements[u]|1073741824|l&261930}function np(i,r){var l=i.entangledLanes|=r;for(i=i.entanglements;l;){var u=31-Ve(l),d=1<<u;d&r|i[u]&r&&(i[u]|=r),l&=~d}}function rp(i,r){var l=r&-r;return l=(l&42)!==0?1:Ou(l),(l&(i.suspendedLanes|r))!==0?0:l}function Ou(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 ju(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function sp(){var i=j.p;return i!==0?i:(i=window.event,i===void 0?32:Wg(i.type))}function lp(i,r){var l=j.p;try{return j.p=i,r()}finally{j.p=l}}var Qn=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Qn,yi="__reactProps$"+Qn,ds="__reactContainer$"+Qn,Hu="__reactEvents$"+Qn,a0="__reactListeners$"+Qn,o0="__reactHandles$"+Qn,ap="__reactResources$"+Qn,pl="__reactMarker$"+Qn;function Pu(i){delete i[Gt],delete i[yi],delete i[Hu],delete i[a0],delete i[o0]}function ps(i){var r=i[Gt];if(r)return r;for(var l=i.parentNode;l;){if(r=l[ds]||l[Gt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(i=Ag(i);i!==null;){if(l=i[Gt])return l;i=Ag(i)}return r}i=l,l=i.parentNode}return null}function ms(i){if(i=i[Gt]||i[ds]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function ml(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function _s(i){var r=i[ap];return r||(r=i[ap]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Ht(i){i[pl]=!0}var op=new Set,up={};function zr(i,r){gs(i,r),gs(i+"Capture",r)}function gs(i,r){for(up[i]=r,i=0;i<r.length;i++)op.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]*$"),cp={},hp={};function c0(i){return Cn.call(hp,i)?!0:Cn.call(cp,i)?!1:u0.test(i)?hp[i]=!0:(cp[i]=!0,!1)}function Pa(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 Ua(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 En(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 Ii(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function fp(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 Uu(i){if(!i._valueTracker){var r=fp(i)?"checked":"value";i._valueTracker=h0(i,r,""+i[r])}}function dp(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return i&&(u=fp(i)?i.checked?"true":"false":i.value),i=u,i!==l?(r.setValue(i),!0):!1}function Ia(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 Fi(i){return i.replace(f0,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Iu(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=""+Ii(r)):i.value!==""+Ii(r)&&(i.value=""+Ii(r)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),r!=null?Fu(i,v,Ii(r)):l!=null?Fu(i,v,Ii(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=""+Ii(w):i.removeAttribute("name")}function pp(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)){Uu(i);return}l=l!=null?""+Ii(l):"",r=r!=null?""+Ii(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),Uu(i)}function Fu(i,r,l){r==="number"&&Ia(i.ownerDocument)===i||i.defaultValue===""+l||(i.defaultValue=""+l)}function vs(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=""+Ii(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 mp(i,r,l){if(r!=null&&(r=""+Ii(r),r!==i.value&&(i.value=r),l==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=l!=null?""+Ii(l):""}function _p(i,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(s(92));if(R(u)){if(1<u.length)throw Error(s(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Ii(r),i.defaultValue=l,u=i.textContent,u===l&&u!==""&&u!==null&&(i.value=u),Uu(i)}function ys(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 gp(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 vp(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&&gp(i,d,u)}else for(var m in r)r.hasOwnProperty(m)&&gp(i,m,r[m])}function qu(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 Fa(i){return m0.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Tn(){}var Wu=null;function Yu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var bs=null,Ss=null;function yp(i){var r=ms(i);if(r&&(i=r.stateNode)){var l=i[yi]||null;e:switch(i=r.stateNode,r.type){case"input":if(Iu(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="'+Fi(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==i&&u.form===i.form){var d=u[yi]||null;if(!d)throw Error(s(90));Iu(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&&dp(u)}break e;case"textarea":mp(i,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&vs(i,!!l.multiple,r,!1)}}}var Vu=!1;function bp(i,r,l){if(Vu)return i(r,l);Vu=!0;try{var u=i(r);return u}finally{if(Vu=!1,(bs!==null||Ss!==null)&&(Ro(),bs&&(r=bs,i=Ss,Ss=bs=null,yp(r),i)))for(r=0;r<i.length;r++)yp(i[r])}}function _l(i,r){var l=i.stateNode;if(l===null)return null;var u=l[yi]||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 An=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(An)try{var gl={};Object.defineProperty(gl,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",gl,gl),window.removeEventListener("test",gl,gl)}catch{Ku=!1}var Jn=null,Xu=null,qa=null;function Sp(){if(qa)return qa;var i,r=Xu,l=r.length,u,d="value"in Jn?Jn.value:Jn.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 qa=d.slice(i,1<u?1-u:void 0)}function Wa(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 Ya(){return!0}function xp(){return!1}function bi(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)?Ya:xp,this.isPropagationStopped=xp,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=Ya)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ya)},persist:function(){},isPersistent:Ya}),r}var Or={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Va=bi(Or),vl=_({},Or,{view:0,detail:0}),_0=bi(vl),Gu,$u,yl,Ka=_({},vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qu,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!==yl&&(yl&&i.type==="mousemove"?(Gu=i.screenX-yl.screenX,$u=i.screenY-yl.screenY):$u=Gu=0,yl=i),Gu)},movementY:function(i){return"movementY"in i?i.movementY:$u}}),wp=bi(Ka),g0=_({},Ka,{dataTransfer:0}),v0=bi(g0),y0=_({},vl,{relatedTarget:0}),Zu=bi(y0),b0=_({},Or,{animationName:0,elapsedTime:0,pseudoElement:0}),S0=bi(b0),x0=_({},Or,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),w0=bi(x0),C0=_({},Or,{data:0}),Cp=bi(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 Qu(){return A0}var D0=_({},vl,{key:function(i){if(i.key){var r=k0[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Wa(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:Qu,charCode:function(i){return i.type==="keypress"?Wa(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Wa(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),R0=bi(D0),M0=_({},Ka,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kp=bi(M0),B0=_({},vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qu}),N0=bi(B0),L0=_({},Or,{propertyName:0,elapsedTime:0,pseudoElement:0}),z0=bi(L0),O0=_({},Ka,{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=bi(O0),H0=_({},Or,{newState:0,oldState:0}),P0=bi(H0),U0=[9,13,27,32],Ju=An&&"CompositionEvent"in window,bl=null;An&&"documentMode"in document&&(bl=document.documentMode);var I0=An&&"TextEvent"in window&&!bl,Ep=An&&(!Ju||bl&&8<bl&&11>=bl),Tp=" ",Ap=!1;function Dp(i,r){switch(i){case"keyup":return U0.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rp(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var xs=!1;function F0(i,r){switch(i){case"compositionend":return Rp(r);case"keypress":return r.which!==32?null:(Ap=!0,Tp);case"textInput":return i=r.data,i===Tp&&Ap?null:i;default:return null}}function q0(i,r){if(xs)return i==="compositionend"||!Ju&&Dp(i,r)?(i=Sp(),qa=Xu=Jn=null,xs=!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 Ep&&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 Mp(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!W0[i.type]:r==="textarea"}function Bp(i,r,l,u){bs?Ss?Ss.push(u):Ss=[u]:bs=u,r=jo(r,"onChange"),0<r.length&&(l=new Va("onChange","change",null,l,u),i.push({event:l,listeners:r}))}var Sl=null,xl=null;function Y0(i){pg(i,0)}function Xa(i){var r=ml(i);if(dp(r))return i}function Np(i,r){if(i==="change")return r}var Lp=!1;if(An){var ec;if(An){var tc="oninput"in document;if(!tc){var zp=document.createElement("div");zp.setAttribute("oninput","return;"),tc=typeof zp.oninput=="function"}ec=tc}else ec=!1;Lp=ec&&(!document.documentMode||9<document.documentMode)}function Op(){Sl&&(Sl.detachEvent("onpropertychange",jp),xl=Sl=null)}function jp(i){if(i.propertyName==="value"&&Xa(xl)){var r=[];Bp(r,xl,i,Yu(i)),bp(Y0,r)}}function V0(i,r,l){i==="focusin"?(Op(),Sl=r,xl=l,Sl.attachEvent("onpropertychange",jp)):i==="focusout"&&Op()}function K0(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Xa(xl)}function X0(i,r){if(i==="click")return Xa(r)}function G0(i,r){if(i==="input"||i==="change")return Xa(r)}function $0(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var Di=typeof Object.is=="function"?Object.is:$0;function wl(i,r){if(Di(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(!Cn.call(r,d)||!Di(i[d],r[d]))return!1}return!0}function Hp(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Pp(i,r){var l=Hp(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=Hp(l)}}function Up(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?Up(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function Ip(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Ia(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=Ia(i.document)}return r}function ic(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=An&&"documentMode"in document&&11>=document.documentMode,ws=null,nc=null,Cl=null,rc=!1;function Fp(i,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;rc||ws==null||ws!==Ia(u)||(u=ws,"selectionStart"in u&&ic(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&&wl(Cl,u)||(Cl=u,u=jo(nc,"onSelect"),0<u.length&&(r=new Va("onSelect","select",null,r,l),i.push({event:r,listeners:u}),r.target=ws)))}function jr(i,r){var l={};return l[i.toLowerCase()]=r.toLowerCase(),l["Webkit"+i]="webkit"+r,l["Moz"+i]="moz"+r,l}var Cs={animationend:jr("Animation","AnimationEnd"),animationiteration:jr("Animation","AnimationIteration"),animationstart:jr("Animation","AnimationStart"),transitionrun:jr("Transition","TransitionRun"),transitionstart:jr("Transition","TransitionStart"),transitioncancel:jr("Transition","TransitionCancel"),transitionend:jr("Transition","TransitionEnd")},sc={},qp={};An&&(qp=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Hr(i){if(sc[i])return sc[i];if(!Cs[i])return i;var r=Cs[i],l;for(l in r)if(r.hasOwnProperty(l)&&l in qp)return sc[i]=r[l];return i}var Wp=Hr("animationend"),Yp=Hr("animationiteration"),Vp=Hr("animationstart"),Q0=Hr("transitionrun"),J0=Hr("transitionstart"),e1=Hr("transitioncancel"),Kp=Hr("transitionend"),Xp=new Map,lc="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(" ");lc.push("scrollEnd");function rn(i,r){Xp.set(i,r),zr(r,[i])}var Ga=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)},qi=[],ks=0,ac=0;function $a(){for(var i=ks,r=ac=ks=0;r<i;){var l=qi[r];qi[r++]=null;var u=qi[r];qi[r++]=null;var d=qi[r];qi[r++]=null;var m=qi[r];if(qi[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&&Gp(l,d,m)}}function Za(i,r,l,u){qi[ks++]=i,qi[ks++]=r,qi[ks++]=l,qi[ks++]=u,ac|=u,i.lanes|=u,i=i.alternate,i!==null&&(i.lanes|=u)}function oc(i,r,l,u){return Za(i,r,l,u),Qa(i)}function Pr(i,r){return Za(i,null,null,r),Qa(i)}function Gp(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-Ve(l),i=m.hiddenUpdates,u=i[d],u===null?i[d]=[r]:u.push(r),r.lane=l|536870912),m):null}function Qa(i){if(50<Vl)throw Vl=0,gh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var Es={};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 Ri(i,r,l,u){return new t1(i,r,l,u)}function uc(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Dn(i,r){var l=i.alternate;return l===null?(l=Ri(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 $p(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 Ja(i,r,l,u,d,m){var v=0;if(u=i,typeof i=="function")uc(i)&&(v=1);else if(typeof i=="string")v=lx(i,l,Q.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case me:return i=Ri(31,l,r,d),i.elementType=me,i.lanes=m,i;case k:return Ur(l.children,d,m,r);case L:v=8,d|=24;break;case M:return i=Ri(12,l,r,d|2),i.elementType=M,i.lanes=m,i;case W:return i=Ri(13,l,r,d),i.elementType=W,i.lanes=m,i;case O:return i=Ri(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 te:v=14;break e;case oe:v=16,u=null;break e}v=29,l=Error(s(130,i===null?"null":typeof i,"")),u=null}return r=Ri(v,l,r,d),r.elementType=i,r.type=u,r.lanes=m,r}function Ur(i,r,l,u){return i=Ri(7,i,u,r),i.lanes=l,i}function cc(i,r,l){return i=Ri(6,i,null,r),i.lanes=l,i}function Zp(i){var r=Ri(18,null,null,0);return r.stateNode=i,r}function hc(i,r,l){return r=Ri(4,i.children!==null?i.children:[],i.key,r),r.lanes=l,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Qp=new WeakMap;function Wi(i,r){if(typeof i=="object"&&i!==null){var l=Qp.get(i);return l!==void 0?l:(r={value:i,source:r,stack:Br(r)},Qp.set(i,r),r)}return{value:i,source:r,stack:Br(r)}}var Ts=[],As=0,eo=null,kl=0,Yi=[],Vi=0,er=null,cn=1,hn="";function Rn(i,r){Ts[As++]=kl,Ts[As++]=eo,eo=i,kl=r}function Jp(i,r,l){Yi[Vi++]=cn,Yi[Vi++]=hn,Yi[Vi++]=er,er=i;var u=cn;i=hn;var d=32-Ve(u)-1;u&=~(1<<d),l+=1;var m=32-Ve(r)+d;if(30<m){var v=d-d%5;m=(u&(1<<v)-1).toString(32),u>>=v,d-=v,cn=1<<32-Ve(r)+d|l<<d|u,hn=m+i}else cn=1<<m|l<<d|u,hn=i}function fc(i){i.return!==null&&(Rn(i,1),Jp(i,1,0))}function dc(i){for(;i===eo;)eo=Ts[--As],Ts[As]=null,kl=Ts[--As],Ts[As]=null;for(;i===er;)er=Yi[--Vi],Yi[Vi]=null,hn=Yi[--Vi],Yi[Vi]=null,cn=Yi[--Vi],Yi[Vi]=null}function em(i,r){Yi[Vi++]=cn,Yi[Vi++]=hn,Yi[Vi++]=er,cn=r.id,hn=r.overflow,er=i}var $t=null,lt=null,Ie=!1,tr=null,Ki=!1,pc=Error(s(519));function ir(i){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw El(Wi(r,i)),pc}function tm(i){var r=i.stateNode,l=i.type,u=i.memoizedProps;switch(r[Gt]=i,r[yi]=u,l){case"dialog":je("cancel",r),je("close",r);break;case"iframe":case"object":case"embed":je("load",r);break;case"video":case"audio":for(l=0;l<Xl.length;l++)je(Xl[l],r);break;case"source":je("error",r);break;case"img":case"image":case"link":je("error",r),je("load",r);break;case"details":je("toggle",r);break;case"input":je("invalid",r),pp(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":je("invalid",r);break;case"textarea":je("invalid",r),_p(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||vg(r.textContent,l)?(u.popover!=null&&(je("beforetoggle",r),je("toggle",r)),u.onScroll!=null&&je("scroll",r),u.onScrollEnd!=null&&je("scrollend",r),u.onClick!=null&&(r.onclick=Tn),r=!0):r=!1,r||ir(i,!0)}function im(i){for($t=i.return;$t;)switch($t.tag){case 5:case 31:case 13:Ki=!1;return;case 27:case 3:Ki=!0;return;default:$t=$t.return}}function Ds(i){if(i!==$t)return!1;if(!Ie)return im(i),Ie=!0,!1;var r=i.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=i.type,l=!(l!=="form"&&l!=="button")||Bh(i.type,i.memoizedProps)),l=!l),l&<&&ir(i),im(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));lt=Tg(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));lt=Tg(i)}else r===27?(r=lt,_r(i.type)?(i=jh,jh=null,lt=i):lt=r):lt=$t?Gi(i.stateNode.nextSibling):null;return!0}function Ir(){lt=$t=null,Ie=!1}function mc(){var i=tr;return i!==null&&(Ci===null?Ci=i:Ci.push.apply(Ci,i),tr=null),i}function El(i){tr===null?tr=[i]:tr.push(i)}var _c=D(null),Fr=null,Mn=null;function nr(i,r,l){C(_c,r._currentValue),r._currentValue=l}function Bn(i){i._currentValue=_c.current,X(_c)}function gc(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 vc(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 N=0;N<r.length;N++)if(w.context===r[N]){m.lanes|=l,w=m.alternate,w!==null&&(w.lanes|=l),gc(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),gc(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 Rs(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;Di(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===Ce.current){if(v=d.alternate,v===null)throw Error(s(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(Jl):i=[Jl])}d=d.return}i!==null&&vc(r,i,l,u),r.flags|=262144}function to(i){for(i=i.firstContext;i!==null;){if(!Di(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function qr(i){Fr=i,Mn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Zt(i){return nm(Fr,i)}function io(i,r){return Fr===null&&qr(i),nm(i,r)}function nm(i,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},Mn===null){if(i===null)throw Error(s(308));Mn=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else Mn=Mn.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,wt={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yc(){return{controller:new i1,data:new Map,refCount:0}}function Tl(i){i.refCount--,i.refCount===0&&n1(r1,function(){i.controller.abort()})}var Al=null,bc=0,Ms=0,Bs=null;function s1(i,r){if(Al===null){var l=Al=[];bc=0,Ms=wh(),Bs={status:"pending",value:void 0,then:function(u){l.push(u)}}}return bc++,r.then(rm,rm),r}function rm(){if(--bc===0&&Al!==null){Bs!==null&&(Bs.status="fulfilled");var i=Al;Al=null,Ms=0,Bs=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 sm=T.S;T.S=function(i,r){F_=zt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&s1(i,r),sm!==null&&sm(i,r)};var Wr=D(null);function Sc(){var i=Wr.current;return i!==null?i:it.pooledCache}function no(i,r){r===null?C(Wr,Wr.current):C(Wr,r.pool)}function lm(){var i=Sc();return i===null?null:{parent:wt._currentValue,pool:i}}var Ns=Error(s(460)),xc=Error(s(474)),ro=Error(s(542)),so={then:function(){}};function am(i){return i=i.status,i==="fulfilled"||i==="rejected"}function om(i,r,l){switch(l=i[l],l===void 0?i.push(r):l!==r&&(r.then(Tn,Tn),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,cm(i),i;default:if(typeof r.status=="string")r.then(Tn,Tn);else{if(i=it,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,cm(i),i}throw Vr=r,Ns}}function Yr(i){try{var r=i._init;return r(i._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Vr=l,Ns):l}}var Vr=null;function um(){if(Vr===null)throw Error(s(459));var i=Vr;return Vr=null,i}function cm(i){if(i===Ns||i===ro)throw Error(s(483))}var Ls=null,Dl=0;function lo(i){var r=Dl;return Dl+=1,Ls===null&&(Ls=[]),om(Ls,i,r)}function Rl(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function ao(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 hm(i){function r(P,z){if(i){var F=P.deletions;F===null?(P.deletions=[z],P.flags|=16):F.push(z)}}function l(P,z){if(!i)return null;for(;z!==null;)r(P,z),z=z.sibling;return null}function u(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function d(P,z){return P=Dn(P,z),P.index=0,P.sibling=null,P}function m(P,z,F){return P.index=F,i?(F=P.alternate,F!==null?(F=F.index,F<z?(P.flags|=67108866,z):F):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function v(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function w(P,z,F,ie){return z===null||z.tag!==6?(z=cc(F,P.mode,ie),z.return=P,z):(z=d(z,F),z.return=P,z)}function N(P,z,F,ie){var ye=F.type;return ye===k?J(P,z,F.props.children,ie,F.key):z!==null&&(z.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&Yr(ye)===z.type)?(z=d(z,F.props),Rl(z,F),z.return=P,z):(z=Ja(F.type,F.key,F.props,null,P.mode,ie),Rl(z,F),z.return=P,z)}function q(P,z,F,ie){return z===null||z.tag!==4||z.stateNode.containerInfo!==F.containerInfo||z.stateNode.implementation!==F.implementation?(z=hc(F,P.mode,ie),z.return=P,z):(z=d(z,F.children||[]),z.return=P,z)}function J(P,z,F,ie,ye){return z===null||z.tag!==7?(z=Ur(F,P.mode,ie,ye),z.return=P,z):(z=d(z,F),z.return=P,z)}function ne(P,z,F){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=cc(""+z,P.mode,F),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case y:return F=Ja(z.type,z.key,z.props,null,P.mode,F),Rl(F,z),F.return=P,F;case x:return z=hc(z,P.mode,F),z.return=P,z;case oe:return z=Yr(z),ne(P,z,F)}if(R(z)||K(z))return z=Ur(z,P.mode,F,null),z.return=P,z;if(typeof z.then=="function")return ne(P,lo(z),F);if(z.$$typeof===I)return ne(P,io(P,z),F);ao(P,z)}return null}function Y(P,z,F,ie){var ye=z!==null?z.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return ye!==null?null:w(P,z,""+F,ie);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case y:return F.key===ye?N(P,z,F,ie):null;case x:return F.key===ye?q(P,z,F,ie):null;case oe:return F=Yr(F),Y(P,z,F,ie)}if(R(F)||K(F))return ye!==null?null:J(P,z,F,ie,null);if(typeof F.then=="function")return Y(P,z,lo(F),ie);if(F.$$typeof===I)return Y(P,z,io(P,F),ie);ao(P,F)}return null}function G(P,z,F,ie,ye){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return P=P.get(F)||null,w(z,P,""+ie,ye);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case y:return P=P.get(ie.key===null?F:ie.key)||null,N(z,P,ie,ye);case x:return P=P.get(ie.key===null?F:ie.key)||null,q(z,P,ie,ye);case oe:return ie=Yr(ie),G(P,z,F,ie,ye)}if(R(ie)||K(ie))return P=P.get(F)||null,J(z,P,ie,ye,null);if(typeof ie.then=="function")return G(P,z,F,lo(ie),ye);if(ie.$$typeof===I)return G(P,z,F,io(z,ie),ye);ao(z,ie)}return null}function _e(P,z,F,ie){for(var ye=null,We=null,ge=z,Re=z=0,Ue=null;ge!==null&&Re<F.length;Re++){ge.index>Re?(Ue=ge,ge=null):Ue=ge.sibling;var Ye=Y(P,ge,F[Re],ie);if(Ye===null){ge===null&&(ge=Ue);break}i&&ge&&Ye.alternate===null&&r(P,ge),z=m(Ye,z,Re),We===null?ye=Ye:We.sibling=Ye,We=Ye,ge=Ue}if(Re===F.length)return l(P,ge),Ie&&Rn(P,Re),ye;if(ge===null){for(;Re<F.length;Re++)ge=ne(P,F[Re],ie),ge!==null&&(z=m(ge,z,Re),We===null?ye=ge:We.sibling=ge,We=ge);return Ie&&Rn(P,Re),ye}for(ge=u(ge);Re<F.length;Re++)Ue=G(ge,P,Re,F[Re],ie),Ue!==null&&(i&&Ue.alternate!==null&&ge.delete(Ue.key===null?Re:Ue.key),z=m(Ue,z,Re),We===null?ye=Ue:We.sibling=Ue,We=Ue);return i&&ge.forEach(function(Sr){return r(P,Sr)}),Ie&&Rn(P,Re),ye}function we(P,z,F,ie){if(F==null)throw Error(s(151));for(var ye=null,We=null,ge=z,Re=z=0,Ue=null,Ye=F.next();ge!==null&&!Ye.done;Re++,Ye=F.next()){ge.index>Re?(Ue=ge,ge=null):Ue=ge.sibling;var Sr=Y(P,ge,Ye.value,ie);if(Sr===null){ge===null&&(ge=Ue);break}i&&ge&&Sr.alternate===null&&r(P,ge),z=m(Sr,z,Re),We===null?ye=Sr:We.sibling=Sr,We=Sr,ge=Ue}if(Ye.done)return l(P,ge),Ie&&Rn(P,Re),ye;if(ge===null){for(;!Ye.done;Re++,Ye=F.next())Ye=ne(P,Ye.value,ie),Ye!==null&&(z=m(Ye,z,Re),We===null?ye=Ye:We.sibling=Ye,We=Ye);return Ie&&Rn(P,Re),ye}for(ge=u(ge);!Ye.done;Re++,Ye=F.next())Ye=G(ge,P,Re,Ye.value,ie),Ye!==null&&(i&&Ye.alternate!==null&&ge.delete(Ye.key===null?Re:Ye.key),z=m(Ye,z,Re),We===null?ye=Ye:We.sibling=Ye,We=Ye);return i&&ge.forEach(function(gx){return r(P,gx)}),Ie&&Rn(P,Re),ye}function Je(P,z,F,ie){if(typeof F=="object"&&F!==null&&F.type===k&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case y:e:{for(var ye=F.key;z!==null;){if(z.key===ye){if(ye=F.type,ye===k){if(z.tag===7){l(P,z.sibling),ie=d(z,F.props.children),ie.return=P,P=ie;break e}}else if(z.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&Yr(ye)===z.type){l(P,z.sibling),ie=d(z,F.props),Rl(ie,F),ie.return=P,P=ie;break e}l(P,z);break}else r(P,z);z=z.sibling}F.type===k?(ie=Ur(F.props.children,P.mode,ie,F.key),ie.return=P,P=ie):(ie=Ja(F.type,F.key,F.props,null,P.mode,ie),Rl(ie,F),ie.return=P,P=ie)}return v(P);case x:e:{for(ye=F.key;z!==null;){if(z.key===ye)if(z.tag===4&&z.stateNode.containerInfo===F.containerInfo&&z.stateNode.implementation===F.implementation){l(P,z.sibling),ie=d(z,F.children||[]),ie.return=P,P=ie;break e}else{l(P,z);break}else r(P,z);z=z.sibling}ie=hc(F,P.mode,ie),ie.return=P,P=ie}return v(P);case oe:return F=Yr(F),Je(P,z,F,ie)}if(R(F))return _e(P,z,F,ie);if(K(F)){if(ye=K(F),typeof ye!="function")throw Error(s(150));return F=ye.call(F),we(P,z,F,ie)}if(typeof F.then=="function")return Je(P,z,lo(F),ie);if(F.$$typeof===I)return Je(P,z,io(P,F),ie);ao(P,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,z!==null&&z.tag===6?(l(P,z.sibling),ie=d(z,F),ie.return=P,P=ie):(l(P,z),ie=cc(F,P.mode,ie),ie.return=P,P=ie),v(P)):l(P,z)}return function(P,z,F,ie){try{Dl=0;var ye=Je(P,z,F,ie);return Ls=null,ye}catch(ge){if(ge===Ns||ge===ro)throw ge;var We=Ri(29,ge,null,P.mode);return We.lanes=ie,We.return=P,We}finally{}}}var Kr=hm(!0),fm=hm(!1),rr=!1;function wc(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cc(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 sr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function lr(i,r,l){var u=i.updateQueue;if(u===null)return null;if(u=u.shared,(Ke&2)!==0){var d=u.pending;return d===null?r.next=r:(r.next=d.next,d.next=r),u.pending=r,r=Qa(i),Gp(i,null,l),r}return Za(i,u,r,l),Qa(i)}function Ml(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,np(i,l)}}function kc(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 Ec=!1;function Bl(){if(Ec){var i=Bs;if(i!==null)throw i}}function Nl(i,r,l,u){Ec=!1;var d=i.updateQueue;rr=!1;var m=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var N=w,q=N.next;N.next=null,v===null?m=q:v.next=q,v=N;var J=i.alternate;J!==null&&(J=J.updateQueue,w=J.lastBaseUpdate,w!==v&&(w===null?J.firstBaseUpdate=q:w.next=q,J.lastBaseUpdate=N))}if(m!==null){var ne=d.baseState;v=0,J=q=N=null,w=m;do{var Y=w.lane&-536870913,G=Y!==w.lane;if(G?(Pe&Y)===Y:(u&Y)===Y){Y!==0&&Y===Ms&&(Ec=!0),J!==null&&(J=J.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var _e=i,we=w;Y=r;var Je=l;switch(we.tag){case 1:if(_e=we.payload,typeof _e=="function"){ne=_e.call(Je,ne,Y);break e}ne=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=we.payload,Y=typeof _e=="function"?_e.call(Je,ne,Y):_e,Y==null)break e;ne=_({},ne,Y);break e;case 2:rr=!0}}Y=w.callback,Y!==null&&(i.flags|=64,G&&(i.flags|=8192),G=d.callbacks,G===null?d.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},J===null?(q=J=G,N=ne):J=J.next=G,v|=Y;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;G=w,w=G.next,G.next=null,d.lastBaseUpdate=G,d.shared.pending=null}}while(!0);J===null&&(N=ne),d.baseState=N,d.firstBaseUpdate=q,d.lastBaseUpdate=J,m===null&&(d.shared.lanes=0),hr|=v,i.lanes=v,i.memoizedState=ne}}function dm(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function pm(i,r){var l=i.callbacks;if(l!==null)for(i.callbacks=null,i=0;i<l.length;i++)dm(l[i],r)}var zs=D(null),oo=D(0);function mm(i,r){i=In,C(oo,i),C(zs,r),In=i|r.baseLanes}function Tc(){C(oo,In),C(zs,zs.current)}function Ac(){In=oo.current,X(zs),X(oo)}var Mi=D(null),Xi=null;function ar(i){var r=i.alternate;C(yt,yt.current&1),C(Mi,i),Xi===null&&(r===null||zs.current!==null||r.memoizedState!==null)&&(Xi=i)}function Dc(i){C(yt,yt.current),C(Mi,i),Xi===null&&(Xi=i)}function _m(i){i.tag===22?(C(yt,yt.current),C(Mi,i),Xi===null&&(Xi=i)):or()}function or(){C(yt,yt.current),C(Mi,Mi.current)}function Bi(i){X(Mi),Xi===i&&(Xi=null),X(yt)}var yt=D(0);function uo(i){for(var r=i;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||zh(l)||Oh(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 Nn=0,De=null,Ze=null,Ct=null,co=!1,Os=!1,Xr=!1,ho=0,Ll=0,js=null,a1=0;function pt(){throw Error(s(321))}function Rc(i,r){if(r===null)return!1;for(var l=0;l<r.length&&l<i.length;l++)if(!Di(i[l],r[l]))return!1;return!0}function Mc(i,r,l,u,d,m){return Nn=m,De=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,T.H=i===null||i.memoizedState===null?Jm:Vc,Xr=!1,m=l(u,d),Xr=!1,Os&&(m=vm(r,l,u,d)),gm(i),m}function gm(i){T.H=jl;var r=Ze!==null&&Ze.next!==null;if(Nn=0,Ct=Ze=De=null,co=!1,Ll=0,js=null,r)throw Error(s(300));i===null||kt||(i=i.dependencies,i!==null&&to(i)&&(kt=!0))}function vm(i,r,l,u){De=i;var d=0;do{if(Os&&(js=null),Ll=0,Os=!1,25<=d)throw Error(s(301));if(d+=1,Ct=Ze=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}T.H=e_,m=r(l,u)}while(Os);return m}function o1(){var i=T.H,r=i.useState()[0];return r=typeof r.then=="function"?zl(r):r,i=i.useState()[0],(Ze!==null?Ze.memoizedState:null)!==i&&(De.flags|=1024),r}function Bc(){var i=ho!==0;return ho=0,i}function Nc(i,r,l){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~l}function Lc(i){if(co){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}co=!1}Nn=0,Ct=Ze=De=null,Os=!1,Ll=ho=0,js=null}function hi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?De.memoizedState=Ct=i:Ct=Ct.next=i,Ct}function bt(){if(Ze===null){var i=De.alternate;i=i!==null?i.memoizedState:null}else i=Ze.next;var r=Ct===null?De.memoizedState:Ct.next;if(r!==null)Ct=r,Ze=i;else{if(i===null)throw De.alternate===null?Error(s(467)):Error(s(310));Ze=i,i={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},Ct===null?De.memoizedState=Ct=i:Ct=Ct.next=i}return Ct}function fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zl(i){var r=Ll;return Ll+=1,js===null&&(js=[]),i=om(js,i,r),r=De,(Ct===null?r.memoizedState:Ct.next)===null&&(r=r.alternate,T.H=r===null||r.memoizedState===null?Jm:Vc),i}function po(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return zl(i);if(i.$$typeof===I)return Zt(i)}throw Error(s(438,String(i)))}function zc(i){var r=null,l=De.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=De.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=fo(),De.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]=U;return r.index++,l}function Ln(i,r){return typeof r=="function"?r(i):r}function mo(i){var r=bt();return Oc(r,Ze,i)}function Oc(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,N=null,q=r,J=!1;do{var ne=q.lane&-536870913;if(ne!==q.lane?(Pe&ne)===ne:(Nn&ne)===ne){var Y=q.revertLane;if(Y===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ne===Ms&&(J=!0);else if((Nn&Y)===Y){q=q.next,Y===Ms&&(J=!0);continue}else ne={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},N===null?(w=N=ne,v=m):N=N.next=ne,De.lanes|=Y,hr|=Y;ne=q.action,Xr&&l(m,ne),m=q.hasEagerState?q.eagerState:l(m,ne)}else Y={lane:ne,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},N===null?(w=N=Y,v=m):N=N.next=Y,De.lanes|=ne,hr|=ne;q=q.next}while(q!==null&&q!==r);if(N===null?v=m:N.next=w,!Di(m,i.memoizedState)&&(kt=!0,J&&(l=Bs,l!==null)))throw l;i.memoizedState=m,i.baseState=v,i.baseQueue=N,u.lastRenderedState=m}return d===null&&(u.lanes=0),[i.memoizedState,u.dispatch]}function jc(i){var r=bt(),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);Di(m,r.memoizedState)||(kt=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),l.lastRenderedState=m}return[m,u]}function ym(i,r,l){var u=De,d=bt(),m=Ie;if(m){if(l===void 0)throw Error(s(407));l=l()}else l=r();var v=!Di((Ze||d).memoizedState,l);if(v&&(d.memoizedState=l,kt=!0),d=d.queue,Uc(xm.bind(null,u,d,i),[i]),d.getSnapshot!==r||v||Ct!==null&&Ct.memoizedState.tag&1){if(u.flags|=2048,Hs(9,{destroy:void 0},Sm.bind(null,u,d,l,r),null),it===null)throw Error(s(349));m||(Nn&127)!==0||bm(u,r,l)}return l}function bm(i,r,l){i.flags|=16384,i={getSnapshot:r,value:l},r=De.updateQueue,r===null?(r=fo(),De.updateQueue=r,r.stores=[i]):(l=r.stores,l===null?r.stores=[i]:l.push(i))}function Sm(i,r,l,u){r.value=l,r.getSnapshot=u,wm(r)&&Cm(i)}function xm(i,r,l){return l(function(){wm(r)&&Cm(i)})}function wm(i){var r=i.getSnapshot;i=i.value;try{var l=r();return!Di(i,l)}catch{return!0}}function Cm(i){var r=Pr(i,2);r!==null&&ki(r,i,2)}function Hc(i){var r=hi();if(typeof i=="function"){var l=i;if(i=l(),Xr){ui(!0);try{l()}finally{ui(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:i},r}function km(i,r,l,u){return i.baseState=l,Oc(i,Ze,typeof u=="function"?u:Ln)}function u1(i,r,l,u,d){if(vo(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)}};T.T!==null?l(!0):m.isTransition=!1,u(m),l=r.pending,l===null?(m.next=r.pending=m,Em(r,m)):(m.next=l.next,r.pending=l.next=m)}}function Em(i,r){var l=r.action,u=r.payload,d=i.state;if(r.isTransition){var m=T.T,v={};T.T=v;try{var w=l(d,u),N=T.S;N!==null&&N(v,w),Tm(i,r,w)}catch(q){Pc(i,r,q)}finally{m!==null&&v.types!==null&&(m.types=v.types),T.T=m}}else try{m=l(d,u),Tm(i,r,m)}catch(q){Pc(i,r,q)}}function Tm(i,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){Am(i,r,u)},function(u){return Pc(i,r,u)}):Am(i,r,l)}function Am(i,r,l){r.status="fulfilled",r.value=l,Dm(r),i.state=l,r=i.pending,r!==null&&(l=r.next,l===r?i.pending=null:(l=l.next,r.next=l,Em(i,l)))}function Pc(i,r,l){var u=i.pending;if(i.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,Dm(r),r=r.next;while(r!==u)}i.action=null}function Dm(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function Rm(i,r){return r}function Mm(i,r){if(Ie){var l=it.formState;if(l!==null){e:{var u=De;if(Ie){if(lt){t:{for(var d=lt,m=Ki;d.nodeType!==8;){if(!m){d=null;break t}if(d=Gi(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){lt=Gi(d.nextSibling),u=d.data==="F!";break e}}ir(u)}u=!1}u&&(r=l[0])}}return l=hi(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rm,lastRenderedState:r},l.queue=u,l=$m.bind(null,De,u),u.dispatch=l,u=Hc(!1),m=Yc.bind(null,De,!1,u.queue),u=hi(),d={state:r,dispatch:null,action:i,pending:null},u.queue=d,l=u1.bind(null,De,d,m,l),d.dispatch=l,u.memoizedState=i,[r,l,!1]}function Bm(i){var r=bt();return Nm(r,Ze,i)}function Nm(i,r,l){if(r=Oc(i,r,Rm)[0],i=mo(Ln)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=zl(r)}catch(v){throw v===Ns?ro:v}else u=r;r=bt();var d=r.queue,m=d.dispatch;return l!==r.memoizedState&&(De.flags|=2048,Hs(9,{destroy:void 0},c1.bind(null,d,l),null)),[u,m,i]}function c1(i,r){i.action=r}function Lm(i){var r=bt(),l=Ze;if(l!==null)return Nm(r,l,i);bt(),r=r.memoizedState,l=bt();var u=l.queue.dispatch;return l.memoizedState=i,[r,u,!1]}function Hs(i,r,l,u){return i={tag:i,create:l,deps:u,inst:r,next:null},r=De.updateQueue,r===null&&(r=fo(),De.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 zm(){return bt().memoizedState}function _o(i,r,l,u){var d=hi();De.flags|=i,d.memoizedState=Hs(1|r,{destroy:void 0},l,u===void 0?null:u)}function go(i,r,l,u){var d=bt();u=u===void 0?null:u;var m=d.memoizedState.inst;Ze!==null&&u!==null&&Rc(u,Ze.memoizedState.deps)?d.memoizedState=Hs(r,m,l,u):(De.flags|=i,d.memoizedState=Hs(1|r,m,l,u))}function Om(i,r){_o(8390656,8,i,r)}function Uc(i,r){go(2048,8,i,r)}function h1(i){De.flags|=4;var r=De.updateQueue;if(r===null)r=fo(),De.updateQueue=r,r.events=[i];else{var l=r.events;l===null?r.events=[i]:l.push(i)}}function jm(i){var r=bt().memoizedState;return h1({ref:r,nextImpl:i}),function(){if((Ke&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Hm(i,r){return go(4,2,i,r)}function Pm(i,r){return go(4,4,i,r)}function Um(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 Im(i,r,l){l=l!=null?l.concat([i]):null,go(4,4,Um.bind(null,r,i),l)}function Ic(){}function Fm(i,r){var l=bt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&Rc(r,u[1])?u[0]:(l.memoizedState=[i,r],i)}function qm(i,r){var l=bt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&Rc(r,u[1]))return u[0];if(u=i(),Xr){ui(!0);try{i()}finally{ui(!1)}}return l.memoizedState=[u,r],u}function Fc(i,r,l){return l===void 0||(Nn&1073741824)!==0&&(Pe&261930)===0?i.memoizedState=r:(i.memoizedState=l,i=W_(),De.lanes|=i,hr|=i,l)}function Wm(i,r,l,u){return Di(l,r)?l:zs.current!==null?(i=Fc(i,l,u),Di(i,r)||(kt=!0),i):(Nn&42)===0||(Nn&1073741824)!==0&&(Pe&261930)===0?(kt=!0,i.memoizedState=l):(i=W_(),De.lanes|=i,hr|=i,r)}function Ym(i,r,l,u,d){var m=j.p;j.p=m!==0&&8>m?m:8;var v=T.T,w={};T.T=w,Yc(i,!1,r,l);try{var N=d(),q=T.S;if(q!==null&&q(w,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var J=l1(N,u);Ol(i,r,J,zi(i))}else Ol(i,r,u,zi(i))}catch(ne){Ol(i,r,{then:function(){},status:"rejected",reason:ne},zi())}finally{j.p=m,v!==null&&w.types!==null&&(v.types=w.types),T.T=v}}function f1(){}function qc(i,r,l,u){if(i.tag!==5)throw Error(s(476));var d=Vm(i).queue;Ym(i,d,r,H,l===null?f1:function(){return Km(i),l(u)})}function Vm(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:H},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ln,lastRenderedState:l},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function Km(i){var r=Vm(i);r.next===null&&(r=i.alternate.memoizedState),Ol(i,r.next.queue,{},zi())}function Wc(){return Zt(Jl)}function Xm(){return bt().memoizedState}function Gm(){return bt().memoizedState}function d1(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var l=zi();i=sr(l);var u=lr(r,i,l);u!==null&&(ki(u,r,l),Ml(u,r,l)),r={cache:yc()},i.payload=r;return}r=r.return}}function p1(i,r,l){var u=zi();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},vo(i)?Zm(r,l):(l=oc(i,r,l,u),l!==null&&(ki(l,i,u),Qm(l,r,u)))}function $m(i,r,l){var u=zi();Ol(i,r,l,u)}function Ol(i,r,l,u){var d={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(vo(i))Zm(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,Di(w,v))return Za(i,r,d,0),it===null&&$a(),!1}catch{}finally{}if(l=oc(i,r,d,u),l!==null)return ki(l,i,u),Qm(l,r,u),!0}return!1}function Yc(i,r,l,u){if(u={lane:2,revertLane:wh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},vo(i)){if(r)throw Error(s(479))}else r=oc(i,l,u,2),r!==null&&ki(r,i,2)}function vo(i){var r=i.alternate;return i===De||r!==null&&r===De}function Zm(i,r){Os=co=!0;var l=i.pending;l===null?r.next=r:(r.next=l.next,l.next=r),i.pending=r}function Qm(i,r,l){if((l&4194048)!==0){var u=r.lanes;u&=i.pendingLanes,l|=u,r.lanes=l,np(i,l)}}var jl={readContext:Zt,use:po,useCallback:pt,useContext:pt,useEffect:pt,useImperativeHandle:pt,useLayoutEffect:pt,useInsertionEffect:pt,useMemo:pt,useReducer:pt,useRef:pt,useState:pt,useDebugValue:pt,useDeferredValue:pt,useTransition:pt,useSyncExternalStore:pt,useId:pt,useHostTransitionStatus:pt,useFormState:pt,useActionState:pt,useOptimistic:pt,useMemoCache:pt,useCacheRefresh:pt};jl.useEffectEvent=pt;var Jm={readContext:Zt,use:po,useCallback:function(i,r){return hi().memoizedState=[i,r===void 0?null:r],i},useContext:Zt,useEffect:Om,useImperativeHandle:function(i,r,l){l=l!=null?l.concat([i]):null,_o(4194308,4,Um.bind(null,r,i),l)},useLayoutEffect:function(i,r){return _o(4194308,4,i,r)},useInsertionEffect:function(i,r){_o(4,2,i,r)},useMemo:function(i,r){var l=hi();r=r===void 0?null:r;var u=i();if(Xr){ui(!0);try{i()}finally{ui(!1)}}return l.memoizedState=[u,r],u},useReducer:function(i,r,l){var u=hi();if(l!==void 0){var d=l(r);if(Xr){ui(!0);try{l(r)}finally{ui(!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,De,i),[u.memoizedState,i]},useRef:function(i){var r=hi();return i={current:i},r.memoizedState=i},useState:function(i){i=Hc(i);var r=i.queue,l=$m.bind(null,De,r);return r.dispatch=l,[i.memoizedState,l]},useDebugValue:Ic,useDeferredValue:function(i,r){var l=hi();return Fc(l,i,r)},useTransition:function(){var i=Hc(!1);return i=Ym.bind(null,De,i.queue,!0,!1),hi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,l){var u=De,d=hi();if(Ie){if(l===void 0)throw Error(s(407));l=l()}else{if(l=r(),it===null)throw Error(s(349));(Pe&127)!==0||bm(u,r,l)}d.memoizedState=l;var m={value:l,getSnapshot:r};return d.queue=m,Om(xm.bind(null,u,m,i),[i]),u.flags|=2048,Hs(9,{destroy:void 0},Sm.bind(null,u,m,l,r),null),l},useId:function(){var i=hi(),r=it.identifierPrefix;if(Ie){var l=hn,u=cn;l=(u&~(1<<32-Ve(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=ho++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=a1++,r="_"+r+"r_"+l.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Wc,useFormState:Mm,useActionState:Mm,useOptimistic:function(i){var r=hi();r.memoizedState=r.baseState=i;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Yc.bind(null,De,!0,l),l.dispatch=r,[i,r]},useMemoCache:zc,useCacheRefresh:function(){return hi().memoizedState=d1.bind(null,De)},useEffectEvent:function(i){var r=hi(),l={impl:i};return r.memoizedState=l,function(){if((Ke&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},Vc={readContext:Zt,use:po,useCallback:Fm,useContext:Zt,useEffect:Uc,useImperativeHandle:Im,useInsertionEffect:Hm,useLayoutEffect:Pm,useMemo:qm,useReducer:mo,useRef:zm,useState:function(){return mo(Ln)},useDebugValue:Ic,useDeferredValue:function(i,r){var l=bt();return Wm(l,Ze.memoizedState,i,r)},useTransition:function(){var i=mo(Ln)[0],r=bt().memoizedState;return[typeof i=="boolean"?i:zl(i),r]},useSyncExternalStore:ym,useId:Xm,useHostTransitionStatus:Wc,useFormState:Bm,useActionState:Bm,useOptimistic:function(i,r){var l=bt();return km(l,Ze,i,r)},useMemoCache:zc,useCacheRefresh:Gm};Vc.useEffectEvent=jm;var e_={readContext:Zt,use:po,useCallback:Fm,useContext:Zt,useEffect:Uc,useImperativeHandle:Im,useInsertionEffect:Hm,useLayoutEffect:Pm,useMemo:qm,useReducer:jc,useRef:zm,useState:function(){return jc(Ln)},useDebugValue:Ic,useDeferredValue:function(i,r){var l=bt();return Ze===null?Fc(l,i,r):Wm(l,Ze.memoizedState,i,r)},useTransition:function(){var i=jc(Ln)[0],r=bt().memoizedState;return[typeof i=="boolean"?i:zl(i),r]},useSyncExternalStore:ym,useId:Xm,useHostTransitionStatus:Wc,useFormState:Lm,useActionState:Lm,useOptimistic:function(i,r){var l=bt();return Ze!==null?km(l,Ze,i,r):(l.baseState=i,[i,l.queue.dispatch])},useMemoCache:zc,useCacheRefresh:Gm};e_.useEffectEvent=jm;function Kc(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 Xc={enqueueSetState:function(i,r,l){i=i._reactInternals;var u=zi(),d=sr(u);d.payload=r,l!=null&&(d.callback=l),r=lr(i,d,u),r!==null&&(ki(r,i,u),Ml(r,i,u))},enqueueReplaceState:function(i,r,l){i=i._reactInternals;var u=zi(),d=sr(u);d.tag=1,d.payload=r,l!=null&&(d.callback=l),r=lr(i,d,u),r!==null&&(ki(r,i,u),Ml(r,i,u))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var l=zi(),u=sr(l);u.tag=2,r!=null&&(u.callback=r),r=lr(i,u,l),r!==null&&(ki(r,i,l),Ml(r,i,l))}};function t_(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?!wl(l,u)||!wl(d,m):!0}function i_(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&&Xc.enqueueReplaceState(r,r.state,null)}function Gr(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 n_(i){Ga(i)}function r_(i){console.error(i)}function s_(i){Ga(i)}function yo(i,r){try{var l=i.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function l_(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 Gc(i,r,l){return l=sr(l),l.tag=3,l.payload={element:null},l.callback=function(){yo(i,r)},l}function a_(i){return i=sr(i),i.tag=3,i}function o_(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(){l_(r,l,u)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){l_(r,l,u),typeof d!="function"&&(fr===null?fr=new Set([this]):fr.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}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&&Rs(r,l,d,!0),l=Mi.current,l!==null){switch(l.tag){case 31:case 13:return Xi===null?Mo():l.alternate===null&&mt===0&&(mt=3),l.flags&=-257,l.flags|=65536,l.lanes=d,u===so?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),bh(i,u,d)),!1;case 22:return l.flags|=65536,u===so?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)),bh(i,u,d)),!1}throw Error(s(435,l.tag))}return bh(i,u,d),Mo(),!1}if(Ie)return r=Mi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=d,u!==pc&&(i=Error(s(422),{cause:u}),El(Wi(i,l)))):(u!==pc&&(r=Error(s(423),{cause:u}),El(Wi(r,l))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,u=Wi(u,l),d=Gc(i.stateNode,u,d),kc(i,d),mt!==4&&(mt=2)),!1;var m=Error(s(520),{cause:u});if(m=Wi(m,l),Yl===null?Yl=[m]:Yl.push(m),mt!==4&&(mt=2),r===null)return!0;u=Wi(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,i=d&-d,l.lanes|=i,i=Gc(l.stateNode,u,i),kc(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"&&(fr===null||!fr.has(m))))return l.flags|=65536,d&=-d,l.lanes|=d,d=a_(d),o_(d,i,l,u),kc(l,d),!1}l=l.return}while(l!==null);return!1}var $c=Error(s(461)),kt=!1;function Qt(i,r,l,u){r.child=i===null?fm(r,null,l,u):Kr(r,i.child,l,u)}function u_(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 qr(r),u=Mc(i,r,l,v,m,d),w=Bc(),i!==null&&!kt?(Nc(i,r,d),zn(i,r,d)):(Ie&&w&&fc(r),r.flags|=1,Qt(i,r,u,d),r.child)}function c_(i,r,l,u,d){if(i===null){var m=l.type;return typeof m=="function"&&!uc(m)&&m.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=m,h_(i,r,m,u,d)):(i=Ja(l.type,null,u,r,r.mode,d),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!rh(i,d)){var v=m.memoizedProps;if(l=l.compare,l=l!==null?l:wl,l(v,u)&&i.ref===r.ref)return zn(i,r,d)}return r.flags|=1,i=Dn(m,u),i.ref=r.ref,i.return=r,r.child=i}function h_(i,r,l,u,d){if(i!==null){var m=i.memoizedProps;if(wl(m,u)&&i.ref===r.ref)if(kt=!1,r.pendingProps=u=m,rh(i,d))(i.flags&131072)!==0&&(kt=!0);else return r.lanes=i.lanes,zn(i,r,d)}return Zc(i,r,l,u,d)}function f_(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 d_(i,r,m,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&no(r,m!==null?m.cachePool:null),m!==null?mm(r,m):Tc(),_m(r);else return u=r.lanes=536870912,d_(i,r,m!==null?m.baseLanes|l:l,l,u)}else m!==null?(no(r,m.cachePool),mm(r,m),or(),r.memoizedState=null):(i!==null&&no(r,null),Tc(),or());return Qt(i,r,d,l),r.child}function Hl(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function d_(i,r,l,u,d){var m=Sc();return m=m===null?null:{parent:wt._currentValue,pool:m},r.memoizedState={baseLanes:l,cachePool:m},i!==null&&no(r,null),Tc(),_m(r),i!==null&&Rs(i,r,u,!0),r.childLanes=d,null}function bo(i,r){return r=xo({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function p_(i,r,l){return Kr(r,i.child,null,l),i=bo(r,r.pendingProps),i.flags|=2,Bi(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(Ie){if(u.mode==="hidden")return i=bo(r,u),r.lanes=536870912,Hl(null,i);if(Dc(r),(i=lt)?(i=Eg(i,Ki),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:er!==null?{id:cn,overflow:hn}:null,retryLane:536870912,hydrationErrors:null},l=Zp(i),l.return=r,r.child=l,$t=r,lt=null)):i=null,i===null)throw ir(r);return r.lanes=536870912,null}return bo(r,u)}var m=i.memoizedState;if(m!==null){var v=m.dehydrated;if(Dc(r),d)if(r.flags&256)r.flags&=-257,r=p_(i,r,l);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(s(558));else if(kt||Rs(i,r,l,!1),d=(l&i.childLanes)!==0,kt||d){if(u=it,u!==null&&(v=rp(u,l),v!==0&&v!==m.retryLane))throw m.retryLane=v,Pr(i,v),ki(u,i,v),$c;Mo(),r=p_(i,r,l)}else i=m.treeContext,lt=Gi(v.nextSibling),$t=r,Ie=!0,tr=null,Ki=!1,i!==null&&em(r,i),r=bo(r,u),r.flags|=4096;return r}return i=Dn(i.child,{mode:u.mode,children:u.children}),i.ref=r.ref,r.child=i,i.return=r,i}function So(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 Zc(i,r,l,u,d){return qr(r),l=Mc(i,r,l,u,void 0,d),u=Bc(),i!==null&&!kt?(Nc(i,r,d),zn(i,r,d)):(Ie&&u&&fc(r),r.flags|=1,Qt(i,r,l,d),r.child)}function m_(i,r,l,u,d,m){return qr(r),r.updateQueue=null,l=vm(r,u,l,d),gm(i),u=Bc(),i!==null&&!kt?(Nc(i,r,m),zn(i,r,m)):(Ie&&u&&fc(r),r.flags|=1,Qt(i,r,l,m),r.child)}function __(i,r,l,u,d){if(qr(r),r.stateNode===null){var m=Es,v=l.contextType;typeof v=="object"&&v!==null&&(m=Zt(v)),m=new l(u,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Xc,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=u,m.state=r.memoizedState,m.refs={},wc(r),v=l.contextType,m.context=typeof v=="object"&&v!==null?Zt(v):Es,m.state=r.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Kc(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&&Xc.enqueueReplaceState(m,m.state,null),Nl(r,u,m,d),Bl(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(i===null){m=r.stateNode;var w=r.memoizedProps,N=Gr(l,w);m.props=N;var q=m.context,J=l.contextType;v=Es,typeof J=="object"&&J!==null&&(v=Zt(J));var ne=l.getDerivedStateFromProps;J=typeof ne=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,J||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||q!==v)&&i_(r,m,u,v),rr=!1;var Y=r.memoizedState;m.state=Y,Nl(r,u,m,d),Bl(),q=r.memoizedState,w||Y!==q||rr?(typeof ne=="function"&&(Kc(r,l,ne,u),q=r.memoizedState),(N=rr||t_(r,l,N,u,Y,q,v))?(J||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=q),m.props=u,m.state=q,m.context=v,u=N):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{m=r.stateNode,Cc(i,r),v=r.memoizedProps,J=Gr(l,v),m.props=J,ne=r.pendingProps,Y=m.context,q=l.contextType,N=Es,typeof q=="object"&&q!==null&&(N=Zt(q)),w=l.getDerivedStateFromProps,(q=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(v!==ne||Y!==N)&&i_(r,m,u,N),rr=!1,Y=r.memoizedState,m.state=Y,Nl(r,u,m,d),Bl();var G=r.memoizedState;v!==ne||Y!==G||rr||i!==null&&i.dependencies!==null&&to(i.dependencies)?(typeof w=="function"&&(Kc(r,l,w,u),G=r.memoizedState),(J=rr||t_(r,l,J,u,Y,G,N)||i!==null&&i.dependencies!==null&&to(i.dependencies))?(q||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(u,G,N),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(u,G,N)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=G),m.props=u,m.state=G,m.context=N,u=J):(typeof m.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(r.flags|=1024),u=!1)}return m=u,So(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=Kr(r,i.child,null,d),r.child=Kr(r,null,l,d)):Qt(i,r,l,d),r.memoizedState=m.state,i=r.child):i=zn(i,r,d),i}function g_(i,r,l,u){return Ir(),r.flags|=256,Qt(i,r,l,u),r.child}var Qc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jc(i){return{baseLanes:i,cachePool:lm()}}function eh(i,r,l){return i=i!==null?i.childLanes&~l:0,r&&(i|=Li),i}function v_(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:(yt.current&2)!==0),v&&(d=!0,r.flags&=-129),v=(r.flags&32)!==0,r.flags&=-33,i===null){if(Ie){if(d?ar(r):or(),(i=lt)?(i=Eg(i,Ki),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:er!==null?{id:cn,overflow:hn}:null,retryLane:536870912,hydrationErrors:null},l=Zp(i),l.return=r,r.child=l,$t=r,lt=null)):i=null,i===null)throw ir(r);return Oh(i)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,d?(or(),d=r.mode,w=xo({mode:"hidden",children:w},d),u=Ur(u,d,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Jc(l),u.childLanes=eh(i,v,l),r.memoizedState=Qc,Hl(null,u)):(ar(r),th(r,w))}var N=i.memoizedState;if(N!==null&&(w=N.dehydrated,w!==null)){if(m)r.flags&256?(ar(r),r.flags&=-257,r=ih(i,r,l)):r.memoizedState!==null?(or(),r.child=i.child,r.flags|=128,r=null):(or(),w=u.fallback,d=r.mode,u=xo({mode:"visible",children:u.children},d),w=Ur(w,d,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Kr(r,i.child,null,l),u=r.child,u.memoizedState=Jc(l),u.childLanes=eh(i,v,l),r.memoizedState=Qc,r=Hl(null,u));else if(ar(r),Oh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var q=v.dgst;v=q,u=Error(s(419)),u.stack="",u.digest=v,El({value:u,source:null,stack:null}),r=ih(i,r,l)}else if(kt||Rs(i,r,l,!1),v=(l&i.childLanes)!==0,kt||v){if(v=it,v!==null&&(u=rp(v,l),u!==0&&u!==N.retryLane))throw N.retryLane=u,Pr(i,u),ki(v,i,u),$c;zh(w)||Mo(),r=ih(i,r,l)}else zh(w)?(r.flags|=192,r.child=i.child,r=null):(i=N.treeContext,lt=Gi(w.nextSibling),$t=r,Ie=!0,tr=null,Ki=!1,i!==null&&em(r,i),r=th(r,u.children),r.flags|=4096);return r}return d?(or(),w=u.fallback,d=r.mode,N=i.child,q=N.sibling,u=Dn(N,{mode:"hidden",children:u.children}),u.subtreeFlags=N.subtreeFlags&65011712,q!==null?w=Dn(q,w):(w=Ur(w,d,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,Hl(null,u),u=r.child,w=i.child.memoizedState,w===null?w=Jc(l):(d=w.cachePool,d!==null?(N=wt._currentValue,d=d.parent!==N?{parent:N,pool:N}:d):d=lm(),w={baseLanes:w.baseLanes|l,cachePool:d}),u.memoizedState=w,u.childLanes=eh(i,v,l),r.memoizedState=Qc,Hl(i.child,u)):(ar(r),l=i.child,i=l.sibling,l=Dn(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 th(i,r){return r=xo({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function xo(i,r){return i=Ri(22,i,null,r),i.lanes=0,i}function ih(i,r,l){return Kr(r,i.child,null,l),i=th(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function y_(i,r,l){i.lanes|=r;var u=i.alternate;u!==null&&(u.lanes|=r),gc(i.return,r,l)}function nh(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 b_(i,r,l){var u=r.pendingProps,d=u.revealOrder,m=u.tail;u=u.children;var v=yt.current,w=(v&2)!==0;if(w?(v=v&1|2,r.flags|=128):v&=1,C(yt,v),Qt(i,r,u,l),u=Ie?kl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&y_(i,l,r);else if(i.tag===19)y_(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&&uo(i)===null&&(d=l),l=l.sibling;l=d,l===null?(d=r.child,r.child=null):(d=l.sibling,l.sibling=null),nh(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&&uo(i)===null){r.child=d;break}i=d.sibling,d.sibling=l,l=d,d=i}nh(r,!0,l,null,m,u);break;case"together":nh(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function zn(i,r,l){if(i!==null&&(r.dependencies=i.dependencies),hr|=r.lanes,(l&r.childLanes)===0)if(i!==null){if(Rs(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=Dn(i,i.pendingProps),r.child=l,l.return=r;i.sibling!==null;)i=i.sibling,l=l.sibling=Dn(i,i.pendingProps),l.return=r;l.sibling=null}return r.child}function rh(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&to(i)))}function g1(i,r,l){switch(r.tag){case 3:ze(r,r.stateNode.containerInfo),nr(r,wt,i.memoizedState.cache),Ir();break;case 27:case 5:st(r);break;case 4:ze(r,r.stateNode.containerInfo);break;case 10:nr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Dc(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(ar(r),r.flags|=128,null):(l&r.child.childLanes)!==0?v_(i,r,l):(ar(r),i=zn(i,r,l),i!==null?i.sibling:null);ar(r);break;case 19:var d=(i.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(Rs(i,r,l,!1),u=(l&r.childLanes)!==0),d){if(u)return b_(i,r,l);r.flags|=128}if(d=r.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),C(yt,yt.current),u)break;return null;case 22:return r.lanes=0,f_(i,r,l,r.pendingProps);case 24:nr(r,wt,i.memoizedState.cache)}return zn(i,r,l)}function S_(i,r,l){if(i!==null)if(i.memoizedProps!==r.pendingProps)kt=!0;else{if(!rh(i,l)&&(r.flags&128)===0)return kt=!1,g1(i,r,l);kt=(i.flags&131072)!==0}else kt=!1,Ie&&(r.flags&1048576)!==0&&Jp(r,kl,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(i=Yr(r.elementType),r.type=i,typeof i=="function")uc(i)?(u=Gr(i,u),r.tag=1,r=__(null,r,i,u,l)):(r.tag=0,r=Zc(null,r,i,u,l));else{if(i!=null){var d=i.$$typeof;if(d===Z){r.tag=11,r=u_(null,r,i,u,l);break e}else if(d===te){r.tag=14,r=c_(null,r,i,u,l);break e}}throw r=A(i)||i,Error(s(306,r,""))}}return r;case 0:return Zc(i,r,r.type,r.pendingProps,l);case 1:return u=r.type,d=Gr(u,r.pendingProps),__(i,r,u,d,l);case 3:e:{if(ze(r,r.stateNode.containerInfo),i===null)throw Error(s(387));u=r.pendingProps;var m=r.memoizedState;d=m.element,Cc(i,r),Nl(r,u,null,l);var v=r.memoizedState;if(u=v.cache,nr(r,wt,u),u!==m.cache&&vc(r,[wt],l,!0),Bl(),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=g_(i,r,u,l);break e}else if(u!==d){d=Wi(Error(s(424)),r),El(d),r=g_(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(lt=Gi(i.firstChild),$t=r,Ie=!0,tr=null,Ki=!0,l=fm(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ir(),u===d){r=zn(i,r,l);break e}Qt(i,r,u,l)}r=r.child}return r;case 26:return So(i,r),i===null?(l=Bg(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ie||(l=r.type,i=r.pendingProps,u=Ho(de.current).createElement(l),u[Gt]=r,u[yi]=i,Jt(u,l,i),Ht(u),r.stateNode=u):r.memoizedState=Bg(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return st(r),i===null&&Ie&&(u=r.stateNode=Dg(r.type,r.pendingProps,de.current),$t=r,Ki=!0,d=lt,_r(r.type)?(jh=d,lt=Gi(u.firstChild)):lt=d),Qt(i,r,r.pendingProps.children,l),So(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Ie&&((d=u=lt)&&(u=K1(u,r.type,r.pendingProps,Ki),u!==null?(r.stateNode=u,$t=r,lt=Gi(u.firstChild),Ki=!1,d=!0):d=!1),d||ir(r)),st(r),d=r.type,m=r.pendingProps,v=i!==null?i.memoizedProps:null,u=m.children,Bh(d,m)?u=null:v!==null&&Bh(d,v)&&(r.flags|=32),r.memoizedState!==null&&(d=Mc(i,r,o1,null,null,l),Jl._currentValue=d),So(i,r),Qt(i,r,u,l),r.child;case 6:return i===null&&Ie&&((i=l=lt)&&(l=X1(l,r.pendingProps,Ki),l!==null?(r.stateNode=l,$t=r,lt=null,i=!0):i=!1),i||ir(r)),null;case 13:return v_(i,r,l);case 4:return ze(r,r.stateNode.containerInfo),u=r.pendingProps,i===null?r.child=Kr(r,null,u,l):Qt(i,r,u,l),r.child;case 11:return u_(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,nr(r,r.type,u.value),Qt(i,r,u.children,l),r.child;case 9:return d=r.type._context,u=r.pendingProps.children,qr(r),d=Zt(d),u=u(d),r.flags|=1,Qt(i,r,u,l),r.child;case 14:return c_(i,r,r.type,r.pendingProps,l);case 15:return h_(i,r,r.type,r.pendingProps,l);case 19:return b_(i,r,l);case 31:return _1(i,r,l);case 22:return f_(i,r,l,r.pendingProps);case 24:return qr(r),u=Zt(wt),i===null?(d=Sc(),d===null&&(d=it,m=yc(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=l),d=m),r.memoizedState={parent:u,cache:d},wc(r),nr(r,wt,d)):((i.lanes&l)!==0&&(Cc(i,r),Nl(r,null,null,l),Bl()),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),nr(r,wt,u)):(u=m.cache,nr(r,wt,u),u!==d.cache&&vc(r,[wt],l,!0))),Qt(i,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function On(i){i.flags|=4}function sh(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(X_())i.flags|=8192;else throw Vr=so,xc}else i.flags&=-16777217}function x_(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!jg(r))if(X_())i.flags|=8192;else throw Vr=so,xc}function wo(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?vi():536870912,i.lanes|=r,Fs|=r)}function Pl(i,r){if(!Ie)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 at(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(dc(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(r),null;case 1:return at(r),null;case 3:return l=r.stateNode,u=null,i!==null&&(u=i.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Bn(wt),Te(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(i===null||i.child===null)&&(Ds(r)?On(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,mc())),at(r),null;case 26:var d=r.type,m=r.memoizedState;return i===null?(On(r),m!==null?(at(r),x_(r,m)):(at(r),sh(r,d,null,u,l))):m?m!==i.memoizedState?(On(r),at(r),x_(r,m)):(at(r),r.flags&=-16777217):(i=i.memoizedProps,i!==u&&On(r),at(r),sh(r,d,i,u,l)),null;case 27:if(Xe(r),l=de.current,d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&On(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return at(r),null}i=Q.current,Ds(r)?tm(r):(i=Dg(d,u,l),r.stateNode=i,On(r))}return at(r),null;case 5:if(Xe(r),d=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==u&&On(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return at(r),null}if(m=Q.current,Ds(r))tm(r);else{var v=Ho(de.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[Gt]=r,m[yi]=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(Jt(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&&On(r)}}return at(r),sh(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,l),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==u&&On(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(i=de.current,Ds(r)){if(i=r.stateNode,l=r.memoizedProps,u=null,d=$t,d!==null)switch(d.tag){case 27:case 5:u=d.memoizedProps}i[Gt]=r,i=!!(i.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||vg(i.nodeValue,l)),i||ir(r,!0)}else i=Ho(i).createTextNode(u),i[Gt]=r,r.stateNode=i}return at(r),null;case 31:if(l=r.memoizedState,i===null||i.memoizedState!==null){if(u=Ds(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[Gt]=r}else Ir(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;at(r),i=!1}else l=mc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=l),i=!0;if(!i)return r.flags&256?(Bi(r),r):(Bi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return at(r),null;case 13:if(u=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=Ds(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[Gt]=r}else Ir(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;at(r),d=!1}else d=mc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return r.flags&256?(Bi(r),r):(Bi(r),null)}return Bi(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),wo(r,r.updateQueue),at(r),null);case 4:return Te(),i===null&&Th(r.stateNode.containerInfo),at(r),null;case 10:return Bn(r.type),at(r),null;case 19:if(X(yt),u=r.memoizedState,u===null)return at(r),null;if(d=(r.flags&128)!==0,m=u.rendering,m===null)if(d)Pl(u,!1);else{if(mt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=uo(i),m!==null){for(r.flags|=128,Pl(u,!1),i=m.updateQueue,r.updateQueue=i,wo(r,i),r.subtreeFlags=0,i=l,l=r.child;l!==null;)$p(l,i),l=l.sibling;return C(yt,yt.current&1|2),Ie&&Rn(r,u.treeForkCount),r.child}i=i.sibling}u.tail!==null&&zt()>Ao&&(r.flags|=128,d=!0,Pl(u,!1),r.lanes=4194304)}else{if(!d)if(i=uo(m),i!==null){if(r.flags|=128,d=!0,i=i.updateQueue,r.updateQueue=i,wo(r,i),Pl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!m.alternate&&!Ie)return at(r),null}else 2*zt()-u.renderingStartTime>Ao&&l!==536870912&&(r.flags|=128,d=!0,Pl(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=zt(),i.sibling=null,l=yt.current,C(yt,d?l&1|2:l&1),Ie&&Rn(r,u.treeForkCount),i):(at(r),null);case 22:case 23:return Bi(r),Ac(),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&&(at(r),r.subtreeFlags&6&&(r.flags|=8192)):at(r),l=r.updateQueue,l!==null&&wo(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&&X(Wr),null;case 24:return l=null,i!==null&&(l=i.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Bn(wt),at(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function y1(i,r){switch(dc(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return Bn(wt),Te(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Xe(r),null;case 31:if(r.memoizedState!==null){if(Bi(r),r.alternate===null)throw Error(s(340));Ir()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(Bi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Ir()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return X(yt),null;case 4:return Te(),null;case 10:return Bn(r.type),null;case 22:case 23:return Bi(r),Ac(),i!==null&&X(Wr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return Bn(wt),null;case 25:return null;default:return null}}function w_(i,r){switch(dc(r),r.tag){case 3:Bn(wt),Te();break;case 26:case 27:case 5:Xe(r);break;case 4:Te();break;case 31:r.memoizedState!==null&&Bi(r);break;case 13:Bi(r);break;case 19:X(yt);break;case 10:Bn(r.type);break;case 22:case 23:Bi(r),Ac(),i!==null&&X(Wr);break;case 24:Bn(wt)}}function Ul(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){$e(r,r.return,w)}}function ur(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 N=l,q=w;try{q()}catch(J){$e(d,N,J)}}}u=u.next}while(u!==m)}}catch(J){$e(r,r.return,J)}}function C_(i){var r=i.updateQueue;if(r!==null){var l=i.stateNode;try{pm(r,l)}catch(u){$e(i,i.return,u)}}}function k_(i,r,l){l.props=Gr(i.type,i.memoizedProps),l.state=i.memoizedState;try{l.componentWillUnmount()}catch(u){$e(i,r,u)}}function Il(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){$e(i,r,d)}}function fn(i,r){var l=i.ref,u=i.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(d){$e(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){$e(i,r,d)}else l.current=null}function E_(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){$e(i,i.return,d)}}function lh(i,r,l){try{var u=i.stateNode;I1(u,i.type,l,r),u[yi]=r}catch(d){$e(i,i.return,d)}}function T_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&_r(i.type)||i.tag===4}function ah(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||T_(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&&_r(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 oh(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=Tn));else if(u!==4&&(u===27&&_r(i.type)&&(l=i.stateNode,r=null),i=i.child,i!==null))for(oh(i,r,l),i=i.sibling;i!==null;)oh(i,r,l),i=i.sibling}function Co(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&&_r(i.type)&&(l=i.stateNode),i=i.child,i!==null))for(Co(i,r,l),i=i.sibling;i!==null;)Co(i,r,l),i=i.sibling}function A_(i){var r=i.stateNode,l=i.memoizedProps;try{for(var u=i.type,d=r.attributes;d.length;)r.removeAttributeNode(d[0]);Jt(r,u,l),r[Gt]=i,r[yi]=l}catch(m){$e(i,i.return,m)}}var jn=!1,Et=!1,uh=!1,D_=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function b1(i,r){if(i=i.containerInfo,Rh=Yo,i=Ip(i),ic(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,N=-1,q=0,J=0,ne=i,Y=null;t:for(;;){for(var G;ne!==l||d!==0&&ne.nodeType!==3||(w=v+d),ne!==m||u!==0&&ne.nodeType!==3||(N=v+u),ne.nodeType===3&&(v+=ne.nodeValue.length),(G=ne.firstChild)!==null;)Y=ne,ne=G;for(;;){if(ne===i)break t;if(Y===l&&++q===d&&(w=v),Y===m&&++J===u&&(N=v),(G=ne.nextSibling)!==null)break;ne=Y,Y=ne.parentNode}ne=G}l=w===-1||N===-1?null:{start:w,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(Mh={focusedElem:i,selectionRange:l},Yo=!1,Pt=r;Pt!==null;)if(r=Pt,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Pt=i;else for(;Pt!==null;){switch(r=Pt,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 _e=Gr(l.type,d);i=u.getSnapshotBeforeUpdate(_e,m),u.__reactInternalSnapshotBeforeUpdate=i}catch(we){$e(l,l.return,we)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,l=i.nodeType,l===9)Lh(i);else if(l===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Lh(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,Pt=i;break}Pt=r.return}}function R_(i,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:Pn(i,l),u&4&&Ul(5,l);break;case 1:if(Pn(i,l),u&4)if(i=l.stateNode,r===null)try{i.componentDidMount()}catch(v){$e(l,l.return,v)}else{var d=Gr(l.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(d,r,i.__reactInternalSnapshotBeforeUpdate)}catch(v){$e(l,l.return,v)}}u&64&&C_(l),u&512&&Il(l,l.return);break;case 3:if(Pn(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{pm(i,r)}catch(v){$e(l,l.return,v)}}break;case 27:r===null&&u&4&&A_(l);case 26:case 5:Pn(i,l),r===null&&u&4&&E_(l),u&512&&Il(l,l.return);break;case 12:Pn(i,l);break;case 31:Pn(i,l),u&4&&N_(i,l);break;case 13:Pn(i,l),u&4&&L_(i,l),u&64&&(i=l.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(l=D1.bind(null,l),G1(i,l))));break;case 22:if(u=l.memoizedState!==null||jn,!u){r=r!==null&&r.memoizedState!==null||Et,d=jn;var m=Et;jn=u,(Et=r)&&!m?Un(i,l,(l.subtreeFlags&8772)!==0):Pn(i,l),jn=d,Et=m}break;case 30:break;default:Pn(i,l)}}function M_(i){var r=i.alternate;r!==null&&(i.alternate=null,M_(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Pu(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 ut=null,Si=!1;function Hn(i,r,l){for(l=l.child;l!==null;)B_(i,r,l),l=l.sibling}function B_(i,r,l){if(dt&&typeof dt.onCommitFiberUnmount=="function")try{dt.onCommitFiberUnmount(Ot,l)}catch{}switch(l.tag){case 26:Et||fn(l,r),Hn(i,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Et||fn(l,r);var u=ut,d=Si;_r(l.type)&&(ut=l.stateNode,Si=!1),Hn(i,r,l),$l(l.stateNode),ut=u,Si=d;break;case 5:Et||fn(l,r);case 6:if(u=ut,d=Si,ut=null,Hn(i,r,l),ut=u,Si=d,ut!==null)if(Si)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(l.stateNode)}catch(m){$e(l,r,m)}else try{ut.removeChild(l.stateNode)}catch(m){$e(l,r,m)}break;case 18:ut!==null&&(Si?(i=ut,Cg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,l.stateNode),$s(i)):Cg(ut,l.stateNode));break;case 4:u=ut,d=Si,ut=l.stateNode.containerInfo,Si=!0,Hn(i,r,l),ut=u,Si=d;break;case 0:case 11:case 14:case 15:ur(2,l,r),Et||ur(4,l,r),Hn(i,r,l);break;case 1:Et||(fn(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&k_(l,r,u)),Hn(i,r,l);break;case 21:Hn(i,r,l);break;case 22:Et=(u=Et)||l.memoizedState!==null,Hn(i,r,l),Et=u;break;default:Hn(i,r,l)}}function N_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{$s(i)}catch(l){$e(r,r.return,l)}}}function L_(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{$s(i)}catch(l){$e(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 D_),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new D_),r;default:throw Error(s(435,i.tag))}}function ko(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 xi(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(_r(w.type)){ut=w.stateNode,Si=!1;break e}break;case 5:ut=w.stateNode,Si=!1;break e;case 3:case 4:ut=w.stateNode.containerInfo,Si=!0;break e}w=w.return}if(ut===null)throw Error(s(160));B_(m,v,d),ut=null,Si=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)z_(r,i),r=r.sibling}var sn=null;function z_(i,r){var l=i.alternate,u=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:xi(r,i),wi(i),u&4&&(ur(3,i,i.return),Ul(3,i),ur(5,i,i.return));break;case 1:xi(r,i),wi(i),u&512&&(Et||l===null||fn(l,l.return)),u&64&&jn&&(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=sn;if(xi(r,i),wi(i),u&512&&(Et||l===null||fn(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[pl]||m[Gt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(u),d.head.insertBefore(m,d.querySelector("head > title"))),Jt(m,u,l),m[Gt]=i,Ht(m),u=m;break e;case"link":var v=zg("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),Jt(m,u,l),d.head.appendChild(m);break;case"meta":if(v=zg("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),Jt(m,u,l),d.head.appendChild(m);break;default:throw Error(s(468,u))}m[Gt]=i,Ht(m),u=m}i.stateNode=u}else Og(d,i.type,i.stateNode);else i.stateNode=Lg(d,u,i.memoizedProps);else m!==u?(m===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):m.count--,u===null?Og(d,i.type,i.stateNode):Lg(d,u,i.memoizedProps)):u===null&&i.stateNode!==null&&lh(i,i.memoizedProps,l.memoizedProps)}break;case 27:xi(r,i),wi(i),u&512&&(Et||l===null||fn(l,l.return)),l!==null&&u&4&&lh(i,i.memoizedProps,l.memoizedProps);break;case 5:if(xi(r,i),wi(i),u&512&&(Et||l===null||fn(l,l.return)),i.flags&32){d=i.stateNode;try{ys(d,"")}catch(_e){$e(i,i.return,_e)}}u&4&&i.stateNode!=null&&(d=i.memoizedProps,lh(i,d,l!==null?l.memoizedProps:d)),u&1024&&(uh=!0);break;case 6:if(xi(r,i),wi(i),u&4){if(i.stateNode===null)throw Error(s(162));u=i.memoizedProps,l=i.stateNode;try{l.nodeValue=u}catch(_e){$e(i,i.return,_e)}}break;case 3:if(Io=null,d=sn,sn=Po(r.containerInfo),xi(r,i),sn=d,wi(i),u&4&&l!==null&&l.memoizedState.isDehydrated)try{$s(r.containerInfo)}catch(_e){$e(i,i.return,_e)}uh&&(uh=!1,O_(i));break;case 4:u=sn,sn=Po(i.stateNode.containerInfo),xi(r,i),wi(i),sn=u;break;case 12:xi(r,i),wi(i);break;case 31:xi(r,i),wi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ko(i,u)));break;case 13:xi(r,i),wi(i),i.child.flags&8192&&i.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(To=zt()),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ko(i,u)));break;case 22:d=i.memoizedState!==null;var N=l!==null&&l.memoizedState!==null,q=jn,J=Et;if(jn=q||d,Et=J||N,xi(r,i),Et=J,jn=q,wi(i),u&8192)e:for(r=i.stateNode,r._visibility=d?r._visibility&-2:r._visibility|1,d&&(l===null||N||jn||Et||$r(i)),l=null,r=i;;){if(r.tag===5||r.tag===26){if(l===null){N=l=r;try{if(m=N.stateNode,d)v=m.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=N.stateNode;var ne=N.memoizedProps.style,Y=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(_e){$e(N,N.return,_e)}}}else if(r.tag===6){if(l===null){N=r;try{N.stateNode.nodeValue=d?"":N.memoizedProps}catch(_e){$e(N,N.return,_e)}}}else if(r.tag===18){if(l===null){N=r;try{var G=N.stateNode;d?kg(G,!0):kg(N.stateNode,!1)}catch(_e){$e(N,N.return,_e)}}}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,ko(i,l))));break;case 19:xi(r,i),wi(i),u&4&&(u=i.updateQueue,u!==null&&(i.updateQueue=null,ko(i,u)));break;case 30:break;case 21:break;default:xi(r,i),wi(i)}}function wi(i){var r=i.flags;if(r&2){try{for(var l,u=i.return;u!==null;){if(T_(u)){l=u;break}u=u.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var d=l.stateNode,m=ah(i);Co(i,m,d);break;case 5:var v=l.stateNode;l.flags&32&&(ys(v,""),l.flags&=-33);var w=ah(i);Co(i,w,v);break;case 3:case 4:var N=l.stateNode.containerInfo,q=ah(i);oh(i,q,N);break;default:throw Error(s(161))}}catch(J){$e(i,i.return,J)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function O_(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;O_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function Pn(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)R_(i,r.alternate,r),r=r.sibling}function $r(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:ur(4,r,r.return),$r(r);break;case 1:fn(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&k_(r,r.return,l),$r(r);break;case 27:$l(r.stateNode);case 26:case 5:fn(r,r.return),$r(r);break;case 22:r.memoizedState===null&&$r(r);break;case 30:$r(r);break;default:$r(r)}i=i.sibling}}function Un(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:Un(d,m,l),Ul(4,m);break;case 1:if(Un(d,m,l),u=m,d=u.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(q){$e(u,u.return,q)}if(u=m,d=u.updateQueue,d!==null){var w=u.stateNode;try{var N=d.shared.hiddenCallbacks;if(N!==null)for(d.shared.hiddenCallbacks=null,d=0;d<N.length;d++)dm(N[d],w)}catch(q){$e(u,u.return,q)}}l&&v&64&&C_(m),Il(m,m.return);break;case 27:A_(m);case 26:case 5:Un(d,m,l),l&&u===null&&v&4&&E_(m),Il(m,m.return);break;case 12:Un(d,m,l);break;case 31:Un(d,m,l),l&&v&4&&N_(d,m);break;case 13:Un(d,m,l),l&&v&4&&L_(d,m);break;case 22:m.memoizedState===null&&Un(d,m,l),Il(m,m.return);break;case 30:break;default:Un(d,m,l)}r=r.sibling}}function ch(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&&Tl(l))}function hh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&Tl(i))}function ln(i,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)j_(i,r,l,u),r=r.sibling}function j_(i,r,l,u){var d=r.flags;switch(r.tag){case 0:case 11:case 15:ln(i,r,l,u),d&2048&&Ul(9,r);break;case 1:ln(i,r,l,u);break;case 3:ln(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&&Tl(i)));break;case 12:if(d&2048){ln(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(N){$e(r,r.return,N)}}else ln(i,r,l,u);break;case 31:ln(i,r,l,u);break;case 13:ln(i,r,l,u);break;case 23:break;case 22:m=r.stateNode,v=r.alternate,r.memoizedState!==null?m._visibility&2?ln(i,r,l,u):Fl(i,r):m._visibility&2?ln(i,r,l,u):(m._visibility|=2,Ps(i,r,l,u,(r.subtreeFlags&10256)!==0||!1)),d&2048&&ch(v,r);break;case 24:ln(i,r,l,u),d&2048&&hh(r.alternate,r);break;default:ln(i,r,l,u)}}function Ps(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,N=u,q=v.flags;switch(v.tag){case 0:case 11:case 15:Ps(m,v,w,N,d),Ul(8,v);break;case 23:break;case 22:var J=v.stateNode;v.memoizedState!==null?J._visibility&2?Ps(m,v,w,N,d):Fl(m,v):(J._visibility|=2,Ps(m,v,w,N,d)),d&&q&2048&&ch(v.alternate,v);break;case 24:Ps(m,v,w,N,d),d&&q&2048&&hh(v.alternate,v);break;default:Ps(m,v,w,N,d)}r=r.sibling}}function Fl(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:Fl(l,u),d&2048&&ch(u.alternate,u);break;case 24:Fl(l,u),d&2048&&hh(u.alternate,u);break;default:Fl(l,u)}r=r.sibling}}var ql=8192;function Us(i,r,l){if(i.subtreeFlags&ql)for(i=i.child;i!==null;)H_(i,r,l),i=i.sibling}function H_(i,r,l){switch(i.tag){case 26:Us(i,r,l),i.flags&ql&&i.memoizedState!==null&&ax(l,sn,i.memoizedState,i.memoizedProps);break;case 5:Us(i,r,l);break;case 3:case 4:var u=sn;sn=Po(i.stateNode.containerInfo),Us(i,r,l),sn=u;break;case 22:i.memoizedState===null&&(u=i.alternate,u!==null&&u.memoizedState!==null?(u=ql,ql=16777216,Us(i,r,l),ql=u):Us(i,r,l));break;default:Us(i,r,l)}}function P_(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 Wl(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];Pt=u,I_(u,i)}P_(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)U_(i),i=i.sibling}function U_(i){switch(i.tag){case 0:case 11:case 15:Wl(i),i.flags&2048&&ur(9,i,i.return);break;case 3:Wl(i);break;case 12:Wl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,Eo(i)):Wl(i);break;default:Wl(i)}}function Eo(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];Pt=u,I_(u,i)}P_(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:ur(8,r,r.return),Eo(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,Eo(r));break;default:Eo(r)}i=i.sibling}}function I_(i,r){for(;Pt!==null;){var l=Pt;switch(l.tag){case 0:case 11:case 15:ur(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:Tl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Pt=u;else e:for(l=i;Pt!==null;){u=Pt;var d=u.sibling,m=u.return;if(M_(u),u===l){Pt=null;break e}if(d!==null){d.return=m,Pt=d;break e}Pt=m}}}var x1={getCacheForType:function(i){var r=Zt(wt),l=r.data.get(i);return l===void 0&&(l=i(),r.data.set(i,l)),l},cacheSignal:function(){return Zt(wt).controller.signal}},w1=typeof WeakMap=="function"?WeakMap:Map,Ke=0,it=null,Oe=null,Pe=0,Ge=0,Ni=null,cr=!1,Is=!1,fh=!1,In=0,mt=0,hr=0,Zr=0,dh=0,Li=0,Fs=0,Yl=null,Ci=null,ph=!1,To=0,F_=0,Ao=1/0,Do=null,fr=null,Rt=0,dr=null,qs=null,Fn=0,mh=0,_h=null,q_=null,Vl=0,gh=null;function zi(){return(Ke&2)!==0&&Pe!==0?Pe&-Pe:T.T!==null?wh():sp()}function W_(){if(Li===0)if((Pe&536870912)===0||Ie){var i=kn;kn<<=1,(kn&3932160)===0&&(kn=262144),Li=i}else Li=536870912;return i=Mi.current,i!==null&&(i.flags|=32),Li}function ki(i,r,l){(i===it&&(Ge===2||Ge===9)||i.cancelPendingCommit!==null)&&(Ws(i,0),pr(i,Pe,Li,!1)),dl(i,l),((Ke&2)===0||i!==it)&&(i===it&&((Ke&2)===0&&(Zr|=l),mt===4&&pr(i,Pe,Li,!1)),dn(i))}function Y_(i,r,l){if((Ke&6)!==0)throw Error(s(327));var u=!l&&(r&127)===0&&(r&i.expiredLanes)===0||tt(i,r),d=u?E1(i,r):yh(i,r,!0),m=u;do{if(d===0){Is&&!u&&pr(i,r,0,!1);break}else{if(l=i.current.alternate,m&&!C1(l)){d=yh(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=Yl;var N=w.current.memoizedState.isDehydrated;if(N&&(Ws(w,v).flags|=256),v=yh(w,v,!1),v!==2){if(fh&&!N){w.errorRecoveryDisabledLanes|=m,Zr|=m,d=4;break e}m=Ci,Ci=d,m!==null&&(Ci===null?Ci=m:Ci.push.apply(Ci,m))}d=v}if(m=!1,d!==2)continue}}if(d===1){Ws(i,0),pr(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:pr(u,r,Li,!cr);break e;case 2:Ci=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(d=To+300-zt(),10<d)){if(pr(u,r,Li,!cr),ke(u,0,!0)!==0)break e;Fn=r,u.timeoutHandle=xg(V_.bind(null,u,l,Ci,Do,ph,r,Li,Zr,Fs,cr,m,"Throttled",-0,0),d);break e}V_(u,l,Ci,Do,ph,r,Li,Zr,Fs,cr,m,null,-0,0)}}break}while(!0);dn(i)}function V_(i,r,l,u,d,m,v,w,N,q,J,ne,Y,G){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:Tn},H_(r,m,ne);var _e=(m&62914560)===m?To-zt():(m&4194048)===m?F_-zt():0;if(_e=ox(ne,_e),_e!==null){Fn=m,i.cancelPendingCommit=_e(eg.bind(null,i,r,m,l,u,d,v,w,N,J,ne,null,Y,G)),pr(i,m,v,!q);return}}eg(i,r,m,l,u,d,v,w,N)}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(!Di(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 pr(i,r,l,u){r&=~dh,r&=~Zr,i.suspendedLanes|=r,i.pingedLanes&=~r,u&&(i.warmLanes|=r),u=i.expirationTimes;for(var d=r;0<d;){var m=31-Ve(d),v=1<<m;u[m]=-1,d&=~v}l!==0&&ip(i,l,r)}function Ro(){return(Ke&6)===0?(Kl(0),!1):!0}function vh(){if(Oe!==null){if(Ge===0)var i=Oe.return;else i=Oe,Mn=Fr=null,Lc(i),Ls=null,Dl=0,i=Oe;for(;i!==null;)w_(i.alternate,i),i=i.return;Oe=null}}function Ws(i,r){var l=i.timeoutHandle;l!==-1&&(i.timeoutHandle=-1,W1(l)),l=i.cancelPendingCommit,l!==null&&(i.cancelPendingCommit=null,l()),Fn=0,vh(),it=i,Oe=l=Dn(i.current,null),Pe=r,Ge=0,Ni=null,cr=!1,Is=tt(i,r),fh=!1,Fs=Li=dh=Zr=hr=mt=0,Ci=Yl=null,ph=!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-Ve(u),m=1<<d;r|=i[d],u&=~m}return In=r,$a(),l}function K_(i,r){De=null,T.H=jl,r===Ns||r===ro?(r=um(),Ge=3):r===xc?(r=um(),Ge=4):Ge=r===$c?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ni=r,Oe===null&&(mt=1,yo(i,Wi(r,i.current)))}function X_(){var i=Mi.current;return i===null?!0:(Pe&4194048)===Pe?Xi===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?i===Xi:!1}function G_(){var i=T.H;return T.H=jl,i===null?jl:i}function $_(){var i=T.A;return T.A=x1,i}function Mo(){mt=4,cr||(Pe&4194048)!==Pe&&Mi.current!==null||(Is=!0),(hr&134217727)===0&&(Zr&134217727)===0||it===null||pr(it,Pe,Li,!1)}function yh(i,r,l){var u=Ke;Ke|=2;var d=G_(),m=$_();(it!==i||Pe!==r)&&(Do=null,Ws(i,r)),r=!1;var v=mt;e:do try{if(Ge!==0&&Oe!==null){var w=Oe,N=Ni;switch(Ge){case 8:vh(),v=6;break e;case 3:case 2:case 9:case 6:Mi.current===null&&(r=!0);var q=Ge;if(Ge=0,Ni=null,Ys(i,w,N,q),l&&Is){v=0;break e}break;default:q=Ge,Ge=0,Ni=null,Ys(i,w,N,q)}}k1(),v=mt;break}catch(J){K_(i,J)}while(!0);return r&&i.shellSuspendCounter++,Mn=Fr=null,Ke=u,T.H=d,T.A=m,Oe===null&&(it=null,Pe=0,$a()),v}function k1(){for(;Oe!==null;)Z_(Oe)}function E1(i,r){var l=Ke;Ke|=2;var u=G_(),d=$_();it!==i||Pe!==r?(Do=null,Ao=zt()+500,Ws(i,r)):Is=tt(i,r);e:do try{if(Ge!==0&&Oe!==null){r=Oe;var m=Ni;t:switch(Ge){case 1:Ge=0,Ni=null,Ys(i,r,m,1);break;case 2:case 9:if(am(m)){Ge=0,Ni=null,Q_(r);break}r=function(){Ge!==2&&Ge!==9||it!==i||(Ge=7),dn(i)},m.then(r,r);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:am(m)?(Ge=0,Ni=null,Q_(r)):(Ge=0,Ni=null,Ys(i,r,m,7));break;case 5:var v=null;switch(Oe.tag){case 26:v=Oe.memoizedState;case 5:case 27:var w=Oe;if(v?jg(v):w.stateNode.complete){Ge=0,Ni=null;var N=w.sibling;if(N!==null)Oe=N;else{var q=w.return;q!==null?(Oe=q,Bo(q)):Oe=null}break t}}Ge=0,Ni=null,Ys(i,r,m,5);break;case 6:Ge=0,Ni=null,Ys(i,r,m,6);break;case 8:vh(),mt=6;break e;default:throw Error(s(462))}}T1();break}catch(J){K_(i,J)}while(!0);return Mn=Fr=null,T.H=u,T.A=d,Ke=l,Oe!==null?0:(it=null,Pe=0,$a(),mt)}function T1(){for(;Oe!==null&&!fs();)Z_(Oe)}function Z_(i){var r=S_(i.alternate,i,In);i.memoizedProps=i.pendingProps,r===null?Bo(i):Oe=r}function Q_(i){var r=i,l=r.alternate;switch(r.tag){case 15:case 0:r=m_(l,r,r.pendingProps,r.type,void 0,Pe);break;case 11:r=m_(l,r,r.pendingProps,r.type.render,r.ref,Pe);break;case 5:Lc(r);default:w_(l,r),r=Oe=$p(r,In),r=S_(l,r,In)}i.memoizedProps=i.pendingProps,r===null?Bo(i):Oe=r}function Ys(i,r,l,u){Mn=Fr=null,Lc(r),Ls=null,Dl=0;var d=r.return;try{if(m1(i,d,r,l,Pe)){mt=1,yo(i,Wi(l,i.current)),Oe=null;return}}catch(m){if(d!==null)throw Oe=d,m;mt=1,yo(i,Wi(l,i.current)),Oe=null;return}r.flags&32768?(Ie||u===1?i=!0:Is||(Pe&536870912)!==0?i=!1:(cr=i=!0,(u===2||u===9||u===3||u===6)&&(u=Mi.current,u!==null&&u.tag===13&&(u.flags|=16384))),J_(r,i)):Bo(r)}function Bo(i){var r=i;do{if((r.flags&32768)!==0){J_(r,cr);return}i=r.return;var l=v1(r.alternate,r,In);if(l!==null){Oe=l;return}if(r=r.sibling,r!==null){Oe=r;return}Oe=r=i}while(r!==null);mt===0&&(mt=5)}function J_(i,r){do{var l=y1(i.alternate,i);if(l!==null){l.flags&=32767,Oe=l;return}if(l=i.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(i=i.sibling,i!==null)){Oe=i;return}Oe=i=l}while(i!==null);mt=6,Oe=null}function eg(i,r,l,u,d,m,v,w,N){i.cancelPendingCommit=null;do No();while(Rt!==0);if((Ke&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=ac,l0(i,l,m,v,w,N),i===it&&(Oe=it=null,Pe=0),qs=r,dr=i,Fn=l,mh=m,_h=d,q_=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,M1(be,function(){return sg(),null})):(i.callbackNode=null,i.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=T.T,T.T=null,d=j.p,j.p=2,v=Ke,Ke|=4;try{b1(i,r,l)}finally{Ke=v,j.p=d,T.T=u}}Rt=1,tg(),ig(),ng()}}function tg(){if(Rt===1){Rt=0;var i=dr,r=qs,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var u=j.p;j.p=2;var d=Ke;Ke|=4;try{z_(r,i);var m=Mh,v=Ip(i.containerInfo),w=m.focusedElem,N=m.selectionRange;if(v!==w&&w&&w.ownerDocument&&Up(w.ownerDocument.documentElement,w)){if(N!==null&&ic(w)){var q=N.start,J=N.end;if(J===void 0&&(J=q),"selectionStart"in w)w.selectionStart=q,w.selectionEnd=Math.min(J,w.value.length);else{var ne=w.ownerDocument||document,Y=ne&&ne.defaultView||window;if(Y.getSelection){var G=Y.getSelection(),_e=w.textContent.length,we=Math.min(N.start,_e),Je=N.end===void 0?we:Math.min(N.end,_e);!G.extend&&we>Je&&(v=Je,Je=we,we=v);var P=Pp(w,we),z=Pp(w,Je);if(P&&z&&(G.rangeCount!==1||G.anchorNode!==P.node||G.anchorOffset!==P.offset||G.focusNode!==z.node||G.focusOffset!==z.offset)){var F=ne.createRange();F.setStart(P.node,P.offset),G.removeAllRanges(),we>Je?(G.addRange(F),G.extend(z.node,z.offset)):(F.setEnd(z.node,z.offset),G.addRange(F))}}}}for(ne=[],G=w;G=G.parentNode;)G.nodeType===1&&ne.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ne.length;w++){var ie=ne[w];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Yo=!!Rh,Mh=Rh=null}finally{Ke=d,j.p=u,T.T=l}}i.current=r,Rt=2}}function ig(){if(Rt===2){Rt=0;var i=dr,r=qs,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var u=j.p;j.p=2;var d=Ke;Ke|=4;try{R_(i,r.alternate,r)}finally{Ke=d,j.p=u,T.T=l}}Rt=3}}function ng(){if(Rt===4||Rt===3){Rt=0,fl();var i=dr,r=qs,l=Fn,u=q_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Rt=5:(Rt=0,qs=dr=null,rg(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(fr=null),ju(l),r=r.stateNode,dt&&typeof dt.onCommitFiberRoot=="function")try{dt.onCommitFiberRoot(Ot,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=T.T,d=j.p,j.p=2,T.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{T.T=r,j.p=d}}(Fn&3)!==0&&No(),dn(i),d=i.pendingLanes,(l&261930)!==0&&(d&42)!==0?i===gh?Vl++:(Vl=0,gh=i):Vl=0,Kl(0)}}function rg(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,Tl(r)))}function No(){return tg(),ig(),ng(),sg()}function sg(){if(Rt!==5)return!1;var i=dr,r=mh;mh=0;var l=ju(Fn),u=T.T,d=j.p;try{j.p=32>l?32:l,T.T=null,l=_h,_h=null;var m=dr,v=Fn;if(Rt=0,qs=dr=null,Fn=0,(Ke&6)!==0)throw Error(s(331));var w=Ke;if(Ke|=4,U_(m.current),j_(m,m.current,v,l),Ke=w,Kl(0,!1),dt&&typeof dt.onPostCommitFiberRoot=="function")try{dt.onPostCommitFiberRoot(Ot,m)}catch{}return!0}finally{j.p=d,T.T=u,rg(i,r)}}function lg(i,r,l){r=Wi(l,r),r=Gc(i.stateNode,r,2),i=lr(i,r,2),i!==null&&(dl(i,2),dn(i))}function $e(i,r,l){if(i.tag===3)lg(i,i,l);else for(;r!==null;){if(r.tag===3){lg(r,i,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(fr===null||!fr.has(u))){i=Wi(l,i),l=a_(2),u=lr(r,l,2),u!==null&&(o_(l,u,r,i),dl(u,2),dn(u));break}}r=r.return}}function bh(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)||(fh=!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,it===i&&(Pe&l)===l&&(mt===4||mt===3&&(Pe&62914560)===Pe&&300>zt()-To?(Ke&2)===0&&Ws(i,0):dh|=l,Fs===Pe&&(Fs=0)),dn(i)}function ag(i,r){r===0&&(r=vi()),i=Pr(i,r),i!==null&&(dl(i,r),dn(i))}function D1(i){var r=i.memoizedState,l=0;r!==null&&(l=r.retryLane),ag(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),ag(i,l)}function M1(i,r){return Ui(i,r)}var Lo=null,Vs=null,Sh=!1,zo=!1,xh=!1,mr=0;function dn(i){i!==Vs&&i.next===null&&(Vs===null?Lo=Vs=i:Vs=Vs.next=i),zo=!0,Sh||(Sh=!0,N1())}function Kl(i,r){if(!xh&&zo){xh=!0;do for(var l=!1,u=Lo;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-Ve(42|i)+1)-1,m&=d&~(v&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(l=!0,hg(u,m))}else m=Pe,m=ke(u,u===it?m:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(m&3)===0||tt(u,m)||(l=!0,hg(u,m));u=u.next}while(l);xh=!1}}function B1(){og()}function og(){zo=Sh=!1;var i=0;mr!==0&&q1()&&(i=mr);for(var r=zt(),l=null,u=Lo;u!==null;){var d=u.next,m=ug(u,r);m===0?(u.next=null,l===null?Lo=d:l.next=d,d===null&&(Vs=l)):(l=u,(i!==0||(m&3)!==0)&&(zo=!0)),u=d}Rt!==0&&Rt!==5||Kl(i),mr!==0&&(mr=0)}function ug(i,r){for(var l=i.suspendedLanes,u=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var v=31-Ve(m),w=1<<v,N=d[v];N===-1?((w&l)===0||(w&u)!==0)&&(d[v]=ci(w,r)):N<=r&&(i.expiredLanes|=w),m&=~w}if(r=it,l=Pe,l=ke(i,i===r?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u=i.callbackNode,l===0||i===r&&(Ge===2||Ge===9)||i.cancelPendingCommit!==null)return u!==null&&u!==null&&Nr(u),i.callbackNode=null,i.callbackPriority=0;if((l&3)===0||tt(i,l)){if(r=l&-l,r===i.callbackPriority)return r;switch(u!==null&&Nr(u),ju(l)){case 2:case 8:l=ue;break;case 32:l=be;break;case 268435456:l=Fe;break;default:l=be}return u=cg.bind(null,i),l=Ui(l,u),i.callbackPriority=r,i.callbackNode=l,r}return u!==null&&u!==null&&Nr(u),i.callbackPriority=2,i.callbackNode=null,2}function cg(i,r){if(Rt!==0&&Rt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var l=i.callbackNode;if(No()&&i.callbackNode!==l)return null;var u=Pe;return u=ke(i,i===it?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),u===0?null:(Y_(i,u,r),ug(i,zt()),i.callbackNode!=null&&i.callbackNode===l?cg.bind(null,i):null)}function hg(i,r){if(No())return null;Y_(i,r,!0)}function N1(){Y1(function(){(Ke&6)!==0?Ui(ee,B1):og()})}function wh(){if(mr===0){var i=Ms;i===0&&(i=un,un<<=1,(un&261888)===0&&(un=256)),mr=i}return mr}function fg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Fa(""+i)}function dg(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=fg((d[yi]||null).action),v=u.submitter;v&&(r=(r=v[yi]||null)?fg(r.formAction):v.getAttribute("formAction"),r!==null&&(m=r,v=null));var w=new Va("action","action",null,u,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(mr!==0){var N=v?dg(d,v):new FormData(d);qc(l,{pending:!0,data:N,method:d.method,action:m},null,N)}}else typeof m=="function"&&(w.preventDefault(),N=v?dg(d,v):new FormData(d),qc(l,{pending:!0,data:N,method:d.method,action:m},m,N))},currentTarget:d}]})}}for(var Ch=0;Ch<lc.length;Ch++){var kh=lc[Ch],z1=kh.toLowerCase(),O1=kh[0].toUpperCase()+kh.slice(1);rn(z1,"on"+O1)}rn(Wp,"onAnimationEnd"),rn(Yp,"onAnimationIteration"),rn(Vp,"onAnimationStart"),rn("dblclick","onDoubleClick"),rn("focusin","onFocus"),rn("focusout","onBlur"),rn(Q0,"onTransitionRun"),rn(J0,"onTransitionStart"),rn(e1,"onTransitionCancel"),rn(Kp,"onTransitionEnd"),gs("onMouseEnter",["mouseout","mouseover"]),gs("onMouseLeave",["mouseout","mouseover"]),gs("onPointerEnter",["pointerout","pointerover"]),gs("onPointerLeave",["pointerout","pointerover"]),zr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zr("onBeforeInput",["compositionend","keypress","textInput","paste"]),zr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xl="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(Xl));function pg(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],N=w.instance,q=w.currentTarget;if(w=w.listener,N!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=q;try{m(d)}catch(J){Ga(J)}d.currentTarget=null,m=N}else for(v=0;v<u.length;v++){if(w=u[v],N=w.instance,q=w.currentTarget,w=w.listener,N!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=q;try{m(d)}catch(J){Ga(J)}d.currentTarget=null,m=N}}}}function je(i,r){var l=r[Hu];l===void 0&&(l=r[Hu]=new Set);var u=i+"__bubble";l.has(u)||(mg(r,i,2,!1),l.add(u))}function Eh(i,r,l){var u=0;r&&(u|=4),mg(l,i,u,r)}var Oo="_reactListening"+Math.random().toString(36).slice(2);function Th(i){if(!i[Oo]){i[Oo]=!0,op.forEach(function(l){l!=="selectionchange"&&(j1.has(l)||Eh(l,!1,i),Eh(l,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[Oo]||(r[Oo]=!0,Eh("selectionchange",!1,r))}}function mg(i,r,l,u){switch(Wg(r)){case 2:var d=hx;break;case 8:d=fx;break;default:d=Fh}l=d.bind(null,r,l,i),d=void 0,!Ku||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 Ah(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 N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=ps(w),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){u=m=v;continue e}w=w.parentNode}}u=u.return}bp(function(){var q=m,J=Yu(l),ne=[];e:{var Y=Xp.get(i);if(Y!==void 0){var G=Va,_e=i;switch(i){case"keypress":if(Wa(l)===0)break e;case"keydown":case"keyup":G=R0;break;case"focusin":_e="focus",G=Zu;break;case"focusout":_e="blur",G=Zu;break;case"beforeblur":case"afterblur":G=Zu;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":G=wp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=v0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=N0;break;case Wp:case Yp:case Vp:G=S0;break;case Kp:G=z0;break;case"scroll":case"scrollend":G=_0;break;case"wheel":G=j0;break;case"copy":case"cut":case"paste":G=w0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=kp;break;case"toggle":case"beforetoggle":G=P0}var we=(r&4)!==0,Je=!we&&(i==="scroll"||i==="scrollend"),P=we?Y!==null?Y+"Capture":null:Y;we=[];for(var z=q,F;z!==null;){var ie=z;if(F=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||F===null||P===null||(ie=_l(z,P),ie!=null&&we.push(Gl(z,ie,F))),Je)break;z=z.return}0<we.length&&(Y=new G(Y,_e,null,l,J),ne.push({event:Y,listeners:we}))}}if((r&7)===0){e:{if(Y=i==="mouseover"||i==="pointerover",G=i==="mouseout"||i==="pointerout",Y&&l!==Wu&&(_e=l.relatedTarget||l.fromElement)&&(ps(_e)||_e[ds]))break e;if((G||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,G?(_e=l.relatedTarget||l.toElement,G=q,_e=_e?ps(_e):null,_e!==null&&(Je=o(_e),we=_e.tag,_e!==Je||we!==5&&we!==27&&we!==6)&&(_e=null)):(G=null,_e=q),G!==_e)){if(we=wp,ie="onMouseLeave",P="onMouseEnter",z="mouse",(i==="pointerout"||i==="pointerover")&&(we=kp,ie="onPointerLeave",P="onPointerEnter",z="pointer"),Je=G==null?Y:ml(G),F=_e==null?Y:ml(_e),Y=new we(ie,z+"leave",G,l,J),Y.target=Je,Y.relatedTarget=F,ie=null,ps(J)===q&&(we=new we(P,z+"enter",_e,l,J),we.target=F,we.relatedTarget=Je,ie=we),Je=ie,G&&_e)t:{for(we=H1,P=G,z=_e,F=0,ie=P;ie;ie=we(ie))F++;ie=0;for(var ye=z;ye;ye=we(ye))ie++;for(;0<F-ie;)P=we(P),F--;for(;0<ie-F;)z=we(z),ie--;for(;F--;){if(P===z||z!==null&&P===z.alternate){we=P;break t}P=we(P),z=we(z)}we=null}else we=null;G!==null&&_g(ne,Y,G,we,!1),_e!==null&&Je!==null&&_g(ne,Je,_e,we,!0)}}e:{if(Y=q?ml(q):window,G=Y.nodeName&&Y.nodeName.toLowerCase(),G==="select"||G==="input"&&Y.type==="file")var We=Np;else if(Mp(Y))if(Lp)We=G0;else{We=K0;var ge=V0}else G=Y.nodeName,!G||G.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?q&&qu(q.elementType)&&(We=Np):We=X0;if(We&&(We=We(i,q))){Bp(ne,We,l,J);break e}ge&&ge(i,Y,q),i==="focusout"&&q&&Y.type==="number"&&q.memoizedProps.value!=null&&Fu(Y,"number",Y.value)}switch(ge=q?ml(q):window,i){case"focusin":(Mp(ge)||ge.contentEditable==="true")&&(ws=ge,nc=q,Cl=null);break;case"focusout":Cl=nc=ws=null;break;case"mousedown":rc=!0;break;case"contextmenu":case"mouseup":case"dragend":rc=!1,Fp(ne,l,J);break;case"selectionchange":if(Z0)break;case"keydown":case"keyup":Fp(ne,l,J)}var Re;if(Ju)e:{switch(i){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else xs?Dp(i,l)&&(Ue="onCompositionEnd"):i==="keydown"&&l.keyCode===229&&(Ue="onCompositionStart");Ue&&(Ep&&l.locale!=="ko"&&(xs||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&xs&&(Re=Sp()):(Jn=J,Xu="value"in Jn?Jn.value:Jn.textContent,xs=!0)),ge=jo(q,Ue),0<ge.length&&(Ue=new Cp(Ue,i,null,l,J),ne.push({event:Ue,listeners:ge}),Re?Ue.data=Re:(Re=Rp(l),Re!==null&&(Ue.data=Re)))),(Re=I0?F0(i,l):q0(i,l))&&(Ue=jo(q,"onBeforeInput"),0<Ue.length&&(ge=new Cp("onBeforeInput","beforeinput",null,l,J),ne.push({event:ge,listeners:Ue}),ge.data=Re)),L1(ne,i,q,l,J)}pg(ne,r)})}function Gl(i,r,l){return{instance:i,listener:r,currentTarget:l}}function jo(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=_l(i,l),d!=null&&u.unshift(Gl(i,d,m)),d=_l(i,r),d!=null&&u.push(Gl(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 _g(i,r,l,u,d){for(var m=r._reactName,v=[];l!==null&&l!==u;){var w=l,N=w.alternate,q=w.stateNode;if(w=w.tag,N!==null&&N===u)break;w!==5&&w!==26&&w!==27||q===null||(N=q,d?(q=_l(l,m),q!=null&&v.unshift(Gl(l,q,N))):d||(q=_l(l,m),q!=null&&v.push(Gl(l,q,N)))),l=l.return}v.length!==0&&i.push({event:r,listeners:v})}var P1=/\r\n?/g,U1=/\u0000|\uFFFD/g;function gg(i){return(typeof i=="string"?i:""+i).replace(P1,`
|
|
49
|
+
`).replace(U1,"")}function vg(i,r){return r=gg(r),gg(i)===r}function Qe(i,r,l,u,d,m){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ys(i,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ys(i,""+u);break;case"className":Ua(i,"class",u);break;case"tabIndex":Ua(i,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ua(i,l,u);break;case"style":vp(i,u,m);break;case"data":if(r!=="object"){Ua(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=Fa(""+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"&&Qe(i,r,"name",d.name,d,null),Qe(i,r,"formEncType",d.formEncType,d,null),Qe(i,r,"formMethod",d.formMethod,d,null),Qe(i,r,"formTarget",d.formTarget,d,null)):(Qe(i,r,"encType",d.encType,d,null),Qe(i,r,"method",d.method,d,null),Qe(i,r,"target",d.target,d,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){i.removeAttribute(l);break}u=Fa(""+u),i.setAttribute(l,u);break;case"onClick":u!=null&&(i.onclick=Tn);break;case"onScroll":u!=null&&je("scroll",i);break;case"onScrollEnd":u!=null&&je("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=Fa(""+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":je("beforetoggle",i),je("toggle",i),Pa(i,"popover",u);break;case"xlinkActuate":En(i,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":En(i,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":En(i,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":En(i,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":En(i,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":En(i,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":En(i,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":En(i,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":En(i,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Pa(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,Pa(i,l,u))}}function Dh(i,r,l,u,d,m){switch(l){case"style":vp(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"?ys(i,u):(typeof u=="number"||typeof u=="bigint")&&ys(i,""+u);break;case"onScroll":u!=null&&je("scroll",i);break;case"onScrollEnd":u!=null&&je("scrollend",i);break;case"onClick":u!=null&&(i.onclick=Tn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!up.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[yi]||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,""):Pa(i,l,u)}}}function Jt(i,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":je("error",i),je("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:Qe(i,r,m,v,l,null)}}d&&Qe(i,r,"srcSet",l.srcSet,l,null),u&&Qe(i,r,"src",l.src,l,null);return;case"input":je("invalid",i);var w=m=v=d=null,N=null,q=null;for(u in l)if(l.hasOwnProperty(u)){var J=l[u];if(J!=null)switch(u){case"name":d=J;break;case"type":v=J;break;case"checked":N=J;break;case"defaultChecked":q=J;break;case"value":m=J;break;case"defaultValue":w=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,r));break;default:Qe(i,r,u,J,l,null)}}pp(i,m,w,N,q,v,d,!1);return;case"select":je("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:Qe(i,r,d,w,l,null)}r=m,l=v,i.multiple=!!u,r!=null?vs(i,!!u,r,!1):l!=null&&vs(i,!!u,l,!0);return;case"textarea":je("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:Qe(i,r,v,w,l,null)}_p(i,u,d,m);return;case"option":for(N in l)if(l.hasOwnProperty(N)&&(u=l[N],u!=null))switch(N){case"selected":i.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Qe(i,r,N,u,l,null)}return;case"dialog":je("beforetoggle",i),je("toggle",i),je("cancel",i),je("close",i);break;case"iframe":case"object":je("load",i);break;case"video":case"audio":for(u=0;u<Xl.length;u++)je(Xl[u],i);break;case"image":je("error",i),je("load",i);break;case"details":je("toggle",i);break;case"embed":case"source":case"link":je("error",i),je("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(q in l)if(l.hasOwnProperty(q)&&(u=l[q],u!=null))switch(q){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Qe(i,r,q,u,l,null)}return;default:if(qu(r)){for(J in l)l.hasOwnProperty(J)&&(u=l[J],u!==void 0&&Dh(i,r,J,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&Qe(i,r,w,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,w=null,N=null,q=null,J=null;for(G in l){var ne=l[G];if(l.hasOwnProperty(G)&&ne!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":N=ne;default:u.hasOwnProperty(G)||Qe(i,r,G,null,u,ne)}}for(var Y in u){var G=u[Y];if(ne=l[Y],u.hasOwnProperty(Y)&&(G!=null||ne!=null))switch(Y){case"type":m=G;break;case"name":d=G;break;case"checked":q=G;break;case"defaultChecked":J=G;break;case"value":v=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(137,r));break;default:G!==ne&&Qe(i,r,Y,G,u,ne)}}Iu(i,v,w,N,q,J,m,d);return;case"select":G=v=w=Y=null;for(m in l)if(N=l[m],l.hasOwnProperty(m)&&N!=null)switch(m){case"value":break;case"multiple":G=N;default:u.hasOwnProperty(m)||Qe(i,r,m,null,u,N)}for(d in u)if(m=u[d],N=l[d],u.hasOwnProperty(d)&&(m!=null||N!=null))switch(d){case"value":Y=m;break;case"defaultValue":w=m;break;case"multiple":v=m;default:m!==N&&Qe(i,r,d,m,u,N)}r=w,l=v,u=G,Y!=null?vs(i,!!l,Y,!1):!!u!=!!l&&(r!=null?vs(i,!!l,r,!0):vs(i,!!l,l?[]:"",!1));return;case"textarea":G=Y=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:Qe(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":Y=d;break;case"defaultValue":G=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(s(91));break;default:d!==m&&Qe(i,r,v,d,u,m)}mp(i,Y,G);return;case"option":for(var _e in l)if(Y=l[_e],l.hasOwnProperty(_e)&&Y!=null&&!u.hasOwnProperty(_e))switch(_e){case"selected":i.selected=!1;break;default:Qe(i,r,_e,null,u,Y)}for(N in u)if(Y=u[N],G=l[N],u.hasOwnProperty(N)&&Y!==G&&(Y!=null||G!=null))switch(N){case"selected":i.selected=Y&&typeof Y!="function"&&typeof Y!="symbol";break;default:Qe(i,r,N,Y,u,G)}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 we in l)Y=l[we],l.hasOwnProperty(we)&&Y!=null&&!u.hasOwnProperty(we)&&Qe(i,r,we,null,u,Y);for(q in u)if(Y=u[q],G=l[q],u.hasOwnProperty(q)&&Y!==G&&(Y!=null||G!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(s(137,r));break;default:Qe(i,r,q,Y,u,G)}return;default:if(qu(r)){for(var Je in l)Y=l[Je],l.hasOwnProperty(Je)&&Y!==void 0&&!u.hasOwnProperty(Je)&&Dh(i,r,Je,void 0,u,Y);for(J in u)Y=u[J],G=l[J],!u.hasOwnProperty(J)||Y===G||Y===void 0&&G===void 0||Dh(i,r,J,Y,u,G);return}}for(var P in l)Y=l[P],l.hasOwnProperty(P)&&Y!=null&&!u.hasOwnProperty(P)&&Qe(i,r,P,null,u,Y);for(ne in u)Y=u[ne],G=l[ne],!u.hasOwnProperty(ne)||Y===G||Y==null&&G==null||Qe(i,r,ne,Y,u,G)}function yg(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,w=d.duration;if(m&&w&&yg(v)){for(v=0,w=d.responseEnd,u+=1;u<l.length;u++){var N=l[u],q=N.startTime;if(q>w)break;var J=N.transferSize,ne=N.initiatorType;J&&yg(ne)&&(N=N.responseEnd,v+=J*(N<w?1:(w-q)/(N-q)))}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 Rh=null,Mh=null;function Ho(i){return i.nodeType===9?i:i.ownerDocument}function bg(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 Sg(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 Bh(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 Nh=null;function q1(){var i=window.event;return i&&i.type==="popstate"?i===Nh?!1:(Nh=i,!0):(Nh=null,!1)}var xg=typeof setTimeout=="function"?setTimeout:void 0,W1=typeof clearTimeout=="function"?clearTimeout:void 0,wg=typeof Promise=="function"?Promise:void 0,Y1=typeof queueMicrotask=="function"?queueMicrotask:typeof wg<"u"?function(i){return wg.resolve(null).then(i).catch(V1)}:xg;function V1(i){setTimeout(function(){throw i})}function _r(i){return i==="head"}function Cg(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),$s(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")$l(i.ownerDocument.documentElement);else if(l==="head"){l=i.ownerDocument.head,$l(l);for(var m=l.firstChild;m;){var v=m.nextSibling,w=m.nodeName;m[pl]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&m.rel.toLowerCase()==="stylesheet"||l.removeChild(m),m=v}}else l==="body"&&$l(i.ownerDocument.body);l=d}while(l);$s(r)}function kg(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 Lh(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":Lh(l),Pu(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[pl])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=Gi(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=Gi(i.nextSibling),i===null))return null;return i}function Eg(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Gi(i.nextSibling),i===null))return null;return i}function zh(i){return i.data==="$?"||i.data==="$~"}function Oh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function G1(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 Gi(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 jh=null;function Tg(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var l=i.data;if(l==="/$"||l==="/&"){if(r===0)return Gi(i.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}i=i.nextSibling}return null}function Ag(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 Dg(i,r,l){switch(r=Ho(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 $l(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Pu(i)}var $i=new Map,Rg=new Set;function Po(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var qn=j.d;j.d={f:$1,r:Z1,D:Q1,C:J1,L:ex,m:tx,X:nx,S:ix,M:rx};function $1(){var i=qn.f(),r=Ro();return i||r}function Z1(i){var r=ms(i);r!==null&&r.tag===5&&r.type==="form"?Km(r):qn.r(i)}var Ks=typeof document>"u"?null:document;function Mg(i,r,l){var u=Ks;if(u&&typeof r=="string"&&r){var d=Fi(r);d='link[rel="'+i+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),Rg.has(d)||(Rg.add(d),i={rel:i,crossOrigin:l,href:r},u.querySelector(d)===null&&(r=u.createElement("link"),Jt(r,"link",i),Ht(r),u.head.appendChild(r)))}}function Q1(i){qn.D(i),Mg("dns-prefetch",i,null)}function J1(i,r){qn.C(i,r),Mg("preconnect",i,r)}function ex(i,r,l){qn.L(i,r,l);var u=Ks;if(u&&i&&r){var d='link[rel="preload"][as="'+Fi(r)+'"]';r==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+Fi(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+Fi(l.imageSizes)+'"]')):d+='[href="'+Fi(i)+'"]';var m=d;switch(r){case"style":m=Xs(i);break;case"script":m=Gs(i)}$i.has(m)||(i=_({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:i,as:r},l),$i.set(m,i),u.querySelector(d)!==null||r==="style"&&u.querySelector(Zl(m))||r==="script"&&u.querySelector(Ql(m))||(r=u.createElement("link"),Jt(r,"link",i),Ht(r),u.head.appendChild(r)))}}function tx(i,r){qn.m(i,r);var l=Ks;if(l&&i){var u=r&&typeof r.as=="string"?r.as:"script",d='link[rel="modulepreload"][as="'+Fi(u)+'"][href="'+Fi(i)+'"]',m=d;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Gs(i)}if(!$i.has(m)&&(i=_({rel:"modulepreload",href:i},r),$i.set(m,i),l.querySelector(d)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Ql(m)))return}u=l.createElement("link"),Jt(u,"link",i),Ht(u),l.head.appendChild(u)}}}function ix(i,r,l){qn.S(i,r,l);var u=Ks;if(u&&i){var d=_s(u).hoistableStyles,m=Xs(i);r=r||"default";var v=d.get(m);if(!v){var w={loading:0,preload:null};if(v=u.querySelector(Zl(m)))w.loading=5;else{i=_({rel:"stylesheet",href:i,"data-precedence":r},l),(l=$i.get(m))&&Hh(i,l);var N=v=u.createElement("link");Ht(N),Jt(N,"link",i),N._p=new Promise(function(q,J){N.onload=q,N.onerror=J}),N.addEventListener("load",function(){w.loading|=1}),N.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Uo(v,r,u)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(m,v)}}}function nx(i,r){qn.X(i,r);var l=Ks;if(l&&i){var u=_s(l).hoistableScripts,d=Gs(i),m=u.get(d);m||(m=l.querySelector(Ql(d)),m||(i=_({src:i,async:!0},r),(r=$i.get(d))&&Ph(i,r),m=l.createElement("script"),Ht(m),Jt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function rx(i,r){qn.M(i,r);var l=Ks;if(l&&i){var u=_s(l).hoistableScripts,d=Gs(i),m=u.get(d);m||(m=l.querySelector(Ql(d)),m||(i=_({src:i,async:!0,type:"module"},r),(r=$i.get(d))&&Ph(i,r),m=l.createElement("script"),Ht(m),Jt(m,"link",i),l.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},u.set(d,m))}}function Bg(i,r,l,u){var d=(d=de.current)?Po(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=Xs(l.href),l=_s(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=Xs(l.href);var m=_s(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(Zl(i)))&&!m._p&&(v.instance=m,v.state.loading=5),$i.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},$i.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=Gs(l),l=_s(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 Xs(i){return'href="'+Fi(i)+'"'}function Zl(i){return'link[rel="stylesheet"]['+i+"]"}function Ng(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}),Jt(r,"link",l),Ht(r),i.head.appendChild(r))}function Gs(i){return'[src="'+Fi(i)+'"]'}function Ql(i){return"script[async]"+i}function Lg(i,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=i.querySelector('style[data-href~="'+Fi(l.href)+'"]');if(u)return r.instance=u,Ht(u),u;var d=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(i.ownerDocument||i).createElement("style"),Ht(u),Jt(u,"style",d),Uo(u,l.precedence,i),r.instance=u;case"stylesheet":d=Xs(l.href);var m=i.querySelector(Zl(d));if(m)return r.state.loading|=4,r.instance=m,Ht(m),m;u=Ng(l),(d=$i.get(d))&&Hh(u,d),m=(i.ownerDocument||i).createElement("link"),Ht(m);var v=m;return v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Jt(m,"link",u),r.state.loading|=4,Uo(m,l.precedence,i),r.instance=m;case"script":return m=Gs(l.src),(d=i.querySelector(Ql(m)))?(r.instance=d,Ht(d),d):(u=l,(d=$i.get(m))&&(u=_({},l),Ph(u,d)),i=i.ownerDocument||i,d=i.createElement("script"),Ht(d),Jt(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,Uo(u,l.precedence,i));return r.instance}function Uo(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 Hh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Ph(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Io=null;function zg(i,r,l){if(Io===null){var u=new Map,d=Io=new Map;d.set(l,u)}else d=Io,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[pl]||m[Gt]||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 Og(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 jg(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=Xs(u.href),m=r.querySelector(Zl(d));if(m){r=m._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=Fo.bind(i),r.then(i,i)),l.state.loading|=4,l.instance=m,Ht(m);return}m=r.ownerDocument||r,u=Ng(u),(d=$i.get(d))&&Hh(u,d),m=m.createElement("link"),Ht(m);var v=m;v._p=new Promise(function(w,N){v.onload=w,v.onerror=N}),Jt(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=Fo.bind(i),r.addEventListener("load",l),r.addEventListener("error",l))}}var Uh=0;function ox(i,r){return i.stylesheets&&i.count===0&&Wo(i,i.stylesheets),0<i.count||0<i.imgCount?function(l){var u=setTimeout(function(){if(i.stylesheets&&Wo(i,i.stylesheets),i.unsuspend){var m=i.unsuspend;i.unsuspend=null,m()}},6e4+r);0<i.imgBytes&&Uh===0&&(Uh=62500*F1());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Wo(i,i.stylesheets),i.unsuspend)){var m=i.unsuspend;i.unsuspend=null,m()}},(i.imgBytes>Uh?50:800)+r);return i.unsuspend=l,function(){i.unsuspend=null,clearTimeout(u),clearTimeout(d)}}:null}function Fo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wo(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var qo=null;function Wo(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,qo=new Map,r.forEach(ux,i),qo=null,Fo.call(i))}function ux(i,r){if(!(r.state.loading&4)){var l=qo.get(i);if(l)var u=l.get(null);else{l=new Map,qo.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=Fo.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 Jl={$$typeof:I,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function cx(i,r,l,u,d,m,v,w,N){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=Lr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lr(0),this.hiddenUpdates=Lr(null),this.identifierPrefix=u,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Hg(i,r,l,u,d,m,v,w,N,q,J,ne){return i=new cx(i,r,l,v,N,q,J,ne,w),r=1,m===!0&&(r|=24),m=Ri(3,null,null,r),i.current=m,m.stateNode=i,r=yc(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:u,isDehydrated:l,cache:r},wc(m),i}function Pg(i){return i?(i=Es,i):Es}function Ug(i,r,l,u,d,m){d=Pg(d),u.context===null?u.context=d:u.pendingContext=d,u=sr(r),u.payload={element:l},m=m===void 0?null:m,m!==null&&(u.callback=m),l=lr(i,u,r),l!==null&&(ki(l,i,r),Ml(l,i,r))}function Ig(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var l=i.retryLane;i.retryLane=l!==0&&l<r?l:r}}function Ih(i,r){Ig(i,r),(i=i.alternate)&&Ig(i,r)}function Fg(i){if(i.tag===13||i.tag===31){var r=Pr(i,67108864);r!==null&&ki(r,i,67108864),Ih(i,67108864)}}function qg(i){if(i.tag===13||i.tag===31){var r=zi();r=Ou(r);var l=Pr(i,r);l!==null&&ki(l,i,r),Ih(i,r)}}var Yo=!0;function hx(i,r,l,u){var d=T.T;T.T=null;var m=j.p;try{j.p=2,Fh(i,r,l,u)}finally{j.p=m,T.T=d}}function fx(i,r,l,u){var d=T.T;T.T=null;var m=j.p;try{j.p=8,Fh(i,r,l,u)}finally{j.p=m,T.T=d}}function Fh(i,r,l,u){if(Yo){var d=qh(u);if(d===null)Ah(i,r,u,Vo,l),Yg(i,u);else if(px(d,i,r,l,u))u.stopPropagation();else if(Yg(i,u),r&4&&-1<dx.indexOf(i)){for(;d!==null;){var m=ms(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var v=ve(m.pendingLanes);if(v!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var N=1<<31-Ve(v);w.entanglements[1]|=N,v&=~N}dn(m),(Ke&6)===0&&(Ao=zt()+500,Kl(0))}}break;case 31:case 13:w=Pr(m,2),w!==null&&ki(w,m,2),Ro(),Ih(m,2)}if(m=qh(u),m===null&&Ah(i,r,u,Vo,l),m===d)break;d=m}d!==null&&u.stopPropagation()}else Ah(i,r,u,null,l)}}function qh(i){return i=Yu(i),Wh(i)}var Vo=null;function Wh(i){if(Vo=null,i=ps(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 Vo=i,null}function Wg(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(Zn()){case ee:return 2;case ue:return 8;case be:case Be:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Yh=!1,gr=null,vr=null,yr=null,ea=new Map,ta=new Map,br=[],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 Yg(i,r){switch(i){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":ea.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ta.delete(r.pointerId)}}function ia(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=ms(r),r!==null&&Fg(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 gr=ia(gr,i,r,l,u,d),!0;case"dragenter":return vr=ia(vr,i,r,l,u,d),!0;case"mouseover":return yr=ia(yr,i,r,l,u,d),!0;case"pointerover":var m=d.pointerId;return ea.set(m,ia(ea.get(m)||null,i,r,l,u,d)),!0;case"gotpointercapture":return m=d.pointerId,ta.set(m,ia(ta.get(m)||null,i,r,l,u,d)),!0}return!1}function Vg(i){var r=ps(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,lp(i.priority,function(){qg(l)});return}}else if(r===31){if(r=f(l),r!==null){i.blockedOn=r,lp(i.priority,function(){qg(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 Ko(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var l=qh(i.nativeEvent);if(l===null){l=i.nativeEvent;var u=new l.constructor(l.type,l);Wu=u,l.target.dispatchEvent(u),Wu=null}else return r=ms(l),r!==null&&Fg(r),i.blockedOn=l,!1;r.shift()}return!0}function Kg(i,r,l){Ko(i)&&l.delete(r)}function mx(){Yh=!1,gr!==null&&Ko(gr)&&(gr=null),vr!==null&&Ko(vr)&&(vr=null),yr!==null&&Ko(yr)&&(yr=null),ea.forEach(Kg),ta.forEach(Kg)}function Xo(i,r){i.blockedOn===r&&(i.blockedOn=null,Yh||(Yh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,mx)))}var Go=null;function Xg(i){Go!==i&&(Go=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Go===i&&(Go=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(Wh(u||l)===null)continue;break}var m=ms(l);m!==null&&(i.splice(r,3),r-=3,qc(m,{pending:!0,data:d,method:l.method,action:u},u,d))}}))}function $s(i){function r(N){return Xo(N,i)}gr!==null&&Xo(gr,i),vr!==null&&Xo(vr,i),yr!==null&&Xo(yr,i),ea.forEach(r),ta.forEach(r);for(var l=0;l<br.length;l++){var u=br[l];u.blockedOn===i&&(u.blockedOn=null)}for(;0<br.length&&(l=br[0],l.blockedOn===null);)Vg(l),l.blockedOn===null&&br.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[yi]||null;if(typeof m=="function")v||Xg(l);else if(v){var w=null;if(m&&m.hasAttribute("formAction")){if(d=m,v=m[yi]||null)w=v.formAction;else if(Wh(d)!==null)continue}else w=v.action;typeof w=="function"?l[u+1]=w:(l.splice(u,3),u-=3),Xg(l)}}}function Gg(){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 Vh(i){this._internalRoot=i}$o.prototype.render=Vh.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var l=r.current,u=zi();Ug(l,u,i,r,null,null)},$o.prototype.unmount=Vh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Ug(i.current,2,null,i,null,null),Ro(),r[ds]=null}};function $o(i){this._internalRoot=i}$o.prototype.unstable_scheduleHydration=function(i){if(i){var r=sp();i={blockedOn:null,target:i,priority:r};for(var l=0;l<br.length&&r!==0&&r<br[l].priority;l++);br.splice(l,0,i),l===0&&Vg(i)}};var $g=t.version;if($g!=="19.2.3")throw Error(s(527,$g,"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:T,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zo.isDisabled&&Zo.supportsFiber)try{Ot=Zo.inject(_x),dt=Zo}catch{}}return ra.createRoot=function(i,r){if(!a(i))throw Error(s(299));var l=!1,u="",d=n_,m=r_,v=s_;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=Hg(i,1,!1,null,null,l,u,null,d,m,v,Gg),i[ds]=r.current,Th(i),new Vh(r)},ra.hydrateRoot=function(i,r,l){if(!a(i))throw Error(s(299));var u=!1,d="",m=n_,v=r_,w=s_,N=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&&(N=l.formState)),r=Hg(i,1,!0,r,l??null,u,d,N,m,v,w,Gg),r.context=Pg(null),l=r.current,u=zi(),u=Ou(u),d=sr(u),d.callback=null,lr(l,d,u),l=u,r.current.lanes=l,dl(r,l),dn(r),i[ds]=r.current,Th(i),new $o(r)},ra.version="19.2.3",ra}var lv;function Tx(){if(lv)return Gh.exports;lv=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(),Gh.exports=Ex(),Gh.exports}var Ax=Tx();const Dx=ku(Ax);function Rx({onLogin:e}){const[t,n]=V.useState(""),[s,a]=V.useState(null),[o,c]=V.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]=V.useState(""),[s,a]=V.useState(""),[o,c]=V.useState(null),[f,p]=V.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 av="http://localhost:7777";function ib({token:e}){const[t,n]=V.useState(null),[s,a]=V.useState(!1),[o,c]=V.useState(!1),[f,p]=V.useState(null),h=(x,k)=>fetch(x,{...k,headers:{...k==null?void 0:k.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),g=()=>{h(`${av}/api/wallet`).then(x=>x.json()).then(x=>n(x)).catch(()=>n({exists:!1,error:"Failed to load wallet"}))};V.useEffect(()=>{g()},[]);const _=async()=>{a(!0),p(null);try{const x=await h(`${av}/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]=V.useState(""),[a,o]=V.useState(""),[c,f]=V.useState(null),[p,h]=V.useState(!1),[g,_]=V.useState(!1),[b,y]=V.useState(null),[x,k]=V.useState("AI Writer"),[L,M]=V.useState(""),[$,I]=V.useState(""),[Z,W]=V.useState(!1),[O,te]=V.useState(null),[oe,me]=V.useState(""),[U,se]=V.useState(null),[K,B]=V.useState(!1),[A,R]=V.useState(null),[T,j]=V.useState(null),H=V.useCallback((C,Q)=>fetch(C,{...Q,headers:{...Q==null?void 0:Q.headers,Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}),[e]);V.useEffect(()=>{H("/api/settings/link-status").then(C=>C.json()).then(C=>y(C)).catch(()=>y({linked:!1}))},[]);const le=async()=>{if(!x.trim()){te("Agent name is required");return}if(!L.trim()){te("Description is required");return}W(!0),te(null);try{const C=await H("/api/settings/register-agent",{method:"POST",body:JSON.stringify({name:x,description:L,...$.trim()&&{genre:$}})}),Q=await C.json();if(!C.ok)throw new Error(Q.error||"Registration failed");y({linked:!0,agentId:Q.agentId,owsWallet:Q.owsWallet,txHash:Q.txHash})}catch(C){te(C instanceof Error?C.message:"Registration failed")}W(!1)},E=async()=>{if(!oe.trim()||!/^0x[a-fA-F0-9]{40}$/.test(oe)){R("Enter a valid wallet address (0x...)");return}B(!0),R(null),se(null);try{const C=await H("/api/settings/generate-binding",{method:"POST",body:JSON.stringify({humanWallet:oe})}),Q=await C.json();if(!C.ok)throw new Error(Q.error||"Failed to generate binding code");se(Q)}catch(C){R(C instanceof Error?C.message:"Failed to generate binding code")}B(!1)},D=async(C,Q)=>{await navigator.clipboard.writeText(C),j(Q),setTimeout(()=>j(null),2e3)},X=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 H("/api/auth/reset-passphrase",{method:"POST",body:JSON.stringify({passphrase:n})});if(!C.ok){const Q=await C.json();throw new Error(Q.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=>k(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=>M(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:le,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:oe,onChange:C=>me(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"}),A&&S.jsx("p",{className:"text-error text-xs",children:A}),S.jsx("button",{onClick:E,disabled:K||!oe.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:K?"Generating...":"Generate Binding Code"}),U&&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:U.signature}),S.jsx("button",{onClick:()=>D(U.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:T==="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:U.owsWallet}),S.jsx("button",{onClick:()=>D(U.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:T==="wallet"?"Copied!":"Copy"})]})]}),U.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:U.agentId}),S.jsx("button",{onClick:()=>D(String(U.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:T==="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(ib,{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:X,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]=V.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)};V.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]=V.useState([]),[p,h]=V.useState([]),[g,_]=V.useState(new Set),[b,y]=V.useState(!1),x=V.useCallback(async()=>{try{const W=await e("/api/stories");if(W.ok){const O=await W.json();f(O.stories)}}catch{}},[e]),k=V.useCallback(async()=>{try{const W=await e("/api/stories/archived");if(W.ok){const O=await W.json();h(O.stories)}}catch{}},[e]),L=V.useCallback(async W=>{try{(await e("/api/stories/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W})})).ok&&(k(),x())}catch{}},[e,k,x]);V.useEffect(()=>{x();const W=setInterval(x,5e3);return()=>clearInterval(W)},[x]),V.useEffect(()=>{b&&k()},[b,k]),V.useEffect(()=>{t&&_(W=>new Set(W).add(t))},[t]);const M=W=>{var te;const O=W.map(oe=>{var me;return{file:oe.file,num:(me=oe.file.match(/^plot-(\d+)\.md$/))==null?void 0:me[1]}}).filter(oe=>oe.num!=null).sort((oe,me)=>parseInt(me.num)-parseInt(oe.num));return O.length>0?O[0].file:W.some(oe=>oe.file==="genesis.md")?"genesis.md":W.some(oe=>oe.file==="structure.md")?"structure.md":((te=W[0])==null?void 0:te.file)??null},$=W=>{_(O=>{const te=new Set(O);return te.has(W)?te.delete(W):te.add(W),te})},I=W=>{if($(W.name),!g.has(W.name)){const O=M(W.files);O&&s(W.name,O)}},Z=W=>{const O=te=>{if(te==="structure.md")return 0;if(te==="genesis.md")return 1;const oe=te.match(/^plot-(\d+)\.md$/);return oe?2+parseInt(oe[1]):100};return[...W].sort((te,oe)=>O(te.file)-O(oe.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(W=>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:W.name,children:W.title||W.name}),S.jsx("button",{onClick:()=>L(W.name),className:"text-xs text-accent hover:text-accent-dim flex-shrink-0 ml-2",children:"Restore"})]},W.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(W=>S.jsx("div",{children:S.jsxs("button",{onClick:()=>s(W,""),className:`w-full px-3 py-2 text-left flex items-center gap-2 hover:bg-surface text-sm ${t===W?"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"})]})},W)),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(W=>W.name!=="_example").map(W=>S.jsxs("div",{children:[S.jsxs("button",{onClick:()=>I(W),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(W.name)?"▼":"▶"}),S.jsx("span",{className:"font-medium truncate",title:W.name,children:W.title||W.name}),S.jsxs("span",{className:"ml-auto text-xs text-muted",children:[W.publishedCount,"/",W.files.length]})]}),g.has(W.name)&&S.jsx("div",{className:"pl-4",children:Z(W.files).map(O=>{const te=t===W.name&&n===O.file;return S.jsxs("button",{onClick:()=>s(W.name,O.file),className:`w-full px-3 py-1.5 text-left flex items-center gap-2 text-xs hover:bg-surface ${te?"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)})})]},W.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
|
|
60
|
+
*/var nb=Object.defineProperty,Hx=Object.getOwnPropertyDescriptor,Px=(e,t)=>{for(var n in t)nb(e,n,{get:t[n],enumerable:!0})},vt=(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&&nb(t,n,a),a},pe=(e,t)=>(n,s)=>t(n,s,e),ov="Terminal input",Bf={get:()=>ov,set:e=>ov=e},uv="Too much output to announce, navigate to rows manually to read",Nf={get:()=>uv,set:e=>uv=e};function Ux(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");rb(a,t,n,s)}}function rb(e,t,n,s){e=Ux(e),e=Ix(e,n.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function sb(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 cv(e,t,n,s,a){sb(e,t,n),a&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Er(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Eu(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,M=L-x;for(;h<M;){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}},lb="",Ar=" ",Ma=class ab{constructor(){this.fg=0,this.bg=0,this.extended=new _u}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 ab;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}},_u=class ob{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 ob(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},tn=class ub extends Ma{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _u,this.combinedData=""}static fromCharData(t){let n=new ub;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?Er(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()]}},hv="di$target",Lf="di$dependencies",Jh=new Map;function Vx(e){return e[Lf]||[]}function Kt(e){if(Jh.has(e))return Jh.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,Jh.set(e,t),t}function Kx(e,t,n){t[hv]===t?t[Lf].push({id:e,index:n}):(t[Lf]=[{id:e,index:n}],t[hv]=t)}var mi=Kt("BufferService"),cb=Kt("CoreMouseService"),us=Kt("CoreService"),Xx=Kt("CharsetService"),Td=Kt("InstantiationService"),hb=Kt("LogService"),_i=Kt("OptionsService"),fb=Kt("OscLinkService"),Gx=Kt("UnicodeService"),Ba=Kt("DecorationService"),zf=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 tn,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):$x(k,L),hover:(k,L)=>{var M;return(M=a==null?void 0:a.hover)==null?void 0:M.call(a,k,L,y)},leave:(k,L)=>{var M;return(M=a==null?void 0:a.leave)==null?void 0:M.call(a,k,L,y)}})}h=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=_,f=o.extended.urlId):(p=-1,f=-1)}}t(s)}};zf=vt([pe(0,mi),pe(1,_i),pe(2,fb)],zf);function $x(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
|
|
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 Tu=Kt("CharSizeService"),Xn=Kt("CoreBrowserService"),Ad=Kt("MouseService"),Gn=Kt("RenderService"),Zx=Kt("SelectionService"),db=Kt("CharacterJoinerService"),ol=Kt("ThemeService"),pb=Kt("LinkProviderService"),Qx=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?fv.isErrorNoTelemetry(e)?new fv(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)}},Jx=new Qx;function su(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 Di(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 W=Z.length-1;W>=0;W--)yield Z[W]}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,W){let O=0;for(let te of Z)if(W(te,O++))return!0;return!1}e.some=g;function _(Z,W){for(let O of Z)if(W(O))return O}e.find=_;function*b(Z,W){for(let O of Z)W(O)&&(yield O)}e.filter=b;function*y(Z,W){let O=0;for(let te of Z)yield W(te,O++)}e.map=y;function*x(Z,W){let O=0;for(let te of Z)yield*W(te,O++)}e.flatMap=x;function*k(...Z){for(let W of Z)yield*W}e.concat=k;function L(Z,W,O){let te=O;for(let ue of Z)te=W(te,ue);return te}e.reduce=L;function*M(Z,W,O=Z.length){for(W<0&&(W+=Z.length),O<0?O+=Z.length:O>Z.length&&(O=Z.length);W<O;W++)yield Z[W]}e.slice=M;function G(Z,W=Number.POSITIVE_INFINITY){let O=[];if(W===0)return[O,Z];let te=Z[Symbol.iterator]();for(let ue=0;ue<W;ue++){let _e=te.next();if(_e.done)return[O,e.empty()];O.push(_e.value)}return[O,{[Symbol.iterator](){return te}}]}e.consume=G;async function I(Z){let W=[];for await(let O of Z)W.push(O);return Promise.resolve(W)}e.asyncToArray=I})(pb||(pb={}));function Jr(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 ct(()=>Jr(e))}function ct(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{Jr(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 wr=mb,Ne=class{constructor(){this._store=new wr,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)}};Ne.None=Object.freeze({dispose(){}});var Qs=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}},Hn=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 ht=Of,hv=class{constructor(){this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ht.Undefined}clear(){let e=this._first;for(;e!==ht.Undefined;){let t=e.next;e.prev=ht.Undefined,e.next=ht.Undefined,e=t}this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ht(e);if(this._first===ht.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!==ht.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ht.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ht.Undefined&&e.next!==ht.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ht.Undefined&&e.next===ht.Undefined?(this._first=ht.Undefined,this._last=ht.Undefined):e.next===ht.Undefined?(this._last=this._last.prev,this._last.next=ht.Undefined):e.prev===ht.Undefined&&(this._first=this._first.next,this._first.prev=ht.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ht.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}},ei;(e=>{e.None=()=>Ne.None;function t(V,B){return _(V,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function n(V){return(B,A=null,R)=>{let T=!1,j;return j=V(H=>{if(!T)return j?j.dispose():T=!0,B.call(A,H)},null,R),T&&j.dispose(),j}}e.once=n;function s(V,B,A){return h((R,T=null,j)=>V(H=>R.call(T,B(H)),null,j),A)}e.map=s;function a(V,B,A){return h((R,T=null,j)=>V(H=>{B(H),R.call(T,H)},null,j),A)}e.forEach=a;function o(V,B,A){return h((R,T=null,j)=>V(H=>B(H)&&R.call(T,H),null,j),A)}e.filter=o;function c(V){return V}e.signal=c;function f(...V){return(B,A=null,R)=>{let T=sw(...V.map(j=>j(H=>B.call(A,H))));return g(T,R)}}e.any=f;function p(V,B,A,R){let T=A;return s(V,j=>(T=B(T,j),T),R)}e.reduce=p;function h(V,B){let A,R={onWillAddFirstListener(){A=V(T.fire,T)},onDidRemoveLastListener(){A==null||A.dispose()}},T=new he(R);return B==null||B.add(T),T.event}function g(V,B){return B instanceof Array?B.push(V):B&&B.add(V),V}function _(V,B,A=100,R=!1,T=!1,j,H){let ae,E,D,K=0,C,Q={leakWarningThreshold:j,onWillAddFirstListener(){ae=V(de=>{K++,E=B(E,de),R&&!D&&(fe.fire(E),E=void 0),C=()=>{let Ce=E;E=void 0,D=void 0,(!R||K>1)&&fe.fire(Ce),K=0},typeof A=="number"?(clearTimeout(D),D=setTimeout(C,A)):D===void 0&&(D=0,queueMicrotask(C))})},onWillRemoveListener(){T&&K>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,ae.dispose()}},fe=new he(Q);return H==null||H.add(fe),fe.event}e.debounce=_;function b(V,B=0,A){return e.debounce(V,(R,T)=>R?(R.push(T),R):[T],B,void 0,!0,void 0,A)}e.accumulate=b;function y(V,B=(R,T)=>R===T,A){let R=!0,T;return o(V,j=>{let H=R||!B(j,T);return R=!1,T=j,H},A)}e.latch=y;function x(V,B,A){return[e.filter(V,B,A),e.filter(V,R=>!B(R),A)]}e.split=x;function k(V,B=!1,A=[],R){let T=A.slice(),j=V(E=>{T?T.push(E):ae.fire(E)});R&&R.add(j);let H=()=>{T==null||T.forEach(E=>ae.fire(E)),T=null},ae=new he({onWillAddFirstListener(){j||(j=V(E=>ae.fire(E)),R&&R.add(j))},onDidAddFirstListener(){T&&(B?setTimeout(H):H())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return R&&R.add(ae),ae.event}e.buffer=k;function L(V,B){return(A,R,T)=>{let j=B(new G);return V(function(H){let ae=j.evaluate(H);ae!==M&&A.call(R,ae)},void 0,T)}}e.chain=L;let M=Symbol("HaltChainable");class G{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(A=>(B(A),A)),this}filter(B){return this.steps.push(A=>B(A)?A:M),this}reduce(B,A){let R=A;return this.steps.push(T=>(R=B(R,T),R)),this}latch(B=(A,R)=>A===R){let A=!0,R;return this.steps.push(T=>{let j=A||!B(T,R);return A=!1,R=T,j?T:M}),this}evaluate(B){for(let A of this.steps)if(B=A(B),B===M)break;return B}}function I(V,B,A=R=>R){let R=(...ae)=>H.fire(A(...ae)),T=()=>V.on(B,R),j=()=>V.removeListener(B,R),H=new he({onWillAddFirstListener:T,onDidRemoveLastListener:j});return H.event}e.fromNodeEventEmitter=I;function Z(V,B,A=R=>R){let R=(...ae)=>H.fire(A(...ae)),T=()=>V.addEventListener(B,R),j=()=>V.removeEventListener(B,R),H=new he({onWillAddFirstListener:T,onDidRemoveLastListener:j});return H.event}e.fromDOMEventEmitter=Z;function W(V){return new Promise(B=>n(V)(B))}e.toPromise=W;function O(V){let B=new he;return V.then(A=>{B.fire(A)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=O;function te(V,B){return V(A=>B.fire(A))}e.forward=te;function ue(V,B,A){return B(A),V(R=>B(R))}e.runAndSubscribe=ue;class _e{constructor(B,A){this._observable=B,this._counter=0,this._hasChanged=!1;let R={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new he(R),A&&A.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,A){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function U(V,B){return new _e(V,B).emitter.event}e.fromObservable=U;function se(V){return(B,A,R)=>{let T=0,j=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(V.reportChanges(),j&&(j=!1,B.call(A)))},handlePossibleChange(){},handleChange(){j=!0}};V.addObserver(H),V.reportChanges();let ae={dispose(){V.removeObserver(H)}};return R instanceof wr?R.add(ae):Array.isArray(R)&&R.push(ae),ae}}e.fromObservableLight=se})(ei||(ei={}));var Hf=class Pf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Pf._idPool++}`,Pf.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(`
|
|
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 ou(e){ew(e)||Jx.onUnexpectedError(e)}var Of="Canceled";function ew(e){return e instanceof tw?!0:e instanceof Error&&e.name===Of&&e.message===Of}var tw=class extends Error{constructor(){super(Of),this.name=this.message}};function iw(e){return new Error(`Illegal argument: ${e}`)}var fv=class jf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof jf)return t;let n=new jf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Hf=class mb extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,mb.prototype)}};function Oi(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 _b;(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 W=Z.length-1;W>=0;W--)yield Z[W]}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,W){let O=0;for(let te of Z)if(W(te,O++))return!0;return!1}e.some=g;function _(Z,W){for(let O of Z)if(W(O))return O}e.find=_;function*b(Z,W){for(let O of Z)W(O)&&(yield O)}e.filter=b;function*y(Z,W){let O=0;for(let te of Z)yield W(te,O++)}e.map=y;function*x(Z,W){let O=0;for(let te of Z)yield*W(te,O++)}e.flatMap=x;function*k(...Z){for(let W of Z)yield*W}e.concat=k;function L(Z,W,O){let te=O;for(let oe of Z)te=W(te,oe);return te}e.reduce=L;function*M(Z,W,O=Z.length){for(W<0&&(W+=Z.length),O<0?O+=Z.length:O>Z.length&&(O=Z.length);W<O;W++)yield Z[W]}e.slice=M;function $(Z,W=Number.POSITIVE_INFINITY){let O=[];if(W===0)return[O,Z];let te=Z[Symbol.iterator]();for(let oe=0;oe<W;oe++){let me=te.next();if(me.done)return[O,e.empty()];O.push(me.value)}return[O,{[Symbol.iterator](){return te}}]}e.consume=$;async function I(Z){let W=[];for await(let O of Z)W.push(O);return Promise.resolve(W)}e.asyncToArray=I})(_b||(_b={}));function ls(e){if(_b.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 ct(()=>ls(e))}function ct(e){return{dispose:rw(()=>{e()})}}var gb=class vb{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{ls(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?vb.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)}};gb.DISABLE_DISPOSED_WARNING=!1;var Dr=gb,Le=class{constructor(){this._store=new Dr,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)}};Le.None=Object.freeze({dispose(){}});var ll=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}},Kn=typeof window=="object"?window:globalThis,Pf=class Uf{constructor(t){this.element=t,this.next=Uf.Undefined,this.prev=Uf.Undefined}};Pf.Undefined=new Pf(void 0);var ht=Pf,dv=class{constructor(){this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ht.Undefined}clear(){let e=this._first;for(;e!==ht.Undefined;){let t=e.next;e.prev=ht.Undefined,e.next=ht.Undefined,e=t}this._first=ht.Undefined,this._last=ht.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new ht(e);if(this._first===ht.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!==ht.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ht.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ht.Undefined&&e.next!==ht.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ht.Undefined&&e.next===ht.Undefined?(this._first=ht.Undefined,this._last=ht.Undefined):e.next===ht.Undefined?(this._last=this._last.prev,this._last.next=ht.Undefined):e.prev===ht.Undefined&&(this._first=this._first.next,this._first.prev=ht.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ht.Undefined;)yield e.element,e=e.next}},lw=globalThis.performance&&typeof globalThis.performance.now=="function",aw=class yb{static create(t){return new yb(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}},ii;(e=>{e.None=()=>Le.None;function t(K,B){return _(K,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function n(K){return(B,A=null,R)=>{let T=!1,j;return j=K(H=>{if(!T)return j?j.dispose():T=!0,B.call(A,H)},null,R),T&&j.dispose(),j}}e.once=n;function s(K,B,A){return h((R,T=null,j)=>K(H=>R.call(T,B(H)),null,j),A)}e.map=s;function a(K,B,A){return h((R,T=null,j)=>K(H=>{B(H),R.call(T,H)},null,j),A)}e.forEach=a;function o(K,B,A){return h((R,T=null,j)=>K(H=>B(H)&&R.call(T,H),null,j),A)}e.filter=o;function c(K){return K}e.signal=c;function f(...K){return(B,A=null,R)=>{let T=sw(...K.map(j=>j(H=>B.call(A,H))));return g(T,R)}}e.any=f;function p(K,B,A,R){let T=A;return s(K,j=>(T=B(T,j),T),R)}e.reduce=p;function h(K,B){let A,R={onWillAddFirstListener(){A=K(T.fire,T)},onDidRemoveLastListener(){A==null||A.dispose()}},T=new he(R);return B==null||B.add(T),T.event}function g(K,B){return B instanceof Array?B.push(K):B&&B.add(K),K}function _(K,B,A=100,R=!1,T=!1,j,H){let le,E,D,X=0,C,Q={leakWarningThreshold:j,onWillAddFirstListener(){le=K(de=>{X++,E=B(E,de),R&&!D&&(fe.fire(E),E=void 0),C=()=>{let Ce=E;E=void 0,D=void 0,(!R||X>1)&&fe.fire(Ce),X=0},typeof A=="number"?(clearTimeout(D),D=setTimeout(C,A)):D===void 0&&(D=0,queueMicrotask(C))})},onWillRemoveListener(){T&&X>0&&(C==null||C())},onDidRemoveLastListener(){C=void 0,le.dispose()}},fe=new he(Q);return H==null||H.add(fe),fe.event}e.debounce=_;function b(K,B=0,A){return e.debounce(K,(R,T)=>R?(R.push(T),R):[T],B,void 0,!0,void 0,A)}e.accumulate=b;function y(K,B=(R,T)=>R===T,A){let R=!0,T;return o(K,j=>{let H=R||!B(j,T);return R=!1,T=j,H},A)}e.latch=y;function x(K,B,A){return[e.filter(K,B,A),e.filter(K,R=>!B(R),A)]}e.split=x;function k(K,B=!1,A=[],R){let T=A.slice(),j=K(E=>{T?T.push(E):le.fire(E)});R&&R.add(j);let H=()=>{T==null||T.forEach(E=>le.fire(E)),T=null},le=new he({onWillAddFirstListener(){j||(j=K(E=>le.fire(E)),R&&R.add(j))},onDidAddFirstListener(){T&&(B?setTimeout(H):H())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return R&&R.add(le),le.event}e.buffer=k;function L(K,B){return(A,R,T)=>{let j=B(new $);return K(function(H){let le=j.evaluate(H);le!==M&&A.call(R,le)},void 0,T)}}e.chain=L;let M=Symbol("HaltChainable");class ${constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(A=>(B(A),A)),this}filter(B){return this.steps.push(A=>B(A)?A:M),this}reduce(B,A){let R=A;return this.steps.push(T=>(R=B(R,T),R)),this}latch(B=(A,R)=>A===R){let A=!0,R;return this.steps.push(T=>{let j=A||!B(T,R);return A=!1,R=T,j?T:M}),this}evaluate(B){for(let A of this.steps)if(B=A(B),B===M)break;return B}}function I(K,B,A=R=>R){let R=(...le)=>H.fire(A(...le)),T=()=>K.on(B,R),j=()=>K.removeListener(B,R),H=new he({onWillAddFirstListener:T,onDidRemoveLastListener:j});return H.event}e.fromNodeEventEmitter=I;function Z(K,B,A=R=>R){let R=(...le)=>H.fire(A(...le)),T=()=>K.addEventListener(B,R),j=()=>K.removeEventListener(B,R),H=new he({onWillAddFirstListener:T,onDidRemoveLastListener:j});return H.event}e.fromDOMEventEmitter=Z;function W(K){return new Promise(B=>n(K)(B))}e.toPromise=W;function O(K){let B=new he;return K.then(A=>{B.fire(A)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=O;function te(K,B){return K(A=>B.fire(A))}e.forward=te;function oe(K,B,A){return B(A),K(R=>B(R))}e.runAndSubscribe=oe;class me{constructor(B,A){this._observable=B,this._counter=0,this._hasChanged=!1;let R={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new he(R),A&&A.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,A){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function U(K,B){return new me(K,B).emitter.event}e.fromObservable=U;function se(K){return(B,A,R)=>{let T=0,j=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(K.reportChanges(),j&&(j=!1,B.call(A)))},handlePossibleChange(){},handleChange(){j=!0}};K.addObserver(H),K.reportChanges();let le={dispose(){K.removeObserver(H)}};return R instanceof Dr?R.add(le):Array.isArray(R)&&R.push(le),le}}e.fromObservableLight=se})(ii||(ii={}));var If=class Ff{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ff._idPool++}`,Ff.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}}};If.all=new Set,If._idPool=0;var ow=If,uw=-1,bb=class Sb{constructor(t,n,s=(Sb._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}};bb._idPool=1;var cw=bb,hw=class xb{constructor(t){this.value=t}static create(){let t=new Error;return new xb(t.stack??"")}print(){console.warn(this.value.split(`
|
|
67
67
|
`).slice(2).join(`
|
|
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,Zh=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)??su,((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)||su)(x),Ne.None}if(this._disposed)return Ne.None;n&&(t=t.bind(n));let a=new Zh(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 Zh?(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=ct(()=>{o==null||o(),this._removeListener(a)});return s instanceof wr?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)||su;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 Zh)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}},Uf=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}};Uf.INSTANCE=new Uf;var Ed=Uf;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 tl=typeof navigator=="object"?navigator.userAgent:"",If=tl.indexOf("Firefox")>=0,bw=tl.indexOf("AppleWebKit")>=0,Td=tl.indexOf("Chrome")>=0,Sw=!Td&&tl.indexOf("Safari")>=0;tl.indexOf("Electron/")>=0;tl.indexOf("Android")>=0;var Qh=!1;if(typeof Hn.matchMedia=="function"){let e=Hn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Hn.matchMedia("(display-mode: fullscreen)");Qh=e.matches,vw(Hn,e,({matches:n})=>{Qh&&t.matches||(Qh=n)})}var Gs="en",Ff=!1,qf=!1,lu=!1,Sb=!1,$o,au=Gs,fv=Gs,xw,Ji,Qr=globalThis,Jt,Zy;typeof Qr.vscode<"u"&&typeof Qr.vscode.process<"u"?Jt=Qr.vscode.process:typeof process<"u"&&typeof((Zy=process==null?void 0:process.versions)==null?void 0:Zy.node)=="string"&&(Jt=process);var Qy,ww=typeof((Qy=Jt==null?void 0:Jt.versions)==null?void 0:Qy.electron)=="string",Cw=ww&&(Jt==null?void 0:Jt.type)==="renderer",Jy;if(typeof Jt=="object"){Ff=Jt.platform==="win32",qf=Jt.platform==="darwin",lu=Jt.platform==="linux",lu&&Jt.env.SNAP&&Jt.env.SNAP_REVISION,Jt.env.CI||Jt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,$o=Gs,au=Gs;let e=Jt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);$o=t.userLocale,fv=t.osLocale,au=t.resolvedLanguage||Gs,xw=(Jy=t.languagePack)==null?void 0:Jy.translationsConfigFile}catch{}Sb=!0}else typeof navigator=="object"&&!Cw?(Ji=navigator.userAgent,Ff=Ji.indexOf("Windows")>=0,qf=Ji.indexOf("Macintosh")>=0,(Ji.indexOf("Macintosh")>=0||Ji.indexOf("iPad")>=0||Ji.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,lu=Ji.indexOf("Linux")>=0,(Ji==null?void 0:Ji.indexOf("Mobi"))>=0,au=globalThis._VSCODE_NLS_LANGUAGE||Gs,$o=navigator.language.toLowerCase(),fv=$o):console.error("Unable to resolve platform.");var xb=Ff,hn=qf,kw=lu,dv=Sb,fn=Ji,_r=au,Ew;(e=>{function t(){return _r}e.value=t;function n(){return _r.length===2?_r==="en":_r.length>=3?_r[0]==="e"&&_r[1]==="n"&&_r[2]==="-":!1}e.isDefaultVariant=n;function s(){return _r==="en"}e.isDefault=s})(Ew||(Ew={}));var Tw=typeof Qr.postMessage=="function"&&!Qr.importScripts;(()=>{if(Tw){let e=[];Qr.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}),Qr.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Aw=!!(fn&&fn.indexOf("Chrome")>=0);fn&&fn.indexOf("Firefox")>=0;!Aw&&fn&&fn.indexOf("Safari")>=0;fn&&fn.indexOf("Edg/")>=0;fn&&fn.indexOf("Android")>=0;var qs=typeof navigator=="object"?navigator:{};dv||document.queryCommandSupported&&document.queryCommandSupported("copy")||qs&&qs.clipboard&&qs.clipboard.writeText,dv||qs&&qs.clipboard&&qs.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}},Jh=new Ad,pv=new Ad,mv=new Ad,Dw=new Array(230),wb;(e=>{function t(f){return Jh.keyCodeToStr(f)}e.toString=t;function n(f){return Jh.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 Jh.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(hn)return 57;break}else if(bw&&(hn&&t===93||!hn&&t===92))return 57;return Dw[t]||0}var Nw=hn?256:2048,Lw=512,zw=1024,Ow=hn?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}}},Go=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&&!hn?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&&!hn?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)}}}),Pw;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Uw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:kb})})(Pw||(Pw={}));var Uw=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=ct(()=>{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 Yi{static fromArray(t){return new Yi(n=>{n.emitMany(t)})}static fromPromise(t){return new Yi(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Yi(async n=>{await Promise.all(t.map(async s=>n.emitOne(await s)))})}static merge(t){return new Yi(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 ei.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 Yi(async s=>{for await(let a of t)s.emitOne(n(a))})}map(t){return Yi.map(this,t)}static filter(t,n){return new Yi(async s=>{for await(let a of t)n(a)&&s.emitOne(a)})}filter(t){return Yi.filter(this,t)}static coalesce(t){return Yi.filter(t,n=>!!n)}coalesce(){return Yi.coalesce(this)}static async toPromise(t){let n=[];for await(let s of t)n.push(s);return n}toPromise(){return Yi.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:cn,getWindowId:qw,onDidRegisterWindow:Ww}=(function(){let e=new Map,t={window:Hn,disposables:new wr};e.set(Hn.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 Ne.None;let f=new wr,p={window:c,disposables:f.add(new wr)};return e.set(c.vscodeWindowId,p),f.add(ct(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(ke(c,Ht.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:Hn},getDocument(c){return cn(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 ke(e,t,n,s){return new Yw(e,t,n,s)}var bv=function(e,t,n,s){return ke(e,t,n,s)},Rd,Vw=class extends Iw{constructor(e){super(),this.defaultTarget=e&&cn(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){su(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=cn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ht={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=yi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yi(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=yi(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=yi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yi(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 yi(e){return typeof e=="number"?`${e}px`:e}function da(e){return new Xw(e)}var Eb=class{constructor(){this._hooks=new wr,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(ct(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=cn(e)}this._hooks.add(ke(o,Ht.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(ke(o,Ht.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 on;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(on||(on={}));var oa=class ii extends Ne{constructor(){super(),this.dispatched=!1,this.targets=new hv,this.ignoreTargets=new hv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ei.runAndSubscribe(Ww,({window:t,disposables:n})=>{n.add(ke(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(ke(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(ke(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Hn,disposables:this._store}))}static addTarget(t){if(!ii.isTouchDevice())return Ne.None;ii.INSTANCE||(ii.INSTANCE=new ii);let n=ii.INSTANCE.targets.push(t);return ct(n)}static ignoreTarget(t){if(!ii.isTouchDevice())return Ne.None;ii.INSTANCE||(ii.INSTANCE=new ii);let n=ii.INSTANCE.ignoreTargets.push(t);return ct(n)}static isTouchDevice(){return"ontouchstart"in Hn||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(on.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<ii.HOLD_DELAY&&Math.abs(p.initialPageX-Di(p.rollingPageX))<30&&Math.abs(p.initialPageY-Di(p.rollingPageY))<30){let g=this.newGestureEvent(on.Tap,p.initialTarget);g.pageX=Di(p.rollingPageX),g.pageY=Di(p.rollingPageY),this.dispatchEvent(g)}else if(h>=ii.HOLD_DELAY&&Math.abs(p.initialPageX-Di(p.rollingPageX))<30&&Math.abs(p.initialPageY-Di(p.rollingPageY))<30){let g=this.newGestureEvent(on.Contextmenu,p.initialTarget);g.pageX=Di(p.rollingPageX),g.pageY=Di(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Di(p.rollingPageX),_=Di(p.rollingPageY),b=Di(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(on.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===on.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>ii.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===on.Change||t.type===on.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+=ii.SCROLL_FRICTION*_,f+=ii.SCROLL_FRICTION*_,a>0&&(x=!1,b=o*a*_),f>0&&(x=!1,y=p*f*_);let k=this.newGestureEvent(on.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(on.Change,c.initialTarget);f.translationX=o.pageX-Di(c.rollingPageX),f.translationY=o.pageY-Di(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)}};oa.SCROLL_FRICTION=-.005,oa.HOLD_DELAY=700,oa.CLEAR_TAP_COUNT_TIME=400,gt([$w],oa,"isTouchDevice",1);var Gw=oa,Md=class extends Ne{onclick(e,t){this._register(ke(e,Ht.CLICK,n=>t(new Go(cn(e),n))))}onmousedown(e,t){this._register(ke(e,Ht.MOUSE_DOWN,n=>t(new Go(cn(e),n))))}onmouseover(e,t){this._register(ke(e,Ht.MOUSE_OVER,n=>t(new Go(cn(e),n))))}onmouseleave(e,t){this._register(ke(e,Ht.MOUSE_LEAVE,n=>t(new Go(cn(e),n))))}onkeydown(e,t){this._register(ke(e,Ht.KEY_DOWN,n=>t(new _v(n))))}onkeyup(e,t){this._register(ke(e,Ht.KEY_UP,n=>t(new _v(n))))}oninput(e,t){this._register(ke(e,Ht.INPUT,t))}onblur(e,t){this._register(ke(e,Ht.BLUR,t))}onfocus(e,t){this._register(ke(e,Ht.FOCUS,t))}onchange(e,t){this._register(ke(e,Ht.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,Ht.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(bv(this.domNode,Ht.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,cn(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 Ne{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 ef(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(ef(t,a),ef(o,n),.33)}return ef(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 Ne{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=da(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(ke(this.domNode.domNode,Ht.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=da(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(ke(this.slider.domNode,Ht.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=cn(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=da(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=da(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=da(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=Jr(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,hn&&(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=Jr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new vv(n))};this._mouseWheelToDispose.push(ke(this._listenOnDomNode,Ht.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=!hn&&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,hn&&(t.className+=" mac"),t}var Xf=class extends Ne{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(ei.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ct(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ct(()=>this._styleElement.remove())),this._register(ei.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=gt([pe(2,ci),pe(3,Pn),pe(4,ob),pe(5,el),pe(6,hi),pe(7,Un)],Xf);var $f=class extends Ne{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(ct(()=>{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=gt([pe(1,ci),pe(2,Pn),pe(3,Ca),pe(4,Un)],$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)}},ln={full:0,left:0,center:0,right:0},gr={full:0,left:0,center:0,right:0},Zl={full:0,left:0,center:0,right:0},pu=class extends Ne{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(ct(()=>{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);gr.full=this._canvas.width,gr.left=e,gr.center=t,gr.right=e,this._refreshDrawHeightConstants(),Zl.full=1,Zl.left=1,Zl.center=1+gr.left,Zl.right=1+gr.left+gr.center}_refreshDrawHeightConstants(){ln.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);ln.left=t,ln.center=t,ln.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ln.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ln.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ln.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ln.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(Zl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ln[e.position||"full"]/2),gr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ln[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}))}};pu=gt([pe(2,ci),pe(3,Ca),pe(4,Un),pe(5,hi),pe(6,el),pe(7,Pn)],pu);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 ou;(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=""))(ou||(ou={}));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=gt([pe(2,ci),pe(3,hi),pe(4,is),pe(5,Un)],Gf);var Pt=0,Ut=0,It=0,mt=0,Ev={css:"#00000000",rgba:0},Dt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Yr(a)}${Yr(o)}${Yr(c)}${Yr(f)}`:`#${Yr(a)}${Yr(o)}${Yr(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})(Dt||(Dt={}));var ot;(e=>{function t(p,h){if(mt=(h.rgba&255)/255,mt===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;Pt=y+Math.round((g-y)*mt),Ut=x+Math.round((_-x)*mt),It=k+Math.round((b-k)*mt);let L=Dt.toCss(Pt,Ut,It),M=Dt.toRgba(Pt,Ut,It);return{css:L,rgba:M}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=uu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return Dt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Pt,Ut,It]=uu.toChannels(h),{css:Dt.toCss(Pt,Ut,It),rgba:h}}e.opaque=a;function o(p,h){return mt=Math.round(h*255),[Pt,Ut,It]=uu.toChannels(p.rgba),{css:Dt.toCss(Pt,Ut,It,mt),rgba:Dt.toRgba(Pt,Ut,It,mt)}}e.opacity=o;function c(p,h){return mt=p.rgba&255,o(p,mt*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(ot||(ot={}));var ft;(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 Pt=parseInt(a.slice(1,2).repeat(2),16),Ut=parseInt(a.slice(2,3).repeat(2),16),It=parseInt(a.slice(3,4).repeat(2),16),Dt.toColor(Pt,Ut,It);case 5:return Pt=parseInt(a.slice(1,2).repeat(2),16),Ut=parseInt(a.slice(2,3).repeat(2),16),It=parseInt(a.slice(3,4).repeat(2),16),mt=parseInt(a.slice(4,5).repeat(2),16),Dt.toColor(Pt,Ut,It,mt);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 Pt=parseInt(o[1]),Ut=parseInt(o[2]),It=parseInt(o[3]),mt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Dt.toColor(Pt,Ut,It,mt);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),[Pt,Ut,It,mt]=t.getImageData(0,0,1,1).data,mt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Dt.toRgba(Pt,Ut,It,mt),css:a}}e.toColor=s})(ft||(ft={}));var ai;(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})(ai||(ai={}));var uu;(e=>{function t(c,f){if(mt=(f&255)/255,mt===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 Pt=_+Math.round((p-_)*mt),Ut=b+Math.round((h-b)*mt),It=y+Math.round((g-y)*mt),Dt.toRgba(Pt,Ut,It)}e.blend=t;function n(c,f,p){let h=ai.relativeLuminance(c>>8),g=ai.relativeLuminance(f>>8);if(zn(h,g)<p){if(g<h){let y=s(c,f,p),x=zn(h,ai.relativeLuminance(y>>8));if(x<p){let k=a(c,f,p),L=zn(h,ai.relativeLuminance(k>>8));return x>L?y:k}return y}let _=a(c,f,p),b=zn(h,ai.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=zn(h,ai.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=zn(ai.relativeLuminance2(b,y,x),ai.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=zn(ai.relativeLuminance2(b,y,x),ai.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=zn(ai.relativeLuminance2(b,y,x),ai.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=zn(ai.relativeLuminance2(b,y,x),ai.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})(uu||(uu={}));function Yr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function zn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var pC=class extends wa{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()]}},mu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Xi}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||xr.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++)mu._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||xr.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}};mu=gt([pe(0,ci)],mu);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:Zo(),cell:Zo()},device:{canvas:Zo(),cell:Zo(),char:{width:0,height:0,left:0,top:0}}}}function Zo(){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 Xi,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,M="",G=0,I=0,Z=0,W=0,O=!1,te=0,ue=!1,_e=0,U=0,se=[],V=h!==-1&&g!==-1;for(let B=0;B<x;B++){e.loadCell(B,this._workCell);let A=this._workCell.getWidth();if(A===0)continue;let R=!1,T=B>=U,j=B,H=this._workCell;if(b.length>0&&B===b[0][0]&&T){let xe=b.shift(),Vt=this._isCellInSelection(xe[0],t);for(G=xe[0]+1;G<xe[1];G++)T&&(T=Vt===this._isCellInSelection(G,t));T&&(T=!n||o<xe[0]||o>=xe[1]),T?(R=!0,H=new pC(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),j=xe[1]-1,A=H.getWidth()):U=xe[1]}let ae=this._isCellInSelection(B,t),E=n&&B===o,D=V&&B>=h&&B<=g,K=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,xe=>{K=!0});let C=H.getChars()||xr;if(C===" "&&(H.isUnderline()||H.isOverline())&&(C=" "),_e=A*f-p.get(C,H.isBold(),H.isItalic()),!k)k=this._document.createElement("span");else if(L&&(ae&&ue||!ae&&!ue&&H.bg===I)&&(ae&&ue&&y.selectionForeground||H.fg===Z)&&H.extended.ext===W&&D===O&&_e===te&&!E&&!R&&!K&&T){H.isInvisible()?M+=xr:M+=C,L++;continue}else L&&(k.textContent=M),k=this._document.createElement("span"),L=0,M="";if(I=H.bg,Z=H.fg,W=H.extended.ext,O=D,te=_e,ue=ae,R&&o>=B&&o<=j&&(o=B),!this._coreService.isCursorHidden&&E&&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(H.isBold()&&se.push("xterm-bold"),H.isItalic()&&se.push("xterm-italic"),H.isDim()&&se.push("xterm-dim"),H.isInvisible()?M=xr:M=H.getChars()||xr,H.isUnderline()&&(se.push(`xterm-underline-${H.extended.underlineStyle}`),M===" "&&(M=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${wa.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let xe=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&xe<8&&(xe+=8),k.style.textDecorationColor=y.ansi[xe].css}H.isOverline()&&(se.push("xterm-overline"),M===" "&&(M=" ")),H.isStrikethrough()&&se.push("xterm-strikethrough"),D&&(k.style.textDecoration="underline");let Q=H.getFgColor(),fe=H.getFgColorMode(),de=H.getBgColor(),Ce=H.getBgColorMode(),Le=!!H.isInverse();if(Le){let xe=Q;Q=de,de=xe;let Vt=fe;fe=Ce,Ce=Vt}let Ee,st,Ye=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,xe=>{xe.options.layer!=="top"&&Ye||(xe.backgroundColorRGB&&(Ce=50331648,de=xe.backgroundColorRGB.rgba>>8&16777215,Ee=xe.backgroundColorRGB),xe.foregroundColorRGB&&(fe=50331648,Q=xe.foregroundColorRGB.rgba>>8&16777215,st=xe.foregroundColorRGB),Ye=xe.options.layer==="top")}),!Ye&&ae&&(Ee=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,de=Ee.rgba>>8&16777215,Ce=50331648,Ye=!0,y.selectionForeground&&(fe=50331648,Q=y.selectionForeground.rgba>>8&16777215,st=y.selectionForeground)),Ye&&se.push("xterm-decoration-top");let xt;switch(Ce){case 16777216:case 33554432:xt=y.ansi[de],se.push(`xterm-bg-${de}`);break;case 50331648:xt=Dt.toColor(de>>16,de>>8&255,de&255),this._addStyle(k,`background-color:#${Tv((de>>>0).toString(16),"0",6)}`);break;case 0:default:Le?(xt=y.foreground,se.push("xterm-bg-257")):xt=y.background}switch(Ee||H.isDim()&&(Ee=ot.multiplyOpacity(xt,.5)),fe){case 16777216:case 33554432:H.isBold()&&Q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Q+=8),this._applyMinimumContrast(k,xt,y.ansi[Q],H,Ee,void 0)||se.push(`xterm-fg-${Q}`);break;case 50331648:let xe=Dt.toColor(Q>>16&255,Q>>8&255,Q&255);this._applyMinimumContrast(k,xt,xe,H,Ee,st)||this._addStyle(k,`color:#${Tv(Q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,xt,y.foreground,H,Ee,st)||Le&&se.push("xterm-fg-257")}se.length&&(k.className=se.join(" "),se.length=0),!E&&!R&&!K&&T?L++:k.textContent=M,_e!==this.defaultSpacing&&(k.style.letterSpacing=`${_e}px`),_.push(k),B=j}return k&&L&&(k.textContent=M),_}_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=ot.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=gt([pe(1,hb),pe(2,hi),pe(3,Pn),pe(4,is),pe(5,Ca),pe(6,el)],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 tf="xterm-dom-renderer-owner-",Wi="xterm-rows",Qo="xterm-fg-",Av="xterm-bg-",Ql="xterm-focus",Jo="xterm-selection",xC=1,Qf=class extends Ne{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(Wi),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(Jo),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(tf+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(ct(()=>{this._element.classList.remove(tf+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} .${Wi} 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} .${Wi} { 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} .${Wi} .xterm-dim { color: ${ot.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} .${Wi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Wi}.${Ql} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Wi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Jo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Jo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Jo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${Qo}${o} { color: ${c.css}; }${this._terminalSelector} .${Qo}${o}.xterm-dim { color: ${ot.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Av}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${Qo}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${Qo}257.xterm-dim { color: ${ot.multiplyOpacity(ot.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(Ql),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ql),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`.${tf}${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=gt([pe(7,Cd),pe(8,Cu),pe(9,hi),pe(10,ci),pe(11,is),pe(12,Pn),pe(13,el)],Qf);var Jf=class extends Ne{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=gt([pe(2,hi)],Jf);var Rb=class extends Ne{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 Ne{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(ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ke(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ke(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 Ne{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Qs),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(ct(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ke(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 Ne{constructor(){super(),this.linkProviders=[],this._register(ct(()=>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=gt([pe(0,Un),pe(1,Cu)],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={};Px(Mb,{getSafariVersion:()=>MC,isChromeOS:()=>zb,isFirefox:()=>Bb,isIpad:()=>BC,isIphone:()=>NC,isLegacyEdge:()=>RC,isLinux:()=>Nd,isMac:()=>_u,isNode:()=>ku,isSafari:()=>Nb,isWindows:()=>Lb});var ku=typeof process<"u"&&"title"in process,ka=ku?"node":navigator.userAgent,Ea=ku?"node":navigator.platform,Bb=ka.includes("Firefox"),RC=ka.includes("Edge"),Nb=/^((?!chrome|android).)*safari/i.test(ka);function MC(){if(!Nb)return 0;let e=ka.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var _u=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ea),BC=Ea==="iPad",NC=Ea==="iPhone",Lb=["Windows","Win16","Win32","WinCE"].includes(Ea),Nd=Ea.indexOf("Linux")>=0,zb=/\bCrOS\b/.test(ka),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)}},gu=!ku&&"requestIdleCallback"in window?zC:LC,OC=class{constructor(){this._queue=new gu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},td=class extends Ne{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 Qs),this._pausedResizeTask=new OC,this._observerDisposable=this._register(new Qs),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(ct(()=>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=ct(()=>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=gt([pe(2,hi),pe(3,Cu),pe(4,is),pe(5,Ca),pe(6,ci),pe(7,Pn),pe(8,el)],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)+Eu(o,t,n,s)+FC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",va(Math.abs(a-e),ga(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=UC(o>t?e:a,n)+(f-1)*n.cols+1+PC(o>t?a:e);return va(p,ga(c,s))}function PC(e,t){return e-1}function UC(e,t){return t.cols-e}function IC(e,t,n,s,a,o){return Eu(t,s,a,o).length===0?"":va(Hb(e,t,e,t-es(t,a),!1,a).length,ga("D",o))}function Eu(e,t,n,s){let a=e-es(e,n),o=t-es(t,n),c=Math.abs(a-o)-qC(e,t,n);return va(c,ga(jb(e,t),s))}function FC(e,t,n,s,a,o){let c;Eu(t,s,a,o).length>0?c=s-es(s,a):c=t;let f=s,p=WC(e,t,n,s,a,o);return va(Hb(e,c,n,f,p==="C",a).length,ga(p,o))}function qC(e,t,n){var c;let s=0,a=e-es(e,n),o=t-es(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 es(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 Eu(n,s,a,o).length>0?c=s-es(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 ga(e,t){let n=t?"O":"[";return re.ESC+n+e}function va(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 nf=50,VC=15,KC=50,XC=500,$C=" ",GC=new RegExp($C,"g"),id=class extends Ne{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 Xi,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(ct(()=>{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
|
|
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,ef=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)??ou,((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)||ou)(x),Le.None}if(this._disposed)return Le.None;n&&(t=t.bind(n));let a=new ef(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 ef?(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=ct(()=>{o==null||o(),this._removeListener(a)});return s instanceof Dr?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)||ou;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 ef)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}},qf=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}};qf.INSTANCE=new qf;var Dd=qf;function vw(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Dd.INSTANCE.onDidChangeZoomLevel;function yw(e){return Dd.INSTANCE.getZoomFactor(e)}Dd.INSTANCE.onDidChangeFullscreen;var ul=typeof navigator=="object"?navigator.userAgent:"",Wf=ul.indexOf("Firefox")>=0,bw=ul.indexOf("AppleWebKit")>=0,Rd=ul.indexOf("Chrome")>=0,Sw=!Rd&&ul.indexOf("Safari")>=0;ul.indexOf("Electron/")>=0;ul.indexOf("Android")>=0;var tf=!1;if(typeof Kn.matchMedia=="function"){let e=Kn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Kn.matchMedia("(display-mode: fullscreen)");tf=e.matches,vw(Kn,e,({matches:n})=>{tf&&t.matches||(tf=n)})}var rl="en",Yf=!1,Vf=!1,uu=!1,wb=!1,Qo,cu=rl,pv=rl,xw,an,ss=globalThis,ti,Jy;typeof ss.vscode<"u"&&typeof ss.vscode.process<"u"?ti=ss.vscode.process:typeof process<"u"&&typeof((Jy=process==null?void 0:process.versions)==null?void 0:Jy.node)=="string"&&(ti=process);var eb,ww=typeof((eb=ti==null?void 0:ti.versions)==null?void 0:eb.electron)=="string",Cw=ww&&(ti==null?void 0:ti.type)==="renderer",tb;if(typeof ti=="object"){Yf=ti.platform==="win32",Vf=ti.platform==="darwin",uu=ti.platform==="linux",uu&&ti.env.SNAP&&ti.env.SNAP_REVISION,ti.env.CI||ti.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Qo=rl,cu=rl;let e=ti.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Qo=t.userLocale,pv=t.osLocale,cu=t.resolvedLanguage||rl,xw=(tb=t.languagePack)==null?void 0:tb.translationsConfigFile}catch{}wb=!0}else typeof navigator=="object"&&!Cw?(an=navigator.userAgent,Yf=an.indexOf("Windows")>=0,Vf=an.indexOf("Macintosh")>=0,(an.indexOf("Macintosh")>=0||an.indexOf("iPad")>=0||an.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,uu=an.indexOf("Linux")>=0,(an==null?void 0:an.indexOf("Mobi"))>=0,cu=globalThis._VSCODE_NLS_LANGUAGE||rl,Qo=navigator.language.toLowerCase(),pv=Qo):console.error("Unable to resolve platform.");var Cb=Yf,yn=Vf,kw=uu,mv=wb,bn=an,xr=cu,Ew;(e=>{function t(){return xr}e.value=t;function n(){return xr.length===2?xr==="en":xr.length>=3?xr[0]==="e"&&xr[1]==="n"&&xr[2]==="-":!1}e.isDefaultVariant=n;function s(){return xr==="en"}e.isDefault=s})(Ew||(Ew={}));var Tw=typeof ss.postMessage=="function"&&!ss.importScripts;(()=>{if(Tw){let e=[];ss.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}),ss.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Aw=!!(bn&&bn.indexOf("Chrome")>=0);bn&&bn.indexOf("Firefox")>=0;!Aw&&bn&&bn.indexOf("Safari")>=0;bn&&bn.indexOf("Edg/")>=0;bn&&bn.indexOf("Android")>=0;var Zs=typeof navigator=="object"?navigator:{};mv||document.queryCommandSupported&&document.queryCommandSupported("copy")||Zs&&Zs.clipboard&&Zs.clipboard.writeText,mv||Zs&&Zs.clipboard&&Zs.clipboard.readText;var Md=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}},nf=new Md,_v=new Md,gv=new Md,Dw=new Array(230),kb;(e=>{function t(f){return nf.keyCodeToStr(f)}e.toString=t;function n(f){return nf.strToKeyCode(f)}e.fromString=n;function s(f){return _v.keyCodeToStr(f)}e.toUserSettingsUS=s;function a(f){return gv.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function o(f){return _v.strToKeyCode(f)||gv.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 nf.keyCodeToStr(f)}e.toElectronAccelerator=c})(kb||(kb={}));var Rw=class Eb{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 Eb&&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 kb.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Wf)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(yn)return 57;break}else if(bw&&(yn&&t===93||!yn&&t===92))return 57;return Dw[t]||0}var Nw=yn?256:2048,Lw=512,zw=1024,Ow=yn?2048:256,vv=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)}},yv=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=yv.get(e);if(!t){t=[],yv.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}}},Jo=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()}},bv=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(Rd){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?Wf&&!yn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Sw&&Cb?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?Wf&&!yn?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()}},Tb=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Pw;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Uw?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ii.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Tb})})(Pw||(Pw={}));var Uw=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?Tb:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Bd=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 Hf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Hf("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 Hf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=n.setInterval(()=>{e()},t);this.disposable=ct(()=>{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 Sv=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 ii.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())}};Sv.EMPTY=Sv.fromArray([]);var{getWindow:vn,getWindowId:qw,onDidRegisterWindow:Ww}=(function(){let e=new Map,t={window:Kn,disposables:new Dr};e.set(Kn.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 Le.None;let f=new Dr,p={window:c,disposables:f.add(new Dr)};return e.set(c.vscodeWindowId,p),f.add(ct(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),f.add(Ee(c,Ut.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:Kn},getDocument(c){return vn(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 Ee(e,t,n,s){return new Yw(e,t,n,s)}var xv=function(e,t,n,s){return Ee(e,t,n,s)},Nd,Vw=class extends Iw{constructor(e){super(),this.defaultTarget=e&&vn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},wv=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){ou(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(wv.sort),c.shift().execute();s.set(o,!1)};Nd=(o,c,f=0)=>{let p=qw(o),h=new wv(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=vn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ut={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=Ei(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ei(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ei(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ei(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ei(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ei(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ei(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ei(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ei(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ei(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ei(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=Ei(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=Ei(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ei(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 Ei(e){return typeof e=="number"?`${e}px`:e}function Sa(e){return new Xw(e)}var Ab=class{constructor(){this._hooks=new Dr,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(ct(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=vn(e)}this._hooks.add(Ee(o,Ut.POINTER_MOVE,c=>{if(c.buttons!==n){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Ee(o,Ut.POINTER_UP,c=>this.stopMonitoring(!0)))}};function Gw(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 _n;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(_n||(_n={}));var _a=class ri extends Le{constructor(){super(),this.dispatched=!1,this.targets=new dv,this.ignoreTargets=new dv,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ii.runAndSubscribe(Ww,({window:t,disposables:n})=>{n.add(Ee(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),n.add(Ee(t.document,"touchend",s=>this.onTouchEnd(t,s))),n.add(Ee(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:Kn,disposables:this._store}))}static addTarget(t){if(!ri.isTouchDevice())return Le.None;ri.INSTANCE||(ri.INSTANCE=new ri);let n=ri.INSTANCE.targets.push(t);return ct(n)}static ignoreTarget(t){if(!ri.isTouchDevice())return Le.None;ri.INSTANCE||(ri.INSTANCE=new ri);let n=ri.INSTANCE.ignoreTargets.push(t);return ct(n)}static isTouchDevice(){return"ontouchstart"in Kn||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(_n.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<ri.HOLD_DELAY&&Math.abs(p.initialPageX-Oi(p.rollingPageX))<30&&Math.abs(p.initialPageY-Oi(p.rollingPageY))<30){let g=this.newGestureEvent(_n.Tap,p.initialTarget);g.pageX=Oi(p.rollingPageX),g.pageY=Oi(p.rollingPageY),this.dispatchEvent(g)}else if(h>=ri.HOLD_DELAY&&Math.abs(p.initialPageX-Oi(p.rollingPageX))<30&&Math.abs(p.initialPageY-Oi(p.rollingPageY))<30){let g=this.newGestureEvent(_n.Contextmenu,p.initialTarget);g.pageX=Oi(p.rollingPageX),g.pageY=Oi(p.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Oi(p.rollingPageX),_=Oi(p.rollingPageY),b=Oi(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(_n.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===_n.Tap){let n=new Date().getTime(),s=0;n-this._lastSetTapCountTime>ri.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=n,t.tapCount=s}else(t.type===_n.Change||t.type===_n.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=Nd(t,()=>{let g=Date.now(),_=g-s,b=0,y=0,x=!0;a+=ri.SCROLL_FRICTION*_,f+=ri.SCROLL_FRICTION*_,a>0&&(x=!1,b=o*a*_),f>0&&(x=!1,y=p*f*_);let k=this.newGestureEvent(_n.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(_n.Change,c.initialTarget);f.translationX=o.pageX-Oi(c.rollingPageX),f.translationY=o.pageY-Oi(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)}};_a.SCROLL_FRICTION=-.005,_a.HOLD_DELAY=700,_a.CLEAR_TAP_COUNT_TIME=400,vt([Gw],_a,"isTouchDevice",1);var $w=_a,Ld=class extends Le{onclick(e,t){this._register(Ee(e,Ut.CLICK,n=>t(new Jo(vn(e),n))))}onmousedown(e,t){this._register(Ee(e,Ut.MOUSE_DOWN,n=>t(new Jo(vn(e),n))))}onmouseover(e,t){this._register(Ee(e,Ut.MOUSE_OVER,n=>t(new Jo(vn(e),n))))}onmouseleave(e,t){this._register(Ee(e,Ut.MOUSE_LEAVE,n=>t(new Jo(vn(e),n))))}onkeydown(e,t){this._register(Ee(e,Ut.KEY_DOWN,n=>t(new vv(n))))}onkeyup(e,t){this._register(Ee(e,Ut.KEY_UP,n=>t(new vv(n))))}oninput(e,t){this._register(Ee(e,Ut.INPUT,t))}onblur(e,t){this._register(Ee(e,Ut.BLUR,t))}onfocus(e,t){this._register(Ee(e,Ut.FOCUS,t))}onchange(e,t){this._register(Ee(e,Ut.CHANGE,t))}ignoreGesture(e){return $w.ignoreTarget(e)}},Cv=11,Zw=class extends Ld{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=Cv+"px",this.domNode.style.height=Cv+"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 Ab),this._register(xv(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(xv(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Vw),this._pointerdownScheduleRepeatTimer=this._register(new Bd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,vn(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 Kf{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 Kf(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 Kf(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 Le{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 Ev(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=Ev.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)))}},kv=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function rf(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 Ev=class Xf{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(rf(t,a),rf(o,n),.33)}return rf(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 kv(s,a,!1)}return new kv(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,s){return Xf.start(t,n,s)}static start(t,n,s){s=s+10;let a=Date.now()-10;return new Xf(t,n,a,s)}};function tC(e){return Math.pow(e,3)}function iC(e){return 1-tC(1-e)}var nC=class extends Le{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 Bd)}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,Db=class extends Ld{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 Ab),this._shouldRender=!0,this.domNode=Sa(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(Ee(this.domNode.domNode,Ut.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=Sa(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(Ee(this.slider.domNode,Ut.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(Cb&&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()}},Rb=class Gf{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 Gf(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=Gf._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 Db{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Rb(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 Db{constructor(e,t,n){let s=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Rb(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,Tv=50,oC=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},$f=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(Rd){let n=vn(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}};$f.INSTANCE=new $f;var uC=$f,cC=class extends Ld{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=Sa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Sa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Sa(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 Bd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ls(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,yn&&(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 bv(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ls(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new bv(n))};this._mouseWheelToDispose.push(Ee(this._listenOnDomNode,Ut.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=!yn&&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=Tv*o,_=p.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(h,_)}if(c){let g=Tv*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,yn&&(t.className+=" mac"),t}var Zf=class extends Le{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=>Nd(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(ii.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ct(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ct(()=>this._styleElement.remove())),this._register(ii.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}};Zf=vt([pe(2,mi),pe(3,Xn),pe(4,cb),pe(5,ol),pe(6,_i),pe(7,Gn)],Zf);var Qf=class extends Le{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(ct(()=>{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()}};Qf=vt([pe(1,mi),pe(2,Xn),pe(3,Ba),pe(4,Gn)],Qf);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)}},pn={full:0,left:0,center:0,right:0},wr={full:0,left:0,center:0,right:0},sa={full:0,left:0,center:0,right:0},gu=class extends Le{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(ct(()=>{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);wr.full=this._canvas.width,wr.left=e,wr.center=t,wr.right=e,this._refreshDrawHeightConstants(),sa.full=1,sa.left=1,sa.center=1+wr.left,sa.right=1+wr.left+wr.center}_refreshDrawHeightConstants(){pn.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);pn.left=t,pn.center=t,pn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*pn.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(sa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-pn[e.position||"full"]/2),wr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+pn[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}))}};gu=vt([pe(2,mi),pe(3,Ba),pe(4,Gn),pe(5,_i),pe(6,ol),pe(7,Xn)],gu);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 hu;(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=""))(hu||(hu={}));var Mb;(e=>e.ST=`${re.ESC}\\`)(Mb||(Mb={}));var Jf=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)}}};Jf=vt([pe(2,mi),pe(3,_i),pe(4,us),pe(5,Gn)],Jf);var It=0,Ft=0,qt=0,_t=0,Av={css:"#00000000",rgba:0},Dt;(e=>{function t(a,o,c,f){return f!==void 0?`#${Qr(a)}${Qr(o)}${Qr(c)}${Qr(f)}`:`#${Qr(a)}${Qr(o)}${Qr(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})(Dt||(Dt={}));var ot;(e=>{function t(p,h){if(_t=(h.rgba&255)/255,_t===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;It=y+Math.round((g-y)*_t),Ft=x+Math.round((_-x)*_t),qt=k+Math.round((b-k)*_t);let L=Dt.toCss(It,Ft,qt),M=Dt.toRgba(It,Ft,qt);return{css:L,rgba:M}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=fu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return Dt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[It,Ft,qt]=fu.toChannels(h),{css:Dt.toCss(It,Ft,qt),rgba:h}}e.opaque=a;function o(p,h){return _t=Math.round(h*255),[It,Ft,qt]=fu.toChannels(p.rgba),{css:Dt.toCss(It,Ft,qt,_t),rgba:Dt.toRgba(It,Ft,qt,_t)}}e.opacity=o;function c(p,h){return _t=p.rgba&255,o(p,_t*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})(ot||(ot={}));var ft;(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 It=parseInt(a.slice(1,2).repeat(2),16),Ft=parseInt(a.slice(2,3).repeat(2),16),qt=parseInt(a.slice(3,4).repeat(2),16),Dt.toColor(It,Ft,qt);case 5:return It=parseInt(a.slice(1,2).repeat(2),16),Ft=parseInt(a.slice(2,3).repeat(2),16),qt=parseInt(a.slice(3,4).repeat(2),16),_t=parseInt(a.slice(4,5).repeat(2),16),Dt.toColor(It,Ft,qt,_t);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 It=parseInt(o[1]),Ft=parseInt(o[2]),qt=parseInt(o[3]),_t=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Dt.toColor(It,Ft,qt,_t);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),[It,Ft,qt,_t]=t.getImageData(0,0,1,1).data,_t!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Dt.toRgba(It,Ft,qt,_t),css:a}}e.toColor=s})(ft||(ft={}));var fi;(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})(fi||(fi={}));var fu;(e=>{function t(c,f){if(_t=(f&255)/255,_t===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 It=_+Math.round((p-_)*_t),Ft=b+Math.round((h-b)*_t),qt=y+Math.round((g-y)*_t),Dt.toRgba(It,Ft,qt)}e.blend=t;function n(c,f,p){let h=fi.relativeLuminance(c>>8),g=fi.relativeLuminance(f>>8);if(Wn(h,g)<p){if(g<h){let y=s(c,f,p),x=Wn(h,fi.relativeLuminance(y>>8));if(x<p){let k=a(c,f,p),L=Wn(h,fi.relativeLuminance(k>>8));return x>L?y:k}return y}let _=a(c,f,p),b=Wn(h,fi.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Wn(h,fi.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=Wn(fi.relativeLuminance2(b,y,x),fi.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=Wn(fi.relativeLuminance2(b,y,x),fi.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=Wn(fi.relativeLuminance2(b,y,x),fi.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=Wn(fi.relativeLuminance2(b,y,x),fi.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})(fu||(fu={}));function Qr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Wn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var pC=class extends Ma{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()]}},vu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new tn}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||Ar.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++)vu._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||Ar.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}};vu=vt([pe(0,mi)],vu);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:eu(),cell:eu()},device:{canvas:eu(),cell:eu(),char:{width:0,height:0,left:0,top:0}}}}function eu(){return{width:0,height:0}}var ed=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 tn,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,M="",$=0,I=0,Z=0,W=0,O=!1,te=0,oe=!1,me=0,U=0,se=[],K=h!==-1&&g!==-1;for(let B=0;B<x;B++){e.loadCell(B,this._workCell);let A=this._workCell.getWidth();if(A===0)continue;let R=!1,T=B>=U,j=B,H=this._workCell;if(b.length>0&&B===b[0][0]&&T){let xe=b.shift(),Xt=this._isCellInSelection(xe[0],t);for($=xe[0]+1;$<xe[1];$++)T&&(T=Xt===this._isCellInSelection($,t));T&&(T=!n||o<xe[0]||o>=xe[1]),T?(R=!0,H=new pC(this._workCell,e.translateToString(!0,xe[0],xe[1]),xe[1]-xe[0]),j=xe[1]-1,A=H.getWidth()):U=xe[1]}let le=this._isCellInSelection(B,t),E=n&&B===o,D=K&&B>=h&&B<=g,X=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,xe=>{X=!0});let C=H.getChars()||Ar;if(C===" "&&(H.isUnderline()||H.isOverline())&&(C=" "),me=A*f-p.get(C,H.isBold(),H.isItalic()),!k)k=this._document.createElement("span");else if(L&&(le&&oe||!le&&!oe&&H.bg===I)&&(le&&oe&&y.selectionForeground||H.fg===Z)&&H.extended.ext===W&&D===O&&me===te&&!E&&!R&&!X&&T){H.isInvisible()?M+=Ar:M+=C,L++;continue}else L&&(k.textContent=M),k=this._document.createElement("span"),L=0,M="";if(I=H.bg,Z=H.fg,W=H.extended.ext,O=D,te=me,oe=le,R&&o>=B&&o<=j&&(o=B),!this._coreService.isCursorHidden&&E&&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(H.isBold()&&se.push("xterm-bold"),H.isItalic()&&se.push("xterm-italic"),H.isDim()&&se.push("xterm-dim"),H.isInvisible()?M=Ar:M=H.getChars()||Ar,H.isUnderline()&&(se.push(`xterm-underline-${H.extended.underlineStyle}`),M===" "&&(M=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Ma.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let xe=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&xe<8&&(xe+=8),k.style.textDecorationColor=y.ansi[xe].css}H.isOverline()&&(se.push("xterm-overline"),M===" "&&(M=" ")),H.isStrikethrough()&&se.push("xterm-strikethrough"),D&&(k.style.textDecoration="underline");let Q=H.getFgColor(),fe=H.getFgColorMode(),de=H.getBgColor(),Ce=H.getBgColorMode(),ze=!!H.isInverse();if(ze){let xe=Q;Q=de,de=xe;let Xt=fe;fe=Ce,Ce=Xt}let Te,st,Xe=!1;this._decorationService.forEachDecorationAtCell(B,t,void 0,xe=>{xe.options.layer!=="top"&&Xe||(xe.backgroundColorRGB&&(Ce=50331648,de=xe.backgroundColorRGB.rgba>>8&16777215,Te=xe.backgroundColorRGB),xe.foregroundColorRGB&&(fe=50331648,Q=xe.foregroundColorRGB.rgba>>8&16777215,st=xe.foregroundColorRGB),Xe=xe.options.layer==="top")}),!Xe&&le&&(Te=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,de=Te.rgba>>8&16777215,Ce=50331648,Xe=!0,y.selectionForeground&&(fe=50331648,Q=y.selectionForeground.rgba>>8&16777215,st=y.selectionForeground)),Xe&&se.push("xterm-decoration-top");let xt;switch(Ce){case 16777216:case 33554432:xt=y.ansi[de],se.push(`xterm-bg-${de}`);break;case 50331648:xt=Dt.toColor(de>>16,de>>8&255,de&255),this._addStyle(k,`background-color:#${Dv((de>>>0).toString(16),"0",6)}`);break;case 0:default:ze?(xt=y.foreground,se.push("xterm-bg-257")):xt=y.background}switch(Te||H.isDim()&&(Te=ot.multiplyOpacity(xt,.5)),fe){case 16777216:case 33554432:H.isBold()&&Q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Q+=8),this._applyMinimumContrast(k,xt,y.ansi[Q],H,Te,void 0)||se.push(`xterm-fg-${Q}`);break;case 50331648:let xe=Dt.toColor(Q>>16&255,Q>>8&255,Q&255);this._applyMinimumContrast(k,xt,xe,H,Te,st)||this._addStyle(k,`color:#${Dv(Q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(k,xt,y.foreground,H,Te,st)||ze&&se.push("xterm-fg-257")}se.length&&(k.className=se.join(" "),se.length=0),!E&&!R&&!X&&T?L++:k.textContent=M,me!==this.defaultSpacing&&(k.style.letterSpacing=`${me}px`),_.push(k),B=j}return k&&L&&(k.textContent=M),_}_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=ot.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]}};ed=vt([pe(1,db),pe(2,_i),pe(3,Xn),pe(4,us),pe(5,Ba),pe(6,ol)],ed);function Dv(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 sf="xterm-dom-renderer-owner-",Zi="xterm-rows",tu="xterm-fg-",Rv="xterm-bg-",la="xterm-focus",iu="xterm-selection",xC=1,td=class extends Le{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(Zi),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(iu),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(ed,document),this._element.classList.add(sf+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(ct(()=>{this._element.classList.remove(sf+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} .${Zi} 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} .${Zi} { 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} .${Zi} .xterm-dim { color: ${ot.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} .${Zi}.${la} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${la} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Zi}.${la} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Zi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${iu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${iu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${iu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,c]of e.ansi.entries())t+=`${this._terminalSelector} .${tu}${o} { color: ${c.css}; }${this._terminalSelector} .${tu}${o}.xterm-dim { color: ${ot.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Rv}${o} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${tu}257 { color: ${ot.opaque(e.background).css}; }${this._terminalSelector} .${tu}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(e.background),.5).css}; }${this._terminalSelector} .${Rv}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(la),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(la),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`.${sf}${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))}}};td=vt([pe(7,Td),pe(8,Tu),pe(9,_i),pe(10,mi),pe(11,us),pe(12,Xn),pe(13,ol)],td);var id=class extends Le{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())}};id=vt([pe(2,_i)],id);var Bb=class extends Le{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 Bb{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 Bb{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 Le{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(ii.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ee(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ee(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 Le{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new ll),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(ct(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ee(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 Le{constructor(){super(),this.linkProviders=[],this._register(ct(()=>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 zd(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=zd(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 nd=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=zd(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])}}};nd=vt([pe(0,Gn),pe(1,Tu)],nd);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=[]}},Nb={};Px(Nb,{getSafariVersion:()=>MC,isChromeOS:()=>jb,isFirefox:()=>Lb,isIpad:()=>BC,isIphone:()=>NC,isLegacyEdge:()=>RC,isLinux:()=>Od,isMac:()=>yu,isNode:()=>Au,isSafari:()=>zb,isWindows:()=>Ob});var Au=typeof process<"u"&&"title"in process,Na=Au?"node":navigator.userAgent,La=Au?"node":navigator.platform,Lb=Na.includes("Firefox"),RC=Na.includes("Edge"),zb=/^((?!chrome|android).)*safari/i.test(Na);function MC(){if(!zb)return 0;let e=Na.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var yu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(La),BC=La==="iPad",NC=La==="iPhone",Ob=["Windows","Win16","Win32","WinCE"].includes(La),Od=La.indexOf("Linux")>=0,jb=/\bCrOS\b/.test(Na),Hb=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 Hb{_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 Hb{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},bu=!Au&&"requestIdleCallback"in window?zC:LC,OC=class{constructor(){this._queue=new bu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rd=class extends Le{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 ll),this._pausedResizeTask=new OC,this._observerDisposable=this._register(new ll),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(ct(()=>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=ct(()=>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()}};rd=vt([pe(2,_i),pe(3,Tu),pe(4,us),pe(5,Ba),pe(6,mi),pe(7,Xn),pe(8,ol)],rd);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)+Du(o,t,n,s)+FC(a,o,e,t,n,s);let c;if(o===t)return c=a>e?"D":"C",Ea(Math.abs(a-e),ka(c,s));c=o>t?"D":"C";let f=Math.abs(o-t),p=UC(o>t?e:a,n)+(f-1)*n.cols+1+PC(o>t?a:e);return Ea(p,ka(c,s))}function PC(e,t){return e-1}function UC(e,t){return t.cols-e}function IC(e,t,n,s,a,o){return Du(t,s,a,o).length===0?"":Ea(Ub(e,t,e,t-as(t,a),!1,a).length,ka("D",o))}function Du(e,t,n,s){let a=e-as(e,n),o=t-as(t,n),c=Math.abs(a-o)-qC(e,t,n);return Ea(c,ka(Pb(e,t),s))}function FC(e,t,n,s,a,o){let c;Du(t,s,a,o).length>0?c=s-as(s,a):c=t;let f=s,p=WC(e,t,n,s,a,o);return Ea(Ub(e,c,n,f,p==="C",a).length,ka(p,o))}function qC(e,t,n){var c;let s=0,a=e-as(e,n),o=t-as(t,n);for(let f=0;f<Math.abs(a-o);f++){let p=Pb(e,t)==="A"?-1:1;(c=n.buffer.lines.get(a+p*f))!=null&&c.isWrapped&&s++}return s}function as(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 Du(n,s,a,o).length>0?c=s-as(s,a):c=t,e<n&&c<=s||e>=n&&c<s?"C":"D"}function Pb(e,t){return e>t?"A":"B"}function Ub(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 ka(e,t){let n=t?"O":"[";return re.ESC+n+e}function Ea(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 Mv(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 lf=50,VC=15,KC=50,XC=500,GC=" ",$C=new RegExp(GC,"g"),sd=class extends Le{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 tn,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(ct(()=>{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($C," ")).join(Ob?`\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())),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,-nf),nf),t/=nf,t/Math.abs(t)+Math.round(t*(VC-1)))}shouldForceSelection(e){return _u?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&&!(_u&&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],M=e[0];o.getWidth(L)===0&&(g++,L--),o.getWidth(M)===2&&(_++,M++);let G=o.getString(M).length;for(G>1&&(y+=G-1,p+=G-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(;M<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(M+1,this._workCell));){o.loadCell(M+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,M++):I>1&&(y+=I-1,p+=I-1),p++,M++}}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 M=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(M){let G=this._bufferService.cols-M.start;x-=G,k+=G}}}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 M=this._getWordAt([0,e[1]+1],!1,!1,!0);M&&(k+=M.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=gt([pe(3,ci),pe(4,is),pe(5,kd),pe(6,hi),pe(7,Un),pe(8,Pn)],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()}},Mt=Object.freeze((()=>{let e=[ft.toColor("#2e3436"),ft.toColor("#cc0000"),ft.toColor("#4e9a06"),ft.toColor("#c4a000"),ft.toColor("#3465a4"),ft.toColor("#75507b"),ft.toColor("#06989a"),ft.toColor("#d3d7cf"),ft.toColor("#555753"),ft.toColor("#ef2929"),ft.toColor("#8ae234"),ft.toColor("#fce94f"),ft.toColor("#729fcf"),ft.toColor("#ad7fa8"),ft.toColor("#34e2e2"),ft.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:Dt.toCss(s,a,o),rgba:Dt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Dt.toCss(s,s,s),rgba:Dt.toRgba(s,s,s)})}return e})()),$r=ft.toColor("#ffffff"),ua=ft.toColor("#000000"),Bv=ft.toColor("#ffffff"),Nv=ua,Jl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ZC=$r,nd=class extends Ne{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:$r,background:ua,cursor:Bv,cursorAccent:Nv,selectionForeground:void 0,selectionBackgroundTransparent:Jl,selectionBackgroundOpaque:ot.blend(ua,Jl),selectionInactiveBackgroundTransparent:Jl,selectionInactiveBackgroundOpaque:ot.blend(ua,Jl),scrollbarSliderBackground:ot.opacity($r,.2),scrollbarSliderHoverBackground:ot.opacity($r,.4),scrollbarSliderActiveBackground:ot.opacity($r,.5),overviewRulerBorder:$r,ansi:Mt.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=Ze(e.foreground,$r),t.background=Ze(e.background,ua),t.cursor=ot.blend(t.background,Ze(e.cursor,Bv)),t.cursorAccent=ot.blend(t.background,Ze(e.cursorAccent,Nv)),t.selectionBackgroundTransparent=Ze(e.selectionBackground,Jl),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Ze(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Ze(e.selectionForeground,Ev):void 0,t.selectionForeground===Ev&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Ze(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Ze(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Ze(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=Ze(e.overviewRulerBorder,ZC),t.ansi=Mt.slice(),t.ansi[0]=Ze(e.black,Mt[0]),t.ansi[1]=Ze(e.red,Mt[1]),t.ansi[2]=Ze(e.green,Mt[2]),t.ansi[3]=Ze(e.yellow,Mt[3]),t.ansi[4]=Ze(e.blue,Mt[4]),t.ansi[5]=Ze(e.magenta,Mt[5]),t.ansi[6]=Ze(e.cyan,Mt[6]),t.ansi[7]=Ze(e.white,Mt[7]),t.ansi[8]=Ze(e.brightBlack,Mt[8]),t.ansi[9]=Ze(e.brightRed,Mt[9]),t.ansi[10]=Ze(e.brightGreen,Mt[10]),t.ansi[11]=Ze(e.brightYellow,Mt[11]),t.ansi[12]=Ze(e.brightBlue,Mt[12]),t.ansi[13]=Ze(e.brightMagenta,Mt[13]),t.ansi[14]=Ze(e.brightCyan,Mt[14]),t.ansi[15]=Ze(e.brightWhite,Mt[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]=Ze(e.extendedAnsi[s],Mt[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=gt([pe(0,hi)],nd);function Ze(e,t){if(e!==void 0)try{return ft.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 Ne{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=gt([pe(0,hi)],rd);var Lv=class extends Ne{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}},Be=3,At=Object.freeze(new wa),eu=0,rf=2,ca=class Pb{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Be);let a=n||Xi.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*Be+0],s=n&2097151;return[this._data[t*Be+1],n&2097152?this._combined[t]:s?br(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Be+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Be+0]=t|2097152|n[2]<<22):this._data[t*Be+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Be+0]>>22}hasWidth(t){return this._data[t*Be+0]&12582912}getFg(t){return this._data[t*Be+1]}getBg(t){return this._data[t*Be+2]}hasContent(t){return this._data[t*Be+0]&4194303}getCodePoint(t){let n=this._data[t*Be+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Be+0]&2097152}getString(t){let n=this._data[t*Be+0];return n&2097152?this._combined[t]:n&2097151?br(n&2097151):""}isProtected(t){return this._data[t*Be+2]&536870912}loadCell(t,n){return eu=t*Be,n.content=this._data[eu+0],n.fg=this._data[eu+1],n.bg=this._data[eu+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*Be+0]=n.content,this._data[t*Be+1]=n.fg,this._data[t*Be+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Be+0]=n|s<<22,this._data[t*Be+1]=a.fg,this._data[t*Be+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*Be+0];a&2097152?this._combined[t]+=br(n):a&2097151?(this._combined[t]=br(a&2097151)+br(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*Be+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 Xi;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 Xi;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*rf<this._data.buffer.byteLength;let s=t*Be;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*rf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*rf<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 Pb(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*Be+0]&4194303)return t+(this._data[t*Be+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Be+0]&4194303||this._data[t*Be+2]&50331648)return t+(this._data[t*Be+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<Be;h++)this._data[(s+p)*Be+h]=c[(n+p)*Be+h];c[(n+p)*Be+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<Be;h++)this._data[(s+p)*Be+h]=c[(n+p)*Be+h];c[(n+p)*Be+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*Be+0],f=c&2097151,p=c&2097152?this._combined[n]:f?br(f):xr;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=ya(g,_,t),y=1,x=0;for(;y<g.length;){let L=ya(g,y,t),M=L-x,G=n-b,I=Math.min(M,G);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)=>ya(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=ya(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 ya(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 Ub=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(),Jr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Ub._nextId=1;var l2=Ub,Lt={},Gr=Lt.B;Lt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Lt.A={"#":"£"};Lt.B=void 0;Lt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Lt.C=Lt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Lt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Lt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Lt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Lt.E=Lt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Lt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Lt.H=Lt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};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=At.clone(),this.savedCharset=Gr,this.markers=[],this._nullCell=Xi.fromCharData([0,rb,1,0]),this._whitespaceCell=Xi.fromCharData([0,xr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new gu,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 du),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 du),this._whitespaceCell}getBlankLine(e,t){return new ca(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=At);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(At),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 ca(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 ca(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(At),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(At),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ca(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(At),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(At,!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,M=h;for(;L>=0;){let I=Math.min(M,k);if(p[x]===void 0)break;if(p[x].copyCellsFrom(p[L],M-I,k-I,I,!0),k-=I,k===0&&(x--,k=g[x]),M-=I,M===0){L--;let Z=Math.max(L,0);M=ya(p,Z,this._cols)}}for(let I=0;I<p.length;I++)g[I]<e&&p[I].setCell(g[I],s);let G=_-b;for(;G-- >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 Ne{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 Ne{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=gt([pe(0,hi)],sd);var Ws={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:_u,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 Ne{constructor(e){super(),this._onOptionChange=this._register(new he),this.onOptionChange=this._onOptionChange.event;let t={...Ws};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(ct(()=>{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 Ws))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in Ws))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=Ws[e]),!c2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ws[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=o2.includes(t)?t:Ws[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 ha(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]&&ha(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 Ne{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=ha(jv),this.decPrivateModes=ha(Hv)}reset(){this.modes=ha(jv),this.decPrivateModes=ha(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=gt([pe(0,ci),pe(1,ub),pe(2,hi)],ld);var Pv={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 sf(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 lf=String.fromCharCode,Uv={DEFAULT:e=>{let t=[sf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${lf(t[0])}${lf(t[1])}${lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${sf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${sf(e,!0)};${e.x};${e.y}${t}`}},ad=class extends Ne{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(Pv))this.addProtocol(s,Pv[s]);for(let s of Object.keys(Uv))this.addEncoding(s,Uv[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=gt([pe(0,ci),pe(1,is),pe(2,hi)],ad);var af=[[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]],Bt;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",!Bt){Bt=new Uint8Array(65536),Bt.fill(1),Bt[0]=0,Bt.fill(0,1,32),Bt.fill(0,127,160),Bt.fill(2,4352,4448),Bt[9001]=2,Bt[9002]=2,Bt.fill(2,11904,42192),Bt[12351]=1,Bt.fill(2,44032,55204),Bt.fill(2,63744,64256),Bt.fill(2,65040,65050),Bt.fill(2,65072,65136),Bt.fill(2,65280,65377),Bt.fill(2,65504,65511);for(let e=0;e<af.length;++e)Bt.fill(0,af[e][0],af[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Bt[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=Zr.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return Zr.createPropertyValue(0,n,s)}},Zr=class cu{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=cu.extractWidth(f);cu.extractShouldJoin(f)&&(p-=cu.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 ea=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>ea?ea: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>ea?ea: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,ea):t}},ta=[],_2=class{constructor(){this._state=0,this._active=ta,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=ta}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=ta,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ta,!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",wu(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=ta,this._id=-1,this._state=0}}},Ri=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+=wu(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}},ia=[],g2=class{constructor(){this._handlers=Object.create(null),this._active=ia,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ia}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=ia,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ia,!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",wu(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=ia,this._ident=0}},fa=new Wb;fa.addParam(0);var Fv=class{constructor(e){this._handler=e,this._data="",this._params=fa,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():fa,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=wu(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=fa,this._data="",this._hitLimit=!1,n));return this._params=fa,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}},Vi=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(Vi,0,2,0),e.add(Vi,8,5,8),e.add(Vi,6,0,6),e.add(Vi,11,0,11),e.add(Vi,13,13,13),e})(),b2=class extends Ne{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(ct(()=>{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:Vi)],a>>4){case 2:for(let b=f+1;;++b){if(b>=t||(s=e[b])<32||s>126&&s<Vi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Vi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Vi){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Vi){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<Vi){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<Vi){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 of(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:${of(n,t)}/${of(s,t)}/${of(a,t)}`}var C2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},vr=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 Ne{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=At.clone(),this._eraseAttrDataInternal=At.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(ou.IND,()=>this.index()),this._parser.setExecuteHandler(ou.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ou.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ri(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ri(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ri(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ri(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ri(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ri(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ri(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ri(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ri(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ri(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ri(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ri(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 Lt)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>vr&&(o=this._parseStack.position+vr)}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<vr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,vr))),c||this._dirtyRowTracker.clearRange(),e.length>vr)for(let h=o;h<e.length;h+=vr){let g=h+vr<e.length?h+vr: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 M=o[String.fromCharCode(s)];M&&(s=M.charCodeAt(0))}let x=this._unicodeService.charProperties(s,b);a=Zr.extractWidth(x);let k=Zr.extractShouldJoin(x),L=k?Zr.extractWidth(b):0;if(b=x,c&&this._onA11yChar.fire(br(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-L>f){if(p){let M=_,G=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 ca&&_.copyCellsFrom(M,G,0,L,!1);G<f;)M.setCellFromCodepoint(G++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(k&&this._activeBuffer.x){let M=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-M,s,a);for(let G=a-L;--G>=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 Ri(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(At));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=Zr.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,Gr),this._charsetService.setgCharset(1,Gr),this._charsetService.setgCharset(2,Gr),this._charsetService.setgCharset(3,Gr);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|=wa.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=At.fg,e.bg=At.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|=At.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=At.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|=At.fg&16777215,s.bg&=-67108864,s.bg|=At.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=At.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,Gr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(C2[e[0]],Lt[e[1]]||Gr),!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=At.clone(),this._eraseAttrDataInternal=At.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 Xi;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=gt([pe(0,ci)],ud);function Xv(e){return 0<=e&&e<256}var E2=5e7,$v=12,T2=50,A2=class extends Ne{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=gt([pe(0,ci)],cd);var Gv=!1,D2=class extends Ne{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Qs),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(hi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(sd)),this._instantiationService.setService(ci,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(is,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ad)),this._instantiationService.setService(ob,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Zr)),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(ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ei.forward(this._bufferService.onResize,this._onResize)),this._register(ei.forward(this.coreService.onData,this._onData)),this._register(ei.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(ei.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=ct(()=>{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 St=0,B2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new gu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new gu,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||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===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&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===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}},uf=0,Zv=0,N2=class extends Ne{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(ct(()=>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=>{uf=a.options.x??0,Zv=uf+(a.options.width??1),e>=uf&&e<Zv&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},L2=class extends wr{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=ft.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ft.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,vu=class extends Ne{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(
|
|
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})`}};vu=gt([pe(1,Cd),pe(2,Pn),pe(3,Un)],vu);var hd=class extends Ne{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(ct(()=>{var o;Jr(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(ke(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ke(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ke(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ke(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,Jr(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=gt([pe(1,kd),pe(2,Un),pe(3,ci),pe(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 Qs),this.browser=Mb,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Qs),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(Ca,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(ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ct(()=>{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=ot.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]=Dt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Dt.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(vu,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(ke(this.element,"copy",t=>{this.hasSelection()&&Fx(t,this._selectionService)}));let e=t=>qx(t,this.textarea,this.coreService,this.optionsService);this._register(ke(this.textarea,"paste",e)),this._register(ke(this.element,"paste",e)),Bb?this._register(ke(this.element,"mousedown",t=>{t.button===2&&ov(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ke(this.element,"contextmenu",t=>{ov(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Nd&&this._register(ke(this.element,"auxclick",t=>{t.button===1&&nb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ke(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ke(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ke(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ke(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ke(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ke(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ke(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(ke(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(Pn,this._coreBrowserService),this._register(ke(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(ke(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Jf,this._document,this._helperContainer),this._instantiationService.setService(Cu,this._charSizeService),this._themeService=this._instantiationService.createInstance(nd),this._instantiationService.setService(el,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(mu),this._instantiationService.setService(hb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(td,this.rows,this.screenElement)),this._instantiationService.setService(Un,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(ei.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(ke(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(vu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pu,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(ke(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(ke(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)&&(P2(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(At));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 P2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var U2=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 Xi)}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 Xi}},F2=class extends Ne{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"],an=0,V2=class extends Ne{constructor(e){super(),this._core=this._register(new H2(e)),this._addonManager=this._register(new U2),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
|
|
72
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Od&&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=Mv(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=zd(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,-lf),lf),t/=lf,t/Math.abs(t)+Math.round(t*(VC-1)))}shouldForceSelection(e){return yu?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&&!(yu&&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],M=e[0];o.getWidth(L)===0&&(g++,L--),o.getWidth(M)===2&&(_++,M++);let $=o.getString(M).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(;M<o.length&&p+1<c.length&&!this._isCharWordSeparator(o.loadCell(M+1,this._workCell));){o.loadCell(M+1,this._workCell);let I=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,M++):I>1&&(y+=I-1,p+=I-1),p++,M++}}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 M=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(M){let $=this._bufferService.cols-M.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 M=this._getWordAt([0,e[1]+1],!1,!1,!0);M&&(k+=M.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=Mv(n,this._bufferService.cols)}};sd=vt([pe(3,mi),pe(4,us),pe(5,Ad),pe(6,_i),pe(7,Gn),pe(8,Xn)],sd);var Bv=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={}}},Nv=class{constructor(){this._color=new Bv,this._css=new Bv}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()}},Mt=Object.freeze((()=>{let e=[ft.toColor("#2e3436"),ft.toColor("#cc0000"),ft.toColor("#4e9a06"),ft.toColor("#c4a000"),ft.toColor("#3465a4"),ft.toColor("#75507b"),ft.toColor("#06989a"),ft.toColor("#d3d7cf"),ft.toColor("#555753"),ft.toColor("#ef2929"),ft.toColor("#8ae234"),ft.toColor("#fce94f"),ft.toColor("#729fcf"),ft.toColor("#ad7fa8"),ft.toColor("#34e2e2"),ft.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:Dt.toCss(s,a,o),rgba:Dt.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:Dt.toCss(s,s,s),rgba:Dt.toRgba(s,s,s)})}return e})()),is=ft.toColor("#ffffff"),ga=ft.toColor("#000000"),Lv=ft.toColor("#ffffff"),zv=ga,aa={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ZC=is,ld=class extends Le{constructor(e){super(),this._optionsService=e,this._contrastCache=new Nv,this._halfContrastCache=new Nv,this._onChangeColors=this._register(new he),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:is,background:ga,cursor:Lv,cursorAccent:zv,selectionForeground:void 0,selectionBackgroundTransparent:aa,selectionBackgroundOpaque:ot.blend(ga,aa),selectionInactiveBackgroundTransparent:aa,selectionInactiveBackgroundOpaque:ot.blend(ga,aa),scrollbarSliderBackground:ot.opacity(is,.2),scrollbarSliderHoverBackground:ot.opacity(is,.4),scrollbarSliderActiveBackground:ot.opacity(is,.5),overviewRulerBorder:is,ansi:Mt.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=et(e.foreground,is),t.background=et(e.background,ga),t.cursor=ot.blend(t.background,et(e.cursor,Lv)),t.cursorAccent=ot.blend(t.background,et(e.cursorAccent,zv)),t.selectionBackgroundTransparent=et(e.selectionBackground,aa),t.selectionBackgroundOpaque=ot.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=et(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ot.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?et(e.selectionForeground,Av):void 0,t.selectionForeground===Av&&(t.selectionForeground=void 0),ot.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ot.opacity(t.selectionBackgroundTransparent,.3)),ot.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ot.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=et(e.scrollbarSliderBackground,ot.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=et(e.scrollbarSliderHoverBackground,ot.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=et(e.scrollbarSliderActiveBackground,ot.opacity(t.foreground,.5)),t.overviewRulerBorder=et(e.overviewRulerBorder,ZC),t.ansi=Mt.slice(),t.ansi[0]=et(e.black,Mt[0]),t.ansi[1]=et(e.red,Mt[1]),t.ansi[2]=et(e.green,Mt[2]),t.ansi[3]=et(e.yellow,Mt[3]),t.ansi[4]=et(e.blue,Mt[4]),t.ansi[5]=et(e.magenta,Mt[5]),t.ansi[6]=et(e.cyan,Mt[6]),t.ansi[7]=et(e.white,Mt[7]),t.ansi[8]=et(e.brightBlack,Mt[8]),t.ansi[9]=et(e.brightRed,Mt[9]),t.ansi[10]=et(e.brightGreen,Mt[10]),t.ansi[11]=et(e.brightYellow,Mt[11]),t.ansi[12]=et(e.brightBlue,Mt[12]),t.ansi[13]=et(e.brightMagenta,Mt[13]),t.ansi[14]=et(e.brightCyan,Mt[14]),t.ansi[15]=et(e.brightWhite,Mt[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]=et(e.extendedAnsi[s],Mt[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()}}};ld=vt([pe(0,_i)],ld);function et(e,t){if(e!==void 0)try{return ft.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(Td,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: ",ad=class extends Le{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)}};ad=vt([pe(0,_i)],ad);var Ov=class extends Le{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}},Ne=3,At=Object.freeze(new Ma),nu=0,af=2,va=class Ib{constructor(t,n,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ne);let a=n||tn.fromCharData([0,lb,1,0]);for(let o=0;o<t;++o)this.setCell(o,a);this.length=t}get(t){let n=this._data[t*Ne+0],s=n&2097151;return[this._data[t*Ne+1],n&2097152?this._combined[t]:s?Er(s):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,n){this._data[t*Ne+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ne+0]=t|2097152|n[2]<<22):this._data[t*Ne+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ne+0]>>22}hasWidth(t){return this._data[t*Ne+0]&12582912}getFg(t){return this._data[t*Ne+1]}getBg(t){return this._data[t*Ne+2]}hasContent(t){return this._data[t*Ne+0]&4194303}getCodePoint(t){let n=this._data[t*Ne+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ne+0]&2097152}getString(t){let n=this._data[t*Ne+0];return n&2097152?this._combined[t]:n&2097151?Er(n&2097151):""}isProtected(t){return this._data[t*Ne+2]&536870912}loadCell(t,n){return nu=t*Ne,n.content=this._data[nu+0],n.fg=this._data[nu+1],n.bg=this._data[nu+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*Ne+0]=n.content,this._data[t*Ne+1]=n.fg,this._data[t*Ne+2]=n.bg}setCellFromCodepoint(t,n,s,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Ne+0]=n|s<<22,this._data[t*Ne+1]=a.fg,this._data[t*Ne+2]=a.bg}addCodepointToCell(t,n,s){let a=this._data[t*Ne+0];a&2097152?this._combined[t]+=Er(n):a&2097151?(this._combined[t]=Er(a&2097151)+Er(n),a&=-2097152,a|=2097152):a=n|1<<22,s&&(a&=-12582913,a|=s<<22),this._data[t*Ne+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 tn;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 tn;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*af<this._data.buffer.byteLength;let s=t*Ne;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*af<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*af<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 Ib(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*Ne+0]&4194303)return t+(this._data[t*Ne+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ne+0]&4194303||this._data[t*Ne+2]&50331648)return t+(this._data[t*Ne+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<Ne;h++)this._data[(s+p)*Ne+h]=c[(n+p)*Ne+h];c[(n+p)*Ne+2]&268435456&&(this._extendedAttrs[s+p]=t._extendedAttrs[n+p])}else for(let p=0;p<a;p++){for(let h=0;h<Ne;h++)this._data[(s+p)*Ne+h]=c[(n+p)*Ne+h];c[(n+p)*Ne+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*Ne+0],f=c&2097151,p=c&2097152?this._combined[n]:f?Er(f):Ar;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=Ta(g,_,t),y=1,x=0;for(;y<g.length;){let L=Ta(g,y,t),M=L-x,$=n-b,I=Math.min(M,$);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)=>Ta(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=Ta(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 Ta(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 Fb=class qb{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=qb._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(),ls(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Fb._nextId=1;var l2=Fb,Lt={},ns=Lt.B;Lt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Lt.A={"#":"£"};Lt.B=void 0;Lt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Lt.C=Lt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Lt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Lt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Lt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Lt.E=Lt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Lt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Lt.H=Lt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Lt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var jv=4294967295,Hv=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=At.clone(),this.savedCharset=ns,this.markers=[],this._nullCell=tn.fromCharData([0,lb,1,0]),this._whitespaceCell=tn.fromCharData([0,Ar,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new bu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Ov(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 _u),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 _u),this._whitespaceCell}getBlankLine(e,t){return new va(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>jv?jv:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=At);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 Ov(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(At),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 va(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 va(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(At),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(At),a=n;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new va(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(At),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(At,!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,M=h;for(;L>=0;){let I=Math.min(M,k);if(p[x]===void 0)break;if(p[x].copyCellsFrom(p[L],M-I,k-I,I,!0),k-=I,k===0&&(x--,k=g[x]),M-=I,M===0){L--;let Z=Math.max(L,0);M=Ta(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 Le{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 Hv(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Hv(!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)}},Wb=2,Yb=1,od=class extends Le{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,Wb),this.rows=Math.max(e.rawOptions.rows||0,Yb),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))}};od=vt([pe(0,_i)],od);var Qs={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:yu,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 Le{constructor(e){super(),this._onOptionChange=this._register(new he),this.onOptionChange=this._onOptionChange.event;let t={...Qs};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(ct(()=>{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 Qs))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,s)=>{if(!(n in Qs))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=Qs[e]),!c2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Qs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=o2.includes(t)?t:Qs[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 ya(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]&&ya(e[s],t-1);return n}var Pv=Object.freeze({insertMode:!1}),Uv=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ud=class extends Le{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=ya(Pv),this.decPrivateModes=ya(Uv)}reset(){this.modes=ya(Pv),this.decPrivateModes=ya(Uv)}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))}};ud=vt([pe(0,mi),pe(1,hb),pe(2,_i)],ud);var Iv={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 of(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 uf=String.fromCharCode,Fv={DEFAULT:e=>{let t=[of(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${uf(t[0])}${uf(t[1])}${uf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${of(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${of(e,!0)};${e.x};${e.y}${t}`}},cd=class extends Le{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(Iv))this.addProtocol(s,Iv[s]);for(let s of Object.keys(Fv))this.addEncoding(s,Fv[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)}};cd=vt([pe(0,mi),pe(1,us),pe(2,_i)],cd);var cf=[[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]],Bt;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",!Bt){Bt=new Uint8Array(65536),Bt.fill(1),Bt[0]=0,Bt.fill(0,1,32),Bt.fill(0,127,160),Bt.fill(2,4352,4448),Bt[9001]=2,Bt[9002]=2,Bt.fill(2,11904,42192),Bt[12351]=1,Bt.fill(2,44032,55204),Bt.fill(2,63744,64256),Bt.fill(2,65040,65050),Bt.fill(2,65072,65136),Bt.fill(2,65280,65377),Bt.fill(2,65504,65511);for(let e=0;e<cf.length;++e)Bt.fill(0,cf[e][0],cf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Bt[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=rs.extractWidth(t);a===0?s=!1:a>n&&(n=a)}return rs.createPropertyValue(0,n,s)}},rs=class du{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=du.extractWidth(f);du.extractShouldJoin(f)&&(p-=du.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 qv(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 oa=2147483647,m2=256,Vb=class hd{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 hd;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 hd(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>oa?oa: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>oa?oa: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,oa):t}},ua=[],_2=class{constructor(){this._state=0,this._active=ua,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=ua}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=ua,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ua,!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",Eu(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=ua,this._id=-1,this._state=0}}},ji=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+=Eu(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}},ca=[],g2=class{constructor(){this._handlers=Object.create(null),this._active=ca,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ca}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=ca,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ca,!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",Eu(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=ca,this._ident=0}},ba=new Vb;ba.addParam(0);var Wv=class{constructor(e){this._handler=e,this._data="",this._params=ba,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ba,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Eu(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=ba,this._data="",this._hitLimit=!1,n));return this._params=ba,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}},Ji=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(Ji,0,2,0),e.add(Ji,8,5,8),e.add(Ji,6,0,6),e.add(Ji,11,0,11),e.add(Ji,13,13,13),e})(),b2=class extends Le{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 Vb,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(ct(()=>{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:Ji)],a>>4){case 2:for(let b=f+1;;++b){if(b>=t||(s=e[b])<32||s>126&&s<Ji){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Ji){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Ji){this._printHandler(e,f,b),f=b-1;break}if(++b>=t||(s=e[b])<32||s>126&&s<Ji){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<Ji){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<Ji){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 Yv(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 hf(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:${hf(n,t)}/${hf(s,t)}/${hf(a,t)}`}var C2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Cr=131072,Vv=10;function Kv(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 Xv=5e3,Gv=0,k2=class extends Le{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=At.clone(),this._eraseAttrDataInternal=At.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 fd(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(hu.IND,()=>this.index()),this._parser.setExecuteHandler(hu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(hu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ji(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new ji(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new ji(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new ji(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new ji(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new ji(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new ji(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new ji(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new ji(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new ji(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new ji(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new ji(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 Lt)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 Wv((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"),Xv))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Xv} 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>Cr&&(o=this._parseStack.position+Cr)}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<Cr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Cr))),c||this._dirtyRowTracker.clearRange(),e.length>Cr)for(let h=o;h<e.length;h+=Cr){let g=h+Cr<e.length?h+Cr: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 M=o[String.fromCharCode(s)];M&&(s=M.charCodeAt(0))}let x=this._unicodeService.charProperties(s,b);a=rs.extractWidth(x);let k=rs.extractShouldJoin(x),L=k?rs.extractWidth(b):0;if(b=x,c&&this._onA11yChar.fire(Er(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-L>f){if(p){let M=_,$=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 va&&_.copyCellsFrom(M,$,0,L,!1);$<f;)M.setCellFromCodepoint($++,0,1,g)}else if(this._activeBuffer.x=f-1,a===2)continue}if(k&&this._activeBuffer.x){let M=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-M,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=>Kv(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Wv(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ji(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(At));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=rs.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,ns),this._charsetService.setgCharset(1,ns),this._charsetService.setgCharset(2,ns),this._charsetService.setgCharset(3,ns);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|=Ma.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=At.fg,e.bg=At.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|=At.fg&16777215):n===49?(s.bg&=-67108864,s.bg|=At.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|=At.fg&16777215,s.bg&=-67108864,s.bg|=At.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=At.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(!Kv(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>Vv&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Vv&&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($v(o))if(a==="?")t.push({type:0,index:o});else{let c=Yv(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=Yv(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]);$v(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,ns),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(C2[e[0]],Lt[e[1]]||ns),!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=At.clone(),this._eraseAttrDataInternal=At.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 tn;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)}},fd=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&&(Gv=e,e=t,t=Gv),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};fd=vt([pe(0,mi)],fd);function $v(e){return 0<=e&&e<256}var E2=5e7,Zv=12,T2=50,A2=class extends Le{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>=Zv?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>=Zv)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()}},dd=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)))}};dd=vt([pe(0,mi)],dd);var Qv=!1,D2=class extends Le{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ll),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(_i,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(od)),this._instantiationService.setService(mi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ad)),this._instantiationService.setService(hb,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ud)),this._instantiationService.setService(us,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(cd)),this._instantiationService.setService(cb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(rs)),this._instantiationService.setService(Gx,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p2),this._instantiationService.setService(Xx,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(dd),this._instantiationService.setService(fb,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(ii.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ii.forward(this._bufferService.onResize,this._onResize)),this._register(ii.forward(this.coreService.onData,this._onData)),this._register(ii.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(ii.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&&!Qv&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Qv=!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,Wb),t=Math.max(t,Yb),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(qv.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(qv(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ct(()=>{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 St=0,B2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new bu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new bu,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||(St=this._search(t),St===-1)||this._getKey(this._array[St])!==t)return!1;do if(this._array[St]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(St),!0;while(++St<this._array.length&&this._getKey(this._array[St])===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&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do yield this._array[St];while(++St<this._array.length&&this._getKey(this._array[St])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(St=this._search(e),!(St<0||St>=this._array.length)&&this._getKey(this._array[St])===e))do t(this._array[St]);while(++St<this._array.length&&this._getKey(this._array[St])===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}},ff=0,Jv=0,N2=class extends Le{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(ct(()=>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=>{ff=a.options.x??0,Jv=ff+(a.options.width??1),e>=ff&&e<Jv&&(!n||(a.options.layer??"bottom")===n)&&s(a)})}},L2=class extends Dr{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=ft.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ft.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)}},ey=20,Su=class extends Le{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(Ee(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ct(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ey+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
74
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ey+1&&(this._liveRegion.textContent+=Nf.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})`}};Su=vt([pe(1,Td),pe(2,Xn),pe(3,Gn)],Su);var pd=class extends Le{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(ct(()=>{var o;ls(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(Ee(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ee(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ee(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ee(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,ls(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}}};pd=vt([pe(1,Ad),pe(2,Gn),pe(3,mi),pe(4,pb)],pd);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 ll),this.browser=Nb,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ll),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(Ba,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(TC),this._instantiationService.setService(pb,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zf)),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(ii.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ii.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ii.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ii.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ct(()=>{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=ot.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${re.ESC}]${s};${w2(a)}${Mb.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Dt.toColor(...t.color));else{let o=n;this._themeService.modifyColors(c=>c[o]=Dt.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(Su,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(Ee(this.element,"copy",t=>{this.hasSelection()&&Fx(t,this._selectionService)}));let e=t=>qx(t,this.textarea,this.coreService,this.optionsService);this._register(Ee(this.textarea,"paste",e)),this._register(Ee(this.element,"paste",e)),Lb?this._register(Ee(this.element,"mousedown",t=>{t.button===2&&cv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ee(this.element,"contextmenu",t=>{cv(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Od&&this._register(Ee(this.element,"auxclick",t=>{t.button===1&&sb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ee(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ee(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ee(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ee(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ee(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ee(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ee(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(Ee(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",Bf.get()),jb||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(Xn,this._coreBrowserService),this._register(Ee(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Ee(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(id,this._document,this._helperContainer),this._instantiationService.setService(Tu,this._charSizeService),this._themeService=this._instantiationService.createInstance(ld),this._instantiationService.setService(ol,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(vu),this._instantiationService.setService(db,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rd,this.rows,this.screenElement)),this._instantiationService.setService(Gn,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(Jf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(nd),this._instantiationService.setService(Ad,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(pd,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(Zf,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(sd,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(ii.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Qf,this.screenElement)),this._register(Ee(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(Su,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(td,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(Ee(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(Ee(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){rb(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)&&(P2(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(At));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 P2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var U2=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 tn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},ty=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 tn}},F2=class extends Le{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new he),this.onBufferChange=this._onBufferChange.event,this._normal=new ty(this._core.buffers.normal,"normal"),this._alternate=new ty(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"],mn=0,V2=class extends Le{constructor(e){super(),this._core=this._register(new H2(e)),this._addonManager=this._register(new U2),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 Bf.get()},set promptLabel(e){Bf.set(e)},get tooMuchOutput(){return Nf.get()},set tooMuchOutput(e){Nf.set(e)}}}_verifyIntegers(...e){for(mn of e)if(mn===1/0||isNaN(mn)||mn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(mn of e)if(mn&&(mn===1/0||isNaN(mn)||mn%1!==0||mn<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 K2=2,X2=1
|
|
86
|
+
*/var K2=2,X2=1,G2=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
|
|
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)&&jn(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&jn(c,p)&&jn(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=!jn(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?!jn(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(jn(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&&(jn(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=!jn(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,Cr="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(Cr)||s.createObjectStore(Cr)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function na(e,t){const n=t.length>ty?t.slice(-ty):t,s=await Ld();return new Promise((a,o)=>{const c=s.transaction(Cr,"readwrite");c.objectStore(Cr).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(Cr,"readonly").objectStore(Cr).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(Cr,"readwrite");a.objectStore(Cr).delete(e),a.oncomplete=()=>{t.close(),n()},a.onerror=()=>{t.close(),s(a.error)}})}const Nt=new Map;function lk({token:e,storyName:t,authFetch:n,onSelectStory:s,onDestroySession:a,onArchiveStory:o,confirmedStories:c,renameRef:f}){const p=$.useRef(null),h=$.useRef(n),[g,_]=$.useState([]),[b,y]=$.useState(new Set),[x,k]=$.useState(null),[L,M]=$.useState(null),G=$.useRef(()=>{});$.useEffect(()=>{h.current=n},[n]);const I=$.useCallback(B=>{var R;const{width:A}=B.container.getBoundingClientRect();if(!(A<50))try{B.fit.fit(),((R=B.ws)==null?void 0:R.readyState)===WebSocket.OPEN&&B.ws.send(JSON.stringify({type:"resize",cols:B.term.cols,rows:B.term.rows}))}catch{}},[]),Z=$.useCallback(B=>{for(const[A,R]of Nt)R.container.style.display=A===B?"block":"none";if(B){const A=Nt.get(B);A&&setTimeout(()=>I(A),50)}},[I]),W=$.useCallback((B,A,R)=>{const T=window.location.protocol==="https:"?"wss:":"ws:",j=new WebSocket(`${T}//${window.location.host}/ws/terminal?story=${encodeURIComponent(B)}&token=${e}&resume=${R}`);j.onopen=()=>{A.connected=!0,A._retried=!1,y(H=>{const ae=new Set(H);return ae.delete(B),ae}),j.send(JSON.stringify({type:"resize",cols:A.term.cols,rows:A.term.rows}))},j.onmessage=H=>{A.term.write(H.data)},j.onclose=H=>{if(A.connected=!1,A.ws===j){A.ws=null;try{const ae=A.serialize.serialize();na(B,ae).catch(()=>{})}catch{}if(H.code===4e3&&!A._retried){A._retried=!0,A.term.write(`\r
|
|
97
|
+
*/var Wt=0,Yt=0,Vt=0,gt=0,si;(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})(si||(si={}));var $2;(e=>{function t(p,h){if(gt=(h.rgba&255)/255,gt===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;Wt=y+Math.round((g-y)*gt),Yt=x+Math.round((_-x)*gt),Vt=k+Math.round((b-k)*gt);let L=si.toCss(Wt,Yt,Vt),M=si.toRgba(Wt,Yt,Vt);return{css:L,rgba:M}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function s(p,h,g){let _=pu.ensureContrastRatio(p.rgba,h.rgba,g);if(_)return si.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function a(p){let h=(p.rgba|255)>>>0;return[Wt,Yt,Vt]=pu.toChannels(h),{css:si.toCss(Wt,Yt,Vt),rgba:h}}e.opaque=a;function o(p,h){return gt=Math.round(h*255),[Wt,Yt,Vt]=pu.toChannels(p.rgba),{css:si.toCss(Wt,Yt,Vt,gt),rgba:si.toRgba(Wt,Yt,Vt,gt)}}e.opacity=o;function c(p,h){return gt=p.rgba&255,o(p,gt*h/255)}e.multiplyOpacity=c;function f(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=f})($2||($2={}));var ei;(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 Wt=parseInt(a.slice(1,2).repeat(2),16),Yt=parseInt(a.slice(2,3).repeat(2),16),Vt=parseInt(a.slice(3,4).repeat(2),16),si.toColor(Wt,Yt,Vt);case 5:return Wt=parseInt(a.slice(1,2).repeat(2),16),Yt=parseInt(a.slice(2,3).repeat(2),16),Vt=parseInt(a.slice(3,4).repeat(2),16),gt=parseInt(a.slice(4,5).repeat(2),16),si.toColor(Wt,Yt,Vt,gt);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 Wt=parseInt(o[1]),Yt=parseInt(o[2]),Vt=parseInt(o[3]),gt=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),si.toColor(Wt,Yt,Vt,gt);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),[Wt,Yt,Vt,gt]=t.getImageData(0,0,1,1).data,gt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:si.toRgba(Wt,Yt,Vt,gt),css:a}}e.toColor=s})(ei||(ei={}));var di;(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})(di||(di={}));var pu;(e=>{function t(c,f){if(gt=(f&255)/255,gt===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 Wt=_+Math.round((p-_)*gt),Yt=b+Math.round((h-b)*gt),Vt=y+Math.round((g-y)*gt),si.toRgba(Wt,Yt,Vt)}e.blend=t;function n(c,f,p){let h=di.relativeLuminance(c>>8),g=di.relativeLuminance(f>>8);if(Yn(h,g)<p){if(g<h){let y=s(c,f,p),x=Yn(h,di.relativeLuminance(y>>8));if(x<p){let k=a(c,f,p),L=Yn(h,di.relativeLuminance(k>>8));return x>L?y:k}return y}let _=a(c,f,p),b=Yn(h,di.relativeLuminance(_>>8));if(b<p){let y=s(c,f,p),x=Yn(h,di.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=Yn(di.relativeLuminance2(b,y,x),di.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=Yn(di.relativeLuminance2(b,y,x),di.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=Yn(di.relativeLuminance2(b,y,x),di.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=Yn(di.relativeLuminance2(b,y,x),di.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})(pu||(pu={}));function Jr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Yn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Z2=Object.freeze((()=>{let e=[ei.toColor("#2e3436"),ei.toColor("#cc0000"),ei.toColor("#4e9a06"),ei.toColor("#c4a000"),ei.toColor("#3465a4"),ei.toColor("#75507b"),ei.toColor("#06989a"),ei.toColor("#d3d7cf"),ei.toColor("#555753"),ei.toColor("#ef2929"),ei.toColor("#8ae234"),ei.toColor("#fce94f"),ei.toColor("#729fcf"),ei.toColor("#ad7fa8"),ei.toColor("#34e2e2"),ei.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:si.toCss(s,a,o),rgba:si.toRgba(s,a,o)})}for(let n=0;n<24;n++){let s=8+n*10;e.push({css:si.toCss(s,s,s),rgba:si.toRgba(s,s,s)})}return e})());function iy(e,t,n){return Math.max(t,Math.min(e,n))}function Q2(e){switch(e){case"&":return"&";case"<":return"<"}return e}var Kb=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 Xb(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function Vn(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function Gb(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 Kb{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&&!Vn(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)&&Vn(c,p)&&(g=!0),h&&(f.getChars()||f.getWidth()===0)&&Vn(c,p)&&Vn(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=!Xb(e,t),a=!Vn(e,t),o=!Gb(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?!Vn(this._cursorStyle,e):o.length>0){this._nullCellCount>0&&(Vn(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&&(Vn(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:iy(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:iy(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 Kb{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=!Xb(e,t),a=!Vn(e,t),o=!Gb(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,Rr="scrollback",ny=10*1024*1024;function jd(){return new Promise((e,t)=>{const n=indexedDB.open(nk,rk);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains(Rr)||s.createObjectStore(Rr)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}async function ha(e,t){const n=t.length>ny?t.slice(-ny):t,s=await jd();return new Promise((a,o)=>{const c=s.transaction(Rr,"readwrite");c.objectStore(Rr).put(n,e),c.oncomplete=()=>{s.close(),a()},c.onerror=()=>{s.close(),o(c.error)}})}async function sk(e){const t=await jd();return new Promise((n,s)=>{const o=t.transaction(Rr,"readonly").objectStore(Rr).get(e);o.onsuccess=()=>{t.close(),n(o.result??null)},o.onerror=()=>{t.close(),s(o.error)}})}async function ry(e){const t=await jd();return new Promise((n,s)=>{const a=t.transaction(Rr,"readwrite");a.objectStore(Rr).delete(e),a.oncomplete=()=>{t.close(),n()},a.onerror=()=>{t.close(),s(a.error)}})}const Nt=new Map;function lk({token:e,storyName:t,authFetch:n,onSelectStory:s,onDestroySession:a,onArchiveStory:o,confirmedStories:c,renameRef:f}){const p=V.useRef(null),h=V.useRef(n),[g,_]=V.useState([]),[b,y]=V.useState(new Set),[x,k]=V.useState(null),[L,M]=V.useState(null),$=V.useRef(()=>{});V.useEffect(()=>{h.current=n},[n]);const I=V.useCallback(B=>{var R;const{width:A}=B.container.getBoundingClientRect();if(!(A<50))try{B.fit.fit(),((R=B.ws)==null?void 0:R.readyState)===WebSocket.OPEN&&B.ws.send(JSON.stringify({type:"resize",cols:B.term.cols,rows:B.term.rows}))}catch{}},[]),Z=V.useCallback(B=>{for(const[A,R]of Nt)R.container.style.display=A===B?"block":"none";if(B){const A=Nt.get(B);A&&setTimeout(()=>I(A),50)}},[I]),W=V.useCallback((B,A,R)=>{const T=window.location.protocol==="https:"?"wss:":"ws:",j=new WebSocket(`${T}//${window.location.host}/ws/terminal?story=${encodeURIComponent(B)}&token=${e}&resume=${R}`);j.onopen=()=>{A.connected=!0,A._retried=!1,y(H=>{const le=new Set(H);return le.delete(B),le}),j.send(JSON.stringify({type:"resize",cols:A.term.cols,rows:A.term.rows}))},j.onmessage=H=>{A.term.write(H.data)},j.onclose=H=>{if(A.connected=!1,A.ws===j){A.ws=null;try{const le=A.serialize.serialize();ha(B,le).catch(()=>{})}catch{}if(H.code===4e3&&!A._retried){A._retried=!0,A.term.write(`\r
|
|
99
99
|
\x1B[33m[Resume failed — starting fresh session...]\x1B[0m\r
|
|
100
|
-
`)
|
|
101
|
-
`),iy(B).catch(()=>{}),A.observer.disconnect(),A.ws&&A.ws.close(),A.term.dispose(),A.container.remove(),Nt.delete(B),_(T=>T.filter(j=>j!==B)),y(T=>{const j=new Set(T);return j.delete(B),j}),n(`/api/terminal/${encodeURIComponent(B)}/discard`,{method:"DELETE"}).catch(()=>{}),a==null||a(B))},[n,a]),U=$.useCallback(async(B,A)=>{const R=Nt.get(B);if(!R||Nt.has(A)||!(await h.current("/api/terminal/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:B,newName:A})})).ok)return!1;Nt.delete(B),Nt.set(A,R);try{const j=R.serialize.serialize();await iy(B),await na(A,j)}catch{}return _(j=>j.map(H=>H===B?A:H)),y(j=>{if(!j.has(B))return j;const H=new Set(j);return H.delete(B),H.add(A),H}),!0},[]);$.useEffect(()=>(f&&(f.current=U),()=>{f&&(f.current=null)}),[f,U]),$.useEffect(()=>{t&&(Nt.has(t)?Z(t):h.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(B=>B.ok?B.json():null).then(B=>{if(!Nt.has(t)){const A=(B==null?void 0:B.sessionId)&&!(B!=null&&B.running);O(t,{autoConnect:!A}),Z(t)}}).catch(()=>{Nt.has(t)||(O(t),Z(t))}))},[t,O,Z]),$.useEffect(()=>{const B=setInterval(()=>{for(const[A,R]of Nt)if(R.connected)try{const T=R.serialize.serialize();na(A,T).catch(()=>{})}catch{}},3e4);return()=>clearInterval(B)},[]),$.useEffect(()=>()=>{for(const[B,A]of Nt){try{const R=A.serialize.serialize();na(B,R).catch(()=>{})}catch{}A.observer.disconnect(),A.ws&&A.ws.close(),A.term.dispose(),A.container.remove(),h.current(`/api/terminal/${encodeURIComponent(B)}`,{method:"DELETE"}).catch(()=>{})}Nt.clear()},[]);const se=t?b.has(t):!1,V=g.length===0;return S.jsxs("div",{className:"h-full flex flex-col",children:[!V&&S.jsxs("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:[g.map(B=>S.jsxs("div",{onClick:()=>s==null?void 0:s(B),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${B===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(B)?"bg-amber-500":B===t?"bg-green-600":"bg-muted/50"}`}),S.jsx("span",{className:`truncate max-w-[120px] ${B.startsWith("_new_")?"italic":""}`,children:B.startsWith("_new_")?"Untitled":B}),S.jsx("button",{onClick:A=>{A.stopPropagation(),B.startsWith("_new_")?k(B):ue(B)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},B)),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:()=>M(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"}),V&&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 B=x;k(null),_e(B)},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:()=>M(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:async()=>{const B=L;M(null);try{(await h.current("/api/stories/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})})).ok&&(ue(B),o==null||o(B))}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:()=>te(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:()=>te(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 Ta{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Ta.prototype.normal={};Ta.prototype.property={};Ta.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 Ta(n,s,t)}function fd(e){return e.toLowerCase()}class Si{constructor(t,n){this.attribute=n,this.property=t}}Si.prototype.attribute="";Si.prototype.booleanish=!1;Si.prototype.boolean=!1;Si.prototype.commaOrSpaceSeparated=!1;Si.prototype.commaSeparated=!1;Si.prototype.defined=!1;Si.prototype.mustUseProperty=!1;Si.prototype.number=!1;Si.prototype.overloadedBoolean=!1;Si.prototype.property="";Si.prototype.spaceSeparated=!1;Si.prototype.space=void 0;let dk=0;const Me=ns(),Tt=ns(),dd=ns(),oe=ns(),rt=ns(),Zs=ns(),Mi=ns();function ns(){return 2**++dk}const pd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Me,booleanish:Tt,commaOrSpaceSeparated:Mi,commaSeparated:Zs,number:oe,overloadedBoolean:dd,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),cf=Object.keys(pd);class zd extends Si{constructor(t,n,s,a){let o=-1;if(super(t,n),sy(this,"space",a),typeof s=="number")for(;++o<cf.length;){const c=cf[o];sy(this,cf[o],(s&pd[c])===pd[c])}}}zd.prototype.defined=!0;function sy(e,t,n){n&&(e[t]=n)}function il(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 Ta(t,n,e.space)}const $b=il({properties:{ariaActiveDescendant:null,ariaAtomic:Tt,ariaAutoComplete:null,ariaBusy:Tt,ariaChecked:Tt,ariaColCount:oe,ariaColIndex:oe,ariaColSpan:oe,ariaControls:rt,ariaCurrent:null,ariaDescribedBy:rt,ariaDetails:null,ariaDisabled:Tt,ariaDropEffect:rt,ariaErrorMessage:null,ariaExpanded:Tt,ariaFlowTo:rt,ariaGrabbed:Tt,ariaHasPopup:null,ariaHidden:Tt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rt,ariaLevel:oe,ariaLive:null,ariaModal:Tt,ariaMultiLine:Tt,ariaMultiSelectable:Tt,ariaOrientation:null,ariaOwns:rt,ariaPlaceholder:null,ariaPosInSet:oe,ariaPressed:Tt,ariaReadOnly:Tt,ariaRelevant:null,ariaRequired:Tt,ariaRoleDescription:rt,ariaRowCount:oe,ariaRowIndex:oe,ariaRowSpan:oe,ariaSelected:Tt,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 Gb(e,t){return t in e?e[t]:t}function Zb(e,t){return Gb(e,t.toLowerCase())}const pk=il({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Zs,acceptCharset:rt,accessKey:rt,action:null,allow:null,allowFullScreen:Me,allowPaymentRequest:Me,allowUserMedia:Me,alt:null,as:null,async:Me,autoCapitalize:null,autoComplete:rt,autoFocus:Me,autoPlay:Me,blocking:rt,capture:null,charSet:null,checked:Me,cite:null,className:rt,cols:oe,colSpan:null,content:null,contentEditable:Tt,controls:Me,controlsList:rt,coords:oe|Zs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Me,defer:Me,dir:null,dirName:null,disabled:Me,download:dd,draggable:Tt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Me,formTarget:null,headers:rt,height:oe,hidden:dd,high:oe,href:null,hrefLang:null,htmlFor:rt,httpEquiv:rt,id:null,imageSizes:null,imageSrcSet:null,inert:Me,inputMode:null,integrity:null,is:null,isMap:Me,itemId:null,itemProp:rt,itemRef:rt,itemScope:Me,itemType:rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Me,low:oe,manifest:null,max:null,maxLength:oe,media:null,method:null,min:null,minLength:oe,multiple:Me,muted:Me,name:null,nonce:null,noModule:Me,noValidate:Me,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:Me,optimum:oe,pattern:null,ping:rt,placeholder:null,playsInline:Me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Me,referrerPolicy:null,rel:rt,required:Me,reversed:Me,rows:oe,rowSpan:oe,sandbox:rt,scope:null,scoped:Me,seamless:Me,selected:Me,shadowRootClonable:Me,shadowRootDelegatesFocus:Me,shadowRootMode:null,shape:null,size:oe,sizes:null,slot:null,span:oe,spellCheck:Tt,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:Me,useMap:null,value:Tt,width:oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rt,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:Me,declare:Me,event:null,face:null,frame:null,frameBorder:null,hSpace:oe,leftMargin:oe,link:null,longDesc:null,lowSrc:null,marginHeight:oe,marginWidth:oe,noResize:Me,noHref:Me,noShade:Me,noWrap:Me,object:null,profile:null,prompt:null,rev:null,rightMargin:oe,rules:null,scheme:null,scrolling:Tt,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:Me,disableRemotePlayback:Me,prefix:null,property:null,results:oe,security:null,unselectable:null},space:"html",transform:Zb}),mk=il({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:Mi,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:rt,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:Me,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:Zs,g2:Zs,glyphName:Zs,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:Mi,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:rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oe,pointsAtY:oe,pointsAtZ:oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mi,rev:Mi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mi,requiredFeatures:Mi,requiredFonts:Mi,requiredFormats:Mi,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:Mi,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:Mi,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:Mi,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:Gb}),Qb=il({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=il({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Zb}),eS=il({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=Si;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 Ys={},hf,ay;function Ck(){if(ay)return hf;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,M){if(typeof L!="string")throw new TypeError("First argument must be a string");if(!L)return[];M=M||{};var G=1,I=1;function Z(A){var R=A.match(t);R&&(G+=R.length);var T=A.lastIndexOf(p);I=~T?A.length-T:I+A.length}function W(){var A={line:G,column:I};return function(R){return R.position=new O(A),_e(),R}}function O(A){this.start=A,this.end={line:G,column:I},this.source=M.source}O.prototype.content=L;function te(A){var R=new Error(M.source+":"+G+":"+I+": "+A);if(R.reason=A,R.filename=M.source,R.line=G,R.column=I,R.source=L,!M.silent)throw R}function ue(A){var R=A.exec(L);if(R){var T=R[0];return Z(T),L=L.slice(T.length),R}}function _e(){ue(n)}function U(A){var R;for(A=A||[];R=se();)R!==!1&&A.push(R);return A}function se(){var A=W();if(!(h!=L.charAt(0)||g!=L.charAt(1))){for(var R=2;_!=L.charAt(R)&&(g!=L.charAt(R)||h!=L.charAt(R+1));)++R;if(R+=2,_===L.charAt(R-1))return te("End of comment missing");var T=L.slice(2,R-2);return I+=2,Z(T),L=L.slice(R),I+=2,A({type:b,comment:T})}}function V(){var A=W(),R=ue(s);if(R){if(se(),!ue(a))return te("property missing ':'");var T=ue(o),j=A({type:y,property:k(R[0].replace(e,_)),value:T?k(T[0].replace(e,_)):_});return ue(c),j}}function B(){var A=[];U(A);for(var R;R=V();)R!==!1&&(A.push(R),U(A));return A}return _e(),B()}function k(L){return L?L.replace(f,_):_}return hf=x,hf}var oy;function kk(){if(oy)return Ys;oy=1;var e=Ys&&Ys.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.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 Ys}var ra={},uy;function Ek(){if(uy)return ra;uy=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.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 ra.camelCase=p,ra}var sa,cy;function Tk(){if(cy)return sa;cy=1;var e=sa&&sa.__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,sa=s,sa}var Ak=Tk();const Dk=xu(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 pa(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 si 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=pa(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}}si.prototype.file="";si.prototype.name="";si.prototype.reason="";si.prototype.message="";si.prototype.stack="";si.prototype.column=void 0;si.prototype.line=void 0;si.prototype.ancestors=void 0;si.prototype.cause=void 0;si.prototype.fatal=void 0;si.prototype.place=void 0;si.prototype.ruleId=void 0;si.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 Pk(e,t,n);if(t.type==="text")return Uk(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=Ud(e,t);return Bk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!fk(p):!0})),lS(e,c,o,t),Pd(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)}ba(e,t.position)}function jk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ba(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=Ud(e,t);return lS(e,c,o,t),Pd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Pk(e,t,n){const s={};return Pd(s,Ud(e,t)),e.create(t,e.Fragment,s,n)}function Uk(e,t){return t.value}function lS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Pd(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 ba(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 ba(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function Ud(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 si("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);ba(e)}function ba(e,t){const n=new si("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 ff={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 Bi(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 Ki(e,t){return e.length>0?(Bi(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]);Bi(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 en(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ui=kr(/[A-Za-z]/),ri=kr(/[\dA-Za-z]/),eE=kr(/[#-'*+\--9=?A-Z^-~]/);function yu(e){return e!==null&&(e<32||e===127)}const _d=kr(/\d/),tE=kr(/[\dA-Fa-f]/),iE=kr(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function it(e){return e!==null&&(e<0||e===32)}function je(e){return e===-2||e===-1||e===32}const Tu=kr(new RegExp("\\p{P}|\\p{S}","u")),ts=kr(/\s/);function kr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function nl(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&ri(e.charCodeAt(n+1))&&ri(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 Ie(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return je(p)?(e.enter(n),f(p)):t(p)}function f(p){return je(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"),Ie(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 Se(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&&G();const Z=t.events.length;let W=Z,O;for(;W--;)if(t.events[W][0]==="exit"&&t.events[W][1].type==="chunkFlow"){O=t.events[W][1].end;break}M(s);let te=Z;for(;te<t.events.length;)t.events[te][1].end={...O},te++;return Bi(t.events,W+1,0,t.events.slice(Z)),t.events.length=te,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&&G(),M(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&&G(),M(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),M(0),e.consume(I);return}return Se(I)?(e.consume(I),L(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),k)}function L(I,Z){const W=t.sliceStream(I);if(Z&&W.push(null),I.previous=o,o&&(o.next=I),o=I,a.defineSkip(I.start),a.write(W),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 te=t.events.length;let ue=te,_e,U;for(;ue--;)if(t.events[ue][0]==="exit"&&t.events[ue][1].type==="chunkFlow"){if(_e){U=t.events[ue][1].end;break}_e=!0}for(M(s),O=te;O<t.events.length;)t.events[O][1].end={...U},O++;Bi(t.events,ue+1,0,t.events.slice(te)),t.events.length=O}}function M(I){let Z=n.length;for(;Z-- >I;){const W=n[Z];t.containerState=W[1],W[0].exit.call(t,e)}n.length=I}function G(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function aE(e,t,n){return Ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Js(e){if(e===null||it(e)||ts(e))return 1;if(Tu(e))return 2}function Au(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=Ki(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=Ki(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Ki(h,Au(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=Ki(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=Ki(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Bi(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=Js(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=Js(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 ui(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||ri(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||ri(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||yu(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 ri(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||ri(y))&&s++<63){const x=y===45?b:_;return e.consume(y),x}return n(y)}}const Aa={partial:!0,tokenize:fE};function fE(e,t,n){return s;function s(o){return je(o)?Ie(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Se(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 je(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 je(c)?Ie(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=ri,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===ri&&!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:W};let o=0,c=0,f;return p;function p(O){return h(O)}function h(O){const te=s.events[s.events.length-1];return o=te&&te[1].type==="linePrefix"?te[2].sliceSerialize(te[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"),je(O)?Ie(e,_,"whitespace")(O):_(O))}function _(O){return O===null||Se(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||Se(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(O)):je(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,y,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),b)}function y(O){return O===null||Se(O)?_(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||Se(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"),M}function M(O){return o>0&&je(O)?Ie(e,G,"linePrefix",o+1)(O):G(O)}function G(O){return O===null||Se(O)?e.check(vy,k,Z)(O):(e.enter("codeFlowValue"),I(O))}function I(O){return O===null||Se(O)?(e.exit("codeFlowValue"),G(O)):(e.consume(O),I)}function Z(O){return e.exit("codeFenced"),t(O)}function W(O,te,ue){let _e=0;return U;function U(R){return O.enter("lineEnding"),O.consume(R),O.exit("lineEnding"),se}function se(R){return O.enter("codeFencedFence"),je(R)?Ie(O,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):V(R)}function V(R){return R===f?(O.enter("codeFencedFenceSequence"),B(R)):ue(R)}function B(R){return R===f?(_e++,O.consume(R),B):_e>=c?(O.exit("codeFencedFenceSequence"),je(R)?Ie(O,A,"whitespace")(R):A(R)):ue(R)}function A(R){return R===null||Se(R)?(O.exit("codeFencedFence"),te(R)):ue(R)}}}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 df={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"),Ie(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):Se(h)?e.attempt(bE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Se(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):Se(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Ie(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):Se(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(_)):Se(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(_))}function h(_){return _===null||_===32||_===96||Se(_)?(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&&la(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),la(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),la(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);la(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);la(this.left,n.reverse())}}}function la(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 Bi(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 M=f.slice(L[b],L[b+1]),G=o.pop();p.push([G,G+M.length-1]),e.splice(G,2,M)}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):Se(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"),Ie(e,o,"linePrefix")}function o(c){if(c===null||Se(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 _(M){return M===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(M),e.exit(o),b):M===null||M===32||M===41||yu(M)?n(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(M))}function b(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(M))}function y(M){return M===62?(e.exit("chunkString"),e.exit(f),b(M)):M===null||M===60||Se(M)?n(M):(e.consume(M),M===92?x:y)}function x(M){return M===60||M===62||M===92?(e.consume(M),y):y(M)}function k(M){return!g&&(M===null||M===41||it(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):g<h&&M===40?(e.consume(M),g++,k):M===41?(e.consume(M),g--,k):M===null||M===32||M===40||yu(M)?n(M):(e.consume(M),M===92?L:k)}function L(M){return M===40||M===41||M===92?(e.consume(M),k):k(M)}}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):Se(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||Se(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!je(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):Se(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Ie(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||Se(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 ma(e,t){let n;return s;function s(a){return Se(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):je(a)?Ie(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=en(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 it(y)?ma(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 je(y)?Ie(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Se(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function jE(e,t,n){return s;function s(f){return it(f)?ma(e,a)(f):n(f)}function a(f){return gS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return je(f)?Ie(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Se(f)?t(f):n(f)}}const HE={name:"hardBreakEscape",tokenize:PE};function PE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Se(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const UE={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"},Bi(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||it(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Se(g)?(e.exit("atxHeading"),t(g)):je(g)?Ie(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||it(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(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,k):C===63?(e.consume(C),a=3,s.interrupt?t:E):ui(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):ui(C)?(e.consume(C),a=4,s.interrupt?t:E):n(C)}function y(C){return C===45?(e.consume(C),s.interrupt?t:E):n(C)}function x(C){const Q="CDATA[";return C===Q.charCodeAt(f++)?(e.consume(C),f===Q.length?s.interrupt?t:V:x):n(C)}function k(C){return ui(C)?(e.consume(C),c=String.fromCharCode(C),L):n(C)}function L(C){if(C===null||C===47||C===62||it(C)){const Q=C===47,fe=c.toLowerCase();return!Q&&!o&&by.includes(fe)?(a=1,s.interrupt?t(C):V(C)):qE.includes(c.toLowerCase())?(a=6,Q?(e.consume(C),M):s.interrupt?t(C):V(C)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):o?G(C):I(C))}return C===45||ri(C)?(e.consume(C),c+=String.fromCharCode(C),L):n(C)}function M(C){return C===62?(e.consume(C),s.interrupt?t:V):n(C)}function G(C){return je(C)?(e.consume(C),G):U(C)}function I(C){return C===47?(e.consume(C),U):C===58||C===95||ui(C)?(e.consume(C),Z):je(C)?(e.consume(C),I):U(C)}function Z(C){return C===45||C===46||C===58||C===95||ri(C)?(e.consume(C),Z):W(C)}function W(C){return C===61?(e.consume(C),O):je(C)?(e.consume(C),W):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,te):je(C)?(e.consume(C),O):ue(C)}function te(C){return C===p?(e.consume(C),p=null,_e):C===null||Se(C)?n(C):(e.consume(C),te)}function ue(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||it(C)?W(C):(e.consume(C),ue)}function _e(C){return C===47||C===62||je(C)?I(C):n(C)}function U(C){return C===62?(e.consume(C),se):n(C)}function se(C){return C===null||Se(C)?V(C):je(C)?(e.consume(C),se):n(C)}function V(C){return C===45&&a===2?(e.consume(C),T):C===60&&a===1?(e.consume(C),j):C===62&&a===4?(e.consume(C),D):C===63&&a===3?(e.consume(C),E):C===93&&a===5?(e.consume(C),ae):Se(C)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(YE,K,B)(C)):C===null||Se(C)?(e.exit("htmlFlowData"),B(C)):(e.consume(C),V)}function B(C){return e.check(VE,A,K)(C)}function A(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),R}function R(C){return C===null||Se(C)?B(C):(e.enter("htmlFlowData"),V(C))}function T(C){return C===45?(e.consume(C),E):V(C)}function j(C){return C===47?(e.consume(C),c="",H):V(C)}function H(C){if(C===62){const Q=c.toLowerCase();return by.includes(Q)?(e.consume(C),D):V(C)}return ui(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),H):V(C)}function ae(C){return C===93?(e.consume(C),E):V(C)}function E(C){return C===62?(e.consume(C),D):C===45&&a===2?(e.consume(C),E):V(C)}function D(C){return C===null||Se(C)?(e.exit("htmlFlowData"),K(C)):(e.consume(C),D)}function K(C){return e.exit("htmlFlow"),t(C)}}function $E(e,t,n){const s=this;return a;function a(c){return Se(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(Aa,t,n)}}const ZE={name:"htmlText",tokenize:QE};function QE(e,t,n){const s=this;let a,o,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),p}function p(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),W):E===63?(e.consume(E),I):ui(E)?(e.consume(E),ue):n(E)}function h(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),o=0,x):ui(E)?(e.consume(E),G):n(E)}function g(E){return E===45?(e.consume(E),y):n(E)}function _(E){return E===null?n(E):E===45?(e.consume(E),b):Se(E)?(c=_,j(E)):(e.consume(E),_)}function b(E){return E===45?(e.consume(E),y):_(E)}function y(E){return E===62?T(E):E===45?b(E):_(E)}function x(E){const D="CDATA[";return E===D.charCodeAt(o++)?(e.consume(E),o===D.length?k:x):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),L):Se(E)?(c=k,j(E)):(e.consume(E),k)}function L(E){return E===93?(e.consume(E),M):k(E)}function M(E){return E===62?T(E):E===93?(e.consume(E),M):k(E)}function G(E){return E===null||E===62?T(E):Se(E)?(c=G,j(E)):(e.consume(E),G)}function I(E){return E===null?n(E):E===63?(e.consume(E),Z):Se(E)?(c=I,j(E)):(e.consume(E),I)}function Z(E){return E===62?T(E):I(E)}function W(E){return ui(E)?(e.consume(E),O):n(E)}function O(E){return E===45||ri(E)?(e.consume(E),O):te(E)}function te(E){return Se(E)?(c=te,j(E)):je(E)?(e.consume(E),te):T(E)}function ue(E){return E===45||ri(E)?(e.consume(E),ue):E===47||E===62||it(E)?_e(E):n(E)}function _e(E){return E===47?(e.consume(E),T):E===58||E===95||ui(E)?(e.consume(E),U):Se(E)?(c=_e,j(E)):je(E)?(e.consume(E),_e):T(E)}function U(E){return E===45||E===46||E===58||E===95||ri(E)?(e.consume(E),U):se(E)}function se(E){return E===61?(e.consume(E),V):Se(E)?(c=se,j(E)):je(E)?(e.consume(E),se):_e(E)}function V(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,B):Se(E)?(c=V,j(E)):je(E)?(e.consume(E),V):(e.consume(E),A)}function B(E){return E===a?(e.consume(E),a=void 0,R):E===null?n(E):Se(E)?(c=B,j(E)):(e.consume(E),B)}function A(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||it(E)?_e(E):(e.consume(E),A)}function R(E){return E===47||E===62||it(E)?_e(E):n(E)}function T(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function j(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),H}function H(E){return je(E)?Ie(e,ae,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ae(E)}function ae(E){return e.enter("htmlTextData"),c(E)}}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&&Bi(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=Ki(f,e.slice(o+1,o+s+3)),f=Ki(f,[["enter",g,t]]),f=Ki(f,Au(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=Ki(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=Ki(f,e.slice(c+1)),f=Ki(f,[["exit",p,t]]),Bi(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(en(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 it(_)?ma(e,o)(_):o(_)}function o(_){return _===41?g(_):mS(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return it(_)?ma(e,p)(_):g(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?gS(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):g(_)}function h(_){return it(_)?ma(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(en(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 pf={name:"lineEnding",tokenize:f5};function f5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const fu={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||Se(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),je(h)?Ie(e,f,"whitespace")(h):f(h))}}const bi={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(fu,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(Aa,s.interrupt?n:g,e.attempt(p5,b,_))}function g(y){return s.containerState.initialBlankLine=!0,o++,b(y)}function _(y){return je(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(Aa,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ie(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!je(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,Ie(e,e.attempt(bi,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function v5(e,t,n){const s=this;return Ie(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 Ie(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!je(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"),je(h)?Ie(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Se(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const w5={tokenize:C5};function C5(e){const t=this,n=e.attempt(Aa,s,e.attempt(this.parser.constructs.flowInitial,a,Ie(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:bi,43:bi,45:bi,48:bi,49:bi,50:bi,51:bi,52:bi,53:bi,54:bi,55:bi,56:bi,57:bi,62:hS},R5={91:LE},M5={[-2]:df,[-1]:df,32:df},B5={35:UE,42:fu,45:[Sy,fu],60:WE,61:Sy,95:fu,96:yy,126:yy},N5={38:dS,92:fS},L5={[-5]:pf,[-4]:pf,[-3]:pf,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 P5(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:te(W),check:te(O),consume:G,enter:I,exit:Z,interrupt:te(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=Ki(c,se),L(),c[c.length-1]!==null?[]:(ue(t,0),h.events=Au(o,h.events,h),h.events)}function b(se,V){return I5(y(se),V)}function y(se){return U5(c,se)}function x(){const{_bufferIndex:se,_index:V,line:B,column:A,offset:R}=s;return{_bufferIndex:se,_index:V,line:B,column:A,offset:R}}function k(se){a[se.line]=se.column,U()}function L(){let se;for(;s._index<c.length;){const V=c[s._index];if(typeof V=="string")for(se=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===se&&s._bufferIndex<V.length;)M(V.charCodeAt(s._bufferIndex));else M(V)}}function M(se){g=g(se)}function G(se){Se(se)?(s.line++,s.column=1,s.offset+=se===-3?2:1,U()):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,V){const B=V||{};return B.type=se,B.start=x(),h.events.push(["enter",B,h]),f.push(B),B}function Z(se){const V=f.pop();return V.end=x(),h.events.push(["exit",V,h]),V}function W(se,V){ue(se,V.from)}function O(se,V){V.restore()}function te(se,V){return B;function B(A,R,T){let j,H,ae,E;return Array.isArray(A)?K(A):"tokenize"in A?K([A]):D(A);function D(de){return Ce;function Ce(Le){const Ee=Le!==null&&de[Le],st=Le!==null&&de.null,Ye=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(st)?st:st?[st]:[]];return K(Ye)(Le)}}function K(de){return j=de,H=0,de.length===0?T:C(de[H])}function C(de){return Ce;function Ce(Le){return E=_e(),ae=de,de.partial||(h.currentConstruct=de),de.name&&h.parser.constructs.disable.null.includes(de.name)?fe():de.tokenize.call(V?Object.assign(Object.create(h),V):h,p,Q,fe)(Le)}}function Q(de){return se(ae,E),R}function fe(de){return E.restore(),++H<j.length?C(j[H]):T}}}function ue(se,V){se.resolveAll&&!o.includes(se)&&o.push(se),se.resolve&&Bi(h.events,V,h.events.length-V,se.resolve(h.events.slice(V),h)),se.resolveTo&&(h.events=se.resolveTo(h.events,h))}function _e(){const se=x(),V=h.previous,B=h.currentConstruct,A=h.events.length,R=Array.from(f);return{from:A,restore:T};function T(){s=se,h.previous=V,h.currentConstruct=B,h.events.length=A,f=R,U()}}function U(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function U5(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=`
|
|
100
|
+
`),$.current(B,A,!1);return}y(le=>new Set(le).add(B))}},A.term.onData(H=>{j.readyState===WebSocket.OPEN&&j.send(H)}),A.ws=j},[e]);V.useEffect(()=>{$.current=W},[W]);const O=V.useCallback(async(B,A)=>{if(!p.current||Nt.has(B))return;const{resume:R=!1,autoConnect:T=!0}=A??{},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 H=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}),le=new G2,E=new ek;H.loadAddon(le),H.loadAddon(E),H.open(j);const D={term:H,fit:le,serialize:E,ws:null,container:j,observer:null,connected:!1},X=new ResizeObserver(()=>{var Q;const{width:C}=j.getBoundingClientRect();if(!(C<50))try{le.fit(),((Q=D.ws)==null?void 0:Q.readyState)===WebSocket.OPEN&&D.ws.send(JSON.stringify({type:"resize",cols:H.cols,rows:H.rows}))}catch{}});X.observe(j),D.observer=X,Nt.set(B,D),_(C=>[...C,B]);try{const C=await sk(B);C&&H.write(C)}catch{}T?W(B,D,R):y(C=>new Set(C).add(B)),setTimeout(()=>I(D),50)},[W,I]),te=V.useCallback(async(B,A)=>{const R=Nt.get(B);R&&(R.ws&&(R.ws.close(),R.ws=null),A||(await h.current(`/api/terminal/${encodeURIComponent(B)}`,{method:"DELETE"}).catch(()=>{}),R.term.clear()),W(B,R,A))},[W]),oe=V.useCallback(B=>{const A=Nt.get(B);if(A){try{const R=A.serialize.serialize();ha(B,R).catch(()=>{})}catch{}A.observer.disconnect(),A.ws&&A.ws.close(),A.term.dispose(),A.container.remove(),Nt.delete(B),_(R=>R.filter(T=>T!==B)),y(R=>{const T=new Set(R);return T.delete(B),T}),n(`/api/terminal/${encodeURIComponent(B)}`,{method:"DELETE"}).catch(()=>{}),a==null||a(B)}},[n,a]),me=V.useCallback(B=>{var R;const A=Nt.get(B);A&&(((R=A.ws)==null?void 0:R.readyState)===WebSocket.OPEN&&A.ws.send(`exit
|
|
101
|
+
`),ry(B).catch(()=>{}),A.observer.disconnect(),A.ws&&A.ws.close(),A.term.dispose(),A.container.remove(),Nt.delete(B),_(T=>T.filter(j=>j!==B)),y(T=>{const j=new Set(T);return j.delete(B),j}),n(`/api/terminal/${encodeURIComponent(B)}/discard`,{method:"DELETE"}).catch(()=>{}),a==null||a(B))},[n,a]),U=V.useCallback(async(B,A)=>{const R=Nt.get(B);if(!R||Nt.has(A)||!(await h.current("/api/terminal/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:B,newName:A})})).ok)return!1;Nt.delete(B),Nt.set(A,R);try{const j=R.serialize.serialize();await ry(B),await ha(A,j)}catch{}return _(j=>j.map(H=>H===B?A:H)),y(j=>{if(!j.has(B))return j;const H=new Set(j);return H.delete(B),H.add(A),H}),!0},[]);V.useEffect(()=>(f&&(f.current=U),()=>{f&&(f.current=null)}),[f,U]),V.useEffect(()=>{t&&(Nt.has(t)?Z(t):h.current(`/api/terminal/session/${encodeURIComponent(t)}`).then(B=>B.ok?B.json():null).then(B=>{if(!Nt.has(t)){const A=(B==null?void 0:B.sessionId)&&!(B!=null&&B.running);O(t,{autoConnect:!A}),Z(t)}}).catch(()=>{Nt.has(t)||(O(t),Z(t))}))},[t,O,Z]),V.useEffect(()=>{const B=setInterval(()=>{for(const[A,R]of Nt)if(R.connected)try{const T=R.serialize.serialize();ha(A,T).catch(()=>{})}catch{}},3e4);return()=>clearInterval(B)},[]),V.useEffect(()=>()=>{for(const[B,A]of Nt){try{const R=A.serialize.serialize();ha(B,R).catch(()=>{})}catch{}A.observer.disconnect(),A.ws&&A.ws.close(),A.term.dispose(),A.container.remove(),h.current(`/api/terminal/${encodeURIComponent(B)}`,{method:"DELETE"}).catch(()=>{})}Nt.clear()},[]);const se=t?b.has(t):!1,K=g.length===0;return S.jsxs("div",{className:"h-full flex flex-col",children:[!K&&S.jsxs("div",{className:"px-2 py-1 border-b border-border flex items-center gap-1 overflow-x-auto",children:[g.map(B=>S.jsxs("div",{onClick:()=>s==null?void 0:s(B),className:`flex items-center gap-1 px-2 py-0.5 rounded text-xs font-mono cursor-pointer ${B===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(B)?"bg-amber-500":B===t?"bg-green-600":"bg-muted/50"}`}),S.jsx("span",{className:`truncate max-w-[120px] ${B.startsWith("_new_")?"italic":""}`,children:B.startsWith("_new_")?"Untitled":B}),S.jsx("button",{onClick:A=>{A.stopPropagation(),B.startsWith("_new_")?k(B):oe(B)},className:"ml-0.5 text-muted hover:text-error text-[10px] leading-none",title:"Close terminal",children:"×"})]},B)),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:()=>M(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"}),K&&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 B=x;k(null),me(B)},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:()=>M(null),className:"px-4 py-1.5 border border-border text-sm rounded hover:bg-surface",children:"Cancel"}),S.jsx("button",{onClick:async()=>{const B=L;M(null);try{(await h.current("/api/stories/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})})).ok&&(oe(B),o==null||o(B))}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:()=>te(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:()=>te(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 sy(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"?ly(e.value):!1:ly(e)}function ly(e){return e.replace(hk,"")===""}class za{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}za.prototype.normal={};za.prototype.property={};za.prototype.space=void 0;function $b(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new za(n,s,t)}function md(e){return e.toLowerCase()}class Ai{constructor(t,n){this.attribute=n,this.property=t}}Ai.prototype.attribute="";Ai.prototype.booleanish=!1;Ai.prototype.boolean=!1;Ai.prototype.commaOrSpaceSeparated=!1;Ai.prototype.commaSeparated=!1;Ai.prototype.defined=!1;Ai.prototype.mustUseProperty=!1;Ai.prototype.number=!1;Ai.prototype.overloadedBoolean=!1;Ai.prototype.property="";Ai.prototype.spaceSeparated=!1;Ai.prototype.space=void 0;let dk=0;const Me=cs(),Tt=cs(),_d=cs(),ae=cs(),rt=cs(),sl=cs(),Hi=cs();function cs(){return 2**++dk}const gd=Object.freeze(Object.defineProperty({__proto__:null,boolean:Me,booleanish:Tt,commaOrSpaceSeparated:Hi,commaSeparated:sl,number:ae,overloadedBoolean:_d,spaceSeparated:rt},Symbol.toStringTag,{value:"Module"})),df=Object.keys(gd);class Hd extends Ai{constructor(t,n,s,a){let o=-1;if(super(t,n),ay(this,"space",a),typeof s=="number")for(;++o<df.length;){const c=df[o];ay(this,df[o],(s&gd[c])===gd[c])}}}Hd.prototype.defined=!0;function ay(e,t,n){n&&(e[t]=n)}function cl(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const o=new Hd(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),t[s]=o,n[md(s)]=s,n[md(o.attribute)]=s}return new za(t,n,e.space)}const Zb=cl({properties:{ariaActiveDescendant:null,ariaAtomic:Tt,ariaAutoComplete:null,ariaBusy:Tt,ariaChecked:Tt,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:rt,ariaCurrent:null,ariaDescribedBy:rt,ariaDetails:null,ariaDisabled:Tt,ariaDropEffect:rt,ariaErrorMessage:null,ariaExpanded:Tt,ariaFlowTo:rt,ariaGrabbed:Tt,ariaHasPopup:null,ariaHidden:Tt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:rt,ariaLevel:ae,ariaLive:null,ariaModal:Tt,ariaMultiLine:Tt,ariaMultiSelectable:Tt,ariaOrientation:null,ariaOwns:rt,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:Tt,ariaReadOnly:Tt,ariaRelevant:null,ariaRequired:Tt,ariaRoleDescription:rt,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:Tt,ariaSetSize:ae,ariaSort:null,ariaValueMax:ae,ariaValueMin:ae,ariaValueNow:ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Qb(e,t){return t in e?e[t]:t}function Jb(e,t){return Qb(e,t.toLowerCase())}const pk=cl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sl,acceptCharset:rt,accessKey:rt,action:null,allow:null,allowFullScreen:Me,allowPaymentRequest:Me,allowUserMedia:Me,alt:null,as:null,async:Me,autoCapitalize:null,autoComplete:rt,autoFocus:Me,autoPlay:Me,blocking:rt,capture:null,charSet:null,checked:Me,cite:null,className:rt,cols:ae,colSpan:null,content:null,contentEditable:Tt,controls:Me,controlsList:rt,coords:ae|sl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Me,defer:Me,dir:null,dirName:null,disabled:Me,download:_d,draggable:Tt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Me,formTarget:null,headers:rt,height:ae,hidden:_d,high:ae,href:null,hrefLang:null,htmlFor:rt,httpEquiv:rt,id:null,imageSizes:null,imageSrcSet:null,inert:Me,inputMode:null,integrity:null,is:null,isMap:Me,itemId:null,itemProp:rt,itemRef:rt,itemScope:Me,itemType:rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Me,low:ae,manifest:null,max:null,maxLength:ae,media:null,method:null,min:null,minLength:ae,multiple:Me,muted:Me,name:null,nonce:null,noModule:Me,noValidate:Me,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:Me,optimum:ae,pattern:null,ping:rt,placeholder:null,playsInline:Me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Me,referrerPolicy:null,rel:rt,required:Me,reversed:Me,rows:ae,rowSpan:ae,sandbox:rt,scope:null,scoped:Me,seamless:Me,selected:Me,shadowRootClonable:Me,shadowRootDelegatesFocus:Me,shadowRootMode:null,shape:null,size:ae,sizes:null,slot:null,span:ae,spellCheck:Tt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ae,step:null,style:null,tabIndex:ae,target:null,title:null,translate:null,type:null,typeMustMatch:Me,useMap:null,value:Tt,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:rt,axis:null,background:null,bgColor:null,border:ae,borderColor:null,bottomMargin:ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Me,declare:Me,event:null,face:null,frame:null,frameBorder:null,hSpace:ae,leftMargin:ae,link:null,longDesc:null,lowSrc:null,marginHeight:ae,marginWidth:ae,noResize:Me,noHref:Me,noShade:Me,noWrap:Me,object:null,profile:null,prompt:null,rev:null,rightMargin:ae,rules:null,scheme:null,scrolling:Tt,standby:null,summary:null,text:null,topMargin:ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Me,disableRemotePlayback:Me,prefix:null,property:null,results:ae,security:null,unselectable:null},space:"html",transform:Jb}),mk=cl({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:Hi,accentHeight:ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ae,amplitude:ae,arabicForm:null,ascent:ae,attributeName:null,attributeType:null,azimuth:ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ae,by:null,calcMode:null,capHeight:ae,className:rt,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:ae,diffuseConstant:ae,direction:null,display:null,dur:null,divisor:ae,dominantBaseline:null,download:Me,dx:null,dy:null,edgeMode:null,editable:null,elevation:ae,enableBackground:null,end:null,event:null,exponent:ae,externalResourcesRequired:null,fill:null,fillOpacity:ae,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:sl,g2:sl,glyphName:sl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ae,horizOriginX:ae,horizOriginY:ae,id:null,ideographic:ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ae,k:ae,k1:ae,k2:ae,k3:ae,k4:ae,kernelMatrix:Hi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ae,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:ae,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:ae,overlineThickness:ae,paintOrder:null,panose1:null,path:null,pathLength:ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Hi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Hi,rev:Hi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Hi,requiredFeatures:Hi,requiredFonts:Hi,requiredFormats:Hi,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:ae,specularExponent:ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ae,strikethroughThickness:ae,string:null,stroke:null,strokeDashArray:Hi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ae,strokeOpacity:ae,strokeWidth:null,style:null,surfaceScale:ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Hi,tabIndex:ae,tableValues:null,target:null,targetX:ae,targetY:ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Hi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ae,underlineThickness:ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ae,values:null,vAlphabetic:ae,vMathematical:ae,vectorEffect:null,vHanging:ae,vIdeographic:ae,version:null,vertAdvY:ae,vertOriginX:ae,vertOriginY:ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qb}),eS=cl({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()}}),tS=cl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jb}),iS=cl({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,oy=/-[a-z]/g,vk=/^data[-\w.:]+$/i;function yk(e,t){const n=md(t);let s=t,a=Ai;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(oy,Sk);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!oy.test(o)){let c=o.replace(gk,bk);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Hd}return new a(s,t)}function bk(e){return"-"+e.toLowerCase()}function Sk(e){return e.charAt(1).toUpperCase()}const xk=$b([Zb,pk,eS,tS,iS],"html"),Pd=$b([Zb,mk,eS,tS,iS],"svg");function wk(e){return e.join(" ").trim()}var Js={},pf,uy;function Ck(){if(uy)return pf;uy=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,M){if(typeof L!="string")throw new TypeError("First argument must be a string");if(!L)return[];M=M||{};var $=1,I=1;function Z(A){var R=A.match(t);R&&($+=R.length);var T=A.lastIndexOf(p);I=~T?A.length-T:I+A.length}function W(){var A={line:$,column:I};return function(R){return R.position=new O(A),me(),R}}function O(A){this.start=A,this.end={line:$,column:I},this.source=M.source}O.prototype.content=L;function te(A){var R=new Error(M.source+":"+$+":"+I+": "+A);if(R.reason=A,R.filename=M.source,R.line=$,R.column=I,R.source=L,!M.silent)throw R}function oe(A){var R=A.exec(L);if(R){var T=R[0];return Z(T),L=L.slice(T.length),R}}function me(){oe(n)}function U(A){var R;for(A=A||[];R=se();)R!==!1&&A.push(R);return A}function se(){var A=W();if(!(h!=L.charAt(0)||g!=L.charAt(1))){for(var R=2;_!=L.charAt(R)&&(g!=L.charAt(R)||h!=L.charAt(R+1));)++R;if(R+=2,_===L.charAt(R-1))return te("End of comment missing");var T=L.slice(2,R-2);return I+=2,Z(T),L=L.slice(R),I+=2,A({type:b,comment:T})}}function K(){var A=W(),R=oe(s);if(R){if(se(),!oe(a))return te("property missing ':'");var T=oe(o),j=A({type:y,property:k(R[0].replace(e,_)),value:T?k(T[0].replace(e,_)):_});return oe(c),j}}function B(){var A=[];U(A);for(var R;R=K();)R!==!1&&(A.push(R),U(A));return A}return me(),B()}function k(L){return L?L.replace(f,_):_}return pf=x,pf}var cy;function kk(){if(cy)return Js;cy=1;var e=Js&&Js.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Js,"__esModule",{value:!0}),Js.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 Js}var fa={},hy;function Ek(){if(hy)return fa;hy=1,Object.defineProperty(fa,"__esModule",{value:!0}),fa.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 fa.camelCase=p,fa}var da,fy;function Tk(){if(fy)return da;fy=1;var e=da&&da.__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,da=s,da}var Ak=Tk();const Dk=ku(Ak),nS=rS("end"),Ud=rS("start");function rS(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 sS(e){const t=Ud(e),n=nS(e);if(t&&n)return{start:t,end:n}}function xa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?dy(e.position):"start"in e||"end"in e?dy(e):"line"in e||"column"in e?vd(e):""}function vd(e){return py(e&&e.line)+":"+py(e&&e.column)}function dy(e){return vd(e&&e.start)+"-"+vd(e&&e.end)}function py(e){return e&&typeof e=="number"?e:1}class ai 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=xa(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}}ai.prototype.file="";ai.prototype.name="";ai.prototype.reason="";ai.prototype.message="";ai.prototype.stack="";ai.prototype.column=void 0;ai.prototype.line=void 0;ai.prototype.ancestors=void 0;ai.prototype.cause=void 0;ai.prototype.fatal=void 0;ai.prototype.place=void 0;ai.prototype.ruleId=void 0;ai.prototype.source=void 0;const Id={}.hasOwnProperty,Rk=new Map,Mk=/[A-Z]/g,Bk=new Set(["table","tbody","thead","tfoot","tr"]),Nk=new Set(["td","th"]),lS="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"?Pd:xk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=aS(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function aS(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 Pk(e,t,n);if(t.type==="text")return Uk(e,t)}function zk(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Pd,e.schema=a),e.ancestors.push(t);const o=uS(e,t.tagName,!1),c=qk(e,t);let f=qd(e,t);return Bk.has(t.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!fk(p):!0})),oS(e,c,o,t),Fd(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)}Aa(e,t.position)}function jk(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Aa(e,t.position)}function Hk(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Pd,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:uS(e,t.name,!0),c=Wk(e,t),f=qd(e,t);return oS(e,c,o,t),Fd(c,f),e.ancestors.pop(),e.schema=s,e.create(t,o,c,n)}function Pk(e,t,n){const s={};return Fd(s,qd(e,t)),e.create(t,e.Fragment,s,n)}function Uk(e,t){return t.value}function oS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Fd(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=Ud(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"&&Id.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 Aa(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 Aa(e,t.position);else o=s.value===null?!0:s.value;n[a]=o}return n}function qd(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=aS(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 ai("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=lS+"#cannot-parse-style-attribute",a}}function uS(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=sy(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=sy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Id.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Aa(e)}function Aa(e,t){const n=new ai("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=lS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Kk(e){const t={};let n;for(n in e)Id.call(e,n)&&(t[Xk(n)]=e[n]);return t}function Xk(e){let t=e.replace(Mk,Gk);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Gk(e){return"-"+e.toLowerCase()}const mf={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"]},$k={};function Wd(e,t){const n=$k,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return cS(e,s,a)}function cS(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 my(e.children,t,n)}return Array.isArray(e)?my(e,t,n):""}function my(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=cS(e[a],t,n);return s.join("")}function Zk(e){return!!(e&&typeof e=="object")}const _y=document.createElement("i");function Yd(e){const t="&"+e+";";_y.innerHTML=t;const n=_y.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pi(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 en(e,t){return e.length>0?(Pi(e,e.length,0,t),e):t}const gy={}.hasOwnProperty;function hS(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=(gy.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){gy.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]);Pi(e,0,0,s)}function fS(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 on(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pi=Mr(/[A-Za-z]/),li=Mr(/[\dA-Za-z]/),eE=Mr(/[#-'*+\--9=?A-Z^-~]/);function xu(e){return e!==null&&(e<32||e===127)}const yd=Mr(/\d/),tE=Mr(/[\dA-Fa-f]/),iE=Mr(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function nt(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}const Ru=Mr(new RegExp("\\p{P}|\\p{S}","u")),os=Mr(/\s/);function Mr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hl(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&li(e.charCodeAt(n+1))&&li(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 qe(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return He(p)?(e.enter(n),f(p)):t(p)}function f(p){return He(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"),qe(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 Se(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const sE={tokenize:lE},vy={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 W=Z,O;for(;W--;)if(t.events[W][0]==="exit"&&t.events[W][1].type==="chunkFlow"){O=t.events[W][1].end;break}M(s);let te=Z;for(;te<t.events.length;)t.events[te][1].end={...O},te++;return Pi(t.events,W+1,0,t.events.slice(Z)),t.events.length=te,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(vy,g,_)(I)}function g(I){return a&&$(),M(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(vy,y,x)(I)}function y(I){return s++,n.push([t.currentConstruct,t.containerState]),b(I)}function x(I){if(I===null){a&&$(),M(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),M(0),e.consume(I);return}return Se(I)?(e.consume(I),L(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(I),k)}function L(I,Z){const W=t.sliceStream(I);if(Z&&W.push(null),I.previous=o,o&&(o.next=I),o=I,a.defineSkip(I.start),a.write(W),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 te=t.events.length;let oe=te,me,U;for(;oe--;)if(t.events[oe][0]==="exit"&&t.events[oe][1].type==="chunkFlow"){if(me){U=t.events[oe][1].end;break}me=!0}for(M(s),O=te;O<t.events.length;)t.events[O][1].end={...U},O++;Pi(t.events,oe+1,0,t.events.slice(te)),t.events.length=O}}function M(I){let Z=n.length;for(;Z-- >I;){const W=n[Z];t.containerState=W[1],W[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 qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function al(e){if(e===null||nt(e)||os(e))return 1;if(Ru(e))return 2}function Mu(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 bd={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};yy(_,-p),yy(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=en(h,[["enter",e[s][1],t],["exit",e[s][1],t]])),h=en(h,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=en(h,Mu(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),h=en(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=en(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Pi(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=al(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=al(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 yy(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 pi(y)?(e.consume(y),c):y===64?n(y):h(y)}function c(y){return y===43||y===45||y===46||li(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||li(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||xu(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 li(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||li(y))&&s++<63){const x=y===45?b:_;return e.consume(y),x}return n(y)}}const Oa={partial:!0,tokenize:fE};function fE(e,t,n){return s;function s(o){return He(o)?qe(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||Se(o)?t(o):n(o)}}const dS={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 He(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 He(c)?qe(e,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(dS,t,n)(c)}}function mE(e){e.exit("blockQuote")}const pS={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 mS={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=li,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=yd,g(_))}function g(_){if(_===59&&a){const b=e.exit("characterReferenceValue");return c===li&&!Yd(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 by={partial:!0,tokenize:yE},Sy={concrete:!0,name:"codeFenced",tokenize:vE};function vE(e,t,n){const s=this,a={partial:!0,tokenize:W};let o=0,c=0,f;return p;function p(O){return h(O)}function h(O){const te=s.events[s.events.length-1];return o=te&&te[1].type==="linePrefix"?te[2].sliceSerialize(te[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"),He(O)?qe(e,_,"whitespace")(O):_(O))}function _(O){return O===null||Se(O)?(e.exit("codeFencedFence"),s.interrupt?t(O):e.check(by,k,Z)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Se(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(O)):He(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,y,"whitespace")(O)):O===96&&O===f?n(O):(e.consume(O),b)}function y(O){return O===null||Se(O)?_(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||Se(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"),M}function M(O){return o>0&&He(O)?qe(e,$,"linePrefix",o+1)(O):$(O)}function $(O){return O===null||Se(O)?e.check(by,k,Z)(O):(e.enter("codeFlowValue"),I(O))}function I(O){return O===null||Se(O)?(e.exit("codeFlowValue"),$(O)):(e.consume(O),I)}function Z(O){return e.exit("codeFenced"),t(O)}function W(O,te,oe){let me=0;return U;function U(R){return O.enter("lineEnding"),O.consume(R),O.exit("lineEnding"),se}function se(R){return O.enter("codeFencedFence"),He(R)?qe(O,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):K(R)}function K(R){return R===f?(O.enter("codeFencedFenceSequence"),B(R)):oe(R)}function B(R){return R===f?(me++,O.consume(R),B):me>=c?(O.exit("codeFencedFenceSequence"),He(R)?qe(O,A,"whitespace")(R):A(R)):oe(R)}function A(R){return R===null||Se(R)?(O.exit("codeFencedFence"),te(R)):oe(R)}}}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 _f={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"),qe(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):Se(h)?e.attempt(bE,c,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Se(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):Se(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):qe(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):Se(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(_)):Se(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(_))}function h(_){return _===null||_===32||_===96||Se(_)?(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&&pa(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),pa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pa(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);pa(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pa(this.left,n.reverse())}}}function pa(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 _S(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 Pi(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 M=f.slice(L[b],L[b+1]),$=o.pop();p.push([$,$+M.length-1]),e.splice($,2,M)}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 _S(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):Se(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"),qe(e,o,"linePrefix")}function o(c){if(c===null||Se(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 gS(e,t,n,s,a,o,c,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return _;function _(M){return M===60?(e.enter(s),e.enter(a),e.enter(o),e.consume(M),e.exit(o),b):M===null||M===32||M===41||xu(M)?n(M):(e.enter(s),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),k(M))}function b(M){return M===62?(e.enter(o),e.consume(M),e.exit(o),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(M))}function y(M){return M===62?(e.exit("chunkString"),e.exit(f),b(M)):M===null||M===60||Se(M)?n(M):(e.consume(M),M===92?x:y)}function x(M){return M===60||M===62||M===92?(e.consume(M),y):y(M)}function k(M){return!g&&(M===null||M===41||nt(M))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(s),t(M)):g<h&&M===40?(e.consume(M),g++,k):M===41?(e.consume(M),g--,k):M===null||M===32||M===40||xu(M)?n(M):(e.consume(M),M===92?L:k)}function L(M){return M===40||M===41||M===92?(e.consume(M),k):k(M)}}function vS(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):Se(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||Se(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!He(y)),y===92?b:_)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function yS(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):Se(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),qe(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===c||b===null||Se(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 wa(e,t){let n;return s;function s(a){return Se(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):He(a)?qe(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 vS.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=on(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 nt(y)?wa(e,h)(y):h(y)}function h(y){return gS(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(zE,_,_)(y)}function _(y){return He(y)?qe(e,b,"whitespace")(y):b(y)}function b(y){return y===null||Se(y)?(e.exit("definition"),s.parser.defined.push(a),t(y)):n(y)}}function jE(e,t,n){return s;function s(f){return nt(f)?wa(e,a)(f):n(f)}function a(f){return yS(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return He(f)?qe(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Se(f)?t(f):n(f)}}const HE={name:"hardBreakEscape",tokenize:PE};function PE(e,t,n){return s;function s(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return Se(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const UE={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"},Pi(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||nt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Se(g)?(e.exit("atxHeading"),t(g)):He(g)?qe(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||nt(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"],xy=["pre","script","style","textarea"],WE={concrete:!0,name:"htmlFlow",resolveTo:KE,tokenize:XE},YE={partial:!0,tokenize:$E},VE={partial:!0,tokenize:GE};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(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,k):C===63?(e.consume(C),a=3,s.interrupt?t:E):pi(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):pi(C)?(e.consume(C),a=4,s.interrupt?t:E):n(C)}function y(C){return C===45?(e.consume(C),s.interrupt?t:E):n(C)}function x(C){const Q="CDATA[";return C===Q.charCodeAt(f++)?(e.consume(C),f===Q.length?s.interrupt?t:K:x):n(C)}function k(C){return pi(C)?(e.consume(C),c=String.fromCharCode(C),L):n(C)}function L(C){if(C===null||C===47||C===62||nt(C)){const Q=C===47,fe=c.toLowerCase();return!Q&&!o&&xy.includes(fe)?(a=1,s.interrupt?t(C):K(C)):qE.includes(c.toLowerCase())?(a=6,Q?(e.consume(C),M):s.interrupt?t(C):K(C)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):o?$(C):I(C))}return C===45||li(C)?(e.consume(C),c+=String.fromCharCode(C),L):n(C)}function M(C){return C===62?(e.consume(C),s.interrupt?t:K):n(C)}function $(C){return He(C)?(e.consume(C),$):U(C)}function I(C){return C===47?(e.consume(C),U):C===58||C===95||pi(C)?(e.consume(C),Z):He(C)?(e.consume(C),I):U(C)}function Z(C){return C===45||C===46||C===58||C===95||li(C)?(e.consume(C),Z):W(C)}function W(C){return C===61?(e.consume(C),O):He(C)?(e.consume(C),W):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,te):He(C)?(e.consume(C),O):oe(C)}function te(C){return C===p?(e.consume(C),p=null,me):C===null||Se(C)?n(C):(e.consume(C),te)}function oe(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||nt(C)?W(C):(e.consume(C),oe)}function me(C){return C===47||C===62||He(C)?I(C):n(C)}function U(C){return C===62?(e.consume(C),se):n(C)}function se(C){return C===null||Se(C)?K(C):He(C)?(e.consume(C),se):n(C)}function K(C){return C===45&&a===2?(e.consume(C),T):C===60&&a===1?(e.consume(C),j):C===62&&a===4?(e.consume(C),D):C===63&&a===3?(e.consume(C),E):C===93&&a===5?(e.consume(C),le):Se(C)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(YE,X,B)(C)):C===null||Se(C)?(e.exit("htmlFlowData"),B(C)):(e.consume(C),K)}function B(C){return e.check(VE,A,X)(C)}function A(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),R}function R(C){return C===null||Se(C)?B(C):(e.enter("htmlFlowData"),K(C))}function T(C){return C===45?(e.consume(C),E):K(C)}function j(C){return C===47?(e.consume(C),c="",H):K(C)}function H(C){if(C===62){const Q=c.toLowerCase();return xy.includes(Q)?(e.consume(C),D):K(C)}return pi(C)&&c.length<8?(e.consume(C),c+=String.fromCharCode(C),H):K(C)}function le(C){return C===93?(e.consume(C),E):K(C)}function E(C){return C===62?(e.consume(C),D):C===45&&a===2?(e.consume(C),E):K(C)}function D(C){return C===null||Se(C)?(e.exit("htmlFlowData"),X(C)):(e.consume(C),D)}function X(C){return e.exit("htmlFlow"),t(C)}}function GE(e,t,n){const s=this;return a;function a(c){return Se(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 $E(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Oa,t,n)}}const ZE={name:"htmlText",tokenize:QE};function QE(e,t,n){const s=this;let a,o,c;return f;function f(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),p}function p(E){return E===33?(e.consume(E),h):E===47?(e.consume(E),W):E===63?(e.consume(E),I):pi(E)?(e.consume(E),oe):n(E)}function h(E){return E===45?(e.consume(E),g):E===91?(e.consume(E),o=0,x):pi(E)?(e.consume(E),$):n(E)}function g(E){return E===45?(e.consume(E),y):n(E)}function _(E){return E===null?n(E):E===45?(e.consume(E),b):Se(E)?(c=_,j(E)):(e.consume(E),_)}function b(E){return E===45?(e.consume(E),y):_(E)}function y(E){return E===62?T(E):E===45?b(E):_(E)}function x(E){const D="CDATA[";return E===D.charCodeAt(o++)?(e.consume(E),o===D.length?k:x):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),L):Se(E)?(c=k,j(E)):(e.consume(E),k)}function L(E){return E===93?(e.consume(E),M):k(E)}function M(E){return E===62?T(E):E===93?(e.consume(E),M):k(E)}function $(E){return E===null||E===62?T(E):Se(E)?(c=$,j(E)):(e.consume(E),$)}function I(E){return E===null?n(E):E===63?(e.consume(E),Z):Se(E)?(c=I,j(E)):(e.consume(E),I)}function Z(E){return E===62?T(E):I(E)}function W(E){return pi(E)?(e.consume(E),O):n(E)}function O(E){return E===45||li(E)?(e.consume(E),O):te(E)}function te(E){return Se(E)?(c=te,j(E)):He(E)?(e.consume(E),te):T(E)}function oe(E){return E===45||li(E)?(e.consume(E),oe):E===47||E===62||nt(E)?me(E):n(E)}function me(E){return E===47?(e.consume(E),T):E===58||E===95||pi(E)?(e.consume(E),U):Se(E)?(c=me,j(E)):He(E)?(e.consume(E),me):T(E)}function U(E){return E===45||E===46||E===58||E===95||li(E)?(e.consume(E),U):se(E)}function se(E){return E===61?(e.consume(E),K):Se(E)?(c=se,j(E)):He(E)?(e.consume(E),se):me(E)}function K(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),a=E,B):Se(E)?(c=K,j(E)):He(E)?(e.consume(E),K):(e.consume(E),A)}function B(E){return E===a?(e.consume(E),a=void 0,R):E===null?n(E):Se(E)?(c=B,j(E)):(e.consume(E),B)}function A(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||nt(E)?me(E):(e.consume(E),A)}function R(E){return E===47||E===62||nt(E)?me(E):n(E)}function T(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function j(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),H}function H(E){return He(E)?qe(e,le,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):le(E)}function le(E){return e.enter("htmlTextData"),c(E)}}const Vd={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&&Pi(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=en(f,e.slice(o+1,o+s+3)),f=en(f,[["enter",g,t]]),f=en(f,Mu(t.parser.constructs.insideSpan.null,e.slice(o+s+4,c-3),t)),f=en(f,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),f=en(f,e.slice(c+1)),f=en(f,[["exit",p,t]]),Pi(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(on(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 nt(_)?wa(e,o)(_):o(_)}function o(_){return _===41?g(_):gS(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function c(_){return nt(_)?wa(e,p)(_):g(_)}function f(_){return n(_)}function p(_){return _===34||_===39||_===40?yS(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):g(_)}function h(_){return nt(_)?wa(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 vS.call(s,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return s.parser.defined.includes(on(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:Vd.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:Vd.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 gf={name:"lineEnding",tokenize:f5};function f5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const mu={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||Se(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===a?(e.consume(h),s++,p):(e.exit("thematicBreakSequence"),He(h)?qe(e,f,"whitespace")(h):f(h))}}const Ti={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:yd(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(mu,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 yd(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(Oa,s.interrupt?n:g,e.attempt(p5,b,_))}function g(y){return s.containerState.initialBlankLine=!0,o++,b(y)}function _(y){return He(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(Oa,a,o);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,qe(e,t,"listItemIndent",s.containerState.size+1)(f)}function o(f){return s.containerState.furtherBlankLines||!He(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,qe(e,e.attempt(Ti,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function v5(e,t,n){const s=this;return qe(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 qe(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!He(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const wy={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"),He(h)?qe(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Se(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const w5={tokenize:C5};function C5(e){const t=this,n=e.attempt(Oa,s,e.attempt(this.parser.constructs.flowInitial,a,qe(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:SS()},E5=bS("string"),T5=bS("text");function bS(e){return{resolveAll:SS(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 SS(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:Ti,43:Ti,45:Ti,48:Ti,49:Ti,50:Ti,51:Ti,52:Ti,53:Ti,54:Ti,55:Ti,56:Ti,57:Ti,62:dS},R5={91:LE},M5={[-2]:_f,[-1]:_f,32:_f},B5={35:UE,42:mu,45:[wy,mu],60:WE,61:wy,95:mu,96:Sy,126:Sy},N5={38:mS,92:pS},L5={[-5]:gf,[-4]:gf,[-3]:gf,33:o5,38:mS,42:bd,60:[cE,ZE],91:c5,92:[HE,pS],93:Vd,95:bd,96:wE},z5={null:[bd,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 P5(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:te(W),check:te(O),consume:$,enter:I,exit:Z,interrupt:te(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=en(c,se),L(),c[c.length-1]!==null?[]:(oe(t,0),h.events=Mu(o,h.events,h),h.events)}function b(se,K){return I5(y(se),K)}function y(se){return U5(c,se)}function x(){const{_bufferIndex:se,_index:K,line:B,column:A,offset:R}=s;return{_bufferIndex:se,_index:K,line:B,column:A,offset:R}}function k(se){a[se.line]=se.column,U()}function L(){let se;for(;s._index<c.length;){const K=c[s._index];if(typeof K=="string")for(se=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===se&&s._bufferIndex<K.length;)M(K.charCodeAt(s._bufferIndex));else M(K)}}function M(se){g=g(se)}function $(se){Se(se)?(s.line++,s.column=1,s.offset+=se===-3?2:1,U()):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,K){const B=K||{};return B.type=se,B.start=x(),h.events.push(["enter",B,h]),f.push(B),B}function Z(se){const K=f.pop();return K.end=x(),h.events.push(["exit",K,h]),K}function W(se,K){oe(se,K.from)}function O(se,K){K.restore()}function te(se,K){return B;function B(A,R,T){let j,H,le,E;return Array.isArray(A)?X(A):"tokenize"in A?X([A]):D(A);function D(de){return Ce;function Ce(ze){const Te=ze!==null&&de[ze],st=ze!==null&&de.null,Xe=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(st)?st:st?[st]:[]];return X(Xe)(ze)}}function X(de){return j=de,H=0,de.length===0?T:C(de[H])}function C(de){return Ce;function Ce(ze){return E=me(),le=de,de.partial||(h.currentConstruct=de),de.name&&h.parser.constructs.disable.null.includes(de.name)?fe():de.tokenize.call(K?Object.assign(Object.create(h),K):h,p,Q,fe)(ze)}}function Q(de){return se(le,E),R}function fe(de){return E.restore(),++H<j.length?C(j[H]):T}}}function oe(se,K){se.resolveAll&&!o.includes(se)&&o.push(se),se.resolve&&Pi(h.events,K,h.events.length-K,se.resolve(h.events.slice(K),h)),se.resolveTo&&(h.events=se.resolveTo(h.events,h))}function me(){const se=x(),K=h.previous,B=h.currentConstruct,A=h.events.length,R=Array.from(f);return{from:A,restore:T};function T(){s=se,h.previous=K,h.currentConstruct=B,h.events.length=A,f=R,U()}}function U(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function U5(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 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 P5(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(qn),autolinkProtocol:_e,autolinkEmail:_e,atxHeading:o(pn),blockQuote:o(st),characterEscape:_e,characterReference:_e,codeFenced:o(Ye),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Ye,c),codeText:o(xt,c),codeTextData:_e,data:_e,codeFlowValue:_e,definition:o(xe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Vt),hardBreakEscape:o(Ni),hardBreakTrailing:o(Ni),htmlFlow:o(Fn,c),htmlFlowData:_e,htmlText:o(Fn,c),htmlTextData:_e,image:o(rs),label:c,link:o(qn),listItem:o(Wn),listItemValue:b,listOrdered:o(mn,_),listUnordered:o(mn),paragraph:o(Ma),reference:C,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(pn),strong:o(Er),thematicBreak:o(_n)},exit:{atxHeading:p(),atxHeadingSequence:W,autolink:p(),autolinkEmail:Ee,autolinkProtocol:Le,blockQuote:p(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:de,characterReference:Ce,codeFenced:p(L),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:U,codeIndented:p(M),codeText:p(R),codeTextData:U,data:U,definition:p(),definitionDestinationString:Z,definitionLabelString:G,definitionTitleString:I,emphasis:p(),hardBreakEscape:p(V),hardBreakTrailing:p(V),htmlFlow:p(B),htmlFlowData:U,htmlText:p(A),htmlTextData:U,image:p(j),label:ae,labelText:H,lineEnding:se,link:p(T),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:Q,resourceDestinationString:E,resourceTitleString:D,resource:K,setextHeading:p(ue),setextHeadingLineSequence:te,setextHeadingText:O,strong:p(),thematicBreak:p()}};SS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ee){let ce={type:"root",children:[]};const be={stack:[ce],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},le=[];let me=-1;for(;++me<ee.length;)if(ee[me][1].type==="listOrdered"||ee[me][1].type==="listUnordered")if(ee[me][0]==="enter")le.push(me);else{const Te=le.pop();me=a(ee,Te,me)}for(me=-1;++me<ee.length;){const Te=t[ee[me][0]];bS.call(Te,ee[me][1].type)&&Te[ee[me][1].type].call(Object.assign({sliceSerialize:ee[me][2].sliceSerialize},be),ee[me][1])}if(be.tokenStack.length>0){const Te=be.tokenStack[be.tokenStack.length-1];(Te[1]||wy).call(be,void 0,Te[0])}for(ce.position={start:yr(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:yr(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},me=-1;++me<t.transforms.length;)ce=t.transforms[me](ce)||ce;return ce}function a(ee,ce,be){let le=ce-1,me=-1,Te=!1,Qe,nt,Je,zt;for(;++le<=be;){const et=ee[le];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?me++:me--,zt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Qe&&!zt&&!me&&!Je&&(Je=le),zt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:zt=void 0}if(!me&&et[0]==="enter"&&et[1].type==="listItemPrefix"||me===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Qe){let Yn=le;for(nt=void 0;Yn--;){const $i=ee[Yn];if($i[1].type==="lineEnding"||$i[1].type==="lineEndingBlank"){if($i[0]==="exit")continue;nt&&(ee[nt][1].type="lineEndingBlank",Te=!0),$i[1].type="lineEnding",nt=Yn}else if(!($i[1].type==="linePrefix"||$i[1].type==="blockQuotePrefix"||$i[1].type==="blockQuotePrefixWhitespace"||$i[1].type==="blockQuoteMarker"||$i[1].type==="listItemIndent"))break}Je&&(!nt||Je<nt)&&(Qe._spread=!0),Qe.end=Object.assign({},nt?ee[nt][1].start:et[1].end),ee.splice(nt||le,0,["exit",Qe,et[2]]),le++,be++}if(et[1].type==="listItemPrefix"){const Yn={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Qe=Yn,ee.splice(le,0,["enter",Yn,et[2]]),le++,be++,Je=void 0,zt=!0}}}return ee[ce][1]._spread=Te,be}function o(ee,ce){return be;function be(le){f.call(this,ee(le),le),ce&&ce.call(this,le)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ee,ce,be){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([ce,be||void 0]),ee.position={start:yr(ce.start),end:void 0}}function p(ee){return ce;function ce(be){ee&&ee.call(this,be),h.call(this,be)}}function h(ee,ce){const be=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==ee.type&&(ce?ce.call(this,ee,le[0]):(le[1]||wy).call(this,ee,le[0]));else throw new Error("Cannot close `"+ee.type+"` ("+pa({start:ee.start,end:ee.end})+"): it’s not open");be.position.end=yr(ee.end)}function g(){return Id(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function b(ee){if(this.data.expectingFirstListItemValue){const ce=this.stack[this.stack.length-2];ce.start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.lang=ee}function x(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.meta=ee}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function L(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee.replace(/(\r?\n|\r)$/g,"")}function G(ee){const ce=this.resume(),be=this.stack[this.stack.length-1];be.label=ce,be.identifier=en(this.sliceSerialize(ee)).toLowerCase()}function I(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.title=ee}function Z(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.url=ee}function W(ee){const ce=this.stack[this.stack.length-1];if(!ce.depth){const be=this.sliceSerialize(ee).length;ce.depth=be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function te(ee){const ce=this.stack[this.stack.length-1];ce.depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function ue(){this.data.setextHeadingSlurpLineEnding=void 0}function _e(ee){const be=this.stack[this.stack.length-1].children;let le=be[be.length-1];(!le||le.type!=="text")&&(le=vt(),le.position={start:yr(ee.start),end:void 0},be.push(le)),this.stack.push(le)}function U(ee){const ce=this.stack.pop();ce.value+=this.sliceSerialize(ee),ce.position.end=yr(ee.end)}function se(ee){const ce=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ce.children[ce.children.length-1];be.position.end=yr(ee.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ce.type)&&(_e.call(this,ee),U.call(this,ee))}function V(){this.data.atHardBreak=!0}function B(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function A(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function R(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.value=ee}function T(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ce=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ce,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 ce=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ce,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function H(ee){const ce=this.sliceSerialize(ee),be=this.stack[this.stack.length-2];be.label=V5(ce),be.identifier=en(ce).toLowerCase()}function ae(){const ee=this.stack[this.stack.length-1],ce=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const le=ee.children;be.children=le}else be.alt=ce}function E(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.url=ee}function D(){const ee=this.resume(),ce=this.stack[this.stack.length-1];ce.title=ee}function K(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function Q(ee){const ce=this.resume(),be=this.stack[this.stack.length-1];be.label=ce,be.identifier=en(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function fe(ee){this.data.characterReferenceType=ee.type}function de(ee){const ce=this.sliceSerialize(ee),be=this.data.characterReferenceType;let le;be?(le=cS(ce,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=Fd(ce);const me=this.stack[this.stack.length-1];me.value+=le}function Ce(ee){const ce=this.stack.pop();ce.position.end=yr(ee.end)}function Le(ee){U.call(this,ee);const ce=this.stack[this.stack.length-1];ce.url=this.sliceSerialize(ee)}function Ee(ee){U.call(this,ee);const ce=this.stack[this.stack.length-1];ce.url="mailto:"+this.sliceSerialize(ee)}function st(){return{type:"blockquote",children:[]}}function Ye(){return{type:"code",lang:null,meta:null,value:""}}function xt(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Vt(){return{type:"emphasis",children:[]}}function pn(){return{type:"heading",depth:0,children:[]}}function Ni(){return{type:"break"}}function Fn(){return{type:"html",value:""}}function rs(){return{type:"image",title:null,url:"",alt:null}}function qn(){return{type:"link",title:null,url:"",children:[]}}function mn(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function Wn(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function Ma(){return{type:"paragraph",children:[]}}function Er(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function _n(){return{type:"thematicBreak"}}}function yr(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+"` ("+pa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pa({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:`
|
|
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:hS([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 P5(s,o,f)}}}function q5(e){for(;!_S(e););return e}const Cy=/[\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(Cy.lastIndex=_,h=Cy.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 fS(n.slice(o?2:1),o?16:10)}return Yd(n)||e}const xS={}.hasOwnProperty;function X5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),G5(n)(q5(F5(n).document().write(W5()(e,t,!0))))}function G5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Cn),autolinkProtocol:me,autolinkEmail:me,atxHeading:o(xn),blockQuote:o(st),characterEscape:me,characterReference:me,codeFenced:o(Xe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Xe,c),codeText:o(xt,c),codeTextData:me,data:me,codeFlowValue:me,definition:o(xe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Xt),hardBreakEscape:o(wn),hardBreakTrailing:o(wn),htmlFlow:o(hs,c),htmlFlowData:me,htmlText:o(hs,c),htmlTextData:me,image:o(Br),label:c,link:o(Cn),listItem:o(Nr),listItemValue:b,listOrdered:o(Ui,_),listUnordered:o(Ui),paragraph:o(fs),reference:C,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(xn),strong:o(fl),thematicBreak:o(Zn)},exit:{atxHeading:p(),atxHeadingSequence:W,autolink:p(),autolinkEmail:Te,autolinkProtocol:ze,blockQuote:p(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:fe,characterReferenceMarkerNumeric:fe,characterReferenceValue:de,characterReference:Ce,codeFenced:p(L),codeFencedFence:k,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:U,codeIndented:p(M),codeText:p(R),codeTextData:U,data:U,definition:p(),definitionDestinationString:Z,definitionLabelString:$,definitionTitleString:I,emphasis:p(),hardBreakEscape:p(K),hardBreakTrailing:p(K),htmlFlow:p(B),htmlFlowData:U,htmlText:p(A),htmlTextData:U,image:p(j),label:le,labelText:H,lineEnding:se,link:p(T),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:Q,resourceDestinationString:E,resourceTitleString:D,resource:X,setextHeading:p(oe),setextHeadingLineSequence:te,setextHeadingText:O,strong:p(),thematicBreak:p()}};wS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ee){let ue={type:"root",children:[]};const be={stack:[ue],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:g,data:n},Be=[];let Fe=-1;for(;++Fe<ee.length;)if(ee[Fe][1].type==="listOrdered"||ee[Fe][1].type==="listUnordered")if(ee[Fe][0]==="enter")Be.push(Fe);else{const oi=Be.pop();Fe=a(ee,oi,Fe)}for(Fe=-1;++Fe<ee.length;){const oi=t[ee[Fe][0]];xS.call(oi,ee[Fe][1].type)&&oi[ee[Fe][1].type].call(Object.assign({sliceSerialize:ee[Fe][2].sliceSerialize},be),ee[Fe][1])}if(be.tokenStack.length>0){const oi=be.tokenStack[be.tokenStack.length-1];(oi[1]||ky).call(be,void 0,oi[0])}for(ue.position={start:kr(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:kr(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ue=t.transforms[Fe](ue)||ue;return ue}function a(ee,ue,be){let Be=ue-1,Fe=-1,oi=!1,nn,Ot,dt,ui;for(;++Be<=be;){const Ve=ee[Be];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Fe++:Fe--,ui=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(nn&&!ui&&!Fe&&!dt&&(dt=Be),ui=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ui=void 0}if(!Fe&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Fe===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(nn){let gi=Be;for(Ot=void 0;gi--;){const jt=ee[gi];if(jt[1].type==="lineEnding"||jt[1].type==="lineEndingBlank"){if(jt[0]==="exit")continue;Ot&&(ee[Ot][1].type="lineEndingBlank",oi=!0),jt[1].type="lineEnding",Ot=gi}else if(!(jt[1].type==="linePrefix"||jt[1].type==="blockQuotePrefix"||jt[1].type==="blockQuotePrefixWhitespace"||jt[1].type==="blockQuoteMarker"||jt[1].type==="listItemIndent"))break}dt&&(!Ot||dt<Ot)&&(nn._spread=!0),nn.end=Object.assign({},Ot?ee[Ot][1].start:Ve[1].end),ee.splice(Ot||Be,0,["exit",nn,Ve[2]]),Be++,be++}if(Ve[1].type==="listItemPrefix"){const gi={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};nn=gi,ee.splice(Be,0,["enter",gi,Ve[2]]),Be++,be++,dt=void 0,ui=!0}}}return ee[ue][1]._spread=oi,be}function o(ee,ue){return be;function be(Be){f.call(this,ee(Be),Be),ue&&ue.call(this,Be)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ee,ue,be){this.stack[this.stack.length-1].children.push(ee),this.stack.push(ee),this.tokenStack.push([ue,be||void 0]),ee.position={start:kr(ue.start),end:void 0}}function p(ee){return ue;function ue(be){ee&&ee.call(this,be),h.call(this,be)}}function h(ee,ue){const be=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ee.type&&(ue?ue.call(this,ee,Be[0]):(Be[1]||ky).call(this,ee,Be[0]));else throw new Error("Cannot close `"+ee.type+"` ("+xa({start:ee.start,end:ee.end})+"): it’s not open");be.position.end=kr(ee.end)}function g(){return Wd(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function b(ee){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(ee),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=ee}function x(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=ee}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function L(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ee.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ee.replace(/(\r?\n|\r)$/g,"")}function $(ee){const ue=this.resume(),be=this.stack[this.stack.length-1];be.label=ue,be.identifier=on(this.sliceSerialize(ee)).toLowerCase()}function I(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.title=ee}function Z(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.url=ee}function W(ee){const ue=this.stack[this.stack.length-1];if(!ue.depth){const be=this.sliceSerialize(ee).length;ue.depth=be}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function te(ee){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(ee).codePointAt(0)===61?1:2}function oe(){this.data.setextHeadingSlurpLineEnding=void 0}function me(ee){const be=this.stack[this.stack.length-1].children;let Be=be[be.length-1];(!Be||Be.type!=="text")&&(Be=zt(),Be.position={start:kr(ee.start),end:void 0},be.push(Be)),this.stack.push(Be)}function U(ee){const ue=this.stack.pop();ue.value+=this.sliceSerialize(ee),ue.position.end=kr(ee.end)}function se(ee){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=ue.children[ue.children.length-1];be.position.end=kr(ee.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(me.call(this,ee),U.call(this,ee))}function K(){this.data.atHardBreak=!0}function B(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ee}function A(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ee}function R(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ee}function T(){const ee=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ue,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 ue=this.data.referenceType||"shortcut";ee.type+="Reference",ee.referenceType=ue,delete ee.url,delete ee.title}else delete ee.identifier,delete ee.label;this.data.referenceType=void 0}function H(ee){const ue=this.sliceSerialize(ee),be=this.stack[this.stack.length-2];be.label=V5(ue),be.identifier=on(ue).toLowerCase()}function le(){const ee=this.stack[this.stack.length-1],ue=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Be=ee.children;be.children=Be}else be.alt=ue}function E(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.url=ee}function D(){const ee=this.resume(),ue=this.stack[this.stack.length-1];ue.title=ee}function X(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function Q(ee){const ue=this.resume(),be=this.stack[this.stack.length-1];be.label=ue,be.identifier=on(this.sliceSerialize(ee)).toLowerCase(),this.data.referenceType="full"}function fe(ee){this.data.characterReferenceType=ee.type}function de(ee){const ue=this.sliceSerialize(ee),be=this.data.characterReferenceType;let Be;be?(Be=fS(ue,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Yd(ue);const Fe=this.stack[this.stack.length-1];Fe.value+=Be}function Ce(ee){const ue=this.stack.pop();ue.position.end=kr(ee.end)}function ze(ee){U.call(this,ee);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(ee)}function Te(ee){U.call(this,ee);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(ee)}function st(){return{type:"blockquote",children:[]}}function Xe(){return{type:"code",lang:null,meta:null,value:""}}function xt(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xt(){return{type:"emphasis",children:[]}}function xn(){return{type:"heading",depth:0,children:[]}}function wn(){return{type:"break"}}function hs(){return{type:"html",value:""}}function Br(){return{type:"image",title:null,url:"",alt:null}}function Cn(){return{type:"link",title:null,url:"",children:[]}}function Ui(ee){return{type:"list",ordered:ee.type==="listOrdered",start:null,spread:ee._spread,children:[]}}function Nr(ee){return{type:"listItem",spread:ee._spread,checked:null,children:[]}}function fs(){return{type:"paragraph",children:[]}}function fl(){return{type:"strong",children:[]}}function zt(){return{type:"text",value:""}}function Zn(){return{type:"thematicBreak"}}}function kr(e){return{line:e.line,column:e.column,offset:e.offset}}function wS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?wS(e,s):$5(e,s)}}function $5(e,t){let n;for(n in t)if(xS.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 ky(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xa({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
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=
|
|
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=hl(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 CS(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 CS(e,t);const a={src:hl(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:hl(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 CS(e,t);const a={href:hl(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:hl(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):kS(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 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=
|
|
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=kS(n[s])}return t}function kS(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=Ud(t.children[1]),p=nS(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 Ey=9,Ty=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(Ay(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return o.push(Ay(t.slice(a),a>0,!1)),o.join("")}function Ay(e,t,n){let s=0,a=e.length;if(t){let o=e.codePointAt(s);for(;o===Ey||o===Ty;)s++,o=e.codePointAt(s)}if(n){let o=e.codePointAt(a-1);for(;o===Ey||o===Ty;)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:ru,yaml:ru,definition:ru,footnoteDefinition:ru};function ru(){}const ES=-1,Bu=0,Ca=1,wu=2,Kd=3,Xd=4,Gd=5,$d=6,TS=7,AS=8,Dy=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 Bu:case ES:return n(c,a);case Ca:{const f=n([],a);for(const p of c)f.push(s(p));return f}case wu:{const f=n({},a);for(const[p,h]of c)f[s(p)]=s(h);return f}case Kd:return n(new Date(c),a);case Xd:{const{source:f,flags:p}=c;return n(new RegExp(f,p),a)}case Gd:{const f=n(new Map,a);for(const[p,h]of c)f.set(s(p),s(h));return f}case $d:{const f=n(new Set,a);for(const p of c)f.add(s(p));return f}case TS:{const{name:f,message:p}=c;return n(new Dy[f](p),a)}case AS: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 Dy[o](c),a)};return s},Ry=e=>CT(new Map,e)(0),el="",{toString:kT}={},{keys:ET}=Object,ma=e=>{const t=typeof e;if(t!=="object"||!e)return[Bu,t];const n=kT.call(e).slice(8,-1);switch(n){case"Array":return[Ca,el];case"Object":return[wu,el];case"Date":return[Kd,el];case"RegExp":return[Xd,el];case"Map":return[Gd,el];case"Set":return[$d,el];case"DataView":return[Ca,n]}return n.includes("Array")?[Ca,n]:n.includes("Error")?[TS,n]:[wu,n]},su=([e,t])=>e===Bu&&(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]=ma(c);switch(f){case Bu:{let g=c;switch(p){case"bigint":f=AS,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return a([ES],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 wu:{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||!su(ma(c[b])))&&g.push([o(b),o(c[b])]);return _}case Kd:return a([f,c.toISOString()],c);case Xd:{const{source:g,flags:_}=c;return a([f,{source:g,flags:_}],c)}case Gd:{const g=[],_=a([f,g],c);for(const[b,y]of c)(e||!(su(ma(b))||su(ma(y))))&&g.push([o(b),o(y)]);return _}case $d:{const g=[],_=a([f,g],c);for(const b of c)(e||!su(ma(b)))&&g.push(o(b));return _}}const{message:h}=c;return a([f,{name:p,message:h}],c)};return o},My=(e,{json:t,lossy:n}={})=>{const s=[];return TT(!(t||n),!!t,new Map,s)(e),s},Da=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ry(My(e,t)):structuredClone(e):(e,t)=>Ry(My(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=hl(_.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 M={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(g,!0)};e.patch(h,M),f.push(M)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Da(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
|
|
110
|
+
`}]}}const Nu=(function(e){if(e==null)return LT;if(typeof e=="function")return Lu(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]=Nu(e[n]);return Lu(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 Lu(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 Lu(t);function t(n){return n&&n.type===e}}function Lu(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 DS=[],OT=!0,Sd=!1,jT="skip";function RS(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const o=Nu(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=DS,x,k,L;if((!t||o(p,h,g[g.length-1]||void 0))&&(y=HT(n(p,g)),y[0]===Sd))return y;if("children"in p&&p.children){const M=p;if(M.children&&y[0]!==jT)for(k=(s?M.children.length:-1)+c,L=g.concat(M);k>-1&&k<M.children.length;){const $=M.children[k];if(x=f($,k,L)(),x[0]===Sd)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?DS:[e]}function Zd(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),RS(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 xd={}.hasOwnProperty,PT={};function UT(e,t){const n=t||PT,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 Zd(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(xd.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,M=Da(L);return M.children=f.all(g),M}return Da(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=By(x.value)),!Array.isArray(x)&&x.type==="element")){const k=x.children[0];k&&k.type==="text"&&(k.value=By(k.value))}Array.isArray(x)?_.push(...x):_.push(x)}}}return _}}function IT(e,t){e.position&&(t.position=sS(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,Da(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&&!(xd.call(n,"hProperties")||xd.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
|
|
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 mf,Ny;function VT(){if(Ny)return mf;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 mf=function p(){var h,g,_,b,y,x,k=arguments[0],L=1,M=arguments.length,G=!1;for(typeof k=="boolean"&&(G=k,k=arguments[1]||{},L=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});L<M;++L)if(h=arguments[L],h!=null)for(g in h)_=f(k,g),b=f(h,g),k!==b&&(G&&b&&(o(b)||(y=a(b)))?(y?(y=!1,x=_&&a(_)?_:[]):x=_&&o(_)?_:{},c(k,{name:g,newValue:p(G,x,b)})):typeof b<"u"&&c(k,{name:g,newValue:b}));return k},mf}var KT=VT();const _f=xu(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 un={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');Da(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(Da(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){Da(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;)Da(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":e3(n)}function e3(e){Da(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 Da(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 gf=["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<gf.length;){const o=gf[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let a;for(a in n)gf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?un.basename(this.path):void 0}set basename(t){yf(t,"basename"),vf(t,"basename"),this.path=un.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?un.dirname(this.path):void 0}set dirname(t){Ly(this.basename,"dirname"),this.path=un.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?un.extname(this.path):void 0}set extname(t){if(vf(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=un.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Sd(t)&&(t=r3(t)),yf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?un.basename(this.path,this.extname):void 0}set stem(t){yf(t,"stem"),vf(t,"stem"),this.path=un.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 si(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 vf(e,t){if(e&&e.includes(un.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+un.sep+"`")}function yf(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(_f(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(xf("data",this.frozen),this.namespace[t]=n,this):o3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(xf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=nu(t),s=this.parser||this.Parser;return bf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),bf("process",this.parser||this.Parser),Sf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=nu(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(),bf("processSync",this.parser||this.Parser),Sf("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=nu(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=nu(n),a=this.compiler||this.Compiler;return Sf("stringify",a),zy(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(xf("use",this.frozen),t!=null)if(typeof t=="function")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=_f(!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=_f(!0,k,y)),s[b]=[h,y,...x]}}}}const u3=new $d().freeze();function bf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Sf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function xf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function 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 nu(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 ff)if(Object.hasOwn(ff,y)&&Object.hasOwn(g.properties,y)){const x=g.properties[y],k=ff[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=Ru((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 M=!1,G=[];b.lastIndex=0;let I=b.exec(h.value);for(;I;){const Z=I.index,W={index:I.index,input:I.input,stack:[...g,h]};let O=y(...I,W);if(typeof O=="string"&&(O=O.length>0?{type:"text",value:O}:void 0),O===!1?b.lastIndex=Z+1:(x!==Z&&G.push({type:"text",value:h.value.slice(x,Z)}),Array.isArray(O)?G.push(...O):O&&G.push(O),x=Z+I[0].length,M=!0),!b.global)break;I=b.exec(h.value)}return M?(x<h.value.length&&G.push({type:"text",value:h.value.slice(x)}),_.children.splice(L,1,...G)):G=[h],L+G.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 Py(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 wf="phrasing",Cf=["autolink","link","image","label"];function A3(){return{transforms:[z3],enter:{literalAutolink:R3,literalAutolinkEmail:kf,literalAutolinkHttp:kf,literalAutolinkWww:kf},exit:{literalAutolink:L3,literalAutolinkEmail:N3,literalAutolinkHttp:M3,literalAutolinkWww:B3}}}function D3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:wf,notInConstruct:Cf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:wf,notInConstruct:Cf},{character:":",before:"[ps]",after:"\\/",inConstruct:wf,notInConstruct:Cf}]}}function R3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function kf(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=P3(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 P3(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=Py(e,"(");let o=Py(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||ts(n)||Tu(n))&&(!t||n!==47)}BS.peek=X3;function U3(){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=en(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=en(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:U3,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?
|
|
116
|
-
`)}function lA(e){return e==null?"":String(e)}function
|
|
113
|
+
`}),n}function By(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ny(e,t){const n=UT(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=Ny(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Ny(n,{file:s,...e||t})}}function Ly(e){if(e)throw e}var vf,zy;function VT(){if(zy)return vf;zy=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 vf=function p(){var h,g,_,b,y,x,k=arguments[0],L=1,M=arguments.length,$=!1;for(typeof k=="boolean"&&($=k,k=arguments[1]||{},L=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});L<M;++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},vf}var KT=VT();const yf=ku(KT);function wd(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?GT(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 GT(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 gn={basename:$T,dirname:ZT,extname:QT,join:JT,sep:"/"};function $T(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ja(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(ja(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){ja(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;)ja(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":e3(n)}function e3(e){ja(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 ja(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 Cd(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(!Cd(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 bf=["history","path","basename","stem","extname","dirname"];class MS{constructor(t){let n;t?Cd(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<bf.length;){const o=bf[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)bf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?gn.basename(this.path):void 0}set basename(t){xf(t,"basename"),Sf(t,"basename"),this.path=gn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?gn.dirname(this.path):void 0}set dirname(t){Oy(this.basename,"dirname"),this.path=gn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?gn.extname(this.path):void 0}set extname(t){if(Sf(t,"extname"),Oy(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=gn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Cd(t)&&(t=r3(t)),xf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?gn.basename(this.path,this.extname):void 0}set stem(t){xf(t,"stem"),Sf(t,"stem"),this.path=gn.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 ai(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 Sf(e,t){if(e&&e.includes(gn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+gn.sep+"`")}function xf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Oy(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 Qd 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 Qd;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(yf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(kf("data",this.frozen),this.namespace[t]=n,this):o3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(kf("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=lu(t),s=this.parser||this.Parser;return wf("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),wf("process",this.parser||this.Parser),Cf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(o,c){const f=lu(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(),wf("processSync",this.parser||this.Parser),Cf("processSync",this.compiler||this.Compiler),this.process(t,a),Hy("processSync","process",n),s;function a(o,c){n=!0,Ly(o),s=c}}run(t,n,s){jy(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=lu(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),Hy("runSync","run",s),a;function o(c,f){Ly(c),a=f,s=!0}}stringify(t,n){this.freeze();const s=lu(n),a=this.compiler||this.Compiler;return Cf("stringify",a),jy(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(kf("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=yf(!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];wd(k)&&wd(y)&&(y=yf(!0,k,y)),s[b]=[h,y,...x]}}}}const u3=new Qd().freeze();function wf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kf(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 jy(e){if(!wd(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Hy(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function lu(e){return c3(e)?e:new MS(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",Py=[],Uy={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||Py,n=e.remarkPlugins||Py,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Uy}:Uy;return u3().use(Z5).use(n).use(YT,s).use(t)}function v3(e){const t=e.children||"",n=new MS;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 Zd(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 mf)if(Object.hasOwn(mf,y)&&Object.hasOwn(g.properties,y)){const x=g.properties[y],k=mf[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 BS(e,t,n){const a=Nu((n||{}).ignore||[]),o=x3(t);let c=-1;for(;++c<o.length;)RS(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 M=!1,$=[];b.lastIndex=0;let I=b.exec(h.value);for(;I;){const Z=I.index,W={index:I.index,input:I.input,stack:[...g,h]};let O=y(...I,W);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,M=!0),!b.global)break;I=b.exec(h.value)}return M?(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){BS(e,[/\r?\n|\r/g,E3])}function E3(){return{type:"break"}}function T3(){return function(e){k3(e)}}function Iy(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 Ef="phrasing",Tf=["autolink","link","image","label"];function A3(){return{transforms:[z3],enter:{literalAutolink:R3,literalAutolinkEmail:Af,literalAutolinkHttp:Af,literalAutolinkWww:Af},exit:{literalAutolink:L3,literalAutolinkEmail:N3,literalAutolinkHttp:M3,literalAutolinkWww:B3}}}function D3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ef,notInConstruct:Tf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ef,notInConstruct:Tf},{character:":",before:"[ps]",after:"\\/",inConstruct:Ef,notInConstruct:Tf}]}}function R3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Af(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){BS(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(!NS(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!H3(n)))return!1;const c=P3(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!NS(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 P3(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=Iy(e,"(");let o=Iy(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 NS(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||os(n)||Ru(n))&&(!t||n!==47)}LS.peek=X3;function U3(){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=on(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=on(this.sliceSerialize(e)).toLowerCase(),n.label=t}function K3(e){this.exit(e)}function X3(){return"["}function LS(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 G3(){return{enter:{gfmFootnoteCallString:U3,gfmFootnoteCall:I3,gfmFootnoteDefinitionLabelString:F3,gfmFootnoteDefinition:q3},exit:{gfmFootnoteCallString:W3,gfmFootnoteCall:Y3,gfmFootnoteDefinitionLabelString:V3,gfmFootnoteDefinition:K3}}}function $3(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:LS},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?zS:Z3))),h(),p}}function Z3(e,t,n){return t===0?e:zS(e,t,n)}function zS(e,t,n){return(n?"":" ")+e}const Q3=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];OS.peek=nA;function J3(){return{canContainEols:["delete"],enter:{strikethrough:tA},exit:{strikethrough:iA}}}function eA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q3}],handlers:{delete:OS}}}function tA(e){this.enter({type:"delete",children:[]},e)}function iA(e){this.exit(e)}function OS(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 M=-1;for(e[g].length>h&&(h=e[g].length);++M<e[g].length;){const $=lA(e[g][M]);if(n.alignDelimiters!==!1){const I=a($);L[M]=I,(p[M]===void 0||I>p[M])&&(p[M]=I)}k.push($)}c[g]=k,f[g]=L}let _=-1;if(typeof s=="object"&&"length"in s)for(;++_<h;)o[_]=Fy(s[_]);else{const k=Fy(s);for(;++_<h;)o[_]=k}_=-1;const b=[],y=[];for(;++_<h;){const k=o[_];let L="",M="";k===99?(L=":",M=":"):k===108?L=":":k===114&&(M=":");let $=n.alignDelimiters===!1?1:Math.max(1,p[_]-L.length-M.length);const I=L+"-".repeat($)+M;n.alignDelimiters!==!1&&($=L.length+$+M.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 M=[];for(;++_<h;){const $=k[_]||"";let I="",Z="";if(n.alignDelimiters!==!1){const W=p[_]-(L[_]||0),O=o[_];O===114?I=" ".repeat(W):O===99?W%2?(I=" ".repeat(W/2+.5),Z=" ".repeat(W/2-.5)):(I=" ".repeat(W/2),Z=I):Z=" ".repeat(W)}n.delimiterStart!==!1&&!_&&M.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&$==="")&&(n.delimiterStart!==!1||_)&&M.push(" "),n.alignDelimiters!==!1&&M.push(I),M.push($),n.alignDelimiters!==!1&&M.push(Z),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||_!==h-1)&&M.push("|")}x.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return x.join(`
|
|
116
|
+
`)}function lA(e){return e==null?"":String(e)}function Fy(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 qy(e,t.inConstruct,!0)&&!qy(e,t.notInConstruct,!1)}function qy(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 Wy(e,t,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
117
117
|
`&&uA(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
118
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 pA(e,t,n){return(n?"":" ")+e}function
|
|
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
|
|
121
|
+
`)),g+=f.move(p),h(),g}function pA(e,t,n){return(n?"":" ")+e}function Jd(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=Jd(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 Ra(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cu(e,t,n){const s=al(e),a=al(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}}jS.peek=gA;function jS(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=Cu(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=Ra(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=Cu(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+Ra(_));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 Zd(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Sd}),!!((!e.depth||e.depth<3)&&Wd(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=
|
|
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 M=_(y,k,L)
|
|
129
|
-
`))}function p(y,x,k,L){const M=k.enter("tableCell"),G=k.enter("phrasing"),I=k.containerPhrasing(y,{...L,before:o,after:o});return G(),M(),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 M=-1;const G=[],I=x.enter("table");for(;++M<L.length;)G[M]=_(L[M],x,k);return I(),G}function _(y,x,k){const L=y.children;let M=-1;const G=[],I=x.enter("tableRow");for(;++M<L.length;)G[M]=p(L[M],y,x,k);return I(),G}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(),PA(),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},In={name:"emailAutolink",tokenize:tD,previous:JS},dn={};function eD(){return{text:dn}}let Kr=48;for(;Kr<123;)dn[Kr]=In,Kr++,Kr===58?Kr=65:Kr===91&&(Kr=97);dn[43]=In;dn[45]=In;dn[46]=In;dn[95]=In;dn[72]=[In,GS];dn[104]=[In,GS];dn[87]=[In,$S];dn[119]=[In,$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||ri(_)?(o=!0,e.consume(_),p):g(_)}function h(_){return e.consume(_),a=!0,p}function g(_){return o&&a&&ui(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(ui(_)&&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||yu(_)||it(_)||ts(_)||Tu(_)?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||it(h)||ts(h)||h!==45&&Tu(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||it(c)||ts(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||it(f)||ts(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||it(f)||ts(f)?t(f):s(f)}function o(f){return ui(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):ui(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 ri(o)?n(o):t(o)}}function ZS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||it(e)}function QS(e){return!ui(e)}function JS(e){return!(e===47||xd(e))}function xd(e){return e===43||e===45||e===46||e===95||ri(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=en(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||it(_))return n(_);if(_===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(en(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return it(_)||(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||it(x))return n(x);if(x===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=en(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return it(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),Ie(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function mD(e,t,n){return e.check(Aa,t,e.attempt(uD,t,n))}function _D(e){e.exit("gfmFootnoteDefinition")}function gD(e,t,n){const s=this;return Ie(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&&Bi(b,b.length,0,Au(y,c.slice(h+1,p),f)),Bi(b,b.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Bi(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=Js(h);if(x===126)return _>1?p(x):(c.consume(x),_++,y);if(_<2&&!n)return p(x);const L=c.exit("strikethroughSequenceTemporary"),M=Js(x);return L._open=!M||M===2&&!!k,L._close=!k||k===2&&!!M,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(U){let se=s.events.length-1;for(;se>-1;){const A=s.events[se][1].type;if(A==="lineEnding"||A==="linePrefix")se--;else break}const V=se>-1?s.events[se][1].type:null,B=V==="tableHead"||V==="tableRow"?O:p;return B===O&&s.parser.lazy[s.now().line]?n(U):B(U)}function p(U){return e.enter("tableHead"),e.enter("tableRow"),h(U)}function h(U){return U===124||(c=!0,o+=1),g(U)}function g(U){return U===null?n(U):Se(U)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),y):n(U):je(U)?Ie(e,g,"whitespace")(U):(o+=1,c&&(c=!1,a+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),_(U)))}function _(U){return U===null||U===124||it(U)?(e.exit("data"),g(U)):(e.consume(U),U===92?b:_)}function b(U){return U===92||U===124?(e.consume(U),_):_(U)}function y(U){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(U):(e.enter("tableDelimiterRow"),c=!1,je(U)?Ie(e,x,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):x(U))}function x(U){return U===45||U===58?L(U):U===124?(c=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),k):W(U)}function k(U){return je(U)?Ie(e,L,"whitespace")(U):L(U)}function L(U){return U===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),M):U===45?(o+=1,M(U)):U===null||Se(U)?Z(U):W(U)}function M(U){return U===45?(e.enter("tableDelimiterFiller"),G(U)):W(U)}function G(U){return U===45?(e.consume(U),G):U===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(U))}function I(U){return je(U)?Ie(e,Z,"whitespace")(U):Z(U)}function Z(U){return U===124?x(U):U===null||Se(U)?!c||a!==o?W(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(U)):W(U)}function W(U){return n(U)}function O(U){return e.enter("tableRow"),te(U)}function te(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),te):U===null||Se(U)?(e.exit("tableRow"),t(U)):je(U)?Ie(e,te,"whitespace")(U):(e.enter("data"),ue(U))}function ue(U){return U===null||U===124||it(U)?(e.exit("data"),te(U)):(e.consume(U),U===92?_e:ue)}function _e(U){return U===92||U===124?(e.consume(U),ue):ue(U)}}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],_=ru(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],_=ru(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],_=ru(b,t,o,a,n,_)):c[1]!==0&&(_=ru(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 ru(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},$s(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=$s(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=$s(t.events,n[2]),g=$s(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({},$s(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Yy(e,t,n,s,a){const o=[],c=$s(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 $s(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 it(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 Se(p)?t(p):je(p)?e.check({tokenize:AD},t,n)(p):n(p)}}function AD(e,t,n){return Ie(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 Xr=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Vy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Xr,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Xr],h2:[["className","sr-only"]],img:[...Xr,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Xr,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Xr],table:[...Xr],ul:[...Xr,["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"]},Sr={}.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 Ra(o,t),o}}function LD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Ra(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&&Sr.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 Ra(c,t),c}function OD(e,t){const s={type:"root",children:t0(e,t.children)};return Ra(s,t),s}function jD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return Ra(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&&Sr.call(s,n)?s[n]:void 0,c=s&&Sr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(Sr.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&&Sr.call(a,n)){const g=a[n];for(h in g)Sr.call(g,h)&&!Sr.call(p,h)&&(p[h]=g[h])}return p}function Ky(e,t,n,s){return t?Array.isArray(s)?PD(e,t,n,s):i0(e,t,n,s):void 0}function PD(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")&&UD(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 UD(e,t,n){const s=e.schema.protocols&&Sr.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 Ra(e,t){const n=nS(t);t.data&&(e.data=Sa(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 Ks=["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"],Xs=["English","Chinese","Korean","Japanese","Spanish","French","Hindi","Arabic","Portuguese","Russian","Others"];function FD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a,walletAddress:o}){const[c,f]=$.useState(null),[p,h]=$.useState(!1),[g,_]=$.useState("preview"),[b,y]=$.useState(""),[x,k]=$.useState(!1),[L,M]=$.useState(!1),[G,I]=$.useState(!1),[Z,W]=$.useState(null),[O,te]=$.useState(Ks[0]),[ue,_e]=$.useState(Xs[0]),[U,se]=$.useState(!1),V=$.useRef(null),B=$.useRef(!1),[A,R]=$.useState(!1),[T,j]=$.useState(Ks[0]),[H,ae]=$.useState(Xs[0]),[E,D]=$.useState(!1),[K,C]=$.useState(null),[Q,fe]=$.useState(null),[de,Ce]=$.useState(!1),[Le,Ee]=$.useState(!1),[st,Ye]=$.useState(null),[xt,xe]=$.useState(!1),Vt=$.useRef(null),pn=$.useRef(null),Ni=$.useCallback(async()=>{if(!e||!t){f(null);return}const le=`${e}/${t}`,me=pn.current!==le;me&&(pn.current=le);try{const Te=await n(`/api/stories/${e}/${t}`);if(Te.ok){const Qe=await Te.json();f(Qe),(me||!B.current)&&(y(Qe.content??""),me&&(M(!1),B.current=!1))}}catch{}},[e,t,n]);$.useEffect(()=>{h(!0),Ni().finally(()=>h(!1))},[Ni]),$.useEffect(()=>{if(!e||!t||g==="edit"&&L)return;const le=setInterval(Ni,3e3);return()=>clearInterval(le)},[e,t,Ni,g,L]),$.useEffect(()=>{if(!e)return;let le=!1;return n(`/api/stories/${e}/structure.md`).then(me=>me.ok?me.json():null).then(me=>{if(le||!(me!=null&&me.content))return;const Te=me.content.match(/\*{0,2}genre\*{0,2}[:\s]+(.+)/i);if(Te){const nt=Te[1].replace(/\*+/g,"").trim(),Je=Ks.find(zt=>zt.toLowerCase()===nt.toLowerCase());Je&&te(Je)}const Qe=me.content.match(/\*{0,2}language\*{0,2}[:\s]+(.+)/i);if(Qe){const nt=Qe[1].replace(/\*+/g,"").trim(),Je=Xs.find(zt=>zt.toLowerCase()===nt.toLowerCase());Je&&_e(Je)}}).catch(()=>{}),()=>{le=!0}},[e,n]);const Fn=$.useCallback(async()=>{if(!(!e||!t)){k(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b})})).ok&&(M(!1),B.current=!1,f(me=>me&&{...me,content:b}))}catch{}k(!1)}},[e,t,n,b]),rs=$.useCallback(le=>{var Te;const me=(Te=le.target.files)==null?void 0:Te[0];if(me){if(me.size>500*1024){Ye("Image exceeds 500KB limit");return}if(!me.type.startsWith("image/")){Ye("File must be an image");return}C(me),fe(URL.createObjectURL(me)),Ye(null)}},[]),qn=$.useCallback(async()=>{if(c!=null&&c.storylineId){Ce(!0),Ye(null),xe(!1);try{let le;if(K){const Te=new FormData;Te.append("file",K);const Qe=await n("/api/publish/upload-cover",{method:"POST",body:Te});if(!Qe.ok){const Je=await Qe.json();throw new Error(Je.error||"Cover upload failed")}le=(await Qe.json()).cid}const me=await n("/api/publish/update-storyline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storylineId:c.storylineId,...le!==void 0&&{coverCid:le},genre:T,language:H,isNsfw:E})});if(!me.ok){const Te=await me.json();throw new Error(Te.error||"Update failed")}xe(!0),C(null),setTimeout(()=>xe(!1),3e3)}catch(le){Ye(le instanceof Error?le.message:"Update failed")}finally{Ce(!1)}}},[c==null?void 0:c.storylineId,K,T,H,E,n]);$.useEffect(()=>{R(!1),C(null),fe(null),Ye(null),xe(!1),Ee(!1)},[e,t]),$.useEffect(()=>{if(!A||!(c!=null&&c.storylineId))return;Ee(!1);const le="https://plotlink.xyz";let me=!1;return fetch(`${le}/api/storyline/${c.storylineId}`).then(Te=>Te.ok?Te.json():null).then(Te=>{if(!me){if(!Te){Ye("Could not load current story metadata");return}if(Te.genre){const Qe=Ks.find(nt=>nt.toLowerCase()===Te.genre.toLowerCase());Qe&&j(Qe)}if(Te.language){const Qe=Xs.find(nt=>nt.toLowerCase()===Te.language.toLowerCase());Qe&&ae(Qe)}Te.isNsfw!==void 0&&D(!!Te.isNsfw),Ee(!0)}}).catch(()=>{me||Ye("Could not load current story metadata")}),()=>{me=!0}},[A,c==null?void 0:c.storylineId]),$.useEffect(()=>{if(g!=="edit")return;const le=me=>{(me.metaKey||me.ctrlKey)&&me.key==="s"&&(me.preventDefault(),Fn())};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[g,Fn]),$.useEffect(()=>{if((c==null?void 0:c.status)!=="published-not-indexed"||!c.publishedAt)return;const le=new Date(c.publishedAt).getTime(),me=300*1e3,Te=()=>{const nt=Math.max(0,me-(Date.now()-le));W(nt)};Te();const Qe=setInterval(Te,1e3);return()=>clearInterval(Qe)},[c==null?void 0:c.status,c==null?void 0:c.publishedAt]);const mn=Z!==null&&Z<=0,Wn=Z!==null&&Z>0?`${Math.floor(Z/6e4)}:${String(Math.floor(Z%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(p&&!c)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const Er=(g==="edit"?b:(c==null?void 0:c.content)??"").length,vt=t==="genesis.md",_n=t?/^plot-\d+\.md$/.test(t):!1,ee=(c==null?void 0:c.status)==="published"||(c==null?void 0:c.status)==="published-not-indexed",ce=vt||_n?1e4:null,be=!ee&&ce!==null&&Er>ce;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]}),(c==null?void 0:c.status)==="published"&&S.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(c==null?void 0:c.status)==="published-not-indexed"&&S.jsx("span",{className:"text-amber-700 font-medium",title:c.indexError,children:"Published (not indexed)"}),(c==null?void 0:c.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 ${be?"text-error font-medium":"text-muted"}`,children:[Er.toLocaleString(),ce!==null?`/${ce.toLocaleString()}`:" chars"]}),be&&S.jsxs("span",{className:"text-error text-xs font-medium",children:[(Er-ce).toLocaleString()," over limit"]})]})]}),S.jsxs("div",{className:"flex px-3 gap-1",children:[S.jsx("button",{onClick:()=>_("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${g==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),S.jsxs("button",{onClick:()=>_("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${g==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",L&&S.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),g==="preview"?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:c!=null&&c.content?S.jsx("div",{className:"prose max-w-none",children:S.jsx(_3,{remarkPlugins:[T3,MD],rehypePlugins:[ID],children:c.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:V,value:b,onChange:le=>{y(le.target.value),M(!0),B.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:L?"Unsaved changes":"No changes"}),S.jsx("button",{onClick:Fn,disabled:!L||x,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:x?"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."}):(c==null?void 0:c.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"}),!mn&&S.jsx("button",{onClick:async()=>{if(!(!e||!t||!c.txHash)){I(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:c.txHash,content:c.content,storylineId:c.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:c.txHash,storylineId:c.storylineId,contentCid:"",gasCost:""})}),Ni())}catch{}I(!1)}},disabled:G,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:G?"Retrying...":`Retry Index${Wn?` (${Wn})`:""}`}),_n&&S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,O,ue,U)),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"}),c.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),S.jsx("p",{className:"text-muted text-xs",children:mn?_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."}),c.indexError&&S.jsx("p",{className:"text-error text-xs",children:c.indexError})]}):(c==null?void 0:c.status)==="published"?S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-green-700",children:"Published"}),c.storylineId&&S.jsx("a",{href:(()=>{var Te;const le=`https://plotlink.xyz/story/${c.storylineId}`;if(!_n)return le;const me=c.plotIndex!=null&&c.plotIndex>0?c.plotIndex:parseInt(((Te=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:Te[1])??"1");return`${le}/${me}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),c.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"}),vt&&o&&c.storylineId&&(!c.authorAddress||c.authorAddress.toLowerCase()===o.toLowerCase())&&S.jsx("button",{onClick:()=>R(le=>!le),className:"px-2 py-0.5 border border-border text-xs rounded hover:bg-surface",children:A?"Close Edit":"Edit Story"})]}),A&&vt&&c.storylineId&&S.jsxs("div",{className:"border border-border rounded p-3 flex flex-col gap-3 bg-surface",children:[S.jsxs("div",{className:"flex flex-col gap-1.5",children:[S.jsx("span",{className:"text-xs font-medium text-foreground",children:"Cover Image"}),S.jsxs("div",{className:"flex items-start gap-3",children:[Q&&S.jsxs("div",{className:"relative",children:[S.jsx("img",{src:Q,alt:"Cover preview",className:"w-16 h-24 object-cover rounded border border-border"}),S.jsx("button",{onClick:()=>{C(null),fe(null),Vt.current&&(Vt.current.value="")},className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-error text-white rounded-full text-xs flex items-center justify-center",children:"x"})]}),S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("input",{ref:Vt,type:"file",accept:"image/webp,image/jpeg,image/png",onChange:rs,className:"text-xs"}),S.jsx("span",{className:"text-xs text-muted",children:"WebP/JPEG, max 500KB, 600x900px recommended"})]})]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("select",{value:T,onChange:le=>j(le.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:Ks.map(le=>S.jsx("option",{value:le,children:le},le))}),S.jsx("select",{value:H,onChange:le=>ae(le.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:Xs.map(le=>S.jsx("option",{value:le,children:le},le))})]}),S.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:E,onChange:le=>D(le.target.checked),className:"rounded border-border"}),"This story contains adult content (18+)"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:qn,disabled:de||!Le,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:de?"Saving...":Le?"Save Changes":"Loading..."}),xt&&S.jsx("span",{className:"text-green-700 text-xs",children:"Updated!"}),st&&S.jsx("span",{className:"text-error text-xs",children:st})]})]})]}):S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[vt&&S.jsxs(S.Fragment,{children:[S.jsx("select",{value:O,onChange:le=>te(le.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:Ks.map(le=>S.jsx("option",{value:le,children:le},le))}),S.jsx("select",{value:ue,onChange:le=>_e(le.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:Xs.map(le=>S.jsx("option",{value:le,children:le},le))})]}),S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,O,ue,U)),disabled:!!a||be,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"}),be&&S.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]}),vt&&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:U,onChange:le=>se(le.target.checked),className:"rounded border-border"}),"This story contains adult content (18+)"]}),U&&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]=$.useState(null),[a,o]=$.useState(null),[c,f]=$.useState(null),[p,h]=$.useState(""),[g,_]=$.useState(null),[b,y]=$.useState(WD),[x,k]=$.useState([]),L=$.useRef(new Set),M=$.useRef(null),G=$.useRef(null),I=$.useRef(!1);$.useEffect(()=>{t("/api/wallet").then(A=>A.ok?A.json():null).then(A=>{A!=null&&A.address&&_(A.address)}).catch(()=>{})},[t]),$.useEffect(()=>{try{localStorage.setItem(n0,String(b))}catch{}},[b]),$.useEffect(()=>{const A=()=>{if(!G.current)return;const R=G.current.getBoundingClientRect().width-Tf-Af;y(T=>Gy(T,R))};return window.addEventListener("resize",A),A(),()=>window.removeEventListener("resize",A)},[]);const Z=$.useCallback(()=>{const A=`_new_${Date.now()}`;k(R=>[...R,A]),s(A),o(null)},[]);$.useEffect(()=>{if(x.length===0)return;const A=setInterval(async()=>{try{const R=await t("/api/stories");if(!R.ok)return;const T=await R.json(),j=new Set(T.stories.filter(H=>H.name!=="_example").map(H=>H.name));for(const H of j)if(!L.current.has(H)&&x.length>0){const ae=x[0];let E=!1;M.current&&(E=await M.current(ae,H).catch(()=>!1)),E&&k(D=>D.slice(1)),s(H),o(null)}L.current=j}catch{}},3e3);return()=>clearInterval(A)},[t,x]),$.useEffect(()=>{t("/api/stories").then(A=>{if(A.ok)return A.json()}).then(A=>{A!=null&&A.stories&&(L.current=new Set(A.stories.filter(R=>R.name!=="_example").map(R=>R.name)))}).catch(()=>{})},[t]);const W=$.useCallback((A,R)=>{s(A),o(R)},[]),O=$.useRef(null),te=$.useCallback(async A=>{var R,T,j,H;O.current=A,s(A),o(null);try{const ae=await t(`/api/stories/${A}`);if(ae.ok&&O.current===A){const D=(await ae.json()).files||[],C=((R=D.map(Q=>{var fe;return{file:Q.file,num:(fe=Q.file.match(/^plot-(\d+)\.md$/))==null?void 0:fe[1]}}).filter(Q=>Q.num!=null).sort((Q,fe)=>parseInt(fe.num)-parseInt(Q.num))[0])==null?void 0:R.file)??((T=D.find(Q=>Q.file==="genesis.md"))==null?void 0:T.file)??((j=D.find(Q=>Q.file==="structure.md"))==null?void 0:j.file)??((H=D[0])==null?void 0:H.file);C&&O.current===A&&o(C)}}catch{}},[t]),ue=$.useCallback(A=>{A.preventDefault(),I.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const R=j=>{if(!I.current||!G.current)return;const H=G.current.getBoundingClientRect(),ae=H.width-Tf-Af,E=j.clientX-H.left-Tf;y(Gy(E/ae,ae))},T=()=>{I.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",T)},[]),_e=$.useCallback(async(A,R,T,j,H)=>{var ae;f(R),h("Reading file...");try{const E=await t(`/api/stories/${A}/${R}`);if(!E.ok)throw new Error("Failed to read file");const D=await E.json(),K=D.content.match(/^#\s+(.+)$/m),C=K?K[1].slice(0,60):R.replace(".md","");let Q;if(R.match(/^plot-\d+\.md$/)){try{const Le=await t(`/api/stories/${A}`);if(Le.ok){const st=(await Le.json()).files.find(Ye=>Ye.file==="genesis.md"&&Ye.storylineId);Q=st==null?void 0:st.storylineId}}catch{}if(!Q){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const fe=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:A,fileName:R,title:C,content:D.content,genre:T,language:j,isNsfw:H,storylineId:Q})});if(!fe.ok){const Le=await fe.json();throw new Error(Le.error||"Publish failed")}const de=(ae=fe.body)==null?void 0:ae.getReader(),Ce=new TextDecoder;if(de)for(;;){const{done:Le,value:Ee}=await de.read();if(Le)break;const Ye=Ce.decode(Ee).split(`
|
|
130
|
-
`).filter(xt=>xt.startsWith("data: "));for(const xt of
|
|
127
|
+
`,...o.current()});return/^[\t ]/.test(h)&&(h=Ra(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),f(),h}HS.peek=bA;function HS(e){return e.value||""}function bA(){return"<"}PS.peek=SA;function PS(e,t,n,s){const a=Jd(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"!"}US.peek=xA;function US(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"!"}IS.peek=wA;function IS(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 FS(e,t){const n=Wd(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))}qS.peek=CA;function qS(e,t,n,s){const a=Jd(n),o=a==='"'?"Quote":"Apostrophe",c=n.createTracker(s);let f,p;if(FS(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 FS(e,n)?"<":"["}WS.peek=kA;function WS(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 ep(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=ep(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 YS(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):ep(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),YS(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||ep(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=Nu(["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}VS.peek=zA;function VS(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=Cu(s.before.charCodeAt(s.before.length-1),h,a);g.inside&&(p=Ra(h)+p.slice(1));const _=p.charCodeAt(p.length-1),b=Cu(s.after.charCodeAt(0),_,a);b.inside&&(p=p.slice(0,-1)+Ra(_));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=(YS(n)+(n.options.ruleSpaces?" ":"")).repeat(jA(n));return n.options.ruleSpaces?s.slice(0,-1):s}const KS={blockquote:aA,break:Wy,code:dA,definition:mA,emphasis:jS,hardBreak:Wy,heading:yA,html:HS,image:PS,imageReference:US,inlineCode:IS,link:qS,linkReference:WS,list:AA,listItem:RA,paragraph:MA,root:NA,strong:VS,text:OA,thematicBreak:HA};function PA(){return{enter:{table:UA,tableData:Yy,tableHeader:Yy,tableRow:FA},exit:{codeText:qA,table:IA,tableData:Df,tableHeader:Df,tableRow:Df}}}function UA(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 Df(e){this.exit(e)}function Yy(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 M=_(y,k,L),$=h([M]);return $.slice(0,$.indexOf(`
|
|
129
|
+
`))}function p(y,x,k,L){const M=k.enter("tableCell"),$=k.enter("phrasing"),I=k.containerPhrasing(y,{...L,before:o,after:o});return $(),M(),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 M=-1;const $=[],I=x.enter("table");for(;++M<L.length;)$[M]=_(L[M],x,k);return I(),$}function _(y,x,k){const L=y.children;let M=-1;const $=[],I=x.enter("tableRow");for(;++M<L.length;)$[M]=p(L[M],y,x,k);return I(),$}function b(y,x,k){let L=KS.inlineCode(y,x,k);return k.stack.includes("tableCell")&&(L=L.replace(/\|/g,"\\$&")),L}}function VA(){return{exit:{taskListCheckValueChecked:Vy,taskListCheckValueUnchecked:Vy,paragraph:XA}}}function KA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GA}}}function Vy(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 GA(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=KS.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 $A(){return[A3(),G3(),J3(),PA(),VA()]}function ZA(e){return{extensions:[D3(),$3(e),eA(),YA(e),KA()]}}const QA={tokenize:rD,partial:!0},XS={tokenize:sD,partial:!0},GS={tokenize:lD,partial:!0},$S={tokenize:aD,partial:!0},JA={tokenize:oD,partial:!0},ZS={name:"wwwAutolink",tokenize:iD,previous:JS},QS={name:"protocolAutolink",tokenize:nD,previous:e0},$n={name:"emailAutolink",tokenize:tD,previous:t0},Sn={};function eD(){return{text:Sn}}let es=48;for(;es<123;)Sn[es]=$n,es++,es===58?es=65:es===91&&(es=97);Sn[43]=$n;Sn[45]=$n;Sn[46]=$n;Sn[95]=$n;Sn[72]=[$n,QS];Sn[104]=[$n,QS];Sn[87]=[$n,ZS];Sn[119]=[$n,ZS];function tD(e,t,n){const s=this;let a,o;return c;function c(_){return!kd(_)||!t0.call(s,s.previous)||tp(s.events)?n(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return kd(_)?(e.consume(_),f):_===64?(e.consume(_),p):n(_)}function p(_){return _===46?e.check(JA,g,h)(_):_===45||_===95||li(_)?(o=!0,e.consume(_),p):g(_)}function h(_){return e.consume(_),a=!0,p}function g(_){return o&&a&&pi(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||!JS.call(s,s.previous)||tp(s.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(QA,e.attempt(XS,e.attempt(GS,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)&&e0.call(s,s.previous)&&!tp(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):n(_)}function f(_){if(pi(_)&&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||xu(_)||nt(_)||os(_)||Ru(_)?n(_):e.attempt(XS,e.attempt(GS,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($S,p,f)(h):h===null||nt(h)||os(h)||h!==45&&Ru(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($S,t,o)(c):c===null||nt(c)||os(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||nt(f)||os(f)?t(f):n(f)}function a(f){return f===null||f===40||f===91||nt(f)||os(f)?t(f):s(f)}function o(f){return pi(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),s):pi(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 li(o)?n(o):t(o)}}function JS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||nt(e)}function e0(e){return!pi(e)}function t0(e){return!(e===47||kd(e))}function kd(e){return e===43||e===45||e===46||e===95||li(e)}function tp(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=on(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||nt(_))return n(_);if(_===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return a.includes(on(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(_)}return nt(_)||(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||nt(x))return n(x);if(x===93){e.exit("chunkString");const k=e.exit("gfmFootnoteDefinitionLabelString");return o=on(s.sliceSerialize(k)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return nt(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),qe(e,y,"gfmFootnoteDefinitionWhitespace")):n(x)}function y(x){return t(x)}}function mD(e,t,n){return e.check(Oa,t,e.attempt(uD,t,n))}function _D(e){e.exit("gfmFootnoteDefinition")}function gD(e,t,n){const s=this;return qe(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&&Pi(b,b.length,0,Mu(y,c.slice(h+1,p),f)),Pi(b,b.length,0,[["exit",_,f],["enter",c[p][1],f],["exit",c[p][1],f],["exit",g,f]]),Pi(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=al(h);if(x===126)return _>1?p(x):(c.consume(x),_++,y);if(_<2&&!n)return p(x);const L=c.exit("strikethroughSequenceTemporary"),M=al(x);return L._open=!M||M===2&&!!k,L._close=!k||k===2&&!!M,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(U){let se=s.events.length-1;for(;se>-1;){const A=s.events[se][1].type;if(A==="lineEnding"||A==="linePrefix")se--;else break}const K=se>-1?s.events[se][1].type:null,B=K==="tableHead"||K==="tableRow"?O:p;return B===O&&s.parser.lazy[s.now().line]?n(U):B(U)}function p(U){return e.enter("tableHead"),e.enter("tableRow"),h(U)}function h(U){return U===124||(c=!0,o+=1),g(U)}function g(U){return U===null?n(U):Se(U)?o>1?(o=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),y):n(U):He(U)?qe(e,g,"whitespace")(U):(o+=1,c&&(c=!1,a+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),_(U)))}function _(U){return U===null||U===124||nt(U)?(e.exit("data"),g(U)):(e.consume(U),U===92?b:_)}function b(U){return U===92||U===124?(e.consume(U),_):_(U)}function y(U){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(U):(e.enter("tableDelimiterRow"),c=!1,He(U)?qe(e,x,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):x(U))}function x(U){return U===45||U===58?L(U):U===124?(c=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),k):W(U)}function k(U){return He(U)?qe(e,L,"whitespace")(U):L(U)}function L(U){return U===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),M):U===45?(o+=1,M(U)):U===null||Se(U)?Z(U):W(U)}function M(U){return U===45?(e.enter("tableDelimiterFiller"),$(U)):W(U)}function $(U){return U===45?(e.consume(U),$):U===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(U))}function I(U){return He(U)?qe(e,Z,"whitespace")(U):Z(U)}function Z(U){return U===124?x(U):U===null||Se(U)?!c||a!==o?W(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(U)):W(U)}function W(U){return n(U)}function O(U){return e.enter("tableRow"),te(U)}function te(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),te):U===null||Se(U)?(e.exit("tableRow"),t(U)):He(U)?qe(e,te,"whitespace")(U):(e.enter("data"),oe(U))}function oe(U){return U===null||U===124||nt(U)?(e.exit("data"),te(U)):(e.consume(U),U===92?me:oe)}function me(U){return U===92||U===124?(e.consume(U),oe):oe(U)}}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&&(Ky(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],_=au(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],_=au(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],_=au(b,t,o,a,n,_)):c[1]!==0&&(_=au(b,t,c,a,n,_)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&Ky(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 au(e,t,n,s,a,o){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},nl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=nl(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=nl(t.events,n[2]),g=nl(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({},nl(t.events,a)),e.add(a,0,[["exit",o,t]]),o=void 0),o}function Ky(e,t,n,s,a){const o=[],c=nl(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 nl(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 nt(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 Se(p)?t(p):He(p)?e.check({tokenize:AD},t,n)(p):n(p)}}function AD(e,t,n){return qe(e,s,"whitespace");function s(a){return a===null?n(a):t(a)}}function DD(e){return hS([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($A()),c.push(ZA(n))}const ts=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Xy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...ts,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...ts],h2:[["className","sr-only"]],img:[...ts,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...ts,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...ts],table:[...ts],ul:[...ts,["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"]},Tr={}.hasOwnProperty;function BD(e,t){let n={type:"root",children:[]};const s={schema:t?{...Xy,...t}:Xy,stack:[]},a=i0(s,e);return a&&(Array.isArray(a)?a.length===1?n=a[0]:n.children=a:n=a),n}function i0(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 Ha(o,t),o}}function LD(e,t){if(e.schema.allowDoctypes){const n={type:"doctype"};return Ha(n,t),n}}function zD(e,t){const n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);const s=n0(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&&Tr.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 Ha(c,t),c}function OD(e,t){const s={type:"root",children:n0(e,t.children)};return Ha(s,t),s}function jD(e,t){const s={type:"text",value:typeof t.value=="string"?t.value:""};return Ha(s,t),s}function n0(e,t){const n=[];if(Array.isArray(t)){const s=t;let a=-1;for(;++a<s.length;){const o=i0(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&&Tr.call(s,n)?s[n]:void 0,c=s&&Tr.call(s,"*")?s["*"]:void 0,f=t&&typeof t=="object"?t:{},p={};let h;for(h in f)if(Tr.call(f,h)){const g=f[h];let _=Gy(e,$y(o,h),h,g);_==null&&(_=Gy(e,$y(c,h),h,g)),_!=null&&(p[h]=_)}if(a&&Tr.call(a,n)){const g=a[n];for(h in g)Tr.call(g,h)&&!Tr.call(p,h)&&(p[h]=g[h])}return p}function Gy(e,t,n,s){return t?Array.isArray(s)?PD(e,t,n,s):r0(e,t,n,s):void 0}function PD(e,t,n,s){let a=-1;const o=[];for(;++a<s.length;){const c=r0(e,t,n,s[a]);(typeof c=="number"||typeof c=="string")&&o.push(c)}return o}function r0(e,t,n,s){if(!(typeof s!="boolean"&&typeof s!="number"&&typeof s!="string")&&UD(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 UD(e,t,n){const s=e.schema.protocols&&Tr.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 Ha(e,t){const n=sS(t);t.data&&(e.data=Da(t.data)),n&&(e.position=n)}function $y(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 tl=["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"],il=["English","Chinese","Korean","Japanese","Spanish","French","Hindi","Arabic","Portuguese","Russian","Others"];function FD({storyName:e,fileName:t,authFetch:n,onPublish:s,publishingFile:a,walletAddress:o}){const[c,f]=V.useState(null),[p,h]=V.useState(!1),[g,_]=V.useState("preview"),[b,y]=V.useState(""),[x,k]=V.useState(!1),[L,M]=V.useState(!1),[$,I]=V.useState(!1),[Z,W]=V.useState(null),[O,te]=V.useState(tl[0]),[oe,me]=V.useState(il[0]),[U,se]=V.useState(!1),K=V.useRef(null),B=V.useRef(!1),[A,R]=V.useState(!1),[T,j]=V.useState(tl[0]),[H,le]=V.useState(il[0]),[E,D]=V.useState(!1),[X,C]=V.useState(null),[Q,fe]=V.useState(null),[de,Ce]=V.useState(!1),[ze,Te]=V.useState(!1),[st,Xe]=V.useState(null),[xt,xe]=V.useState(!1),Xt=V.useRef(null),[xn,wn]=V.useState(!1),[hs,Br]=V.useState(!1),[Cn,Ui]=V.useState(null),[Nr,fs]=V.useState([]),[fl,zt]=V.useState(null),Zn=V.useRef(null),ee=V.useRef(null),ue=V.useCallback(async()=>{if(!e||!t){f(null);return}const ce=`${e}/${t}`,ve=ee.current!==ce;ve&&(ee.current=ce);try{const ke=await n(`/api/stories/${e}/${t}`);if(ke.ok){const tt=await ke.json();f(tt),(ve||!B.current)&&(y(tt.content??""),ve&&(M(!1),B.current=!1))}}catch{}},[e,t,n]);V.useEffect(()=>{h(!0),ue().finally(()=>h(!1))},[ue]),V.useEffect(()=>{if(!e||!t||g==="edit"&&L)return;const ce=setInterval(ue,3e3);return()=>clearInterval(ce)},[e,t,ue,g,L]),V.useEffect(()=>{if(!e)return;let ce=!1;return n(`/api/stories/${e}/structure.md`).then(ve=>ve.ok?ve.json():null).then(ve=>{if(ce||!(ve!=null&&ve.content))return;const ke=ve.content.match(/\*{0,2}genre\*{0,2}[:\s]+(.+)/i);if(ke){const ci=ke[1].replace(/\*+/g,"").trim(),vi=tl.find(Lr=>Lr.toLowerCase()===ci.toLowerCase());vi&&te(vi)}const tt=ve.content.match(/\*{0,2}language\*{0,2}[:\s]+(.+)/i);if(tt){const ci=tt[1].replace(/\*+/g,"").trim(),vi=il.find(Lr=>Lr.toLowerCase()===ci.toLowerCase());vi&&me(vi)}}).catch(()=>{}),()=>{ce=!0}},[e,n]);const be=V.useCallback(async()=>{if(!(!e||!t)){k(!0);try{(await n(`/api/stories/${e}/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b})})).ok&&(M(!1),B.current=!1,f(ve=>ve&&{...ve,content:b}))}catch{}k(!1)}},[e,t,n,b]),Be=V.useCallback(ce=>{var ke;const ve=(ke=ce.target.files)==null?void 0:ke[0];if(ve){if(ve.size>500*1024){Xe("Image exceeds 500KB limit");return}if(!ve.type.startsWith("image/")){Xe("File must be an image");return}C(ve),fe(URL.createObjectURL(ve)),Xe(null)}},[]),Fe=V.useCallback(async ce=>{if(ce.size>500*1024){Ui("Image exceeds 500KB limit");return}if(!["image/webp","image/jpeg"].includes(ce.type)){Ui("Only WebP and JPEG images are accepted");return}Br(!0),Ui(null);try{const ke=new FormData;ke.append("file",ce);const tt=await n("/api/publish/upload-plot-image",{method:"POST",body:ke});if(!tt.ok){const vi=await tt.json();throw new Error(vi.error||"Upload failed")}const ci=await tt.json();fs(vi=>[...vi,{cid:ci.cid,url:ci.url}])}catch(ke){Ui(ke instanceof Error?ke.message:"Upload failed")}finally{Br(!1),Zn.current&&(Zn.current.value="")}},[n]),oi=V.useCallback(ce=>{var ke;const ve=(ke=ce.target.files)==null?void 0:ke[0];ve&&Fe(ve)},[Fe]),nn=V.useCallback(async()=>{if(c!=null&&c.storylineId){Ce(!0),Xe(null),xe(!1);try{let ce;if(X){const ke=new FormData;ke.append("file",X);const tt=await n("/api/publish/upload-cover",{method:"POST",body:ke});if(!tt.ok){const vi=await tt.json();throw new Error(vi.error||"Cover upload failed")}ce=(await tt.json()).cid}const ve=await n("/api/publish/update-storyline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storylineId:c.storylineId,...ce!==void 0&&{coverCid:ce},genre:T,language:H,isNsfw:E})});if(!ve.ok){const ke=await ve.json();throw new Error(ke.error||"Update failed")}xe(!0),C(null),setTimeout(()=>xe(!1),3e3)}catch(ce){Xe(ce instanceof Error?ce.message:"Update failed")}finally{Ce(!1)}}},[c==null?void 0:c.storylineId,X,T,H,E,n]);V.useEffect(()=>{R(!1),C(null),fe(null),Xe(null),xe(!1),Te(!1),wn(!1),fs([]),Ui(null)},[e,t]),V.useEffect(()=>{if(!A||!(c!=null&&c.storylineId))return;Te(!1);const ce="https://plotlink.xyz";let ve=!1;return fetch(`${ce}/api/storyline/${c.storylineId}`).then(ke=>ke.ok?ke.json():null).then(ke=>{if(!ve){if(!ke){Xe("Could not load current story metadata");return}if(ke.genre){const tt=tl.find(ci=>ci.toLowerCase()===ke.genre.toLowerCase());tt&&j(tt)}if(ke.language){const tt=il.find(ci=>ci.toLowerCase()===ke.language.toLowerCase());tt&&le(tt)}ke.isNsfw!==void 0&&D(!!ke.isNsfw),Te(!0)}}).catch(()=>{ve||Xe("Could not load current story metadata")}),()=>{ve=!0}},[A,c==null?void 0:c.storylineId]),V.useEffect(()=>{if(g!=="edit")return;const ce=ve=>{(ve.metaKey||ve.ctrlKey)&&ve.key==="s"&&(ve.preventDefault(),be())};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[g,be]),V.useEffect(()=>{if((c==null?void 0:c.status)!=="published-not-indexed"||!c.publishedAt)return;const ce=new Date(c.publishedAt).getTime(),ve=300*1e3,ke=()=>{const ci=Math.max(0,ve-(Date.now()-ce));W(ci)};ke();const tt=setInterval(ke,1e3);return()=>clearInterval(tt)},[c==null?void 0:c.status,c==null?void 0:c.publishedAt]);const Ot=Z!==null&&Z<=0,dt=Z!==null&&Z>0?`${Math.floor(Z/6e4)}:${String(Math.floor(Z%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(p&&!c)return S.jsx("div",{className:"h-full flex items-center justify-center text-muted",children:"Loading..."});const Ve=(g==="edit"?b:(c==null?void 0:c.content)??"").length,gi=t==="genesis.md",jt=t?/^plot-\d+\.md$/.test(t):!1,zu=(c==null?void 0:c.status)==="published"||(c==null?void 0:c.status)==="published-not-indexed",un=gi||jt?1e4:null,kn=!zu&&un!==null&&Ve>un;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]}),(c==null?void 0:c.status)==="published"&&S.jsx("span",{className:"text-green-700 font-medium",children:"Published"}),(c==null?void 0:c.status)==="published-not-indexed"&&S.jsx("span",{className:"text-amber-700 font-medium",title:c.indexError,children:"Published (not indexed)"}),(c==null?void 0:c.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 ${kn?"text-error font-medium":"text-muted"}`,children:[Ve.toLocaleString(),un!==null?`/${un.toLocaleString()}`:" chars"]}),kn&&S.jsxs("span",{className:"text-error text-xs font-medium",children:[(Ve-un).toLocaleString()," over limit"]})]})]}),S.jsxs("div",{className:"flex px-3 gap-1",children:[S.jsx("button",{onClick:()=>_("preview"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${g==="preview"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:"Preview"}),S.jsxs("button",{onClick:()=>_("edit"),className:`px-3 py-1 text-xs font-medium border-b-2 transition-colors ${g==="edit"?"border-accent text-accent":"border-transparent text-muted hover:text-foreground"}`,children:["Edit",L&&S.jsx("span",{className:"ml-1 text-amber-600",children:"*"})]})]})]}),g==="preview"?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 py-4",style:{background:"var(--paper-bg)"},children:c!=null&&c.content?S.jsx("div",{className:"prose max-w-none",children:S.jsx(_3,{remarkPlugins:[T3,MD],rehypePlugins:[ID],children:c.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:K,value:b,onChange:ce=>{y(ce.target.value),M(!0),B.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:L?"Unsaved changes":"No changes"}),S.jsx("button",{onClick:be,disabled:!L||x,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50 disabled:cursor-not-allowed",children:x?"Saving...":"Save"})]}),jt&&S.jsxs("div",{className:"px-3 py-1.5 border-t border-border",children:[S.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:xn,onChange:ce=>wn(ce.target.checked),className:"rounded border-border"}),"Add illustrations in the plot"]}),xn&&S.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[S.jsxs("div",{className:"border-2 border-dashed border-border rounded p-3 flex flex-col items-center gap-1.5 cursor-pointer hover:border-accent transition-colors",onClick:()=>{var ce;return(ce=Zn.current)==null?void 0:ce.click()},onDragOver:ce=>{ce.preventDefault(),ce.stopPropagation()},onDrop:ce=>{var ke;ce.preventDefault(),ce.stopPropagation();const ve=(ke=ce.dataTransfer.files)==null?void 0:ke[0];ve&&Fe(ve)},children:[S.jsx("input",{ref:Zn,type:"file",accept:"image/webp,image/jpeg",onChange:oi,className:"hidden"}),S.jsx("span",{className:"text-xs text-muted",children:hs?"Uploading...":"Drop image here or click to browse"}),S.jsx("span",{className:"text-xs text-muted",children:"WebP/JPEG, max 500KB"})]}),Cn&&S.jsx("span",{className:"text-error text-xs",children:Cn}),Nr.map((ce,ve)=>S.jsxs("div",{className:"border border-border rounded p-2 flex flex-col gap-1 bg-surface",children:[S.jsx("span",{className:"text-xs text-green-700",children:"Image uploaded! Copy the markdown below and paste it where you want the illustration to appear in your plot:"}),S.jsxs("div",{className:"flex items-center gap-1.5",children:[S.jsxs("code",{className:"flex-1 text-xs bg-background px-2 py-1 rounded font-mono break-all",children:[""]}),S.jsx("button",{onClick:()=>{navigator.clipboard.writeText(``),zt(ve),setTimeout(()=>zt(null),2e3)},className:"px-2 py-1 text-xs border border-border rounded hover:bg-surface shrink-0",children:fl===ve?"Copied!":"Copy"})]})]},ce.cid))]})]})]}),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."}):(c==null?void 0:c.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"}),!Ot&&S.jsx("button",{onClick:async()=>{if(!(!e||!t||!c.txHash)){I(!0);try{(await(await n("/api/publish/retry-index",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:e,fileName:t,txHash:c.txHash,content:c.content,storylineId:c.storylineId})})).json()).ok&&(await n(`/api/stories/${e}/${t}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:c.txHash,storylineId:c.storylineId,contentCid:"",gasCost:""})}),ue())}catch{}I(!1)}},disabled:$,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:$?"Retrying...":`Retry Index${dt?` (${dt})`:""}`}),jt&&S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,O,oe,U)),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"}),c.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"})]}),S.jsx("p",{className:"text-muted text-xs",children:Ot?jt?"Index window expired. Use Retry Publish to create a new on-chain tx.":"Index window expired. Contact support or re-publish manually.":jt?"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."}),c.indexError&&S.jsx("p",{className:"text-error text-xs",children:c.indexError})]}):(c==null?void 0:c.status)==="published"?S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:"text-green-700",children:"Published"}),c.storylineId&&S.jsx("a",{href:(()=>{var ke;const ce=`https://plotlink.xyz/story/${c.storylineId}`;if(!jt)return ce;const ve=c.plotIndex!=null&&c.plotIndex>0?c.plotIndex:parseInt(((ke=t==null?void 0:t.match(/^plot-(\d+)\.md$/))==null?void 0:ke[1])??"1");return`${ce}/${ve}`})(),target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"View on PlotLink"}),c.txHash&&S.jsx("a",{href:`https://basescan.org/tx/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",className:"text-muted underline",children:"BaseScan"}),gi&&o&&c.storylineId&&(!c.authorAddress||c.authorAddress.toLowerCase()===o.toLowerCase())&&S.jsx("button",{onClick:()=>R(ce=>!ce),className:"px-2 py-0.5 border border-border text-xs rounded hover:bg-surface",children:A?"Close Edit":"Edit Story"})]}),A&&gi&&c.storylineId&&S.jsxs("div",{className:"border border-border rounded p-3 flex flex-col gap-3 bg-surface",children:[S.jsxs("div",{className:"flex flex-col gap-1.5",children:[S.jsx("span",{className:"text-xs font-medium text-foreground",children:"Cover Image"}),S.jsxs("div",{className:"flex items-start gap-3",children:[Q&&S.jsxs("div",{className:"relative",children:[S.jsx("img",{src:Q,alt:"Cover preview",className:"w-16 h-24 object-cover rounded border border-border"}),S.jsx("button",{onClick:()=>{C(null),fe(null),Xt.current&&(Xt.current.value="")},className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-error text-white rounded-full text-xs flex items-center justify-center",children:"x"})]}),S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("input",{ref:Xt,type:"file",accept:"image/webp,image/jpeg,image/png",onChange:Be,className:"text-xs"}),S.jsx("span",{className:"text-xs text-muted",children:"WebP/JPEG, max 500KB, 600x900px recommended"})]})]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("select",{value:T,onChange:ce=>j(ce.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:tl.map(ce=>S.jsx("option",{value:ce,children:ce},ce))}),S.jsx("select",{value:H,onChange:ce=>le(ce.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:il.map(ce=>S.jsx("option",{value:ce,children:ce},ce))})]}),S.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:E,onChange:ce=>D(ce.target.checked),className:"rounded border-border"}),"This story contains adult content (18+)"]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:nn,disabled:de||!ze,className:"px-3 py-1 bg-accent text-white text-xs rounded hover:bg-accent-dim disabled:opacity-50",children:de?"Saving...":ze?"Save Changes":"Loading..."}),xt&&S.jsx("span",{className:"text-green-700 text-xs",children:"Updated!"}),st&&S.jsx("span",{className:"text-error text-xs",children:st})]})]})]}):S.jsxs("div",{className:"flex flex-col gap-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[gi&&S.jsxs(S.Fragment,{children:[S.jsx("select",{value:O,onChange:ce=>te(ce.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:tl.map(ce=>S.jsx("option",{value:ce,children:ce},ce))}),S.jsx("select",{value:oe,onChange:ce=>me(ce.target.value),className:"px-2 py-1.5 text-xs border border-border rounded bg-surface text-foreground",children:il.map(ce=>S.jsx("option",{value:ce,children:ce},ce))})]}),S.jsx("button",{onClick:()=>e&&t&&(s==null?void 0:s(e,t,O,oe,U)),disabled:!!a||kn,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"}),kn&&S.jsx("span",{className:"text-error text-xs",children:"Reduce content to publish"})]}),gi&&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:U,onChange:ce=>se(ce.target.checked),className:"rounded border-border"}),"This story contains adult content (18+)"]}),U&&S.jsx("span",{className:"text-xs text-amber-600",children:"Adult content will be hidden from the default browse view."})]})]})})]})}const s0="plotlink-panel-ratio",qD=.6,Zy=300,Rf=224,Mf=6;function WD(){try{const e=localStorage.getItem(s0);if(e){const t=parseFloat(e);if(t>0&&t<1)return t}}catch{}return qD}function Qy(e,t){if(t<=0)return e;const n=Zy/t,s=1-Zy/t;return n>=s?.5:Math.min(s,Math.max(n,e))}function YD({token:e,authFetch:t}){const[n,s]=V.useState(null),[a,o]=V.useState(null),[c,f]=V.useState(null),[p,h]=V.useState(""),[g,_]=V.useState(null),[b,y]=V.useState(WD),[x,k]=V.useState([]),L=V.useRef(new Set),M=V.useRef(null),$=V.useRef(null),I=V.useRef(!1);V.useEffect(()=>{t("/api/wallet").then(A=>A.ok?A.json():null).then(A=>{A!=null&&A.address&&_(A.address)}).catch(()=>{})},[t]),V.useEffect(()=>{try{localStorage.setItem(s0,String(b))}catch{}},[b]),V.useEffect(()=>{const A=()=>{if(!$.current)return;const R=$.current.getBoundingClientRect().width-Rf-Mf;y(T=>Qy(T,R))};return window.addEventListener("resize",A),A(),()=>window.removeEventListener("resize",A)},[]);const Z=V.useCallback(()=>{const A=`_new_${Date.now()}`;k(R=>[...R,A]),s(A),o(null)},[]);V.useEffect(()=>{if(x.length===0)return;const A=setInterval(async()=>{try{const R=await t("/api/stories");if(!R.ok)return;const T=await R.json(),j=new Set(T.stories.filter(H=>H.name!=="_example").map(H=>H.name));for(const H of j)if(!L.current.has(H)&&x.length>0){const le=x[0];let E=!1;M.current&&(E=await M.current(le,H).catch(()=>!1)),E&&k(D=>D.slice(1)),s(H),o(null)}L.current=j}catch{}},3e3);return()=>clearInterval(A)},[t,x]),V.useEffect(()=>{t("/api/stories").then(A=>{if(A.ok)return A.json()}).then(A=>{A!=null&&A.stories&&(L.current=new Set(A.stories.filter(R=>R.name!=="_example").map(R=>R.name)))}).catch(()=>{})},[t]);const W=V.useCallback((A,R)=>{s(A),o(R)},[]),O=V.useRef(null),te=V.useCallback(async A=>{var R,T,j,H;O.current=A,s(A),o(null);try{const le=await t(`/api/stories/${A}`);if(le.ok&&O.current===A){const D=(await le.json()).files||[],C=((R=D.map(Q=>{var fe;return{file:Q.file,num:(fe=Q.file.match(/^plot-(\d+)\.md$/))==null?void 0:fe[1]}}).filter(Q=>Q.num!=null).sort((Q,fe)=>parseInt(fe.num)-parseInt(Q.num))[0])==null?void 0:R.file)??((T=D.find(Q=>Q.file==="genesis.md"))==null?void 0:T.file)??((j=D.find(Q=>Q.file==="structure.md"))==null?void 0:j.file)??((H=D[0])==null?void 0:H.file);C&&O.current===A&&o(C)}}catch{}},[t]),oe=V.useCallback(A=>{A.preventDefault(),I.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const R=j=>{if(!I.current||!$.current)return;const H=$.current.getBoundingClientRect(),le=H.width-Rf-Mf,E=j.clientX-H.left-Rf;y(Qy(E/le,le))},T=()=>{I.current=!1,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",T)},[]),me=V.useCallback(async(A,R,T,j,H)=>{var le;f(R),h("Reading file...");try{const E=await t(`/api/stories/${A}/${R}`);if(!E.ok)throw new Error("Failed to read file");const D=await E.json(),X=D.content.match(/^#\s+(.+)$/m),C=X?X[1].slice(0,60):R.replace(".md","");let Q;if(R.match(/^plot-\d+\.md$/)){try{const ze=await t(`/api/stories/${A}`);if(ze.ok){const st=(await ze.json()).files.find(Xe=>Xe.file==="genesis.md"&&Xe.storylineId);Q=st==null?void 0:st.storylineId}}catch{}if(!Q){h("Error: Publish genesis first to create the storyline"),setTimeout(()=>{f(null),h("")},3e3);return}}h("Publishing...");const fe=await t("/api/publish/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyName:A,fileName:R,title:C,content:D.content,genre:T,language:j,isNsfw:H,storylineId:Q})});if(!fe.ok){const ze=await fe.json();throw new Error(ze.error||"Publish failed")}const de=(le=fe.body)==null?void 0:le.getReader(),Ce=new TextDecoder;if(de)for(;;){const{done:ze,value:Te}=await de.read();if(ze)break;const Xe=Ce.decode(Te).split(`
|
|
130
|
+
`).filter(xt=>xt.startsWith("data: "));for(const xt of Xe)try{const xe=JSON.parse(xt.slice(6));xe.step&&h(xe.message||xe.step),xe.step==="done"&&xe.txHash&&await t(`/api/stories/${A}/${R}/publish-status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({txHash:xe.txHash,storylineId:xe.storylineId,plotIndex:xe.plotIndex,contentCid:xe.contentCid,gasCost:xe.gasCost,indexError:xe.indexError,authorAddress:g})})}catch{}}h("Published!")}catch(E){const D=E instanceof Error?E.message:"Publish failed";h(`Error: ${D}`)}finally{setTimeout(()=>{f(null),h("")},3e3)}},[t]),U=V.useCallback(A=>{A.startsWith("_new_")&&k(R=>R.filter(T=>T!==A))},[]),[se,K]=V.useState(new Set);V.useEffect(()=>{t("/api/stories").then(R=>R.ok?R.json():null).then(R=>{R!=null&&R.stories&&K(new Set(R.stories.filter(T=>T.hasStructure).map(T=>T.name)))}).catch(()=>{});const A=setInterval(async()=>{try{const R=await t("/api/stories");if(R.ok){const T=await R.json();K(new Set(T.stories.filter(j=>j.hasStructure).map(j=>j.name)))}}catch{}},5e3);return()=>clearInterval(A)},[t]);const B=V.useCallback(A=>{n===A&&(s(null),o(null))},[n]);return S.jsxs("div",{ref:$,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:W,onNewStory:Z,untitledSessions:x})}),S.jsx("div",{className:"min-w-0 border-r border-border",style:{flex:`${b} 0 0`},children:S.jsx(lk,{token:e,storyName:n,authFetch:t,onSelectStory:te,onDestroySession:U,onArchiveStory:B,confirmedStories:se,renameRef:M})}),S.jsx("div",{onMouseDown:oe,className:"flex-shrink-0 flex items-center justify-center hover:bg-border/50 transition-colors",style:{width:Mf,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-b} 0 0`},children:[S.jsx(FD,{storyName:n,fileName:a,authFetch:t,onPublish:me,publishingFile:c,walletAddress:g}),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]=V.useState(!1),[a,o]=V.useState(null),[c,f]=V.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 V.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]=V.useState("home"),[a,o]=V.useState(0),c=V.useCallback(async(f,p)=>fetch(f,{...p,headers:{...(p==null?void 0:p.headers)||{},Authorization:`Bearer ${e}`}}),[e]);return V.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(ib,{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]=V.useState(()=>localStorage.getItem("ows-token")),[n,s]=V.useState(null),[a,o]=V.useState(!0);V.useEffect(()=>{fetch("/api/auth/status").then(h=>h.json()).then(h=>s(h.configured)).catch(()=>s(null))},[]),V.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,{})}));
|